Skip to content

Commit cf938f9

Browse files
Seongsu Parkctmarinas
authored andcommitted
arm64: Cleanup __cpu_set_tcr_t0sz()
The T0SZ field of TCR_EL1 occupies bits 0-5 of the register and encode the virtual address space translated by TTBR0_EL1. When updating the field, for example because we are switching to/from the idmap page-table, __cpu_set_tcr_t0sz() erroneously treats its 't0sz' argument as unshifted, resulting in harmless but confusing double shifts by 0 in the code. Co-developed-by: Leem ChaeHoon <[email protected]> Signed-off-by: Leem ChaeHoon <[email protected]> Signed-off-by: Seongsu Park <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 5736111 commit cf938f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/include/asm/mmu_context.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ static inline void __cpu_set_tcr_t0sz(unsigned long t0sz)
7272
{
7373
unsigned long tcr = read_sysreg(tcr_el1);
7474

75-
if ((tcr & TCR_T0SZ_MASK) >> TCR_T0SZ_OFFSET == t0sz)
75+
if ((tcr & TCR_T0SZ_MASK) == t0sz)
7676
return;
7777

7878
tcr &= ~TCR_T0SZ_MASK;
79-
tcr |= t0sz << TCR_T0SZ_OFFSET;
79+
tcr |= t0sz;
8080
write_sysreg(tcr, tcr_el1);
8181
isb();
8282
}

0 commit comments

Comments
 (0)