Commit db205f7e authored by Aaron Lewis's avatar Aaron Lewis Committed by Paolo Bonzini

KVM: x86: Add a VALID_MASK for the MSR exit reason flags

Add the mask KVM_MSR_EXIT_REASON_VALID_MASK for the MSR exit reason
flags.  This simplifies checks that validate these flags, and makes it
easier to introduce new flags in the future.

No functional change intended.
Signed-off-by: default avatarAaron Lewis <aaronlewis@google.com>
Message-Id: <20220921151525.904162-3-aaronlewis@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent be837942
...@@ -6230,9 +6230,7 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm, ...@@ -6230,9 +6230,7 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
break; break;
case KVM_CAP_X86_USER_SPACE_MSR: case KVM_CAP_X86_USER_SPACE_MSR:
r = -EINVAL; r = -EINVAL;
if (cap->args[0] & ~(KVM_MSR_EXIT_REASON_INVAL | if (cap->args[0] & ~KVM_MSR_EXIT_REASON_VALID_MASK)
KVM_MSR_EXIT_REASON_UNKNOWN |
KVM_MSR_EXIT_REASON_FILTER))
break; break;
kvm->arch.user_space_msr_mask = cap->args[0]; kvm->arch.user_space_msr_mask = cap->args[0];
r = 0; r = 0;
......
...@@ -485,6 +485,9 @@ struct kvm_run { ...@@ -485,6 +485,9 @@ struct kvm_run {
#define KVM_MSR_EXIT_REASON_INVAL (1 << 0) #define KVM_MSR_EXIT_REASON_INVAL (1 << 0)
#define KVM_MSR_EXIT_REASON_UNKNOWN (1 << 1) #define KVM_MSR_EXIT_REASON_UNKNOWN (1 << 1)
#define KVM_MSR_EXIT_REASON_FILTER (1 << 2) #define KVM_MSR_EXIT_REASON_FILTER (1 << 2)
#define KVM_MSR_EXIT_REASON_VALID_MASK (KVM_MSR_EXIT_REASON_INVAL | \
KVM_MSR_EXIT_REASON_UNKNOWN | \
KVM_MSR_EXIT_REASON_FILTER)
__u32 reason; /* kernel -> user */ __u32 reason; /* kernel -> user */
__u32 index; /* kernel -> user */ __u32 index; /* kernel -> user */
__u64 data; /* kernel <-> user */ __u64 data; /* kernel <-> user */
......
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