Skip to content

Commit ce0f500

Browse files
bind crash debugs
Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
1 parent 23841ed commit ce0f500

7 files changed

Lines changed: 94 additions & 19 deletions

File tree

app/boards/intel_adsp_ace30_ptl.conf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CONFIG_LIBRARY_BUILD_LIB=y
3434
CONFIG_LIBRARY_DEFAULT_MODULAR=y
3535

3636
# SOF / logging
37-
CONFIG_SOF_LOG_LEVEL_INF=y
37+
CONFIG_SOF_LOG_LEVEL_DBG=y
3838

3939
# Zephyr / OS features
4040
CONFIG_COUNTER=y
@@ -77,3 +77,5 @@ CONFIG_SOF_USERSPACE_PROXY=y
7777
CONFIG_MAX_THREAD_BYTES=3
7878

7979
CONFIG_MAX_DOMAIN_PARTITIONS=32
80+
81+
CONFIG_ASSERT=y

src/audio/buffers/comp_buffer.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static void comp_buffer_free(struct sof_audio_buffer *audio_buffer)
156156

157157
struct mod_alloc_ctx *alloc = buffer->audio_buffer.alloc;
158158

159-
#ifdef CONFIG_SOF_USERSPACE_LL
159+
#ifdef CONFIG_USERSPACE ///CONFIG_SOF_USERSPACE_LL
160160
assert(alloc);
161161
sof_ctx_free(alloc, buffer->stream.addr);
162162
#else
@@ -255,7 +255,7 @@ struct comp_buffer *buffer_alloc(struct mod_alloc_ctx *alloc, size_t size, uint3
255255
return NULL;
256256
}
257257

