Skip to content
Open
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
24 changes: 22 additions & 2 deletions app/boards/intel_adsp_ace30_ptl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL=n
CONFIG_PROBE=y
CONFIG_PROBE_DMA_MAX=2
CONFIG_SOF_TELEMETRY=y
CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS=y
CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS=y
CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS=n
CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS=n
CONFIG_COLD_STORE_EXECUTE_DRAM=y

# SOF / loadable modules
Expand Down Expand Up @@ -83,3 +83,23 @@ CONFIG_SOF_USERSPACE_PROXY=y
CONFIG_MAX_THREAD_BYTES=3

CONFIG_MAX_DOMAIN_PARTITIONS=32

# Userspace LL (was app/overlays/ptl/ll_userspace_overlay.conf)
# Run Low-Latency audio pipelines in user-space threads by default.
CONFIG_SOF_USERSPACE_LL=y
CONFIG_SOF_USERSPACE_INTERFACE_DMA=y
CONFIG_DAI_USERSPACE=y

# Settings currently required to enable user-space LL. The cold-store,
# telemetry, loadable-module and misc feature disables above/here are not
# yet user-space compatible (see the former overlay for rationale).
CONFIG_COLD_STORE_EXECUTE_DEBUG=n
CONFIG_SOF_BOOT_TEST_ALLOWED=n
CONFIG_CROSS_CORE_STREAM=n
CONFIG_INTEL_ADSP_MIC_PRIVACY=n
CONFIG_XRUN_NOTIFICATIONS_ENABLE=n
# Extend the shared LL user-space heap to 0.5MB. This
# is current maximum for PTL builds with virtual heap
# enabled and uses the vmh allocation intended for KBP.
# TODO: needs some better solution to allocate
CONFIG_SOF_ZEPHYR_SYS_USER_HEAP_SIZE=0x80000
37 changes: 35 additions & 2 deletions app/boards/intel_adsp_ace30_wcl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL=n
CONFIG_PROBE=y
CONFIG_PROBE_DMA_MAX=2
CONFIG_SOF_TELEMETRY=y
CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS=y
CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS=y
CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS=n
CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS=n
CONFIG_COLD_STORE_EXECUTE_DRAM=y

# SOF / loadable modules
Expand Down Expand Up @@ -69,3 +69,36 @@ CONFIG_PM_DEVICE_RUNTIME_ASYNC=n
CONFIG_LOG_BACKEND_ADSP=n
CONFIG_LOG_FLUSH_SLEEP_US=5000
CONFIG_WINSTREAM_CONSOLE=n

# Userspace base (mirrored from intel_adsp_ace30_ptl.conf)
# Required so that user-space LL (below) can actually be enabled, since
# CONFIG_SOF_USERSPACE_LL depends on CONFIG_USERSPACE.
CONFIG_USERSPACE=y
CONFIG_DYNAMIC_THREAD=y
CONFIG_DYNAMIC_THREAD_ALLOC=y
CONFIG_DYNAMIC_THREAD_PREFER_ALLOC=y
CONFIG_SOF_STACK_SIZE=8192
CONFIG_SOF_USERSPACE_PROXY=y
CONFIG_MAX_THREAD_BYTES=3
CONFIG_MAX_DOMAIN_PARTITIONS=32
CONFIG_XTENSA_MMU_NUM_L2_TABLES=128

# Userspace LL (was app/overlays/ptl/ll_userspace_overlay.conf)
# Run Low-Latency audio pipelines in user-space threads by default.
CONFIG_SOF_USERSPACE_LL=y
CONFIG_SOF_USERSPACE_INTERFACE_DMA=y
CONFIG_DAI_USERSPACE=y

# Settings currently required to enable user-space LL. The cold-store,
# telemetry, loadable-module and misc feature disables above/here are not
# yet user-space compatible (see the former overlay for rationale).
CONFIG_COLD_STORE_EXECUTE_DEBUG=n
CONFIG_SOF_BOOT_TEST_ALLOWED=n
CONFIG_CROSS_CORE_STREAM=n
CONFIG_INTEL_ADSP_MIC_PRIVACY=n
CONFIG_XRUN_NOTIFICATIONS_ENABLE=n
# Extend the shared LL user-space heap to 0.5MB. This
# is current maximum for WCL builds with virtual heap
# enabled and uses the vmh allocation intended for KBP.
# TODO: needs some better solution to allocate
CONFIG_SOF_ZEPHYR_SYS_USER_HEAP_SIZE=0x80000
14 changes: 7 additions & 7 deletions app/overlays/ptl/ll_userspace_overlay.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ CONFIG_SOF_USERSPACE_LL=y
# make the drivers work in user-space
CONFIG_SOF_USERSPACE_INTERFACE_DMA=y
CONFIG_DAI_USERSPACE=y
CONFIG_MAX_THREAD_BYTES=4

