From nobody Tue May 7 13:15:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1607597043; cv=none; d=zohomail.com; s=zohoarc; b=BS6Raj40kelao9jLlWqlwe6/e/X0RYTef1rqW5AX/ReMX4EB8jctDXZna04iIWkoRYcNkFzZsCQYhcFMxdTzQbMI35Wf0Yh9nFvhv9z/ZxT6ltRx11tW31T0vwNLftlHi9QiJ/ngCC/HxUkqa8MPXakQYCpe+LNGKVVsAcppMfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607597043; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=jEMAGrL4C6JcdMjtzgsP0+hgyhQb2V+YdsIQa/tcT78=; b=jIB0co0SXAoEnGoUIAM1hUIXK9U9kIOfJYzsELxlqAyZbE335PB8+GzF3r8IxYt7RsCP/k0Wuf16bPCoostMoi8ZmsSpk6GwG+SyZWd7kNAz4cPOiOUsIgqJJA2ZJcKaJXfSJ+XK8rjfmulW59ch982fGQEzrIkFAT6tnys4vVs= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1607597043565397.4020805666305; Thu, 10 Dec 2020 02:44:03 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.49054.86772 (Exim 4.92) (envelope-from ) id 1knJQ2-0003GP-Eg; Thu, 10 Dec 2020 10:43:30 +0000 Received: by outflank-mailman (output) from mailman id 49054.86772; Thu, 10 Dec 2020 10:43:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1knJQ2-0003GI-Bk; Thu, 10 Dec 2020 10:43:30 +0000 Received: by outflank-mailman (input) for mailman id 49054; Thu, 10 Dec 2020 10:43:28 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1knJQ0-0003GD-IB for xen-devel@lists.xenproject.org; Thu, 10 Dec 2020 10:43:28 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 4ad526f4-b2db-4788-94e3-8b8c52186b02; Thu, 10 Dec 2020 10:43:26 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 49C9C30E; Thu, 10 Dec 2020 02:43:26 -0800 (PST) Received: from localhost.localdomain (unknown [10.57.62.29]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8AFDC3F718; Thu, 10 Dec 2020 02:43:24 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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" X-Inumbo-ID: 4ad526f4-b2db-4788-94e3-8b8c52186b02 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, wei.chen@arm.com, Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Wei Liu Subject: [PATCH] xen/arm: Add workaround for Cortex-A53 erratum #843419 Date: Thu, 10 Dec 2020 10:42:58 +0000 Message-Id: <20201210104258.111-1-luca.fancellu@arm.com> X-Mailer: git-send-email 2.17.1 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" On the Cortex A53, when executing in AArch64 state, a load or store instruc= tion which uses the result of an ADRP instruction as a base register, or which u= ses a base register written by an instruction immediately after an ADRP to the same register, might access an incorrect address. The workaround is to enable the linker flag --fix-cortex-a53-843419 if present, to check and fix the affected sequence. Otherwise print a warni= ng that Xen may be susceptible to this errata Signed-off-by: Luca Fancellu Reviewed-by: Bertrand Marquis Reviewed-by: Stefano Stabellini --- docs/misc/arm/silicon-errata.txt | 1 + xen/arch/arm/Kconfig | 19 +++++++++++++++++++ xen/arch/arm/Makefile | 8 ++++++++ xen/scripts/Kbuild.include | 12 ++++++++++++ 4 files changed, 40 insertions(+) diff --git a/docs/misc/arm/silicon-errata.txt b/docs/misc/arm/silicon-errat= a.txt index 27bf957ebf..1925d8fd4e 100644 --- a/docs/misc/arm/silicon-errata.txt +++ b/docs/misc/arm/silicon-errata.txt @@ -45,6 +45,7 @@ stable hypervisors. | ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_82731= 9 | | ARM | Cortex-A53 | #824069 | ARM64_ERRATUM_82406= 9 | | ARM | Cortex-A53 | #819472 | ARM64_ERRATUM_81947= 2 | +| ARM | Cortex-A53 | #843419 | ARM64_ERRATUM_84341= 9 | | ARM | Cortex-A55 | #1530923 | N/A = | | ARM | Cortex-A57 | #852523 | N/A = | | ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_83207= 5 | diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index f5b1bcda03..41bde2f401 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -186,6 +186,25 @@ config ARM64_ERRATUM_819472 =20 If unsure, say Y. =20 +config ARM64_ERRATUM_843419 + bool "Cortex-A53: 843419: A load or store might access an incorrect addre= ss" + default y + depends on ARM_64 + help + This option adds an alternative code sequence to work around ARM + erratum 843419 on Cortex-A53 parts up to r0p4. + + When executing in AArch64 state, a load or store instruction which uses + the result of an ADRP instruction as a base register, or which uses a + base register written by an instruction immediately after an ADRP to the + same register, might access an incorrect address. + + The workaround enables the linker to check if the affected sequence is + produced and it will fix it with an alternative not affected sequence + that produce the same behavior. + + If unsure, say Y. + config ARM64_ERRATUM_832075 bool "Cortex-A57: 832075: possible deadlock on mixing exclusive memory ac= cesses with device loads" default y diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 296c5e68bb..ad2d497c45 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -101,6 +101,14 @@ prelink.o: $(ALL_OBJS) FORCE $(call if_changed,ld) endif =20 +ifeq ($(CONFIG_ARM64_ERRATUM_843419),y) + ifeq ($(call ld-option, --fix-cortex-a53-843419),n) + $(warning ld does not support --fix-cortex-a53-843419; xen may be = susceptible to erratum) + else + XEN_LDFLAGS +=3D --fix-cortex-a53-843419 + endif +endif + targets +=3D prelink.o =20 $(TARGET)-syms: prelink.o xen.lds diff --git a/xen/scripts/Kbuild.include b/xen/scripts/Kbuild.include index e62eddc365..83c7e1457b 100644 --- a/xen/scripts/Kbuild.include +++ b/xen/scripts/Kbuild.include @@ -43,6 +43,18 @@ define as-option-add-closure endif endef =20 +# $(if-success,,,) +# Return if exits with 0, otherwise. +if-success =3D $(shell { $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$= (3)") + +# $(success,) +# Return y if exits with 0, n otherwise +success =3D $(call if-success,$(1),y,n) + +# $(ld-option,) +# Return y if the linker supports , n otherwise +ld-option =3D $(call success,$(LD) -v $(1)) + # cc-ifversion # Usage: EXTRA_CFLAGS +=3D $(call cc-ifversion, -lt, 0402, -O1) cc-ifversion =3D $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $= (3) || echo $(4)) --=20 2.17.1