arch: rename arch_start_cpu() to arch_cpu_start()

Rename arch_start_cpu() to arch_cpu_start() so it belongs to
the "cpu" namespace.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2023-11-08 09:05:17 -08:00 committed by Fabio Baltieri
parent 3664ed64c3
commit 6ea749de52
14 changed files with 19 additions and 17 deletions

View file

@ -39,7 +39,7 @@ volatile char *arc_cpu_sp;
volatile _cpu_t *_curr_cpu[CONFIG_MP_MAX_NUM_CPUS]; volatile _cpu_t *_curr_cpu[CONFIG_MP_MAX_NUM_CPUS];
/* Called from Zephyr initialization */ /* Called from Zephyr initialization */
void arch_start_cpu(int cpu_num, k_thread_stack_t *stack, int sz, void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz,
arch_cpustart_t fn, void *arg) arch_cpustart_t fn, void *arg)
{ {
_curr_cpu[cpu_num] = &(_kernel.cpus[cpu_num]); _curr_cpu[cpu_num] = &(_kernel.cpus[cpu_num]);
@ -114,7 +114,7 @@ void arch_secondary_cpu_init(int cpu_num)
DT_IRQ(DT_NODELABEL(ici), priority), 0); DT_IRQ(DT_NODELABEL(ici), priority), 0);
irq_enable(DT_IRQN(DT_NODELABEL(ici))); irq_enable(DT_IRQN(DT_NODELABEL(ici)));
#endif #endif
/* call the function set by arch_start_cpu */ /* call the function set by arch_cpu_start */
fn = arc_cpu_init[cpu_num].fn; fn = arc_cpu_init[cpu_num].fn;
fn(arc_cpu_init[cpu_num].arg); fn(arc_cpu_init[cpu_num].arg);

View file

