All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] KVM: PPC: Fix contents of SRR1 when injecting a program exception in kvm-pr
@ 2016-05-19  9:33 ` Thomas Huth
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2016-05-19  9:33 UTC (permalink / raw)
  To: Alexander Graf, Paul Mackerras, kvm-ppc; +Cc: kvm, lvivier

vcpu->arch.shadow_srr1 only contains usable values for injecting
a program exception into the guest if we entered the function
kvmppc_handle_exit_pr() with exit_nr == BOOK3S_INTERRUPT_PROGRAM.
In other cases, the shadow_srr1 bits are zero. Since we want to
pass an illegal-instruction program check to the guest, set
"flags" to SRR1_PROGILL for these other cases.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 v2: Added a comment, as suggested by Alexander Graf

 arch/powerpc/kvm/book3s_pr.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 95bceca..e67b8ea 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -1031,7 +1031,17 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
 		int emul;
 
 program_interrupt:
-		flags = vcpu->arch.shadow_srr1 & 0x1f0000ull;
+		/*
+		 * shadow_srr1 only contains valid flags if we came here via
+		 * a program exception. The other exceptions (emulation assist,
+		 * FP unavailable, etc.) do not provide flags in SRR1, so use
+		 * an illegal-instruction exception when injecting a program
+		 * interrupt into the guest.
+		 */
+		if (exit_nr == BOOK3S_INTERRUPT_PROGRAM)
+			flags = vcpu->arch.shadow_srr1 & 0x1f0000ull;
+		else
+			flags = SRR1_PROGILL;
 
 		emul = kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst);
 		if (emul != EMULATE_DONE) {
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2] KVM: PPC: Fix contents of SRR1 when injecting a program exception in kvm-pr
@ 2016-05-19  9:33 ` Thomas Huth
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2016-05-19  9:33 UTC (permalink / raw)
  To: Alexander Graf, Paul Mackerras, kvm-ppc; +Cc: kvm, lvivier

vcpu->arch.shadow_srr1 only contains usable values for injecting
a program exception into the guest if we entered the function
kvmppc_handle_exit_pr() with exit_nr = BOOK3S_INTERRUPT_PROGRAM.
In other cases, the shadow_srr1 bits are zero. Since we want to
pass an illegal-instruction program check to the guest, set
"flags" to SRR1_PROGILL for these other cases.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 v2: Added a comment, as suggested by Alexander Graf

 arch/powerpc/kvm/book3s_pr.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 95bceca..e67b8ea 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -1031,7 +1031,17 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
 		int emul;
 
 program_interrupt:
-		flags = vcpu->arch.shadow_srr1 & 0x1f0000ull;
+		/*
+		 * shadow_srr1 only contains valid flags if we came here via
+		 * a program exception. The other exceptions (emulation assist,
+		 * FP unavailable, etc.) do not provide flags in SRR1, so use
+		 * an illegal-instruction exception when injecting a program
+		 * interrupt into the guest.
+		 */
+		if (exit_nr = BOOK3S_INTERRUPT_PROGRAM)
+			flags = vcpu->arch.shadow_srr1 & 0x1f0000ull;
+		else
+			flags = SRR1_PROGILL;
 
 		emul = kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst);
 		if (emul != EMULATE_DONE) {
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] KVM: PPC: Fix contents of SRR1 when injecting a program exception in kvm-pr
  2016-05-19  9:33 ` Thomas Huth
@ 2016-06-14 17:51   ` Thomas Huth
  -1 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2016-06-14 17:51 UTC (permalink / raw)
  To: Alexander Graf, Paul Mackerras, kvm-ppc; +Cc: kvm, lvivier

