From patchwork Tue May 22 17:42:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 136593 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1929523lji; Tue, 22 May 2018 10:45:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrqwV6ERzmtJv4chSzCcWgCvHd7jbpKm053fA1sRUbc+PqQ3I7mBF+vvARyWq0Ho9fVSx3z X-Received: by 2002:a6b:8f09:: with SMTP id r9-v6mr805478iod.233.1527011147133; Tue, 22 May 2018 10:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527011147; cv=none; d=google.com; s=arc-20160816; b=VKRDD4Mi5Y33nf2VLQzI7ennN7L2nSPiljRb064Ku2bJLoY5YqUbeH/NggoFmixKno vBLqLeS7ZXg5tw4AOonI94fQc4uGpxpyZIoFWmPTgS0R5XZ9eUI9KOQ249ANcF1d4DW/ h1fUOvrMns218wO5S23Z7gtyuSPpORJUsBLt8T0nm9gq9Jh/uLzcj3h13Wd60uBStcoX eOOAY3AlpW3lSlMuxPMYbSNAxadzHRAfFpQ917DT4XCKvhGNcjjAuOd1KHPHvFkEIbuY bFjRp49h2k92ducupPMG5R5IPTubKtlqAlE8euVnqkf276bPhIr4zYQgsAUlFh17jhnT a/Kw== 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=XZAYCZWnRZ9Zb91oVybHRCN5/Ar+8bwA84Gf0smOKLA=; b=tx6NnBuKugTQeyUEJYuYyBSYwc7KlW76ocX8lBsvXeHwzanJ1C7VqjESE0Twtp8g9J LPwne/JEw6mVnR2NTT19qC2Eht62YbniQTLumu5XCLDpzDz1+gShWGuVccbUAchBj6Hm IeQrfil88/qRIzrzxhS2r2ZX7TxQxEktnQInn/5mkaFXy2JbHDBQ/5XwHdrE84Xh+11T 4cJPWiKNOM1bGaSDAuOG1Q9AFAlRVArqedJyseD3JzpX2gqVRsWoVr0JC4kCzqHEL2Go 5QpLJbBYqCVVqT/348nJ7QrT5hSuIUbweHmXp/SIIYVOA9mr5u4yLAhdyL8n+Z4PHw77 rFUQ== 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 a130-v6si359864ita.84.2018.05.22.10.45.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 May 2018 10:45:47 -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 1fLBJh-0002Hc-H3; Tue, 22 May 2018 17:43:21 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fLBJf-0002FP-SP for xen-devel@lists.xenproject.org; Tue, 22 May 2018 17:43:19 +0000 X-Inumbo-ID: 5a04e1b7-5de7-11e8-9728-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 5a04e1b7-5de7-11e8-9728-bc764e045a96; Tue, 22 May 2018 19:41:26 +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 227E21435; Tue, 22 May 2018 10:43:19 -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 384563F589; Tue, 22 May 2018 10:43:18 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 22 May 2018 18:42:54 +0100 Message-Id: <20180522174254.27551-14-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180522174254.27551-1-julien.grall@arm.com> References: <20180522174254.27551-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 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 --- 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 020b0b8eef..b1546f6907 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); } }