mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
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: Aaron Lewis <aaronlewis@google.com> Message-Id: <20220921151525.904162-3-aaronlewis@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
be83794210
commit
db205f7e1e
|
|
@ -6230,9 +6230,7 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
|
|||
break;
|
||||
case KVM_CAP_X86_USER_SPACE_MSR:
|
||||
r = -EINVAL;
|
||||
if (cap->args[0] & ~(KVM_MSR_EXIT_REASON_INVAL |
|
||||
KVM_MSR_EXIT_REASON_UNKNOWN |
|
||||
KVM_MSR_EXIT_REASON_FILTER))
|
||||
if (cap->args[0] & ~KVM_MSR_EXIT_REASON_VALID_MASK)
|
||||
break;
|
||||
kvm->arch.user_space_msr_mask = cap->args[0];
|
||||
r = 0;
|
||||
|
|
|
|||
|
|
@ -485,6 +485,9 @@ struct kvm_run {
|
|||
#define KVM_MSR_EXIT_REASON_INVAL (1 << 0)
|
||||
#define KVM_MSR_EXIT_REASON_UNKNOWN (1 << 1)
|
||||
#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 index; /* kernel -> user */
|
||||
__u64 data; /* kernel <-> user */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user