From patchwork Thu Aug 20 10:34:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Scull X-Patchwork-Id: 11726007 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D927B17C5 for ; Thu, 20 Aug 2020 10:35:44 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AA92D20639 for ; Thu, 20 Aug 2020 10:35:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Lm0RIvGC"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="svS4aSTW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA92D20639 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=n51tnOUAbAQhnE0YgFuyaLlofIAtLaloZ6TyTKDks3g=; b=Lm0RIvGCx/YU9SHnK7jL20JCl LnyvBwB3ZzP3BW8y39Q99xus650SJgsJqjFWmtzr3Vup5tVyWQo6H/9ps/fqFCELXUrDTJuU+IB8B XM8cUI9jA0dKyUVYz1f++paEy/fclAM6KHQxPxwc3nQUO8N2KbkvDUcxO/zWB1WS/Gbddvagl2O74 p+HhN/FlVy6VUpzF6ARHbs+7zzbuD+F4Dla/KG0evB63ijB7KrrXoW9uqh5f2zo9bbdr7NHRSeckj pWaJ4aLBnfH7ByCGD4K9LQda5oG+DMILoU1fWizgHjOD6ObmLbkk3BPCQ7yrPHEHF5W8Qn7rTlg8c axByqRilQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8hus-0001z1-Dt; Thu, 20 Aug 2020 10:35:30 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8huo-0001xT-5S for linux-arm-kernel@lists.infradead.org; Thu, 20 Aug 2020 10:35:27 +0000 Received: by mail-yb1-xb49.google.com with SMTP id n19so1846014ybf.0 for ; Thu, 20 Aug 2020 03:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=HYWwnaxxN9FJeVd5cnyIhTlJLg1bqv4TtHfD3U0RlXs=; b=svS4aSTW4PpT7iw+VQyZ1+qUl5GF34lMx8mgpWm/FIcXopzSZVkRyVBaiXS+OVT59C aGrxUS22s1Xx1Jw+jHR2ONIsp04jUPnucFBy5vMq/c+/LMODP5IS9dqfHw/UY3Ja1bTO /tMOy41QXvgt9i3123BZGxKykQ6MqDzhixhhuy0L0dhsEZkfRVeSS8jl0JZFyEDrjZdc QoY0FQwEmvXF1C361lJJ7bk44EnFjiUS+TpcbHnhX2wUk8QS8zo4gfF5YNXB4DwPCC9p gZUkB9RRxx0Xw5rZO9ZMFO24n/OZijeMxmZCl5i+ANZwxnvfYzUeF3SC53cZxclyqFg4 FSOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=HYWwnaxxN9FJeVd5cnyIhTlJLg1bqv4TtHfD3U0RlXs=; b=ZAuWY+lgTEujO+Eap1J/tn5Y1Dluw+3JPVF/+ttMP4tlTue3TUB8kN+KSwH3sfosmb hltCro/arBWWbqLCdJe3m5bjYRahzaen4QaqQK4aGxNO9RFxuOMfXBBNT7gL829T8XtT qMzxoKFVUa4vi5HiRQ9YMr1nxtwTlebERihe46aPZWBFqKkDUi9e+XLpWsdpVnmmd6rW eA5Yvq2yxwKz5wSLRuGihp3cTxGVZfMjJ0v90VNxyem72la8TRNe51bvF+3SdUOXggGO Om72EGshIino+00ryRiOUPB8hrAQwYKLcml8UDZrXiO+EBBxj/aKirKmO+AXir1nA9lI QqVQ== X-Gm-Message-State: AOAM532V65PL0Dzq8AYRSx2Dc+R53KXF/He12ISn6/s076AD7Xu3fh5e TliXS/Z0+2R7SuQBzu1ZmSMzkeGBFrg= X-Google-Smtp-Source: ABdhPJxLn2z0cBy11YDIYFTd9OIYnRwhQlbqitdefWbhHlYAbLRzYH4IboahCiHc9HaQFEgmqJAQXZbSPu4= X-Received: from ascull.lon.corp.google.com ([2a00:79e0:d:109:4a0f:cfff:fe4a:6363]) (user=ascull job=sendgmr) by 2002:a25:f20d:: with SMTP id i13mr3686021ybe.152.1597919722311; Thu, 20 Aug 2020 03:35:22 -0700 (PDT) Date: Thu, 20 Aug 2020 11:34:27 +0100 In-Reply-To: <20200820103446.959000-1-ascull@google.com> Message-Id: <20200820103446.959000-2-ascull@google.com> Mime-Version: 1.0 References: <20200820103446.959000-1-ascull@google.com> X-Mailer: git-send-email 2.28.0.220.ged08abb693-goog Subject: [PATCH v2 01/20] KVM: arm64: Remove __activate_vm wrapper From: Andrew Scull To: kvmarm@lists.cs.columbia.edu X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200820_063526_264230_261870A0 X-CRM114-Status: GOOD ( 12.58 ) X-Spam-Score: -7.7 (-------) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-7.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:b49 listed in] [list.dnswl.org] -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 DKIMWL_WL_MED DKIMwl.org - Medium sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, kernel-team@android.com, suzuki.poulose@arm.com, maz@kernel.org, Sudeep Holla , james.morse@arm.com, Andrew Scull , catalin.marinas@arm.com, will@kernel.org, julien.thierry.kdev@gmail.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The __activate_vm wrapper serves no useful function and has a misleading name as it simply calls __load_guest_stage2 and does not touch HCR_EL2.VM so remove it. Also rename __deactivate_vm to __load_host_stage2 to match naming pattern. Signed-off-by: Andrew Scull --- arch/arm64/kvm/hyp/include/hyp/switch.h | 5 ----- arch/arm64/kvm/hyp/nvhe/switch.c | 8 ++++---- arch/arm64/kvm/hyp/vhe/switch.c | 10 +++++----- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h index 426ef65601dd..d07777d857a3 100644 --- a/arch/arm64/kvm/hyp/include/hyp/switch.h +++ b/arch/arm64/kvm/hyp/include/hyp/switch.h @@ -122,11 +122,6 @@ static inline void ___deactivate_traps(struct kvm_vcpu *vcpu) } } -static inline void __activate_vm(struct kvm_s2_mmu *mmu) -{ - __load_guest_stage2(mmu); -} - static inline bool __translate_far_to_hpfar(u64 far, u64 *hpfar) { u64 par, tmp; diff --git a/arch/arm64/kvm/hyp/nvhe/switch.c b/arch/arm64/kvm/hyp/nvhe/switch.c index 341be2f2f312..2940d220096d 100644 --- a/arch/arm64/kvm/hyp/nvhe/switch.c +++ b/arch/arm64/kvm/hyp/nvhe/switch.c @@ -93,7 +93,7 @@ static void __deactivate_traps(struct kvm_vcpu *vcpu) write_sysreg(CPTR_EL2_DEFAULT, cptr_el2); } -static void __deactivate_vm(struct kvm_vcpu *vcpu) +static void __load_host_stage2(void) { write_sysreg(0, vttbr_el2); } @@ -194,7 +194,7 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu) __sysreg32_restore_state(vcpu); __sysreg_restore_state_nvhe(guest_ctxt); - __activate_vm(kern_hyp_va(vcpu->arch.hw_mmu)); + __load_guest_stage2(kern_hyp_va(vcpu->arch.hw_mmu)); __activate_traps(vcpu); __hyp_vgic_restore_state(vcpu); @@ -219,7 +219,7 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu) __hyp_vgic_save_state(vcpu); __deactivate_traps(vcpu); - __deactivate_vm(vcpu); + __load_host_stage2(); __sysreg_restore_state_nvhe(host_ctxt); @@ -253,7 +253,7 @@ void __noreturn hyp_panic(struct kvm_cpu_context *host_ctxt) if (read_sysreg(vttbr_el2)) { __timer_disable_traps(vcpu); __deactivate_traps(vcpu); - __deactivate_vm(vcpu); + __load_host_stage2(); __sysreg_restore_state_nvhe(host_ctxt); } diff --git a/arch/arm64/kvm/hyp/vhe/switch.c b/arch/arm64/kvm/hyp/vhe/switch.c index c52d714e0d75..30bb76066cc0 100644 --- a/arch/arm64/kvm/hyp/vhe/switch.c +++ b/arch/arm64/kvm/hyp/vhe/switch.c @@ -120,12 +120,12 @@ static int __kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) * HCR_EL2.TGE. * * We have already configured the guest's stage 1 translation in - * kvm_vcpu_load_sysregs_vhe above. We must now call __activate_vm - * before __activate_traps, because __activate_vm configures - * stage 2 translation, and __activate_traps clear HCR_EL2.TGE - * (among other things). + * kvm_vcpu_load_sysregs_vhe above. We must now call + * __load_guest_stage2 before __activate_traps, because + * __load_guest_stage2 configures stage 2 translation, and + * __activate_traps clear HCR_EL2.TGE (among other things). */ - __activate_vm(vcpu->arch.hw_mmu); + __load_guest_stage2(vcpu->arch.hw_mmu); __activate_traps(vcpu); sysreg_restore_guest_state_vhe(guest_ctxt);