[2/5] kvm: x86: Add payload operands to kvm_multiple_exception
diff mbox series

Message ID 20181008182945.79957-2-jmattson@google.com
State New
Headers show
Series
  • [1/5] kvm: x86: Add payload to kvm_queued_exception and kvm_vcpu_events
Related show

Commit Message

Jim Mattson Oct. 8, 2018, 6:29 p.m. UTC
kvm_multiple_exception now takes two additional operands: has_payload
and payload, so that updates to CR2 (and DR6 under VMX) can be delayed
until the exception is delivered.

Reported-by: Jim Mattson <jmattson@google.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Peter Shier <pshier@google.com>
---
 arch/x86/kvm/x86.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Liran Alon Oct. 9, 2018, 9:28 a.m. UTC | #1
> On 8 Oct 2018, at 21:29, Jim Mattson <jmattson@google.com> wrote:
> 
> kvm_multiple_exception now takes two additional operands: has_payload
> and payload, so that updates to CR2 (and DR6 under VMX) can be delayed
> until the exception is delivered.
> 
> Reported-by: Jim Mattson <jmattson@google.com>
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Jim Mattson <jmattson@google.com>
> Reviewed-by: Peter Shier <pshier@google.com>
> ---
> arch/x86/kvm/x86.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index dbc538d66505..7c4e6845fe80 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -402,7 +402,7 @@ static int exception_type(int vector)
> 
> static void kvm_multiple_exception(struct kvm_vcpu *vcpu,
> 		unsigned nr, bool has_error, u32 error_code,
> -		bool reinject)
> +	        bool has_payload, unsigned long payload, bool reinject)
> {
> 	u32 prev_nr;
> 	int class1, class2;
> @@ -431,8 +431,8 @@ static void kvm_multiple_exception(struct kvm_vcpu *vcpu,
> 		vcpu->arch.exception.has_error_code = has_error;
> 		vcpu->arch.exception.nr = nr;
> 		vcpu->arch.exception.error_code = error_code;
> -		vcpu->arch.exception.has_payload = false;
> -		vcpu->arch.exception.payload = 0;
> +		vcpu->arch.exception.has_payload = has_payload;
> +		vcpu->arch.exception.payload = payload;
> 		return;
> 	}
> 
> @@ -468,13 +468,13 @@ static void kvm_multiple_exception(struct kvm_vcpu *vcpu,
> 
> void kvm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr)
> {
> -	kvm_multiple_exception(vcpu, nr, false, 0, false);
> +	kvm_multiple_exception(vcpu, nr, false, 0, false, 0, false);
> }
> EXPORT_SYMBOL_GPL(kvm_queue_exception);
> 
> void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr)
> {
> -	kvm_multiple_exception(vcpu, nr, false, 0, true);
> +	kvm_multiple_exception(vcpu, nr, false, 0, false, 0, true);
> }
> EXPORT_SYMBOL_GPL(kvm_requeue_exception);
> 
> @@ -521,13 +521,13 @@ EXPORT_SYMBOL_GPL(kvm_inject_nmi);
> 
> void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code)
> {
> -	kvm_multiple_exception(vcpu, nr, true, error_code, false);
> +	kvm_multiple_exception(vcpu, nr, true, error_code, false, 0, false);
> }
> EXPORT_SYMBOL_GPL(kvm_queue_exception_e);
> 
> void kvm_requeue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code)
> {
> -	kvm_multiple_exception(vcpu, nr, true, error_code, true);
> +	kvm_multiple_exception(vcpu, nr, true, error_code, false, 0, true);
> }
> EXPORT_SYMBOL_GPL(kvm_requeue_exception_e);
> 
> -- 
> 2.19.0.605.g01d371f741-goog
> 

I would give more context on commit message. Referring to previous commit should suffice.
Reviewed-By: Liran Alon <liran.alon@oracle.com>

Patch
diff mbox series

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index dbc538d66505..7c4e6845fe80 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -402,7 +402,7 @@  static int exception_type(int vector)
 
 static void kvm_multiple_exception(struct kvm_vcpu *vcpu,
 		unsigned nr, bool has_error, u32 error_code,
-		bool reinject)
+	        bool has_payload, unsigned long payload, bool reinject)
 {
 	u32 prev_nr;
 	int class1, class2;
@@ -431,8 +431,8 @@  static void kvm_multiple_exception(struct kvm_vcpu *vcpu,
 		vcpu->arch.exception.has_error_code = has_error;
 		vcpu->arch.exception.nr = nr;
 		vcpu->arch.exception.error_code = error_code;
-		vcpu->arch.exception.has_payload = false;
-		vcpu->arch.exception.payload = 0;
+		vcpu->arch.exception.has_payload = has_payload;
+		vcpu->arch.exception.payload = payload;
 		return;
 	}
 
@@ -468,13 +468,13 @@  static void kvm_multiple_exception(struct kvm_vcpu *vcpu,
 
 void kvm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr)
 {
-	kvm_multiple_exception(vcpu, nr, false, 0, false);
+	kvm_multiple_exception(vcpu, nr, false, 0, false, 0, false);
 }
 EXPORT_SYMBOL_GPL(kvm_queue_exception);
 
 void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr)
 {
-	kvm_multiple_exception(vcpu, nr, false, 0, true);
+	kvm_multiple_exception(vcpu, nr, false, 0, false, 0, true);
 }
 EXPORT_SYMBOL_GPL(kvm_requeue_exception);
 
@@ -521,13 +521,13 @@  EXPORT_SYMBOL_GPL(kvm_inject_nmi);
 
 void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code)
 {
-	kvm_multiple_exception(vcpu, nr, true, error_code, false);
+	kvm_multiple_exception(vcpu, nr, true, error_code, false, 0, false);
 }
 EXPORT_SYMBOL_GPL(kvm_queue_exception_e);
 
 void kvm_requeue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code)
 {
-	kvm_multiple_exception(vcpu, nr, true, error_code, true);
+	kvm_multiple_exception(vcpu, nr, true, error_code, false, 0, true);
 }
 EXPORT_SYMBOL_GPL(kvm_requeue_exception_e);