From patchwork Tue Feb 27 11:34:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10244845 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 C7C1360208 for ; Tue, 27 Feb 2018 11:35:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC9D828833 for ; Tue, 27 Feb 2018 11:35:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0F1F28841; Tue, 27 Feb 2018 11:35:05 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 4DA4828833 for ; Tue, 27 Feb 2018 11:35:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752793AbeB0LfD (ORCPT ); Tue, 27 Feb 2018 06:35:03 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:55745 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932111AbeB0Le6 (ORCPT ); Tue, 27 Feb 2018 06:34:58 -0500 Received: by mail-wm0-f65.google.com with SMTP id q83so23500862wme.5 for ; Tue, 27 Feb 2018 03:34:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=christofferdall-dk.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=SASAGCVN7bzvTx12GLMfpEkdS8LNJspbd/30hJaxoGM=; b=IwYYcrUtIVBjcgsIDQLHNYjYI2ywQH9oMeQoZcWsRr3eGLNVDMhfwBw5BnxsH1MJer eLgFy8Cd5dUP5DXghrTcnFJ4OYzmaPWwZAi5GaBMzwGRoAcoHGNbbejYh/FHwUyEfS0s x6zcMiNkvjR0KY0sX4+fcPNX9XRn6UJPpVkavhaFAncpPYlA1blO3muBlxGdvETdYThh 6qPI0g17T9z/EL0ozQ18iSBIuegQGDM2oKgI/6z+g2tLA7ql76Myex/DH7z7tg8d/hyq VpzJy0uRh6zhSck6Cbr7JhKdOnflWJK6/45hDuScQyJ61KpwHkv3ZqEOLyzsSPUMlG6e 94EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=SASAGCVN7bzvTx12GLMfpEkdS8LNJspbd/30hJaxoGM=; b=WqFH0kYogkx8vVW6+HeTUSRP+6p4KHtYwz95y1koI2FS+09LEXgZk7O/vtxw0S+Hgs C7QmwpdBFFW+DpGPKIac0d4YX2hYgHNZqHp7O9LGXvdKjf+YcMQlzDoZKACH2AjbXcjV 5gAIEPzLVfar92Zjmxw10vwX621XZN2G0yfiptimdeldhSSPyHo0R8d/D7cHCa4UrCfG sZHuO1N199LUXaoGxDgUhLChyXz5qZ/u9ILQF1VlMnz+UAaWhiMxX6CtNljjOhjE3dMA jQhQaWGUXwSmAEzTALpTe965966jR6Z+PJ2/PGC7i6U28sOAuAvOUjfe7j783oKDIJjQ lvSA== X-Gm-Message-State: APf1xPBItIiywsw3zgveuCSFxQy6U4y0uAyTDnO/uUnh6wz/aOY0haZ1 DzITP3utcZnpvVa/kDAdwMtEQw== X-Google-Smtp-Source: AH8x227MH2AoVkaW08tl7iRvMAc8k+4ikP6pl++y6bLVs3Y03atygHd8V2dbb6pCagoVNLMeUwGAHA== X-Received: by 10.80.184.58 with SMTP id j55mr18735573ede.45.1519731297677; Tue, 27 Feb 2018 03:34:57 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id m1sm9176786ede.39.2018.02.27.03.34.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Feb 2018 03:34:56 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: kvm@vger.kernel.org, Marc Zyngier , Andrew Jones , Shih-Wei Li , Dave Martin , Julien Grall , Tomasz Nowicki , Yury Norov Subject: [PATCH v5 18/40] KVM: arm64: Rewrite sysreg alternatives to static keys Date: Tue, 27 Feb 2018 12:34:07 +0100 Message-Id: <20180227113429.637-19-cdall@kernel.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180227113429.637-1-cdall@kernel.org> References: <20180227113429.637-1-cdall@kernel.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Christoffer Dall 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 Reviewed-by: Andrew Jones 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 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); }