aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2014-02-17 07:03:25 -0500
committerCatalin Marinas <catalin.marinas@arm.com>2014-02-26 06:16:28 -0500
commitea8c2e1124457f266f82effc3e6558552527943a (patch)
tree40fb161135cda0d6aaca19a7eb5855e2d98e9998 /arch/arm64
parent020c1427f3ad73c86fd566d86441e673adfe2ecb (diff)
arm64: Extend the idmap to the whole kernel image
This patch changes the idmap page table creation during boot to cover the whole kernel image, allowing functions like cpu_reset() to be safely called with the physical address. This patch also simplifies the create_block_map asm macro to no longer take an idmap argument and always use the phys/virt/end parameters. For the idmap case, phys == virt. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/kernel/head.S20
1 files changed, 8 insertions, 12 deletions
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 0b281fffda51..61035d6814cb 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -384,26 +384,18 @@ ENDPROC(__calc_phys_offset)
384 * Preserves: tbl, flags 384 * Preserves: tbl, flags
385 * Corrupts: phys, start, end, pstate 385 * Corrupts: phys, start, end, pstate
386 */ 386 */
387 .macro create_block_map, tbl, flags, phys, start, end, idmap=0 387 .macro create_block_map, tbl, flags, phys, start, end
388 lsr \phys, \phys, #BLOCK_SHIFT 388 lsr \phys, \phys, #BLOCK_SHIFT
389 .if \idmap
390 and \start, \phys, #PTRS_PER_PTE - 1 // table index
391 .else
392 lsr \start, \start, #BLOCK_SHIFT 389 lsr \start, \start, #BLOCK_SHIFT
393 and \start, \start, #PTRS_PER_PTE - 1 // table index 390 and \start, \start, #PTRS_PER_PTE - 1 // table index
394 .endif
395 orr \phys, \flags, \phys, lsl #BLOCK_SHIFT // table entry 391 orr \phys, \flags, \phys, lsl #BLOCK_SHIFT // table entry
396 .ifnc \start,\end
397 lsr \end, \end, #BLOCK_SHIFT 392 lsr \end, \end, #BLOCK_SHIFT
398 and \end, \end, #PTRS_PER_PTE - 1 // table end index 393 and \end, \end, #PTRS_PER_PTE - 1 // table end index
399 .endif
4009999: str \phys, [\tbl, \start, lsl #3] // store the entry 3949999: str \phys, [\tbl, \start, lsl #3] // store the entry
401 .ifnc \start,\end
402 add \start, \start, #1 // next entry 395 add \start, \start, #1 // next entry
403 add \phys, \phys, #BLOCK_SIZE // next block 396 add \phys, \phys, #BLOCK_SIZE // next block
404 cmp \start, \end 397 cmp \start, \end
405 b.ls 9999b 398 b.ls 9999b
406 .endif
407 .endm 399 .endm
408 400
409/* 401/*
@@ -435,9 +427,13 @@ __create_page_tables:
435 * Create the identity mapping. 427 * Create the identity mapping.
436 */ 428 */
437 add x0, x25, #PAGE_SIZE // section table address 429 add x0, x25, #PAGE_SIZE // section table address
438 adr x3, __turn_mmu_on // virtual/physical address 430 ldr x3, =KERNEL_START
431 add x3, x3, x28 // __pa(KERNEL_START)
439 create_pgd_entry x25, x0, x3, x5, x6 432 create_pgd_entry x25, x0, x3, x5, x6
440 create_block_map x0, x7, x3, x5, x5, idmap=1 433 ldr x6, =KERNEL_END
434 mov x5, x3 // __pa(KERNEL_START)
435 add x6, x6, x28 // __pa(KERNEL_END)
436 create_block_map x0, x7, x3, x5, x6
441 437
442 /* 438 /*
443 * Map the kernel image (starting with PHYS_OFFSET). 439 * Map the kernel image (starting with PHYS_OFFSET).
@@ -445,7 +441,7 @@ __create_page_tables:
445 add x0, x26, #PAGE_SIZE // section table address 441 add x0, x26, #PAGE_SIZE // section table address
446 mov x5, #PAGE_OFFSET 442 mov x5, #PAGE_OFFSET
447 create_pgd_entry x26, x0, x5, x3, x6 443 create_pgd_entry x26, x0, x5, x3, x6
448 ldr x6, =KERNEL_END - 1 444 ldr x6, =KERNEL_END
449 mov x3, x24 // phys offset 445 mov x3, x24 // phys offset
450 create_block_map x0, x7, x3, x5, x6 446 create_block_map x0, x7, x3, x5, x6
451 447