From patchwork Thu Oct 12 10:41:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10001635 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 8546060325 for ; Thu, 12 Oct 2017 10:50:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77B6028C7E for ; Thu, 12 Oct 2017 10:50:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CD0A28D6E; Thu, 12 Oct 2017 10:50:38 +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 D65EC28C7E for ; Thu, 12 Oct 2017 10:50:37 +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=mdqtlxPfSTxI9kLSyF8ymDxAqRmS/EQAS8CblDAT+6c=; b=XdjGpSjA32JVRKKqqPJ+uydthB 42k7tp3zaYMeDGuIcvc0COLQb3mRw7Ow/9hglAeAsW9oxoGxZTJ/o2aaZ3sZC1JDqia/hbZV8sHwR MXqi9fQ//PXbGO/RLCwvYcm31zWahsuzE/+tKwfeWvNkGT4S1jggI4ChvOqC4azdtmxMQGYrqBCHx 5ydqkDnzGFfBpAId7OBTEiZAdEKwAG+j/9Vj+cdVvpSFxX3gQ2vXDpy705Pc60xA+aO/KluQyIloU HNUPUfWEP7BDb/PVb/FeCnN8wd8mZg3+jIEHQd0/uT8Ha+zK5n8juls8c5TaERhFPLfFmndZL12dn xBVGP39Q==; 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 1e2b4B-0007jk-1a; Thu, 12 Oct 2017 10:50:15 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e2awe-0007Z9-AG for linux-arm-kernel@lists.infradead.org; Thu, 12 Oct 2017 10:42:44 +0000 Received: by mail-wm0-x230.google.com with SMTP id t69so11961395wmt.2 for ; Thu, 12 Oct 2017 03:42:07 -0700 (PDT) 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=5DeODKJ61SqVJyzKgAGHdWYSL7oT8Yr7PlEGLzpxp+Q=; b=ObNPJY+BUdCnvTH0lFM8yP0ALInq/idW9Y9HRhp25H2soBj4V8P4btNFDEXBy6/gTm Z2wYKsvMSy+l/x3WzKsn3dQNb2FUDkqsXcGAfUskeg+HGKiRJhkaL+rdSyXwgjxfgUwL qWvV54lxXrnNvOiqNx2CVUHcnr78gzgRUIf4Y= 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=5DeODKJ61SqVJyzKgAGHdWYSL7oT8Yr7PlEGLzpxp+Q=; b=bTBf6Zm99gPE3JdtqjtMur50K0lI+H25TitZyeYGlTlJ9pQDVF948tgu0U6S5UaLc9 snj90KrgiRkrh9SarUNO3dffar7yLy098kXQM4+Kn57q9rXcbGiQ+843Yoz367YqKtiv nHppBF0CMQBGK+yuL3lmWgMd8x2a6uxWl775Ar4wvQ9NiNfifiS5on65OoAWIY0A+N+g OMzASabwfTXG1G/OZLT5yf0DQ58jejCbXtBFFOJQj/FKbLe42d4qRgTvonQCjH9THyu9 tapm8WzZWdcaBYwU91bW4jbFHWc92GipGHKTqEDUY11FPHh4JJpnJqCXJLdYMykGQp8m boqA== X-Gm-Message-State: AMCzsaX1yfCzTgRTAy16etUf+kJfY863DsTogM4wn6dfiWzMTRZCKaTz aZApSockxm+4yp3Y9nMt6YuuTJq/KH0= X-Google-Smtp-Source: AOwi7QBdEEmX7CW+3WSzAaOxepySiQHsOZqG8KCVcDBfiFKBtgoFLR+be4gRXcVrZX+d/h0B817pgg== X-Received: by 10.80.161.134 with SMTP id 6mr2365496edk.197.1507804926468; Thu, 12 Oct 2017 03:42:06 -0700 (PDT) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id g49sm4798603edc.31.2017.10.12.03.42.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Oct 2017 03:42:05 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH 18/37] KVM: arm64: Rewrite sysreg alternatives to static keys Date: Thu, 12 Oct 2017 12:41:22 +0200 Message-Id: <20171012104141.26902-19-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171012104141.26902-1-christoffer.dall@linaro.org> References: <20171012104141.26902-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171012_034228_889475_141459C2 X-CRM114-Status: GOOD ( 11.79 ) 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 , 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 --- 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 193c2b0..b55c4ad 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. * @@ -73,13 +70,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); } @@ -132,13 +126,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); }