[PATCH 0/8] KVM: selftests: Add Zhaoxin CPU support

From: Ewan Hai-oc

Date: Thu Jul 30 2026 - 07:38:14 EST


Add Zhaoxin CPU detection to KVM's x86 selftests and enable tests whose
VMX paths are applicable to Zhaoxin CPUs. Zhaoxin CPUs report either
"CentaurHauls" or " Shanghai " as vendor string and expose a
VMX-compatible virtualization interface.

Patch 1 adds the common vendor detection.
Patches 2-4 allow applicable TDP, invalid guest state, and hypercall
tests to run on Zhaoxin CPUs.
Patch 5 keeps feature_msrs_test running when KVM does not expose PDCM,
allowing the test to run on some Zhaoxin CPUs that do not support PDCM.
Patches 6-8 handle the KVM-defined IA32_UCODE_REV initial value, Zhaoxin
nested exception error codes, and optional APIC-access virtualization.

The series is based on kvm-x86-next-2026.07.28.

Tested on a system with a Zhaoxin CPU:
- feature_msrs_test
- fix_hypercall_test
- nested_exceptions_test
- vmx_apic_access_test
- vmx_exception_with_invalid_guest_state
- nx_huge_pages_test

Frank Zhu (8):
KVM: selftests: Add Zhaoxin (ZX) CPU detection support
KVM: selftests: nx_huge_pages_test: Add TDP detection for Zhaoxin CPUs
KVM: selftests: vmx_exception_with_invalid_guest_state: Support
Zhaoxin CPUs
KVM: selftests: fix_hypercall_test: Add Zhaoxin CPU support
KVM: selftests: Skip PERF_CAPABILITIES vCPU checks without PDCM
KVM: selftests: feature_msrs_test: Extend MSR_IA32_UCODE_REV quirk to
Zhaoxin
KVM: selftests: nested_exceptions_test: Add Zhaoxin CPU support
KVM: selftests: vmx_apic_access_test: Check APIC virtualization
support

.../testing/selftests/kvm/include/x86/processor.h | 7 +++++++
tools/testing/selftests/kvm/include/x86/vmx.h | 1 +
tools/testing/selftests/kvm/lib/x86/processor.c | 5 ++++-
tools/testing/selftests/kvm/lib/x86/vmx.c | 15 +++++++++++++++
.../testing/selftests/kvm/x86/feature_msrs_test.c | 15 ++++++++++++++-
.../selftests/kvm/x86/fix_hypercall_test.c | 2 +-
.../selftests/kvm/x86/nested_exceptions_test.c | 4 +++-
.../selftests/kvm/x86/vmx_apic_access_test.c | 1 +
.../x86/vmx_exception_with_invalid_guest_state.c | 2 +-
9 files changed, 47 insertions(+), 5 deletions(-)


base-commit: 3c7d7f908d574277a845423ec32250a8d8df44c8
--
2.34.1