Skip to content

Commit a004393

Browse files
ardbiesheuvelwilldeacon
authored andcommitted
arm64: idreg-override: use early FDT mapping in ID map
Instead of calling into the kernel to map the FDT into the kernel page tables before even calling start_kernel(), let's switch to the initial, temporary mapping of the device tree that has been added to the ID map. Signed-off-by: Ard Biesheuvel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent f70b3a2 commit a004393

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

arch/arm64/kernel/head.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ SYM_FUNC_START_LOCAL(__primary_switched)
472472
#endif
473473
mov x0, x21 // pass FDT address in x0
474474
bl early_fdt_map // Try mapping the FDT early
475+
mov x0, x22 // pass FDT address in x0
475476
bl init_feature_override // Parse cpu feature overrides
476477
#ifdef CONFIG_RANDOMIZE_BASE
477478
tst x23, ~(MIN_KIMG_ALIGN - 1) // already running randomized?

arch/arm64/kernel/idreg-override.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,11 @@ static __init void __parse_cmdline(const char *cmdline, bool parse_aliases)
201201
} while (1);
202202
}
203203

204-
static __init const u8 *get_bootargs_cmdline(void)
204+
static __init const u8 *get_bootargs_cmdline(const void *fdt)
205205
{
206206
const u8 *prop;
207-
void *fdt;
208207
int node;
209208

210-
fdt = get_early_fdt_ptr();
211-
if (!fdt)
212-
return NULL;
213-
214209
node = fdt_path_offset(fdt, "/chosen");
215210
if (node < 0)
216211
return NULL;
@@ -222,9 +217,9 @@ static __init const u8 *get_bootargs_cmdline(void)
222217
return strlen(prop) ? prop : NULL;
223218
}
224219

225-
static __init void parse_cmdline(void)
220+
static __init void parse_cmdline(const void *fdt)
226221
{
227-
const u8 *prop = get_bootargs_cmdline();
222+
const u8 *prop = get_bootargs_cmdline(fdt);
228223

229224
if (IS_ENABLED(CONFIG_CMDLINE_FORCE) || !prop)
230225
__parse_cmdline(CONFIG_CMDLINE, true);
@@ -234,9 +229,9 @@ static __init void parse_cmdline(void)
234229
}
235230

236231
/* Keep checkers quiet */
237-
void init_feature_override(void);
232+
void init_feature_override(const void *fdt);
238233

239-
asmlinkage void __init init_feature_override(void)
234+
asmlinkage void __init init_feature_override(const void *fdt)
240235
{
241236
int i;
242237

@@ -247,7 +242,7 @@ asmlinkage void __init init_feature_override(void)
247242
}
248243
}
249244

250-
parse_cmdline();
245+
parse_cmdline(fdt);
251246

252247
for (i = 0; i < ARRAY_SIZE(regs); i++) {
253248
if (regs[i]->override)

0 commit comments

Comments
 (0)