Commit 01244fce authored by Vishal Annapurve's avatar Vishal Annapurve Committed by Paolo Bonzini

KVM: selftests: Add helpers to do KVM_HC_MAP_GPA_RANGE hypercalls (x86)

Add helpers for x86 guests to invoke the KVM_HC_MAP_GPA_RANGE hypercall,
which KVM will forward to userspace and thus can be used by tests to
coordinate private<=>shared conversions between host userspace code and
guest code.
Signed-off-by: default avatarVishal Annapurve <vannapurve@google.com>
[sean: drop shared/private helpers (let tests specify flags)]
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Message-Id: <20231027182217.3615211-29-seanjc@google.com>
Reviewed-by: default avatarFuad Tabba <tabba@google.com>
Tested-by: default avatarFuad Tabba <tabba@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent f7fa6749
......@@ -15,6 +15,7 @@
#include <asm/msr-index.h>
#include <asm/prctl.h>
#include <linux/kvm_para.h>
#include <linux/stringify.h>
#include "../kvm_util.h"
......@@ -1194,6 +1195,20 @@ uint64_t kvm_hypercall(uint64_t nr, uint64_t a0, uint64_t a1, uint64_t a2,
uint64_t __xen_hypercall(uint64_t nr, uint64_t a0, void *a1);
void xen_hypercall(uint64_t nr, uint64_t a0, void *a1);
static inline uint64_t __kvm_hypercall_map_gpa_range(uint64_t gpa,
uint64_t size, uint64_t flags)
{
return kvm_hypercall(KVM_HC_MAP_GPA_RANGE, gpa, size >> PAGE_SHIFT, flags, 0);
}
static inline void kvm_hypercall_map_gpa_range(uint64_t gpa, uint64_t size,
uint64_t flags)
{
uint64_t ret = __kvm_hypercall_map_gpa_range(gpa, size, flags);
GUEST_ASSERT(!ret);
}
void __vm_xsave_require_permission(uint64_t xfeature, const char *name);
#define vm_xsave_require_permission(xfeature) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment