From patchwork Thu Dec 7 17:06:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10100259 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 E213960360 for ; Thu, 7 Dec 2017 17:11:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9A0F28569 for ; Thu, 7 Dec 2017 17:11:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDCDD2858E; Thu, 7 Dec 2017 17:11:15 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 1E79828569 for ; Thu, 7 Dec 2017 17:11:15 +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=n/Almmbert5THLqKaKG36Pi76SJ4PEkNurI3R1joCQY=; b=ADUytO9/N+D46/3hmHT8AQ68AT ct8rKMNhi8v/Ax53/DwpEWlP8yPZxDO1gNpVktPlb/6JMjQB5l+QJjyTRd66l6mQoKAAZz8KVqO/7 yW2SYfz1MVUsvfjCsAHtxqKHSaM/df+XD7CSBWrAKX+LNFd7/WXExDOX+aB2pAa+j5kDK70Yu3voK EVYmwKAKYzR7RUAZoVdVLytWMNoUOSPTuRA5z0a2pLhlFJfO86p1DbNAhH9GGZJL6R8syiQwrzr3l 6i52e42lgMkJCtLoMRIUDViWvXTxq0V17NGxbogtY1rnnnd3hSGIy9/U+WqUrw+kpHlF2ck+iQ54r JUFqm2Gg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eMzhZ-0007vk-TX; Thu, 07 Dec 2017 17:11:13 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMzdu-00034o-Ko for linux-arm-kernel@lists.infradead.org; Thu, 07 Dec 2017 17:07:35 +0000 Received: by mail-wm0-x241.google.com with SMTP id f140so14078103wmd.2 for ; Thu, 07 Dec 2017 09:07:07 -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=s9iJ9o4eS+UfLfxKAeKQIglY7BKeU6FfAyAsj677fM8=; b=STONxtjjlJFcV0T6WVElUWt9vzWp60x3bAQ2rmxgDacnzv+sFCrYoSEOSM9ZGfFnBq UECkgISpyIinY/oLkhL/fPmkk6u7tn/kr9DTVle6XfBOgELmjOeAgaNJg2ZJdiczjvVG mUxCRtPgT/cZ/5ijLkPO6SSY1evbN0VXSpF5Y= 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=s9iJ9o4eS+UfLfxKAeKQIglY7BKeU6FfAyAsj677fM8=; b=uMFCiMwOcFJO8Z4g/8UOPuRwbaa6hQBWJ1Cdf2k4WqlrBvO0Zobs5VlLtE1ER04u8v HzbYgLpEi3Bcwv5kyKgc3KAiLu8VYRTWZreziNcJdNn/2EuXFR006U3tvnO4KhHvFMub eELClU2f4XqmJ1EQTKO6Z94Wm/dEUW0GwetxxDzU0dnfBAktkCaC0JcD8pFbL6IputiI qYYmid14iYuZVlJrv/YStJYKXow/pJtbNIJN/09lBcoKvvyxY72kjD9KsDnjEiKUOXlk 800KH5/ryJl8rwA3SBoQxr6LsVWUQ6fYWelTvMVzjskZGTt8QIK5X+R+BQj113kneat3 hQQA== X-Gm-Message-State: AJaThX5G/UrlPGAh8NYb2PvlIJ6iiiD3k9k+/nkEDULRauwJRdtZfy5+ gmwXSlXj8TdxB8Ero6Aev73gZA== X-Google-Smtp-Source: AGs4zMa5hN0t8bBCkpSxGUXYieDPRvEapQV/5l4oF3OzN5LbKxIiyl73J9Pctd1OUQltia2baXEA0A== X-Received: by 10.80.186.111 with SMTP id 44mr37142243eds.261.1512666426410; Thu, 07 Dec 2017 09:07:06 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id a16sm2868270edd.19.2017.12.07.09.07.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Dec 2017 09:07:05 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 16/36] KVM: arm64: Rewrite sysreg alternatives to static keys Date: Thu, 7 Dec 2017 18:06:10 +0100 Message-Id: <20171207170630.592-17-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171207170630.592-1-christoffer.dall@linaro.org> References: <20171207170630.592-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171207_090727_363938_FE79DEF1 X-CRM114-Status: GOOD ( 11.80 ) 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: Marc Zyngier , Andrew Jones , Christoffer Dall , Shih-Wei Li , kvm@vger.kernel.org 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. Signed-off-by: Christoffer Dall Acked-by: Marc Zyngier --- 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 bbfb4d01af88..e747f2fd31be 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); }