yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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