Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7435014ybl; Tue, 24 Dec 2019 02:30:52 -0800 (PST) X-Google-Smtp-Source: APXvYqxKRQXEbM+ATlBXFq3NpM+yu4v/e8mwJwHFwvDtua752U8Mf+FREuAf5lOBtS1Fz2+d1N6c X-Received: by 2002:a9d:4b05:: with SMTP id q5mr25199307otf.174.1577183452182; Tue, 24 Dec 2019 02:30:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577183452; cv=none; d=google.com; s=arc-20160816; b=MWcLX5uUsoWnJS3QqFn+VP2JMMY1OnfMRwidWSZkHcwvzjYVk5V334IF1gGxdsWNFI GPPgYf1vJuE0a9U94ohOsuIGO2QXAss/452bWbWMC5YrHA+pTAl46l2t6AyriZi1HSAV ENRz8XbveqoCkY/24euk1bMxkfke+iVM7UIq1MgvsH/5UTtcND48aO8FkmG1w1LFUzr4 njxEkEpJvzljHXo1Ew7++l63/47dsdjwFNNgXYTqmyIqDSro4zLkimmfdOCpwuT0sIwF 22awmrb72wo9sIy6pFD1VxfBAcxgLo+E3wEPNEcm4dOJHXmsPZcu8hR0KtTtgYUampFp K5Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=EPoGw1Xtr2HqrFmkxkZ5Gef3nwHEtZtB5GzauqWvJU0=; b=l1BZvTAD1ZCOdaefGAFFsdWsGitutwauAQ6ALpYGHfs/prkyTkspuenc3HjWqi9mfZ 6zE8lggvDIUdC9DEFXddn+DJjoQOk5tuwEMUC1kxeWD44KDR3Vr+h7lCrSQCGlGjZL/X 8MS6/zV+TpXFuO5P0+zY0H504Rv8KpMEKXXg0Liau9WHimSF0VjubPWRZ/qVqwg922lr KjwSSH2ZokRep+LaH1yiisGRfteeFR8l1qwkRIn6QCrIMmopqaO1lZX2oQcMVJ3Abi8V bCySf8+gLKI1RYaDX6hzp1rDBOKS9F2liUwNTAlna53fMEJ9SYoQivYtVwmX5P6XUyM0 wQQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u16si8438473oia.233.2019.12.24.02.30.41; Tue, 24 Dec 2019 02:30:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726269AbfLXK3x (ORCPT + 99 others); Tue, 24 Dec 2019 05:29:53 -0500 Received: from foss.arm.com ([217.140.110.172]:50936 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726104AbfLXK3x (ORCPT ); Tue, 24 Dec 2019 05:29:53 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 93FCF31B; Tue, 24 Dec 2019 02:29:52 -0800 (PST) Received: from localhost (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0C4773F6CF; Tue, 24 Dec 2019 02:29:51 -0800 (PST) Date: Tue, 24 Dec 2019 10:29:50 +0000 From: Andrew Murray To: Marc Zyngier Cc: will@kernel.org, Catalin Marinas , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Sudeep Holla , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 02/18] arm64: KVM: reset E2PB correctly in MDCR_EL2 when exiting the guest(VHE) Message-ID: <20191224102949.GD42593@e119886-lin.cambridge.arm.com> References: <20191220143025.33853-1-andrew.murray@arm.com> <20191220143025.33853-3-andrew.murray@arm.com> <20191221131214.769a140e@why> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191221131214.769a140e@why> User-Agent: Mutt/1.10.1+81 (426a6c1) (2018-08-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 21, 2019 at 01:12:14PM +0000, Marc Zyngier wrote: > On Fri, 20 Dec 2019 14:30:09 +0000 > Andrew Murray wrote: > > > From: Sudeep Holla > > > > On VHE systems, the reset value for MDCR_EL2.E2PB=b00 which defaults > > to profiling buffer using the EL2 stage 1 translations. > > Does the reset value actually matter here? I don't see it being > specific to VHE systems, and all we're trying to achieve is to restore > the SPE configuration to a state where it can be used by the host. > > > However if the > > guest are allowed to use profiling buffers changing E2PB settings, we > > How can the guest be allowed to change E2PB settings? Or do you mean > here that allowing the guest to use SPE will mandate changes of the > E2PB settings, and that we'd better restore the hypervisor state once > we exit? > > > need to ensure we resume back MDCR_EL2.E2PB=b00. Currently we just > > do bitwise '&' with MDCR_EL2_E2PB_MASK which will retain the value. > > > > So fix it by clearing all the bits in E2PB. > > > > Signed-off-by: Sudeep Holla > > Signed-off-by: Andrew Murray > > --- > > arch/arm64/kvm/hyp/switch.c | 4 +--- > > 1 file changed, 1 insertion(+), 3 deletions(-) > > > > diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c > > index 72fbbd86eb5e..250f13910882 100644 > > --- a/arch/arm64/kvm/hyp/switch.c > > +++ b/arch/arm64/kvm/hyp/switch.c > > @@ -228,9 +228,7 @@ void deactivate_traps_vhe_put(void) > > { > > u64 mdcr_el2 = read_sysreg(mdcr_el2); > > > > - mdcr_el2 &= MDCR_EL2_HPMN_MASK | > > - MDCR_EL2_E2PB_MASK << MDCR_EL2_E2PB_SHIFT | > > - MDCR_EL2_TPMS; > > + mdcr_el2 &= MDCR_EL2_HPMN_MASK | MDCR_EL2_TPMS; > > > > write_sysreg(mdcr_el2, mdcr_el2); > > > > I'm OK with this change, but I believe the commit message could use > some tidying up. No problem, I'll update the commit message. Thanks, Andrew Murray > > Thanks, > > M. > -- > Jazz is not dead. It just smells funny...