From patchwork Thu Dec 7 17:06:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10100335 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 D2EBC60325 for ; Thu, 7 Dec 2017 17:17:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B671628464 for ; Thu, 7 Dec 2017 17:17:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A83BA284DA; Thu, 7 Dec 2017 17:17:26 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 3AFBF28464 for ; Thu, 7 Dec 2017 17:17:26 +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=5IgToUULku/sS94Kxr2nRDm8hzTfVgt2yK0IDH+eCzE=; b=tpXFMrVcIB/BcU3Ft4e+YEqgO/ d8dFLqVPkhVWej+sWhy0a5idNc7KPsVqhCoHL9LGUKcceSRlKNUAcV/I1XagZi8N12tQK3wCTXQQN JyXzx1A5qaUMY0cv4ojozLc/In8pAHTxZt10chaBqG7aQNZaP+N+pprKV4VHmTCty8OIH5x840uve fOFhMVxSKom8vCYhAghKoCS8Qg931SSp38J7h4oxf2IkC2yirAoVHcrUcqxj8c/raFniIDwS7UMbx 34durKpcHsHwRaGWlPWpoHlBH/nIfli9bUkz5Jt3714HZkj/hGOCW/hLioCvzQ3B8hSuGjvg/PJGk T1X89SBA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eMznZ-0006B1-Db; Thu, 07 Dec 2017 17:17:25 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMzfQ-0004Pb-A5 for linux-arm-kernel@bombadil.infradead.org; Thu, 07 Dec 2017 17:09:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=HMJZzbRe7OqmJSkx6L5k3kzGybZNxJvVa/2oq0pdrAg=; b=OLMN6lMVtmkRdZlIhu9ccMqkh wutE/4+NP5nxUDbm6J2PqQm71lmJTm6PZyFzAn/2pt8KmB4ZbHTpIjsusb+4fP3hIplZn+8GnMvkk P3I6IcdQ8hn3C4N0F7ERC3cX2KzKkrwMEuIuCuobu6EcQF35jss1jXUSvZQAdMGEjJtvvPYMdQsvo fEeNiURCYLNvqg/sRXxyl31jp0NCK1/wSnWuIs11oCrLiDLj+krXtMw+TC7mSim7op1WjhmB8FRDV tO8GtNO2xK6gz4b52nYmtr1wC2MeDDYl/vZ/NjdHL+mVUrA9n3GRMbuYmOxCS842NXUj6bwI2VMm0 D9Ds4m1tg==; Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMzdq-0001w2-HQ for linux-arm-kernel@lists.infradead.org; Thu, 07 Dec 2017 17:07:24 +0000 Received: by mail-wm0-x242.google.com with SMTP id b76so14241271wmg.1 for ; Thu, 07 Dec 2017 09:07:02 -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=HMJZzbRe7OqmJSkx6L5k3kzGybZNxJvVa/2oq0pdrAg=; b=h4RpnbwPPr87mvVVetwycMmKq73HyrbSBIq7f+OBmJPF3+ROY8RWJa10+pXvRd3cZ0 AVpbYLxfNkPiK0HFfAnjL2DfWTkdhL0Q13gfoD47cw1W75uMKbBg4+2rynsp9s9lT0ZP UzvC+M3S7ewYGTo+5BD8WQuZBbqAvfc7rsndo= 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=HMJZzbRe7OqmJSkx6L5k3kzGybZNxJvVa/2oq0pdrAg=; b=FTxMN0n3eZuAjcYClsfF9+aJUQ6qZv3YAArSuvnNfXVMw1iwvQBNBiZETkf5eQRMmv +hrcruR+Nougg2ACo+xT/SAkrb8HLxOpSBAOf4YGX44NGLkUULp9/Ltid0Rmx/m1Yrb1 Q7w2bBrV0IymdVfRm2UjxQDLSQRcvkA62M9nypKCuYWN9Lf0ndziSJoBihIUddpGM6Ju lVb+pgsmifiWizxXIaVBg3VJbyG3Fc7m/GRjjfMLy3LDh1Ma0/H+4o0CwdrkyA0iTH5w M1nZDdNZUOIumNuJ6cthCodLluz0WE8TU1rTuJz1ss6FetCmOf0Fl/QD6SFoH5i8aEth fQeg== X-Gm-Message-State: AJaThX62nDiTN3CcDy8bmNLR+b9OicHKtX8SsBa7Qszr9saDV2jEByxM OK6BPDg3NiNqMnk3L5d8c+QZmFUGOW8= X-Google-Smtp-Source: AGs4zMa8cfapmJD/GQlFVv1R2MfceP1wnWX9lRHzjTEzXsxxsg0ch2HcjTAgmVRCG0s6C48IgPOZgQ== X-Received: by 10.80.151.178 with SMTP id e47mr45948664edb.196.1512666421333; Thu, 07 Dec 2017 09:07:01 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id a16sm2868270edd.19.2017.12.07.09.06.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Dec 2017 09:07:00 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 13/36] KVM: arm64: Don't deactivate VM on VHE systems Date: Thu, 7 Dec 2017 18:06:07 +0100 Message-Id: <20171207170630.592-14-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171207170630.592-1-christoffer.dall@linaro.org> References: <20171207170630.592-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171207_170722_613631_31F8DB0B X-CRM114-Status: GOOD ( 12.16 ) 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: Marc Zyngier , Andrew Jones , Christoffer Dall , Shih-Wei Li , kvm@vger.kernel.org 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 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 Signed-off-by: Christoffer Dall Acked-by: Marc Zyngier --- 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 eac2202a179c..e783e2371b7c 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -140,9 +140,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); } @@ -356,7 +355,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); @@ -382,7 +381,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); @@ -411,7 +409,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);