summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/include
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2026-09-03 17:24:12 -0700
committerSean Christopherson <seanjc@google.com>2026-09-11 09:08:11 -0700
commitf1d4e357a69559e47e7f34fe8dc9d156d0de7588 (patch)
tree5eccdfbf5687dc9ae669b6eb7763d4aa69c6bafb /tools/testing/selftests/kvm/include
parent0d6e35f6ab7d6c8b9afa6882447793aad58701e4 (diff)
KVM: selftests: Assert success in vmptrst(), kill off vmptrstz()
Assert success in vmptrst() instead of punting to the caller, as literally every user expects VMPTRST to succeed (and because '0' is a valid physical address). Link: https://patch.msgid.link/20260904002423.3154436-7-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/testing/selftests/kvm/include')
-rw-r--r--tools/testing/selftests/kvm/include/x86/vmx.h19
1 files changed, 4 insertions, 15 deletions
diff --git a/tools/testing/selftests/kvm/include/x86/vmx.h b/tools/testing/selftests/kvm/include/x86/vmx.h
index a161dbee7e04..04f638fcd3ba 100644
--- a/tools/testing/selftests/kvm/include/x86/vmx.h
+++ b/tools/testing/selftests/kvm/include/x86/vmx.h
@@ -366,27 +366,16 @@ static inline int __vmptrld(u64 vmcs_pa)
return vector ? vector : failed ? -EINVAL : 0;
}
-static inline int vmptrst(u64 *value)
+static inline u64 vmptrst(void)
{
- u64 tmp;
+ u64 value = 0;
u8 ret;
__asm__ __volatile__("vmptrst %[value]; setna %[ret]"
- : [value]"=m"(tmp), [ret]"=rm"(ret)
+ : [value]"=m"(value), [ret]"=rm"(ret)
: : "cc", "memory");
- *value = tmp;
- return ret;
-}
-
-/*
- * A wrapper around vmptrst that ignores errors and returns zero if the
- * vmptrst instruction fails.
- */
-static inline u64 vmptrstz(void)
-{
- u64 value = 0;
- vmptrst(&value);
+ __GUEST_ASSERT(!ret, "vmptrst failed");
return value;
}