From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E1EA1BD516 for ; Tue, 6 Aug 2024 10:04:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722938662; cv=none; b=GXz059u7xqvO4oDvwWuyNSLVEU8gaROcmiDqB9vWrLf6maofeir2Igo6/d2XPc9pvzkWoVFYh5Kd6iXGEaCBaZFkjjWm1mEVMJhHg3lubQAALpUJ8bT1vTVf+ZDkAeQEu2+MBrgNQDGBJdoYVz3eiF7ZFRUaiydfM4mk7aSyLJE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722938662; c=relaxed/simple; bh=Nz3cNR+Mt159G5KgVqt0YOrnk0UCpdEEE+jR7HnV+vI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UtoFtJyBh/O/XQkhuhApnJ1zsSjRuefooF3PD0ZKaUnz8sqSMBs7eE257PZZSjmr2r8q6CZN2eEZO1xBVZcCoSDPjA5bMdPETyq8m+mIM021k0TIZr5yroVa96UmCqDnuVVPP0MBDlm1mzF5zyZ9SFIGqFuiD1lKVhvusFAJnuU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 82D53DA7; Tue, 6 Aug 2024 03:04:44 -0700 (PDT) Received: from e124191.cambridge.arm.com (e124191.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C837F3F6A8; Tue, 6 Aug 2024 03:04:15 -0700 (PDT) Date: Tue, 6 Aug 2024 11:04:13 +0100 From: Joey Gouly To: Dave Martin Cc: linux-arm-kernel@lists.infradead.org, akpm@linux-foundation.org, aneesh.kumar@kernel.org, aneesh.kumar@linux.ibm.com, bp@alien8.de, broonie@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, dave.hansen@linux.intel.com, hpa@zytor.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, maz@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, naveen.n.rao@linux.ibm.com, npiggin@gmail.com, oliver.upton@linux.dev, shuah@kernel.org, szabolcs.nagy@arm.com, tglx@linutronix.de, will@kernel.org, x86@kernel.org, kvmarm@lists.linux.dev Subject: Re: [PATCH v4 04/29] arm64: disable trapping of POR_EL0 to EL2 Message-ID: <20240806100413.GE841837@e124191.cambridge.arm.com> References: <20240503130147.1154804-1-joey.gouly@arm.com> <20240503130147.1154804-5-joey.gouly@arm.com> Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Jul 25, 2024 at 04:44:13PM +0100, Dave Martin wrote: > Hi, > > On Fri, May 03, 2024 at 02:01:22PM +0100, Joey Gouly wrote: > > Allow EL0 or EL1 to access POR_EL0 without being trapped to EL2. > > > > Signed-off-by: Joey Gouly > > Cc: Catalin Marinas > > Cc: Will Deacon > > Acked-by: Catalin Marinas > > --- > > arch/arm64/include/asm/el2_setup.h | 10 +++++++++- > > 1 file changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h > > index b7afaa026842..df5614be4b70 100644 > > --- a/arch/arm64/include/asm/el2_setup.h > > +++ b/arch/arm64/include/asm/el2_setup.h > > @@ -184,12 +184,20 @@ > > .Lset_pie_fgt_\@: > > mrs_s x1, SYS_ID_AA64MMFR3_EL1 > > ubfx x1, x1, #ID_AA64MMFR3_EL1_S1PIE_SHIFT, #4 > > - cbz x1, .Lset_fgt_\@ > > + cbz x1, .Lset_poe_fgt_\@ > > > > /* Disable trapping of PIR_EL1 / PIRE0_EL1 */ > > orr x0, x0, #HFGxTR_EL2_nPIR_EL1 > > orr x0, x0, #HFGxTR_EL2_nPIRE0_EL1 > > > > +.Lset_poe_fgt_\@: > > + mrs_s x1, SYS_ID_AA64MMFR3_EL1 > > + ubfx x1, x1, #ID_AA64MMFR3_EL1_S1POE_SHIFT, #4 > > + cbz x1, .Lset_fgt_\@ > > + > > + /* Disable trapping of POR_EL0 */ > > + orr x0, x0, #HFGxTR_EL2_nPOR_EL0 > > Do I understand correctly that this is just to allow the host to access > its own POR_EL0, before (or unless) KVM starts up? Yup. > > KVM always overrides all the EL2 trap controls while running a guest, > right? We don't want this bit still set when running in a guest just > because KVM doesn't know about POE yet. KVM currently unconditionally traps POE regs currently, this series makes that conditional. > > (Hopefully this follows naturally from the way the KVM code works, but > my KVM-fu is a bit rusty.) > > Also, what about POR_EL1? Do we have to reset that to something sane > (and so untrap it here), or it is sufficient if we never turn on POE > support in the host, via TCR2_EL1.POE? Since the host isn't using it, we don't need to reset it. It will be reset to an unknown value for guests. In patch 7: + { SYS_DESC(SYS_POR_EL1), NULL, reset_unknown, POR_EL1 }, > > [...] > > Cheers > ---Dave Thanks, Joey