[PATCH 3/4] tests: acpi: q35: add test for hmat nodes without initiators

Brice Goglin posted 4 patches 2 years, 4 months ago
There is a newer version of this series
[PATCH 3/4] tests: acpi: q35: add test for hmat nodes without initiators
Posted by Brice Goglin 2 years, 4 months ago
expected HMAT:

[000h 0000   4]                    Signature : "HMAT"    [Heterogeneous Memory Attributes Table]
[004h 0004   4]                 Table Length : 00000120
[008h 0008   1]                     Revision : 02
[009h 0009   1]                     Checksum : 4F
[00Ah 0010   6]                       Oem ID : "BOCHS "
[010h 0016   8]                 Oem Table ID : "BXPC    "
[018h 0024   4]                 Oem Revision : 00000001
[01Ch 0028   4]              Asl Compiler ID : "BXPC"
[020h 0032   4]        Asl Compiler Revision : 00000001

[024h 0036   4]                     Reserved : 00000000

[028h 0040   2]               Structure Type : 0000 [Memory Proximity Domain Attributes]
[02Ah 0042   2]                     Reserved : 0000
[02Ch 0044   4]                       Length : 00000028
[030h 0048   2]        Flags (decoded below) : 0001
             Processor Proximity Domain Valid : 1
[032h 0050   2]                    Reserved1 : 0000
[034h 0052   4] Attached Initiator Proximity Domain : 00000000
[038h 0056   4]      Memory Proximity Domain : 00000000
[03Ch 0060   4]                    Reserved2 : 00000000
[040h 0064   8]                    Reserved3 : 0000000000000000
[048h 0072   8]                    Reserved4 : 0000000000000000

[050h 0080   2]               Structure Type : 0000 [Memory Proximity Domain Attributes]
[052h 0082   2]                     Reserved : 0000
[054h 0084   4]                       Length : 00000028
[058h 0088   2]        Flags (decoded below) : 0001
             Processor Proximity Domain Valid : 1
[05Ah 0090   2]                    Reserved1 : 0000
[05Ch 0092   4] Attached Initiator Proximity Domain : 00000001
[060h 0096   4]      Memory Proximity Domain : 00000001
[064h 0100   4]                    Reserved2 : 00000000
[068h 0104   8]                    Reserved3 : 0000000000000000
[070h 0112   8]                    Reserved4 : 0000000000000000

[078h 0120   2]               Structure Type : 0000 [Memory Proximity Domain Attributes]
[07Ah 0122   2]                     Reserved : 0000
[07Ch 0124   4]                       Length : 00000028
[080h 0128   2]        Flags (decoded below) : 0000
             Processor Proximity Domain Valid : 0
[082h 0130   2]                    Reserved1 : 0000
[084h 0132   4] Attached Initiator Proximity Domain : 00000080
[088h 0136   4]      Memory Proximity Domain : 00000002
[08Ch 0140   4]                    Reserved2 : 00000000
[090h 0144   8]                    Reserved3 : 0000000000000000
[098h 0152   8]                    Reserved4 : 0000000000000000

[0A0h 0160   2]               Structure Type : 0001 [System Locality Latency and Bandwidth Information]
[0A2h 0162   2]                     Reserved : 0000
[0A4h 0164   4]                       Length : 00000040
[0A8h 0168   1]        Flags (decoded below) : 00
                             Memory Hierarchy : 0
[0A9h 0169   1]                    Data Type : 00
[0AAh 0170   2]                    Reserved1 : 0000
[0ACh 0172   4] Initiator Proximity Domains # : 00000002
[0B0h 0176   4]   Target Proximity Domains # : 00000003
[0B4h 0180   4]                    Reserved2 : 00000000
[0B8h 0184   8]              Entry Base Unit : 0000000000002710
[0C0h 0192   4] Initiator Proximity Domain List : 00000000
[0C4h 0196   4] Initiator Proximity Domain List : 00000001
[0C8h 0200   4] Target Proximity Domain List : 00000000
[0CCh 0204   4] Target Proximity Domain List : 00000001
[0D0h 0208   4] Target Proximity Domain List : 00000002
[0D4h 0212   2]                        Entry : 0001
[0D6h 0214   2]                        Entry : 0002
[0D8h 0216   2]                        Entry : 0003
[0DAh 0218   2]                        Entry : 0002
[0DCh 0220   2]                        Entry : 0001
[0DEh 0222   2]                        Entry : 0003

