-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prepare for dynamic boot configuration #7233
base: master
Are you sure you want to change the base?
Conversation
83621b2
to
56fece1
Compare
Update to fix the checkpatch issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For " core: arm: entry_a32.S: use ldr over adr":
Reviewed-by: Jerome Forissier <[email protected]>
56fece1
to
704c04d
Compare
Rebased on master and tag applied. |
704c04d
to
036ac13
Compare
Rebased to resolve a conflict. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-by: Etienne Carriere <[email protected]>
for commits:
"core: arm: entry_a32.S: use ldr over adr",
"core: thread: get stacks from recorded end-va",
"core: thread: initialize stack canaries from recorded end-va" and
"core: arm32: initialize secure monitor late" (period missing in commit message).
Acked-by: Etienne Carriere <[email protected]>
for commit
"core: arm: refactor boot".
core/arch/arm/kernel/boot.c
Outdated
@@ -1077,14 +1081,7 @@ void __weak boot_init_primary_late(unsigned long fdt __unused, | |||
thread_set_exceptions(thread_get_exceptions() | | |||
THREAD_EXCP_NATIVE_INTR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking: since the rebase operation, would it be worth simplifying the native interrupt unmask sequence here?
boot_primary_init_intc();
init_vfp_nsec();
+ /* Unmask native interrupts during initcalls */
+ thread_set_exceptions(thread_get_exceptions() &
+ ~THREAD_EXCP_NATIVE_INTR);
+
if (!IS_ENABLED(CFG_NS_VIRTUALIZATION)) {
- /* Unmask native interrupts during driver initcalls */
- thread_set_exceptions(thread_get_exceptions() &
- ~THREAD_EXCP_NATIVE_INTR);
init_tee_runtime();
- thread_set_exceptions(thread_get_exceptions() |
- THREAD_EXCP_NATIVE_INTR);
}
if (!IS_ENABLED(CFG_WITH_PAGER))
boot_mem_release_tmp_alloc();
- /* Unmask native interrupts during init/finalcalls */
- thread_set_exceptions(thread_get_exceptions() &
- ~THREAD_EXCP_NATIVE_INTR);
-
if (!IS_ENABLED(CFG_NS_VIRTUALIZATION))
call_driver_initcalls();
call_finalcalls();
IMSG("Primary CPU switching to normal world boot");
thread_set_exceptions(thread_get_exceptions() |
THREAD_EXCP_NATIVE_INTR);
}
Likely for a specific commit or P-R.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll add a commit on top.
Hmm, I just realized that we can't have native interrupts unmasked for virtualization since we're still on the tmp stack then. I'll fix that in the "optimization" commit.
core/kernel/thread.c
Outdated
@@ -496,6 +516,7 @@ void __nostackcheck thread_init_core_local_stacks(void) | |||
tcl[n].abt_stack_va_end = GET_STACK_BOTTOM(stack_abt, n); | |||
} | |||
} | |||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: #endif /*CFG_BOOT_INIT_THREAD_CORE_LOCAL0*/
core/kernel/thread.c
Outdated
@@ -195,20 +229,24 @@ static void print_stack_limits(void) | |||
size_t n = 0; | |||
vaddr_t __maybe_unused start = 0; | |||
vaddr_t __maybe_unused end = 0; | |||
vaddr_t va; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
= 0
mk/config.mk
Outdated
@@ -1265,10 +1265,14 @@ CFG_CORE_UNSAFE_MODEXP ?= n | |||
CFG_TA_MEBDTLS_UNSAFE_MODEXP ?= n | |||
|
|||
# CFG_BOOT_MEM, when enabled, adds stack like memory allocation during boot. | |||
# CFG_BOOT_INIT_THREAD_CORE_LOCAL0, when enabled, initialize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/initialize/initializes/
Load address of reset_vect_table using ldr r0, =reset_vect_table, instead of adr r0 reset_vect_table to allow longer addressing range. Signed-off-by: Jens Wiklander <[email protected]> Reviewed-by: Jerome Forissier <[email protected]> Reviewed-by: Etienne Carriere <[email protected]>
Introduce CFG_BOOT_INIT_THREAD_CORE_LOCAL0 to indicate that thread_core_local[0] is initialized before the boot_init_* functions are called. thread_init_core_local_stacks() and thread_init_thread_core_local() are replaced by a new version of thread_init_thread_core_local() for CFG_BOOT_INIT_THREAD_CORE_LOCAL0=y. Move initialization of thread_core_local[] from very early to boot_init_primary_late() where various DTBs containing run-time configuration are available. This will be needed in later patches when the number of configured cores can be read from DT or some other run-time configuration. Move the "OP-TEE version" print and following code from boot_init_primary_late() to boot_init_primary_final() Signed-off-by: Jens Wiklander <[email protected]> Acked-by: Etienne Carriere <[email protected]>
Each stack has its end-va or top recorded in either thread_core_local[] or threads[] as tmp_stack_va_end, abt_stack_va_end, or stack_va_end. This address together with the known size of the stack is enough to calculate all the other needed stack related addresses: - start and end canaries, - top and bottom of the stacks. Add and use new internal functions to calculate these addresses and remove the now unused macros. This is needed in later patches where the stacks aren't statically allocated. INIT_CANARY(), GET_START_CANARY(), and GET_END_CANARY() are kept for now to see that the addresses for the canaries are calculated correctly in the new functions. Signed-off-by: Jens Wiklander <[email protected]> Reviewed-by: Etienne Carriere <[email protected]>
Continue where "core: thread: get stacks from recorded end-va" left and initialize the stack canaries based on the recorded end-va. This is needed in later patches where the stacks aren't statically allocated. Signed-off-by: Jens Wiklander <[email protected]> Reviewed-by: Etienne Carriere <[email protected]>
Initialize the secure monitor as late as possible before exiting to the normal world. This is needed in later patches where the stacks aren't statically allocated. Signed-off-by: Jens Wiklander <[email protected]> Reviewed-by: Etienne Carriere <[email protected]>
036ac13
to
096e3f2
Compare
Comments addressed, and tags applied. Added a new commit, "core: arm: boot: mask native interrupts for virtualization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-by: Etienne Carriere <[email protected]>
for commit
"core: arm: boot: mask native interrupts for virtualization".
Native interrupts are prior to this patch unmasked while processing initcalls. This is only permitted if the temporary stack isn't used. That's not true when CFG_NS_VIRTUALIZATION=y so fix this by only unmasking when NS-virtualization isn't enabled. Fixes: 259c34d ("core: arm: boot: enable native interrupts before initcalls") Signed-off-by: Jens Wiklander <[email protected]> Reviewed-by: Etienne Carriere <[email protected]>
096e3f2
to
f7f3608
Compare
Tag applied. |
No description provided.