From: Anish Ghulati <aghulati@xxxxxxxxxx> Delete the old SVM code to manage MSR interception. There are no more calls to these functions: set_msr_interception_bitmap() set_msr_interception() set_shadow_msr_intercept() valid_msr_intercept() Suggested-by: Sean Christopherson <seanjc@xxxxxxxxxx> Signed-off-by: Anish Ghulati <aghulati@xxxxxxxxxx> --- arch/x86/kvm/svm/svm.c | 70 ------------------------------------------ arch/x86/kvm/svm/svm.h | 2 -- 2 files changed, 72 deletions(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 37b8683849ed2..2380059727168 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -770,32 +770,6 @@ static int direct_access_msr_slot(u32 msr) return -ENOENT; } -static void set_shadow_msr_intercept(struct kvm_vcpu *vcpu, u32 msr, int read, - int write) -{ - struct vcpu_svm *svm = to_svm(vcpu); - int slot = direct_access_msr_slot(msr); - - if (slot == -ENOENT) - return; - - /* Set the shadow bitmaps to the desired intercept states */ - if (read) - __clear_bit(slot, svm->shadow_msr_intercept.read); - else - __set_bit(slot, svm->shadow_msr_intercept.read); - - if (write) - __clear_bit(slot, svm->shadow_msr_intercept.write); - else - __set_bit(slot, svm->shadow_msr_intercept.write); -} - -static bool valid_msr_intercept(u32 index) -{ - return direct_access_msr_slot(index) != -ENOENT; -} - static bool msr_write_intercepted(struct kvm_vcpu *vcpu, u32 msr) { u8 bit_write; @@ -824,50 +798,6 @@ static bool msr_write_intercepted(struct kvm_vcpu *vcpu, u32 msr) return test_bit(bit_write, &tmp); } -static void set_msr_interception_bitmap(struct kvm_vcpu *vcpu, unsigned long *msrpm, - u32 msr, int read, int write) -{ - struct vcpu_svm *svm = to_svm(vcpu); - u8 bit_read, bit_write; - unsigned long tmp; - u32 offset; - - /* - * If this warning triggers extend the direct_access_msrs list at the - * beginning of the file - */ - WARN_ON(!valid_msr_intercept(msr)); - - /* Enforce non allowed MSRs to trap */ - if (read && !kvm_msr_allowed(vcpu, msr, KVM_MSR_FILTER_READ)) - read = 0; - - if (write && !kvm_msr_allowed(vcpu, msr, KVM_MSR_FILTER_WRITE)) - write = 0; - - offset = svm_msrpm_offset(msr); - bit_read = 2 * (msr & 0x0f); - bit_write = 2 * (msr & 0x0f) + 1; - tmp = msrpm[offset]; - - BUG_ON(offset == MSR_INVALID); - - read ? __clear_bit(bit_read, &tmp) : __set_bit(bit_read, &tmp); - write ? __clear_bit(bit_write, &tmp) : __set_bit(bit_write, &tmp); - - msrpm[offset] = tmp; - - svm_hv_vmcb_dirty_nested_enlightenments(vcpu); - svm->nested.force_msr_bitmap_recalc = true; -} - -void set_msr_interception(struct kvm_vcpu *vcpu, unsigned long *msrpm, u32 msr, - int read, int write) -{ - set_shadow_msr_intercept(vcpu, msr, read, write); - set_msr_interception_bitmap(vcpu, msrpm, msr, read, write); -} - static void svm_get_msr_bitmap_entries(struct kvm_vcpu *vcpu, u32 msr, unsigned long **read_map, u8 *read_bit, unsigned long **write_map, u8 *write_bit) diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h index b008c190188a2..2513990c5b6e6 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -612,8 +612,6 @@ bool svm_nmi_blocked(struct kvm_vcpu *vcpu); bool svm_interrupt_blocked(struct kvm_vcpu *vcpu); void svm_set_gif(struct vcpu_svm *svm, bool value); int svm_invoke_exit_handler(struct kvm_vcpu *vcpu, u64 exit_code); -void set_msr_interception(struct kvm_vcpu *vcpu, unsigned long *msrpm, u32 msr, - int read, int write); void svm_set_x2apic_msr_interception(struct vcpu_svm *svm, bool disable); void svm_complete_interrupt_delivery(struct kvm_vcpu *vcpu, int delivery_mode, int trig_mode, int vec); -- 2.47.0.338.g60cca15819-goog