aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm/svm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kvm/svm/svm.c')
-rw-r--r--arch/x86/kvm/svm/svm.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index b855b94c3aba..3c5e82ed6bd4 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -685,24 +685,20 @@ void svm_disable_intercept_for_msr(struct kvm_vcpu *vcpu, u32 msr, int type)
void *msrpm = svm->msrpm;
/* Don't disable interception for MSRs userspace wants to handle. */
- if ((type & MSR_TYPE_R) &&
- !kvm_msr_allowed(vcpu, msr, KVM_MSR_FILTER_READ)) {
- svm_set_msr_bitmap_read(msrpm, msr);
- type &= ~MSR_TYPE_R;
+ if (type & MSR_TYPE_R) {
+ if (kvm_msr_allowed(vcpu, msr, KVM_MSR_FILTER_READ))
+ svm_clear_msr_bitmap_read(msrpm, msr);
+ else
+ svm_set_msr_bitmap_read(msrpm, msr);
}
- if ((type & MSR_TYPE_W) &&
- !kvm_msr_allowed(vcpu, msr, KVM_MSR_FILTER_WRITE)) {
- svm_set_msr_bitmap_write(msrpm, msr);
- type &= ~MSR_TYPE_W;
+ if (type & MSR_TYPE_W) {
+ if (kvm_msr_allowed(vcpu, msr, KVM_MSR_FILTER_WRITE))
+ svm_clear_msr_bitmap_write(msrpm, msr);
+ else
+ svm_set_msr_bitmap_write(msrpm, msr);
}
- if (type & MSR_TYPE_R)
- svm_clear_msr_bitmap_read(msrpm, msr);
-
- if (type & MSR_TYPE_W)
- svm_clear_msr_bitmap_write(msrpm, msr);
-
svm_hv_vmcb_dirty_nested_enlightenments(vcpu);
svm->nested.force_msr_bitmap_recalc = true;
}