Skip to content

Commit

Permalink
arm64: mm: Remove vabits_user
Browse files Browse the repository at this point in the history
Previous patches have enabled 52-bit kernel + user VAs and there is no
longer any scenario where user VA != kernel VA size.

This patch removes the, now redundant, vabits_user variable and replaces
usage with vabits_actual where appropriate.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Steve Capper <steve.capper@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
  • Loading branch information
Steve Capper authored and Will Deacon committed Aug 9, 2019
1 parent b6d00d4 commit 2c624fe
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 16 deletions.
3 changes: 0 additions & 3 deletions arch/arm64/include/asm/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,6 @@ static inline unsigned long kaslr_offset(void)
return kimage_vaddr - KIMAGE_VADDR;
}

/* the actual size of a user virtual address */
extern u64 vabits_user;

/*
* Allow all memory at the discovery stage. We will clip it later.
*/
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/include/asm/pointer_auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ extern int ptrauth_prctl_reset_keys(struct task_struct *tsk, unsigned long arg);
* The EL0 pointer bits used by a pointer authentication code.
* This is dependent on TBI0 being enabled, or bits 63:56 would also apply.
*/
#define ptrauth_user_pac_mask() GENMASK(54, vabits_user)
#define ptrauth_user_pac_mask() GENMASK(54, vabits_actual)

/* Only valid for EL0 TTBR0 instruction pointers */
static inline unsigned long ptrauth_strip_insn_pac(unsigned long ptr)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*/

#define DEFAULT_MAP_WINDOW_64 (UL(1) << VA_BITS_MIN)
#define TASK_SIZE_64 (UL(1) << vabits_user)
#define TASK_SIZE_64 (UL(1) << vabits_actual)

#ifdef CONFIG_COMPAT
#if defined(CONFIG_ARM64_64K_PAGES) && defined(CONFIG_KUSER_HELPERS)
Expand Down
7 changes: 1 addition & 6 deletions arch/arm64/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,6 @@ __create_page_tables:
#endif
mov x5, #VA_BITS_MIN
1:
adr_l x6, vabits_user
str x5, [x6]
dmb sy
dc ivac, x6 // Invalidate potentially stale cache line

adr_l x6, vabits_actual
str x5, [x6]
dmb sy
Expand Down Expand Up @@ -795,7 +790,7 @@ ENDPROC(__enable_mmu)

ENTRY(__cpu_secondary_check52bitva)
#ifdef CONFIG_ARM64_VA_BITS_52
ldr_l x0, vabits_user
ldr_l x0, vabits_actual
cmp x0, #52
b.ne 2f

Expand Down
3 changes: 1 addition & 2 deletions arch/arm64/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ static void show_pte(unsigned long addr)

pr_alert("%s pgtable: %luk pages, %llu-bit VAs, pgdp=%016lx\n",
mm == &init_mm ? "swapper" : "user", PAGE_SIZE / SZ_1K,
mm == &init_mm ? vabits_actual : (int)vabits_user,
(unsigned long)virt_to_phys(mm->pgd));
vabits_actual, (unsigned long)virt_to_phys(mm->pgd));
pgdp = pgd_offset(mm, addr);
pgd = READ_ONCE(*pgdp);
pr_alert("[%016lx] pgd=%016llx", addr, pgd_val(pgd));
Expand Down
2 changes: 0 additions & 2 deletions arch/arm64/mm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@

u64 idmap_t0sz = TCR_T0SZ(VA_BITS);
u64 idmap_ptrs_per_pgd = PTRS_PER_PGD;
u64 vabits_user __ro_after_init;
EXPORT_SYMBOL(vabits_user);

u64 __section(".mmuoff.data.write") vabits_actual;
EXPORT_SYMBOL(vabits_actual);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/mm/proc.S
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ ENTRY(__cpu_setup)
tcr_clear_errata_bits x10, x9, x5

#ifdef CONFIG_ARM64_VA_BITS_52
ldr_l x9, vabits_user
ldr_l x9, vabits_actual
sub x9, xzr, x9
add x9, x9, #64
tcr_set_t1sz x10, x9
Expand Down

0 comments on commit 2c624fe

Please sign in to comment.