From patchwork Wed Jun 22 13:21:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 70648 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp2547259qgy; Wed, 22 Jun 2016 06:23:46 -0700 (PDT) X-Received: by 10.107.30.72 with SMTP id e69mr38669677ioe.142.1466601823357; Wed, 22 Jun 2016 06:23:43 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y80si1983194itb.57.2016.06.22.06.23.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Jun 2016 06:23:43 -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 1bFi5y-0001Ar-R4; Wed, 22 Jun 2016 13:21:30 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFi5x-00019p-2g for xen-devel@lists.xen.org; Wed, 22 Jun 2016 13:21:29 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 06/70-22092-8D09A675; Wed, 22 Jun 2016 13:21:28 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTff6hKx wg6ftVhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8alY2vYC74JV2xbP5m9gfEzbxcjF4eQwCZG iXezn7BDOKcZJaZ0vmbsYuTkYBPQlLjz+RMTiC0iIC1x7fNlRpAiZoE2Rom1s6eCFQkLhEu8P bGBFcRmEVCVOHZlPVicV8BFYs2S9ewgtoSAnMTJY5PBajgFXCX+n28Cs4WAatZ9Ps86gZF7AS PDKkb14tSistQiXWO9pKLM9IyS3MTMHF1DAzO93NTi4sT01JzEpGK95PzcTYxADzMAwQ7Gjn9 OhxglOZiURHnllbPChfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwuvYD5QSLUtNTK9Iyc4ChBpOW 4OBREuGNBEnzFhck5hZnpkOkTjEqSonz1oAkBEASGaV5cG2w8L7EKCslzMsIdIgQT0FqUW5mC ar8K0ZxDkYlYV4FkCk8mXklcNNfAS1mAlq8rD8dZHFJIkJKqoFxove74Gzt3IDWd8KbsnNnNE 8NymLuMGbIYVvez312R07O9xQrqy4NzR13v+28dM/6+4ReZXn9hTVh0/Nkpuge4VQuaRa2WWD A0v90Cv8Ms7Rn7d82ZL44/nZBt/XPNBfFu5/eRgtH53CLmEed/XwqYiJn3Kae6692nWNU135w zuedfs4ht3IlluKMREMt5qLiRAAgLZ4RagIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-2.tower-21.messagelabs.com!1466601683!6353330!4 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 51868 invoked from network); 22 Jun 2016 13:21:27 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-2.tower-21.messagelabs.com with SMTP; 22 Jun 2016 13:21:27 -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 8EBCB440; Wed, 22 Jun 2016 06:22:14 -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 778A53F21A; Wed, 22 Jun 2016 06:21:26 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 22 Jun 2016 14:21:07 +0100 Message-Id: <1466601669-25398-8-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 7/9] xen/arm: traps: MMIO should only be emulated for fault translation 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 function do_trap_data_abort_guest assumes that a stage-2 data abort can only be taken for a translation fault or permission fault today. Whilst this is true today, it might not be in the future. Rather than emulating the MMIO for any fault other than the permission one, print a warning message when the fault is not handled by Xen. Signed-off-by: Julien Grall --- xen/arch/arm/traps.c | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 785e3e9..591de3c 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2468,35 +2468,40 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, /* Trap was triggered by mem_access, work here is done */ if ( !rc ) return; + break; } - break; - } - - if ( dabt.s1ptw ) - goto bad_data_abort; + case FSC_FLT_TRANS: + if ( dabt.s1ptw ) + goto bad_data_abort; - /* XXX: Decode the instruction if ISS is not valid */ - if ( !dabt.valid ) - goto bad_data_abort; + /* XXX: Decode the instruction if ISS is not valid */ + if ( !dabt.valid ) + goto bad_data_abort; - /* - * Erratum 766422: Thumb store translation fault to Hypervisor may - * not have correct HSR Rt value. - */ - if ( check_workaround_766422() && (regs->cpsr & PSR_THUMB) && dabt.write ) - { - rc = decode_instruction(regs, &info.dabt); - if ( rc ) + /* + * Erratum 766422: Thumb store translation fault to Hypervisor may + * not have correct HSR Rt value. + */ + if ( check_workaround_766422() && (regs->cpsr & PSR_THUMB) && + dabt.write ) { - gprintk(XENLOG_DEBUG, "Unable to decode instruction\n"); - goto bad_data_abort; + rc = decode_instruction(regs, &info.dabt); + if ( rc ) + { + gprintk(XENLOG_DEBUG, "Unable to decode instruction\n"); + goto bad_data_abort; + } } - } - if (handle_mmio(&info)) - { - advance_pc(regs, hsr); - return; + if ( handle_mmio(&info) ) + { + advance_pc(regs, hsr); + return; + } + break; + default: + gprintk(XENLOG_WARNING, "Unsupported DFSC: HSR=%#x DFSC=%#x\n", + hsr.bits, dabt.dfsc); } bad_data_abort: