qemu/hw/acpi
Igor Mammedov 6b0969f1ec acpi: pcihp: pcie: set power on cap on parent slot
on creation a PCIDevice has power turned on at the end of pci_qdev_realize()
however later on if PCIe slot isn't populated with any children
it's power is turned off. It's fine if native hotplug is used
as plug callback will power slot on among other things.
However when ACPI hotplug is enabled it replaces native PCIe plug
callbacks with ACPI specific ones (acpi_pcihp_device_*plug_cb) and
as result slot stays powered off. It works fine as ACPI hotplug
on guest side takes care of enumerating/initializing hotplugged
device. But when later guest is migrated, call chain introduced by]
commit d5daff7d31 (pcie: implement slot power control for pcie root ports)

   pcie_cap_slot_post_load()
       -> pcie_cap_update_power()
           -> pcie_set_power_device()
               -> pci_set_power()
                   -> pci_update_mappings()

will disable earlier initialized BARs for the hotplugged device
in powered off slot due to commit 23786d1344 (pci: implement power state)
which disables BARs if power is off.

Fix it by setting PCI_EXP_SLTCTL_PCC to PCI_EXP_SLTCTL_PWR_ON
on slot (root port/downstream port) at the time a device
hotplugged into it. As result PCI_EXP_SLTCTL_PWR_ON is migrated
to target and above call chain keeps device plugged into it
powered on.

Fixes: d5daff7d31 ("pcie: implement slot power control for pcie root ports")
Fixes: 23786d1344 ("pci: implement power state")
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2053584
Suggested-by: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220301151200.3507298-3-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2022-03-06 05:08:23 -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-stub.c
acpi-x86-stub.c
aml-build-stub.c
aml-build.c acpi: fix OEM ID/OEM Table ID padding 2022-02-04 09:07:43 -05:00
bios-linker-loader.c
core.c
cpu_hotplug.c
cpu.c Remove unnecessary minimum_version_id_old fields 2022-01-28 15:38:23 +01:00
erst.c hw/acpi/erst: clean up unused IS_UEFI_CPER_RECORD macro 2022-03-04 08:30:52 -05:00
generic_event_device.c
ghes-stub.c
ghes.c
hmat.c
hmat.h
ich9.c Remove unnecessary minimum_version_id_old fields 2022-01-28 15:38:23 +01:00
ipmi-stub.c
ipmi.c
Kconfig ACPI ERST: support for ACPI ERST feature 2022-02-06 04:33:50 -05:00
memory_hotplug.c hw/acpi/memory_hotplug: Remove unused 'hw/acpi/pc-hotplug.h' header 2022-02-21 10:18:06 +01:00
meson.build configure, meson: move TPM check to meson 2022-02-21 10:35:53 +01:00
nvdimm.c
pci.c
pcihp.c acpi: pcihp: pcie: set power on cap on parent slot 2022-03-06 05:08:23 -05:00
piix4.c Remove unnecessary minimum_version_id_old fields 2022-01-28 15:38:23 +01:00
tco.c Remove unnecessary minimum_version_id_old fields 2022-01-28 15:38:23 +01:00
tpm.c
trace-events ACPI ERST: support for ACPI ERST feature 2022-02-06 04:33:50 -05:00
trace.h
utils.c
viot.c
viot.h
vmgenid.c