258-
#ifdef CONFIG_SOF_USERSPACE_LL
258+
#ifdef CONFIG_USERSPACE /// CONFIG_SOF_USERSPACE_LL
259259
assert(alloc);
260260
stream_addr = sof_ctx_alloc(alloc, flags, size, align);
261261
#else
@@ -270,7 +270,7 @@ struct comp_buffer *buffer_alloc(struct mod_alloc_ctx *alloc, size_t size, uint3
270270
buffer = buffer_alloc_struct(alloc, stream_addr, size, flags, is_shared);
271271
if (!buffer) {
272272
tr_err(&buffer_tr, "could not alloc buffer structure");
273-
#ifdef CONFIG_SOF_USERSPACE_LL
273+
#ifdef CONFIG_USERSPACE /// CONFIG_SOF_USERSPACE_LL
274274
assert(alloc);
275275
sof_ctx_free(alloc, stream_addr);
276276
#else
@@ -303,7 +303,7 @@ struct comp_buffer *buffer_alloc_range(struct mod_alloc_ctx *alloc, size_t prefe
303303
preferred_size += minimum_size - preferred_size % minimum_size;
304304

305305
for (size = preferred_size; size >= minimum_size; size -= minimum_size) {
306-
#ifdef CONFIG_SOF_USERSPACE_LL
306+
#ifdef CONFIG_USERSPACE /// CONFIG_SOF_USERSPACE_LL
307307
assert(alloc);
308308
stream_addr = sof_ctx_alloc(alloc, flags, size, align);
309309
#else
@@ -324,7 +324,7 @@ struct comp_buffer *buffer_alloc_range(struct mod_alloc_ctx *alloc, size_t prefe
324324
buffer = buffer_alloc_struct(alloc, stream_addr, size, flags, is_shared);
325325
if (!buffer) {
326326
tr_err(&buffer_tr, "could not alloc buffer structure");
327-
#ifdef CONFIG_SOF_USERSPACE_LL
327+
#ifdef CONFIG_USERSPACE /// CONFIG_SOF_USERSPACE_LL
328328
assert(alloc);
329329
sof_ctx_free(alloc, stream_addr);
330330
#else
@@ -350,7 +350,7 @@ void buffer_zero(struct comp_buffer *buffer)
350350
int buffer_set_size(struct comp_buffer *buffer, uint32_t size, uint32_t alignment)
351351
{
352352
void *new_ptr = NULL;
353-
#ifdef CONFIG_SOF_USERSPACE_LL
353+
#ifdef CONFIG_USERSPACE /// CONFIG_SOF_USERSPACE_LL
354354
struct mod_alloc_ctx *alloc = buffer->audio_buffer.alloc;
355355
#endif
356356

@@ -365,7 +365,7 @@ int buffer_set_size(struct comp_buffer *buffer, uint32_t size, uint32_t alignmen
365365
if (size == audio_stream_get_size(&buffer->stream))
366366
return 0;
367367

368-
#ifdef CONFIG_SOF_USERSPACE_LL
368+
#ifdef CONFIG_USERSPACE /// CONFIG_SOF_USERSPACE_LL
369369
assert(alloc);
370370
new_ptr = sof_ctx_alloc(alloc, buffer->flags, size, alignment);
371371
#else
@@ -381,7 +381,7 @@ int buffer_set_size(struct comp_buffer *buffer, uint32_t size, uint32_t alignmen
381381

382382
/* use bigger chunk, else just use the old chunk but set smaller */
383383
if (new_ptr) {
384-
#ifdef CONFIG_SOF_USERSPACE_LL
384+
#ifdef CONFIG_USERSPACE /// CONFIG_SOF_USERSPACE_LL
385385
assert(alloc);
386386
sof_ctx_free(alloc, audio_stream_get_addr(&buffer->stream));
387387
#else
@@ -401,7 +401,7 @@ int buffer_set_size_range(struct comp_buffer *buffer, size_t preferred_size, siz
401401
const size_t actual_size = audio_stream_get_size(&buffer->stream);
402402
void *new_ptr = NULL;
403403
size_t new_size;
404-
#ifdef CONFIG_SOF_USERSPACE_LL
404+
#ifdef CONFIG_USERSPACE /// CONFIG_SOF_USERSPACE_LL
405405
struct mod_alloc_ctx *alloc = buffer->audio_buffer.alloc;
406406
#endif
407407

@@ -423,7 +423,7 @@ int buffer_set_size_range(struct comp_buffer *buffer, size_t preferred_size, siz
423423

424424
for (new_size = preferred_size; new_size >= minimum_size;
425425
new_size -= minimum_size) {
426-
#ifdef CONFIG_SOF_USERSPACE_LL
426+
#ifdef CONFIG_USERSPACE /// CONFIG_SOF_USERSPACE_LL
427427
assert(alloc);
428428
new_ptr = sof_ctx_alloc(alloc, buffer->flags, new_size, alignment);
429429
#else
@@ -442,7 +442,7 @@ int buffer_set_size_range(struct comp_buffer *buffer, size_t preferred_size, siz
442442

443443
/* use bigger chunk, else just use the old chunk but set smaller */
444444
if (new_ptr) {
445-
#ifdef CONFIG_SOF_USERSPACE_LL
445+
#ifdef CONFIG_USERSPACE /// CONFIG_SOF_USERSPACE_LL
446446
assert(alloc);
447447
sof_ctx_free(alloc, audio_stream_get_addr(&buffer->stream));
448448
#else

src/audio/module_adapter/library/userspace_proxy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ static const struct module_interface userspace_proxy_interface;
5454
#include <sof/audio/module_adapter/iadk/system_agent.h>
5555
#include <sof/schedule/dp_schedule.h>
5656

57-
static inline int user_worker_get(void)
57+
static inline int user_worker_get(int cpu)
5858
{
5959
return 0;
6060
}
6161

62-
static inline void user_worker_put(void) { }
62+
static inline void user_worker_put(int cpu) { }
6363

6464
struct k_work_user *userspace_proxy_register_ipc_handler(struct processing_module *mod,
6565
struct k_event *event)

src/init/init.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,13 @@ int sof_main(int argc, char *argv[])
257257
return start_complete();
258258
}
259259

260+
volatile uint32_t *aaa = NULL;
261+
260262
static int sof_init(void)
261263
{
264+
aaa = sys_cache_uncached_ptr_get((__sparse_force void __sparse_cache *) (WIN3_MBASE + WIN3_OFFSET + 0x1000));
265+
aaa[0] = 0xABCD1234;
266+
262267
return primary_core_init(0, NULL, &sof);
263268
}
264269

src/ipc/ipc-helper.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
LOG_MODULE_DECLARE(ipc, CONFIG_SOF_LOG_LEVEL);
4040

41+
extern volatile uint32_t *aaa;
42+
4143
__cold static bool valid_ipc_buffer_desc(const struct sof_ipc_buffer *desc)
4244
{
4345
assert_can_be_cold();
@@ -53,6 +55,8 @@ __cold static bool valid_ipc_buffer_desc(const struct sof_ipc_buffer *desc)
5355
__cold struct comp_buffer *buffer_new(struct mod_alloc_ctx *alloc,
5456
const struct sof_ipc_buffer *desc, bool is_shared)
5557
{
58+
aaa[4] = 1;
59+
5660
struct comp_buffer *buffer;
5761
uint32_t flags = desc->flags;
5862

@@ -78,9 +82,13 @@ __cold struct comp_buffer *buffer_new(struct mod_alloc_ctx *alloc,
7882
tr_warn(&buffer_tr, "Deprecated buffer caps 0x%x used, convert to flags 0x%x",
7983
desc->caps, flags);
8084

85+
aaa[4] = 2;
86+
aaa[5] = alloc;
8187
/* allocate buffer */
8288
buffer = buffer_alloc(alloc, desc->size, flags, PLATFORM_DCACHE_ALIGN,
8389
is_shared);
90+
aaa[4] = 3;
91+
8492
if (buffer) {
8593
buffer->stream.runtime_stream_params.id = desc->comp.id;
8694
buffer->stream.runtime_stream_params.pipeline_id = desc->comp.pipeline_id;

src/ipc/ipc4/handler-user.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959

6060
LOG_MODULE_DECLARE(ipc, CONFIG_SOF_LOG_LEVEL);
6161

62+
extern volatile uint32_t *aaa;
63+
6264
/* Userspace message context, copied in/out by kernel IPC thread. */
6365
/* fw sends a fw ipc message to send the status of the last host ipc message */
6466
static struct ipc_msg *msg_reply;
@@ -769,12 +771,16 @@ __cold static int ipc4_init_module_instance(struct ipc4_message_request *ipc4)
769771

770772
__cold static int ipc4_bind_module_instance(struct ipc4_message_request *ipc4)
771773
{
774+
aaa[1] = 1;
775+
772776
struct ipc4_module_bind_unbind bu;
773777
struct ipc *ipc = ipc_get();
774778

775779
assert_can_be_cold();
776780

781+
aaa[1] = 2;
777782
int ret = memcpy_s(&bu, sizeof(bu), ipc4, sizeof(*ipc4));
783+
aaa[1] = 3;
778784

779785
if (ret < 0)
780786
return IPC4_FAILURE;
@@ -783,7 +789,10 @@ __cold static int ipc4_bind_module_instance(struct ipc4_message_request *ipc4)
783789
(uint32_t)bu.primary.r.module_id, (uint32_t)bu.primary.r.instance_id,
784790
(uint32_t)bu.extension.r.dst_module_id, (uint32_t)bu.extension.r.dst_instance_id);
785791

786-
return ipc_comp_connect(ipc, (ipc_pipe_comp_connect *)&bu);
792+
aaa[1] = 4;
793+
int rrr = ipc_comp_connect(ipc, (ipc_pipe_comp_connect *)&bu);
794+
aaa[1] = 5;
795+
return rrr;
787796
}
788797

789798
__cold static int ipc4_unbind_module_instance(struct ipc4_message_request *ipc4)

0 commit comments

Comments
 (0)