KVM: x86: rename update_bp_intercept to update_exception_bitmap
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 10 Jul 2020 15:48:06 +0000 (17:48 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 10 Jul 2020 17:20:18 +0000 (13:20 -0400)
We would like to introduce a callback to update the #PF intercept
when CPUID changes.  Just reuse update_bp_intercept since VMX is
already using update_exception_bitmap instead of a bespoke function.

While at it, remove an unnecessary assignment in the SVM version,
which is already done in the caller (kvm_arch_vcpu_ioctl_set_guest_debug)
and has nothing to do with the exception bitmap.

Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/x86.c

index 733bbfa7001e685d30287210280083ea3dbf2521..1df95f10c9037a671d03ebfdcaefdcafd06fd4d7 100644 (file)
@@ -1057,7 +1057,7 @@ struct kvm_x86_ops {
        void (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu);
        void (*vcpu_put)(struct kvm_vcpu *vcpu);
 
-       void (*update_bp_intercept)(struct kvm_vcpu *vcpu);
+       void (*update_exception_bitmap)(struct kvm_vcpu *vcpu);
        int (*get_msr)(struct kvm_vcpu *vcpu, struct msr_data *msr);
        int (*set_msr)(struct kvm_vcpu *vcpu, struct msr_data *msr);
        u64 (*get_segment_base)(struct kvm_vcpu *vcpu, int seg);
index 41f791e2a013a51dd052d6761320996afd794d1e..2371b1e40f3922726b170407cd91b504051800c5 100644 (file)
@@ -1627,7 +1627,7 @@ static void svm_set_segment(struct kvm_vcpu *vcpu,
        vmcb_mark_dirty(svm->vmcb, VMCB_SEG);
 }
 
-static void update_bp_intercept(struct kvm_vcpu *vcpu)
+static void update_exception_bitmap(struct kvm_vcpu *vcpu)
 {
        struct vcpu_svm *svm = to_svm(vcpu);
 
@@ -1636,8 +1636,7 @@ static void update_bp_intercept(struct kvm_vcpu *vcpu)
        if (vcpu->guest_debug & KVM_GUESTDBG_ENABLE) {
                if (vcpu->guest_debug & KVM_GUESTDBG_USE_SW_BP)
                        set_exception_intercept(svm, BP_VECTOR);
-       } else
-               vcpu->guest_debug = 0;
+       }
 }
 
 static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *sd)
@@ -4037,7 +4036,7 @@ static struct kvm_x86_ops svm_x86_ops __initdata = {
        .vcpu_blocking = svm_vcpu_blocking,
        .vcpu_unblocking = svm_vcpu_unblocking,
 
-       .update_bp_intercept = update_bp_intercept,
+       .update_exception_bitmap = update_exception_bitmap,
        .get_msr_feature = svm_get_msr_feature,
        .get_msr = svm_get_msr,
        .set_msr = svm_set_msr,
index 2b41d987b101d76253200ec344a46ace9632f8e2..8fe2999fcb1e5e2a36cf1ff0bdfef7ac57c7a6c9 100644 (file)
@@ -7875,7 +7875,7 @@ static struct kvm_x86_ops vmx_x86_ops __initdata = {
        .vcpu_load = vmx_vcpu_load,
        .vcpu_put = vmx_vcpu_put,
 
-       .update_bp_intercept = update_exception_bitmap,
+       .update_exception_bitmap = update_exception_bitmap,
        .get_msr_feature = vmx_get_msr_feature,
        .get_msr = vmx_get_msr,
        .set_msr = vmx_set_msr,
index 0867a626b226fb2979112bcfa18cbeb6d4513919..35abe69aad2858f8ecbc80fbc168b7f7cffdb836 100644 (file)
@@ -9316,7 +9316,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
         */
        kvm_set_rflags(vcpu, rflags);
 
-       kvm_x86_ops.update_bp_intercept(vcpu);
+       kvm_x86_ops.update_exception_bitmap(vcpu);
 
        r = 0;