# Temporary settings that are needed currently to enable user-space LL
# --------------------------------------------------------------------

# problem with DSP panics due to illegal instruction hit in user-space if cold
# store execution is enabled. Disable it for now until rootcause is found.
CONFIG_COLD_STORE_EXECUTE_DRAM=n
CONFIG_COLD_STORE_EXECUTE_DEBUG=n

# telemetry not yet user-space compatible
CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS=n
CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS=n

# disable loadable modules (hits privilege issues in user-space now)
CONFIG_LLEXT_STORAGE_WRITABLE=n
CONFIG_LLEXT_EXPERIMENTAL=n
CONFIG_MODULES=n

# some of current boot tests interfere with user-space setup
CONFIG_SOF_BOOT_TEST_ALLOWED=n

# misc features not yet compatible with user-space
CONFIG_CROSS_CORE_STREAM=n
CONFIG_INTEL_ADSP_MIC_PRIVACY=n
CONFIG_XRUN_NOTIFICATIONS_ENABLE=n
CONFIG_ZEPHYR_DP_SCHEDULER=n

# Extend the shared LL user-space heap to 0.5MB. This
# is current maximum for PTL builds with virtual heap
# enabled and uses the vmh allocation intended for KBP.
# TODO: needs some better solution to allocate
CONFIG_SOF_ZEPHYR_SYS_USER_HEAP_SIZE=0x80000
4 changes: 2 additions & 2 deletions src/audio/tdfb/tdfb_direction.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@
* from output files tdfb_iir_emphasis_48k.h and tdfb_iir_emphasis_16k.h.
*/

