[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260120091449.526798-3-zhiquan_li@163.com>
Date: Tue, 20 Jan 2026 17:14:45 +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 2/5] KVM: x86: selftests: Alter the hypercall instruction on Hygon
Hygon architecture uses VMMCALL as guest hypercall instruction, so
utilize the Hygon specific flag to avoid the test like "fix hypercall"
running into the wrong branches and using VMCALL, then causing failure.
Signed-off-by: Zhiquan Li <zhiquan_li@....com>
---
tools/testing/selftests/kvm/lib/x86/processor.c | 3 ++-
tools/testing/selftests/kvm/x86/fix_hypercall_test.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/kvm/lib/x86/processor.c b/tools/testing/selftests/kvm/lib/x86/processor.c
index bbd3336f22eb..64f9ecd2387d 100644
--- a/tools/testing/selftests/kvm/lib/x86/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86/processor.c
@@ -1229,7 +1229,8 @@ const struct kvm_cpuid_entry2 *get_cpuid_entry(const struct kvm_cpuid2 *cpuid,
"1: vmmcall\n\t" \
"2:" \
: "=a"(r) \
- : [use_vmmcall] "r" (host_cpu_is_amd), inputs); \
+ : [use_vmmcall] "r" \
+ (host_cpu_is_amd || host_cpu_is_hygon), inputs); \
\
r; \
})
diff --git a/tools/testing/selftests/kvm/x86/fix_hypercall_test.c b/tools/testing/selftests/kvm/x86/fix_hypercall_test.c
index 762628f7d4ba..0377ab5b1238 100644
--- a/tools/testing/selftests/kvm/x86/fix_hypercall_test.c
+++ b/tools/testing/selftests/kvm/x86/fix_hypercall_test.c
@@ -52,7 +52,7 @@ static void guest_main(void)
if (host_cpu_is_intel) {
native_hypercall_insn = vmx_vmcall;
other_hypercall_insn = svm_vmmcall;
- } else if (host_cpu_is_amd) {
+ } else if (host_cpu_is_amd || host_cpu_is_hygon) {
native_hypercall_insn = svm_vmmcall;
other_hypercall_insn = vmx_vmcall;
} else {
--
2.43.0
Powered by blists - more mailing lists