kvmarm.lists.cs.columbia.edu archive mirror
 help / color / mirror / Atom feed
From: James Morse <james.morse@arm.com>
To: Andrew Scull <ascull@google.com>, maz@kernel.org
Cc: kernel-team@android.com, kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH] KVM: arm64: Avoid rewinding the PC for trapped SMCs
Date: Wed, 15 Jul 2020 14:16:26 +0100	[thread overview]
Message-ID: <1c4cbd53-e035-1b7b-e062-80d594b8bd08@arm.com> (raw)
In-Reply-To: <20200714094520.3313396-1-ascull@google.com>

Hi Andrew,

On 14/07/2020 10:45, Andrew Scull wrote:
> When handling a guest's SError that was identified in __guest_exit, it
> is injected back into the guest at the instruction that caused the
> switch into hyp. A trapped SMC does not advance the PC so no adjustment
> needs to be made to the PC.

Oops!

Reviewed-by: James Morse <james.morse@arm.com>


Thanks,

James


> Fixes: ddb3d07cfe90 ("arm64: KVM: Inject a Virtual SError if it was pending")
> Signed-off-by: Andrew Scull <ascull@google.com>
> ---
>  arch/arm64/kvm/handle_exit.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
> index 98ab33139982..7d9e198ebdf2 100644
> --- a/arch/arm64/kvm/handle_exit.c
> +++ b/arch/arm64/kvm/handle_exit.c
> @@ -244,12 +244,11 @@ int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
>  		u8 esr_ec = ESR_ELx_EC(kvm_vcpu_get_esr(vcpu));
>  
>  		/*
> -		 * HVC/SMC already have an adjusted PC, which we need
> +		 * HVC already has an adjusted PC, which we need
>  		 * to correct in order to return to after having
>  		 * injected the SError.
>  		 */
> -		if (esr_ec == ESR_ELx_EC_HVC32 || esr_ec == ESR_ELx_EC_HVC64 ||
> -		    esr_ec == ESR_ELx_EC_SMC32 || esr_ec == ESR_ELx_EC_SMC64) {
> +		if (esr_ec == ESR_ELx_EC_HVC32 || esr_ec == ESR_ELx_EC_HVC64) {
>  			u32 adj =  kvm_vcpu_trap_il_is32bit(vcpu) ? 4 : 2;
>  			*vcpu_pc(vcpu) -= adj;
>  		}
> 

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

      reply	other threads:[~2020-07-15 13:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14  9:45 [PATCH] KVM: arm64: Avoid rewinding the PC for trapped SMCs Andrew Scull
2020-07-15 13:16 ` James Morse [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1c4cbd53-e035-1b7b-e062-80d594b8bd08@arm.com \
    --to=james.morse@arm.com \
    --cc=ascull@google.com \
    --cc=kernel-team@android.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=maz@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).