All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Morse <james.morse@arm.com>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: kvm@vger.kernel.org, Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 4/4] arm64: KVM: Implement workaround for Cortex-A76 erratum 1165522
Date: Mon, 5 Nov 2018 18:34:35 +0000	[thread overview]
Message-ID: <a13dfb2d-df5b-7783-2e8b-8a8ffe50b436@arm.com> (raw)
In-Reply-To: <20181105143617.120602-5-marc.zyngier@arm.com>

Hi Marc,

On 05/11/2018 14:36, Marc Zyngier wrote:
> Early versions of Cortex-A76 can end-up with corrupt TLBs if they
> speculate an AT instruction in during a guest switch while the

                              (in during?)

> S1/S2 system registers are in an inconsistent state.
> 
> Work around it by:
> - Mandating VHE
> - Make sure that S1 and S2 system registers are consistent before
>    clearing HCR_EL2.TGE, which allows AT to target the EL1 translation
>    regime
> 
> These two things together ensure that we cannot hit this erratum.


> diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c
> index 51d5d966d9e5..322109183853 100644
> --- a/arch/arm64/kvm/hyp/switch.c
> +++ b/arch/arm64/kvm/hyp/switch.c
> @@ -143,6 +143,13 @@ static void deactivate_traps_vhe(void)
>   {
>   	extern char vectors[];	/* kernel exception vectors */
>   	write_sysreg(HCR_HOST_VHE_FLAGS, hcr_el2);
> +
> +	/*
> +	 * ARM erratum 1165522 requires the actual execution of the
> +	 * above before we can switch to the host translation regime.
> +	 */
> +	asm(ALTERNATIVE("nop", "isb", ARM64_WORKAROUND_1165522));
> +

Host regime too ... does __tlb_switch_to_host_vhe() need the same 
treatment? It writes vttbr_el2 and hcr_el2 back to back.



Thanks,

James

WARNING: multiple messages have this Message-ID (diff)
From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] arm64: KVM: Implement workaround for Cortex-A76 erratum 1165522
Date: Mon, 5 Nov 2018 18:34:35 +0000	[thread overview]
Message-ID: <a13dfb2d-df5b-7783-2e8b-8a8ffe50b436@arm.com> (raw)
In-Reply-To: <20181105143617.120602-5-marc.zyngier@arm.com>

Hi Marc,

On 05/11/2018 14:36, Marc Zyngier wrote:
> Early versions of Cortex-A76 can end-up with corrupt TLBs if they
> speculate an AT instruction in during a guest switch while the

                              (in during?)

> S1/S2 system registers are in an inconsistent state.
> 
> Work around it by:
> - Mandating VHE
> - Make sure that S1 and S2 system registers are consistent before
>    clearing HCR_EL2.TGE, which allows AT to target the EL1 translation
>    regime
> 
> These two things together ensure that we cannot hit this erratum.


> diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c
> index 51d5d966d9e5..322109183853 100644
> --- a/arch/arm64/kvm/hyp/switch.c
> +++ b/arch/arm64/kvm/hyp/switch.c
> @@ -143,6 +143,13 @@ static void deactivate_traps_vhe(void)
>   {
>   	extern char vectors[];	/* kernel exception vectors */
>   	write_sysreg(HCR_HOST_VHE_FLAGS, hcr_el2);
> +
> +	/*
> +	 * ARM erratum 1165522 requires the actual execution of the
> +	 * above before we can switch to the host translation regime.
> +	 */
> +	asm(ALTERNATIVE("nop", "isb", ARM64_WORKAROUND_1165522));
> +

Host regime too ... does __tlb_switch_to_host_vhe() need the same 
treatment? It writes vttbr_el2 and hcr_el2 back to back.



Thanks,

James

  reply	other threads:[~2018-11-05 18:34 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05 14:36 [PATCH 0/4] Workaround for Cortex-A76 erratum 1165522 Marc Zyngier
2018-11-05 14:36 ` Marc Zyngier
2018-11-05 14:36 ` [PATCH 1/4] KVM: arm64: Rework detection of SVE, !VHE systems Marc Zyngier
2018-11-05 14:36   ` Marc Zyngier
2018-11-06  7:52   ` Christoffer Dall
2018-11-06  7:52     ` Christoffer Dall
2018-11-08 19:14     ` Dave Martin
2018-11-08 19:14       ` Dave Martin
2018-11-05 14:36 ` [PATCH 2/4] KVM: arm64: Allow implementations to be confined to using VHE Marc Zyngier
2018-11-05 14:36   ` Marc Zyngier
2018-11-06  7:53   ` Christoffer Dall
2018-11-06  7:53     ` Christoffer Dall
2018-11-08 17:51     ` Marc Zyngier
2018-11-08 17:51       ` Marc Zyngier
2018-11-08 19:23   ` Dave Martin
2018-11-08 19:23     ` Dave Martin
2018-11-05 14:36 ` [PATCH 3/4] arm64: KVM: Install stage-2 translation before enabling traps on VHE Marc Zyngier
2018-11-05 14:36   ` Marc Zyngier
2018-11-06  8:06   ` Christoffer Dall
2018-11-06  8:06     ` Christoffer Dall
2018-11-08 17:54     ` Marc Zyngier
2018-11-08 17:54       ` Marc Zyngier
2018-11-05 14:36 ` [PATCH 4/4] arm64: KVM: Implement workaround for Cortex-A76 erratum 1165522 Marc Zyngier
2018-11-05 14:36   ` Marc Zyngier
2018-11-05 18:34   ` James Morse [this message]
2018-11-05 18:34     ` James Morse
2018-11-08 17:18     ` Marc Zyngier
2018-11-08 17:18       ` Marc Zyngier
2018-11-09 11:39       ` James Morse
2018-11-09 11:39         ` James Morse
2018-11-06  8:15   ` Christoffer Dall
2018-11-06  8:15     ` Christoffer Dall
2018-11-08 18:05     ` Marc Zyngier
2018-11-08 18:05       ` Marc Zyngier
2018-11-08 20:10       ` Christoffer Dall
2018-11-08 20:10         ` Christoffer Dall
2018-11-22 16:13         ` Marc Zyngier
2018-11-22 16:13           ` Marc Zyngier
2018-11-23  9:57           ` Christoffer Dall
2018-11-23  9:57             ` Christoffer Dall
2018-11-21 12:23   ` Julien Grall
2018-11-21 12:23     ` Julien Grall
2018-11-21 12:58     ` Marc Zyngier
2018-11-21 12:58       ` Marc Zyngier

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=a13dfb2d-df5b-7783-2e8b-8a8ffe50b436@arm.com \
    --to=james.morse@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=will.deacon@arm.com \
    /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 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.