pci(pc/q35): acpi-index support on non-hotpluggable slots
v2 cover pci(pc/q35): acpi-index support on non-hotpluggable slots
Changelog:
v2:
* rebase on top mst's pull request
* revert
3aa50aa253 ("tests/qtest: Check for devices in bios-tables-test")
which broke acpi tables test and rebuild due to skipping some tests even thought none of devices tests depend on weren't disabled that resulted in stale expected tables and merge conflicts.
Series extends acpi-index support to host-bridge(s) and bridges with disabled hotplug (either explicitly or implicitly).
Whats new (it is still limited to 'pc' and 'q35' machines), acpi-index now works for non-hotpluggable slots/nics:
* q35: host-bridge
* pc: host-bridge with disabled hotplug 'PIIX4_PM.acpi-root-pci-hotplug=off'
* non-hotpluggable multifunction nics
* on non-hotpluggable slots with native hotplug (i.e. without ACPI PCI hotplug) PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off
+ pcie-root-port,hotplug=off | pci-bridge,shpc=off
where it doesn't work (and never will):
* on hotplugged ports/bridges
* on hotpluggable ports/bridges with native hotplug
1-12/34: fixes for bugs or odd behavior
14-24/34: non-hotplug/multifunction acpi-index enabling 29-34/34: cleanups
all of that is peppered by extra acpi tests or extensions to existing ones
Somewhat tested with RHEL9.0 and WS2022.
What's in queue:
* PXB support
* microvm and arm/virt support
all of above only for non-hotpluggable slots as I don't really want to pull there complicated APCI PCI hotplug.
gitlab tree: https://gitlab.com/imammedo/qemu/-/tree/acpi_index_non_hotplug_v2
Igor Mammedov (34):
Revert "tests/qtest: Check for devices in bios-tables-test"
tests: acpi: whitelist new q35.noacpihp test and pc.hpbrroot
tests: acpi: add test_acpi_q35_tcg_no_acpi_hotplug test and extend
test_acpi_piix4_no_acpi_pci_hotplug
tests: acpi: update expected blobs
tests: acpi: whitelist q35/DSDT.multi-bridge before extending testcase
tests: acpi: extend multi-bridge case with case
'root-port,id=HOHP,hotplug=off root-port,bus=NOHP'
x86: pcihp: fix missing PCNT callchain when intermediate root-port has
'hotplug=off' set
tests: acpi: whitelist pc/DSDT.hpbrroot and pc/DSDT.hpbridge tests
x86: pcihp: fix missing bridge AML when intermediate root-port has
'hotplug=off' set
tests: acpi: update expected blobs
pcihp: piix4: do not redirect hotplug controller to piix4 when ACPI
hotplug is disabled
pci: fix 'hotplugglable' property behavior
tests: acpi: whitelist DSDT blobs before isolating PCI _DSM func 0
prolog
pcihp: move PCI _DSM function 0 prolog into separate function
tests: acpi: update expected blobs
tests: acpi: whitelist DSDT before adding EDSM method
acpi: pci: add EDSM method to DSDT
tests: acpi: update expected blobs
tests: acpi: whitelist DSDT before adding device with acpi-index to
testcases
tests: acpi: add device with acpi-index on non-hotpluggble bus
acpi: pci: support acpi-index for non-hotpluggable devices
tests: acpi: update expected blobs
tests: acpi: whitelist DSDT before exposing non zero functions
acpi: pci: describe all functions on populated slots
tests: acpi: update expected blobs
tests: acpi: whitelist DSDT before adding non-0 function device with
acpi-index to testcases
tests: acpi: add non zero function device with acpi-index on
non-hotpluggble bus
tests: acpi: update expected blobs
pci: move acpi-index uniqueness check to generic PCI device code
acpi: pci: drop BSEL usage when deciding that device isn't
hotpluggable
acpi: pci: move BSEL into build_append_pcihp_slots()
acpi: pci: move out ACPI PCI hotplug generator from generic slot
generator build_append_pci_bus_devices()
pcihp: move fields enabling hotplug into AcpiPciHpState
pcihp: add ACPI PCI hotplug specific is_hotpluggable_bus() callback
include/hw/acpi/ich9.h | 1 + include/hw/acpi/pcihp.h | 11 +- include/hw/acpi/piix4.h | 2 - include/hw/hotplug.h | 2 + include/hw/qdev-core.h | 13 +- hw/acpi/acpi-pci-hotplug-stub.c | 9 +- hw/acpi/ich9.c | 21 +- hw/acpi/pci-bridge.c | 14 +- hw/acpi/pcihp.c | 112 +++-------- hw/acpi/piix4.c | 33 ++-- hw/i386/acpi-build.c | 179 +++++++++++++----- hw/isa/lpc_ich9.c | 1 + hw/pci/pci.c | 57 ++++++ hw/pci/pcie_port.c | 8 + tests/data/acpi/pc/DSDT | Bin 6360 -> 6488 bytes tests/data/acpi/pc/DSDT.acpierst | Bin 6283 -> 6411 bytes tests/data/acpi/pc/DSDT.acpihmat | Bin 7685 -> 7813 bytes tests/data/acpi/pc/DSDT.bridge | Bin 12487 -> 12615 bytes tests/data/acpi/pc/DSDT.cphp | Bin 6824 -> 6952 bytes tests/data/acpi/pc/DSDT.dimmpxm | Bin 8014 -> 8142 bytes tests/data/acpi/pc/DSDT.hpbridge | Bin 6289 -> 6451 bytes tests/data/acpi/pc/DSDT.hpbrroot | Bin 3081 -> 3343 bytes tests/data/acpi/pc/DSDT.ipmikcs | Bin 6432 -> 6560 bytes tests/data/acpi/pc/DSDT.memhp | Bin 7719 -> 7847 bytes tests/data/acpi/pc/DSDT.nohpet | Bin 6218 -> 6346 bytes tests/data/acpi/pc/DSDT.numamem | Bin 6366 -> 6494 bytes tests/data/acpi/pc/DSDT.roothp | Bin 9745 -> 9873 bytes tests/data/acpi/q35/DSDT | Bin 8252 -> 8361 bytes tests/data/acpi/q35/DSDT.acpierst | Bin 8269 -> 8378 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9577 -> 9686 bytes tests/data/acpi/q35/DSDT.acpihmat-noinitiator | Bin 8531 -> 8640 bytes tests/data/acpi/q35/DSDT.applesmc | Bin 8298 -> 8407 bytes tests/data/acpi/q35/DSDT.bridge | Bin 11481 -> 11590 bytes tests/data/acpi/q35/DSDT.core-count2 | Bin 32392 -> 32501 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8716 -> 8825 bytes tests/data/acpi/q35/DSDT.cxl | Bin 9564 -> 9673 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9906 -> 10015 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 8327 -> 8436 bytes tests/data/acpi/q35/DSDT.ipmismbus | Bin 8340 -> 8449 bytes tests/data/acpi/q35/DSDT.ivrs | Bin 8269 -> 8378 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9611 -> 9720 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 9382 -> 9491 bytes tests/data/acpi/q35/DSDT.multi-bridge | Bin 12337 -> 12770 bytes tests/data/acpi/q35/DSDT.noacpihp | Bin 0 -> 8248 bytes tests/data/acpi/q35/DSDT.nohpet | Bin 8110 -> 8219 bytes tests/data/acpi/q35/DSDT.numamem | Bin 8258 -> 8367 bytes tests/data/acpi/q35/DSDT.pvpanic-isa | Bin 8353 -> 8462 bytes tests/data/acpi/q35/DSDT.tis.tpm12 | Bin 8858 -> 8967 bytes tests/data/acpi/q35/DSDT.tis.tpm2 | Bin 8884 -> 8993 bytes tests/data/acpi/q35/DSDT.viot | Bin 9361 -> 9470 bytes tests/data/acpi/q35/DSDT.xapic | Bin 35615 -> 35724 bytes tests/qtest/bios-tables-test.c | 125 +++++------- 52 files changed, 345 insertions(+), 243 deletions(-) create mode 100644 tests/data/acpi/q35/DSDT.noacpihp
Signature · 1 line
2.39.1
PATCH v2 1/34 Revert "tests/qtest: Check for devices in bios-tables-test"
This reverts commit c471eb4f40445908c1be7bb11a37ac676a0edae7.
which broke acpi tables test and rebuild due to skipping some tests even thought none of devices tests depend on weren't disabled.
As result it leads to some expected tables not being updated, merge conflicts and tests failure.
---
CC: Fabiano Rosas <[email protected]>
tests/qtest/bios-tables-test.c | 75 ++-------------------------------- 1 file changed, 4 insertions(+), 71 deletions(-)
tests/qtest/bios-tables-test.c +4 -71
@@ -1008,12 +1008,6 @@ static void test_acpi_q35_multif_bridge(void) .machine = MACHINE_Q35, .variant = ".multi-bridge", }; - -if (!qtest_has_device ("pcie-root-port" )) { -g_test_skip ("Device pcie-root-port is not available" ); - goto out; - } -test_vm_prepare ("-S" " -device virtio-balloon,id=balloon0,addr=0x4.0x2" " -device pcie-root-port,id=rp0,multifunction=on,"
@@ -1049,7 +1043,6 @@ static void test_acpi_q35_multif_bridge(void)/* check that reboot/reset doesn't change any ACPI tables */ qtest_qmp_send (data.qts,"{'execute':'system_reset' }" );process_acpi_tables (&data); -out:free_test_data (&data); }
@@ -1403,11 +1396,6 @@ static void test_acpi_tcg_dimm_pxm(const char *machine) {test_data data; -if (!qtest_has_device ("nvdimm" )) { -g_test_skip ("Device nvdimm is not available" ); -return ; - } -memset (&data,0 ,sizeof (data)); data.machine = machine; data.variant =".dimmpxm" ;
@@ -1456,11 +1444,6 @@ static void test_acpi_virt_tcg_memhp(void) .scan_len = 256ULL * 1024 * 1024, }; -if (!qtest_has_device ("nvdimm" )) { -g_test_skip ("Device nvdimm is not available" ); - goto out; - } - data.variant =".memhp" ;test_acpi_one (" -machine nvdimm=on" " -cpu cortex-a57"
@@ -1474,7 +1457,7 @@ static void test_acpi_virt_tcg_memhp(void)" -device pc-dimm,id=dimm0,memdev=ram2,node=0" " -device nvdimm,id=dimm1,memdev=nvm0,node=1" , &data); -out: +free_test_data (&data); }
@@ -1492,11 +1475,6 @@ static void test_acpi_microvm_tcg(void) {test_data data; -if (!qtest_has_device ("virtio-blk-device" )) { -g_test_skip ("Device virtio-blk-device is not available" ); -return ; - } -test_acpi_microvm_prepare (&data);test_acpi_one (" -machine microvm,acpi=on,ioapic2=off,rtc=off" , &data);
@@ -1507,11 +1485,6 @@ static void test_acpi_microvm_usb_tcg(void) {test_data data; -if (!qtest_has_device ("virtio-blk-device" )) { -g_test_skip ("Device virtio-blk-device is not available" ); -return ; - } -test_acpi_microvm_prepare (&data); data.variant =".usb" ; test_acpi_one(" -machine microvm,acpi=on,ioapic2=off,usb=on,rtc=off",
@@ -1523,11 +1496,6 @@ static void test_acpi_microvm_rtc_tcg(void) {test_data data; -if (!qtest_has_device ("virtio-blk-device" )) { -g_test_skip ("Device virtio-blk-device is not available" ); -return ; - } -test_acpi_microvm_prepare (&data); data.variant =".rtc" ; test_acpi_one(" -machine microvm,acpi=on,ioapic2=off,rtc=on",
@@ -1539,11 +1507,6 @@ static void test_acpi_microvm_pcie_tcg(void) {test_data data; -if (!qtest_has_device ("virtio-blk-device" )) { -g_test_skip ("Device virtio-blk-device is not available" ); -return ; - } -test_acpi_microvm_prepare (&data); data.variant =".pcie" ; data.tcg_only = true;/* need constant host-phys-bits */
@@ -1556,11 +1519,6 @@ static void test_acpi_microvm_ioapic2_tcg(void) {test_data data; -if (!qtest_has_device ("virtio-blk-device" )) { -g_test_skip ("Device virtio-blk-device is not available" ); -return ; - } -test_acpi_microvm_prepare (&data); data.variant =".ioapic2" ; test_acpi_one(" -machine microvm,acpi=on,ioapic2=on,rtc=off",
@@ -1600,12 +1558,6 @@ static void test_acpi_virt_tcg_pxb(void) .ram_start = 0x40000000ULL, .scan_len = 128ULL * 1024 * 1024, }; - -if (!qtest_has_device ("pcie-root-port" )) { -g_test_skip ("Device pcie-root-port is not available" ); - goto out; - } -/* * While using -cdrom, the cdrom would auto plugged into pxb-pcie, * the reason is the bus of pxb-pcie is also root bus, it would lead
@@ -1624,7 +1576,7 @@ static void test_acpi_virt_tcg_pxb(void)" -cpu cortex-a57" " -device pxb-pcie,bus_nr=128" , &data); -out: +free_test_data (&data); }
@@ -1812,12 +1764,6 @@ static void test_acpi_microvm_acpi_erst(void)gchar *params;test_data data; -if (!qtest_has_device ("virtio-blk-device" )) { -g_test_skip ("Device virtio-blk-device is not available" ); -g_free (tmp_path); -return ; - } -test_acpi_microvm_prepare (&data); data.variant =".pcie" ; data.tcg_only = true;/* need constant host-phys-bits */
@@ -1878,11 +1824,6 @@ static void test_acpi_q35_viot(void) .variant = ".viot", }; -if (!qtest_has_device ("virtio-iommu" )) { -g_test_skip ("Device virtio-iommu is not available" ); - goto out; - } -/* * To keep things interesting, two buses bypass the IOMMU. * VIOT should only describes the other two buses.
@@ -1893,7 +1834,6 @@ static void test_acpi_q35_viot(void)"-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on " "-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0" , &data); -out:free_test_data (&data); }
@@ -1954,10 +1894,8 @@ static void test_acpi_virt_viot(void) .scan_len = 128ULL * 1024 * 1024, }; -if (qtest_has_device ("virtio-iommu" )) { -test_acpi_one ("-cpu cortex-a57 " -"-device virtio-iommu-pci" , &data); - } +test_acpi_one ("-cpu cortex-a57 " +"-device virtio-iommu-pci" , &data);free_test_data (&data); }
@@ -2066,11 +2004,6 @@ static void test_acpi_microvm_oem_fields(void)test_data data;char *args; -if (!qtest_has_device ("virtio-blk-device" )) { -g_test_skip ("Device virtio-blk-device is not available" ); -return ; - } -test_acpi_microvm_prepare (&data); args = test_acpi_create_args(&data,
Signature · 1 line
2.39.1
Re: [PATCH v2 01/34] Revert "tests/qtest: Check for devices in bios-tables-test"
Quoted 10 lines · Igor Mammedov
This reverts commit
c471eb4f40445908c1be7bb11a37ac676a0edae7.which broke acpi tables test and rebuild due to skipping some tests even thought none of devices tests depend on weren't disabled.
As result it leads to some expected tables not being updated, merge conflicts and tests failure.
Signed-off-by Igor Mammedov <[email protected]>---
PATCH v2 2/34 tests: acpi: whitelist new q35.noacpihp test and pc.hpbrroot
In reply to Igor Mammedovfor q35.noacpihp use plain default Q35 DSDT table as a starting point.
--- tests/qtest/bios-tables-test-allowed-diff.h | 2 ++ tests/data/acpi/q35/DSDT.noacpihp | Bin 0 -> 8252 bytes 2 files changed, 2 insertions(+) create mode 100644 tests/data/acpi/q35/DSDT.noacpihp
tests/qtest/bios-tables-test-allowed-diff.h +2 -0
@@ -1 +1,3 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT.hpbrroot" , +"tests/data/acpi/q35/DSDT.noacpihp",
tests/data/acpi/q35/DSDT.noacpihp new file binary +0 -0
Signature · 1 line
2.39.1
PATCH v2 3/34 tests: acpi: add test_acpi_q35_tcg_no_acpi_hotplug test and extend test_acpi_piix4_no_acpi_pci_hotplug
In reply to Igor Mammedovtest bridge AML generator with ACPI PCI hotplug disabled (i.e. with native hotplug enabled/disabled per bridge/root port)
PS:
while at make sure that devices on pci-bridge are starting from addr=1.0 as slot 0 is not available there and test passes only because of a bug in ACPI hotplug that will be fixed by follow up patch
--- tests/qtest/bios-tables-test.c | 42 +++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-)
tests/qtest/bios-tables-test.c +39 -3
@@ -949,9 +949,14 @@ static void test_acpi_piix4_no_acpi_pci_hotplug(void) data.required_struct_types_len =ARRAY_SIZE (base_required_struct_types);test_acpi_one ("-global PIIX4_PM.acpi-root-pci-hotplug=off " "-global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off " -"-device pci-bridge,chassis_nr=1 " -"-device pci-testdev,bus=pci.0 " -"-device pci-testdev,bus=pci.1" , &data); +"-device pci-bridge,chassis_nr=1,addr=4.0 " +"-device pci-testdev,bus=pci.0,addr=5.0 " +"-device pci-testdev,bus=pci.0,addr=6.0,acpi-index=101 " +"-device pci-testdev,bus=pci.1,addr=1.0 " +"-device pci-testdev,bus=pci.1,addr=2.0,acpi-index=201 " +"-device pci-bridge,id=nhpbr,chassis_nr=2,shpc=off,addr=7.0 " +"-device pci-testdev,bus=nhpbr,addr=1.0,acpi-index=301 " + , &data);free_test_data (&data); }
@@ -1002,6 +1007,35 @@ static void test_acpi_q35_tcg_bridge(void)free_test_data (&data); } +static void test_acpi_q35_tcg_no_acpi_hotplug (void ) +{ +test_data data; + +memset (&data,0 ,sizeof (data)); + data.machine =MACHINE_Q35 ; + data.variant =".noacpihp" ; + data.required_struct_types = base_required_struct_types; + data.required_struct_types_len =ARRAY_SIZE (base_required_struct_types); +test_acpi_one ("-global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off" +" -device pci-testdev,bus=pcie.0,acpi-index=101,addr=3.0" +" -device pci-bridge,chassis_nr=1,id=shpcbr,addr=4.0" +" -device pci-testdev,bus=shpcbr,addr=1.0,acpi-index=201" +" -device pci-bridge,chassis_nr=2,shpc=off,id=noshpcbr,addr=5.0" +" -device pci-testdev,bus=noshpcbr,addr=1.0,acpi-index=301" +" -device pcie-root-port,id=hprp,port=0x0,chassis=1,addr=6.0" +" -device pci-testdev,bus=hprp,acpi-index=401" +" -device pcie-root-port,id=nohprp,port=0x0,chassis=2,hotplug=off," +"addr=7.0" +" -device pci-testdev,bus=nohprp,acpi-index=501" +" -device pcie-root-port,id=nohprpint,port=0x0,chassis=3,hotplug=off," +"addr=8.0" +" -device pcie-root-port,id=hprp2,port=0x0,chassis=4,bus=nohprpint," +"addr=9.0" +" -device pci-testdev,bus=hprp2,acpi-index=601" + , &data); +free_test_data (&data); +} +static void test_acpi_q35_multif_bridge (void ) {test_data data = {
@@ -2094,6 +2128,8 @@ int main(int argc, char *argv[]) test_acpi_q35_tcg_tpm12_tis); }qtest_add_func ("acpi/q35/bridge" , test_acpi_q35_tcg_bridge); +qtest_add_func ("acpi/q35/no-acpi-hotplug" , + test_acpi_q35_tcg_no_acpi_hotplug);qtest_add_func ("acpi/q35/multif-bridge" , test_acpi_q35_multif_bridge);qtest_add_func ("acpi/q35/mmio64" , test_acpi_q35_tcg_mmio64);
Signature · 1 line
2.39.1
PATCH v2 4/34 tests: acpi: update expected blobs
In reply to Igor Mammedovexpected changes:
Basically adds devices present on root bus in form:
Device (SXX)
{
Name (_ADR, 0xYYYYYYYY) // _ADR: Address}
On top of that For q35.noacpihp, all ACPI PCI hotplug AML is removed and _OSC get native hotplug enabled:
CreateDWordField (Arg3, 0x04, CDW2)
CreateDWordField (Arg3, 0x08, CDW3)
Local0 = CDW3 /* \_SB_.PCI0._OSC.CDW3 */
- Local0 &= 0x1E
+ Local0 &= 0x1F
If ((Arg1 != One))
{
CDW1 |= 0x08--- tests/qtest/bios-tables-test-allowed-diff.h | 2 -- tests/data/acpi/pc/DSDT.hpbrroot | Bin 3081 -> 3115 bytes tests/data/acpi/q35/DSDT.noacpihp | Bin 8252 -> 7932 bytes 3 files changed, 2 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -2
@@ -1,3 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT.hpbrroot" , -"tests/data/acpi/q35/DSDT.noacpihp",
tests/data/acpi/pc/DSDT.hpbrroot binary +0 -0
tests/data/acpi/q35/DSDT.noacpihp binary +0 -0
Signature · 1 line
2.39.1
PATCH v2 5/34 tests: acpi: whitelist q35/DSDT.multi-bridge before extending testcase
In reply to Igor Mammedov--- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+)
tests/qtest/bios-tables-test-allowed-diff.h +1 -0
@@ -1 +1,2 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/DSDT.multi-bridge",
Signature · 1 line
2.39.1
PATCH v2 6/34 tests: acpi: extend multi-bridge case with case 'root-port, id=HOHP, hotplug=off root-port, bus=NOHP'
In reply to Igor MammedovFollowing corner case wasn't covered:
-device pcie-root-port,id=NO_HOTPLUG,hotplug=off -device pcie-root-port,bus=NO_HOTPLUG
when intermediate root-port has explicitly disabled hotplug, all hierarchy below it is not described anymore (used to be described in 7.2)
So as result we see only NO_HOTPLUG root-port described
+ Device (S50)
+ {
+ Name (_ADR, 0x000A0000) // _ADR: Address
+ }
and no children nor notification chain for them are being composed. Follow up patches will fix missing leaf root-port descriptor and notification chain that should accompany it.
--- tests/qtest/bios-tables-test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tests/qtest/bios-tables-test.c +4 -1
@@ -1055,7 +1055,10 @@ static void test_acpi_q35_multif_bridge(void)" -device pci-testdev,bus=pcie.0,addr=2.4" " -device pci-testdev,bus=pcie.0,addr=5.0" " -device pci-testdev,bus=rp0,addr=0.0" - " -device pci-testdev,bus=br1", &data); +" -device pci-testdev,bus=br1" +" -device pcie-root-port,id=rpnohp,chassis=8,addr=0xA.0,hotplug=off" +" -device pcie-root-port,id=rp3,chassis=9,bus=rpnohp" + , &data);/* hotplugged bridges section */ qtest_qmp_device_add(data.qts, "pci-bridge", "hpbr1",
Signature · 1 line
2.39.1
PATCH v2 7/34 x86: pcihp: fix missing PCNT callchain when intermediate root-port has 'hotplug=off' set
In reply to Igor MammedovBeside BSEL numbers change (due to 2 extra root-ports in q35/miltibridge test), following change is expected:
Scope (\_SB.PCI0)
{
...
+ Scope (S50)
+ {
+ Scope (S00)
+ {
+ Method (PCNT, 0, NotSerialized)
+ {
+ BNUM = Zero
+ DVNT (PCIU, One)
+ DVNT (PCID, 0x03)
+ }
+ }
+
+ Method (PCNT, 0, NotSerialized)
+ {
+ ^S00.PCNT
+ }
+ }
...
Method (PCNT, 0, NotSerialized)
{
+ ^S50.PCNT ()
^S13.PCNT ()
^S12.PCNT ()
^S11.PCNT ()I practice [1] hasn't broke anything since on hardware side we unset hotplug_handler on such intermediate port => hotplug behind it has not been properly wired and as result not worked.
1)
--- hw/i386/acpi-build.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
hw/i386/acpi-build.c +13 -9
@@ -517,16 +517,24 @@ static bool build_append_notfication_callback(Aml *parent_scope,PCIBus *sec;QObject *bsel;int nr_notifiers =0 ; +GQueue *pcnt_bus_list =g_queue_new (); QLIST_FOREACH(sec, &bus->child, sibling) {Aml *br_scope =aml_scope ("S%.02X" , sec->parent_dev->devfn); -if (pci_bus_is_root (sec) || - !object_property_find (OBJECT (sec),ACPI_PCIHP_PROP_BSEL )) { +if (pci_bus_is_root (sec)) {continue ; } nr_notifiers = nr_notifiers +build_append_notfication_callback (br_scope, sec); -aml_append (parent_scope, br_scope); +/* +* add new child scope to parent +* and keep track of bus that have PCNT, +* bus list is used later to call children PCNTs from this level PCNT +*/ +if (nr_notifiers) { +g_queue_push_tail (pcnt_bus_list, sec); +aml_append (parent_scope, br_scope); + } }/*
@@ -550,17 +558,13 @@ static bool build_append_notfication_callback(Aml *parent_scope, }/* Notify about child bus events in any case */ - QLIST_FOREACH(sec, &bus->child, sibling) { -if (pci_bus_is_root (sec) || - !object_property_find (OBJECT (sec),ACPI_PCIHP_PROP_BSEL )) { -continue ; - } - +while ((sec =g_queue_pop_head (pcnt_bus_list))) {aml_append (method,aml_name ("^S%.02X.PCNT" , sec->parent_dev->devfn)); }aml_append (parent_scope, method);qobject_unref (bsel); +g_queue_free (pcnt_bus_list);return !!nr_notifiers; }
Signature · 1 line
2.39.1
PATCH v2 8/34 tests: acpi: whitelist pc/DSDT.hpbrroot and pc/DSDT.hpbridge tests
In reply to Igor Mammedovfollow up fix for missing root-port AML will affect these tests by adding non-hotpluggable Device descriptors of colplugged bridges when bridge hotplug is disabled.
--- tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ 1 file changed, 3 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +3 -0
@@ -1,2 +1,5 @@/* List of comma-separated changed AML files to ignore */ "tests/data/acpi/q35/DSDT.multi-bridge" , +"tests/data/acpi/pc/DSDT.hpbridge" , +"tests/data/acpi/pc/DSDT.hpbrroot" , +"tests/data/acpi/q35/DSDT.noacpihp",
Signature · 1 line
2.39.1
PATCH v2 9/34 x86: pcihp: fix missing bridge AML when intermediate root-port has 'hotplug=off' set
In reply to Igor Mammedov(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)
--- hw/acpi/pci-bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/acpi/pci-bridge.c +1 -1
@@ -21,7 +21,7 @@ void build_pci_bridge_aml(AcpiDevAmlIf *adev, Aml *scope) {PCIBridge *br =PCI_BRIDGE (adev); -if (object_property_find (OBJECT (&br->sec_bus),ACPI_PCIHP_PROP_BSEL )) { +if (!DEVICE (br)->hotplugged) {build_append_pci_bus_devices (scope,pci_bridge_get_sec_bus (br)); } }
Signature · 1 line
2.39.1
PATCH v2 10/34 tests: acpi: update expected blobs
In reply to Igor MammedovBNUM numbering changes across DSDT due to addition of new bridges.
Fixed missing PCI tree brunch (q35/DSDT.multi-bridge case):
// -device pcie-root-port,id=rpnohp,chassis=8,addr=0xA.0,hotplug=off
+ Device (S50)
+ {
+ Name (_ADR, 0x000A0000) // _ADR: Address
// -device pcie-root-port,id=rp3,chassis=9,bus=rpnohp
+ Device (S00)
+ {
+ Name (_ADR, Zero) // _ADR: Address
+ Name (BSEL, Zero)
+ Device (S00)
+ {
+ Name (_ADR, Zero) // _ADR: Address
+ Name (ASUN, Zero)
+ Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method
+ {
+ Local0 = Package (0x02)
+ {
+ BSEL,
+ ASUN
+ }
+ Return (PDSM (Arg0, Arg1, Arg2, Arg3, Local0))
+ }
+
+ Name (_SUN, Zero) // _SUN: Slot User Number
+ Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device
+ { + PCEJ (BSEL, _SUN)
+ }
+ }
+
+ Method (DVNT, 2, NotSerialized)
+ {
+ If ((Arg0 & One))
+ {
+ Notify (S00, Arg1)
+ }
+ }
+ }
+ }
Fixed hotplug notification for leaf root port (hotplug=on) attached to intermediate root port (hotplug=off) (q35/DSDT.multi-bridge case)
// -device pcie-root-port,id=rpnohp,chassis=8,addr=0xA.0,hotplug=off
+ Scope (S50)
+ {
// -device pcie-root-port,id=rp3,chassis=9,bus=rpnohp
+ Scope (S00)
+ {
+ Method (PCNT, 0, NotSerialized)
+ {
+ BNUM = Zero
+ DVNT (PCIU, One)
+ DVNT (PCID, 0x03)
+ }
+ }
+
+ Method (PCNT, 0, NotSerialized)
+ {
+ ^S00.PCNT ()
+ }
+ }
...
Method (PCNT, 0, NotSerialized)
{
+ ^S50.PCNT ()
^S13.PCNT ()Populated slots being described on coldplugged bridges even if ACPI bridge hotplug is disabled.
(pc/DSDT.hpbridge and pc/DSDT.hpbrroot)
...
Device (S18)
{
Name (_ADR, 0x00030000) // _ADR: Address
+ Device (S08)
+ {
+ Name (_ADR, 0x00010000) // _ADR: Address
+ }
+
+ Device (S10)
+ {
+ Name (_ADR, 0x00020000) // _ADR: Address
+ }
}
...
Device (S18)
{
Name (_ADR, 0x00030000) // _ADR: Address
+ Device (S00)
+ {
+ Name (_ADR, Zero) // _ADR: Address
+ }
}--- tests/qtest/bios-tables-test-allowed-diff.h | 4 ---- tests/data/acpi/pc/DSDT.hpbridge | Bin 6289 -> 6323 bytes tests/data/acpi/pc/DSDT.hpbrroot | Bin 3115 -> 3166 bytes tests/data/acpi/q35/DSDT.multi-bridge | Bin 12337 -> 12545 bytes tests/data/acpi/q35/DSDT.noacpihp | Bin 7932 -> 8022 bytes 5 files changed, 4 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -4
@@ -1,5 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/DSDT.multi-bridge" , -"tests/data/acpi/pc/DSDT.hpbridge" , -"tests/data/acpi/pc/DSDT.hpbrroot" , -"tests/data/acpi/q35/DSDT.noacpihp",
tests/data/acpi/pc/DSDT.hpbridge binary +0 -0
tests/data/acpi/pc/DSDT.hpbrroot binary +0 -0
tests/data/acpi/q35/DSDT.multi-bridge binary +0 -0
tests/data/acpi/q35/DSDT.noacpihp binary +0 -0
Signature · 1 line
2.39.1
PATCH v2 11/34 pcihp: piix4: do not redirect hotplug controller to piix4 when ACPI hotplug is disabled
In reply to Igor Mammedovcommit [1] added ability to disable ACPI PCI hotplug on hostbridge but forgot to take into account that it should disable all ACPI hotplug machinery in case both hostbridge and bridge hotplug are disabled.
Commit [2] tried to fix that, however it forgot to remove hotplug_handler override which hands hotplug control over to piix4 hotplug controller (uninitialized after [2]).
As result at the time bridge is plugged in, its default (SHPC) hotplug handler is replaced by piix4 one in
acpi_pcihp_device_plug_cb()
...
if (!s->legacy_piix &&
...
qbus_set_hotplug_handler(BUS(sec), OBJECT(hotplug_dev));which is acting on uninitialized s->legacy_piix value (0 by default) that was supposed to be initialized by acpi_pcihp_init(), that is no longer called due to following condition being false:
piix4_acpi_system_hot_add_init()
if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) {and the bridge ends up with piix4 as hotplug handler instead of shpc one.
Followup hotplug on that bridge as result yields
piix4 specific error:
Error: Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set
1) 3d7e78aa777 (Introduce a new flag for i440fx to disable PCI hotplug on the root bus)
2) df4008c9c59 (piix4: don't reserve hw resources when hotplug is off globally)
--- hw/acpi/piix4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/acpi/piix4.c +1 -1
@@ -492,7 +492,6 @@ static void piix4_pm_realize(PCIDevice *dev, Error **errp)piix4_acpi_system_hot_add_init (pci_address_space_io (dev),pci_get_bus (dev), s); -qbus_set_hotplug_handler (BUS (pci_get_bus (dev)),OBJECT (s));piix4_pm_add_properties (s); }
@@ -564,6 +563,7 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) {acpi_pcihp_init (OBJECT (s), &s->acpi_pci_hotplug, bus, parent, s->use_acpi_hotplug_bridge,ACPI_PCIHP_ADDR_PIIX4 ); +qbus_set_hotplug_handler (BUS (pci_get_bus (PCI_DEVICE (s))),OBJECT (s)); } s->cpu_hotplug_legacy = true;
Signature · 1 line
2.39.1
PATCH v2 12/34 pci: fix 'hotplugglable' property behavior
In reply to Igor MammedovCurrently the property may flip its state during VM bring up or just doesn't work as the name implies.
In particular with PCIE root port that has 'hotplug={on|off}' property, and when it's turned off, one would expect
'hotpluggable' == false
for any devices attached to it.
Which is not the case since qbus_is_hotpluggable() used by the property just checks for presence of any hotplug_handler set on bus.
The problem is that name BusState::hotplug_handler from its inception is misnomer, as it handles not only hotplug but also in many cases coldplug as well (i.e. generic wiring interface), and it's fine to have hotplug_handler set on bus while it doesn't support hotplug (ex. pcie-slot with hotplug=off).
Another case of root port flipping 'hotpluggable' state when ACPI PCI hotplug is enabled in this case root port with 'hotplug=off' starts as hotpluggable and then later on, pcihp hotplug_handler clears hotplug_handler explicitly after checking root port's 'hotplug' property.
So root-port hotpluggablity check sort of works if pcihp is enabled but is broken if pcihp is disabled.
One way to deal with the issue is to ask hotplug_handler if bus it controls is hotpluggable or not. To do that add is_hotpluggable_bus() hook to HotplugHandler interface and use it in 'hotpluggable' property + teach pcie-slot to actually look into 'hotplug' property state before deciding if bus is hotpluggable.
--- include/hw/hotplug.h | 2 ++ include/hw/qdev-core.h | 13 ++++++++++++- hw/pci/pcie_port.c | 8 ++++++++ 3 files changed, 22 insertions(+), 1 deletion(-)
include/hw/hotplug.h +2 -0
@@ -48,6 +48,7 @@ typedef void (*hotplug_fn)(HotplugHandler *plug_handler,* @unplug: unplug callback. * Used for device removal with devices that implement * asynchronous and synchronous (surprise) removal. +* @is_hotpluggable_bus: called to check if bus/its parent allow hotplug on bus */ struct HotplugHandlerClass {/* <private> */
@@ -58,6 +59,7 @@ struct HotplugHandlerClass {hotplug_fn plug;hotplug_fn unplug_request;hotplug_fn unplug; +bool (*is_hotpluggable_bus)(HotplugHandler *plug_handler,BusState *bus); };/**
include/hw/qdev-core.h +12 -1
@@ -812,7 +812,18 @@ void qbus_set_bus_hotplug_handler(BusState *bus);static inline bool qbus_is_hotpluggable (BusState *bus) { -return bus->hotplug_handler; +HotplugHandler *plug_handler = bus->hotplug_handler; +bool ret = !!plug_handler; + +if (plug_handler) { +HotplugHandlerClass *hdc; + + hdc =HOTPLUG_HANDLER_GET_CLASS (plug_handler); +if (hdc->is_hotpluggable_bus) { + ret = hdc->is_hotpluggable_bus (plug_handler, bus); + } + } +return ret; }/**
hw/pci/pcie_port.c +8 -0
@@ -161,6 +161,13 @@ PCIDevice *pcie_find_port_by_pn(PCIBus *bus, uint8_t pn)return NULL ; } +static bool pcie_slot_is_hotpluggbale_bus (HotplugHandler *plug_handler, +BusState *bus) +{ +PCIESlot *s =PCIE_SLOT (bus->parent); +return s->hotplug; +} +static const TypeInfo pcie_port_type_info = { .name =TYPE_PCIE_PORT , .parent =TYPE_PCI_BRIDGE ,
@@ -188,6 +195,7 @@ static void pcie_slot_class_init(ObjectClass *oc, void *data) hc->plug = pcie_cap_slot_plug_cb; hc->unplug = pcie_cap_slot_unplug_cb; hc->unplug_request = pcie_cap_slot_unplug_request_cb; + hc->is_hotpluggable_bus = pcie_slot_is_hotpluggbale_bus; }static const TypeInfo pcie_slot_type_info = {
Signature · 1 line
2.39.1
PATCH v2 13/34 tests: acpi: whitelist DSDT blobs before isolating PCI _DSM func 0 prolog
In reply to Igor Mammedov--- tests/qtest/bios-tables-test-allowed-diff.h | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +35 -0
@@ -1 +1,36 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT" , +"tests/data/acpi/pc/DSDT.acpierst" , +"tests/data/acpi/pc/DSDT.acpihmat" , +"tests/data/acpi/pc/DSDT.bridge" , +"tests/data/acpi/pc/DSDT.cphp" , +"tests/data/acpi/pc/DSDT.dimmpxm" , +"tests/data/acpi/pc/DSDT.hpbridge" , +"tests/data/acpi/pc/DSDT.ipmikcs" , +"tests/data/acpi/pc/DSDT.memhp" , +"tests/data/acpi/pc/DSDT.nohpet" , +"tests/data/acpi/pc/DSDT.numamem" , +"tests/data/acpi/pc/DSDT.roothp" , +"tests/data/acpi/q35/DSDT" , +"tests/data/acpi/q35/DSDT.acpierst" , +"tests/data/acpi/q35/DSDT.acpihmat" , +"tests/data/acpi/q35/DSDT.acpihmat-noinitiator" , +"tests/data/acpi/q35/DSDT.applesmc" , +"tests/data/acpi/q35/DSDT.bridge" , +"tests/data/acpi/q35/DSDT.core-count2" , +"tests/data/acpi/q35/DSDT.cphp" , +"tests/data/acpi/q35/DSDT.cxl" , +"tests/data/acpi/q35/DSDT.dimmpxm" , +"tests/data/acpi/q35/DSDT.ipmibt" , +"tests/data/acpi/q35/DSDT.ipmismbus" , +"tests/data/acpi/q35/DSDT.ivrs" , +"tests/data/acpi/q35/DSDT.memhp" , +"tests/data/acpi/q35/DSDT.mmio64" , +"tests/data/acpi/q35/DSDT.multi-bridge" , +"tests/data/acpi/q35/DSDT.nohpet" , +"tests/data/acpi/q35/DSDT.numamem" , +"tests/data/acpi/q35/DSDT.pvpanic-isa" , +"tests/data/acpi/q35/DSDT.tis.tpm12" , +"tests/data/acpi/q35/DSDT.tis.tpm2" , +"tests/data/acpi/q35/DSDT.viot" , +"tests/data/acpi/q35/DSDT.xapic",
Signature · 1 line
2.39.1
PATCH v2 14/34 pcihp: move PCI _DSM function 0 prolog into separate function
In reply to Igor Mammedovit will be reused by follow up patches that will implement static _DSM for non-hotpluggable devices.
no functional AML change, only context one, where 'cap' (Local1) initialization is moved after UUID/revision checks.
--- hw/i386/acpi-build.c | 54 ++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 24 deletions(-)
hw/i386/acpi-build.c +30 -24
@@ -373,6 +373,33 @@ Aml *aml_pci_device_dsm(void)return method; } +static void build_append_pci_dsm_func0_common (Aml *ctx,Aml *retvar) +{ +Aml *UUID , *ifctx1; +uint8_t byte_list[1 ] = {0 };/* nothing supported yet */ + +aml_append (ctx,aml_store (aml_buffer (1 , byte_list), retvar)); +/* +* PCI Firmware Specification 3.1 +* 4.6. _DSM Definitions for PCI +*/ +UUID =aml_touuid ("E5C937D0-3553-4D7A-9117-EA4D19C3434D" ); + ifctx1 =aml_if (aml_lnot (aml_equal (aml_arg (0 ),UUID ))); + { +/* call is for unsupported UUID, bail out */ +aml_append (ifctx1,aml_return (retvar)); + } +aml_append (ctx, ifctx1); + + ifctx1 =aml_if (aml_lless (aml_arg (1 ),aml_int (2 ))); + { +/* call is for unsupported REV, bail out */ +aml_append (ifctx1,aml_return (retvar)); + } +aml_append (ctx, ifctx1); +} + +static void build_append_pcihp_notify_entry (Aml *method,int slot) {Aml *if_ctx;
@@ -570,14 +597,13 @@ static bool build_append_notfication_callback(Aml *parent_scope,static Aml *aml_pci_pdsm (void ) { -Aml *method, *UUID , *ifctx, *ifctx1; +Aml *method, *ifctx, *ifctx1;Aml *ret =aml_local (0 );Aml *caps =aml_local (1 );Aml *acpi_index =aml_local (2 );Aml *zero =aml_int (0 );Aml *one =aml_int (1 );Aml *func =aml_arg (2 ); -Aml *rev =aml_arg (1 );Aml *params =aml_arg (4 );Aml *bnum =aml_derefof (aml_index (params,aml_int (0 )));Aml *sunum =aml_derefof (aml_index (params,aml_int (1 )));
@@ -587,29 +613,9 @@ static Aml *aml_pci_pdsm(void)/* get supported functions */ ifctx =aml_if (aml_equal (func, zero)); { -uint8_t byte_list[1 ] = {0 };/* nothing supported yet */ -aml_append (ifctx,aml_store (aml_buffer (1 , byte_list), ret)); -aml_append (ifctx,aml_store (zero, caps)); - -/* -* PCI Firmware Specification 3.1 -* 4.6. _DSM Definitions for PCI -*/ -UUID =aml_touuid ("E5C937D0-3553-4D7A-9117-EA4D19C3434D" ); - ifctx1 =aml_if (aml_lnot (aml_equal (aml_arg (0 ),UUID ))); - { -/* call is for unsupported UUID, bail out */ -aml_append (ifctx1,aml_return (ret)); - } -aml_append (ifctx, ifctx1); - - ifctx1 =aml_if (aml_lless (rev,aml_int (2 ))); - { -/* call is for unsupported REV, bail out */ -aml_append (ifctx1,aml_return (ret)); - } -aml_append (ifctx, ifctx1); +build_append_pci_dsm_func0_common (ifctx, ret); +aml_append (ifctx,aml_store (zero, caps));aml_append (ifctx,aml_store (aml_call2 ("AIDX" , bnum, sunum), acpi_index));/*
Signature · 1 line
2.39.1
PATCH v2 15/34 tests: acpi: update expected blobs
In reply to Igor Mammedovonly following context change:
- Local1 = Zero
If ((Arg0 != ToUUID ("e5c937d0-3553-4d7a-9117-ea4d19c3434d") /* Device Labeling Interface */))
{
Return (Local0)
...
Return (Local0)
} + Local1 = Zero
Local2 = AIDX (DerefOf (Arg4 [Zero]), DerefOf (Arg4 [One]
--- tests/qtest/bios-tables-test-allowed-diff.h | 35 ------------------ tests/data/acpi/pc/DSDT | Bin 6360 -> 6360 bytes tests/data/acpi/pc/DSDT.acpierst | Bin 6283 -> 6283 bytes tests/data/acpi/pc/DSDT.acpihmat | Bin 7685 -> 7685 bytes tests/data/acpi/pc/DSDT.bridge | Bin 12487 -> 12487 bytes tests/data/acpi/pc/DSDT.cphp | Bin 6824 -> 6824 bytes tests/data/acpi/pc/DSDT.dimmpxm | Bin 8014 -> 8014 bytes tests/data/acpi/pc/DSDT.hpbridge | Bin 6323 -> 6323 bytes tests/data/acpi/pc/DSDT.ipmikcs | Bin 6432 -> 6432 bytes tests/data/acpi/pc/DSDT.memhp | Bin 7719 -> 7719 bytes tests/data/acpi/pc/DSDT.nohpet | Bin 6218 -> 6218 bytes tests/data/acpi/pc/DSDT.numamem | Bin 6366 -> 6366 bytes tests/data/acpi/pc/DSDT.roothp | Bin 9745 -> 9745 bytes tests/data/acpi/q35/DSDT | Bin 8252 -> 8252 bytes tests/data/acpi/q35/DSDT.acpierst | Bin 8269 -> 8269 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9577 -> 9577 bytes tests/data/acpi/q35/DSDT.acpihmat-noinitiator | Bin 8531 -> 8531 bytes tests/data/acpi/q35/DSDT.applesmc | Bin 8298 -> 8298 bytes tests/data/acpi/q35/DSDT.bridge | Bin 11481 -> 11481 bytes tests/data/acpi/q35/DSDT.core-count2 | Bin 32392 -> 32392 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8716 -> 8716 bytes tests/data/acpi/q35/DSDT.cxl | Bin 9564 -> 9564 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9906 -> 9906 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 8327 -> 8327 bytes tests/data/acpi/q35/DSDT.ipmismbus | Bin 8340 -> 8340 bytes tests/data/acpi/q35/DSDT.ivrs | Bin 8269 -> 8269 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9611 -> 9611 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 9382 -> 9382 bytes tests/data/acpi/q35/DSDT.multi-bridge | Bin 12545 -> 12545 bytes tests/data/acpi/q35/DSDT.nohpet | Bin 8110 -> 8110 bytes tests/data/acpi/q35/DSDT.numamem | Bin 8258 -> 8258 bytes tests/data/acpi/q35/DSDT.pvpanic-isa | Bin 8353 -> 8353 bytes tests/data/acpi/q35/DSDT.tis.tpm12 | Bin 8858 -> 8858 bytes tests/data/acpi/q35/DSDT.tis.tpm2 | Bin 8884 -> 8884 bytes tests/data/acpi/q35/DSDT.viot | Bin 9361 -> 9361 bytes tests/data/acpi/q35/DSDT.xapic | Bin 35615 -> 35615 bytes 36 files changed, 35 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -35
@@ -1,36 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT" , -"tests/data/acpi/pc/DSDT.acpierst" , -"tests/data/acpi/pc/DSDT.acpihmat" , -"tests/data/acpi/pc/DSDT.bridge" , -"tests/data/acpi/pc/DSDT.cphp" , -"tests/data/acpi/pc/DSDT.dimmpxm" , -"tests/data/acpi/pc/DSDT.hpbridge" , -"tests/data/acpi/pc/DSDT.ipmikcs" , -"tests/data/acpi/pc/DSDT.memhp" , -"tests/data/acpi/pc/DSDT.nohpet" , -"tests/data/acpi/pc/DSDT.numamem" , -"tests/data/acpi/pc/DSDT.roothp" , -"tests/data/acpi/q35/DSDT" , -"tests/data/acpi/q35/DSDT.acpierst" , -"tests/data/acpi/q35/DSDT.acpihmat" , -"tests/data/acpi/q35/DSDT.acpihmat-noinitiator" , -"tests/data/acpi/q35/DSDT.applesmc" , -"tests/data/acpi/q35/DSDT.bridge" , -"tests/data/acpi/q35/DSDT.core-count2" , -"tests/data/acpi/q35/DSDT.cphp" , -"tests/data/acpi/q35/DSDT.cxl" , -"tests/data/acpi/q35/DSDT.dimmpxm" , -"tests/data/acpi/q35/DSDT.ipmibt" , -"tests/data/acpi/q35/DSDT.ipmismbus" , -"tests/data/acpi/q35/DSDT.ivrs" , -"tests/data/acpi/q35/DSDT.memhp" , -"tests/data/acpi/q35/DSDT.mmio64" , -"tests/data/acpi/q35/DSDT.multi-bridge" , -"tests/data/acpi/q35/DSDT.nohpet" , -"tests/data/acpi/q35/DSDT.numamem" , -"tests/data/acpi/q35/DSDT.pvpanic-isa" , -"tests/data/acpi/q35/DSDT.tis.tpm12" , -"tests/data/acpi/q35/DSDT.tis.tpm2" , -"tests/data/acpi/q35/DSDT.viot" , -"tests/data/acpi/q35/DSDT.xapic",
tests/data/acpi/pc/DSDT binary +0 -0
tests/data/acpi/pc/DSDT.acpierst binary +0 -0
tests/data/acpi/pc/DSDT.acpihmat binary +0 -0
tests/data/acpi/pc/DSDT.bridge binary +0 -0
tests/data/acpi/pc/DSDT.cphp binary +0 -0
tests/data/acpi/pc/DSDT.dimmpxm binary +0 -0
tests/data/acpi/pc/DSDT.hpbridge binary +0 -0
tests/data/acpi/pc/DSDT.ipmikcs binary +0 -0
tests/data/acpi/pc/DSDT.memhp binary +0 -0
tests/data/acpi/pc/DSDT.nohpet binary +0 -0
tests/data/acpi/pc/DSDT.numamem binary +0 -0
tests/data/acpi/pc/DSDT.roothp binary +0 -0
tests/data/acpi/q35/DSDT binary +0 -0
tests/data/acpi/q35/DSDT.acpierst binary +0 -0
tests/data/acpi/q35/DSDT.acpihmat binary +0 -0
tests/data/acpi/q35/DSDT.acpihmat-noinitiator binary +0 -0
tests/data/acpi/q35/DSDT.applesmc binary +0 -0
tests/data/acpi/q35/DSDT.bridge binary +0 -0
tests/data/acpi/q35/DSDT.core-count2 binary +0 -0
tests/data/acpi/q35/DSDT.cphp binary +0 -0
tests/data/acpi/q35/DSDT.cxl binary +0 -0
tests/data/acpi/q35/DSDT.dimmpxm binary +0 -0
tests/data/acpi/q35/DSDT.ipmibt binary +0 -0
tests/data/acpi/q35/DSDT.ipmismbus binary +0 -0
tests/data/acpi/q35/DSDT.ivrs binary +0 -0
tests/data/acpi/q35/DSDT.memhp binary +0 -0
tests/data/acpi/q35/DSDT.mmio64 binary +0 -0
tests/data/acpi/q35/DSDT.multi-bridge binary +0 -0
tests/data/acpi/q35/DSDT.nohpet binary +0 -0
tests/data/acpi/q35/DSDT.numamem binary +0 -0
tests/data/acpi/q35/DSDT.pvpanic-isa binary +0 -0
tests/data/acpi/q35/DSDT.tis.tpm12 binary +0 -0
tests/data/acpi/q35/DSDT.tis.tpm2 binary +0 -0
tests/data/acpi/q35/DSDT.viot binary +0 -0
tests/data/acpi/q35/DSDT.xapic binary +0 -0
Signature · 1 line
2.39.1
PATCH v2 16/34 tests: acpi: whitelist DSDT before adding EDSM method
In reply to Igor Mammedov--- tests/qtest/bios-tables-test-allowed-diff.h | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +37 -0
@@ -1 +1,38 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT" , +"tests/data/acpi/pc/DSDT.acpierst" , +"tests/data/acpi/pc/DSDT.acpihmat" , +"tests/data/acpi/pc/DSDT.bridge" , +"tests/data/acpi/pc/DSDT.cphp" , +"tests/data/acpi/pc/DSDT.dimmpxm" , +"tests/data/acpi/pc/DSDT.hpbridge" , +"tests/data/acpi/pc/DSDT.hpbrroot" , +"tests/data/acpi/pc/DSDT.ipmikcs" , +"tests/data/acpi/pc/DSDT.memhp" , +"tests/data/acpi/pc/DSDT.nohpet" , +"tests/data/acpi/pc/DSDT.numamem" , +"tests/data/acpi/pc/DSDT.roothp" , +"tests/data/acpi/q35/DSDT" , +"tests/data/acpi/q35/DSDT.acpierst" , +"tests/data/acpi/q35/DSDT.acpihmat" , +"tests/data/acpi/q35/DSDT.acpihmat-noinitiator" , +"tests/data/acpi/q35/DSDT.applesmc" , +"tests/data/acpi/q35/DSDT.bridge" , +"tests/data/acpi/q35/DSDT.core-count2" , +"tests/data/acpi/q35/DSDT.cphp" , +"tests/data/acpi/q35/DSDT.cxl" , +"tests/data/acpi/q35/DSDT.dimmpxm" , +"tests/data/acpi/q35/DSDT.ipmibt" , +"tests/data/acpi/q35/DSDT.ipmismbus" , +"tests/data/acpi/q35/DSDT.ivrs" , +"tests/data/acpi/q35/DSDT.memhp" , +"tests/data/acpi/q35/DSDT.mmio64" , +"tests/data/acpi/q35/DSDT.multi-bridge" , +"tests/data/acpi/q35/DSDT.noacpihp" , +"tests/data/acpi/q35/DSDT.nohpet" , +"tests/data/acpi/q35/DSDT.numamem" , +"tests/data/acpi/q35/DSDT.pvpanic-isa" , +"tests/data/acpi/q35/DSDT.tis.tpm12" , +"tests/data/acpi/q35/DSDT.tis.tpm2" , +"tests/data/acpi/q35/DSDT.viot" , +"tests/data/acpi/q35/DSDT.xapic",
Signature · 1 line
2.39.1
PATCH v2 17/34 acpi: pci: add EDSM method to DSDT
In reply to Igor Mammedovit's a helper method for acpi-index support on PCI buses that do no support or have disabled ACPI PCI hotplug or for non-hotpluggble endpoint devices.
(like non-hotpluggble NICs, integrated endpoints and later for machines that do not support ACPI PCI hotplug)
no functional change, commit adds only EDSM method in DSDT without any users. (the follow up patches will use it)
--- hw/i386/acpi-build.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
hw/i386/acpi-build.c +54 -0
@@ -399,6 +399,58 @@ static void build_append_pci_dsm_func0_common(Aml *ctx, Aml *retvar)aml_append (ctx, ifctx1); } +static Aml *aml_pci_edsm (void ) +{ +Aml *method, *ifctx; +Aml *zero =aml_int (0 ); +Aml *func =aml_arg (2 ); +Aml *ret =aml_local (0 ); +Aml *aidx =aml_local (1 ); +Aml *params =aml_arg (4 ); + + method =aml_method ("EDSM" ,5 ,AML_SERIALIZED ); + +/* get supported functions */ + ifctx =aml_if (aml_equal (func, zero)); + { +/* 1: have supported functions */ +/* 7: support for function 7 */ +const uint8_t caps =1 |BIT (7 ); +build_append_pci_dsm_func0_common (ifctx, ret); +aml_append (ifctx,aml_store (aml_int (caps),aml_index (ret, zero))); +aml_append (ifctx,aml_return (ret)); + } +aml_append (method, ifctx); + +/* handle specific functions requests */ +/* +* PCI Firmware Specification 3.1 +* 4.6.7. _DSM for Naming a PCI or PCI Express Device Under +* Operating Systems +*/ + ifctx =aml_if (aml_equal (func,aml_int (7 ))); + { +Aml *pkg =aml_package (2 ); +aml_append (pkg, zero); +/* optional, if not impl. should return null string */ +aml_append (pkg,aml_string ("%s" ,"" )); +aml_append (ifctx,aml_store (pkg, ret)); + +/* +* IASL is fine when initializing Package with computational data, +* however it makes guest unhappy /it fails to process such AML/. +* So use runtime assignment to set acpi-index after initializer +* to make OSPM happy. +*/ +aml_append (ifctx, +aml_store (aml_derefof (aml_index (params,aml_int (0 ))), aidx)); +aml_append (ifctx,aml_store (aidx,aml_index (ret, zero))); +aml_append (ifctx,aml_return (ret)); + } +aml_append (method, ifctx); + +return method; +}static void build_append_pcihp_notify_entry (Aml *method,int slot) {
@@ -1398,6 +1450,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0A03" )));aml_append (dev,aml_name_decl ("_ADR" ,aml_int (0 )));aml_append (dev,aml_name_decl ("_UID" ,aml_int (pcmc->pci_root_uid))); +aml_append (dev,aml_pci_edsm ());aml_append (sb_scope, dev);aml_append (dsdt, sb_scope);
@@ -1413,6 +1466,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,aml_append (dev,aml_name_decl ("_ADR" ,aml_int (0 )));aml_append (dev,aml_name_decl ("_UID" ,aml_int (pcmc->pci_root_uid)));aml_append (dev,build_q35_osc_method (!pm->pcihp_bridge_en)); +aml_append (dev,aml_pci_edsm ());aml_append (sb_scope, dev);if (mcfg_valid) {aml_append (sb_scope,build_q35_dram_controller (&mcfg));
Signature · 1 line
2.39.1
PATCH v2 18/34 tests: acpi: update expected blobs
In reply to Igor Mammedov--- tests/qtest/bios-tables-test-allowed-diff.h | 37 ------------------ tests/data/acpi/pc/DSDT | Bin 6360 -> 6454 bytes tests/data/acpi/pc/DSDT.acpierst | Bin 6283 -> 6377 bytes tests/data/acpi/pc/DSDT.acpihmat | Bin 7685 -> 7779 bytes tests/data/acpi/pc/DSDT.bridge | Bin 12487 -> 12581 bytes tests/data/acpi/pc/DSDT.cphp | Bin 6824 -> 6918 bytes tests/data/acpi/pc/DSDT.dimmpxm | Bin 8014 -> 8108 bytes tests/data/acpi/pc/DSDT.hpbridge | Bin 6323 -> 6417 bytes tests/data/acpi/pc/DSDT.hpbrroot | Bin 3166 -> 3260 bytes tests/data/acpi/pc/DSDT.ipmikcs | Bin 6432 -> 6526 bytes tests/data/acpi/pc/DSDT.memhp | Bin 7719 -> 7813 bytes tests/data/acpi/pc/DSDT.nohpet | Bin 6218 -> 6312 bytes tests/data/acpi/pc/DSDT.numamem | Bin 6366 -> 6460 bytes tests/data/acpi/pc/DSDT.roothp | Bin 9745 -> 9839 bytes tests/data/acpi/q35/DSDT | Bin 8252 -> 8344 bytes tests/data/acpi/q35/DSDT.acpierst | Bin 8269 -> 8361 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9577 -> 9669 bytes tests/data/acpi/q35/DSDT.acpihmat-noinitiator | Bin 8531 -> 8623 bytes tests/data/acpi/q35/DSDT.applesmc | Bin 8298 -> 8390 bytes tests/data/acpi/q35/DSDT.bridge | Bin 11481 -> 11573 bytes tests/data/acpi/q35/DSDT.core-count2 | Bin 32392 -> 32484 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8716 -> 8808 bytes tests/data/acpi/q35/DSDT.cxl | Bin 9564 -> 9656 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9906 -> 9998 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 8327 -> 8419 bytes tests/data/acpi/q35/DSDT.ipmismbus | Bin 8340 -> 8432 bytes tests/data/acpi/q35/DSDT.ivrs | Bin 8269 -> 8361 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9611 -> 9703 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 9382 -> 9474 bytes tests/data/acpi/q35/DSDT.multi-bridge | Bin 12545 -> 12637 bytes tests/data/acpi/q35/DSDT.noacpihp | Bin 8022 -> 8114 bytes tests/data/acpi/q35/DSDT.nohpet | Bin 8110 -> 8202 bytes tests/data/acpi/q35/DSDT.numamem | Bin 8258 -> 8350 bytes tests/data/acpi/q35/DSDT.pvpanic-isa | Bin 8353 -> 8445 bytes tests/data/acpi/q35/DSDT.tis.tpm12 | Bin 8858 -> 8950 bytes tests/data/acpi/q35/DSDT.tis.tpm2 | Bin 8884 -> 8976 bytes tests/data/acpi/q35/DSDT.viot | Bin 9361 -> 9453 bytes tests/data/acpi/q35/DSDT.xapic | Bin 35615 -> 35707 bytes 38 files changed, 37 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -37
@@ -1,38 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT" , -"tests/data/acpi/pc/DSDT.acpierst" , -"tests/data/acpi/pc/DSDT.acpihmat" , -"tests/data/acpi/pc/DSDT.bridge" , -"tests/data/acpi/pc/DSDT.cphp" , -"tests/data/acpi/pc/DSDT.dimmpxm" , -"tests/data/acpi/pc/DSDT.hpbridge" , -"tests/data/acpi/pc/DSDT.hpbrroot" , -"tests/data/acpi/pc/DSDT.ipmikcs" , -"tests/data/acpi/pc/DSDT.memhp" , -"tests/data/acpi/pc/DSDT.nohpet" , -"tests/data/acpi/pc/DSDT.numamem" , -"tests/data/acpi/pc/DSDT.roothp" , -"tests/data/acpi/q35/DSDT" , -"tests/data/acpi/q35/DSDT.acpierst" , -"tests/data/acpi/q35/DSDT.acpihmat" , -"tests/data/acpi/q35/DSDT.acpihmat-noinitiator" , -"tests/data/acpi/q35/DSDT.applesmc" , -"tests/data/acpi/q35/DSDT.bridge" , -"tests/data/acpi/q35/DSDT.core-count2" , -"tests/data/acpi/q35/DSDT.cphp" , -"tests/data/acpi/q35/DSDT.cxl" , -"tests/data/acpi/q35/DSDT.dimmpxm" , -"tests/data/acpi/q35/DSDT.ipmibt" , -"tests/data/acpi/q35/DSDT.ipmismbus" , -"tests/data/acpi/q35/DSDT.ivrs" , -"tests/data/acpi/q35/DSDT.memhp" , -"tests/data/acpi/q35/DSDT.mmio64" , -"tests/data/acpi/q35/DSDT.multi-bridge" , -"tests/data/acpi/q35/DSDT.noacpihp" , -"tests/data/acpi/q35/DSDT.nohpet" , -"tests/data/acpi/q35/DSDT.numamem" , -"tests/data/acpi/q35/DSDT.pvpanic-isa" , -"tests/data/acpi/q35/DSDT.tis.tpm12" , -"tests/data/acpi/q35/DSDT.tis.tpm2" , -"tests/data/acpi/q35/DSDT.viot" , -"tests/data/acpi/q35/DSDT.xapic",
tests/data/acpi/pc/DSDT binary +0 -0
tests/data/acpi/pc/DSDT.acpierst binary +0 -0
tests/data/acpi/pc/DSDT.acpihmat binary +0 -0
tests/data/acpi/pc/DSDT.bridge binary +0 -0
tests/data/acpi/pc/DSDT.cphp binary +0 -0
tests/data/acpi/pc/DSDT.dimmpxm binary +0 -0
tests/data/acpi/pc/DSDT.hpbridge binary +0 -0
tests/data/acpi/pc/DSDT.hpbrroot binary +0 -0
tests/data/acpi/pc/DSDT.ipmikcs binary +0 -0
tests/data/acpi/pc/DSDT.memhp binary +0 -0
tests/data/acpi/pc/DSDT.nohpet binary +0 -0
tests/data/acpi/pc/DSDT.numamem binary +0 -0
tests/data/acpi/pc/DSDT.roothp binary +0 -0
tests/data/acpi/q35/DSDT binary +0 -0
tests/data/acpi/q35/DSDT.acpierst binary +0 -0
tests/data/acpi/q35/DSDT.acpihmat binary +0 -0
tests/data/acpi/q35/DSDT.acpihmat-noinitiator binary +0 -0
tests/data/acpi/q35/DSDT.applesmc binary +0 -0
tests/data/acpi/q35/DSDT.bridge binary +0 -0
tests/data/acpi/q35/DSDT.core-count2 binary +0 -0
tests/data/acpi/q35/DSDT.cphp binary +0 -0
tests/data/acpi/q35/DSDT.cxl binary +0 -0
tests/data/acpi/q35/DSDT.dimmpxm binary +0 -0
tests/data/acpi/q35/DSDT.ipmibt binary +0 -0
tests/data/acpi/q35/DSDT.ipmismbus binary +0 -0
tests/data/acpi/q35/DSDT.ivrs binary +0 -0
tests/data/acpi/q35/DSDT.memhp binary +0 -0
tests/data/acpi/q35/DSDT.mmio64 binary +0 -0
tests/data/acpi/q35/DSDT.multi-bridge binary +0 -0
tests/data/acpi/q35/DSDT.noacpihp binary +0 -0
tests/data/acpi/q35/DSDT.nohpet binary +0 -0
tests/data/acpi/q35/DSDT.numamem binary +0 -0
tests/data/acpi/q35/DSDT.pvpanic-isa binary +0 -0
tests/data/acpi/q35/DSDT.tis.tpm12 binary +0 -0
tests/data/acpi/q35/DSDT.tis.tpm2 binary +0 -0
tests/data/acpi/q35/DSDT.viot binary +0 -0
tests/data/acpi/q35/DSDT.xapic binary +0 -0
Signature · 1 line
2.39.1
PATCH v2 19/34 tests: acpi: whitelist DSDT before adding device with acpi-index to testcases
In reply to Igor Mammedov--- tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ 1 file changed, 3 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +3 -0
@@ -1 +1,4 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT.hpbrroot" , +"tests/data/acpi/q35/DSDT.multi-bridge" , +"tests/data/acpi/q35/DSDT.noacpihp",
Signature · 1 line
2.39.1
PATCH v2 20/34 tests: acpi: add device with acpi-index on non-hotpluggble bus
In reply to Igor Mammedov--- tests/qtest/bios-tables-test.c | 1 + 1 file changed, 1 insertion(+)
tests/qtest/bios-tables-test.c +1 -0
@@ -1054,6 +1054,7 @@ static void test_acpi_q35_multif_bridge(void)" -device pcie-root-port,id=rphptgt3,port=0x0,chassis=7,addr=2.3" " -device pci-testdev,bus=pcie.0,addr=2.4" " -device pci-testdev,bus=pcie.0,addr=5.0" +" -device pci-testdev,bus=pcie.0,addr=0xf.0,acpi-index=101" " -device pci-testdev,bus=rp0,addr=0.0" " -device pci-testdev,bus=br1" " -device pcie-root-port,id=rpnohp,chassis=8,addr=0xA.0,hotplug=off"
Signature · 1 line
2.39.1
PATCH v2 21/34 acpi: pci: support acpi-index for non-hotpluggable devices
In reply to Igor MammedovInject static _DSM (EDSM) if non-hotpluggable device has acpi-index configured on it.
It lets use acpi-index non-hotpluggable devices / devices attached to non-hotpluggable bus.
--- hw/i386/acpi-build.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
hw/i386/acpi-build.c +25 -0
@@ -452,6 +452,25 @@ static Aml *aml_pci_edsm(void)return method; } +static Aml *aml_pci_static_endpoint_dsm (PCIDevice *pdev) +{ +Aml *method; + +g_assert (pdev->acpi_index !=0 ); + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *params =aml_local (0 ); +Aml *pkg =aml_package (1 ); +aml_append (pkg,aml_int (pdev->acpi_index)); +aml_append (method,aml_store (pkg, params)); +aml_append (method, +aml_return (aml_call5 ("EDSM" ,aml_arg (0 ),aml_arg (1 ), +aml_arg (2 ),aml_arg (3 ), params)) + ); + } +return method; +} +static void build_append_pcihp_notify_entry (Aml *method,int slot) {Aml *if_ctx;
@@ -577,6 +596,12 @@ void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus)aml_append (dev,aml_name_decl ("_ADR" ,aml_int (adr)));call_dev_aml_func (DEVICE (bus->devices[devfn]), dev); +/* add _DSM if device has acpi-index set */ +if (pdev->acpi_index && !bsel && + !object_property_get_bool (OBJECT (pdev),"hotpluggable" , + &error_abort)) { +aml_append (dev,aml_pci_static_endpoint_dsm (pdev)); + }/* device descriptor has been composed, add it into parent context */ aml_append (parent_scope, dev);
Signature · 1 line
2.39.1
PATCH v2 22/34 tests: acpi: update expected blobs
In reply to Igor Mammedovthe only chenge is addition of _DSM- > EDSM method on non-hotpluggable devices with configured acpi-index. Something like:
+ Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method
+ {
+ Local0 = Package (0x01)
+ {
+ 0x65
+ }
+ Return (EDSM (Arg0, Arg1, Arg2, Arg3, Local0))
+ }
--- tests/qtest/bios-tables-test-allowed-diff.h | 3 --- tests/data/acpi/pc/DSDT.hpbrroot | Bin 3260 -> 3309 bytes tests/data/acpi/q35/DSDT.multi-bridge | Bin 12637 -> 12678 bytes tests/data/acpi/q35/DSDT.noacpihp | Bin 8114 -> 8188 bytes 4 files changed, 3 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -3
@@ -1,4 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT.hpbrroot" , -"tests/data/acpi/q35/DSDT.multi-bridge" , -"tests/data/acpi/q35/DSDT.noacpihp",
tests/data/acpi/pc/DSDT.hpbrroot binary +0 -0
tests/data/acpi/q35/DSDT.multi-bridge binary +0 -0
tests/data/acpi/q35/DSDT.noacpihp binary +0 -0
Signature · 1 line
2.39.1
PATCH v2 23/34 tests: acpi: whitelist DSDT before exposing non zero functions
In reply to Igor Mammedov--- tests/qtest/bios-tables-test-allowed-diff.h | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +37 -0
@@ -1 +1,38 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT" , +"tests/data/acpi/pc/DSDT.acpierst" , +"tests/data/acpi/pc/DSDT.acpihmat" , +"tests/data/acpi/pc/DSDT.bridge" , +"tests/data/acpi/pc/DSDT.cphp" , +"tests/data/acpi/pc/DSDT.dimmpxm" , +"tests/data/acpi/pc/DSDT.hpbridge" , +"tests/data/acpi/pc/DSDT.hpbrroot" , +"tests/data/acpi/pc/DSDT.ipmikcs" , +"tests/data/acpi/pc/DSDT.memhp" , +"tests/data/acpi/pc/DSDT.nohpet" , +"tests/data/acpi/pc/DSDT.numamem" , +"tests/data/acpi/pc/DSDT.roothp" , +"tests/data/acpi/q35/DSDT" , +"tests/data/acpi/q35/DSDT.acpierst" , +"tests/data/acpi/q35/DSDT.acpihmat" , +"tests/data/acpi/q35/DSDT.acpihmat-noinitiator" , +"tests/data/acpi/q35/DSDT.applesmc" , +"tests/data/acpi/q35/DSDT.bridge" , +"tests/data/acpi/q35/DSDT.core-count2" , +"tests/data/acpi/q35/DSDT.cphp" , +"tests/data/acpi/q35/DSDT.cxl" , +"tests/data/acpi/q35/DSDT.dimmpxm" , +"tests/data/acpi/q35/DSDT.ipmibt" , +"tests/data/acpi/q35/DSDT.ipmismbus" , +"tests/data/acpi/q35/DSDT.ivrs" , +"tests/data/acpi/q35/DSDT.memhp" , +"tests/data/acpi/q35/DSDT.mmio64" , +"tests/data/acpi/q35/DSDT.multi-bridge" , +"tests/data/acpi/q35/DSDT.noacpihp" , +"tests/data/acpi/q35/DSDT.nohpet" , +"tests/data/acpi/q35/DSDT.numamem" , +"tests/data/acpi/q35/DSDT.pvpanic-isa" , +"tests/data/acpi/q35/DSDT.tis.tpm12" , +"tests/data/acpi/q35/DSDT.tis.tpm2" , +"tests/data/acpi/q35/DSDT.viot" , +"tests/data/acpi/q35/DSDT.xapic",
Signature · 1 line
2.39.1
PATCH v2 24/34 acpi: pci: describe all functions on populated slots
In reply to Igor Mammedovdescribing all present devices on functions other than 0 was complicated when non hotplug and hotplug code was intermixed. So QEMU has been excluding non zero functions since they are not supported by hotplug code, then a condition to whitelist coldplugged bridges was added and later whitelisting of devices that advertise presence of their own AML description.
With non hotplug and hotplug code separated, it is possible to relax rules and allow describing all non-hotpluggble functions and hence simplify conditions whether PCI device should be enumerated by generic (non-hotplug) code.
Price of that simplification is an extra few Device() descriptors in DSDT exposing built-in chipset functions, which has no functional effect on guest side.
Apart from that, the enumeration of non zero functions, allows to attach more NICs with acpi-index enabled directly on hostbridge (if hotplug is not required).
---
* patch is making acpi-index feature support complete in the scope of host bridge (support of acpi-index on PXB is out of scope of this series, and probably should follow host-bridge clean up)
* follow up patch will add a tests case with acpi-index enabled PCI device on non zero function to demonstrate that.
--- hw/i386/acpi-build.c | 6 ------ 1 file changed, 6 deletions(-)
hw/i386/acpi-build.c +0 -6
@@ -494,12 +494,6 @@ static bool is_devfn_ignored_generic(const int devfn, const PCIBus *bus)if (DEVICE (pdev)->hotplugged) {return true; } - }else if (!get_dev_aml_func (DEVICE (pdev))) { -/* -* Ignore all other devices on !0 functions unless they -* have AML description (i.e have get_dev_aml_func() != 0) -*/ -return true; } }return false;
Signature · 1 line
2.39.1
PATCH v2 25/34 tests: acpi: update expected blobs
In reply to Igor Mammedovin PC machine case piix3-ide and PIIX4_PM get exposed
+ Device (S09)
+ {
+ Name (_ADR, 0x00010001) // _ADR: Address
+ }
+
+ Device (S0B)
+ {
+ Name (_ADR, 0x00010003) // _ADR: Address
+ }
in q35 machine case ich9-ahci gets exposed
+ Device (SFA)
+ {
+ Name (_ADR, 0x001F0002) // _ADR: Address
+ }
and addtional pci-testdev, virtio-balloon exposed in q35 multi-bridge test case
+ Device (S14)
+ {
+ Name (_ADR, 0x00020004) // _ADR: Address
+ }
+
...
+ Device (S22)
+ {
+ Name (_ADR, 0x00040002) // _ADR: Address
+ }
--- tests/qtest/bios-tables-test-allowed-diff.h | 37 ------------------ tests/data/acpi/pc/DSDT | Bin 6454 -> 6488 bytes tests/data/acpi/pc/DSDT.acpierst | Bin 6377 -> 6411 bytes tests/data/acpi/pc/DSDT.acpihmat | Bin 7779 -> 7813 bytes tests/data/acpi/pc/DSDT.bridge | Bin 12581 -> 12615 bytes tests/data/acpi/pc/DSDT.cphp | Bin 6918 -> 6952 bytes tests/data/acpi/pc/DSDT.dimmpxm | Bin 8108 -> 8142 bytes tests/data/acpi/pc/DSDT.hpbridge | Bin 6417 -> 6451 bytes tests/data/acpi/pc/DSDT.hpbrroot | Bin 3309 -> 3343 bytes tests/data/acpi/pc/DSDT.ipmikcs | Bin 6526 -> 6560 bytes tests/data/acpi/pc/DSDT.memhp | Bin 7813 -> 7847 bytes tests/data/acpi/pc/DSDT.nohpet | Bin 6312 -> 6346 bytes tests/data/acpi/pc/DSDT.numamem | Bin 6460 -> 6494 bytes tests/data/acpi/pc/DSDT.roothp | Bin 9839 -> 9873 bytes tests/data/acpi/q35/DSDT | Bin 8344 -> 8361 bytes tests/data/acpi/q35/DSDT.acpierst | Bin 8361 -> 8378 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9669 -> 9686 bytes tests/data/acpi/q35/DSDT.acpihmat-noinitiator | Bin 8623 -> 8640 bytes tests/data/acpi/q35/DSDT.applesmc | Bin 8390 -> 8407 bytes tests/data/acpi/q35/DSDT.bridge | Bin 11573 -> 11590 bytes tests/data/acpi/q35/DSDT.core-count2 | Bin 32484 -> 32501 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8808 -> 8825 bytes tests/data/acpi/q35/DSDT.cxl | Bin 9656 -> 9673 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9998 -> 10015 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 8419 -> 8436 bytes tests/data/acpi/q35/DSDT.ipmismbus | Bin 8432 -> 8449 bytes tests/data/acpi/q35/DSDT.ivrs | Bin 8361 -> 8378 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9703 -> 9720 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 9474 -> 9491 bytes tests/data/acpi/q35/DSDT.multi-bridge | Bin 12678 -> 12729 bytes tests/data/acpi/q35/DSDT.noacpihp | Bin 8188 -> 8205 bytes tests/data/acpi/q35/DSDT.nohpet | Bin 8202 -> 8219 bytes tests/data/acpi/q35/DSDT.numamem | Bin 8350 -> 8367 bytes tests/data/acpi/q35/DSDT.pvpanic-isa | Bin 8445 -> 8462 bytes tests/data/acpi/q35/DSDT.tis.tpm12 | Bin 8950 -> 8967 bytes tests/data/acpi/q35/DSDT.tis.tpm2 | Bin 8976 -> 8993 bytes tests/data/acpi/q35/DSDT.viot | Bin 9453 -> 9470 bytes tests/data/acpi/q35/DSDT.xapic | Bin 35707 -> 35724 bytes 38 files changed, 37 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -37
@@ -1,38 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT" , -"tests/data/acpi/pc/DSDT.acpierst" , -"tests/data/acpi/pc/DSDT.acpihmat" , -"tests/data/acpi/pc/DSDT.bridge" , -"tests/data/acpi/pc/DSDT.cphp" , -"tests/data/acpi/pc/DSDT.dimmpxm" , -"tests/data/acpi/pc/DSDT.hpbridge" , -"tests/data/acpi/pc/DSDT.hpbrroot" , -"tests/data/acpi/pc/DSDT.ipmikcs" , -"tests/data/acpi/pc/DSDT.memhp" , -"tests/data/acpi/pc/DSDT.nohpet" , -"tests/data/acpi/pc/DSDT.numamem" , -"tests/data/acpi/pc/DSDT.roothp" , -"tests/data/acpi/q35/DSDT" , -"tests/data/acpi/q35/DSDT.acpierst" , -"tests/data/acpi/q35/DSDT.acpihmat" , -"tests/data/acpi/q35/DSDT.acpihmat-noinitiator" , -"tests/data/acpi/q35/DSDT.applesmc" , -"tests/data/acpi/q35/DSDT.bridge" , -"tests/data/acpi/q35/DSDT.core-count2" , -"tests/data/acpi/q35/DSDT.cphp" , -"tests/data/acpi/q35/DSDT.cxl" , -"tests/data/acpi/q35/DSDT.dimmpxm" , -"tests/data/acpi/q35/DSDT.ipmibt" , -"tests/data/acpi/q35/DSDT.ipmismbus" , -"tests/data/acpi/q35/DSDT.ivrs" , -"tests/data/acpi/q35/DSDT.memhp" , -"tests/data/acpi/q35/DSDT.mmio64" , -"tests/data/acpi/q35/DSDT.multi-bridge" , -"tests/data/acpi/q35/DSDT.noacpihp" , -"tests/data/acpi/q35/DSDT.nohpet" , -"tests/data/acpi/q35/DSDT.numamem" , -"tests/data/acpi/q35/DSDT.pvpanic-isa" , -"tests/data/acpi/q35/DSDT.tis.tpm12" , -"tests/data/acpi/q35/DSDT.tis.tpm2" , -"tests/data/acpi/q35/DSDT.viot" , -"tests/data/acpi/q35/DSDT.xapic",
tests/data/acpi/pc/DSDT binary +0 -0
tests/data/acpi/pc/DSDT.acpierst binary +0 -0
tests/data/acpi/pc/DSDT.acpihmat binary +0 -0
tests/data/acpi/pc/DSDT.bridge binary +0 -0
tests/data/acpi/pc/DSDT.cphp binary +0 -0
tests/data/acpi/pc/DSDT.dimmpxm binary +0 -0
tests/data/acpi/pc/DSDT.hpbridge binary +0 -0
tests/data/acpi/pc/DSDT.hpbrroot binary +0 -0
tests/data/acpi/pc/DSDT.ipmikcs binary +0 -0
tests/data/acpi/pc/DSDT.memhp binary +0 -0
tests/data/acpi/pc/DSDT.nohpet binary +0 -0
tests/data/acpi/pc/DSDT.numamem binary +0 -0
tests/data/acpi/pc/DSDT.roothp binary +0 -0
tests/data/acpi/q35/DSDT binary +0 -0
tests/data/acpi/q35/DSDT.acpierst binary +0 -0
tests/data/acpi/q35/DSDT.acpihmat binary +0 -0
tests/data/acpi/q35/DSDT.acpihmat-noinitiator binary +0 -0
tests/data/acpi/q35/DSDT.applesmc binary +0 -0
tests/data/acpi/q35/DSDT.bridge binary +0 -0
tests/data/acpi/q35/DSDT.core-count2 binary +0 -0
tests/data/acpi/q35/DSDT.cphp binary +0 -0
tests/data/acpi/q35/DSDT.cxl binary +0 -0
tests/data/acpi/q35/DSDT.dimmpxm binary +0 -0
tests/data/acpi/q35/DSDT.ipmibt binary +0 -0
tests/data/acpi/q35/DSDT.ipmismbus binary +0 -0
tests/data/acpi/q35/DSDT.ivrs binary +0 -0
tests/data/acpi/q35/DSDT.memhp binary +0 -0
tests/data/acpi/q35/DSDT.mmio64 binary +0 -0
tests/data/acpi/q35/DSDT.multi-bridge binary +0 -0
tests/data/acpi/q35/DSDT.noacpihp binary +0 -0
tests/data/acpi/q35/DSDT.nohpet binary +0 -0
tests/data/acpi/q35/DSDT.numamem binary +0 -0
tests/data/acpi/q35/DSDT.pvpanic-isa binary +0 -0
tests/data/acpi/q35/DSDT.tis.tpm12 binary +0 -0
tests/data/acpi/q35/DSDT.tis.tpm2 binary +0 -0
tests/data/acpi/q35/DSDT.viot binary +0 -0
tests/data/acpi/q35/DSDT.xapic binary +0 -0
Signature · 1 line
2.39.1
PATCH v2 26/34 tests: acpi: whitelist DSDT before adding non-0 function device with acpi-index to testcases
In reply to Igor Mammedov--- tests/qtest/bios-tables-test-allowed-diff.h | 2 ++ 1 file changed, 2 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +2 -0
@@ -1 +1,3 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/DSDT.multi-bridge" , +"tests/data/acpi/q35/DSDT.noacpihp",
Signature · 1 line
2.39.1
PATCH v2 27/34 tests: acpi: add non zero function device with acpi-index on non-hotpluggble bus
In reply to Igor Mammedov--- tests/qtest/bios-tables-test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tests/qtest/bios-tables-test.c +4 -2
@@ -1028,10 +1028,11 @@ static void test_acpi_q35_tcg_no_acpi_hotplug(void)"addr=7.0" " -device pci-testdev,bus=nohprp,acpi-index=501" " -device pcie-root-port,id=nohprpint,port=0x0,chassis=3,hotplug=off," -"addr=8.0" +"multifunction=on,addr=8.0" +" -device pci-testdev,bus=nohprpint,acpi-index=601,addr=8.1" " -device pcie-root-port,id=hprp2,port=0x0,chassis=4,bus=nohprpint," "addr=9.0" -" -device pci-testdev,bus=hprp2,acpi-index=601" +" -device pci-testdev,bus=hprp2,acpi-index=602" , &data);free_test_data (&data); }
@@ -1053,6 +1054,7 @@ static void test_acpi_q35_multif_bridge(void)" -device pcie-root-port,id=rphptgt2,port=0x0,chassis=6,addr=2.2" " -device pcie-root-port,id=rphptgt3,port=0x0,chassis=7,addr=2.3" " -device pci-testdev,bus=pcie.0,addr=2.4" +" -device pci-testdev,bus=pcie.0,addr=2.5,acpi-index=102" " -device pci-testdev,bus=pcie.0,addr=5.0" " -device pci-testdev,bus=pcie.0,addr=0xf.0,acpi-index=101" " -device pci-testdev,bus=rp0,addr=0.0"
Signature · 1 line
2.39.1
PATCH v2 28/34 tests: acpi: update expected blobs
In reply to Igor Mammedovan extra devices at non-zero function address with static _DSM method get exposed, ex:
+ Device (S15)
+ {
+ Name (_ADR, 0x00020005) // _ADR: Address
+ Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method
+ { + Local0 = Package (0x01)
+ {
+ 0x66
+ }
+ Return (EDSM (Arg0, Arg1, Arg2, Arg3, Local0))
+ }
+ }
--- tests/qtest/bios-tables-test-allowed-diff.h | 2 -- tests/data/acpi/q35/DSDT.multi-bridge | Bin 12729 -> 12770 bytes tests/data/acpi/q35/DSDT.noacpihp | Bin 8205 -> 8248 bytes 3 files changed, 2 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -2
@@ -1,3 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/DSDT.multi-bridge" , -"tests/data/acpi/q35/DSDT.noacpihp",
tests/data/acpi/q35/DSDT.multi-bridge binary +0 -0
tests/data/acpi/q35/DSDT.noacpihp binary +0 -0
Signature · 1 line
2.39.1
PATCH v2 29/34 pci: move acpi-index uniqueness check to generic PCI device code
In reply to Igor Mammedovacpi-index is now working with non-hotpluggable buses (pci/q35 machine hostbridge), it can be used even if ACPI PCI hotplug is disabled and as result acpi-index uniqueness check will be omitted (since the check is done by ACPI PCI hotplug handler, which isn't wired when ACPI PCI hotplug is disabled).
Move check and related code to generic PCIDevice so it would be independent of ACPI PCI hotplug.
---
PS: this also one step closer to enabling acpi-index support for microvm and virt/arm machines.
--- hw/acpi/pcihp.c | 56 ------------------------------------------------ hw/pci/pci.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 56 deletions(-)
hw/acpi/pcihp.c +0 -56
@@ -54,21 +54,6 @@ typedef struct AcpiPciHpFind {PCIBus *bus; } AcpiPciHpFind; -static gint g_cmp_uint32 (gconstpointer a,gconstpointer b,gpointer user_data) -{ -return a - b; -} - -static GSequence *pci_acpi_index_list (void ) -{ -static GSequence *used_acpi_index_list; - -if (!used_acpi_index_list) { - used_acpi_index_list =g_sequence_new (NULL ); - } -return used_acpi_index_list; -} -static int acpi_pcihp_get_bsel (PCIBus *bus) {Error *local_err =NULL ;
@@ -300,8 +285,6 @@ void acpi_pcihp_reset(AcpiPciHpState *s, bool acpihp_root_off)acpi_pcihp_update (s); } -#define ONBOARD_INDEX_MAX (16 * 1024 - 1) -void acpi_pcihp_device_pre_plug_cb (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp) {
@@ -314,34 +297,6 @@ void acpi_pcihp_device_pre_plug_cb(HotplugHandler *hotplug_dev, ACPI_PCIHP_PROP_BSEL "' set");return ; } - -/* -* capped by systemd (see: udev-builtin-net_id.c) -* as it's the only known user honor it to avoid users -* misconfigure QEMU and then wonder why acpi-index doesn't work -*/ -if (pdev->acpi_index >ONBOARD_INDEX_MAX ) { -error_setg (errp,"acpi-index should be less or equal to %u" , -ONBOARD_INDEX_MAX ); -return ; - } - -/* -* make sure that acpi-index is unique across all present PCI devices -*/ -if (pdev->acpi_index) { -GSequence *used_indexes =pci_acpi_index_list (); - -if (g_sequence_lookup (used_indexes,GINT_TO_POINTER (pdev->acpi_index), - g_cmp_uint32,NULL )) { -error_setg (errp,"a PCI device with acpi-index = %" PRIu32 -" already exist" , pdev->acpi_index); -return ; - } -g_sequence_insert_sorted (used_indexes, -GINT_TO_POINTER (pdev->acpi_index), - g_cmp_uint32,NULL ); - } } void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
@@ -401,17 +356,6 @@ void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,trace_acpi_pci_unplug (PCI_SLOT (pdev->devfn),acpi_pcihp_get_bsel (pci_get_bus (pdev))); -/* -* clean up acpi-index so it could reused by another device -*/ -if (pdev->acpi_index) { -GSequence *used_indexes =pci_acpi_index_list (); - -g_sequence_remove (g_sequence_lookup (used_indexes, -GINT_TO_POINTER (pdev->acpi_index), - g_cmp_uint32,NULL )); - } -qdev_unrealize (dev); }
hw/pci/pci.c +57 -0
81 lines not on this page · raw message
Signature · 1 line
2.39.1
PATCH v2 30/34 acpi: pci: drop BSEL usage when deciding that device isn't hotpluggable
In reply to Igor Mammedovprevious commit ("pci: fix 'hotplugglable' property behavior") fixed pcie root port's 'hotpluggable' property to behave consistently.
So we don't need a BSEL crutch anymore to see of device is not hotpluggable, drop it from 'generic' PCI slots description handling.
BSEL is still used to decide if hotplug part should be called but that will be moved out of generic code to hotplug one by followup patches.
--- hw/i386/acpi-build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/acpi-build.c +1 -1
@@ -591,7 +591,7 @@ void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus)call_dev_aml_func (DEVICE (bus->devices[devfn]), dev);/* add _DSM if device has acpi-index set */ -if (pdev->acpi_index && !bsel && +if (pdev->acpi_index && !object_property_get_bool (OBJECT (pdev),"hotpluggable" , &error_abort)) {aml_append (dev,aml_pci_static_endpoint_dsm (pdev));
Signature · 1 line
2.39.1
PATCH v2 31/34 acpi: pci: move BSEL into build_append_pcihp_slots()
In reply to Igor MammedovGeneric PCI enumeration code doesn't really need access to BSEL value, it is only used as means to decide if hotplug enumerator should be called.
Use stateless object_property_find() to do that, and move the rest of BSEL handling into build_append_pcihp_slots() where it belongs.
This cleans up generic code a bit from hotplug stuff and follow up patch will remove remaining call to build_append_pcihp_slots() from generic code, making it possible to use without ACPI PCI hotplug dependencies.
--- hw/i386/acpi-build.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
hw/i386/acpi-build.c +6 -9
@@ -520,12 +520,14 @@ static bool is_devfn_ignored_hotplug(const int devfn, const PCIBus *bus)return false; } -static void build_append_pcihp_slots (Aml *parent_scope,PCIBus *bus, -QObject *bsel) +static void build_append_pcihp_slots (Aml *parent_scope,PCIBus *bus) {int devfn;Aml *dev, *notify_method =NULL , *method; +QObject *bsel =object_property_get_qobject (OBJECT (bus), +ACPI_PCIHP_PROP_BSEL ,NULL );uint64_t bsel_val =qnum_get_uint (qobject_to (QNum, bsel)); +qobject_unref (bsel);aml_append (parent_scope,aml_name_decl ("BSEL" ,aml_int (bsel_val))); notify_method =aml_method ("DVNT" ,2 ,AML_NOTSERIALIZED );
@@ -570,12 +572,9 @@ static void build_append_pcihp_slots(Aml *parent_scope, PCIBus *bus,void build_append_pci_bus_devices (Aml *parent_scope,PCIBus *bus) { -QObject *bsel;int devfn;Aml *dev; - bsel =object_property_get_qobject (OBJECT (bus),ACPI_PCIHP_PROP_BSEL ,NULL ); -for (devfn =0 ; devfn <ARRAY_SIZE (bus->devices); devfn++) {/* ACPI spec: 1.0b: Table 6-2 _ADR Object Bus Types, PCI type */ int adr =PCI_SLOT (devfn) <<16 |PCI_FUNC (devfn);
@@ -601,11 +600,9 @@ void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus)aml_append (parent_scope, dev); } -if (bsel) { -build_append_pcihp_slots (parent_scope, bus, bsel); +if (object_property_find (OBJECT (bus),ACPI_PCIHP_PROP_BSEL )) { +build_append_pcihp_slots (parent_scope, bus); } - -qobject_unref (bsel); } static bool build_append_notfication_callback(Aml *parent_scope,
Signature · 1 line
2.39.1
PATCH v2 32/34 acpi: pci: move out ACPI PCI hotplug generator from generic slot generator build_append_pci_bus_devices()
In reply to Igor Mammedov--- include/hw/acpi/pcihp.h | 2 ++ hw/acpi/pci-bridge.c | 12 +++++++++++- hw/i386/acpi-build.c | 9 ++++----- 3 files changed, 17 insertions(+), 6 deletions(-)
include/hw/acpi/pcihp.h +2 -0
@@ -71,6 +71,8 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev,/* Called on reset */ void acpi_pcihp_reset (AcpiPciHpState *s,bool acpihp_root_off); +void build_append_pcihp_slots (Aml *parent_scope,PCIBus *bus); +extern const VMStateDescription vmstate_acpi_pcihp_pci_status;#define VMSTATE_PCI_HOTPLUG (pcihp, state, test_pcihp, test_acpi_index) \
hw/acpi/pci-bridge.c +11 -1
@@ -22,6 +22,16 @@ void build_pci_bridge_aml(AcpiDevAmlIf *adev, Aml *scope)PCIBridge *br =PCI_BRIDGE (adev);if (!DEVICE (br)->hotplugged) { -build_append_pci_bus_devices (scope,pci_bridge_get_sec_bus (br)); +PCIBus *sec_bus =pci_bridge_get_sec_bus (br); + +build_append_pci_bus_devices (scope, sec_bus); + +/* +* generate hotplug slots descriptors if +* bridge has ACPI PCI hotplug attached, +*/ +if (object_property_find (OBJECT (sec_bus),ACPI_PCIHP_PROP_BSEL )) { +build_append_pcihp_slots (scope, sec_bus); + } } }
hw/i386/acpi-build.c +4 -5
@@ -520,7 +520,7 @@ static bool is_devfn_ignored_hotplug(const int devfn, const PCIBus *bus)return false; } -static void build_append_pcihp_slots (Aml *parent_scope,PCIBus *bus) +void build_append_pcihp_slots (Aml *parent_scope,PCIBus *bus) {int devfn;Aml *dev, *notify_method =NULL , *method;
@@ -599,10 +599,6 @@ void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus)/* device descriptor has been composed, add it into parent context */ aml_append (parent_scope, dev); } - -if (object_property_find (OBJECT (bus),ACPI_PCIHP_PROP_BSEL )) { -build_append_pcihp_slots (parent_scope, bus); - } } static bool build_append_notfication_callback(Aml *parent_scope,
@@ -1790,6 +1786,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,Aml *scope =aml_scope ("PCI0" );/* Scan all PCI buses. Generate tables to support hotplug. */ build_append_pci_bus_devices (scope, bus); +if (object_property_find (OBJECT (bus),ACPI_PCIHP_PROP_BSEL )) { +build_append_pcihp_slots (scope, bus); + }aml_append (sb_scope, scope); } }
Signature · 1 line
2.39.1
PATCH v2 33/34 pcihp: move fields enabling hotplug into AcpiPciHpState
In reply to Igor Mammedov... instead of duplicating them in piix4 and lpc and then trying to pass them to pcihp routines as arguments. it simplifies call sites and places pcihp specific in its own structure.
--- include/hw/acpi/pcihp.h | 8 ++++---- include/hw/acpi/piix4.h | 2 -- hw/acpi/acpi-pci-hotplug-stub.c | 5 ++--- hw/acpi/ich9.c | 15 +++++++-------- hw/acpi/pcihp.c | 16 ++++++++-------- hw/acpi/piix4.c | 23 +++++++++++++---------- 6 files changed, 34 insertions(+), 35 deletions(-)
include/hw/acpi/pcihp.h +4 -4
@@ -49,14 +49,14 @@ typedef struct AcpiPciHpState {uint32_t acpi_index;PCIBus *root;MemoryRegion io; -bool legacy_piix;uint16_t io_base;uint16_t io_len; +bool use_acpi_hotplug_bridge; +bool use_acpi_root_pci_hotplug; } AcpiPciHpState;void acpi_pcihp_init (Object *owner,AcpiPciHpState *,PCIBus *root, -MemoryRegion *address_space_io,bool bridges_enabled, -uint16_t io_base); +MemoryRegion *address_space_io,uint16_t io_base);void acpi_pcihp_device_pre_plug_cb (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp);
@@ -69,7 +69,7 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev, Error **errp);/* Called on reset */ -void acpi_pcihp_reset (AcpiPciHpState *s,bool acpihp_root_off); +void acpi_pcihp_reset (AcpiPciHpState *s);void build_append_pcihp_slots (Aml *parent_scope,PCIBus *bus);
include/hw/acpi/piix4.h +0 -2
@@ -57,8 +57,6 @@ struct PIIX4PMState {Notifier powerdown_notifier;AcpiPciHpState acpi_pci_hotplug; -bool use_acpi_hotplug_bridge; -bool use_acpi_root_pci_hotplug;bool not_migrate_acpi_index;uint8_t disable_s3;
hw/acpi/acpi-pci-hotplug-stub.c +2 -3
@@ -5,8 +5,7 @@const VMStateDescription vmstate_acpi_pcihp_pci_status;void acpi_pcihp_init (Object *owner,AcpiPciHpState *s,PCIBus *root_bus, -MemoryRegion *address_space_io,bool bridges_enabled, -uint16_t io_base) +MemoryRegion *address_space_io,uint16_t io_base) {return ; }
@@ -36,7 +35,7 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev,return ; } -void acpi_pcihp_reset (AcpiPciHpState *s,bool acpihp_root_off) +void acpi_pcihp_reset (AcpiPciHpState *s) {return ; }
hw/acpi/ich9.c +7 -8
@@ -218,7 +218,7 @@ static bool vmstate_test_use_pcihp(void *opaque) {ICH9LPCPMRegs *s = opaque; -return s->use_acpi_hotplug_bridge; +return s->acpi_pci_hotplug.use_acpi_hotplug_bridge; }static const VMStateDescription vmstate_pcihp_state = {
@@ -277,8 +277,8 @@ static void pm_reset(void *opaque) } pm->smi_en_wmask = ~0 ; -if (pm->use_acpi_hotplug_bridge) { -acpi_pcihp_reset (&pm->acpi_pci_hotplug, true); +if (pm->acpi_pci_hotplug.use_acpi_hotplug_bridge) { +acpi_pcihp_reset (&pm->acpi_pci_hotplug); }acpi_update_sci (&pm->acpi_regs, pm->irq);
@@ -316,12 +316,11 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq)acpi_pm_tco_init (&pm->tco_regs, &pm->io); } -if (pm->use_acpi_hotplug_bridge) { +if (pm->acpi_pci_hotplug.use_acpi_hotplug_bridge) {acpi_pcihp_init (OBJECT (lpc_pci), &pm->acpi_pci_hotplug,pci_get_bus (lpc_pci),pci_address_space_io (lpc_pci), - true,ACPI_PCIHP_ADDR_ICH9 ); qbus_set_hotplug_handler(BUS(pci_get_bus(lpc_pci)),
@@ -403,14 +402,14 @@ static bool ich9_pm_get_acpi_pci_hotplug(Object *obj, Error **errp) {ICH9LPCState *s =ICH9_LPC_DEVICE (obj); -return s->pm.use_acpi_hotplug_bridge; +return s->pm.acpi_pci_hotplug.use_acpi_hotplug_bridge; }static void ich9_pm_set_acpi_pci_hotplug (Object *obj,bool value,Error **errp) {ICH9LPCState *s =ICH9_LPC_DEVICE (obj); - s->pm.use_acpi_hotplug_bridge = value; + s->pm.acpi_pci_hotplug.use_acpi_hotplug_bridge = value; }static bool ich9_pm_get_keep_pci_slot_hpc (Object *obj,Error **errp)
@@ -435,7 +434,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) pm->disable_s3 =0 ; pm->disable_s4 =0 ; pm->s4_val =2 ; - pm->use_acpi_hotplug_bridge = true; + pm->acpi_pci_hotplug.use_acpi_hotplug_bridge = true; pm->keep_pci_slot_hpc = true; pm->enable_tco = true;
hw/acpi/pcihp.c +8 -8
@@ -276,12 +276,12 @@ static void acpi_pcihp_update(AcpiPciHpState *s) } } -void acpi_pcihp_reset (AcpiPciHpState *s,bool acpihp_root_off) +void acpi_pcihp_reset (AcpiPciHpState *s) { -if (acpihp_root_off) { +if (!s->use_acpi_root_pci_hotplug) {acpi_pcihp_disable_root_bus (); } -acpi_set_pci_info (!s->legacy_piix); +acpi_set_pci_info (s->use_acpi_hotplug_bridge);acpi_pcihp_update (s); }
@@ -316,7 +316,7 @@ void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,* Overwrite the default hotplug handler with the ACPI PCI one * for cold plugged bridges only. */ -if (!s->legacy_piix && +if (s->use_acpi_hotplug_bridge &&object_dynamic_cast (OBJECT (dev),TYPE_PCI_BRIDGE )) {PCIBus *sec =pci_bridge_get_sec_bus (PCI_BRIDGE (pdev));
@@ -398,7 +398,7 @@ static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)switch (addr) {case PCI_UP_BASE : val = s->acpi_pcihp_pci_status[bsel].up; -if (!s->legacy_piix) { +if (s->use_acpi_hotplug_bridge) { s->acpi_pcihp_pci_status[bsel].up =0 ; }trace_acpi_pci_up_read (val);
@@ -473,7 +473,8 @@ static void pci_write(void *opaque, hwaddr addr, uint64_t data,trace_acpi_pci_ej_write (addr, data);break ;case PCI_SEL_BASE : - s->hotplug_select = s->legacy_piix ?ACPI_PCIHP_BSEL_DEFAULT : data; + s->hotplug_select = s->use_acpi_hotplug_bridge ? data : +ACPI_PCIHP_BSEL_DEFAULT ;trace_acpi_pci_sel_write (addr, data);default :break ;
@@ -491,14 +492,13 @@ static const MemoryRegionOps acpi_pcihp_io_ops = { };void acpi_pcihp_init (Object *owner,AcpiPciHpState *s,PCIBus *root_bus, -MemoryRegion *address_space_io,bool bridges_enabled, +MemoryRegion *address_space_io,uint16_t io_base) { s->io_len =ACPI_PCIHP_SIZE ; s->io_base = io_base; s->root = root_bus; - s->legacy_piix = !bridges_enabled;memory_region_init_io (&s->io, owner, &acpi_pcihp_io_ops, s,"acpi-pci-hotplug" , s->io_len);
hw/acpi/piix4.c +13 -10
@@ -170,14 +170,14 @@ static const VMStateDescription vmstate_pci_status = {static bool vmstate_test_use_acpi_hotplug_bridge (void *opaque,int version_id) {PIIX4PMState *s = opaque; -return s->use_acpi_hotplug_bridge; +return s->acpi_pci_hotplug.use_acpi_hotplug_bridge; }static bool vmstate_test_no_use_acpi_hotplug_bridge (void *opaque,int version_id) {PIIX4PMState *s = opaque; -return !s->use_acpi_hotplug_bridge; +return !s->acpi_pci_hotplug.use_acpi_hotplug_bridge; }static bool vmstate_test_use_memhp (void *opaque)
@@ -234,7 +234,8 @@ static bool piix4_vmstate_need_smbus(void *opaque, int version_id)static bool vmstate_test_migrate_acpi_index (void *opaque,int version_id) {PIIX4PMState *s =PIIX4_PM (opaque); -return s->use_acpi_hotplug_bridge && !s->not_migrate_acpi_index; +return s->acpi_pci_hotplug.use_acpi_hotplug_bridge && + !s->not_migrate_acpi_index; }/* qemu-kvm 1.2 uses version 3 but advertised as 2
@@ -303,8 +304,9 @@ static void piix4_pm_reset(DeviceState *dev)acpi_update_sci (&s->ar, s->irq);pm_io_space_update (s); -if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) { -acpi_pcihp_reset (&s->acpi_pci_hotplug, !s->use_acpi_root_pci_hotplug); +if (s->acpi_pci_hotplug.use_acpi_hotplug_bridge || + s->acpi_pci_hotplug.use_acpi_root_pci_hotplug) { +acpi_pcihp_reset (&s->acpi_pci_hotplug); } }
@@ -487,7 +489,7 @@ static void piix4_pm_realize(PCIDevice *dev, Error **errp)qemu_add_machine_init_done_notifier (&s->machine_ready);if (xen_enabled ()) { - s->use_acpi_hotplug_bridge = false; + s->acpi_pci_hotplug.use_acpi_hotplug_bridge = false; } piix4_acpi_system_hot_add_init(pci_address_space_io(dev),
@@ -560,9 +562,10 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent, "acpi-gpe0", GPE_LEN);memory_region_add_subregion (parent,GPE_BASE , &s->io_gpe); -if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) { +if (s->acpi_pci_hotplug.use_acpi_hotplug_bridge || + s->acpi_pci_hotplug.use_acpi_root_pci_hotplug) {acpi_pcihp_init (OBJECT (s), &s->acpi_pci_hotplug, bus, parent, - s->use_acpi_hotplug_bridge,ACPI_PCIHP_ADDR_PIIX4 ); +ACPI_PCIHP_ADDR_PIIX4 );qbus_set_hotplug_handler (BUS (pci_get_bus (PCI_DEVICE (s))),OBJECT (s)); }
@@ -602,9 +605,9 @@ static Property piix4_pm_properties[] = {DEFINE_PROP_UINT8 (ACPI_PM_PROP_S4_DISABLED , PIIX4PMState, disable_s4,0 ),DEFINE_PROP_UINT8 (ACPI_PM_PROP_S4_VAL , PIIX4PMState, s4_val,2 ),DEFINE_PROP_BOOL (ACPI_PM_PROP_ACPI_PCIHP_BRIDGE , PIIX4PMState, - use_acpi_hotplug_bridge, true), + acpi_pci_hotplug.use_acpi_hotplug_bridge, true),DEFINE_PROP_BOOL (ACPI_PM_PROP_ACPI_PCI_ROOTHP , PIIX4PMState, - use_acpi_root_pci_hotplug, true), + acpi_pci_hotplug.use_acpi_root_pci_hotplug, true),DEFINE_PROP_BOOL ("memory-hotplug-support" , PIIX4PMState, acpi_memory_hotplug.is_enabled, true), DEFINE_PROP_BOOL("smm-compat", PIIX4PMState, smm_compat, false),
Signature · 1 line
2.39.1
PATCH v2 34/34 pcihp: add ACPI PCI hotplug specific is_hotpluggable_bus() callback
In reply to Igor MammedovProvide pcihp specific callback to check if bus is hotpluggable and consolidate its scattered hotplug criteria there. While at it clean up no longer needed
qbus_set_hotplug_handler(BUS(bus), NULL)
workarounds since callback makes qbus_is_hotpluggable() return correct answer even if hotplug_handler is set on bus.
PS:
see ("pci: fix 'hotplugglable' property behavior") for details why callback was introduced.
--- include/hw/acpi/ich9.h | 1 + include/hw/acpi/pcihp.h | 1 + hw/acpi/acpi-pci-hotplug-stub.c | 4 ++++ hw/acpi/ich9.c | 6 +++++ hw/acpi/pcihp.c | 42 ++++++++++++++------------------- hw/acpi/piix4.c | 8 +++++++ hw/isa/lpc_ich9.c | 1 + 7 files changed, 39 insertions(+), 24 deletions(-)
include/hw/acpi/ich9.h +1 -0
@@ -87,6 +87,7 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp);void ich9_pm_device_unplug_cb (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp); +bool ich9_pm_is_hotpluggable_bus (HotplugHandler *hotplug_dev,BusState *bus);void ich9_pm_ospm_status (AcpiDeviceIf *adev,ACPIOSTInfoList ***list);#endif /* HW_ACPI_ICH9_H */
include/hw/acpi/pcihp.h +1 -0
@@ -58,6 +58,7 @@ typedef struct AcpiPciHpState {void acpi_pcihp_init (Object *owner,AcpiPciHpState *,PCIBus *root,MemoryRegion *address_space_io,uint16_t io_base); +bool acpi_pcihp_is_hotpluggbale_bus (AcpiPciHpState *s,BusState *bus);void acpi_pcihp_device_pre_plug_cb (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp); void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
hw/acpi/acpi-pci-hotplug-stub.c +4 -0
@@ -40,3 +40,7 @@ void acpi_pcihp_reset(AcpiPciHpState *s)return ; } +bool acpi_pcihp_is_hotpluggbale_bus (AcpiPciHpState *s,BusState *bus) +{ +return true; +}
hw/acpi/ich9.c +6 -0
@@ -578,6 +578,12 @@ void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, } } +bool ich9_pm_is_hotpluggable_bus (HotplugHandler *hotplug_dev,BusState *bus) +{ +ICH9LPCState *lpc =ICH9_LPC_DEVICE (hotplug_dev); +return acpi_pcihp_is_hotpluggbale_bus (&lpc->pm.acpi_pci_hotplug, bus); +} +void ich9_pm_ospm_status (AcpiDeviceIf *adev,ACPIOSTInfoList ***list) {ICH9LPCState *s =ICH9_LPC_DEVICE (adev);
hw/acpi/pcihp.c +18 -24
66 lines not on this page · raw message
hw/acpi/piix4.c +8 -0
@@ -404,6 +404,13 @@ static void piix4_device_unplug_cb(HotplugHandler *hotplug_dev, } } +static bool piix4_is_hotpluggable_bus (HotplugHandler *hotplug_dev, +BusState *bus) +{ +PIIX4PMState *s =PIIX4_PM (hotplug_dev); +return acpi_pcihp_is_hotpluggbale_bus (&s->acpi_pci_hotplug, bus); +} +static void piix4_pm_machine_ready (Notifier *n,void *opaque) {PIIX4PMState *s =container_of (n, PIIX4PMState, machine_ready);
@@ -644,6 +651,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data) hc->plug = piix4_device_plug_cb; hc->unplug_request = piix4_device_unplug_request_cb; hc->unplug = piix4_device_unplug_cb; + hc->is_hotpluggable_bus = piix4_is_hotpluggable_bus; adevc->ospm_status = piix4_ospm_status; adevc->send_event = piix4_send_gpe; adevc->madt_cpu = pc_madt_cpu_entry;
hw/isa/lpc_ich9.c +1 -0
@@ -865,6 +865,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data) hc->plug = ich9_pm_device_plug_cb; hc->unplug_request = ich9_pm_device_unplug_request_cb; hc->unplug = ich9_pm_device_unplug_cb; + hc->is_hotpluggable_bus = ich9_pm_is_hotpluggable_bus; adevc->ospm_status = ich9_pm_ospm_status; adevc->send_event = ich9_send_gpe; adevc->madt_cpu = pc_madt_cpu_entry;
Signature · 1 line
2.39.1