KVM: arm64: Don't populate TPIDR_EL2 in finalise_el2()
Will Deacon
maintainerPATCH v2 1/1 KVM: arm64: Don't populate TPIDR_EL2 in finalise_el2()
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().
---
v2: Use Mark's commit message, add his R-b tag, rebase onto -rc4. Link to v1: https://lore.kernel.org/r/[email protected]
arch/arm64/kernel/hyp-stub.S | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm64/kernel/hyp-stub.S +1 -3
@@ -104,11 +104,9 @@ SYM_CODE_START_LOCAL(__finalise_el2) mov_q x0, HCR_HOST_VHE_FLAGS msr_hcr_el2 x0 - // Use the EL1 allocated stack, per-cpu offset + // Use the EL1 allocated stack mrs x0, sp_el1 mov sp, x0 - mrs x0, tpidr_el1 - msr tpidr_el2, x0 // FP configuration, vectors mrs_s x0, SYS_CPACR_EL12
Signature · 1 line
2.54.0.563.g4f69b47b94-goog
Quoted 20 lines · Will Deacon
Currently, it is not necessary for
__finalise_el2()to configureTPIDR_EL2:* The hyp stub code does not consume the value of
TPIDR_EL2.* On the boot cpu,
TPIDR_EL1is used for the percpu offset until theARM64_HAS_VIRT_HOST_EXTNcpucap is detected and boot alternatives are patched. Before boot alternatives are patched,cpu_copy_el2regs()will copyTPIDR_EL1intoTPIDR_EL2. It is not necessary for__finalise_el2()to initialiseTPIDR_EL2before this.* Secondary CPUs are brought up after boot alternatives have been patched, and
__secondary_switched()will initializeTPIDR_EL2in 'init_cpu_task', afterfinalise_el2()calls__finalise_el2()* KVM hyp code which may consume
TPIDR_EL2is brought up after all secondaries have been booted, onceTPIDR_El2has been configured on all CPUs.
Quoted 7 lines
Remove the redundant initialisation from
__finalise_el2().Cc Oliver Upton <[email protected]>Cc Marc Zyngier <[email protected]>Cc Catalin Marinas <[email protected]>Reviewed-by Mark Rutland <[email protected]>Signed-off-by Will Deacon <[email protected]>
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Marc Zyngier
maintainerQuoted 25 lines · Marc Zyngier
Quoted 22 lines · Will Deacon
Currently, it is not necessary for
__finalise_el2()to configureTPIDR_EL2:* The hyp stub code does not consume the value of
TPIDR_EL2.* On the boot cpu,
TPIDR_EL1is used for the percpu offset until theARM64_HAS_VIRT_HOST_EXTNcpucap is detected and boot alternatives are patched. Before boot alternatives are patched,cpu_copy_el2regs()will copyTPIDR_EL1intoTPIDR_EL2. It is not necessary for__finalise_el2()to initialiseTPIDR_EL2before this.* Secondary CPUs are brought up after boot alternatives have been patched, and
__secondary_switched()will initializeTPIDR_EL2in 'init_cpu_task', afterfinalise_el2()calls__finalise_el2()* KVM hyp code which may consume
TPIDR_EL2is brought up after all secondaries have been booted, onceTPIDR_El2has been configured on all CPUs.Remove the redundant initialisation from
__finalise_el2().
Quoted 7 lines
Quoted 5 lines
Cc Oliver Upton <[email protected]>Cc Marc Zyngier <[email protected]>Cc Catalin Marinas <[email protected]>Reviewed-by Mark Rutland <[email protected]>Signed-off-by Will Deacon <[email protected]>Reviewed-by Marc Zyngier <[email protected]>
Ah, realised too late you intended for this to go via the KVM tree.
I'll queue that for 7.2.
Thanks,
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Will Deacon
maintainerQuoted 33 lines · Marc Zyngier
Quoted 31 lines · Marc Zyngier
Quoted 27 lines · Will Deacon
Currently, it is not necessary for
__finalise_el2()to configureTPIDR_EL2:* The hyp stub code does not consume the value of
TPIDR_EL2.* On the boot cpu,
TPIDR_EL1is used for the percpu offset until theARM64_HAS_VIRT_HOST_EXTNcpucap is detected and boot alternatives are patched. Before boot alternatives are patched,cpu_copy_el2regs()will copyTPIDR_EL1intoTPIDR_EL2. It is not necessary for__finalise_el2()to initialiseTPIDR_EL2before this.* Secondary CPUs are brought up after boot alternatives have been patched, and
__secondary_switched()will initializeTPIDR_EL2in 'init_cpu_task', afterfinalise_el2()calls__finalise_el2()* KVM hyp code which may consume
TPIDR_EL2is brought up after all secondaries have been booted, onceTPIDR_El2has been configured on all CPUs.Remove the redundant initialisation from
__finalise_el2().Cc Oliver Upton <[email protected]>Cc Marc Zyngier <[email protected]>Cc Catalin Marinas <[email protected]>Reviewed-by Mark Rutland <[email protected]>Signed-off-by Will Deacon <[email protected]>
Quoted 5 lines
Quoted 1 line
Reviewed-by Marc Zyngier <[email protected]>Ah, realised too late you intended for this to go via the KVM tree.
I'll queue that for 7.2.
Thanks, Marc!
Will
Quoted 5 lines · Will Deacon
Currently, it is not necessary for
__finalise_el2()to configureTPIDR_EL2:* The hyp stub code does not consume the value of
TPIDR_EL2.
Quoted 7 lines
* On the boot cpu,
TPIDR_EL1is used for the percpu offset until theARM64_HAS_VIRT_HOST_EXTNcpucap is detected and boot alternatives are patched. Before boot alternatives are patched,cpu_copy_el2regs()will copyTPIDR_EL1intoTPIDR_EL2. It is not necessary for__finalise_el2()to initialiseTPIDR_EL2before this.[...]
Applied to next, thanks!
[1/1] KVM: arm64: Don't populate TPIDR_EL2 in finalise_el2()
commit: 4cceeb8da363ac5127b147ee7345104743f53e9d
Cheers,
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.