[PATCH v2] KVM: arm64: Don't populate TPIDR_EL2 in finalise_el2()

Will Deacon will at kernel.org
Mon May 18 08:55:57 PDT 2026


On Mon, May 18, 2026 at 04:41:15PM +0100, Marc Zyngier wrote:
> On Mon, 18 May 2026 16:39:30 +0100,
> Marc Zyngier <maz at kernel.org> wrote:
> > 
> > On Mon, 18 May 2026 16:31:26 +0100,
> > Will Deacon <will at kernel.org> wrote:
> > > 
> > > Currently, it is not necessary for __finalise_el2() to configure
> > > TPIDR_EL2:
> > > 
> > > * The hyp stub code does not consume the value of TPIDR_EL2.
> > > 
> > > * On the boot cpu, TPIDR_EL1 is used for the percpu offset until the
> > >   ARM64_HAS_VIRT_HOST_EXTN cpucap is detected and boot alternatives
> > >   are patched. Before boot alternatives are patched,
> > >   cpu_copy_el2regs() will copy TPIDR_EL1 into TPIDR_EL2. It is not
> > >   necessary for __finalise_el2() to initialise TPIDR_EL2 before this.
> > > 
> > > * Secondary CPUs are brought up after boot alternatives have been
> > >   patched, and __secondary_switched() will initialize TPIDR_EL2 in
> > >   'init_cpu_task', after finalise_el2() calls __finalise_el2()
> > > 
> > > * KVM hyp code which may consume TPIDR_EL2 is brought up after all
> > >   secondaries have been booted, once TPIDR_El2 has been configured on
> > >   all CPUs.
> > > 
> > > Remove the redundant initialisation from __finalise_el2().
> > > 
> > > Cc: Oliver Upton <oupton at kernel.org>
> > > Cc: Marc Zyngier <maz at kernel.org>
> > > Cc: Catalin Marinas <catalin.marinas at arm.com>
> > > Reviewed-by: Mark Rutland <mark.rutland at arm.com>
> > > Signed-off-by: Will Deacon <will at kernel.org>
> > 
> > Reviewed-by: Marc Zyngier <maz at kernel.org>
> 
> Ah, realised too late you intended for this to go via the KVM tree.
> 
> I'll queue that for 7.2.

Thanks, Marc!

Will



More information about the linux-arm-kernel mailing list