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
6 changes: 1 addition & 5 deletions src/include/sof/probe/probe.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#ifndef __SOF_PROBE_PROBE_H__
#define __SOF_PROBE_PROBE_H__

#if CONFIG_PROBE

#include <ipc/probe.h>

/**
Expand All @@ -18,8 +16,8 @@
typedef void(*probe_logging_hook_t)(uint8_t *buffer, size_t length);

#if CONFIG_LOG_BACKEND_SOF_PROBE
void probe_logging_hook(uint8_t *buffer, size_t length);
const struct log_backend *log_backend_probe_get(void);
bool probe_is_backend_configured(void);
#endif

/**
Expand Down Expand Up @@ -106,6 +104,4 @@ static inline struct probe_pdata *probe_get(void)
return sof_get()->probe;
}

#endif /* CONFIG_PROBE */

#endif /* __SOF_PROBE_PROBE_H__ */
2 changes: 2 additions & 0 deletions src/init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <sof/trace/trace.h>
#include <rtos/idc.h>
#include <rtos/string_macro.h>
#include <rtos/symbol.h>
#include <sof/schedule/schedule.h>
#include <sof/schedule/edf_schedule.h>
#include <sof/schedule/dp_schedule.h>
Expand Down Expand Up @@ -53,6 +54,7 @@ struct sof *sof_get(void)
{
return &sof;
}
EXPORT_SYMBOL(sof_get);

#if CONFIG_NO_SECONDARY_CORE_ROM
/**
Expand Down
2 changes: 2 additions & 0 deletions src/ipc/ipc-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <sof/audio/pipeline.h>
#include <sof/common.h>
#include <rtos/idc.h>
#include <rtos/symbol.h>
#include <sof/ipc/topology.h>
#include <sof/ipc/common.h>
#include <sof/ipc/msg.h>
Expand Down Expand Up @@ -95,6 +96,7 @@ struct ipc_comp_dev *ipc_get_comp_dev(struct ipc *ipc, uint16_t type, uint32_t i

return NULL;
}
EXPORT_SYMBOL(ipc_get_comp_dev);

/* Walks through the list of components looking for a sink/source endpoint component
* of the given pipeline
Expand Down
2 changes: 1 addition & 1 deletion src/ipc/ipc4/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ int ipc4_logging_enable_logs(bool first_block,
if (!probe_is_backend_configured())
return -EINVAL;

log_backend_activate(log_backend, probe_logging_hook);
log_backend_activate(log_backend, NULL);

} else {
log_backend_deactivate(log_backend);
Expand Down
4 changes: 4 additions & 0 deletions src/lib/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <sof/lib/memory.h>
#include <sof/lib/uuid.h>
#include <rtos/spinlock.h>
#include <rtos/symbol.h>
#include <sof/trace/trace.h>
#include <ipc/topology.h>
#include <user/trace.h>
Expand Down Expand Up @@ -278,6 +279,8 @@ void dma_put(struct dma *dma)
k_spin_unlock(&dma->lock, key);
}
#endif
EXPORT_SYMBOL(dma_get);
EXPORT_SYMBOL(dma_put);

int dma_sg_alloc(struct dma_sg_elem_array *elem_array,
enum mem_zone zone,
Expand Down Expand Up @@ -318,6 +321,7 @@ void dma_sg_free(struct dma_sg_elem_array *elem_array)
rfree(elem_array->elems);
dma_sg_init(elem_array);
}
EXPORT_SYMBOL(dma_sg_free);

int dma_buffer_copy_from(struct comp_buffer *source,
struct comp_buffer *sink,
Expand Down
3 changes: 3 additions & 0 deletions src/lib/notifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <sof/lib/uuid.h>
#include <sof/list.h>
#include <rtos/sof.h>
#include <rtos/symbol.h>
#include <ipc/topology.h>
#include <stdint.h>

Expand Down Expand Up @@ -78,6 +79,7 @@ int notifier_register(void *receiver, void *caller, enum notify_id type,
k_spin_unlock(&notify->lock, key);
return ret;
}
EXPORT_SYMBOL(notifier_register);

void notifier_unregister(void *receiver, void *caller, enum notify_id type)
{
Expand Down Expand Up @@ -114,6 +116,7 @@ void notifier_unregister(void *receiver, void *caller, enum notify_id type)

k_spin_unlock(&notify->lock, key);
}
EXPORT_SYMBOL(notifier_unregister);

void notifier_unregister_all(void *receiver, void *caller)
{
Expand Down
1 change: 1 addition & 0 deletions src/logging/log_backend_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ void probe_logging_init(probe_logging_hook_t fn)
{
probe_hook = fn;
}
EXPORT_SYMBOL(probe_logging_init);

const struct log_backend *log_backend_probe_get(void)
{
Expand Down
8 changes: 7 additions & 1 deletion src/probe/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
menu "Probe"

config PROBE
bool "Probes enabled"
tristate "Probes enabled"
default m if LIBRARY_DEFAULT_MODULAR
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this means we can't merge this before the Zephyr PR is merged...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kv2019i as confirmed by @jsarha with our default configurations setting CONFIG_PROBE=y nothing should break if this is merged before any Zephyr support code

default y if CAVS
help
Select for enabling debug probes to extract/inject buffers

if PROBE != n

config PROBE_POINTS_MAX
int "Maximum probe points"
depends on PROBE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think now with the if above you don't need these depends any more - here and below?

Expand All @@ -23,4 +26,7 @@ config PROBE_DMA_MAX
default 0
help
Define maximum number of injection DMAs.

endif

endmenu
6 changes: 6 additions & 0 deletions src/probe/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2024 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0

sof_llext_build("probe"
SOURCES ../probe.c
)
10 changes: 10 additions & 0 deletions src/probe/llext/llext.toml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2024 Intel Corporation. All rights reserved.
*/
#include <tools/rimage/config/platform.toml>
#define LOAD_TYPE "2"
#include "../probe.toml"

