linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V13 10/10] arm/arm64: KVM: add guest SEA support
Date: Tue, 28 Mar 2017 11:57:52 +0100	[thread overview]
Message-ID: <58DA41B0.8080203@arm.com> (raw)
In-Reply-To: <1490136425-4324-11-git-send-email-tbaicar@codeaurora.org>

Hi Tyler,

On 21/03/17 22:47, Tyler Baicar wrote:
> Currently external aborts are unsupported by the guest abort
> handling. Add handling for SEAs so that the host kernel reports
> SEAs which occur in the guest kernel.

Looks good,

Can we squash the APEI changes into the patch that added them? This would be one
fewer patches that then need the ACPI maintainer to review.


> diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
> index 962616f..105b6ab 100644
> --- a/arch/arm/kvm/mmu.c
> +++ b/arch/arm/kvm/mmu.c
> @@ -1406,6 +1407,24 @@ static void handle_access_fault(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa)
>  		kvm_set_pfn_accessed(pfn);
>  }
>  
> +static bool is_abort_synchronous(unsigned long fault_status) {

I missed kvm_vcpu_dabt_isextabt() when I suggested we would need a helper (my
fault). Can we use that instead?

(my argument that the unused encodings are reserved doesn't hold if KVM is
already doing this... )


> @@ -1426,23 +1445,31 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run)
>  	unsigned long hva;
>  	bool is_iabt, write_fault, writable;
>  	gfn_t gfn;
> -	int ret, idx;
> +	int ret, idx, sea_status = 1;
> +
> +	/* Check the stage-2 fault is trans. fault or write fault */
> +	fault_status = kvm_vcpu_trap_get_fault_type(vcpu);
> +
> +	fault_ipa = kvm_vcpu_get_fault_ipa(vcpu);
> +
> +	/* The host kernel will handle the synchronous external abort. There
> +	 * is no need to pass the error into the guest.
> +	 */
> +	if (is_abort_synchronous(fault_status))
> +		sea_status = handle_guest_sea((unsigned long)fault_ipa,
> +				    kvm_vcpu_get_hsr(vcpu));


Why not return from here if the error has been handled?

You use sea_status to skip the next two things that KVM might do, but it goes on
to try and process this, possibly calling user_mem_abort(), surely all this is
unnecessary?


>  
>  	is_iabt = kvm_vcpu_trap_is_iabt(vcpu);
> -	if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu))) {
> +	if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu)) && sea_status) {
>  		kvm_inject_vabt(vcpu);
>  		return 1;
>  	}
>  
> -	fault_ipa = kvm_vcpu_get_fault_ipa(vcpu);
> -
>  	trace_kvm_guest_fault(*vcpu_pc(vcpu), kvm_vcpu_get_hsr(vcpu),
>  			      kvm_vcpu_get_hfar(vcpu), fault_ipa);
>  
> -	/* Check the stage-2 fault is trans. fault or write fault */
> -	fault_status = kvm_vcpu_trap_get_fault_type(vcpu);
>  	if (fault_status != FSC_FAULT && fault_status != FSC_PERM &&
> -	    fault_status != FSC_ACCESS) {
> +	    fault_status != FSC_ACCESS && sea_status) {
>  		kvm_err("Unsupported FSC: EC=%#x xFSC=%#lx ESR_EL2=%#lx\n",
>  			kvm_vcpu_trap_get_class(vcpu),
>  			(unsigned long)kvm_vcpu_trap_get_fault(vcpu),


Thanks,

James

      parent reply	other threads:[~2017-03-28 10:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21 22:46 [PATCH V13 00/10] Add UEFI 2.6 and ACPI 6.1 updates for RAS on ARM64 Tyler Baicar
2017-03-21 22:46 ` [PATCH V13 01/10] acpi: apei: read ack upon ghes record consumption Tyler Baicar
2017-03-21 22:46 ` [PATCH V13 02/10] ras: acpi/apei: cper: generic error data entry v3 per ACPI 6.1 Tyler Baicar
2017-03-21 22:46 ` [PATCH V13 03/10] efi: parse ARM processor error Tyler Baicar
2017-03-21 22:46 ` [PATCH V13 04/10] arm64: exception: handle Synchronous External Abort Tyler Baicar
2017-03-23 17:02   ` Catalin Marinas
2017-03-21 22:47 ` [PATCH V13 05/10] acpi: apei: handle SEA notification type for ARMv8 Tyler Baicar
2017-03-23 17:55   ` Catalin Marinas
2017-03-21 22:47 ` [PATCH V13 06/10] acpi: apei: panic OS with fatal error status block Tyler Baicar
2017-03-21 22:47 ` [PATCH V13 07/10] efi: print unrecognized CPER section Tyler Baicar
2017-03-21 22:47 ` [PATCH V13 08/10] ras: acpi / apei: generate trace event for " Tyler Baicar
2017-03-23 18:44   ` Shiju Jose
2017-03-21 22:47 ` [PATCH V13 09/10] trace, ras: add ARM processor error trace event Tyler Baicar
2017-03-22  2:48   ` Xie XiuQi
2017-03-22  3:05     ` Baicar, Tyler
2017-03-21 22:47 ` [PATCH V13 10/10] arm/arm64: KVM: add guest SEA support Tyler Baicar
2017-03-23 17:58   ` Catalin Marinas
2017-03-24 14:03   ` Marc Zyngier
2017-03-28 16:35     ` Baicar, Tyler
2017-03-24 16:01   ` Christoffer Dall
2017-03-28  4:19     ` gengdongjiu
2017-03-28 16:44       ` Baicar, Tyler
2017-03-28 16:42     ` Baicar, Tyler
2017-03-28  9:53   ` gengdongjiu
2017-03-28 16:44     ` Baicar, Tyler
2017-03-28 10:57   ` 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=58DA41B0.8080203@arm.com \
    --to=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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).