[PATCH v15 1/6] arm64/gcs: Ensure FGTs for EL1 GCS instructions are disabled

Mark Brown posted 6 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH v15 1/6] arm64/gcs: Ensure FGTs for EL1 GCS instructions are disabled
Posted by Mark Brown 1 month, 2 weeks ago
The initial EL2 setup for GCS did not include disabling of EL1 usage of
GCS instructions, also disable these traps.  This is the first disabling
of instruction traps, use x2 to store the value to be written.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 arch/arm64/include/asm/el2_setup.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h
index 46033027510c..0ac14ea4dbc8 100644
--- a/arch/arm64/include/asm/el2_setup.h
+++ b/arch/arm64/include/asm/el2_setup.h
@@ -355,6 +355,10 @@
 
 .Lskip_gce_fgt_\@:
 
+	orr	x2, x2, #HFGITR_EL2_nGCSEPP_MASK
+	orr	x2, x2, #HFGITR_EL2_nGCSSTR_EL1_MASK
+	orr	x2, x2, #HFGITR_EL2_nGCSPUSHM_EL1_MASK
+
 .Lset_fgt_\@:
 	msr_s	SYS_HFGRTR_EL2, x0
 	msr_s	SYS_HFGWTR_EL2, x0

-- 
2.39.5
Re: [PATCH v15 1/6] arm64/gcs: Ensure FGTs for EL1 GCS instructions are disabled
Posted by Marc Zyngier 1 month, 2 weeks ago
On Wed, 20 Aug 2025 15:14:41 +0100,
Mark Brown <broonie@kernel.org> wrote:
> 
> The initial EL2 setup for GCS did not include disabling of EL1 usage of
> GCS instructions, also disable these traps.  This is the first disabling
> of instruction traps, use x2 to store the value to be written.

Written where?

> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  arch/arm64/include/asm/el2_setup.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h
> index 46033027510c..0ac14ea4dbc8 100644
> --- a/arch/arm64/include/asm/el2_setup.h
> +++ b/arch/arm64/include/asm/el2_setup.h
> @@ -355,6 +355,10 @@
>  
>  .Lskip_gce_fgt_\@:
>  
> +	orr	x2, x2, #HFGITR_EL2_nGCSEPP_MASK

What is x2 set to before this?

> +	orr	x2, x2, #HFGITR_EL2_nGCSSTR_EL1_MASK
> +	orr	x2, x2, #HFGITR_EL2_nGCSPUSHM_EL1_MASK
> +
>  .Lset_fgt_\@:
>  	msr_s	SYS_HFGRTR_EL2, x0
>  	msr_s	SYS_HFGWTR_EL2, x0

Followed by:

	msr_s	SYS_HFGITR_EL2, xzr

Puzzled.

	M.

-- 
Jazz isn't dead. It just smells funny.
Re: [PATCH v15 1/6] arm64/gcs: Ensure FGTs for EL1 GCS instructions are disabled
Posted by Marc Zyngier 1 month, 2 weeks ago
On Wed, 20 Aug 2025 23:24:24 +0100,
Marc Zyngier <maz@kernel.org> wrote:
> 
> On Wed, 20 Aug 2025 15:14:41 +0100,
> Mark Brown <broonie@kernel.org> wrote:
> > 
> > The initial EL2 setup for GCS did not include disabling of EL1 usage of
> > GCS instructions, also disable these traps.  This is the first disabling
> > of instruction traps, use x2 to store the value to be written.
> 
> Written where?

Gah, I was looking at 6.16, not 6.17-rc1.

Apologies for the noise.

	M.

-- 
Jazz isn't dead. It just smells funny.