[PATCH] arm64: Clear VTCR_EL2 in __init_el2_stage2()

Mark Rutland mark.rutland at arm.com
Fri Mar 13 02:59:30 PDT 2026


On Fri, Mar 13, 2026 at 05:38:57AM +0000, Anshuman Khandual wrote:
> Clear VTCR_EL2 along with VTTBR_EL2 register in __init_el2_stage2(), which
> ensures that MMU stage-2 translation remain disabled.

As Marc noted, that's not true -- whether stage 2 is enabled is governed
entirely by HCR_EL2.VM.

The only reason to initialize VTCR_EL2 here would be if some field in
VTCR_EL2 applies when stage 2 is *disabled*.

> Although clearing out VTTBR_EL2 probably should have been sufficient
> but adding VTCR_EL2 improves overall safety.

It's unhelpful to send patches like this with unclear or non-existent
rationale, and vague statements about what the patch might do. Was there
some specific reason to send this? e.g.

* Did you have any specific reason to believe that setting some field in
  VTCR_EL2 was necessary? e.g. is there some misleading documentation,
  or comment elsewhere in the kernel?

* Are you trying to fix some problem you've encountered, but haven't
  managed to debug?

* Was this purely from inspection?

Mark.

> Cc: Catalin Marinas <catalin.marinas at arm.com>
> Cc: Will Deacon <will at kernel.org>
> Cc: Marc Zyngier <maz at kernel.org>
> Cc: Oliver Upton <oupton at kernel.org>
> Cc: Mark Rutland <mark.rutland at arm.com>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual at arm.com>
> ---
>  arch/arm64/include/asm/el2_setup.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h
> index 85f4c1615472..2c88033591bb 100644
> --- a/arch/arm64/include/asm/el2_setup.h
> +++ b/arch/arm64/include/asm/el2_setup.h
> @@ -189,6 +189,7 @@
>  /* Stage-2 translation */
>  .macro __init_el2_stage2
>  	msr	vttbr_el2, xzr
> +	msr	vtcr_el2, xzr
>  .endm
>  
>  /* GICv3 system register access */
> -- 
> 2.30.2
> 



More information about the linux-arm-kernel mailing list