aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/efi-entry.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64/kernel/efi-entry.S')
-rw-r--r--arch/arm64/kernel/efi-entry.S27
1 files changed, 21 insertions, 6 deletions
diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S
index 619b1dd7bcde..d18a44940968 100644
--- a/arch/arm64/kernel/efi-entry.S
+++ b/arch/arm64/kernel/efi-entry.S
@@ -54,18 +54,17 @@ ENTRY(efi_stub_entry)
54 b.eq efi_load_fail 54 b.eq efi_load_fail
55 55
56 /* 56 /*
57 * efi_entry() will have relocated the kernel image if necessary 57 * efi_entry() will have copied the kernel image if necessary and we
58 * and we return here with device tree address in x0 and the kernel 58 * return here with device tree address in x0 and the kernel entry
59 * entry point stored at *image_addr. Save those values in registers 59 * point stored at *image_addr. Save those values in registers which
60 * which are callee preserved. 60 * are callee preserved.
61 */ 61 */
62 mov x20, x0 // DTB address 62 mov x20, x0 // DTB address
63 ldr x0, [sp, #16] // relocated _text address 63 ldr x0, [sp, #16] // relocated _text address
64 mov x21, x0 64 mov x21, x0
65 65
66 /* 66 /*
67 * Flush dcache covering current runtime addresses 67 * Calculate size of the kernel Image (same for original and copy).
68 * of kernel text/data. Then flush all of icache.
69 */ 68 */
70 adrp x1, _text 69 adrp x1, _text
71 add x1, x1, #:lo12:_text 70 add x1, x1, #:lo12:_text
@@ -73,9 +72,24 @@ ENTRY(efi_stub_entry)
73 add x2, x2, #:lo12:_edata 72 add x2, x2, #:lo12:_edata
74 sub x1, x2, x1 73 sub x1, x2, x1
75 74
75 /*
76 * Flush the copied Image to the PoC, and ensure it is not shadowed by
77 * stale icache entries from before relocation.
78 */
76 bl __flush_dcache_area 79 bl __flush_dcache_area
77 ic ialluis 80 ic ialluis
78 81
82 /*
83 * Ensure that the rest of this function (in the original Image) is
84 * visible when the caches are disabled. The I-cache can't have stale
85 * entries for the VA range of the current image, so no maintenance is
86 * necessary.
87 */
88 adr x0, efi_stub_entry
89 adr x1, efi_stub_entry_end
90 sub x1, x1, x0
91 bl __flush_dcache_area
92
79 /* Turn off Dcache and MMU */ 93 /* Turn off Dcache and MMU */
80 mrs x0, CurrentEL 94 mrs x0, CurrentEL
81 cmp x0, #CurrentEL_EL2 95 cmp x0, #CurrentEL_EL2
@@ -105,4 +119,5 @@ efi_load_fail:
105 ldp x29, x30, [sp], #32 119 ldp x29, x30, [sp], #32
106 ret 120 ret
107 121
122efi_stub_entry_end:
108ENDPROC(efi_stub_entry) 123ENDPROC(efi_stub_entry)