From patchwork Wed Jun 22 13:21:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9192761 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 922C56075A for ; Wed, 22 Jun 2016 13:23:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83B7A283F7 for ; Wed, 22 Jun 2016 13:23:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 781DD28406; Wed, 22 Jun 2016 13:23:26 +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 2D731283F7 for ; Wed, 22 Jun 2016 13:23:26 +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 1bFi5u-00018c-4Y; Wed, 22 Jun 2016 13:21:26 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFi5t-00018C-G1 for xen-devel@lists.xen.org; Wed, 22 Jun 2016 13:21:25 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id F2/46-00606-4D09A675; Wed, 22 Jun 2016 13:21:24 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTffKhKx wg9lTxCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1owdD96xFazlrHg44TJzA+Nk9i5GLg4hgU2M ErtfLWGDcE4zSsxc08baxcjJwSagKXHn8ycmEFtEQFri2ufLjCBFzAJtjBJrZ08Fcjg4hAUCJ S41R4LUsAioSlxrngtWzyvgIvFx+yewORICchInj00GszkFXCX+n28Cs4WAatZ9Ps86gZF7AS PDKkb14tSistQiXUO9pKLM9IyS3MTMHF1DA1O93NTi4sT01JzEpGK95PzcTYxA/9YzMDDuYGz qdT7EKMnBpCTKK6+cFS7El5SfUpmRWJwRX1Sak1p8iFGGg0NJgnd7P1BOsCg1PbUiLTMHGGgw aQkOHiUR3hkgad7igsTc4sx0iNQpRkUpcd4akIQASCKjNA+uDRbclxhlpYR5GRkYGIR4ClKLc jNLUOVfMYpzMCoJ8z4EmcKTmVcCN/0V0GImoMXL+tNBFpckIqSkGhiLS0p7dsmuOR/wbN2Fef dsXE4K/J7Oa7FLVWzymabgvx/2979t13DVFVIrmqiwZ/kO1SsbxY+qdyT323E6HT9VkHsuua7 vjeSEjhn+LdXeC5I+V6+xmxaYZsPBt3HuxukOQn+vSJn+v6K+//Dr+You5v/SYxffMEx02p3H uebnhGmCJwJuzpJUYinOSDTUYi4qTgQATutr0mkCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-10.tower-206.messagelabs.com!1466601683!28961764!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 49748 invoked from network); 22 Jun 2016 13:21:24 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-10.tower-206.messagelabs.com with SMTP; 22 Jun 2016 13:21:24 -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 905DD938; Wed, 22 Jun 2016 06:22:10 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.215.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 78B983F21A; Wed, 22 Jun 2016 06:21:22 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 22 Jun 2016 14:21:04 +0100 Message-Id: <1466601669-25398-5-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466601669-25398-1-git-send-email-julien.grall@arm.com> References: <1466601669-25398-1-git-send-email-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org, steve.capper@arm.com, wei.chen@linaro.org Subject: [Xen-devel] [PATCH 4/9] xen/arm: traps: Simplify the switch in do_trap_*_abort_guest 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 The fault status we care are all the form BBBBxx where xx is the lookup level that gave the fault. We can simply the code by masking the 2 least significant bits. Signed-off-by: Julien Grall --- xen/arch/arm/traps.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 2e84b5a..8a3fac0 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2388,9 +2388,9 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs, int rc; register_t gva = READ_SYSREG(FAR_EL2); - switch ( hsr.iabt.ifsc & 0x3f ) + switch ( hsr.iabt.ifsc & ~FSC_LL_MASK ) { - case FSC_FLT_PERM ... FSC_FLT_PERM + 3: + case FSC_FLT_PERM: { paddr_t gpa; const struct npfec npfec = { @@ -2451,9 +2451,9 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, return; /* Try again */ } - switch ( dabt.dfsc & 0x3f ) + switch ( dabt.dfsc & ~FSC_LL_MASK ) { - case FSC_FLT_PERM ... FSC_FLT_PERM + 3: + case FSC_FLT_PERM: { const struct npfec npfec = { .read_access = !dabt.write,