Skip to content

Commit 93d0d6f

Browse files
ardbiesheuvelwilldeacon
authored andcommitted
arm64/boot: Move init_pgdir[] and init_idmap_pgdir[] into __pi_ namespace
init_pgdir[] is only referenced from the startup code, but lives after BSS in the linker map. Before tightening the rules about accessing BSS from startup code, move init_pgdir[] into the __pi_ namespace, so it does not need to be exported explicitly. For symmetry, do the same with init_idmap_pgdir[], although it lives before BSS. Signed-off-by: Ard Biesheuvel <[email protected]> Tested-by: Yeoreum Yun <[email protected]> Reviewed-by: Yeoreum Yun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 13c63ce commit 93d0d6f

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

arch/arm64/include/asm/pgtable.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,8 +851,6 @@ static inline bool pud_table(pud_t pud) { return true; }
851851
PUD_TYPE_TABLE)
852852
#endif
853853

854-
extern pgd_t init_pg_dir[];
855-
extern pgd_t init_pg_end[];
856854
extern pgd_t swapper_pg_dir[];
857855
extern pgd_t idmap_pg_dir[];
858856
extern pgd_t tramp_pg_dir[];

arch/arm64/kernel/head.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ SYM_CODE_START(primary_entry)
8989
adrp x1, early_init_stack
9090
mov sp, x1
9191
mov x29, xzr
92-
adrp x0, init_idmap_pg_dir
92+
adrp x0, __pi_init_idmap_pg_dir
9393
mov x1, xzr
9494
bl __pi_create_init_idmap
9595

@@ -101,7 +101,7 @@ SYM_CODE_START(primary_entry)
101101
cbnz x19, 0f
102102
dmb sy
103103
mov x1, x0 // end of used region
104-
adrp x0, init_idmap_pg_dir
104+
adrp x0, __pi_init_idmap_pg_dir
105105
adr_l x2, dcache_inval_poc
106106
blr x2
107107
b 1f
@@ -507,7 +507,7 @@ SYM_FUNC_END(__no_granule_support)
507507

508508
SYM_FUNC_START_LOCAL(__primary_switch)
509509
adrp x1, reserved_pg_dir
510-
adrp x2, init_idmap_pg_dir
510+
adrp x2, __pi_init_idmap_pg_dir
511511
bl __enable_mmu
512512

513513
adrp x1, early_init_stack

arch/arm64/kernel/image-vars.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ PROVIDE(__pi_is_midr_in_range_list = is_midr_in_range_list);
5353
#endif
5454
PROVIDE(__pi__ctype = _ctype);
5555

56-
PROVIDE(__pi_init_idmap_pg_dir = init_idmap_pg_dir);
57-
PROVIDE(__pi_init_idmap_pg_end = init_idmap_pg_end);
58-
PROVIDE(__pi_init_pg_dir = init_pg_dir);
59-
PROVIDE(__pi_init_pg_end = init_pg_end);
6056
PROVIDE(__pi_swapper_pg_dir = swapper_pg_dir);
6157

6258
PROVIDE(__pi__text = _text);

arch/arm64/kernel/pi/pi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ static inline void *prel64_to_pointer(const prel64_t *offset)
2222
extern bool dynamic_scs_is_enabled;
2323

2424
extern pgd_t init_idmap_pg_dir[], init_idmap_pg_end[];
25+
extern pgd_t init_pg_dir[], init_pg_end[];
2526

2627
void init_feature_override(u64 boot_status, const void *fdt, int chosen);
2728
u64 kaslr_early_init(void *fdt, int chosen);

arch/arm64/kernel/vmlinux.lds.S

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,9 @@ SECTIONS
249249
__inittext_end = .;
250250
__initdata_begin = .;
251251

252-
init_idmap_pg_dir = .;
252+
__pi_init_idmap_pg_dir = .;
253253
. += INIT_IDMAP_DIR_SIZE;
254-
init_idmap_pg_end = .;
254+
__pi_init_idmap_pg_end = .;
255255

256256
.init.data : {
257257
INIT_DATA
@@ -321,9 +321,9 @@ SECTIONS
321321
BSS_SECTION(SBSS_ALIGN, 0, 0)
322322

323323
. = ALIGN(PAGE_SIZE);
324-
init_pg_dir = .;
324+
__pi_init_pg_dir = .;
325325
. += INIT_DIR_SIZE;
326-
init_pg_end = .;
326+
__pi_init_pg_end = .;
327327
/* end of zero-init region */
328328

329329
. += SZ_4K; /* stack for the early C runtime */

0 commit comments

Comments
 (0)