qemu-e2k/hw/acpi
Igor Mammedov 0e84fd3b98 x86: pcihp: fix missing bridge AML when intermediate root-port has 'hotplug=off' set
(I practice [1] hasn't broke anything since on hardware side we unset
hotplug_handler on such intermediate port => hotplug behind it has
never worked)

When deciding if bridge should be described, the original
condition was

  cold_plugged_bridge && pcihp_bridge_en

which was replaced [1] by

  bridge has ACPI_PCIHP_PROP_BSEL

the later however is not the same thing as the original
and flips to false if intermediate bridge has hotplug
turned off (root-port with 'hotplug=off' option).

Since we already in build_pci_bridge_aml(), the question
if it's bridge is answered. Use DeviceState::hotplugged
to make decision if bridge should describe its slots.

What's left out is pcihp_bridge_en, which tells us if
ACPI bridge hotplug is enabled.

With hotplug and non hotplug part now being mostly
separated, omitting this check will only lead to
colplugged bridges describe occupied slots in case
when ACPI bridge hotplug is disabled.
Which makes behavior consistent with occupied slots
on hostbridge.

Ex (pc/DSDT.hpbrroot diff):
  ...
               Device (S20)
               {
                   Name (_ADR, 0x00040000)  // _ADR: Address
  +                Device (S08)
  +                {
  +                    Name (_ADR, 0x00010000)  // _ADR: Address
  +                }
  +
  +                Device (S10)
  +                {
  +                    Name (_ADR, 0x00020000)  // _ADR: Address
  +                }
               }
  ...

PS:
testing shows that above doesn't affect adversely guest OS
behavior: i.e. if ACPI bridge hotplug is enabled it's
expected behaviour, and with ACPI bridge hotplug is disabled
(a.k. native hotplug), it doesn't break slot enumeration
nor native hotplug. (tested with RHEL9.0 and WS2022).

1)
Fixes: 6c36ec46b0 ("pcihp: make bridge describe itself using AcpiDevAmlIfClass:build_dev_aml")
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230302161543.286002-10-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2023-03-07 12:38:59 -05:00
..
acpi_interface.c
acpi-cpu-hotplug-stub.c
acpi-mem-hotplug-stub.c
acpi-nvdimm-stub.c
acpi-pci-hotplug-stub.c
acpi-qmp-cmds.c acpi: Move the QMP command from monitor/ to hw/acpi/ 2023-02-04 07:56:54 +01:00
acpi-stub.c hw/acpi: Dumb down acpi_table_add() stub 2023-02-23 14:10:17 +01:00
acpi-x86-stub.c
aml-build-stub.c
aml-build.c
bios-linker-loader.c
core.c
cpu_hotplug.c
cpu.c
cxl-stub.c
cxl.c
erst.c
generic_event_device.c
ghes-stub.c
ghes.c
hmat.c
hmat.h
ich9_tco.c hw: Move ich9.h to southbridge/ 2023-02-27 22:29:01 +01:00
ich9.c hw: Move ich9.h to southbridge/ 2023-02-27 22:29:01 +01:00
ipmi-stub.c
ipmi.c
Kconfig pcihp: make bridge describe itself using AcpiDevAmlIfClass:build_dev_aml 2023-01-28 06:21:29 -05:00
memory_hotplug.c
meson.build acpi: Move the QMP command from monitor/ to hw/acpi/ 2023-02-04 07:56:54 +01:00
nvdimm.c
pci-bridge-stub.c pcihp: make bridge describe itself using AcpiDevAmlIfClass:build_dev_aml 2023-01-28 06:21:29 -05:00
pci-bridge.c x86: pcihp: fix missing bridge AML when intermediate root-port has 'hotplug=off' set 2023-03-07 12:38:59 -05:00
pci.c
pcihp.c
piix4.c Drop duplicate #include 2023-02-08 07:28:05 +01:00
tpm.c
trace-events
trace.h
utils.c
viot.c
viot.h
vmgenid.c hw/acpi: Move QMP command to hw/core/ 2023-02-23 14:10:17 +01:00