From patchwork Thu Feb 15 21:03:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10223671 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B9E51602CB for ; Thu, 15 Feb 2018 21:18:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A990329482 for ; Thu, 15 Feb 2018 21:18:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DAEB294F9; Thu, 15 Feb 2018 21:18:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EE6B629482 for ; Thu, 15 Feb 2018 21:18:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Xf8E6LBwLDEHZQtZf7Y34hgDULyRLs1mmFqiUnog1Hs=; b=fTEKXU+2JnPMxUoQT21IJMYFr4 IRMEg7NCWGRt5NPTNAC13rz3PVOyu/2D+qyRUR61A246rZpPFRyWPdqMdkgRaR8cUMMY7Cw6uc+vI oaj/bJAf6s9BA7NT3ElqPzekweaGduANJ+IP15bFkn04+DVEqO4LgJbglN4wneTk2IbYBVjNwgvIN ue5E/2Q2dmrKgSOBlSNrCeivfMDOwtETbF6XO0SaESBOE1tXhldOAwPmDNYjop4R1Weu+ZSxX2WUu XRx3mgefSE+vqb1KiHjFCk/rsHNSEtIzSIl+jb8JpRjN/amYAMEFA6nh3W7IXQ4UfGqPbBDDrYhtQ zwxR6byg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1emQvK-0004kK-Ns; Thu, 15 Feb 2018 21:18:34 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1emQhW-0000E0-A7 for linux-arm-kernel@lists.infradead.org; Thu, 15 Feb 2018 21:05:02 +0000 Received: by mail-wm0-x242.google.com with SMTP id b21so3308693wme.4 for ; Thu, 15 Feb 2018 13:04:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GA1XNbDp6SuMP7HPqAlOVxTjugKsGqyOy5HaFPEn7jk=; b=Unisd9G6AkJxD8ESsBdIziHd1DCFh+1Vp6jqFwGc6TtUmWrBsiAM7TesHV6AIUfQw7 ts/QyYewrmYeqhiQxPiSAoFbA7Gtj+bUQw7G6Jl0WQ+Sqkq6wx9jfXSDiTLPDbLB+hix LaBYtn9qE5OjE8Vv9fhqNY0+xvGQLcozQ5xSI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GA1XNbDp6SuMP7HPqAlOVxTjugKsGqyOy5HaFPEn7jk=; b=cOtsvcMuV87WeRRLK9D4d6xW87WOAYc+mp99m1VhKpBe6PlIcXE+3CmHgZaCwDw7I7 8pdUZSEurULRs7/p8OL9kSkqO7qo1XvPD756n/e96fdDFII92AC/rSq7mDROMuHo+A8g Dwv+iVCn5+tjW469dIdzBSvjFOySUR7yzIQfWwpng8O2/Up93hOc48kzNsXhiefiVoXz uV/9MXoxOjiJcrb0X5tD1uIgi+1IiFyRknk8FWMDnGQwQ0LmYELE7/WeaRj2qdnFEU2d 4hQCEVFklwv9Xcy3GlRQkH+NnU+ufaxiooR1FpoiE3RQ9W4p0S3LlS62bxIzuBOwQEpy R7jg== X-Gm-Message-State: APf1xPAIpbR4BO7lK9qyCy7zXj2lkhtQH/xT6CTEizuoz9neWvcTmIYv Cwo/LiqFC8DjJu1x+gkNV4CxqA== X-Google-Smtp-Source: AH8x227s7j9/2XoMSk5QG4Kt8tD8QMX2X68w9yPv4vMC0TDu1RnLicEj4R5BayZR/dnS5PaK35ufgA== X-Received: by 10.80.161.5 with SMTP id 5mr5033157edj.65.1518728654338; Thu, 15 Feb 2018 13:04:14 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id p55sm8220030edc.15.2018.02.15.13.04.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Feb 2018 13:04:13 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 18/40] KVM: arm64: Rewrite sysreg alternatives to static keys Date: Thu, 15 Feb 2018 22:03:10 +0100 Message-Id: <20180215210332.8648-19-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180215210332.8648-1-christoffer.dall@linaro.org> References: <20180215210332.8648-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180215_130419_099792_BA239280 X-CRM114-Status: GOOD ( 12.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jones , kvm@vger.kernel.org, Marc Zyngier , Tomasz Nowicki , Julien Grall , Yury Norov , Christoffer Dall , Dave Martin , Shih-Wei Li MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP As we are about to move calls around in the sysreg save/restore logic, let's first rewrite the alternative function callers, because it is going to make the next patches much easier to read. Acked-by: Marc Zyngier Signed-off-by: Christoffer Dall Reviewed-by: Andrew Jones --- arch/arm64/kvm/hyp/sysreg-sr.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/arch/arm64/kvm/hyp/sysreg-sr.c b/arch/arm64/kvm/hyp/sysreg-sr.c index d5a5145b4e7c..51b557226170 100644 --- a/arch/arm64/kvm/hyp/sysreg-sr.c +++ b/arch/arm64/kvm/hyp/sysreg-sr.c @@ -22,9 +22,6 @@ #include #include -/* Yes, this does nothing, on purpose */ -static void __hyp_text __sysreg_do_nothing(struct kvm_cpu_context *ctxt) { } - /* * Non-VHE: Both host and guest must save everything. * @@ -81,13 +78,10 @@ static void __hyp_text __sysreg_save_el1_state(struct kvm_cpu_context *ctxt) ctxt->sys_regs[DISR_EL1] = read_sysreg_s(SYS_VDISR_EL2); } -static hyp_alternate_select(__sysreg_call_save_host_state, - __sysreg_save_el1_state, __sysreg_do_nothing, - ARM64_HAS_VIRT_HOST_EXTN); - void __hyp_text __sysreg_save_host_state(struct kvm_cpu_context *ctxt) { - __sysreg_call_save_host_state()(ctxt); + if (!has_vhe()) + __sysreg_save_el1_state(ctxt); __sysreg_save_common_state(ctxt); __sysreg_save_user_state(ctxt); } @@ -148,13 +142,10 @@ static void __hyp_text __sysreg_restore_el1_state(struct kvm_cpu_context *ctxt) write_sysreg_s(ctxt->sys_regs[DISR_EL1], SYS_VDISR_EL2); } -static hyp_alternate_select(__sysreg_call_restore_host_state, - __sysreg_restore_el1_state, __sysreg_do_nothing, - ARM64_HAS_VIRT_HOST_EXTN); - void __hyp_text __sysreg_restore_host_state(struct kvm_cpu_context *ctxt) { - __sysreg_call_restore_host_state()(ctxt); + if (!has_vhe()) + __sysreg_restore_el1_state(ctxt); __sysreg_restore_common_state(ctxt); __sysreg_restore_user_state(ctxt); }