uint32_t iir_emphasis_48k[20] = {
static const uint32_t iir_emphasis_48k[20] = {
0x00000002, 0x00000002, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0xc8cf47b5, 0x7689916a,
0x1dc95968, 0xc46d4d30, 0x1dc95968, 0x00000000,
0x00004000, 0xe16f20ea, 0x51e57f66, 0x01966267,
0x032cc4ce, 0x01966267, 0xfffffffe, 0x00004222
};

uint32_t iir_emphasis_16k[20] = {
static const uint32_t iir_emphasis_16k[20] = {
0x00000002, 0x00000002, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0xd6f418ae, 0x63e7b85c,
0x19ae069b, 0xcca3f2ca, 0x19ae069b, 0x00000000,
Expand Down
8 changes: 8 additions & 0 deletions src/include/ipc4/handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ struct ipc4_message_request;
*/
int ipc4_user_process_module_message(struct ipc4_message_request *ipc4, struct ipc_msg *reply);

/**
* \brief Load a dynamically loadable module.
* @param[in] drv Component driver.
* @param[in] mi SOF_IPC4_MOD_INIT_INSTANCE data
*/
int ipc4_user_module_load(const struct comp_driver *drv,
const struct ipc4_module_init_instance *mi);

/**
* @brief Process MOD_CONFIG_GET or MOD_CONFIG_SET in any execution context.
* @param[in] ipc4 IPC4 message request.
Expand Down
28 changes: 24 additions & 4 deletions src/include/sof/ipc/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,16 @@ extern struct tr_ctx ipc_tr;
#define IPC_TASK_SECONDARY_CORE BIT(2)
#define IPC_TASK_POWERDOWN BIT(3)

#ifdef CONFIG_CORE_COUNT
#define CORE_COUNT CONFIG_CORE_COUNT
#else
#define CORE_COUNT 1
#endif

struct ipc_user {
struct k_thread *thread;
struct k_thread *thread[CORE_COUNT];
struct k_sem *sem;
struct k_event *event;
struct k_event *event[CORE_COUNT];
/** @brief Copy of IPC4 message primary word forwarded to user thread */
uint32_t ipc_msg_pri;
/** @brief Copy of IPC4 message extension word forwarded to user thread */
Expand All @@ -73,9 +79,10 @@ struct ipc_user {
/** @brief Reply TX data pointer from user thread (e.g. LARGE_CONFIG_GET result) */
void *reply_tx_data;
struct ipc *ipc;
struct k_thread *audio_thread;
struct k_thread *audio_thread[CORE_COUNT];
/** @brief Original kernel driver pointer for restoring dev->drv after create */
const struct comp_driver *init_drv;
bool init_needed[CORE_COUNT];
/**
* @brief User-accessible copy of comp_driver + tr_ctx for create().
*
Expand Down Expand Up @@ -326,7 +333,7 @@ extern bool ipc_enter_gdb;
* @param extension Extension message word
* @return Result code from user thread processing
*/
int ipc_user_forward_cmd(uint32_t primary, uint32_t extension);
int ipc_user_forward_cmd(uint32_t primary, uint32_t extension, unsigned int core);

/**
* @brief Protocol-specific dispatch of a forwarded IPC command.
Expand All @@ -338,6 +345,19 @@ int ipc_user_forward_cmd(uint32_t primary, uint32_t extension);
* @return Result code to report back to the host
*/
int ipc_user_thread_dispatch(struct ipc_user *ipc_user);

/**
* @brief Initialize IPC and LL scheduler threads on a booting secondary core.
*
* @param core Secondary core ID
* @return 0 or a negative error code
*/
int ipc_user_init_secondary(unsigned int core);
#endif

/**
* \brief get pointer to the userspace IPC thread for core
*/
struct k_thread *ipc_thread_user(unsigned int core);

#endif /* __SOF_DRIVERS_IPC_H__ */
19 changes: 19 additions & 0 deletions src/include/sof/lib_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,25 @@ void lib_manager_get_instance_bss_address(uint32_t instance_id,
*/
int lib_manager_load_library(uint32_t dma_id, uint32_t lib_id, uint32_t type);

struct userspace_context;
/*
* \brief Allocate the module and start the agent if needed
*/
int lib_manager_mod_create_priv(const struct comp_driver *drv,
const struct comp_ipc_config *config,
const void *spec, void **adapter_priv,
struct userspace_context **userspace,
const struct module_interface **ops);

#if defined(__ZEPHYR__) && defined(CONFIG_SOF_FULL_ZEPHYR_APPLICATION)
__syscall int lib_manager_free_module(const uint32_t component_id);

#include <zephyr/syscalls/lib_manager.h>
#else
int z_impl_lib_manager_free_module(const uint32_t component_id);
#define lib_manager_free_module z_impl_lib_manager_free_module
#endif

/*
* \brief Initialize message
*
Expand Down
12 changes: 11 additions & 1 deletion src/init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <rtos/init.h>
#include <rtos/interrupt.h>
#include <sof/init.h>
#include <sof/ipc/common.h>
#include <sof/lib/cpu.h>
#include <sof/lib/cpu-clk-manager.h>
#include <sof/lib/memory.h>
Expand Down Expand Up @@ -110,6 +111,9 @@ static inline int secondary_core_restore(void) { return 0; };

__cold int secondary_core_init(struct sof *sof)
{
#if CONFIG_SOF_USERSPACE_LL || CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL
unsigned int core = cpu_get_id();
#endif
int err;
struct ll_schedule_domain *dma_domain;

Expand All @@ -134,6 +138,12 @@ __cold int secondary_core_init(struct sof *sof)
if (dma_domain)
scheduler_init_ll(dma_domain);

#if CONFIG_SOF_USERSPACE_LL
err = ipc_user_init_secondary(core);
if (err < 0)
return err;
#endif

#if CONFIG_ZEPHYR_DP_SCHEDULER
err = scheduler_dp_init();
if (err < 0)
Expand All @@ -152,7 +162,7 @@ __cold int secondary_core_init(struct sof *sof)
return err;
#endif
#if CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL
err = core_kcps_adjust(cpu_get_id(), SECONDARY_CORE_BASE_CPS_USAGE);
err = core_kcps_adjust(core, SECONDARY_CORE_BASE_CPS_USAGE);
if (err < 0)
return err;
#endif
Expand Down
Loading
Loading