[0E0h 0224   2]               Structure Type : 0001 [System Locality Latency and Bandwidth Information]
[0E2h 0226   2]                     Reserved : 0000
[0E4h 0228   4]                       Length : 00000040
[0E8h 0232   1]        Flags (decoded below) : 00
                             Memory Hierarchy : 0
[0E9h 0233   1]                    Data Type : 03
[0EAh 0234   2]                    Reserved1 : 0000
[0ECh 0236   4] Initiator Proximity Domains # : 00000002
[0F0h 0240   4]   Target Proximity Domains # : 00000003
[0F4h 0244   4]                    Reserved2 : 00000000
[0F8h 0248   8]              Entry Base Unit : 0000000000000001
[100h 0256   4] Initiator Proximity Domain List : 00000000
[104h 0260   4] Initiator Proximity Domain List : 00000001
[108h 0264   4] Target Proximity Domain List : 00000000
[10Ch 0268   4] Target Proximity Domain List : 00000001
[110h 0272   4] Target Proximity Domain List : 00000002
[114h 0276   2]                        Entry : 000A
[116h 0278   2]                        Entry : 0005
[118h 0280   2]                        Entry : 0001
[11Ah 0282   2]                        Entry : 0005
[11Ch 0284   2]                        Entry : 000A
[11Eh 0286   2]                        Entry : 0001

Raw Table Data: Length 288 (0x120)

     0000: 48 4D 41 54 20 01 00 00 02 4F 42 4F 43 48 53 20  // HMAT ....OBOCHS
     0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43  // BXPC    ....BXPC
     0020: 01 00 00 00 00 00 00 00 00 00 00 00 28 00 00 00  // ............(...
     0030: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
     0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
     0050: 00 00 00 00 28 00 00 00 01 00 00 00 01 00 00 00  // ....(...........
     0060: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
     0070: 00 00 00 00 00 00 00 00 00 00 00 00 28 00 00 00  // ............(...
     0080: 00 00 00 00 80 00 00 00 02 00 00 00 00 00 00 00  // ................
     0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
     00A0: 01 00 00 00 40 00 00 00 00 00 00 00 02 00 00 00  // ....@...........
     00B0: 03 00 00 00 00 00 00 00 10 27 00 00 00 00 00 00  // .........'......
     00C0: 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00  // ................
     00D0: 02 00 00 00 01 00 02 00 03 00 02 00 01 00 03 00  // ................
     00E0: 01 00 00 00 40 00 00 00 00 03 00 00 02 00 00 00  // ....@...........
     00F0: 03 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00  // ................
     0100: 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00  // ................
     0110: 02 00 00 00 0A 00 05 00 01 00 05 00 0A 00 01 00  // ................

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
---
  tests/qtest/bios-tables-test.c | 45 ++++++++++++++++++++++++++++++++++
  1 file changed, 45 insertions(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 359916c228..1252b166ff 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1461,6 +1461,50 @@ static void test_acpi_piix4_tcg_acpi_hmat(void)
      test_acpi_tcg_acpi_hmat(MACHINE_PC);
  }
  
