cryptospore / 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

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