aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/setup.c
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2015-06-01 07:40:32 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2015-06-02 11:31:33 -0400
commit61bd93ce801bb6df36eda257a9d2d16c02863cdd (patch)
treeca3bb08e7b2e8223ca612e51fd44c4e0fd7e1670 /arch/arm64/kernel/setup.c
parent24bbd929e6b9e62afd263c42b4318d3b603c956c (diff)
arm64: use fixmap region for permanent FDT mapping
Currently, the FDT blob needs to be in the same 512 MB region as the kernel, so that it can be mapped into the kernel virtual memory space very early on using a minimal set of statically allocated translation tables. Now that we have early fixmap support, we can relax this restriction, by moving the permanent FDT mapping to the fixmap region instead. This way, the FDT blob may be anywhere in memory. This also moves the vetting of the FDT to mmu.c, since the early init code in head.S does not handle mapping of the FDT anymore. At the same time, fix up some comments in head.S that have gone stale. Reviewed-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/setup.c')
-rw-r--r--arch/arm64/kernel/setup.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 508cca1f8dce..ffd3970721bf 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -105,18 +105,6 @@ static struct resource mem_res[] = {
105#define kernel_code mem_res[0] 105#define kernel_code mem_res[0]
106#define kernel_data mem_res[1] 106#define kernel_data mem_res[1]
107 107
108void __init early_print(const char *str, ...)
109{
110 char buf[256];
111 va_list ap;
112
113 va_start(ap, str);
114 vsnprintf(buf, sizeof(buf), str, ap);
115 va_end(ap);
116
117 printk("%s", buf);
118}
119
120/* 108/*
121 * The recorded values of x0 .. x3 upon kernel entry. 109 * The recorded values of x0 .. x3 upon kernel entry.
122 */ 110 */
@@ -326,12 +314,14 @@ static void __init setup_processor(void)
326 314
327static void __init setup_machine_fdt(phys_addr_t dt_phys) 315static void __init setup_machine_fdt(phys_addr_t dt_phys)
328{ 316{
329 if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys))) { 317 void *dt_virt = fixmap_remap_fdt(dt_phys);
330 early_print("\n" 318
331 "Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n" 319 if (!dt_virt || !early_init_dt_scan(dt_virt)) {
332 "The dtb must be 8-byte aligned and passed in the first 512MB of memory\n" 320 pr_crit("\n"
333 "\nPlease check your bootloader.\n", 321 "Error: invalid device tree blob at physical address %pa (virtual address 0x%p)\n"
334 dt_phys, phys_to_virt(dt_phys)); 322 "The dtb must be 8-byte aligned and must not exceed 2 MB in size\n"
323 "\nPlease check your bootloader.",
324 &dt_phys, dt_virt);
335 325
336 while (true) 326 while (true)
337 cpu_relax(); 327 cpu_relax();
@@ -374,8 +364,6 @@ void __init setup_arch(char **cmdline_p)
374{ 364{
375 setup_processor(); 365 setup_processor();
376 366
377 setup_machine_fdt(__fdt_pointer);
378
379 init_mm.start_code = (unsigned long) _text; 367 init_mm.start_code = (unsigned long) _text;
380 init_mm.end_code = (unsigned long) _etext; 368 init_mm.end_code = (unsigned long) _etext;
381 init_mm.end_data = (unsigned long) _edata; 369 init_mm.end_data = (unsigned long) _edata;
@@ -386,6 +374,8 @@ void __init setup_arch(char **cmdline_p)
386 early_fixmap_init(); 374 early_fixmap_init();
387 early_ioremap_init(); 375 early_ioremap_init();
388 376
377 setup_machine_fdt(__fdt_pointer);
378
389 parse_early_param(); 379 parse_early_param();
390 380
391 /* 381 /*