[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260120091449.526798-4-zhiquan_li@163.com>
Date: Tue, 20 Jan 2026 17:14:46 +0800
From: Zhiquan Li <zhiquan_li@....com>
To: seanjc@...gle.com,
pbonzini@...hat.com,
shuah@...nel.org
Cc: kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
zhiquan_li@....com
Subject: [PATCH 3/5] KVM: x86: selftests: Avoid failures due to reserved memory address regions on Hygon
There are similar reserved memory address regions for Hygon
architecture, mapping memory into these regions and accesses to them
results in a #PF.
Hygon CSV also makes the "physical address space width reduction", the
reduced physical address bits are reported by bits 11:6 of
CPUID[0x8000001f].EBX as well, so the logic is totally applicable
for Hygon processors.
Following test failures are fixed by this change:
- access_tracking_perf_test
- demand_paging_test
- dirty_log_perf_test
- dirty_log_test
- kvm_page_table_test
- memslot_modification_stress_test
- pre_fault_memory_test
- x86/dirty_log_page_splitting_test
Signed-off-by: Zhiquan Li <zhiquan_li@....com>
---
tools/testing/selftests/kvm/lib/x86/processor.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/kvm/lib/x86/processor.c b/tools/testing/selftests/kvm/lib/x86/processor.c
index 64f9ecd2387d..252b04c8e944 100644
--- a/tools/testing/selftests/kvm/lib/x86/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86/processor.c
@@ -1270,8 +1270,8 @@ unsigned long vm_compute_max_gfn(struct kvm_vm *vm)
max_gfn = (1ULL << (guest_maxphyaddr - vm->page_shift)) - 1;
- /* Avoid reserved HyperTransport region on AMD processors. */
- if (!host_cpu_is_amd)
+ /* Avoid reserved HyperTransport region on AMD or Hygon processors. */
+ if (!host_cpu_is_amd && !host_cpu_is_hygon)
return max_gfn;
/* On parts with <40 physical address bits, the area is fully hidden */
@@ -1285,7 +1285,7 @@ unsigned long vm_compute_max_gfn(struct kvm_vm *vm)
/*
* Otherwise it's at the top of the physical address space, possibly
- * reduced due to SME by bits 11:6 of CPUID[0x8000001f].EBX. Use
+ * reduced due to SME or CSV by bits 11:6 of CPUID[0x8000001f].EBX. Use
* the old conservative value if MAXPHYADDR is not enumerated.
*/
if (!this_cpu_has_p(X86_PROPERTY_MAX_PHY_ADDR))
--
2.43.0
Powered by blists - more mailing lists