hw/acpi: Fixes + tests for ACPI Generic Port Affinity Struturs
cover hw/acpi: Fixes + tests for ACPI Generic Port Affinity Struturs
A couple of issues have been reported on this code that has been merged for 9.2.
A) Missed a version number update in the qapi/qom.json docs when rebasing for 9.2.
B) A test failure on i686 (32bit) bios tables test for x86_64.
This second one was a refactoring mistake where visibility of the size of an array of 8 characters had been replaced with a pointer which on 64 bit hosts is also 8 bytes, but not on 32 bits, leading to a miss-alignment of the final structure in the table and a test failure. Fix by hard coding the size as 8 given it is always this size for the relevant ACPI HIDs.
For completeness the tests are also included. Some reference tables needed an update to incorporate other changes.
Jonathan Cameron (5):
hw/acpi: Fix size of HID in build_append_srat_acpi_device_handle() qapi/qom: Change Since entry for AcpiGenericPortProperties to 9.2
bios-tables-test: Allow for new acpihmat-generic-x test data.
bios-tables-test: Add complex SRAT / HMAT test for GI GP
bios-tables-test: Add data for complex numa test (GI, GP etc)
qapi/qom.json | 2 +- hw/acpi/aml-build.c | 2 +- tests/qtest/bios-tables-test.c | 97 ++++++++++++++++++ .../data/acpi/x86/q35/APIC.acpihmat-generic-x | Bin 0 -> 136 bytes .../data/acpi/x86/q35/CEDT.acpihmat-generic-x | Bin 0 -> 68 bytes .../data/acpi/x86/q35/DSDT.acpihmat-generic-x | Bin 0 -> 12599 bytes .../data/acpi/x86/q35/HMAT.acpihmat-generic-x | Bin 0 -> 360 bytes .../data/acpi/x86/q35/SRAT.acpihmat-generic-x | Bin 0 -> 520 bytes 8 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 tests/data/acpi/x86/q35/APIC.acpihmat-generic-x create mode 100644 tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x create mode 100644 tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x create mode 100644 tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x create mode 100644 tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x
Signature · 1 line
2.43.0
PATCH 1/5 hw/acpi: Fix size of HID in build_append_srat_acpi_device_handle()
The size should always be 8 so hard code that. By coincidience the incorrect use of sizeof(char *) is 8 on 64 bit hosts, but was caught by CI testing with i686 as the host.
--- hw/acpi/aml-build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/acpi/aml-build.c +1 -1
@@ -1960,7 +1960,7 @@ static void build_append_srat_acpi_device_handle(GArray *table_data, {assert (strlen (hid) ==8 );/* Device Handle - ACPI */ -for (int i =0 ; i <sizeof (hid); i++) { +for (int i =0 ; i <8 ; i++) {build_append_int_noprefix (table_data, hid[i],1 ); }build_append_int_noprefix (table_data, uid,4 );
Signature · 1 line
2.43.0
Re: [PATCH 1/5] hw/acpi: Fix size of HID in build_append_srat_acpi_device_handle()
Quoted 10 lines · Jonathan Cameron
The size should always be 8 so hard code that. By coincidience the incorrect use of
sizeof(char *)is 8 on 64 bit hosts, but was caught by CI testing with i686 as the host.Reported-by Michael S. Tsirkin <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>--- hw/acpi/aml-build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH 2/5 qapi/qom: Change Since entry for AcpiGenericPortProperties to 9.2
In reply to Jonathan Cameron viaThis feature was only applied during the 9.2 cycle, so reflect that rather than 9.1.
--- qapi/qom.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qapi/qom.json +1 -1
@@ -877,7 +877,7 @@ # complex as there may be interleaving across multiple devices # and shared links in the path. # -# Since: 9.1 +# Since: 9.2 ## { 'struct': 'AcpiGenericPortProperties', 'data': { 'pci-bus': 'str',
Signature · 1 line
2.43.0
Re: [PATCH 2/5] qapi/qom: Change Since entry for AcpiGenericPortProperties to 9.2
Quoted 9 lines · Jonathan Cameron
This feature was only applied during the 9.2 cycle, so reflect that rather than 9.1.
Reported-by Daniel P. Berrangé <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>--- qapi/qom.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH 3/5 bios-tables-test: Allow for new acpihmat-generic-x test data.
In reply to Jonathan Cameron viaThe test to be added exercises many corner cases of the SRAT and HMAT table generation.
--- tests/qtest/bios-tables-test-allowed-diff.h | 5 +++++ tests/data/acpi/x86/q35/APIC.acpihmat-generic-x | 0 tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x | 0 tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x | 0 tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x | 0 tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x | 0 6 files changed, 5 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +5 -0
@@ -1 +1,6 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/x86/q35/APIC.acpihmat-generic-x" , +"tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x" , +"tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x" , +"tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x" , +"tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x",
tests/data/acpi/x86/q35/APIC.acpihmat-generic-x new file +0 -0
tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x new file +0 -0
tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x new file +0 -0
tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x new file +0 -0
tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x new file +0 -0
Signature · 1 line
2.43.0
PATCH 4/5 bios-tables-test: Add complex SRAT / HMAT test for GI GP
In reply to Jonathan Cameron viaAdd a test with 6 nodes to exercise most interesting corner cases of SRAT and HMAT generation including the new Generic Initiator and Generic Port Affinity structures. More details of the set up in the following patch adding the table data.
--- tests/qtest/bios-tables-test.c | 97 ++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+)
tests/qtest/bios-tables-test.c +97 -0
@@ -1936,6 +1936,101 @@ static void test_acpi_q35_tcg_acpi_hmat_noinitiator(void)free_test_data (&data); } +/* Test intended to hit corner cases of SRAT and HMAT */ +static void test_acpi_q35_tcg_acpi_hmat_generic_x (void ) +{ +test_data data = {}; + + data.machine =MACHINE_Q35 ; + data.arch ="x86" ; + data.variant =".acpihmat-generic-x" ; +test_acpi_one (" -machine hmat=on,cxl=on" +" -smp 3,sockets=3" +" -m 128M,maxmem=384M,slots=2" +" -device pcie-root-port,chassis=1,id=pci.1" +" -device pci-testdev,bus=pci.1," +"multifunction=on,addr=00.0" +" -device pci-testdev,bus=pci.1,addr=00.1" +" -device pci-testdev,bus=pci.1,id=gidev,addr=00.2" +" -device pxb-cxl,bus_nr=64,bus=pcie.0,id=cxl.1" +" -object memory-backend-ram,size=64M,id=ram0" +" -object memory-backend-ram,size=64M,id=ram1" +" -numa node,nodeid=0,cpus=0,memdev=ram0" +" -numa node,nodeid=1" +" -object acpi-generic-initiator,id=gi0,pci-dev=gidev,node=1" +" -numa node,nodeid=2" +" -object acpi-generic-port,id=gp0,pci-bus=cxl.1,node=2" +" -numa node,nodeid=3,cpus=1" +" -numa node,nodeid=4,memdev=ram1" +" -numa node,nodeid=5,cpus=2" +" -numa hmat-lb,initiator=0,target=0,hierarchy=memory," +"data-type=access-latency,latency=10" +" -numa hmat-lb,initiator=0,target=0,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=800M" +" -numa hmat-lb,initiator=0,target=2,hierarchy=memory," +"data-type=access-latency,latency=100" +" -numa hmat-lb,initiator=0,target=2,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=200M" +" -numa hmat-lb,initiator=0,target=4,hierarchy=memory," +"data-type=access-latency,latency=100" +" -numa hmat-lb,initiator=0,target=4,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=200M" +" -numa hmat-lb,initiator=0,target=5,hierarchy=memory," +"data-type=access-latency,latency=200" +" -numa hmat-lb,initiator=0,target=5,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=400M" +" -numa hmat-lb,initiator=1,target=0,hierarchy=memory," +"data-type=access-latency,latency=500" +" -numa hmat-lb,initiator=1,target=0,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=100M" +" -numa hmat-lb,initiator=1,target=2,hierarchy=memory," +"data-type=access-latency,latency=50" +" -numa hmat-lb,initiator=1,target=2,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=400M" +" -numa hmat-lb,initiator=1,target=4,hierarchy=memory," +"data-type=access-latency,latency=50" +" -numa hmat-lb,initiator=1,target=4,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=800M" +" -numa hmat-lb,initiator=1,target=5,hierarchy=memory," +"data-type=access-latency,latency=500" +" -numa hmat-lb,initiator=1,target=5,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=100M" +" -numa hmat-lb,initiator=3,target=0,hierarchy=memory," +"data-type=access-latency,latency=20" +" -numa hmat-lb,initiator=3,target=0,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=400M" +" -numa hmat-lb,initiator=3,target=2,hierarchy=memory," +"data-type=access-latency,latency=80" +" -numa hmat-lb,initiator=3,target=2,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=200M" +" -numa hmat-lb,initiator=3,target=4,hierarchy=memory," +"data-type=access-latency,latency=80" +" -numa hmat-lb,initiator=3,target=4,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=200M" +" -numa hmat-lb,initiator=3,target=5,hierarchy=memory," +"data-type=access-latency,latency=20" +" -numa hmat-lb,initiator=3,target=5,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=400M" +" -numa hmat-lb,initiator=5,target=0,hierarchy=memory," +"data-type=access-latency,latency=20" +" -numa hmat-lb,initiator=5,target=0,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=400M" +" -numa hmat-lb,initiator=5,target=2,hierarchy=memory," +"data-type=access-latency,latency=80" +" -numa hmat-lb,initiator=5,target=4,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=200M" +" -numa hmat-lb,initiator=5,target=4,hierarchy=memory," +"data-type=access-latency,latency=80" +" -numa hmat-lb,initiator=5,target=2,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=200M" +" -numa hmat-lb,initiator=5,target=5,hierarchy=memory," +"data-type=access-latency,latency=10" +" -numa hmat-lb,initiator=5,target=5,hierarchy=memory," +"data-type=access-bandwidth,bandwidth=800M" , + &data); +free_test_data (&data); +} +#ifdef CONFIG_POSIX static void test_acpi_erst (const char *machine,const char *arch) {
@@ -2414,6 +2509,8 @@ int main(int argc, char *argv[])qtest_add_func ("acpi/q35/nohpet" , test_acpi_q35_tcg_nohpet);qtest_add_func ("acpi/q35/acpihmat-noinitiator" , test_acpi_q35_tcg_acpi_hmat_noinitiator); +qtest_add_func ("acpi/q35/acpihmat-genericx" , + test_acpi_q35_tcg_acpi_hmat_generic_x);/* i386 does not support memory hotplug */ if (strcmp (arch,"i386" )) {
Signature · 1 line
2.43.0
PATCH 5/5 bios-tables-test: Add data for complex numa test (GI, GP etc)
In reply to Jonathan Cameron viaGiven this is a new configuration, there are affects on APIC, CEDT and DSDT, but the key elements are in SRAT (plus related data in HMAT). The configuration has node to exercise many different combinations.
0) CPUs + Memory
1) GI only
2) GP only
3) CPUS only
4) Memory only
5) CPUs + HP memory
GI node, GP Node, Memory only node, hotplug memory
only node, latency and bandwidth such that in Linux Access0 (any initiator) and Access1 (CPU initiators only) given different answers. Following cropped to remove details of each entry.
[000h 0000 004h] Signature : "SRAT" [System Resource Affinity Table]
...
[030h 0048 001h] Subtable Type : 00 [Processor Local APIC/SAPIC Affinity]
...
[032h 0050 001h] Proximity Domain Low(8) : 00
[033h 0051 001h] Apic ID : 00
...
[040h 0064 001h] Subtable Type : 00 [Processor Local APIC/SAPIC Affinity]
...
[042h 0066 001h] Proximity Domain Low(8) : 03
[043h 0067 001h] Apic ID : 01
...
[050h 0080 001h] Subtable Type : 00 [Processor Local APIC/SAPIC Affinity]
...
[052h 0082 001h] Proximity Domain Low(8) : 05
[053h 0083 001h] Apic ID : 02
...
[060h 0096 001h] Subtable Type : 01 [Memory Affinity]
...
[062h 0098 004h] Proximity Domain : 00000000
...
[068h 0104 008h] Base Address : 0000000000000000
[070h 0112 008h] Address Length : 00000000000A0000
...
[088h 0136 001h] Subtable Type : 01 [Memory Affinity]
...
[08Ah 0138 004h] Proximity Domain : 00000000
...
[090h 0144 008h] Base Address : 0000000000100000
[098h 0152 008h] Address Length : 0000000003F00000
...
[0B0h 0176 001h] Subtable Type : 01 [Memory Affinity]
...
[0B2h 0178 004h] Proximity Domain : 00000004
...
[0B8h 0184 008h] Base Address : 0000000004000000
[0C0h 0192 008h] Address Length : 0000000004000000
... some zero length entries follow...
[1A0h 0416 001h] Subtable Type : 05 [Generic Initiator Affinity]
[1A1h 0417 001h] Length : 20
[1A2h 0418 001h] Reserved1 : 00
[1A3h 0419 001h] Device Handle Type : 01
[1A4h 0420 004h] Proximity Domain : 00000001
[1A8h 0424 010h] Device Handle : 00 00 01 02 00 00 00 00 00 00 00 00 00 00 00 00
[1B8h 0440 004h] Flags (decoded below) : 00000001
Enabled : 1
Architectural Transactions : 0
[1BCh 0444 004h] Reserved2 : 00000000
[1C0h 0448 001h] Subtable Type : 06 [Generic Port Affinity]
[1C1h 0449 001h] Length : 20
[1C2h 0450 001h] Reserved1 : 00
[1C3h 0451 001h] Device Handle Type : 00
[1C4h 0452 004h] Proximity Domain : 00000002
[1C8h 0456 010h] Device Handle : 41 43 50 49 30 30 31 36 40 00 00 00 00 00 00 00
[1D8h 0472 004h] Flags (decoded below) : 00000001
Enabled : 1
Architectural Transactions : 0
[1DCh 0476 004h] Reserved2 : 00000000
[1E0h 0480 001h] Subtable Type : 01 [Memory Affinity]
...
[1E2h 0482 004h] Proximity Domain : 00000005
...
[1E8h 0488 008h] Base Address : 0000000100000000
[1F0h 0496 008h] Address Length : 0000000090000000
Example block from HMAT:
[0F0h 0240 002h] Structure Type : 0001 [System Locality Latency and Bandwidth Information]
[0F2h 0242 002h] Reserved : 0000
[0F4h 0244 004h] Length : 00000078
[0F8h 0248 001h] Flags (decoded below) : 00
Memory Hierarchy : 0
Use Minimum Transfer Size : 0
Non-sequential Transfers : 0
[0F9h 0249 001h] Data Type : 03
[0FAh 0250 001h] Minimum Transfer Size : 00
[0FBh 0251 001h] Reserved1 : 00
[0FCh 0252 004h] Initiator Proximity Domains # : 00000004 [100h 0256 004h] Target Proximity Domains # : 00000006
[104h 0260 004h] Reserved2 : 00000000
[108h 0264 008h] Entry Base Unit : 0000000000000004
[110h 0272 004h] Initiator Proximity Domain List : 00000000 [114h 0276 004h] Initiator Proximity Domain List : 00000001 [118h 0280 004h] Initiator Proximity Domain List : 00000003 [11Ch 0284 004h] Initiator Proximity Domain List : 00000005 [120h 0288 004h] Target Proximity Domain List : 00000000 [124h 0292 004h] Target Proximity Domain List : 00000001 [128h 0296 004h] Target Proximity Domain List : 00000002 [12Ch 0300 004h] Target Proximity Domain List : 00000003 [130h 0304 004h] Target Proximity Domain List : 00000004 [134h 0308 004h] Target Proximity Domain List : 00000005
[138h 0312 002h] Entry : 00C8 [13Ah 0314 002h] Entry : 0000 [13Ch 0316 002h] Entry : 0032 [13Eh 0318 002h] Entry : 0000 [140h 0320 002h] Entry : 0032 [142h 0322 002h] Entry : 0064 [144h 0324 002h] Entry : 0019 [146h 0326 002h] Entry : 0000 [148h 0328 002h] Entry : 0064 [14Ah 0330 002h] Entry : 0000 [14Ch 0332 002h] Entry : 00C8 [14Eh 0334 002h] Entry : 0019 [150h 0336 002h] Entry : 0064 [152h 0338 002h] Entry : 0000 [154h 0340 002h] Entry : 0032 [156h 0342 002h] Entry : 0000 [158h 0344 002h] Entry : 0032 [15Ah 0346 002h] Entry : 0064 [15Ch 0348 002h] Entry : 0064 [15Eh 0350 002h] Entry : 0000 [160h 0352 002h] Entry : 0032 [162h 0354 002h] Entry : 0000 [164h 0356 002h] Entry : 0032 [166h 0358 002h] Entry : 00C8
Note the zeros represent entries where the target node has no memory. These could be surpressed but it isn't 'wrong' to provide them and it is (probably) permissible under ACPI to hotplug memory into these nodes later.
---
Since v6: Rebased - required data update.
--- tests/qtest/bios-tables-test-allowed-diff.h | 5 ----- tests/data/acpi/x86/q35/APIC.acpihmat-generic-x | Bin 0 -> 136 bytes tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x | Bin 0 -> 68 bytes tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x | Bin 0 -> 12599 bytes tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x | Bin 0 -> 360 bytes tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x | Bin 0 -> 520 bytes 6 files changed, 5 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -5
@@ -1,6 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/x86/q35/APIC.acpihmat-generic-x" , -"tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x" , -"tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x" , -"tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x" , -"tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x",
tests/data/acpi/x86/q35/APIC.acpihmat-generic-x binary +0 -0
tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x binary +0 -0
tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x binary +0 -0
tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x binary +0 -0
tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x binary +0 -0
Signature · 1 line
2.43.0