thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-tests-bios-tables-test-add-test-cases-for-ACPI-HMAT.patch

902636
From 6d549629becb69f315dd4213f730122d19c9c566 Mon Sep 17 00:00:00 2001
902636
From: "plai@redhat.com" <plai@redhat.com>
902636
Date: Thu, 21 May 2020 23:56:54 +0100
902636
Subject: [PATCH 11/12] tests/bios-tables-test: add test cases for ACPI HMAT
902636
902636
RH-Author: plai@redhat.com
902636
Message-id: <20200521235655.27141-11-plai@redhat.com>
902636
Patchwork-id: 96739
902636
O-Subject: [RHEL8.2.1 AV qemu-kvm PATCH 10/11] tests/bios-tables-test: add test cases for ACPI HMAT
902636
Bugzilla: 1600217
902636
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
902636
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
902636
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
902636
902636
From: Tao Xu <tao3.xu@intel.com>
902636
902636
ACPI table HMAT has been introduced, QEMU now builds HMAT tables for
902636
Heterogeneous Memory with boot option '-numa node'.
902636
902636
Add test cases on PC and Q35 machines with 2 numa nodes.
902636
Because HMAT is generated when system enable numa, the
902636
following tables need to be added for this test:
902636
    tests/data/acpi/pc/APIC.acpihmat
902636
    tests/data/acpi/pc/SRAT.acpihmat
902636
    tests/data/acpi/pc/HMAT.acpihmat
902636
    tests/data/acpi/pc/DSDT.acpihmat
902636
    tests/data/acpi/q35/APIC.acpihmat
902636
    tests/data/acpi/q35/SRAT.acpihmat
902636
    tests/data/acpi/q35/HMAT.acpihmat
902636
    tests/data/acpi/q35/DSDT.acpihmat
902636
902636
Acked-by: Markus Armbruster <armbru@redhat.com>
902636
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
902636
Reviewed-by: Daniel Black <daniel@linux.ibm.com>
902636
Reviewed-by: Jingqi Liu <Jingqi.liu@intel.com>
902636
Suggested-by: Igor Mammedov <imammedo@redhat.com>
902636
Signed-off-by: Tao Xu <tao3.xu@intel.com>
902636
Message-Id: <20191213011929.2520-9-tao3.xu@intel.com>
902636
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
902636
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
902636
(cherry picked from commit 1c8f85d93d261dc555a0aad6f54f2b5e8009d859)
902636
Signed-off-by: Paul Lai <plai@redhat.com>
902636
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
902636
---
902636
 tests/bios-tables-test-allowed-diff.h |  8 +++++++
902636
 tests/bios-tables-test.c              | 44 +++++++++++++++++++++++++++++++++++
902636
 2 files changed, 52 insertions(+)
902636
902636
diff --git a/tests/bios-tables-test-allowed-diff.h b/tests/bios-tables-test-allowed-diff.h
902636
index dfb8523..3c9e0c9 100644
902636
--- a/tests/bios-tables-test-allowed-diff.h
902636
+++ b/tests/bios-tables-test-allowed-diff.h
902636
@@ -1 +1,9 @@
902636
 /* List of comma-separated changed AML files to ignore */
902636
+"tests/data/acpi/pc/APIC.acpihmat",
902636
+"tests/data/acpi/pc/SRAT.acpihmat",
902636
+"tests/data/acpi/pc/HMAT.acpihmat",
902636
+"tests/data/acpi/pc/DSDT.acpihmat",
902636
+"tests/data/acpi/q35/APIC.acpihmat",
902636
+"tests/data/acpi/q35/SRAT.acpihmat",
902636
+"tests/data/acpi/q35/HMAT.acpihmat",
902636
+"tests/data/acpi/q35/DSDT.acpihmat",
902636
diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
902636
index 79f5da0..9823820 100644
902636
--- a/tests/bios-tables-test.c
902636
+++ b/tests/bios-tables-test.c
902636
@@ -947,6 +947,48 @@ static void test_acpi_virt_tcg_numamem(void)
902636
 
902636
 }
902636
 
902636
+static void test_acpi_tcg_acpi_hmat(const char *machine)
902636
+{
902636
+    test_data data;
902636
+
902636
+    memset(&data, 0, sizeof(data));
902636
+    data.machine = machine;
902636
+    data.variant = ".acpihmat";
902636
+    test_acpi_one(" -machine hmat=on"
902636
+                  " -smp 2,sockets=2"
902636
+                  " -m 128M,slots=2,maxmem=1G"
902636
+                  " -object memory-backend-ram,size=64M,id=m0"
902636
+                  " -object memory-backend-ram,size=64M,id=m1"
902636
+                  " -numa node,nodeid=0,memdev=m0"
902636
+                  " -numa node,nodeid=1,memdev=m1,initiator=0"
902636
+                  " -numa cpu,node-id=0,socket-id=0"
902636
+                  " -numa cpu,node-id=0,socket-id=1"
902636
+                  " -numa hmat-lb,initiator=0,target=0,hierarchy=memory,"
902636
+                  "data-type=access-latency,latency=1"
902636
+                  " -numa hmat-lb,initiator=0,target=0,hierarchy=memory,"
902636
+                  "data-type=access-bandwidth,bandwidth=65534M"
902636
+                  " -numa hmat-lb,initiator=0,target=1,hierarchy=memory,"
902636
+                  "data-type=access-latency,latency=65534"
902636
+                  " -numa hmat-lb,initiator=0,target=1,hierarchy=memory,"
902636
+                  "data-type=access-bandwidth,bandwidth=32767M"
902636
+                  " -numa hmat-cache,node-id=0,size=10K,level=1,"
902636
+                  "associativity=direct,policy=write-back,line=8"
902636
+                  " -numa hmat-cache,node-id=1,size=10K,level=1,"
902636
+                  "associativity=direct,policy=write-back,line=8",
902636
+                  &data);
902636
+    free_test_data(&data);
902636
+}
902636
+
902636
+static void test_acpi_q35_tcg_acpi_hmat(void)
902636
+{
902636
+    test_acpi_tcg_acpi_hmat(MACHINE_Q35);
902636
+}
902636
+
902636
+static void test_acpi_piix4_tcg_acpi_hmat(void)
902636
+{
902636
+    test_acpi_tcg_acpi_hmat(MACHINE_PC);
902636
+}
902636
+
902636
 static void test_acpi_virt_tcg(void)
902636
 {
902636
     test_data data = {
902636
@@ -991,6 +1033,8 @@ int main(int argc, char *argv[])
902636
         qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
902636
         qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
902636
         qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
902636
+        qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat);
902636
+        qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
902636
     } else if (strcmp(arch, "aarch64") == 0) {
902636
         qtest_add_func("acpi/virt", test_acpi_virt_tcg);
902636
         qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
902636
-- 
902636
1.8.3.1
902636