Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D256C2D0E4 for ; Tue, 17 Nov 2020 17:30:55 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C53E4241A7 for ; Tue, 17 Nov 2020 17:30:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C53E4241A7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.29188.58436 (Exim 4.92) (envelope-from ) id 1kf4oA-0003ZT-Rv; Tue, 17 Nov 2020 17:30:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 29188.58436; Tue, 17 Nov 2020 17:30:22 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kf4oA-0003ZM-Og; Tue, 17 Nov 2020 17:30:22 +0000 Received: by outflank-mailman (input) for mailman id 29188; Tue, 17 Nov 2020 17:30:21 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kf4o9-0003ZH-D4 for xen-devel@lists.xenproject.org; Tue, 17 Nov 2020 17:30:21 +0000 Received: from [54.239.6.188] (helo=a483e7b01a66.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kf4o8-0003ib-T3; Tue, 17 Nov 2020 17:30:21 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kf4o9-0003ZH-D4 for xen-devel@lists.xenproject.org; Tue, 17 Nov 2020 17:30:21 +0000 Received: from [54.239.6.188] (helo=a483e7b01a66.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kf4o8-0003ib-T3; Tue, 17 Nov 2020 17:30:21 +0000 Subject: Re: [PATCH v2] xen/arm: Add workaround for Cortex-A76/Neoverse-N1 erratum #1286807 To: Michal Orzel , xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Volodymyr Babchuk , bertrand.marquis@arm.com References: <20201116121140.26763-1-michal.orzel@arm.com> From: Julien Grall Message-ID: Date: Tue, 17 Nov 2020 17:30:19 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 MIME-Version: 1.0 In-Reply-To: <20201116121140.26763-1-michal.orzel@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Hi Michal, On 16/11/2020 12:11, Michal Orzel wrote: > On the affected Cortex-A76/Neoverse-N1 cores (r0p0 to r3p0), > if a virtual address for a cacheable mapping of a location is being > accessed by a core while another core is remapping the virtual > address to a new physical page using the recommended break-before-make > sequence, then under very rare circumstances TLBI+DSB completes before > a read using the translation being invalidated has been observed by > other observers. The workaround repeats the TLBI+DSB operation > for all the TLB flush operations on purpose. Sorry for nitpicking, the commit message should contain enough information for future reader to understand why this was done "on purpose". So how about: "The workaround repeats the TLBI+DSB operation for all the TLB flush operations. While this is stricly not necessary, we don't want to take any risk.". I can fix it on commit. Reviewed-by: Julien Grall > > Signed-off-by: Michal Orzel > --- > docs/misc/arm/silicon-errata.txt | 2 ++ > xen/arch/arm/Kconfig | 23 +++++++++++++++++++++ > xen/arch/arm/cpuerrata.c | 14 +++++++++++++ > xen/include/asm-arm/arm64/flushtlb.h | 30 +++++++++++++++++++--------- > xen/include/asm-arm/cpufeature.h | 3 ++- > 5 files changed, 62 insertions(+), 10 deletions(-) > > diff --git a/docs/misc/arm/silicon-errata.txt b/docs/misc/arm/silicon-errata.txt > index 552c4151d3..d183ba543f 100644 > --- a/docs/misc/arm/silicon-errata.txt > +++ b/docs/misc/arm/silicon-errata.txt > @@ -53,5 +53,7 @@ stable hypervisors. > | ARM | Cortex-A72 | #853709 | N/A | > | ARM | Cortex-A73 | #858921 | ARM_ERRATUM_858921 | > | ARM | Cortex-A76 | #1165522 | N/A | > +| ARM | Cortex-A76 | #1286807 | ARM64_ERRATUM_1286807 | > | ARM | Neoverse-N1 | #1165522 | N/A > +| ARM | Neoverse-N1 | #1286807 | ARM64_ERRATUM_1286807 | > | ARM | MMU-500 | #842869 | N/A | > diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig > index f938dd21bd..8171b8d04a 100644 > --- a/xen/arch/arm/Kconfig > +++ b/xen/arch/arm/Kconfig > @@ -244,6 +244,29 @@ config ARM_ERRATUM_858921 > > If unsure, say Y. > > +config ARM64_WORKAROUND_REPEAT_TLBI > + bool > + > +config ARM64_ERRATUM_1286807 > + bool "Cortex-A76/Neoverse-N1: 1286807: Modification of the translation table for a virtual address might lead to read-after-read ordering violation" > + default y > + select ARM64_WORKAROUND_REPEAT_TLBI > + depends on ARM_64 > + help > + This option adds a workaround for ARM Cortex-A76/Neoverse-N1 erratum 1286807. > + > + On the affected Cortex-A76/Neoverse-N1 cores (r0p0 to r3p0), if a virtual > + address for a cacheable mapping of a location is being > + accessed by a core while another core is remapping the virtual > + address to a new physical page using the recommended > + break-before-make sequence, then under very rare circumstances > + TLBI+DSB completes before a read using the translation being > + invalidated has been observed by other observers. The > + workaround repeats the TLBI+DSB operation for all the TLB flush > + operations on purpose. If you agree with what I wrote above, I will update this section and ... > + > + If unsure, say Y. > + > endmenu > > config ARM64_HARDEN_BRANCH_PREDICTOR > diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c > index 567911d380..cb4795beec 100644 > --- a/xen/arch/arm/cpuerrata.c > +++ b/xen/arch/arm/cpuerrata.c > @@ -424,6 +424,20 @@ static const struct arm_cpu_capabilities arm_errata[] = { > (1 << MIDR_VARIANT_SHIFT) | 2), > }, > #endif > +#ifdef CONFIG_ARM64_ERRATUM_1286807 > + { > + /* Cortex-A76 r0p0 - r3p0 */ > + .desc = "ARM erratum 1286807", > + .capability = ARM64_WORKAROUND_REPEAT_TLBI, > + MIDR_RANGE(MIDR_CORTEX_A76, 0, 3 << MIDR_VARIANT_SHIFT), > + }, > + { > + /* Neoverse-N1 r0p0 - r3p0 */ > + .desc = "ARM erratum 1286807", > + .capability = ARM64_WORKAROUND_REPEAT_TLBI, > + MIDR_RANGE(MIDR_NEOVERSE_N1, 0, 3 << MIDR_VARIANT_SHIFT), > + }, > +#endif > #ifdef CONFIG_ARM64_HARDEN_BRANCH_PREDICTOR > { > .capability = ARM_HARDEN_BRANCH_PREDICTOR, > diff --git a/xen/include/asm-arm/arm64/flushtlb.h b/xen/include/asm-arm/arm64/flushtlb.h > index ceec59542e..8f2abfaf1d 100644 > --- a/xen/include/asm-arm/arm64/flushtlb.h > +++ b/xen/include/asm-arm/arm64/flushtlb.h > @@ -9,6 +9,12 @@ > * DSB ISH // Ensure the TLB invalidation has completed > * ISB // See explanation below > * > + * ARM64_WORKAROUND_REPEAT_TLBI: > + * Modification of the translation table for a virtual address might lead to > + * read-after-read ordering violation. > + * The workaround repeats TLBI+DSB operation for all the TLB flush operations > + * on purpose. ... this section while committing. Cheers, -- Julien Grall