Skip to content

Commit

Permalink
Merge branch 'thesofproject:main' into gb_branch_1
Browse files Browse the repository at this point in the history
  • Loading branch information
gbernatxintel authored Apr 15, 2024
2 parents b47596f + 2810090 commit da25211
Show file tree
Hide file tree
Showing 27 changed files with 707 additions and 54 deletions.
3 changes: 3 additions & 0 deletions app/boards/intel_adsp_ace15_mtpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ CONFIG_INTEL_ADSP_TIMER=y
CONFIG_MM_DRV_INTEL_ADSP_TLB_REMAP_UNUSED_RAM=y
CONFIG_AMS=y
CONFIG_COUNTER=y
CONFIG_SOF_TELEMETRY=y

CONFIG_HEAP_MEM_POOL_SIZE=8192
CONFIG_L3_HEAP=y
Expand Down Expand Up @@ -78,6 +79,8 @@ CONFIG_INTEL_ADSP_IPC=y
CONFIG_WATCHDOG=y
CONFIG_LL_WATCHDOG=y

CONFIG_MEMORY_WIN_2_SIZE=12288

# Temporary disabled options
CONFIG_TRACE=n
CONFIG_COMP_KPB=y
Expand Down
4 changes: 4 additions & 0 deletions app/boards/intel_adsp_ace20_lnl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ CONFIG_INTEL_ADSP_TIMER=y
CONFIG_MM_DRV_INTEL_ADSP_TLB_REMAP_UNUSED_RAM=y
CONFIG_AMS=y
CONFIG_COUNTER=y
CONFIG_SOF_TELEMETRY=y

CONFIG_HEAP_MEM_POOL_SIZE=8192
CONFIG_L3_HEAP=y
Expand Down Expand Up @@ -73,6 +74,9 @@ CONFIG_INTEL_ADSP_IPC=y
CONFIG_PROBE=y
CONFIG_PROBE_DMA_MAX=2

CONFIG_MEMORY_WIN_2_SIZE=12288


# Temporary disabled options
CONFIG_TRACE=n
CONFIG_COMP_KPB=y
Expand Down
2 changes: 2 additions & 0 deletions src/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ rsource "ipc/Kconfig"
rsource "math/Kconfig"

rsource "library_manager/Kconfig"

rsource "debug/telemetry/Kconfig"
91 changes: 88 additions & 3 deletions src/audio/base_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
#if defined(CONFIG_SOC_SERIES_INTEL_ADSP_ACE)
#include <intel_adsp_hda.h>
#endif
#include <sof/audio/module_adapter/module/generic.h>
#include <sof/schedule/dp_schedule.h>
#include <sof/schedule/ll_schedule.h>
#include <sof/debug/telemetry/telemetry.h>
/* FIXME:
* Builds for some platforms like tgl fail because their defines related to memory windows are
* already defined somewhere else. Remove this ifdef after it's cleaned up
*/
#ifdef CONFIG_SOF_TELEMETRY
#include "mem_window.h"
#include "adsp_debug_window.h"
#endif

#if CONFIG_ACE_V1X_ART_COUNTER || CONFIG_ACE_V1X_RTC_COUNTER
#include <zephyr/device.h>
Expand Down Expand Up @@ -499,16 +511,85 @@ static int basefw_set_fw_config(bool first_block,
return 0;
}

int schedulers_info_get(uint32_t *data_off_size,
char *data,
uint32_t core_id)
{
/* TODO
* Core id parameter is not yet used. For now we only get scheduler info from current core
* Other cores info can be added by implementing idc request for this data.
* Do this if Schedulers info get ipc has uses for accurate info per core
*/

struct scheduler_props *scheduler_props;
/* the internal structs have irregular sizes so we cannot use indexing, and have to
* reassign pointers for each element
*/
struct schedulers_info *schedulers_info = (struct schedulers_info *)data;

schedulers_info->scheduler_count = 0;

/* smallest response possible is just zero schedulers count
* here we replace max_len from data_off_size to serve as output size
*/
*data_off_size = sizeof(struct schedulers_info);

/* ===================== LL_TIMER SCHEDULER INFO ============================ */
schedulers_info->scheduler_count++;
scheduler_props = (struct scheduler_props *)(data + *data_off_size);
scheduler_get_task_info_ll(scheduler_props, data_off_size);

/* ===================== DP SCHEDULER INFO ============================ */
#if CONFIG_ZEPHYR_DP_SCHEDULER
schedulers_info->scheduler_count++;
scheduler_props = (struct scheduler_props *)(data + *data_off_size);
scheduler_get_task_info_dp(scheduler_props, data_off_size);
#endif
return 0;
}

int set_perf_meas_state(const char *data)
{
#ifdef CONFIG_SOF_TELEMETRY
enum ipc4_perf_measurements_state_set state = *data;

struct telemetry_wnd_data *wnd_data =
(struct telemetry_wnd_data *)ADSP_DW->slots[SOF_DW_TELEMETRY_SLOT];
struct system_tick_info *systick_info =
(struct system_tick_info *)wnd_data->system_tick_info;

switch (state) {
case IPC4_PERF_MEASUREMENTS_DISABLED:
break;
case IPC4_PERF_MEASUREMENTS_STOPPED:
for (int i = 0; i < CONFIG_MAX_CORE_COUNT; i++)
systick_info[i].peak_utilization = 0;
break;
case IPC4_PERF_MEASUREMENTS_STARTED:
case IPC4_PERF_MEASUREMENTS_PAUSED:
break;
default:
return -EINVAL;
}
#endif
return IPC4_SUCCESS;
}