[module]
count = __COUNTER__
28 changes: 23 additions & 5 deletions src/probe/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,6 @@ static uint32_t probe_gen_format(uint32_t frame_fmt, uint32_t rate,
default:
tr_err(&pr_tr, "probe_gen_format(): Invalid frame format specified = 0x%08x",
frame_fmt);
assert(false);
return 0;
}

Expand Down Expand Up @@ -836,7 +835,7 @@ static void kick_probe_task(struct probe_pdata *_probe)
}

#if CONFIG_LOG_BACKEND_SOF_PROBE
void probe_logging_hook(uint8_t *buffer, size_t length)
static void probe_logging_hook(uint8_t *buffer, size_t length)
{
struct probe_pdata *_probe = probe_get();
uint64_t checksum;
Expand Down Expand Up @@ -1088,7 +1087,7 @@ static struct comp_buffer *ipc4_get_buffer(struct ipc_comp_dev *dev, probe_point
static bool enable_logs(const struct probe_point *probe)
{
#if CONFIG_IPC_MAJOR_4
return probe->buffer_id.fields.module_id == 0;
return probe->buffer_id.full_id == 0;
#else
return probe->purpose == PROBE_PURPOSE_LOGGING;
#endif
Expand Down Expand Up @@ -1511,6 +1510,25 @@ static const struct module_interface probe_interface = {
};

DECLARE_MODULE_ADAPTER(probe_interface, PROBE_UUID, pr_tr);
SOF_MODULE_INIT(asrc, sys_comp_module_probe_interface_init);
SOF_MODULE_INIT(probe, sys_comp_module_probe_interface_init);

#endif
#if CONFIG_PROBE_MODULE
/* modular: llext dynamic link */

#include <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

#define UUID_PROBE 0x08, 0x08, 0xAD, 0x7C, 0x10, 0xAB, 0x23, 0xCD, 0xEF, 0x45, \
0x12, 0xAB, 0x34, 0xCD, 0x56, 0xEF,

SOF_LLEXT_MOD_ENTRY(probe, &probe_interface);

static const struct sof_man_module_manifest mod_manifest __section(".module") __used =
SOF_LLEXT_MODULE_MANIFEST("PROBE", probe_llext_entry, 1, UUID_PROBE, 40);

SOF_LLEXT_BUILDINFO;

#endif /* CONFIG_COMP_PROBE_MODULE */

#endif /* CONFIG_IPC_MAJOR_4 */
6 changes: 5 additions & 1 deletion src/probe/probe.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

[[module.entry]]
name = "PROBE"
uuid = "7CAD0808-AB10-CD23-EF45-12AB34CD56EF"
affinity_mask = "0x1"
instance_count = "1"
domain_types = "0"
load_type = "0"
load_type = LOAD_TYPE
module_type = "9"
auto_start = "0"
sched_caps = [1, 0x00008000]
Expand Down
2 changes: 2 additions & 0 deletions src/schedule/zephyr_ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <sof/list.h>
#include <rtos/spinlock.h>
#include <rtos/symbol.h>
#include <sof/audio/component.h>
#include <rtos/interrupt.h>
#include <sof/lib/notifier.h>
Expand Down Expand Up @@ -522,6 +523,7 @@ int zephyr_ll_task_init(struct task *task,

return 0;
}
EXPORT_SYMBOL(zephyr_ll_task_init);

/* TODO: low-power mode clock support */
/* Runs on each core during initialisation with the same domain argument */
Expand Down
10 changes: 7 additions & 3 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1129,9 +1129,13 @@ zephyr_library_sources_ifdef(CONFIG_WAVES_CODEC_STUB
${SOF_AUDIO_PATH}/module_adapter/module/waves/maxx_stub.c
)

zephyr_library_sources_ifdef(CONFIG_PROBE
${SOF_SRC_PATH}/probe/probe.c
)
if(CONFIG_PROBE STREQUAL "m")
add_subdirectory(${SOF_SRC_PATH}/probe/llext
${PROJECT_BINARY_DIR}/probe_llext)
add_dependencies(app probe)
elseif(CONFIG_PROBE)
zephyr_library_sources(${SOF_SRC_PATH}/probe/probe.c)
endif()

zephyr_library_sources_ifdef(CONFIG_MULTICORE
${SOF_SRC_PATH}/idc/idc.c
Expand Down
2 changes: 2 additions & 0 deletions zephyr/schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <sof/schedule/edf_schedule.h>
#include <sof/schedule/ll_schedule.h>
#include <rtos/alloc.h>
#include <rtos/symbol.h>
#include <sof/lib/cpu.h>
#include <ipc/topology.h>

Expand All @@ -22,3 +23,4 @@ struct schedulers **arch_schedulers_get(void)
{
return _schedulers + cpu_get_id();
}
EXPORT_SYMBOL(arch_schedulers_get);