Multicore Processing

Description

Sound Open Firmware implements multicore processing so that the whole pipelines or single components are executed on the selected core. The core selection is done by the core field in struct sof_ipc_pipe_new or struct sof_ipc_comp during creation. The core value cannot exceed the number of cores on the current platform defined by CONFIG_MAX_CORE_COUNT.

struct sof_ipc_pipe_new {
   struct sof_ipc_hdr hdr;
   uint32_t comp_id;
   uint32_t pipeline_id;
   uint32_t sched_id;
   uint32_t core;
   uint32_t deadline;
   uint32_t priority;
   uint32_t mips;
   uint32_t frames_per_sched;
   uint32_t xrun_limit_usecs;
   uint32_t timer;
} __attribute__((packed));

struct sof_ipc_comp {
   struct sof_ipc_cmd_hdr hdr;
   uint32_t id;
   enum sof_comp_type type;
   uint32_t pipeline_id;
   uint32_t core;

   /** extended data length, 0 if no extended data (ABI3.17) */
   uint32_t ext_data_length;
} __attribute__((packed));

Core enablement

Cores are enabled and disabled by sending the SOF_IPC_PM_CORE_ENABLE IPC with the correct enable_mask. The core must be enabled before the pipeline trigger start happens and disabled after the pipeline trigger stop.

struct sof_ipc_pm_core_config {
   struct sof_ipc_hdr hdr;
   uint32_t enable_mask;
}

participant core0
participant core1
participant ipc
participant cpu
participant alloc
participant idc
participant init

core0 -> ipc : ipc_pm_core_enable(header)
   activate ipc

   ipc -> cpu : cpu_enable_core(core_id)
      activate cpu

      cpu -> alloc : alloc_core_context(core_id)
         activate alloc
      cpu <-- alloc
      deactivate alloc

      cpu -> idc : idc_enable_interrupts(core_id)
         activate idc
      cpu <-- idc
      cpu-> idc : arch_idc_send_msg(power_up, IDC_NON_BLOCKING)
      cpu <-- idc
      deactivate idc

   ipc <-- cpu
   deactivate cpu

core0 <-- ipc
deactivate ipc

core1 -> init : slave_core_init()
   activate init
init <-- core1
deactivate init

Note

The kernel also needs to enable cores on the host side, before even sending the SOF_IPC_PM_CORE_ENABLE IPC to the FW. For details on how to specify the DSP core in the topology file, refer to the topology documentation, DSP Core Index.