+static void test_acpi_q35_tcg_acpi_hmat_noinitiator(void)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = MACHINE_Q35;
+    data.variant = ".acpihmat-noinitiator";
+    test_acpi_one(" -machine hmat=on"
+                  " -smp 4"
+                  " -m 128M"
+                  " -object memory-backend-ram,size=32M,id=ram0"
+                  " -object memory-backend-ram,size=32M,id=ram1"
+                  " -object memory-backend-ram,size=64M,id=ram2"
+                  " -numa node,nodeid=0,memdev=ram0,cpus=0-1"
+                  " -numa node,nodeid=1,memdev=ram1,cpus=2-3"
+                  " -numa node,nodeid=2,memdev=ram2"
+                  " -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=10485760"
+                  " -numa hmat-lb,initiator=0,target=1,hierarchy=memory,"
+                  "data-type=access-latency,latency=20"
+                  " -numa hmat-lb,initiator=0,target=1,hierarchy=memory,"
+                  "data-type=access-bandwidth,bandwidth=5242880"
+                  " -numa hmat-lb,initiator=0,target=2,hierarchy=memory,"
+                  "data-type=access-latency,latency=30"
+                  " -numa hmat-lb,initiator=0,target=2,hierarchy=memory,"
+                  "data-type=access-bandwidth,bandwidth=1048576"
+                  " -numa hmat-lb,initiator=1,target=0,hierarchy=memory,"
+                  "data-type=access-latency,latency=20"
+                  " -numa hmat-lb,initiator=1,target=0,hierarchy=memory,"
+                  "data-type=access-bandwidth,bandwidth=5242880"
+                  " -numa hmat-lb,initiator=1,target=1,hierarchy=memory,"
+                  "data-type=access-latency,latency=10"
+                  " -numa hmat-lb,initiator=1,target=1,hierarchy=memory,"
+                  "data-type=access-bandwidth,bandwidth=10485760"
+                  " -numa hmat-lb,initiator=1,target=2,hierarchy=memory,"
+                  "data-type=access-latency,latency=30"
+                  " -numa hmat-lb,initiator=1,target=2,hierarchy=memory,"
+                  "data-type=access-bandwidth,bandwidth=1048576",
+                  &data);
+    free_test_data(&data);
+}
+
  static void test_acpi_erst(const char *machine)
  {
      gchar *tmp_path = g_dir_make_tmp("qemu-test-erst.XXXXXX", NULL);
@@ -1803,6 +1847,7 @@ int main(int argc, char *argv[])
          qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
          qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat);
          qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
+        qtest_add_func("acpi/q35/acpihmat-noinitiator", test_acpi_q35_tcg_acpi_hmat_noinitiator);
          qtest_add_func("acpi/piix4/acpierst", test_acpi_piix4_acpi_erst);
          qtest_add_func("acpi/q35/acpierst", test_acpi_q35_acpi_erst);
          qtest_add_func("acpi/q35/applesmc", test_acpi_q35_applesmc);
-- 
2.30.2



Re: [PATCH 3/4] tests: acpi: q35: add test for hmat nodes without initiators
Posted by Igor Mammedov 2 years, 4 months ago
On Thu, 23 Jun 2022 16:59:29 +0200
Brice Goglin <Brice.Goglin@inria.fr> wrote:

maybe add a description of what you are testing


something along:
  machine with X numa nodes configured like this or that ...



