From patchwork Tue Sep 12 10:03:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9948889 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A740560360 for ; Tue, 12 Sep 2017 10:06:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97BDE283BB for ; Tue, 12 Sep 2017 10:06:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8CA9328EC7; Tue, 12 Sep 2017 10:06:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 41125283BB for ; Tue, 12 Sep 2017 10:06:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2o-0002tL-OP; Tue, 12 Sep 2017 10:03:50 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2n-0002rb-Eg for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:49 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id 20/FC-01910-401B7B95; Tue, 12 Sep 2017 10:03:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTZdl4/Z Ig2mLGS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oxXm1vYCl7wVly9+oWtgXEjVxcjF4eQwGZG iSc/TrFCOKcZJZa0rwZyODnYBDQl7nz+xARiiwhIS1z7fJkRxGYWiJQ4/OEHO4gtLOAhseHUD 2YQm0VAVeL8+uVsIDavgIXEit+HwOISAvISu9ougs3kFLCUWPHxF1iNEFDN95c/GCcwci9gZF jFqFGcWlSWWqRraK6XVJSZnlGSm5iZo2toYKyXm1pcnJiempOYVKyXnJ+7iRHoYQYg2MH48rT nIUZJDiYlUd4j67dHCvEl5adUZiQWZ8QXleakFh9ilOHgUJLgPQ+SEyxKTU+tSMvMAYYaTFqC g0dJhHc2SJq3uCAxtzgzHSJ1ilGXo+Pm3T9MQix5+XmpUuK8GSBFAiBFGaV5cCNgYX+JUVZKm JcR6CghnoLUotzMElT5V4ziHIxKwrzxIFN4MvNK4Da9AjqCCegInktbQI4oSURISTUwriq34n K8FuC18ox+a374is/3nCytpMXKOzpNutiCtiaWTbkovINpLs/kh1yvksTr+mIrfMXZTB/uujw h/VVoHGPczP2ekbdX23kueGsq5XrPryd09wWBhUbzTd/4asvM2MLa/urZ9tdRayb+LTb8+CC0 RV38gK39JFnZ88u7HXfwbb+zVOSsEktxRqKhFnNRcSIALpThAHYCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1505210627!114366351!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 53730 invoked from network); 12 Sep 2017 10:03:47 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-31.messagelabs.com with SMTP; 12 Sep 2017 10:03:47 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 42D111529; Tue, 12 Sep 2017 03:03:47 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 548CB3F578; Tue, 12 Sep 2017 03:03:46 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:12 +0100 Message-Id: <20170912100330.2168-7-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 06/24] xen/arm: traps: Don't define FAR_EL2 for ARM32 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Aliasing FAR_EL2 to HIFAR makes the code confusing because on ARMv8 FAR_EL2[31:0] is architecturally mapped to HDFAR and FAR_EL2[63:32] to HIFAR. See D7.2.30 in ARM DDI 0487B.a. Open-code the alias instead. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- Changes in v2: - Fix register name in the commit message - Add Andre's reviewed-by --- xen/arch/arm/traps.c | 8 +++++++- xen/include/asm-arm/cpregs.h | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 7f6ec15b5e..967bfea4ed 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2579,11 +2579,17 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs, const union hsr hsr) { int rc; - register_t gva = READ_SYSREG(FAR_EL2); + register_t gva; uint8_t fsc = hsr.iabt.ifsc & ~FSC_LL_MASK; paddr_t gpa; mfn_t mfn; +#ifdef CONFIG_ARM_32 + gva = READ_CP32(HIFAR); +#else + gva = READ_SYSREG64(FAR_EL2); +#endif + /* * If this bit has been set, it means that this instruction abort is caused * by a guest external abort. We can handle this instruction abort as guest diff --git a/xen/include/asm-arm/cpregs.h b/xen/include/asm-arm/cpregs.h index af45ec7a65..1889d7cbfb 100644 --- a/xen/include/asm-arm/cpregs.h +++ b/xen/include/asm-arm/cpregs.h @@ -307,7 +307,6 @@ #define ESR_EL1 DFSR #define ESR_EL2 HSR #define FAR_EL1 HIFAR -#define FAR_EL2 HIFAR #define HCR_EL2 HCR #define HPFAR_EL2 HPFAR #define HSTR_EL2 HSTR