From patchwork Thu Feb 15 21:03:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10223611 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 E423760467 for ; Thu, 15 Feb 2018 21:05:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5923283B9 for ; Thu, 15 Feb 2018 21:05:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA44A29516; Thu, 15 Feb 2018 21:05:44 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI 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 70645283B9 for ; Thu, 15 Feb 2018 21:05:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1167308AbeBOVFg (ORCPT ); Thu, 15 Feb 2018 16:05:36 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:37493 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1167288AbeBOVEK (ORCPT ); Thu, 15 Feb 2018 16:04:10 -0500 Received: by mail-wm0-f67.google.com with SMTP id v71so3327266wmv.2 for ; Thu, 15 Feb 2018 13:04:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=h69kfhm0Zr7Dz3nSnNQzuoxWFT87CE6Px8ZvK9fY7Og=; b=B6r6djq04gnhfvR5/+rLM8dEsEYrtPHrBbpF5xIaHbd0mglymtT2QSY8hrOs6MZDh5 wx/2m3JbOTJAcllVALRassRpCyWk4IPXX9f5YVgEbaQKgBoGM7p7ptO5suZBlDDqOpl5 J3wG/nXvQ2Xzc0fJLBkbkAaGobN/N1LHC0QUs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=h69kfhm0Zr7Dz3nSnNQzuoxWFT87CE6Px8ZvK9fY7Og=; b=rLetPXU+eBbbpBSfauc8eHPTHEyjjCggZV4Z0tFuTD3CQpMCXvFOpmwB1v1NsN0tn8 dq8dDiY/zNHMQ0EHBtLHE2NYB2LqLSILjAHhvBbQ9Fuuf5jp9/OdPwtVEPVUBewXyIuU Lj0deciW8bXoJMx0vs5+AnsdHYuX16SgLyGgXJpQKNx2bHf5SJ9poTFOX12PWT8c33bz iC+Qh5Jk3t4vG2re8Q8dnoaPyzPtCBAnDB2Pfbw01wWfRIj70IHVOHXutl7RpCZYDP7G zT3eaIJjl8dJK19vlaLoxxi5osWRQKgi0Excxj9BWvDFGRKQjpdbPtOyX2YYUAlWI/Sa w+MQ== X-Gm-Message-State: APf1xPDGqR9pqdSZkt5dDxRTfTCe4W707SU3fbvo4P62Rxpc9YpNOUrQ Jl4ZRHocynEjwjGbUwf8n2T6Wg== X-Google-Smtp-Source: AH8x224CqRa5N/rhllgB6JG6eAevNgOY0eCcYVZCkb7kUKHxzUkOH6wjb9XqehiXkpHL8QJn2X41/A== X-Received: by 10.80.145.150 with SMTP id g22mr4904664eda.162.1518728649511; Thu, 15 Feb 2018 13:04:09 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id p55sm8220030edc.15.2018.02.15.13.04.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Feb 2018 13:04:08 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: kvm@vger.kernel.org, Christoffer Dall , Marc Zyngier , Andrew Jones , Shih-Wei Li , Dave Martin , Julien Grall , Tomasz Nowicki , Yury Norov Subject: [PATCH v4 15/40] KVM: arm64: Don't deactivate VM on VHE systems Date: Thu, 15 Feb 2018 22:03:07 +0100 Message-Id: <20180215210332.8648-16-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180215210332.8648-1-christoffer.dall@linaro.org> References: <20180215210332.8648-1-christoffer.dall@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 85dae7b94a0f..734dac7f808f 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);