[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/23] tests: Add test case of APIC ID for module level parsing
From: |
Paolo Bonzini |
Subject: |
[PULL 18/23] tests: Add test case of APIC ID for module level parsing |
Date: |
Thu, 23 May 2024 17:00:31 +0200 |
From: Zhuocheng Ding <zhuocheng.ding@intel.com>
After i386 supports module level, it's time to add the test for module
level's parsing.
Signed-off-by: Zhuocheng Ding <zhuocheng.ding@intel.com>
Co-developed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
Tested-by: Babu Moger <babu.moger@amd.com>
Tested-by: Yongwei Ma <yongwei.ma@intel.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20240424154929.1487382-18-zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/unit/test-x86-topo.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/tests/unit/test-x86-topo.c b/tests/unit/test-x86-topo.c
index f21b8a5d95c..55b731ccae5 100644
--- a/tests/unit/test-x86-topo.c
+++ b/tests/unit/test-x86-topo.c
@@ -37,6 +37,7 @@ static void test_topo_bits(void)
topo_info = (X86CPUTopoInfo) {1, 1, 1, 1};
g_assert_cmpuint(apicid_smt_width(&topo_info), ==, 0);
g_assert_cmpuint(apicid_core_width(&topo_info), ==, 0);
+ g_assert_cmpuint(apicid_module_width(&topo_info), ==, 0);
g_assert_cmpuint(apicid_die_width(&topo_info), ==, 0);
topo_info = (X86CPUTopoInfo) {1, 1, 1, 1};
@@ -74,13 +75,22 @@ static void test_topo_bits(void)
topo_info = (X86CPUTopoInfo) {1, 1, 33, 2};
g_assert_cmpuint(apicid_core_width(&topo_info), ==, 6);
- topo_info = (X86CPUTopoInfo) {1, 1, 30, 2};
+ topo_info = (X86CPUTopoInfo) {1, 6, 30, 2};
+ g_assert_cmpuint(apicid_module_width(&topo_info), ==, 3);
+ topo_info = (X86CPUTopoInfo) {1, 7, 30, 2};
+ g_assert_cmpuint(apicid_module_width(&topo_info), ==, 3);
+ topo_info = (X86CPUTopoInfo) {1, 8, 30, 2};
+ g_assert_cmpuint(apicid_module_width(&topo_info), ==, 3);
+ topo_info = (X86CPUTopoInfo) {1, 9, 30, 2};
+ g_assert_cmpuint(apicid_module_width(&topo_info), ==, 4);
+
+ topo_info = (X86CPUTopoInfo) {1, 6, 30, 2};
g_assert_cmpuint(apicid_die_width(&topo_info), ==, 0);
- topo_info = (X86CPUTopoInfo) {2, 1, 30, 2};
+ topo_info = (X86CPUTopoInfo) {2, 6, 30, 2};
g_assert_cmpuint(apicid_die_width(&topo_info), ==, 1);
- topo_info = (X86CPUTopoInfo) {3, 1, 30, 2};
+ topo_info = (X86CPUTopoInfo) {3, 6, 30, 2};
g_assert_cmpuint(apicid_die_width(&topo_info), ==, 2);
- topo_info = (X86CPUTopoInfo) {4, 1, 30, 2};
+ topo_info = (X86CPUTopoInfo) {4, 6, 30, 2};
g_assert_cmpuint(apicid_die_width(&topo_info), ==, 2);
/* build a weird topology and see if IDs are calculated correctly
@@ -91,6 +101,7 @@ static void test_topo_bits(void)
topo_info = (X86CPUTopoInfo) {1, 1, 6, 3};
g_assert_cmpuint(apicid_smt_width(&topo_info), ==, 2);
g_assert_cmpuint(apicid_core_offset(&topo_info), ==, 2);
+ g_assert_cmpuint(apicid_module_offset(&topo_info), ==, 5);
g_assert_cmpuint(apicid_die_offset(&topo_info), ==, 5);
g_assert_cmpuint(apicid_pkg_offset(&topo_info), ==, 5);
--
2.45.1
- [PULL 07/23] i386/cpu: Use APIC ID info to encode cache topo in CPUID[4], (continued)
- [PULL 07/23] i386/cpu: Use APIC ID info to encode cache topo in CPUID[4], Paolo Bonzini, 2024/05/23
- [PULL 08/23] i386/cpu: Use APIC ID info get NumSharingCache for CPUID[0x8000001D].EAX[bits 25:14], Paolo Bonzini, 2024/05/23
- [PULL 09/23] i386/cpu: Consolidate the use of topo_info in cpu_x86_cpuid(), Paolo Bonzini, 2024/05/23
- [PULL 10/23] i386/cpu: Introduce bitmap to cache available CPU topology levels, Paolo Bonzini, 2024/05/23
- [PULL 11/23] i386: Split topology types of CPUID[0x1F] from the definitions of CPUID[0xB], Paolo Bonzini, 2024/05/23
- [PULL 17/23] i386/cpu: Introduce module-id to X86CPU, Paolo Bonzini, 2024/05/23
- [PULL 14/23] i386: Support modules_per_die in X86CPUTopoInfo, Paolo Bonzini, 2024/05/23
- [PULL 16/23] i386: Support module_id in X86CPUTopoIDs, Paolo Bonzini, 2024/05/23
- [PULL 12/23] i386/cpu: Decouple CPUID[0x1F] subleaf with specific topology level, Paolo Bonzini, 2024/05/23
- [PULL 13/23] i386: Introduce module level cpu topology to CPUX86State, Paolo Bonzini, 2024/05/23
- [PULL 18/23] tests: Add test case of APIC ID for module level parsing,
Paolo Bonzini <=
- [PULL 15/23] i386: Expose module level in CPUID[0x1F], Paolo Bonzini, 2024/05/23
- [PULL 19/23] hw/i386/pc: Support smp.modules for x86 PC machine, Paolo Bonzini, 2024/05/23
- [PULL 21/23] i386/cpu: Use CPUCacheInfo.share_level to encode CPUID[4], Paolo Bonzini, 2024/05/23
- [PULL 20/23] i386: Add cache topology info in CPUCacheInfo, Paolo Bonzini, 2024/05/23
- [PULL 22/23] i386/cpu: Use CPUCacheInfo.share_level to encode CPUID[0x8000001D].EAX[bits 25:14], Paolo Bonzini, 2024/05/23
- [PULL 23/23] target-i386: hyper-v: Correct kvm_hv_handle_exit return value, Paolo Bonzini, 2024/05/23
- Re: [PULL 00/23] i386 changes for 2024-05-23, Richard Henderson, 2024/05/23