Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Architecture-specific SMP APIs

Typedefs

typedef void(* arch_cpustart_t) (void *data)
 Per-cpu entry function.
 

Functions

void arch_cpu_start (int cpu_num, k_thread_stack_t *stack, int sz, arch_cpustart_t fn, void *arg)
 Start a numbered CPU on a MP-capable system.
 
bool arch_cpu_active (int cpu_num)
 Return CPU power status.
 
static struct _cpu * arch_curr_cpu (void)
 Return the CPU struct for the currently executing CPU.
 
static uint32_t arch_proc_id (void)
 Processor hardware ID.
 
void arch_sched_broadcast_ipi (void)
 Broadcast an interrupt to all CPUs.
 
void arch_sched_directed_ipi (uint32_t cpu_bitmap)
 Direct IPIs to the specified CPUs.
 
int arch_smp_init (void)
 
static unsigned int arch_num_cpus (void)
 Returns the number of CPUs.
 

Detailed Description

Typedef Documentation

◆ arch_cpustart_t

typedef void(* arch_cpustart_t) (void *data)

#include <zephyr/arch/arch_interface.h>

Per-cpu entry function.

Parameters
datacontext parameter, implementation specific

Function Documentation

◆ arch_cpu_active()

bool arch_cpu_active ( int cpu_num)

#include <zephyr/arch/arch_interface.h>

Return CPU power status.

Parameters
cpu_numInteger number of the CPU

◆ arch_cpu_start()

void arch_cpu_start ( int cpu_num,
k_thread_stack_t * stack,
int sz,
arch_cpustart_t fn,
void * arg )

#include <zephyr/arch/arch_interface.h>

Start a numbered CPU on a MP-capable system.

This starts and initializes a specific CPU. The main thread on startup is running on CPU zero, other processors are numbered sequentially. On return from this function, the CPU is known to have begun operating and will enter the provided function. Its interrupts will be initialized but disabled such that irq_unlock() with the provided key will work to enable them.

Normally, in SMP mode this function will be called by the kernel initialization and should not be used as a user API. But it is defined here for special-purpose apps which want Zephyr running on one core and to use others for design-specific processing.

Parameters
cpu_numInteger number of the CPU
stackStack memory for the CPU
szStack buffer size, in bytes
fnFunction to begin running on the CPU.
argUntyped argument to be passed to "fn"

◆ arch_curr_cpu()

static struct _cpu * arch_curr_cpu ( void )
inlinestatic

#include <zephyr/arch/arch_interface.h>

Return the CPU struct for the currently executing CPU.

◆ arch_num_cpus()

static unsigned int arch_num_cpus ( void )
inlinestatic

#include <zephyr/arch/arch_interface.h>

Returns the number of CPUs.

For most systems this will be the same as CONFIG_MP_MAX_NUM_CPUS, however some systems may determine this at runtime instead.

Returns
the number of CPUs

◆ arch_proc_id()

static uint32_t arch_proc_id ( void )
inlinestatic

#include <zephyr/arch/arch_interface.h>

Processor hardware ID.

Most multiprocessor architectures have a low-level unique ID value associated with the current CPU that can be retrieved rapidly and efficiently in kernel context. Note that while the numbering of the CPUs is guaranteed to be unique, the values are platform-defined. In particular, they are not guaranteed to match Zephyr's own sequential CPU IDs (even though on some platforms they do).

Note
There is an inherent race with this API: the system may preempt the current thread and migrate it to another CPU before the value is used. Safe usage requires knowing the migration is impossible (e.g. because the code is in interrupt context, holds a spinlock, or cannot migrate due to k_cpu_mask state).
Returns
Unique ID for currently-executing CPU

◆ arch_sched_broadcast_ipi()

void arch_sched_broadcast_ipi ( void )

#include <zephyr/arch/arch_interface.h>

Broadcast an interrupt to all CPUs.

This will invoke z_sched_ipi() on all other CPUs in the system.

◆ arch_sched_directed_ipi()

void arch_sched_directed_ipi ( uint32_t cpu_bitmap)

#include <zephyr/arch/arch_interface.h>

Direct IPIs to the specified CPUs.

This will invoke z_sched_ipi() on the CPUs identified by cpu_bitmap.

Parameters
cpu_bitmapA bitmap indicating which CPUs need the IPI

◆ arch_smp_init()

int arch_smp_init ( void )