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: 10244843 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 0C63660208 for ; Tue, 27 Feb 2018 11:35:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3CD728833 for ; Tue, 27 Feb 2018 11:35:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA7A528841; Tue, 27 Feb 2018 11:35:01 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 65C2928843 for ; Tue, 27 Feb 2018 11:35:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932132AbeB0LfA (ORCPT ); Tue, 27 Feb 2018 06:35:00 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33669 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932106AbeB0Ley (ORCPT ); Tue, 27 Feb 2018 06:34:54 -0500 Received: by mail-wm0-f65.google.com with SMTP id s206so21263347wme.0 for ; Tue, 27 Feb 2018 03:34:54 -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=sZ0L4FofhBBqkijdN1NaPBHNOq3BcnwiDhLVh12T3BVJ3KvV8h7NqcxWNKb+tiUiFJ 0qkLsgMdvnBflFOyT+kJDUhRqiy4pqKoWY88aTBXMCtyGGc5mAtTl34oFx/adyawWknM 6yrxgxT98AimqsLZjkhT0tFzMqSFvvyMAxA1IWSYzBnR79PsAizXoxZPQ3xbICymBXCr bPeboTWhyZA4px/zD2UrfCFVOYYFVfct659BL25sBrJgh37B1PtlWelmkOaAihHBGalZ HxQfVxTOkybN0CtU8RaJXbWwkUljk0lafOd/q+NtcQwEMfOFMeSCVCu8loI0wl3N0xZS TJ9A== X-Gm-Message-State: APf1xPAsmp2D17e9bpYQznGtE4uoUdqCfmIlAs5vBr5P6tbayeLNUbaX oUp55dK3WGPt3rSihoSwoF1eUg== 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 Cc: kvm@vger.kernel.org, Marc Zyngier , Andrew Jones , Shih-Wei Li , Dave Martin , Julien Grall , Tomasz Nowicki , Yury Norov 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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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);