[PATCH v2 0/9] KVM: selftests: Add Zhaoxin CPU support
From: Ewan Hai-oc
Date: Thu Sep 10 2026 - 08:08:18 EST
From: Frank Zhu <frankzhu@xxxxxxxxxxx>
This series adds Zhaoxin CPU support to the KVM x86 selftests.
Zhaoxin CPUs use the "CentaurHauls" and " Shanghai " vendor strings
and implement VMX-compatible virtualization, so KVM handles them via
its VMX backend. Several selftests currently assume a CPU is either
Intel or AMD, which makes them misbehave or skip on Zhaoxin hosts.
Patch 1 adds Zhaoxin detection and the compatibility flag. Patch 2
updates the mediated PMU parameter lookup. Patches 3-5 and 7 apply the
compatibility flag to VMX-backed paths. Patch 6 handles feature MSR
testing without PDCM, patch 8 handles Zhaoxin's #GP error-code behavior,
and patch 9 checks APIC-access virtualization support.
Frank Zhu (9):
KVM: selftests: Add Zhaoxin CPU detection support
KVM: selftests: Use host_cpu_is_intel_compatible for mediated PMU
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 | 10 +++++++++-
tools/testing/selftests/kvm/include/x86/vmx.h | 1 +
tools/testing/selftests/kvm/lib/x86/processor.c | 8 +++++++-
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, 52 insertions(+), 6 deletions(-)
Changes since v1:
- Rebase the series onto kvm-x86/next.
- Spell out Zhaoxin in helper, macro, and patch names.
- Add a new patch (2/9) to use host_cpu_is_intel_compatible in
kvm_is_mediated_pmu_enabled() so Zhaoxin CPUs look up the mediated
PMU parameter from kvm_intel.
- Reword the Zhaoxin CPU detection commit message to document the new
host_cpu_is_intel_compatible flag.
- Expand the nested_exceptions_test commit message to explain why
Zhaoxin CPUs leave EXT clear for the #GP generated when vectoring
an injected #SS.
base-commit: 76671054f9a1ff6abb976583cd8da37650acdc97
--
2.34.1