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: 70641 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp2547114qgy; Wed, 22 Jun 2016 06:23:29 -0700 (PDT) X-Received: by 10.36.3.145 with SMTP id e139mr14654276ite.40.1466601809339; Wed, 22 Jun 2016 06:23:29 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id v72si12295955itb.85.2016.06.22.06.23.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Jun 2016 06:23:29 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org 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" 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,