From patchwork Thu Jul 28 14:20:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 72958 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp880477qga; Thu, 28 Jul 2016 07:24:29 -0700 (PDT) X-Received: by 10.107.174.99 with SMTP id x96mr39136573ioe.76.1469715869693; Thu, 28 Jul 2016 07:24:29 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id r21si13332540ioe.71.2016.07.28.07.24.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jul 2016 07:24: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 1bSmB1-0007KJ-BM; Thu, 28 Jul 2016 14:20:43 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSmAz-0007Hk-Vy for xen-devel@lists.xen.org; Thu, 28 Jul 2016 14:20:42 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id FD/8A-20915-8B41A975; Thu, 28 Jul 2016 14:20:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRWlGSWpSXmKPExsVysyfVTXeHyKx wg3lXJCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oym5QeYCjaxVRw7dJ2pgXEGaxcjF4eQwCZG iTcPTrJAOKcZJXq/TwPKcHKwCWhK3Pn8iQnEFhGQlrj2+TIjSBGzQDujxNr+XmaQhLBApMSPD +cZQWwWAVWJOzdvgDXzCrhIvHx8GiwuISAncfLYZLA4J1D8Xtt3MFtIwFni9N3t7BMYuRcwMq xi1ChOLSpLLdI1NNVLKspMzyjJTczM0TU0MNbLTS0uTkxPzUlMKtZLzs/dxAj0MQMQ7GBcs93 zEKMkB5OSKG9Y6MxwIb6k/JTKjMTijPii0pzU4kOMMhwcShK8bsKzwoUEi1LTUyvSMnOAwQaT luDgURLhjQRJ8xYXJOYWZ6ZDpE4x6nIs+HF7LZMQS15+XqqUOG8uSJEASFFGaR7cCFjgX2KUl RLmZQQ6SoinILUoN7MEVf4VozgHo5Iw70aQKTyZeSVwm14BHcEEdERx7AyQI0oSEVJSDYya/S tMt/23OPuxgmuh6hqhE09Vt3ZPsfswZ+MWHdM6z6oDlgm7WR5vrNhRcqZg9nEm1U1cm76U3e6 1dHB45N380Pk0i9+8xfa9pmecfh9cqbLQ9EvMAYav1z0+1nZODW0QnqO1+OwkrrOMU3ZzWjl+ mMLUUOHwc/rs+zE+e8un1y8P0DQ/MeuLEktxRqKhFnNRcSIA8Kup93cCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1469715635!26646407!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.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 44787 invoked from network); 28 Jul 2016 14:20:40 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-11.tower-31.messagelabs.com with SMTP; 28 Jul 2016 14:20:40 -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 19202BB4; Thu, 28 Jul 2016 07:21:57 -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 DE2173F21A; Thu, 28 Jul 2016 07:20:38 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 28 Jul 2016 15:20:15 +0100 Message-Id: <1469715620-4670-11-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469715620-4670-1-git-send-email-julien.grall@arm.com> References: <1469715620-4670-1-git-send-email-julien.grall@arm.com> Cc: proskurin@sec.in.tum.de, Julien Grall , sstabellini@kernel.org, steve.capper@arm.com, wei.chen@linaro.org Subject: [Xen-devel] [PATCH v2 10/15] xen/arm: p2m: Don't need to restore the state for an idle vCPU. 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 p2m_restore_state could be called with an idle vCPU in arguments (when called by construct_dom0). However, we will never return to EL0/EL1 in this case, so it is not necessary to restore the p2m registers. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Stefano's reviewed-by --- xen/arch/arm/p2m.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 7e524fe..aff5906 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -127,6 +127,9 @@ void p2m_restore_state(struct vcpu *n) { register_t hcr; + if ( is_idle_vcpu(n) ) + return; + hcr = READ_SYSREG(HCR_EL2); WRITE_SYSREG(hcr & ~HCR_VM, HCR_EL2); isb();