From patchwork Thu Sep 3 13:52:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Scull X-Patchwork-Id: 11753647 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 552CA618 for ; Thu, 3 Sep 2020 13:54:58 +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 27E00208C7 for ; Thu, 3 Sep 2020 13:54:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SWazNGjD"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="Wj17iHI2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27E00208C7 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=QP1NKfTSpZOw4jDij+uA3IN9Q+wJ7CQfXjmcHL4DrZo=; b=SWazNGjDj/ksFjDE3dBl16zyX GfDrV5PWLHguL7EMbAhqhUI7g6LnuE+nMkT4SdxmUUZs7W9hy8RWKbNE1y/UvPqmHIObSWsf9edNK lNm+R7inopnEKqR1LZGWawiS9pMlTN+dq9c8MSXrHF0xczyO3lrGQkFc/T9YvKJnh0cTBfV8D/aVs CaZDH69xG2Au6yvIysG162jmrs7WaTAEhFNLkYkUD+Lsc2hjZ4Noxnnvgq29Y9TjLvvqO8D3v7sTb oMmK6JWJ7uhDovrjy4M/5CsZrMZVxwZdl7wHmf6v6W2NiMgjkcCfA5NPH4WcKdXmM/LOSahssPKQa edgYDrL7g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDpg2-0001vc-9e; Thu, 03 Sep 2020 13:53:22 +0000 Received: from mail-wr1-x449.google.com ([2a00:1450:4864:20::449]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDpfx-0001tN-HT for linux-arm-kernel@lists.infradead.org; Thu, 03 Sep 2020 13:53:18 +0000 Received: by mail-wr1-x449.google.com with SMTP id 33so1122011wre.0 for ; Thu, 03 Sep 2020 06:53:15 -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=BnMJBgJiDhVxiUGYUS5SOi8paRTmIE3UJRbLhmkSw7w=; b=Wj17iHI2FFBQ+/FbnuZRtQYRpHDe5aImOg9FRfWHF4F4b7q4Qouw9lyqJinF9gfyWn B4p1G/hn0qdFVt5QtLRH/xcAjGFE9tke2Z/v+39+kIsTzJT6pjqJ7KXAtSSHBDT/yXWh A0o3PMWT4DZaMO8B6RgE9G5+MYfzAScP2ERVJXldYvQAz9WK/duVx4XhULmCML0D9lbp uj+CrYODJz99oUf8s45+w/1rICYIQlwNSVH8Fvhr2eSrMGCSO0JCC26Zad0sv6vwTCph FockXREocolFDcHpqJy0+yatrCJ+yjBqMIBjMHoGe0Ssw9VN2OR1RRN5v8Or5LomAs3H qoZA== 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=BnMJBgJiDhVxiUGYUS5SOi8paRTmIE3UJRbLhmkSw7w=; b=gfqKhrr62OegPkhWajqIgGPNUX6Iy0NkUpcMzKOL0pvroIXi+FPI5bTmbgHfrDPKRQ 0VQ1svODngr/+/ljwLzX3DEoh9eWdhGvsac2ShhCGt5gyHmlY7vwrjz0oMzEzu13BurV kfw91PQOTMnAyBnVTbwT/UJgpF8ta//lggtm8I+odKAbts/3zCPxXq5adBT7pz/DdbvA xEVuXhftSRHOrhElEEi5B/R6suPB8q42KRZRFX4Pcf7HipPDqomX+x+WhRH/zEtlKR7h MZyD3vIFadngaoMvrtVz5aKSMBFj7kqX5qhFwLEIQOOjXGZ36/5W4eVyDYQrtrzvBTWg XIxw== X-Gm-Message-State: AOAM530KUIrFTpXkdY0jfB9meBWJdVknd9k7Z55T9s4c8qunJ4Tzd5Lf SvyQ2SSCWm7YtFLggaIOuD00sVhkELU= X-Google-Smtp-Source: ABdhPJx1b8IwK+r2Pkar5vpwz0NAjhOUWL9h65XWXzWZBmyUP/ImLysk1/0DgwOZon/9BXbR8piMQpCeTdA= X-Received: from ascull.lon.corp.google.com ([2a00:79e0:d:109:4a0f:cfff:fe4a:6363]) (user=ascull job=sendgmr) by 2002:a7b:c019:: with SMTP id c25mr720374wmb.0.1599141193462; Thu, 03 Sep 2020 06:53:13 -0700 (PDT) Date: Thu, 3 Sep 2020 14:52:50 +0100 In-Reply-To: <20200903135307.251331-1-ascull@google.com> Message-Id: <20200903135307.251331-2-ascull@google.com> Mime-Version: 1.0 References: <20200903135307.251331-1-ascull@google.com> X-Mailer: git-send-email 2.28.0.402.g5ffc5be6b7-goog Subject: [PATCH v3 01/18] 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-20200903_095317_632086_70E73CBA X-CRM114-Status: GOOD ( 12.80 ) X-Spam-Score: -8.2 (--------) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-8.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:449 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -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.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.5 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 5b6b8fa00f0a..0864f88bc840 100644 --- a/arch/arm64/kvm/hyp/include/hyp/switch.h +++ b/arch/arm64/kvm/hyp/include/hyp/switch.h @@ -126,11 +126,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 0970442d2dbc..3c9c065b3264 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 c1da4f86ccac..6636522a8529 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);