Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions src/include/ipc4/handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
#ifndef __SOF_IPC4_HANDLER_H__
#define __SOF_IPC4_HANDLER_H__

struct comp_dev;
struct comp_driver;
struct ipc4_message_request;
struct ipc4_pipeline_set_state;

/**
* \brief Processes an IPC4 userspace module message.
Expand Down Expand Up @@ -69,6 +72,73 @@ int ipc4_user_process_glb_message(struct ipc4_message_request *ipc4, struct ipc_
*/
int ipc4_set_pipeline_state(struct ipc4_message_request *ipc4);

/**
* \brief Get the first pipeline ID of a SET_PIPELINE_STATE message.
* \ingroup ipc4_envelope_api
* @param[in] ipc4 IPC4 message request structure.
* @param[in] state Copy of the SET_PIPELINE_STATE message header.
* @param[out] ppl_id Receives the pipeline ID array of a multi-pipeline
* message, NULL otherwise (may be NULL).
* @param[out] ppl_count Receives the number of pipelines (may be NULL).
* @return The first pipeline ID, or a negative error code.
*/
int ipc4_pipeline_id_get(struct ipc4_message_request *ipc4,
struct ipc4_pipeline_set_state *state,
const uint32_t **ppl_id, unsigned int *ppl_count);

/**
* \brief Copy the kcontrol payload header of a LARGE_CONFIG_GET from the hostbox.
* \ingroup ipc4_envelope_api
* @param[in] dev Target component, NULL for the base firmware.
* @param[in] param_id Large config parameter ID.
* @param[out] data_out Reply data buffer.
* @param[in] data_size Size of the payload in the hostbox.
*/
void ipc4_prepare_for_kcontrol_get(struct comp_dev *dev, uint8_t param_id,
char *data_out, uint32_t data_size);

/**
* \brief Process a vendor config LARGE_CONFIG_GET.
* \ingroup ipc4_envelope_api
* @param[in] dev Target component, NULL for the base firmware.
* @param[in] drv Component driver.
* @param[in] init_block True for the first block.
* @param[in] final_block True for the last block.
* @param[in,out] data_off_size Payload size in, reply data size out.
* @param[out] data_out Reply data buffer.
* @param[in] data_in Request payload.
* @return IPC4 status code (IPC4_SUCCESS on success).
*/
int ipc4_get_vendor_config_module_instance(struct comp_dev *dev,
const struct comp_driver *drv,
bool init_block,
bool final_block,
uint32_t *data_off_size,
char *data_out,
const char *data_in);

/**
* \brief Process a vendor config LARGE_CONFIG_SET.
* \ingroup ipc4_envelope_api
* @param[in] dev Target component, NULL for the base firmware.
* @param[in] drv Component driver.
* @param[in] module_id Module ID, for error messages.
* @param[in] instance_id Instance ID, for error messages.
* @param[in] init_block True for the first block.
* @param[in] final_block True for the last block.
* @param[in] data_off_size Payload size.
* @param[in] data Request payload.
* @return IPC4 status code (IPC4_SUCCESS on success).
*/
int ipc4_set_vendor_config_module_instance(struct comp_dev *dev,
const struct comp_driver *drv,
uint32_t module_id,
uint32_t instance_id,
bool init_block,
bool final_block,
uint32_t data_off_size,
const char *data);

/**
* \brief Complete an IPC compound message transaction and signal waiting threads.
* \ingroup ipc4_envelope_api
Expand Down
14 changes: 14 additions & 0 deletions src/include/sof/ipc/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,20 @@ void ipc_complete_cmd(struct ipc *ipc);
extern bool ipc_enter_gdb;

#ifdef CONFIG_SOF_USERSPACE_LL
/* Events that wake the user-space IPC thread */
#define IPC_USER_EVENT_CMD BIT(0)
#define IPC_USER_EVENT_STOP BIT(1)
#define IPC_USER_EVENT_XCORE BIT(2)

/**
* @brief User-space IPC thread entry point.
*
* @param p1 struct ipc_user shared with the kernel
* @param p2 Core ID
* @param p3 Unused
*/
void ipc_user_thread_fn(void *p1, void *p2, void *p3);

/**
* @brief Forward an IPC command to the user-space thread and wait for it.
*
Expand Down
5 changes: 5 additions & 0 deletions src/include/sof/ipc/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ struct ipc_comp_dev;
const struct comp_driver *ipc4_get_comp_drv(uint32_t module_id);
struct comp_dev *ipc4_get_comp_dev(uint32_t comp_id);
int ipc4_add_comp_dev(struct comp_dev *dev);
struct comp_ipc_config;
int ipc4_comp_new_config(struct comp_ipc_config *ipc_config,
const struct ipc4_module_init_instance *module_init);
unsigned char *ipc4_get_comp_new_data(void);
int ipc_comp_free_remote(struct comp_dev *dev);
#ifdef CONFIG_SOF_USERSPACE_LL
struct ipc4_message_request;
struct comp_driver;
Expand Down
12 changes: 8 additions & 4 deletions src/ipc/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Inter-Processor Communication (IPC) Core Architecture

> **Runs in:** Boundary / bridge — the kernel receives and dispatches IPC, then forwards
> module-facing commands to a user thread. The split is visible in the file names
> (`src/kernel/ipc/ipc4/handler-kernel.c` vs `ipc4/handler-user.c`,
> `ipc4/notification-user.c`), and this subsystem hosts the `ipc_msg_*`, `ipc_compound_*` and
> `send_resource_notif` syscalls. See
> module-facing commands to a user thread. The kernel halves of the mixed files are in
> `src/kernel/ipc` (`ipc-common-kernel.c`, `ipc4/handler-kernel.c`,
> `ipc4/handler-user-kernel.c`, `ipc4/handler-ll-user.c`, `ipc4/handler-ll-kernel.c`,
> `ipc4/helper-kernel.c`), the user halves stay here (`ipc-common.c`, `ipc4/handler-user.c`,
> `ipc4/helper.c`, `ipc4/notification-user.c`), and this subsystem hosts the `ipc_msg_*`,
> `ipc_compound_*` and `send_resource_notif` syscalls. Which IPC4 messages are handled in the
> kernel, in user space or in both is listed in
> [IPC4 User/Kernel Partitioning](ipc4/README.md#userkernel-partitioning). See also
> [User/kernel split](../include/sof/userspace/README.md).

This directory contains the common foundation for all Inter-Processor Communication (IPC) within the Sound Open Firmware (SOF) project. It bridges the gap between hardware mailbox interrupts and the version-specific (IPC3/IPC4) message handlers.
Expand Down
Loading
Loading