From patchwork Tue Jun 5 15:23:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 137761 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1098977lji; Tue, 5 Jun 2018 08:26:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIYAX0UdeKRmwQ0RLYuZOBdWXtmOs6dtTsOqgZHfxnubSBz+aTaEXHJP5trcgqqKooi6m3q X-Received: by 2002:a6b:720d:: with SMTP id n13-v6mr27360456ioc.123.1528212367320; Tue, 05 Jun 2018 08:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528212367; cv=none; d=google.com; s=arc-20160816; b=EI0B7qtIyKUUsbc/AiaiTU7zYKhslfGQHsMi/U4JAGoJ0F0C2anaF1s9F8L4+8FS+A fM854nJbUvB53N5hpPG0+7O/5UpAuR7EhDi85NWOorIMykZvcrOCme6VAemQTmCnWd5/ O+w4c5R6XqZO8qwpJmFDZ4YAi0Nv684ph89TdzNppwD/HejeXUTEZlpQsiJpw5BQMMFp ePSjE5Znk0OTc4ASWuLBNVqpcjx2b7KgThYlU2FxAkR+JFX0CPf51kP5PNkd3s91DU1r Z80VK6087yPvZuOAwoFpBiuSrR+mHYQr67PaD2LNMLwO9k/2pJZ5HfcSmnsIWPhU4dZA u88w== 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=HWeJJsYZzcveywnZaJZDWV0Kt7rtEsUz2mYcQJIrdizxGSH94SXZnhK6jyrK9TYUzP KKVIT9gDhrTKSy1OWvHNq+6uGBFp7jxClsA/r6Sc6hMcBo1eAXIdXVYJ+IbfZ4QUYYJl rSN6Jm5s/ZEeadYsmfOnw2JNpMjcJQ5g+f+Vet6solXgz7nL4hfa0eaXu1JSI5uu29Cu qiBAMCz8r2Y4ZB8Wl2ywHtPripyxCIkaoXQv2iE0odkT7+fx96quHS8lVJv0jtVBhFPH bJ/6TkfKMMZl9X/UqydBfMDjyFJR52ESzdPzxAHnecgcBxeJwPqEYX/sY8Q7Kta0KJeY Q/fg== 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 o187-v6si1773486ito.88.2018.06.05.08.26.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 08:26:07 -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 1fQDo9-0005It-7Q; Tue, 05 Jun 2018 15:23:37 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fQDo7-0005HI-MM for xen-devel@lists.xenproject.org; Tue, 05 Jun 2018 15:23:35 +0000 X-Inumbo-ID: 18d2faf1-68d4-11e8-9728-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 18d2faf1-68d4-11e8-9728-bc764e045a96; Tue, 05 Jun 2018 17:21:19 +0200 (CEST) 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 A8EBA15AD; Tue, 5 Jun 2018 08:23:33 -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 BE66B3F557; Tue, 5 Jun 2018 08:23:32 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 5 Jun 2018 16:23:03 +0100 Message-Id: <20180605152303.14450-14-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180605152303.14450-1-julien.grall@arm.com> References: <20180605152303.14450-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v1 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); } }