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: 10160635 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 DE3E060327 for ; Fri, 12 Jan 2018 12:24:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5DF727968 for ; Fri, 12 Jan 2018 12:24:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAB0A289D3; Fri, 12 Jan 2018 12:24:16 +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 5E31D27968 for ; Fri, 12 Jan 2018 12:24:16 +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=4ogZaqMrMyc4Um5/osXLRr9LJJM8DL9jJ2czCrAwfTw=; b=l0cBtrHUZeDYnCUCcHt6Vy/qnr +/TtAGrnFSV8DgpA50YkhIvmtu8lg8ZI2+7gJSNdOozCnxOz6ZcDTffDJcMwAMTWmFAXdxIJoCg0o hKGLBx4fzzi/5DfY0LXuBgL3NDidgnBl9FLPz1LwwM5kwemmrh8hgFQyjlnIoeHoMhEHWM9ZgQm9c 32VHEHPlMcieTUlgz90lpNVaYEeYsUxttFFzMdaTk53FAIqAjlAkygIoDg04zLgzBs1QI95qezcsV iXs5mt0EzlgB2ftJ1G0Sg+WnR6S8bKOKm+tbsszOTkOyQTB1pBKwwNcAaAjujEiFhEsKTH7a6PYsD 0+1iAp2w==; 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 1eZyNY-0007yO-TQ; Fri, 12 Jan 2018 12:24:12 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eZy8N-0000VT-Ey for linux-arm-kernel@lists.infradead.org; Fri, 12 Jan 2018 12:08:45 +0000 Received: by mail-wm0-x241.google.com with SMTP id t8so11611162wmc.3 for ; Fri, 12 Jan 2018 04:08:21 -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=mBHULo0TACTXhqbDVS/F71ivhsWfisgwS2mTjxbe5TiluJaUEYiY0HGu3zrkiuyebV ou0q2YhiLrL8jvLJnm0K9AXbP/3kO+B47qAEByoCJ4SIWX/XgWZU7/CIHBFFK8xu9MbN bXT3lqwcKN1lyR2cGgtEMOQ95b/OZ+m849Ns/pGNSooYyYlwLiOYbNInxwBJB2FbWY1g WyMV+2o5eNsNwG5Q5GQe4h/mwshl6tSydOm+z14zdDhlEaTofaCmLYUR2OqHsdzQzsbL uvd06GMXLVg8JoBedteCPVPs6rs16/eSNfXSJJuhA+MVcq/wpzsF6JYNXlz0D56EHzxB jiYg== X-Gm-Message-State: AKGB3mKXOHKPmMo8aVBlNz0GBuJs5rTv5kupsz8K1d5N63Sek4JW9cAP +CNwbXnw9yeJSw+uGsMnyVVV5g== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180112_040831_940133_77B635A6 X-CRM114-Status: GOOD ( 11.70 ) 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. 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); }