KVM: x86: Simplify kvm_x86_ops->queue_exception parameter list
authorWanpeng Li <wanpeng.li@hotmail.com>
Fri, 14 Jul 2017 01:30:39 +0000 (18:30 -0700)
committerRadim Krčmář <rkrcmar@redhat.com>
Fri, 14 Jul 2017 12:24:28 +0000 (14:24 +0200)
This patch removes all arguments except the first in
kvm_x86_ops->queue_exception since they can extract the arguments from
vcpu->arch.exception themselves.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/svm.c
arch/x86/kvm/vmx.c
arch/x86/kvm/x86.c

index 9d8de5dd7546d27ae9ddfee6744a50ea29f88a18..8d11ddcb0dbfd9371de4de807e6829a20de0d389 100644 (file)
@@ -954,9 +954,7 @@ struct kvm_x86_ops {
                                unsigned char *hypercall_addr);
        void (*set_irq)(struct kvm_vcpu *vcpu);
        void (*set_nmi)(struct kvm_vcpu *vcpu);
-       void (*queue_exception)(struct kvm_vcpu *vcpu, unsigned nr,
-                               bool has_error_code, u32 error_code,
-                               bool reinject);
+       void (*queue_exception)(struct kvm_vcpu *vcpu);
        void (*cancel_injection)(struct kvm_vcpu *vcpu);
        int (*interrupt_allowed)(struct kvm_vcpu *vcpu);
        int (*nmi_allowed)(struct kvm_vcpu *vcpu);
index 4c98d362e3e44613fd6342bfb0f87d9b5ba42e2b..cde756a02b1aa374bedc08238cb4474b55f83d61 100644 (file)
@@ -637,11 +637,13 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
        svm_set_interrupt_shadow(vcpu, 0);
 }
 
-static void svm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr,
-                               bool has_error_code, u32 error_code,
-                               bool reinject)
+static void svm_queue_exception(struct kvm_vcpu *vcpu)
 {
        struct vcpu_svm *svm = to_svm(vcpu);
+       unsigned nr = vcpu->arch.exception.nr;
+       bool has_error_code = vcpu->arch.exception.has_error_code;
+       bool reinject = vcpu->arch.exception.reinject;
+       u32 error_code = vcpu->arch.exception.error_code;
 
        /*
         * If we are within a nested VM we'd better #VMEXIT and let the guest
index 25f2fdccf6251ced51b5db232a750c5e3be7be0a..69cc228436ea65921da8fe41eeb20d42545969f5 100644 (file)
@@ -2435,11 +2435,13 @@ static int nested_vmx_check_exception(struct kvm_vcpu *vcpu, unsigned nr)
        return 1;
 }
 
-static void vmx_queue_exception(struct kvm_vcpu *vcpu, unsigned nr,
-                               bool has_error_code, u32 error_code,
-                               bool reinject)
+static void vmx_queue_exception(struct kvm_vcpu *vcpu)
 {
        struct vcpu_vmx *vmx = to_vmx(vcpu);
+       unsigned nr = vcpu->arch.exception.nr;
+       bool has_error_code = vcpu->arch.exception.has_error_code;
+       bool reinject = vcpu->arch.exception.reinject;
+       u32 error_code = vcpu->arch.exception.error_code;
        u32 intr_info = nr | INTR_INFO_VALID_MASK;
 
        if (!reinject && is_guest_mode(vcpu) &&
index 4f41c5222ecd41e8cbab05d4affbf4c9ccae3068..e149c92476f14807049bf07db2ba027e444b4718 100644 (file)
@@ -6356,10 +6356,7 @@ static int inject_pending_event(struct kvm_vcpu *vcpu, bool req_int_win)
                        kvm_update_dr7(vcpu);
                }
 
-               kvm_x86_ops->queue_exception(vcpu, vcpu->arch.exception.nr,
-                                         vcpu->arch.exception.has_error_code,
-                                         vcpu->arch.exception.error_code,
-                                         vcpu->arch.exception.reinject);
+               kvm_x86_ops->queue_exception(vcpu);
                return 0;
        }