@ -90,7 +90,7 @@ extern int z_arm_mmu_init(void);
#endif #endif
/* Called from Zephyr initialization */ /* Called from Zephyr initialization */
void arch_start_cpu(int cpu_num, k_thread_stack_t *stack, int sz, arch_cpustart_t fn, void *arg) void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz, arch_cpustart_t fn, void *arg)
{ {
int cpu_count, i, j; int cpu_count, i, j;
uint32_t cpu_mpid = 0; uint32_t cpu_mpid = 0;

View file

@ -62,7 +62,7 @@ static uint64_t cpu_map[CONFIG_MP_MAX_NUM_CPUS] = {
extern void z_arm64_mm_init(bool is_primary_core); extern void z_arm64_mm_init(bool is_primary_core);
/* Called from Zephyr initialization */ /* Called from Zephyr initialization */
void arch_start_cpu(int cpu_num, k_thread_stack_t *stack, int sz, void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz,
arch_cpustart_t fn, void *arg) arch_cpustart_t fn, void *arg)
{ {
int cpu_count; int cpu_count;

View file

@ -27,7 +27,7 @@ extern void __start(void);
void soc_interrupt_init(void); void soc_interrupt_init(void);
#endif #endif
void arch_start_cpu(int cpu_num, k_thread_stack_t *stack, int sz, void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz,
arch_cpustart_t fn, void *arg) arch_cpustart_t fn, void *arg)
{ {
riscv_cpu_init[cpu_num].fn = fn; riscv_cpu_init[cpu_num].fn = fn;

View file

@ -138,7 +138,7 @@ struct x86_cpuboot x86_cpuboot[] = {
* will enter the kernel at fn(arg), running on the specified stack. * will enter the kernel at fn(arg), running on the specified stack.
*/ */
void arch_start_cpu(int cpu_num, k_thread_stack_t *stack, int sz, void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz,
arch_cpustart_t fn, void *arg) arch_cpustart_t fn, void *arg)
{ {
#if CONFIG_MP_MAX_NUM_CPUS > 1 #if CONFIG_MP_MAX_NUM_CPUS > 1

View file

@ -132,7 +132,7 @@ happens on a single CPU before other CPUs are brought online.
Just before entering the application :c:func:`main` function, the kernel Just before entering the application :c:func:`main` function, the kernel
calls :c:func:`z_smp_init` to launch the SMP initialization process. This calls :c:func:`z_smp_init` to launch the SMP initialization process. This
enumerates over the configured CPUs, calling into the architecture enumerates over the configured CPUs, calling into the architecture
layer using :c:func:`arch_start_cpu` for each one. This function is layer using :c:func:`arch_cpu_start` for each one. This function is
passed a memory region to use as a stack on the foreign CPU (in passed a memory region to use as a stack on the foreign CPU (in
practice it uses the area that will become that CPU's interrupt practice it uses the area that will become that CPU's interrupt
stack), the address of a local :c:func:`smp_init_top` callback function to stack), the address of a local :c:func:`smp_init_top` callback function to

View file

@ -309,7 +309,7 @@
id="tspan3682" id="tspan3682"
x="33.970718" x="33.970718"
y="46.338062" y="46.338062"
style="stroke-width:0.34572953">arch_start_cpu()</tspan></text> style="stroke-width:0.34572953">arch_cpu_start()</tspan></text>
<rect <rect
style="fill:#ffffaa;fill-opacity:1;stroke:#000000;stroke-width:0.32675847;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" style="fill:#ffffaa;fill-opacity:1;stroke:#000000;stroke-width:0.32675847;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect3686-7" id="rect3686-7"

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -196,6 +196,8 @@ Userspace
Architectures Architectures
************* *************
* Function :c:func:`arch_start_cpu` has been renamed to :c:func:`arch_cpu_start`.
* x86 * x86
* Kconfigs ``CONFIG_DISABLE_SSBD`` and ``CONFIG_ENABLE_EXTENDED_IBRS`` * Kconfigs ``CONFIG_DISABLE_SSBD`` and ``CONFIG_ENABLE_EXTENDED_IBRS``

View file

@ -238,7 +238,7 @@ typedef void (*arch_cpustart_t)(void *data);
* @param fn Function to begin running on the CPU. * @param fn Function to begin running on the CPU.
* @param arg Untyped argument to be passed to "fn" * @param arg Untyped argument to be passed to "fn"
*/ */
void arch_start_cpu(int cpu_num, k_thread_stack_t *stack, int sz, void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz,
arch_cpustart_t fn, void *arg); arch_cpustart_t fn, void *arg);
/** /**

View file

@ -156,7 +156,7 @@ static void start_cpu(int id, struct cpu_start_cb *csc)
(void)atomic_clear(&ready_flag); (void)atomic_clear(&ready_flag);
/* Power up the CPU */ /* Power up the CPU */
arch_start_cpu(id, z_interrupt_stacks[id], CONFIG_ISR_STACK_SIZE, arch_cpu_start(id, z_interrupt_stacks[id], CONFIG_ISR_STACK_SIZE,
smp_init_top, csc); smp_init_top, csc);
/* Wait until the newly powered up CPU to signal that /* Wait until the newly powered up CPU to signal that

View file

@ -243,7 +243,7 @@ IRAM_ATTR static void esp_crosscore_isr(void *arg)
} }
} }
void arch_start_cpu(int cpu_num, k_thread_stack_t *stack, int sz, void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz,
arch_cpustart_t fn, void *arg) arch_cpustart_t fn, void *arg)
{ {
volatile struct cpustart_rec sr; volatile struct cpustart_rec sr;

View file

@ -107,7 +107,7 @@ static __imr void __used z_mp_entry(void)
soc_mp_startup(start_rec.cpu); soc_mp_startup(start_rec.cpu);
soc_cpus_active[start_rec.cpu] = true; soc_cpus_active[start_rec.cpu] = true;
start_rec.fn(start_rec.arg); start_rec.fn(start_rec.arg);
__ASSERT(false, "arch_start_cpu() handler should never return"); __ASSERT(false, "arch_cpu_start() handler should never return");
} }
void mp_resume_entry(void) void mp_resume_entry(void)
@ -120,7 +120,7 @@ bool arch_cpu_active(int cpu_num)
return soc_cpus_active[cpu_num]; return soc_cpus_active[cpu_num];
} }
void arch_start_cpu(int cpu_num, k_thread_stack_t *stack, int sz, void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz,
arch_cpustart_t fn, void *arg) arch_cpustart_t fn, void *arg)
{ {
__ASSERT_NO_MSG(!soc_cpus_active[cpu_num]); __ASSERT_NO_MSG(!soc_cpus_active[cpu_num]);

View file

@ -76,7 +76,7 @@ FUNC_NORETURN void cpu_fn(void *arg)
* *
* Test Procedure: * Test Procedure:
* -# In main thread, given and set a global variable cpu_arg to 12345. * -# In main thread, given and set a global variable cpu_arg to 12345.
* -# Call arch_start_cpu() with parameters * -# Call arch_cpu_start() with parameters
* -# Enter a while loop and wait for cpu_running equals to 1. * -# Enter a while loop and wait for cpu_running equals to 1.
* -# In target function, check if the address is &cpu_arg and its content * -# In target function, check if the address is &cpu_arg and its content
* equal to 12345. * equal to 12345.
@ -94,7 +94,7 @@ FUNC_NORETURN void cpu_fn(void *arg)
* - This test using for the platform that support MP or SMP, in our current * - This test using for the platform that support MP or SMP, in our current
* scenario which own over two CPUs. * scenario which own over two CPUs.
* *
* @see arch_start_cpu() * @see arch_cpu_start()
*/ */
ZTEST(multiprocessing, test_mp_start) ZTEST(multiprocessing, test_mp_start)
{ {
@ -105,7 +105,7 @@ ZTEST(multiprocessing, test_mp_start)
cpu_arg = 12345 * i; cpu_arg = 12345 * i;
arch_start_cpu(i, cpu_stacks[i], CPU_STACK_SIZE, cpu_fn, &cpu_arg); arch_cpu_start(i, cpu_stacks[i], CPU_STACK_SIZE, cpu_fn, &cpu_arg);
/* Wait for about 5 (500 * 10ms) seconds for CPU to start. */ /* Wait for about 5 (500 * 10ms) seconds for CPU to start. */
wait_count = 500; wait_count = 500;

View file

@ -122,7 +122,7 @@ static void cpu1_fn(void *p1, void *p2, void *p3)
* *
* @ingroup kernel_spinlock_tests * @ingroup kernel_spinlock_tests
* *
* @see arch_start_cpu() * @see arch_cpu_start()
*/ */
ZTEST(spinlock, test_spinlock_bounce) ZTEST(spinlock, test_spinlock_bounce)
{ {