qemu/hw/acpi
Igor Mammedov 2940a4b9e3 pci: acpihp: assign BSEL only to coldplugged bridges
ACPI PCI hotplug would broken after bridge hotplug and then migration
if hotplugged bridge were specified on target at command line.
Currently it's not possible since, 'hotplugged' property was made
read-only for some time now.

The issue would happen due to BSEL being assigned to all bridges
during 1st 'reset':
 source seq:
   1. start 'pc' machine => sets BSEL to 0 on pci.0 (host-bridge)
   2. hotplug bridge, no bsel is assigned (so far is ok)
 target seq:
   1. start 'pc' machine with
        -S -device pci-bridge,id=hp_br,hotplugged=on
      BSEL gets assigned to as follows
        hp_br: 0
        pci.0: 1
as result hotplug requests with migrated AML generated on source
would be misdirected to 'hp_br' instead of intended pci.0

While it's not issue at the moment, it's based on implicit assumptions
 * 'hotplugged' property is read-only
 * 1st reset happens before QEMU drops into monitor mode
   which lets add hotplugged on source bridges as hotplugged ones
   (anything added at that stage counts as hotplugged
    (yet another assumption))

All of it looks too fragile to me, so lets restrict BSEL only
to cold-plugged bridges explicitly.

Migration wise it shouldn't break anything since assignment order
stays the same:
  * user can't specify 'hotplugged=on' on CLI
  * user can't specify 'hotplugged=off' at monitor stage or later
on older QEMU versions where 'hotplugged' is RW, hotplug is broken
after migration anyways and we cannot do anything to fix that.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230112140312.3096331-12-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2023-01-28 06:21:29 -05:00
..
acpi-cpu-hotplug-stub.c hw/acpi: refactor acpi hp modules so that targets can just use what they need 2021-09-04 09:07:46 -04:00
acpi-mem-hotplug-stub.c hw/acpi: refactor acpi hp modules so that targets can just use what they need 2021-09-04 09:07:46 -04:00
acpi-nvdimm-stub.c hw/acpi: refactor acpi hp modules so that targets can just use what they need 2021-09-04 09:07:46 -04:00
acpi-pci-hotplug-stub.c acpi: fix acpi_index migration 2022-04-06 20:03:26 +01:00
acpi-stub.c Include qmp-commands.h exactly where needed 2018-02-09 13:52:10 +01:00
acpi-x86-stub.c hw/acpi/acpi_dev_interface: Remove unused parameter from AcpiDeviceIfClass::madt_cpu 2023-01-27 11:47:02 -05:00
acpi_interface.c hw/isa/isa-bus: Turn isa_build_aml() into qbus_build_aml() 2023-01-27 11:47:02 -05:00
aml-build-stub.c acpi: pc: vga: use AcpiDevAmlIf interface to build VGA device descriptors 2022-11-07 14:00:29 -05:00
aml-build.c hw/acpi/aml-build: Only generate cluster node in PPTT when specified 2023-01-08 01:54:23 -05:00
bios-linker-loader.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
core.c qapi acpi: Elide redundant has_FOO in generated C 2022-12-13 18:31:37 +01:00
cpu.c hw/acpi/acpi_dev_interface: Remove unused parameter from AcpiDeviceIfClass::madt_cpu 2023-01-27 11:47:02 -05:00
cpu_hotplug.c acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block 2023-01-08 01:54:23 -05:00
cxl-stub.c acpi/cxl: Add _OSC implementation (9.14.2) 2022-05-13 06:13:36 -04:00
cxl.c hw/acpi/cxl: Pass in the CXLState directly rather than MachineState 2022-06-09 19:32:49 -04:00
erst.c include/hw/pci: Split pci_device.h off pci.h 2023-01-08 01:54:22 -05:00
generic_event_device.c hw/acpi: Add ospm_status hook implementation for acpi-ged 2022-09-22 16:38:28 +01:00
ghes-stub.c hw/acpi: Provide function acpi_ghes_present() 2021-06-21 16:49:37 +01:00
ghes.c Fix 'writeable' typos 2022-06-08 19:38:47 +01:00
hmat.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
hmat.h acpi: Permit OEM ID and OEM table ID fields to be changed 2021-02-05 08:52:59 -05:00
ich9.c hw/acpi: Rename tco.c -> ich9_tco.c 2022-12-21 07:32:24 -05:00
ich9_tco.c hw/acpi: Rename tco.c -> ich9_tco.c 2022-12-21 07:32:24 -05:00
ipmi-stub.c acpi: ipmi: use AcpiDevAmlIf interface to build IPMI device descriptors 2022-06-09 19:32:49 -04:00
ipmi.c acpi: ipmi: use AcpiDevAmlIf interface to build IPMI device descriptors 2022-06-09 19:32:49 -04:00
Kconfig hw/acpi/Kconfig: Add missing dependencies to ACPI_PIIX4 2023-01-08 01:54:21 -05:00
memory_hotplug.c qapi qdev qom: Elide redundant has_FOO in generated C 2022-12-14 20:05:07 +01:00
meson.build hw/acpi/Kconfig: Rename ACPI_X86_ICH to ACPI_ICH9 2023-01-08 01:54:21 -05:00
nvdimm.c acpi/nvdimm: Implement ACPI NVDIMM Label Methods 2022-11-02 06:56:31 -04:00
pci.c acpi: build_mcfg: use acpi_table_begin()/acpi_table_end() instead of build_header() 2021-10-05 17:30:57 -04:00
pcihp.c pci: acpihp: assign BSEL only to coldplugged bridges 2023-01-28 06:21:29 -05:00
piix4.c pcihp: piix4: do not call acpi_pcihp_reset() when ACPI PCI hotplug is disabled 2023-01-28 06:21:29 -05:00
tpm.c docs: fix references to docs/specs/tpm.rst 2021-06-02 06:51:09 +02:00
trace-events hw/acpi: add trace events for TCO watchdog register access 2022-12-21 06:35:28 -05:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
utils.c acpi: Set proper maximum size for "etc/acpi/rsdp" blob 2021-03-22 18:58:19 -04:00
viot.c hw/acpi/viot: sort VIOT ACPI table entries by PCI host bridge min_bus 2022-06-09 19:32:49 -04:00
viot.h hw/acpi: Add VIOT table 2021-11-01 18:49:10 -04:00
vmgenid.c acpi: vmgenid_build_acpi: use acpi_table_begin()/acpi_table_end() instead of build_header() 2021-10-05 17:30:57 -04:00