static int basefw_get_large_config(struct comp_dev *dev,
uint32_t param_id,
bool first_block,
bool last_block,
uint32_t *data_offset,
char *data)
{
/* We can use extended param id for both extended and standard param id */
union ipc4_extended_param_id extended_param_id;

extended_param_id.full = param_id;

uint32_t ret = -EINVAL;

switch (param_id) {
switch (extended_param_id.part.parameter_type) {
case IPC4_PERF_MEASUREMENTS_STATE:
case IPC4_GLOBAL_PERF_DATA:
break;
Expand All @@ -517,7 +598,7 @@ static int basefw_get_large_config(struct comp_dev *dev,
return -EINVAL;
}

switch (param_id) {
switch (extended_param_id.part.parameter_type) {
case IPC4_FW_CONFIG:
return basefw_config(data_offset, data);
case IPC4_HW_CONFIG_GET:
Expand All @@ -537,13 +618,15 @@ static int basefw_get_large_config(struct comp_dev *dev,
break;
case IPC4_POWER_STATE_INFO_GET:
return basefw_power_state_info_get(data_offset, data);
case IPC4_SCHEDULERS_INFO_GET:
return schedulers_info_get(data_offset, data,
extended_param_id.part.parameter_instance);
/* TODO: add more support */
case IPC4_DSP_RESOURCE_STATE:
case IPC4_NOTIFICATION_MASK:
case IPC4_MODULES_INFO_GET:
case IPC4_PIPELINE_LIST_INFO_GET:
case IPC4_PIPELINE_PROPS_GET:
case IPC4_SCHEDULERS_INFO_GET:
case IPC4_GATEWAYS_INFO_GET:
break;
case IPC4_LIBRARIES_INFO_GET:
Expand All @@ -568,6 +651,8 @@ static int basefw_set_large_config(struct comp_dev *dev,
switch (param_id) {
case IPC4_FW_CONFIG:
return basefw_set_fw_config(first_block, last_block, data_offset, data);
case IPC4_PERF_MEASUREMENTS_STATE:
return set_perf_meas_state(data);
case IPC4_SYSTEM_TIME:
return basefw_set_system_time(param_id, first_block,
last_block, data_offset, data);
Expand Down
15 changes: 7 additions & 8 deletions src/audio/module_adapter/module/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,20 @@ static int modules_new(struct processing_module *mod, const void *buildinfo,
uint32_t log_handle = (uint32_t) dev->drv->tctx;
/* Connect loadable module interfaces with module adapter entity. */
/* Check if native Zephyr lib is loaded */
struct sof_man_fw_desc *desc = lib_manager_get_library_module_desc(module_id);
void *system_agent;

if (!desc) {
comp_err(dev, "modules_init(): Failed to load manifest");
return -ENOMEM;
}

const struct sof_module_api_build_info *mod_buildinfo;

if (buildinfo) {
mod_buildinfo = buildinfo;
} else {
struct sof_man_module *module_entry =
(struct sof_man_module *)((char *)desc + SOF_MAN_MODULE_OFFSET(0));
const struct sof_man_module *const module_entry =
lib_manager_get_module_manifest(module_id);

if (!module_entry) {
comp_err(dev, "modules_new(): Failed to load manifest");
return -ENODATA;
}

mod_buildinfo =
(struct sof_module_api_build_info *)
Expand Down
14 changes: 14 additions & 0 deletions src/audio/module_adapter/module/waves/waves.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ static int waves_effect_apply_config(struct processing_module *mod)
/* incoming data in cfg->data is arranged according to struct module_param
* there migh be more than one struct module_param inside cfg->data, glued back to back
*/
const uint32_t header_size = sizeof(param->size) + sizeof(param->id);
for (index = 0; index < cfg->size && (!ret); param_number++) {
uint32_t param_data_size;

Expand All @@ -610,6 +611,18 @@ static int waves_effect_apply_config(struct processing_module *mod)
comp_info(dev, "waves_effect_apply_config() param num %d id %d size %d",
param_number, param->id, param->size);

if ((param->size <= header_size) || (param->size > MAX_CONFIG_SIZE_BYTES)) {
comp_err(dev, "waves_effect_apply_config() invalid module_param size: %d",
param->size);
return -EINVAL;
}

if ((index + param->size) > cfg->size) {
comp_err(dev, "waves_effect_apply_config() module_param size: %d exceeds cfg buffer size: %d",
param->size, cfg->size);
return -EINVAL;
}

switch (param->id) {
case PARAM_NOP:
comp_info(dev, "waves_effect_apply_config() NOP");
Expand Down Expand Up @@ -653,6 +666,7 @@ static int waves_codec_init(struct processing_module *mod)
sizeof(struct waves_codec_data));
ret = -ENOMEM;
} else {
memset(waves_codec, 0, sizeof(struct waves_codec_data));
codec->private = waves_codec;
ret = waves_effect_allocate(mod);
if (ret) {
Expand Down
3 changes: 3 additions & 0 deletions src/debug/telemetry/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: BSD-3-Clause

add_local_sources_ifdef(CONFIG_SOF_TELEMETRY sof telemetry.c)
11 changes: 11 additions & 0 deletions src/debug/telemetry/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-License-Identifier: BSD-3-Clause

config SOF_TELEMETRY
bool "enable telemetry"
default n
help
Enables telemetry. Enables performance measurements and debug utilities
that use memory window 2 (debug window) as interface. Measurements include
systick_info measurement which measures scheduler task performance and may
slightly affect overall performance.

Loading

0 comments on commit da25211

Please sign in to comment.