> expected HMAT:
> 
> [000h 0000   4]                    Signature : "HMAT"    [Heterogeneous Memory Attributes Table]
> [004h 0004   4]                 Table Length : 00000120
> [008h 0008   1]                     Revision : 02
> [009h 0009   1]                     Checksum : 4F
> [00Ah 0010   6]                       Oem ID : "BOCHS "
> [010h 0016   8]                 Oem Table ID : "BXPC    "
> [018h 0024   4]                 Oem Revision : 00000001
> [01Ch 0028   4]              Asl Compiler ID : "BXPC"
> [020h 0032   4]        Asl Compiler Revision : 00000001
> 
> [024h 0036   4]                     Reserved : 00000000
> 
> [028h 0040   2]               Structure Type : 0000 [Memory Proximity Domain Attributes]
> [02Ah 0042   2]                     Reserved : 0000
> [02Ch 0044   4]                       Length : 00000028
> [030h 0048   2]        Flags (decoded below) : 0001
>              Processor Proximity Domain Valid : 1
> [032h 0050   2]                    Reserved1 : 0000
> [034h 0052   4] Attached Initiator Proximity Domain : 00000000
> [038h 0056   4]      Memory Proximity Domain : 00000000
> [03Ch 0060   4]                    Reserved2 : 00000000
> [040h 0064   8]                    Reserved3 : 0000000000000000
> [048h 0072   8]                    Reserved4 : 0000000000000000
> 
> [050h 0080   2]               Structure Type : 0000 [Memory Proximity Domain Attributes]
> [052h 0082   2]                     Reserved : 0000
> [054h 0084   4]                       Length : 00000028
> [058h 0088   2]        Flags (decoded below) : 0001
>              Processor Proximity Domain Valid : 1
> [05Ah 0090   2]                    Reserved1 : 0000
> [05Ch 0092   4] Attached Initiator Proximity Domain : 00000001
> [060h 0096   4]      Memory Proximity Domain : 00000001
> [064h 0100   4]                    Reserved2 : 00000000
> [068h 0104   8]                    Reserved3 : 0000000000000000
> [070h 0112   8]                    Reserved4 : 0000000000000000
> 
> [078h 0120   2]               Structure Type : 0000 [Memory Proximity Domain Attributes]
> [07Ah 0122   2]                     Reserved : 0000
> [07Ch 0124   4]                       Length : 00000028
> [080h 0128   2]        Flags (decoded below) : 0000
>              Processor Proximity Domain Valid : 0
> [082h 0130   2]                    Reserved1 : 0000
> [084h 0132   4] Attached Initiator Proximity Domain : 00000080
> [088h 0136   4]      Memory Proximity Domain : 00000002
> [08Ch 0140   4]                    Reserved2 : 00000000
> [090h 0144   8]                    Reserved3 : 0000000000000000
> [098h 0152   8]                    Reserved4 : 0000000000000000
> 
> [0A0h 0160   2]               Structure Type : 0001 [System Locality Latency and Bandwidth Information]
> [0A2h 0162   2]                     Reserved : 0000
> [0A4h 0164   4]                       Length : 00000040
> [0A8h 0168   1]        Flags (decoded below) : 00
>                              Memory Hierarchy : 0
> [0A9h 0169   1]                    Data Type : 00
> [0AAh 0170   2]                    Reserved1 : 0000
> [0ACh 0172   4] Initiator Proximity Domains # : 00000002
> [0B0h 0176   4]   Target Proximity Domains # : 00000003
> [0B4h 0180   4]                    Reserved2 : 00000000
> [0B8h 0184   8]              Entry Base Unit : 0000000000002710
> [0C0h 0192   4] Initiator Proximity Domain List : 00000000
> [0C4h 0196   4] Initiator Proximity Domain List : 00000001
> [0C8h 0200   4] Target Proximity Domain List : 00000000
> [0CCh 0204   4] Target Proximity Domain List : 00000001
> [0D0h 0208   4] Target Proximity Domain List : 00000002
> [0D4h 0212   2]                        Entry : 0001
> [0D6h 0214   2]                        Entry : 0002
> [0D8h 0216   2]                        Entry : 0003
> [0DAh 0218   2]                        Entry : 0002
> [0DCh 0220   2]                        Entry : 0001
> [0DEh 0222   2]                        Entry : 0003
> 
> [0E0h 0224   2]               Structure Type : 0001 [System Locality Latency and Bandwidth Information]
> [0E2h 0226   2]                     Reserved : 0000
> [0E4h 0228   4]                       Length : 00000040
> [0E8h 0232   1]        Flags (decoded below) : 00
>                              Memory Hierarchy : 0
> [0E9h 0233   1]                    Data Type : 03
> [0EAh 0234   2]                    Reserved1 : 0000
> [0ECh 0236   4] Initiator Proximity Domains # : 00000002
> [0F0h 0240   4]   Target Proximity Domains # : 00000003
> [0F4h 0244   4]                    Reserved2 : 00000000
> [0F8h 0248   8]              Entry Base Unit : 0000000000000001
> [100h 0256   4] Initiator Proximity Domain List : 00000000
> [104h 0260   4] Initiator Proximity Domain List : 00000001
> [108h 0264   4] Target Proximity Domain List : 00000000
> [10Ch 0268   4] Target Proximity Domain List : 00000001
> [110h 0272   4] Target Proximity Domain List : 00000002
> [114h 0276   2]                        Entry : 000A
> [116h 0278   2]                        Entry : 0005
> [118h 0280   2]                        Entry : 0001
> [11Ah 0282   2]                        Entry : 0005
> [11Ch 0284   2]                        Entry : 000A
> [11Eh 0286   2]                        Entry : 0001
> 
> Raw Table Data: Length 288 (0x120)
> 
>      0000: 48 4D 41 54 20 01 00 00 02 4F 42 4F 43 48 53 20  // HMAT ....OBOCHS
>      0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43  // BXPC    ....BXPC
>      0020: 01 00 00 00 00 00 00 00 00 00 00 00 28 00 00 00  // ............(...
>      0030: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
>      0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
>      0050: 00 00 00 00 28 00 00 00 01 00 00 00 01 00 00 00  // ....(...........
>      0060: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
>      0070: 00 00 00 00 00 00 00 00 00 00 00 00 28 00 00 00  // ............(...
>      0080: 00 00 00 00 80 00 00 00 02 00 00 00 00 00 00 00  // ................
>      0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
>      00A0: 01 00 00 00 40 00 00 00 00 00 00 00 02 00 00 00  // ....@...........
>      00B0: 03 00 00 00 00 00 00 00 10 27 00 00 00 00 00 00  // .........'......
>      00C0: 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00  // ................
>      00D0: 02 00 00 00 01 00 02 00 03 00 02 00 01 00 03 00  // ................
>      00E0: 01 00 00 00 40 00 00 00 00 03 00 00 02 00 00 00  // ....@...........
>      00F0: 03 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00  // ................
>      0100: 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00  // ................
>      0110: 02 00 00 00 0A 00 05 00 01 00 05 00 0A 00 01 00  // ................
> 
> Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
> ---
>   tests/qtest/bios-tables-test.c | 45 ++++++++++++++++++++++++++++++++++
>   1 file changed, 45 insertions(+)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index 359916c228..1252b166ff 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -1461,6 +1461,50 @@ static void test_acpi_piix4_tcg_acpi_hmat(void)
>       test_acpi_tcg_acpi_hmat(MACHINE_PC);
>   }
>   
> +static void test_acpi_q35_tcg_acpi_hmat_noinitiator(void)
> +{
> +    test_data data;
> +
> +    memset(&data, 0, sizeof(data));
> +    data.machine = MACHINE_Q35;
> +    data.variant = ".acpihmat-noinitiator";
> +    test_acpi_one(" -machine hmat=on"
> +                  " -smp 4"
> +                  " -m 128M"
> +                  " -object memory-backend-ram,size=32M,id=ram0"
> +                  " -object memory-backend-ram,size=32M,id=ram1"
> +                  " -object memory-backend-ram,size=64M,id=ram2"

> +                  " -numa node,nodeid=0,memdev=ram0,cpus=0-1"
> +                  " -numa node,nodeid=1,memdev=ram1,cpus=2-3"

drop legacy cpus=foo and replace it with '-numa cpu'
(you can find examples in this file or tests/qtest/numa-test.c )


> +                  " -numa node,nodeid=2,memdev=ram2"
> +                  " -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=10485760"
> +                  " -numa hmat-lb,initiator=0,target=1,hierarchy=memory,"
> +                  "data-type=access-latency,latency=20"
> +                  " -numa hmat-lb,initiator=0,target=1,hierarchy=memory,"
> +                  "data-type=access-bandwidth,bandwidth=5242880"
> +                  " -numa hmat-lb,initiator=0,target=2,hierarchy=memory,"
> +                  "data-type=access-latency,latency=30"
> +                  " -numa hmat-lb,initiator=0,target=2,hierarchy=memory,"
> +                  "data-type=access-bandwidth,bandwidth=1048576"
> +                  " -numa hmat-lb,initiator=1,target=0,hierarchy=memory,"
> +                  "data-type=access-latency,latency=20"
> +                  " -numa hmat-lb,initiator=1,target=0,hierarchy=memory,"
> +                  "data-type=access-bandwidth,bandwidth=5242880"
> +                  " -numa hmat-lb,initiator=1,target=1,hierarchy=memory,"
> +                  "data-type=access-latency,latency=10"
> +                  " -numa hmat-lb,initiator=1,target=1,hierarchy=memory,"
> +                  "data-type=access-bandwidth,bandwidth=10485760"
> +                  " -numa hmat-lb,initiator=1,target=2,hierarchy=memory,"
> +                  "data-type=access-latency,latency=30"
> +                  " -numa hmat-lb,initiator=1,target=2,hierarchy=memory,"
> +                  "data-type=access-bandwidth,bandwidth=1048576",
> +                  &data);
> +    free_test_data(&data);
> +}
> +
>   static void test_acpi_erst(const char *machine)
>   {
>       gchar *tmp_path = g_dir_make_tmp("qemu-test-erst.XXXXXX", NULL);
> @@ -1803,6 +1847,7 @@ int main(int argc, char *argv[])
>           qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
>           qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat);
>           qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
> +        qtest_add_func("acpi/q35/acpihmat-noinitiator", test_acpi_q35_tcg_acpi_hmat_noinitiator);

should be aligned with the rest of the block

>           qtest_add_func("acpi/piix4/acpierst", test_acpi_piix4_acpi_erst);
>           qtest_add_func("acpi/q35/acpierst", test_acpi_q35_acpi_erst);
>           qtest_add_func("acpi/q35/applesmc", test_acpi_q35_applesmc);