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: 10244957 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 B153360211 for ; Tue, 27 Feb 2018 11:47:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3A312872D for ; Tue, 27 Feb 2018 11:47:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97F4728735; Tue, 27 Feb 2018 11:47:46 +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=unavailable 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 216AB2872D for ; Tue, 27 Feb 2018 11:47:46 +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=knPK6epQTVji9FbJX3SOrtBkVFzFx60ZVRMhaMgPmy0=; b=pFWT/rKt39ewLRPhR6tEx33fKM Yul5HzF0isOykDKwxLltEeOYnmdYL+ca+hLbDHhDPZBYTPNNIe77YWlxusXTwsH3sFIG5tCnIfmGe ZjPLMwr4HZH8C7LDOY+2kgVTaFqY79uKb7LxgZ4LyVJtxkV3lVqQrHn2uzPCmU6B7NGRsCUzkuDTu znk28aU2jbo6JmfWHW8NC3GD2oAN9ZnYrldJfs2q8CCp2LmEXJuYvs6AVLcAOsfyaePGFX++uhOoK CYkWVlMPn8J0lkS0sxo6gC2u0NjWp1Tv8vrQhyp8MjSQnTAH9J1FnLr+R3BdNtiwx3UY0LXkAXp4h OonEfcZw==; 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 1eqdjN-0000Ix-Ou; Tue, 27 Feb 2018 11:47:37 +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 1eqdXF-0006f3-7W for linux-arm-kernel@lists.infradead.org; Tue, 27 Feb 2018 11:35:25 +0000 Received: by mail-wm0-x242.google.com with SMTP id t3so23399925wmc.2 for ; Tue, 27 Feb 2018 03:34:59 -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=kvpNMdNvpmdo/b+5tdWduc5FR/HDby21hNma25lmLmyHoaReidvSOe+eB5ryPhmrvd 3M0yQ+KXB3r1nndDPDVTGkcz4CxB2VrKejokm5Lp4wc9xUhkK5W4BjBjcX3ADBKsLy0b j3M6QuiAyrhnEKoHSfobsUmf275A3GB/EliVbY+ngbZIohFxR5ij/Dsnx23qi4i/KfWD qXBmiL3VSZFe0yCbhvxfNqYj2Ir0iWMP4gy6+qDzoPJV0XDrYlURn7rosQFWqC0/TFA2 6yPBGJHY0VnGFOjxKjYuBzNjCmd+yNhDzJwAS6PuyvfITs8R13t9VK91Qb7ZKQW5qPU0 zANA== X-Gm-Message-State: APf1xPBmi9HHD7KBdRq3tK6iZ6bRP3da8AvC7KZsXA3bxRkmzFdiEt1T lycP4rWgRvi+HHBcnFRnfrjTDPIGJOc= 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180227_033506_056038_88B42415 X-CRM114-Status: GOOD ( 13.37 ) 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 , 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 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); }