From patchwork Tue Feb 27 11:34:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10244941 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 D5EF860208 for ; Tue, 27 Feb 2018 11:43:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C84D428647 for ; Tue, 27 Feb 2018 11:43:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD20428696; Tue, 27 Feb 2018 11:43:52 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 247992865F for ; Tue, 27 Feb 2018 11:43:51 +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=iLMTuREyP/n/ae0FE0+1B4KX40zKOazFjP9Rvzmybzk=; b=bb26b4CZVpzkRmjSGOuwmuw3Xr xNSacw0EpwuR2zVc4AGv0w+EOMiV9GbqtgkBIxTBRQrciheHaTJxcgyNiWB921F6wKoRy5xM44lFN WPexpKA75ZITzejYstNvJb0TIPgGe83gtsDuHInLBnV2EfsvDUizu/GW9uYcmhlP9GkU20Bgn/7Yp aCvmaby+SGogIqAh0lZ3PmhMtojfbm0kAB3ViIpiQXYcx9/rXhfNNkufNaOtUQYf8vi8EYNAYx2xK eL80ZtekRd9LPh4T4iCakEmvfiyx2xfvEKJJytFVyXIgcCVFlxF6igQssGnObVyaQArXgjLu5dbB2 gKI0Z4Bg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eqdfc-0005N2-Iv; Tue, 27 Feb 2018 11:43:44 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eqdXF-0006d4-8c for linux-arm-kernel@lists.infradead.org; Tue, 27 Feb 2018 11:35:27 +0000 Received: by mail-wm0-x242.google.com with SMTP id s206so21263350wme.0 for ; Tue, 27 Feb 2018 03:34:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=christofferdall-dk.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Pv7QOSW59a9Elzo8/nxPd+j1w3L0UJJWpZbSttaeTCg=; b=oc78jLryh7R6wlUzQa4wjPrAd3OQB1FY37mQWR91iA/euCZgW9KKlyj8F02Pgk41WX LWNOGHpZ4Of7fmPIS3ku7UUsoC2fDUBSlukktUfnTTG8VshVW0R4sV5phiyLOgisir8C SoeAY5QN9vpDoiebzE7SiTJgjEdAlL15vhi04wJc4dZ51U1zORxwmwI422xuFxSHn70s rdoH0FEVqs+lIchgFaDKtaFXtNHkfHHo15npunD3v9kJPLcGh+VUlfIXtnrrncJ907Yf O39MA9vMs7oSpjQcqFkomKtgq3gzvnj9KanhceXRIxvOgkfE8yG01UcN0AjhZ++DdSJD rebg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Pv7QOSW59a9Elzo8/nxPd+j1w3L0UJJWpZbSttaeTCg=; b=fWR3bLhjmvY7ku8Wz22AAwobgVFfve/fO9flXrJsD3lqfSJdOLzyZke2yWm5LbUHj8 TG9t5BfSnzQZ7V4GEcQ9JyiAs6pY21vA3Pi6jhk4IRiauEtdW0feBvU27jjeL65eXeyM 2M1+j4uBmR8bZ5OcwxGOqitedd/GSW9g/3QIJOkk9AAuVf7rOQ6A3d+3eOYT4T4qFeFm OfrvTd7t/HFhiEktdGAAuX1YtpELC84TstsHQ2kKevQL/WK6kRjwPz4APBMhdnAhoT9q Ovvo0ld0tEJUtqZPz7h5JunMDzVSeLj4z51p0K+Wz8QYgl/Ls0A9QjNVjxVt4mjwY8U0 4jlg== X-Gm-Message-State: APf1xPAKDva34fhpvRCJzVgh0+g6HeCLNErou/7n+1+qOk+t0Es9DzPO RTNJ2mx3R5EzwQxGJUJHoCllHg== X-Google-Smtp-Source: AH8x226ANdEhoTQHd+DfH6Yn0DjlaRALERYjhkcbYBBcvMUDxE+iPWDrZhGZawsI4OwbVTnzY/M50A== X-Received: by 10.80.245.136 with SMTP id u8mr18990682edm.8.1519731293678; Tue, 27 Feb 2018 03:34:53 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id m1sm9176786ede.39.2018.02.27.03.34.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Feb 2018 03:34:52 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 15/40] KVM: arm64: Don't deactivate VM on VHE systems Date: Tue, 27 Feb 2018 12:34:04 +0100 Message-Id: <20180227113429.637-16-cdall@kernel.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180227113429.637-1-cdall@kernel.org> References: <20180227113429.637-1-cdall@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180227_033506_182250_CDB82DC9 X-CRM114-Status: GOOD ( 13.73 ) 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: Andrew Jones , kvm@vger.kernel.org, Marc Zyngier , Tomasz Nowicki , Julien Grall , Yury Norov , Dave Martin , Shih-Wei Li 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 From: Christoffer Dall There is no need to reset the VTTBR to zero when exiting the guest on VHE systems. VHE systems don't use stage 2 translations for the EL2&0 translation regime used by the host. Reviewed-by: Andrew Jones Acked-by: Marc Zyngier Signed-off-by: Christoffer Dall --- Notes: Changes since v1: - Changed __activate_vm to take a kvm pointer - No longer adding inline attributes to functions arch/arm64/kvm/hyp/switch.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index 1e26a81c0a16..9ffd802e775d 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -156,9 +156,8 @@ static void __hyp_text __deactivate_traps(struct kvm_vcpu *vcpu) write_sysreg(0, pmuserenr_el0); } -static void __hyp_text __activate_vm(struct kvm_vcpu *vcpu) +static void __hyp_text __activate_vm(struct kvm *kvm) { - struct kvm *kvm = kern_hyp_va(vcpu->kvm); write_sysreg(kvm->arch.vttbr, vttbr_el2); } @@ -377,7 +376,7 @@ int kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) __sysreg_save_host_state(host_ctxt); __activate_traps(vcpu); - __activate_vm(vcpu); + __activate_vm(vcpu->kvm); __vgic_restore_state(vcpu); __timer_enable_traps(vcpu); @@ -405,7 +404,6 @@ int kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) __vgic_save_state(vcpu); __deactivate_traps(vcpu); - __deactivate_vm(vcpu); __sysreg_restore_host_state(host_ctxt); @@ -440,7 +438,7 @@ int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu) __sysreg_save_host_state(host_ctxt); __activate_traps(vcpu); - __activate_vm(vcpu); + __activate_vm(kern_hyp_va(vcpu->kvm)); __vgic_restore_state(vcpu); __timer_enable_traps(vcpu);