From patchwork Tue Jun 12 11:36:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 138326 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5234960lji; Tue, 12 Jun 2018 04:39:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLm5mqC5gobjDpgpW/7httJ0J2s52ttoO8i1Wd2Uil8ApUOWLAMng5HsgpaMgkZKLMT+dDu X-Received: by 2002:a6b:9156:: with SMTP id t83-v6mr31440iod.32.1528803571036; Tue, 12 Jun 2018 04:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528803571; cv=none; d=google.com; s=arc-20160816; b=QmBBYF2dPvFe745kfUQdzeupG1w8hSK4iBc6UbODSY+mClrNF4LfUVCYTlIokTXUi1 Xjsl+VlnRF7UaMl7AQ1tvgbw+9J+TObtvzhLEUwlnb8TSnJKRUTh/iAICi2r3GcqgF7S n6mPTUQ+3tC4KwwEVEP2mE3QX94GKp2F4S2GHtQ0YV8KgzuIKOITKwrSJhndcEPnIb+2 vTra+hVk8YhmpKCcW+fWhaOUCSISGuJI3xYA5xTJnWsf7sjb4HdUg4zDMo/weYy9VK/5 dOGa4gG2j4E/cPq2YJmsQF0gBSDMOAdT+zZ1pRgzhnxw7DD2CGU7XymNaBa/GekZFYnY wtYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from :arc-authentication-results; bh=smFcaeoBTL6C+7qA4zFKrSWVpBF6FtHMeKqU3+D14zc=; b=Ud7c5zT5akw8hokFStXdSka7yFEMb6BedlTPYHXQGEYrRarg1HPp0XgFkHioet+6Qc h9raWPAFClpIImcAsyNaIr9fQRri1I4BWLfae+01LA101P5icCn1sIFpPP795H1M98vE NxbvOYWpaPeSKaUHUgyER+TqAx9FRzUY/RF7k24vlY1jIohh2Fs8ljIwJEizMoWCyZlz /4ER+uVFsZLGXoXE/3y6C/zNfHDhSWCxlzU9NVGu8p9wV2+dlxDE24H9vNGwyy1Fi9vp 6Uaj7vQoELShrxbSlgXj032o/sV9CxttMg5W6+qOiRMt2uP14puK5WihDm6DeLc19ejk v82g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id j62-v6si206942ite.84.2018.06.12.04.39.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 04:39:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fShbo-0000xj-J0; Tue, 12 Jun 2018 11:37:08 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fShbm-0000vO-Qf for xen-devel@lists.xenproject.org; Tue, 12 Jun 2018 11:37:06 +0000 X-Inumbo-ID: f16d5ffc-6e34-11e8-bc1d-65256ead4e3a Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTP id f16d5ffc-6e34-11e8-bc1d-65256ead4e3a; Tue, 12 Jun 2018 11:37:10 +0000 (UTC) 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 6FA411435; Tue, 12 Jun 2018 04:37:05 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 85C3B3F318; Tue, 12 Jun 2018 04:37:04 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 12 Jun 2018 12:36:43 +0100 Message-Id: <20180612113643.32020-14-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180612113643.32020-1-julien.grall@arm.com> References: <20180612113643.32020-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v3 13/13] xen/arm: Avoid to use current everywhere in enter_hypervisor_head X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Using current is fairly expensive, so save up into a variable. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Stefano's reviewed-by --- xen/arch/arm/traps.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 315fc61f77..bde303261e 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2024,8 +2024,10 @@ static void enter_hypervisor_head(struct cpu_user_regs *regs) { if ( guest_mode(regs) ) { + struct vcpu *v = current; + /* If the guest has disabled the workaround, bring it back on. */ - if ( needs_ssbd_flip(current) ) + if ( needs_ssbd_flip(v) ) arm_smccc_1_1_smc(ARM_SMCCC_ARCH_WORKAROUND_2_FID, 1, NULL); /* @@ -2034,8 +2036,8 @@ static void enter_hypervisor_head(struct cpu_user_regs *regs) * but the crucial bit is "On taking a vSError interrupt, HCR_EL2.VSE * (alias of HCR.VA) is cleared to 0." */ - if ( current->arch.hcr_el2 & HCR_VA ) - current->arch.hcr_el2 = READ_SYSREG(HCR_EL2); + if ( v->arch.hcr_el2 & HCR_VA ) + v->arch.hcr_el2 = READ_SYSREG(HCR_EL2); #ifdef CONFIG_NEW_VGIC /* @@ -2045,11 +2047,11 @@ static void enter_hypervisor_head(struct cpu_user_regs *regs) * TODO: Investigate whether this is necessary to do on every * trap and how it can be optimised. */ - vtimer_update_irqs(current); - vcpu_update_evtchn_irq(current); + vtimer_update_irqs(v); + vcpu_update_evtchn_irq(v); #endif - vgic_sync_from_lrs(current); + vgic_sync_from_lrs(v); } }