From patchwork Fri Jan 12 12:07:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10160461 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 7BD85602D8 for ; Fri, 12 Jan 2018 12:09:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 604E428518 for ; Fri, 12 Jan 2018 12:09:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54A98289CD; Fri, 12 Jan 2018 12:09:32 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB20528518 for ; Fri, 12 Jan 2018 12:09:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933652AbeALMJa (ORCPT ); Fri, 12 Jan 2018 07:09:30 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:41702 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933573AbeALMIV (ORCPT ); Fri, 12 Jan 2018 07:08:21 -0500 Received: by mail-wm0-f66.google.com with SMTP id g75so11737747wme.0 for ; Fri, 12 Jan 2018 04:08:20 -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=RZCkkBQNzm4b0G0T+kspVA5uf0ZhEFbbUmsWssAwArg=; b=Sw6OgWZezROyos3KgcTgRMp3iDdsjxoAb6tDbjXR2G1pRS6SH0/MPOkJjFCsWlwRKt wIepu4LX3c62bRLujNbpZpQ8M6iol/c2L8B1djRs2PhHMhtw5EQtLOWlFa/8AUo8bUy4 xxIp4hPg2cb9l0VU2qLm05nxrapZreWXLMwoc= 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=RZCkkBQNzm4b0G0T+kspVA5uf0ZhEFbbUmsWssAwArg=; b=lkixBq6R4DzqUNog7EOSdlpTsOIOxGQCWS2d7eSYiyLQ6RsvTz6ZM6D7CiZSAoOFIy yWcPdmm46oJ1po5TL0DmuFwZAAC+0JKn+v2LcouBOG5Arnxl7xm1W7Jvur3qMu39CjFk yoVtqCZlMr3qU8lHNmnQ6w3b0buT6+Nytdq4o7Si3AOXa0LYSMGnR/y/FIOKWL6JDBQ7 dNW2F58Y+aG3T1DKu0Q/5MoqEamjrdSu0PJLT1VxAVwp22GszKxEQGxoo120oXZgZehy 6wCXM5rdx5BS274QWRw7sYLRC7esTKBmJYLa4B1V0P4sIsDcB1SpaTqs1B0R9prN88Vf mJuA== X-Gm-Message-State: AKGB3mLBSfKH4EmZGcXs84TdgzbM9+Bpj/y/ugATRGVSmjjp+LMGNdOV CF8Hj3Zb43dRUy8wP7A0P2RTyw== X-Google-Smtp-Source: ACJfBot2laGpGnqEUJ6sHFUvOpTx/k5m1sUDmgiyJHdr/8/+bGXaXVLFWMQui6kiGH2NkYbL9WNKGA== X-Received: by 10.80.157.6 with SMTP id v6mr35219038ede.123.1515758900064; Fri, 12 Jan 2018 04:08:20 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id f16sm13489705edj.65.2018.01.12.04.08.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jan 2018 04:08:19 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: kvm@vger.kernel.org, Marc Zyngier , Shih-Wei Li , Andrew Jones , Christoffer Dall Subject: [PATCH v3 19/41] KVM: arm64: Rewrite sysreg alternatives to static keys Date: Fri, 12 Jan 2018 13:07:25 +0100 Message-Id: <20180112120747.27999-20-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180112120747.27999-1-christoffer.dall@linaro.org> References: <20180112120747.27999-1-christoffer.dall@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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 --- 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 99dd50ce483b..72cdbc1f678b 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. * @@ -78,13 +75,10 @@ static void __hyp_text __sysreg_save_el1_state(struct kvm_cpu_context *ctxt) ctxt->gp_regs.regs.pstate = read_sysreg_el2(spsr); } -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); } @@ -142,13 +136,10 @@ static void __hyp_text __sysreg_restore_el1_state(struct kvm_cpu_context *ctxt) write_sysreg_el2(ctxt->gp_regs.regs.pstate, spsr); } -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); }