Skip to content

Commit

Permalink
core: arm: boot: enable native interrupts before initcalls
Browse files Browse the repository at this point in the history
Enable native interrupts on Arm architectures when executing
initcalls (early,service,driver,final). This change allows drivers
to leverage interrupts during OP-TEE core initialization, as for example
detecting a firewall access violation when it occurs. Before this change,
OP-TEE needed to complete its initialization and return the secure
monitor for secure interrupts to be handled.

Note that when CFG_NS_VIRTUALIZATION is enabled, initcalls called from
virt_on_stdcall() is not changed here since they are executing from a
standard call entry hence with native and foreign interrupts already
default unmasked.

Signed-off-by: Etienne Carriere <[email protected]>
Reviewed-by: Jens Wiklander <[email protected]>
  • Loading branch information
etienne-lms authored and jforissier committed Feb 6, 2025
1 parent bb7ce54 commit 259c34d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion core/arch/arm/kernel/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,8 +1069,14 @@ void __weak boot_init_primary_late(unsigned long fdt __unused,

boot_primary_init_intc();
init_vfp_nsec();
if (!IS_ENABLED(CFG_NS_VIRTUALIZATION))
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);
}
}

/*
Expand All @@ -1082,10 +1088,19 @@ void __weak boot_init_primary_final(void)
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);
}

static void init_secondary_helper(unsigned long nsec_entry)
Expand Down

0 comments on commit 259c34d

Please sign in to comment.