On 19.05.2016 11:33, Thomas Huth wrote:
> vcpu->arch.shadow_srr1 only contains usable values for injecting
> a program exception into the guest if we entered the function
> kvmppc_handle_exit_pr() with exit_nr == BOOK3S_INTERRUPT_PROGRAM.
> In other cases, the shadow_srr1 bits are zero. Since we want to
> pass an illegal-instruction program check to the guest, set
> "flags" to SRR1_PROGILL for these other cases.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  v2: Added a comment, as suggested by Alexander Graf
> 
>  arch/powerpc/kvm/book3s_pr.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
> index 95bceca..e67b8ea 100644
> --- a/arch/powerpc/kvm/book3s_pr.c
> +++ b/arch/powerpc/kvm/book3s_pr.c
> @@ -1031,7 +1031,17 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		int emul;
>  
>  program_interrupt:
> -		flags = vcpu->arch.shadow_srr1 & 0x1f0000ull;
> +		/*
> +		 * shadow_srr1 only contains valid flags if we came here via
> +		 * a program exception. The other exceptions (emulation assist,
> +		 * FP unavailable, etc.) do not provide flags in SRR1, so use
> +		 * an illegal-instruction exception when injecting a program
> +		 * interrupt into the guest.
> +		 */
> +		if (exit_nr == BOOK3S_INTERRUPT_PROGRAM)
> +			flags = vcpu->arch.shadow_srr1 & 0x1f0000ull;
> +		else
> +			flags = SRR1_PROGILL;
>  
>  		emul = kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst);
>  		if (emul != EMULATE_DONE) {
> 

*ping*

 Thomas


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] KVM: PPC: Fix contents of SRR1 when injecting a program exception in kvm-pr
@ 2016-06-14 17:51   ` Thomas Huth
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2016-06-14 17:51 UTC (permalink / raw)
  To: Alexander Graf, Paul Mackerras, kvm-ppc; +Cc: kvm, lvivier

On 19.05.2016 11:33, Thomas Huth wrote:
> vcpu->arch.shadow_srr1 only contains usable values for injecting
> a program exception into the guest if we entered the function
> kvmppc_handle_exit_pr() with exit_nr = BOOK3S_INTERRUPT_PROGRAM.
> In other cases, the shadow_srr1 bits are zero. Since we want to
> pass an illegal-instruction program check to the guest, set
> "flags" to SRR1_PROGILL for these other cases.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  v2: Added a comment, as suggested by Alexander Graf
> 
>  arch/powerpc/kvm/book3s_pr.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
> index 95bceca..e67b8ea 100644
> --- a/arch/powerpc/kvm/book3s_pr.c
> +++ b/arch/powerpc/kvm/book3s_pr.c
> @@ -1031,7 +1031,17 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		int emul;
>  
>  program_interrupt:
> -		flags = vcpu->arch.shadow_srr1 & 0x1f0000ull;
> +		/*
> +		 * shadow_srr1 only contains valid flags if we came here via
> +		 * a program exception. The other exceptions (emulation assist,
> +		 * FP unavailable, etc.) do not provide flags in SRR1, so use
> +		 * an illegal-instruction exception when injecting a program
> +		 * interrupt into the guest.
> +		 */
> +		if (exit_nr = BOOK3S_INTERRUPT_PROGRAM)
> +			flags = vcpu->arch.shadow_srr1 & 0x1f0000ull;
> +		else
> +			flags = SRR1_PROGILL;
>  
>  		emul = kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst);
>  		if (emul != EMULATE_DONE) {
> 

*ping*

 Thomas


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] KVM: PPC: Fix contents of SRR1 when injecting a program exception in kvm-pr
  2016-05-19  9:33 ` Thomas Huth
@ 2016-06-24  9:21   ` Paul Mackerras
  -1 siblings, 0 replies; 6+ messages in thread
From: Paul Mackerras @ 2016-06-24  9:21 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Alexander Graf, kvm-ppc, kvm, lvivier

On Thu, May 19, 2016 at 11:33:31AM +0200, Thomas Huth wrote:
> vcpu->arch.shadow_srr1 only contains usable values for injecting
> a program exception into the guest if we entered the function
> kvmppc_handle_exit_pr() with exit_nr == BOOK3S_INTERRUPT_PROGRAM.
> In other cases, the shadow_srr1 bits are zero. Since we want to
> pass an illegal-instruction program check to the guest, set
> "flags" to SRR1_PROGILL for these other cases.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Thanks, applied to my kvm-ppc-next branch.

Paul.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] KVM: PPC: Fix contents of SRR1 when injecting a program exception in kvm-pr
@ 2016-06-24  9:21   ` Paul Mackerras
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Mackerras @ 2016-06-24  9:21 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Alexander Graf, kvm-ppc, kvm, lvivier

On Thu, May 19, 2016 at 11:33:31AM +0200, Thomas Huth wrote:
> vcpu->arch.shadow_srr1 only contains usable values for injecting
> a program exception into the guest if we entered the function
> kvmppc_handle_exit_pr() with exit_nr = BOOK3S_INTERRUPT_PROGRAM.
> In other cases, the shadow_srr1 bits are zero. Since we want to
> pass an illegal-instruction program check to the guest, set
> "flags" to SRR1_PROGILL for these other cases.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Thanks, applied to my kvm-ppc-next branch.

Paul.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-06-24  9:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19  9:33 [PATCH v2] KVM: PPC: Fix contents of SRR1 when injecting a program exception in kvm-pr Thomas Huth
2016-05-19  9:33 ` Thomas Huth
2016-06-14 17:51 ` Thomas Huth
2016-06-14 17:51   ` Thomas Huth
2016-06-24  9:21 ` Paul Mackerras
2016-06-24  9:21   ` Paul Mackerras

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.