From patchwork Thu Aug 4 17:50:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 73300 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1519352qga; Thu, 4 Aug 2016 10:52:37 -0700 (PDT) X-Received: by 10.36.91.134 with SMTP id g128mr78531408itb.42.1470333153132; Thu, 04 Aug 2016 10:52:33 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id g28si13682451ioi.148.2016.08.04.10.52.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Aug 2016 10:52:33 -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 1bVMmj-0004c9-FK; Thu, 04 Aug 2016 17:50:21 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bVMmh-0004bE-Lu for xen-devel@lists.xen.org; Thu, 04 Aug 2016 17:50:19 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id A4/37-15788-A5083A75; Thu, 04 Aug 2016 17:50:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTTeqYXG 4weyV4hZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8az1sdsBa9FKm7d6WJpYDzP18XIxSEksJFR 4un056wQzmlGiV1di5i7GDk52AQ0Je58/sQEYosISEtc+3yZEcRmFnCQePPxHguILSwQJXFww xYwm0VAVeLWrfNgvbwCLhK/Z6xmB7ElBOQkTh6bzApicwq4Skw69QOsRgioZt26yywTGLkXMD KsYtQoTi0qSy3SNTTQSyrKTM8oyU3MzAHyjPVyU4uLE9NTcxKTivWS83M3MQI9XM/AwLiDcVu X8yFGSQ4mJVHeV9WLw4X4kvJTKjMSizPii0pzUosPMcpwcChJ8D6pA8oJFqWmp1akZeYAQw0m LcHBoyTCK1cPlOYtLkjMLc5Mh0idYlSUEud9DdInAJLIKM2Da4OF9yVGWSlhXkYGBgYhnoLUo tzMElT5V4ziHIxKwryHQKbwZOaVwE1/BbSYCWjxCYMFIItLEhFSUg2MbWW6mj0zLtSdbNrUI2 rMc2/mw/+dC2Zpf4g/++q/xRJXKUH7nUtKD8lO7FM5W7ZsgizP04i4aaVTPodxOU91WNncWCt 39kvnxYePFT/6GryqUnqZeCg0eZ3W/Evzu3cUTC50SF85peLfxuV7NbtiZlo7n8jX4yqL6WFe +DWeVTPp1WkODgc/JZbijERDLeai4kQAztHVaGoCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1470333017!54024273!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.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 37451 invoked from network); 4 Aug 2016 17:50:18 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-2.tower-31.messagelabs.com with SMTP; 4 Aug 2016 17:50:18 -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 9BA0428; Thu, 4 Aug 2016 10:51:40 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.218.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 047D03F387; Thu, 4 Aug 2016 10:50:16 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 4 Aug 2016 18:50:05 +0100 Message-Id: <1470333007-25178-5-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470333007-25178-1-git-send-email-julien.grall@arm.com> References: <1470333007-25178-1-git-send-email-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v3 4/6] 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 Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Stefano's reviewed-by --- 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 7206a7e..46922eb 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2467,35 +2467,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: