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: 10001579 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 284F0602BF for ; Thu, 12 Oct 2017 10:43:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AB4628BEC for ; Thu, 12 Oct 2017 10:43:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FC7828D6D; Thu, 12 Oct 2017 10:43:28 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 06D4128BEC for ; Thu, 12 Oct 2017 10:43:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754894AbdJLKnV (ORCPT ); Thu, 12 Oct 2017 06:43:21 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:50680 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756529AbdJLKmH (ORCPT ); Thu, 12 Oct 2017 06:42:07 -0400 Received: by mail-wm0-f49.google.com with SMTP id u138so11925727wmu.5 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=uPzSzqL5ZVCXfPpuz8dmDlSpe57DKg7c/rpZ4IvJoh1zqkGF4PDah1IMH0yuXj9luw hYXkU4qdcZqzxgQuHmW5s94ZNpb4LKgZvECZeNLVOk+9osYCLJG4uVK3ZpGZM+VaAeQQ lIGbjcaZUU87707/q5VastmAVhjCBUA1sJm0sMDe0nbH5U+lPmgW3vUoOjo5MRbKs3y6 WIB/H2BMK0dsrS8ieU9csSbA2r+OTYd5DgqB0Ut/8gETSuh/8YpI0T1dzMr+JnCJyWNI r+z52Y2cj1EC+OUXU69Zx+aMUPNAtX0Y8dVyDslquSKGST+fkRCtypOwZwyNVQQ+sl3E e04w== X-Gm-Message-State: AMCzsaVODUJcpb8jyyv8nvI0gTtkHNVaquHiSPZuQhpxQJJrbbM3ToGr ZZywWVvxELdeCYkc/Huwyx7avQ== 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 Cc: kvm@vger.kernel.org, Marc Zyngier , Shih-Wei Li , Christoffer Dall 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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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); }