forked from Minki/linux
selftests: kvm: check dynamic bits against KVM_X86_XCOMP_GUEST_SUPP
Provide coverage for the new API. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
dd6e631220
commit
b19c99b9f4
@ -452,6 +452,9 @@ struct kvm_sync_regs {
|
|||||||
|
|
||||||
#define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001
|
#define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001
|
||||||
|
|
||||||
|
/* attributes for system fd (group 0) */
|
||||||
|
#define KVM_X86_XCOMP_GUEST_SUPP 0
|
||||||
|
|
||||||
struct kvm_vmx_nested_state_data {
|
struct kvm_vmx_nested_state_data {
|
||||||
__u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
|
__u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
|
||||||
__u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
|
__u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
|
||||||
|
@ -1133,6 +1133,7 @@ struct kvm_ppc_resize_hpt {
|
|||||||
#define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206
|
#define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206
|
||||||
#define KVM_CAP_VM_GPA_BITS 207
|
#define KVM_CAP_VM_GPA_BITS 207
|
||||||
#define KVM_CAP_XSAVE2 208
|
#define KVM_CAP_XSAVE2 208
|
||||||
|
#define KVM_CAP_SYS_ATTRIBUTES 209
|
||||||
|
|
||||||
#ifdef KVM_CAP_IRQ_ROUTING
|
#ifdef KVM_CAP_IRQ_ROUTING
|
||||||
|
|
||||||
|
@ -667,8 +667,23 @@ static bool is_xfd_supported(void)
|
|||||||
|
|
||||||
void vm_xsave_req_perm(int bit)
|
void vm_xsave_req_perm(int bit)
|
||||||
{
|
{
|
||||||
|
int kvm_fd;
|
||||||
u64 bitmask;
|
u64 bitmask;
|
||||||
long rc;
|
long rc;
|
||||||
|
struct kvm_device_attr attr = {
|
||||||
|
.group = 0,
|
||||||
|
.attr = KVM_X86_XCOMP_GUEST_SUPP,
|
||||||
|
.addr = (unsigned long) &bitmask
|
||||||
|
};
|
||||||
|
|
||||||
|
kvm_fd = open_kvm_dev_path_or_exit();
|
||||||
|
rc = ioctl(kvm_fd, KVM_GET_DEVICE_ATTR, &attr);
|
||||||
|
close(kvm_fd);
|
||||||
|
if (rc == -1 && (errno == ENXIO || errno == EINVAL))
|
||||||
|
exit(KSFT_SKIP);
|
||||||
|
TEST_ASSERT(rc == 0, "KVM_GET_DEVICE_ATTR(0, KVM_X86_XCOMP_GUEST_SUPP) error: %ld", rc);
|
||||||
|
if (!(bitmask & (1ULL << bit)))
|
||||||
|
exit(KSFT_SKIP);
|
||||||
|
|
||||||
if (!is_xfd_supported())
|
if (!is_xfd_supported())
|
||||||
exit(KSFT_SKIP);
|
exit(KSFT_SKIP);
|
||||||
|
Loading…
Reference in New Issue
Block a user