From patchwork Fri Jan 12 12:07:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10160491 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 AAF87602D8 for ; Fri, 12 Jan 2018 12:11:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EF56289D1 for ; Fri, 12 Jan 2018 12:11:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83788289D3; Fri, 12 Jan 2018 12:11:27 +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 142CB289D1 for ; Fri, 12 Jan 2018 12:11:27 +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=nzcHQXXSYiRCcCsXAHun/RVrs6QHusE8KhT84uSbPp4=; b=JqecK+BY2wuH9EWmLS7gZUXUM7 T6t0dLAd+RyxiAM4wWl77s3IjEqoGq3yUhPHQE6fleBoAWnnR0XtdkV7mFaV2R/BhbJa2ngHxwWPw +eTsi/xDJc7uTN/+ztT/UQYEZaANMkrOWBko87LpvtmWR6E+Cxu4Kkm0To/stHLL9ycCRX71wWpus bs+05K8NaQGUvgUZDibW8XFc+oKkREB5r8tbAiu8DdECGfBPgQJPuDfOmdDPkimPSynT02DUafepq 94pLOGy0Z+2cHpEvWXtXicofiMBojX+LKdcBkfX/84N2LLw3mFfiuxi/yGaUnZGYN7lA2sMhnZggg CiINAMig==; 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 1eZyBB-0004ow-CR; Fri, 12 Jan 2018 12:11:25 +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 1eZy8G-0000OS-JN for linux-arm-kernel@lists.infradead.org; Fri, 12 Jan 2018 12:08:29 +0000 Received: by mail-wm0-x242.google.com with SMTP id x4so2106002wmc.0 for ; Fri, 12 Jan 2018 04:08:17 -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=xpY8Fij3LhY+zgOHMaQ369LKQmWcGgTI7Qxf+5HMdq8=; b=fUfLMRuc19LrvIQ3MKwCybPStFCDCIVqSGN3NnPws/jMiBsXYa3fFNMbBwKQnoKyGm r1aSvyb6InZkCKcTV3y+VU9zpCYWJ5/Tc8hmizgrfVoDviuF0vXbqRvobBkXn64VywpZ h65uTbyqp2vxD/OtqkFQ9OztA+Unzv3S4WTXA= 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=xpY8Fij3LhY+zgOHMaQ369LKQmWcGgTI7Qxf+5HMdq8=; b=GVFfK9+47SIAHqqiVO6R6Ur7Km2lcTRBzE19uNxN4ynad0/niq9m3OXYvvqE6z239H h2lK0mBB3jh2qiNacS0ahtsj/i9/sgwouyypg4i0jrCWyoePvdk6nNr8dJ7J+jhsVwEv Zbk4FWiHSALuxN4shuqAzGoH0OBvDs3kdBqTZ+GjrqNnDwPyRquCesNeg5Dbb/dWZ4i8 ERUR6k2BLUCwVFtvSwBEHiDeOQV5vwEDdlXwMSDe3o9Ibrpu9+Jq5a5DaaFuqrS3tnXG YCeRecbEh+Jmn2fD+S94agJ5SbJ2WXjaZggHMtR/EcoCxX1eJ/YRl2Ik6/3RrUF+RlKs ntxA== X-Gm-Message-State: AKGB3mLyV569jUTahOpW97p7V6zOpgjMsN0gP7Cy2/zndo+V02rfDNAn zu5iqpm0aWc9U/H63GgFjdOGhg== X-Google-Smtp-Source: ACJfBotV06Rw4tnm5no6+GTOik0W1XRGSyTN9hpJbtwieRfBWJ2W3ibCg4idrT4KwlpAl+BdjdSMVQ== X-Received: by 10.80.169.104 with SMTP id m37mr35035329edc.15.1515758895903; Fri, 12 Jan 2018 04:08:15 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id f16sm13489705edj.65.2018.01.12.04.08.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jan 2018 04:08:14 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 16/41] KVM: arm64: Don't deactivate VM on VHE systems Date: Fri, 12 Jan 2018 13:07:22 +0100 Message-Id: <20180112120747.27999-17-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180112120747.27999-1-christoffer.dall@linaro.org> References: <20180112120747.27999-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180112_040824_874642_6DB50FAA X-CRM114-Status: GOOD ( 10.91 ) 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 Acked-by: Marc Zyngier Signed-off-by: Christoffer Dall --- 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 05fba76ec918..9aadef6966bf 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -136,9 +136,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); } @@ -352,7 +351,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); @@ -378,7 +377,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); @@ -407,7 +405,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);