From patchwork Tue Sep 15 10:46:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Scull X-Patchwork-Id: 11776277 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 60CE9618 for ; Tue, 15 Sep 2020 12:01:59 +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 2DFDE21D43 for ; Tue, 15 Sep 2020 12:01:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NtRqjrb9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="K9Fho3aA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DFDE21D43 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=GF3tngLd0FDOJeGc9fdcDQc4ya9fIIqK26MPvoBcv8I=; b=NtRqjrb9HEolb2yiZqjjDWWVW h44cbsuQo8VVC/gGDgfsEaIYQrS2F0OElx/ZRbGFYNWVv8x1i1EPdc0p1gI5gfY1nG862UGKAKmG7 +D9TsjgrFdxJcuJIeRCuSeyXsUtIOcyYbGRhxRRkR+lZSZniyPcsYsYVjXUr+P/TtnGeP/m0mGIir sLEZNeRWxpyldMZbhyXDQaYf/KqI0Opiz9eyYZ8MpJMA3d1ENfMZf29fxfmwaANTsBRLgeyyXkaCn +fRvGnAQcojg+mmA4AibNmNkkwSNIU4xU/wVtKtL43CCzCTM3jErRPj2HG1e1yIv8PDxIpIk5xUoJ Hn2sL6nkg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kI9dV-0004nK-5f; Tue, 15 Sep 2020 12:00:37 +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 1kI8UA-0000l0-UD for linux-arm-kernel@lists.infradead.org; Tue, 15 Sep 2020 10:46:56 +0000 Received: by mail-wr1-x449.google.com with SMTP id v5so1054478wrs.17 for ; Tue, 15 Sep 2020 03:46:51 -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=FtRrF3HJrkl6Kgil9FQQ7n4eux/aw8pbY+vMb70E3yg=; b=K9Fho3aA3AC8h2JWZlbTqFriptK7K6CovKcqq8pV9agNThHbP5wM2/H/P5B6m6sFCn HALw8A768wgiih0RDN9VPTiUSP8GhmZmrsgEc8ij8vW6tme9DQtwpmrgGOlZIZ6OBbA8 980+9LpZiw4vY7yHg08ET8wziCIXkvd/MuwDeFR+C3QkfNl3xOHPptkfiR3308dl0sT5 icVCNzzHbJkbeBwgHxNgcG0OsE+TFkDK066h9hcyR7cMknspggyEPQDUoEFlgfqsYu9R gWH835kQEm46w4T/zoc/y1dIupouOp05i9t2gFr9pDuknpwTyx+3+HGlCLGzcQte/MA8 82GA== 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=FtRrF3HJrkl6Kgil9FQQ7n4eux/aw8pbY+vMb70E3yg=; b=lmIYnJUXuq9lJu0Fc2hdtfSr/Q3Ptvsg+uxg88kEdeqvp7rRQ4700XzmRRrbzJ8dQu 7ozD2Oxbd9SVOt1vuWkfmQZb9qHPaFAmLlAIjgAwbqyYRp18nY92vb33dYZO+N8JuSEt 1I80vsFR4BvmgtFXDfcs89e0ypN2rxG8eGKnhWmSY6XvOGDCYH4GLMu5AOt+73cOtKn8 zSZPiX4Ku1rbiCDK8SMfFpcco2cPQo6XgRb27y6caoa1PEKbv9M+fA4r5tD8Jr5Top9J YGB8UVlBC46n2ZRDkrXTulX34Kc9yXcBsfjqwDj6oGTlbQ1e3sG/u49UjuQqW+Qj2jkT mZ6A== X-Gm-Message-State: AOAM531HKWY6mrWb409MEsDSOLW+3WYn5kqz0mzWQlQvjqusdaqvmtMP 9huDHHQqlldzoPseoTajvWtvLJIXfi4= X-Google-Smtp-Source: ABdhPJyqm+zSXSbUB3V/Ze4+quq3syfmDToNa8AuMfnBt6hwP0hrSSR2eK/9U5qEyFzXXGuhoLCQIkzwkQ0= X-Received: from ascull.lon.corp.google.com ([2a00:79e0:d:109:4a0f:cfff:fe4a:6363]) (user=ascull job=sendgmr) by 2002:a5d:5583:: with SMTP id i3mr20059308wrv.119.1600166810490; Tue, 15 Sep 2020 03:46:50 -0700 (PDT) Date: Tue, 15 Sep 2020 11:46:25 +0100 In-Reply-To: <20200915104643.2543892-1-ascull@google.com> Message-Id: <20200915104643.2543892-2-ascull@google.com> Mime-Version: 1.0 References: <20200915104643.2543892-1-ascull@google.com> X-Mailer: git-send-email 2.28.0.618.gf4bc123cb7-goog Subject: [PATCH v4 01/19] 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-20200915_064655_070101_11DBDFA4 X-CRM114-Status: GOOD ( 13.05 ) 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 [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_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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's 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 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);