Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAM: more cold functions #9850

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
6 changes: 3 additions & 3 deletions src/init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static int secondary_core_restore(void)

#endif

int secondary_core_init(struct sof *sof)
__cold int secondary_core_init(struct sof *sof)
{
int err;
struct ll_schedule_domain *dma_domain;
Expand Down Expand Up @@ -237,7 +237,7 @@ int secondary_core_init(struct sof *sof)

#endif

static void print_version_banner(void)
__cold static void print_version_banner(void)
{
/*
* Non-Zephyr builds emit the version banner in DMA-trace
Expand Down Expand Up @@ -267,7 +267,7 @@ static log_timestamp_t default_get_timestamp(void)
}
#endif

static int primary_core_init(int argc, char *argv[], struct sof *sof)
__cold static int primary_core_init(int argc, char *argv[], struct sof *sof)
{
/* setup context */
sof->argc = argc;
Expand Down
27 changes: 14 additions & 13 deletions src/ipc/ipc-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <rtos/cache.h>
#include <sof/lib/cpu.h>
#include <sof/lib/mailbox.h>
#include <sof/lib/memory.h>
#include <sof/list.h>
#include <sof/platform.h>
#include <rtos/sof.h>
Expand All @@ -41,7 +42,7 @@ SOF_DEFINE_REG_UUID(ipc);

DECLARE_TR_CTX(ipc_tr, SOF_UUID(ipc_uuid), LOG_LEVEL_INFO);

int ipc_process_on_core(uint32_t core, bool blocking)
__cold int ipc_process_on_core(uint32_t core, bool blocking)
{
struct ipc *ipc = ipc_get();
struct idc_msg msg = { .header = IDC_MSG_IPC, .core = core, };
Expand Down Expand Up @@ -83,7 +84,7 @@ int ipc_process_on_core(uint32_t core, bool blocking)
* Components, buffers and pipelines are stored in the same lists, hence
* type and ID have to be used for the identification.
*/
struct ipc_comp_dev *ipc_get_comp_dev(struct ipc *ipc, uint16_t type, uint32_t id)
__cold struct ipc_comp_dev *ipc_get_comp_dev(struct ipc *ipc, uint16_t type, uint32_t id)
{
struct ipc_comp_dev *icd;
struct list_item *clist;
Expand All @@ -101,7 +102,7 @@ EXPORT_SYMBOL(ipc_get_comp_dev);
/* Walks through the list of components looking for a sink/source endpoint component
* of the given pipeline
*/
struct ipc_comp_dev *ipc_get_ppl_comp(struct ipc *ipc, uint32_t pipeline_id, int dir)
__cold struct ipc_comp_dev *ipc_get_ppl_comp(struct ipc *ipc, uint32_t pipeline_id, int dir)
{
struct ipc_comp_dev *icd;
struct comp_buffer *buffer;
Expand Down Expand Up @@ -140,7 +141,7 @@ struct ipc_comp_dev *ipc_get_ppl_comp(struct ipc *ipc, uint32_t pipeline_id, int
return next_ppl_icd;
}

void ipc_send_queued_msg(void)
__cold void ipc_send_queued_msg(void)
{
struct ipc *ipc = ipc_get();
struct ipc_msg *msg;
Expand Down Expand Up @@ -175,7 +176,7 @@ static struct k_work_q ipc_send_wq;
static K_THREAD_STACK_DEFINE(ipc_send_wq_stack, CONFIG_STACK_SIZE_IPC_TX);
#endif

static void schedule_ipc_worker(void)
__cold static void schedule_ipc_worker(void)
{
/*
* note: in XTOS builds, this is handled in
Expand All @@ -188,7 +189,7 @@ static void schedule_ipc_worker(void)
#endif
}

void ipc_msg_send_direct(struct ipc_msg *msg, void *data)
__cold void ipc_msg_send_direct(struct ipc_msg *msg, void *data)
{
struct ipc *ipc = ipc_get();
k_spinlock_key_t key;
Expand All @@ -208,7 +209,7 @@ void ipc_msg_send_direct(struct ipc_msg *msg, void *data)
k_spin_unlock(&ipc->lock, key);
}

void ipc_msg_send(struct ipc_msg *msg, void *data, bool high_priority)
__cold void ipc_msg_send(struct ipc_msg *msg, void *data, bool high_priority)
{
struct ipc *ipc = ipc_get();
k_spinlock_key_t key;
Expand Down Expand Up @@ -255,7 +256,7 @@ void ipc_msg_send(struct ipc_msg *msg, void *data, bool high_priority)
EXPORT_SYMBOL(ipc_msg_send);

#ifdef __ZEPHYR__
static void ipc_work_handler(struct k_work *work)
__cold static void ipc_work_handler(struct k_work *work)
{
struct ipc *ipc = ipc_get();
k_spinlock_key_t key;
Expand All @@ -271,12 +272,12 @@ static void ipc_work_handler(struct k_work *work)
}
#endif

void ipc_schedule_process(struct ipc *ipc)
__cold void ipc_schedule_process(struct ipc *ipc)
{
schedule_task(&ipc->ipc_task, 0, IPC_PERIOD_USEC);
}

int ipc_init(struct sof *sof)
__cold int ipc_init(struct sof *sof)
{
tr_dbg(&ipc_tr, "ipc_init()");

Expand Down Expand Up @@ -323,7 +324,7 @@ int ipc_init(struct sof *sof)
}

/* Locking: call with ipc->lock held and interrupts disabled */
void ipc_complete_cmd(struct ipc *ipc)
__cold void ipc_complete_cmd(struct ipc *ipc)
{
/*
* We have up to three contexts, attempting to complete IPC processing:
Expand All @@ -343,7 +344,7 @@ void ipc_complete_cmd(struct ipc *ipc)
ipc_platform_complete_cmd(ipc);
}

static void ipc_complete_task(void *data)
__cold static void ipc_complete_task(void *data)
{
struct ipc *ipc = data;
k_spinlock_key_t key;
Expand All @@ -354,7 +355,7 @@ static void ipc_complete_task(void *data)
k_spin_unlock(&ipc->lock, key);
}

static enum task_state ipc_do_cmd(void *data)
__cold static enum task_state ipc_do_cmd(void *data)
{
struct ipc *ipc = data;

Expand Down
25 changes: 13 additions & 12 deletions src/ipc/ipc-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <rtos/cache.h>
#include <sof/lib/cpu.h>
#include <sof/lib/mailbox.h>
#include <sof/lib/memory.h>
#include <sof/list.h>
#include <sof/platform.h>
#include <rtos/sof.h>
Expand All @@ -37,7 +38,7 @@

LOG_MODULE_DECLARE(ipc, CONFIG_SOF_LOG_LEVEL);

static bool valid_ipc_buffer_desc(const struct sof_ipc_buffer *desc)
__cold static bool valid_ipc_buffer_desc(const struct sof_ipc_buffer *desc)
{
if (desc->caps >= SOF_MEM_CAPS_LOWEST_INVALID)
return false;
Expand All @@ -47,7 +48,7 @@ static bool valid_ipc_buffer_desc(const struct sof_ipc_buffer *desc)
}

/* create a new component in the pipeline */
struct comp_buffer *buffer_new(const struct sof_ipc_buffer *desc, bool is_shared)
__cold struct comp_buffer *buffer_new(const struct sof_ipc_buffer *desc, bool is_shared)
{
struct comp_buffer *buffer;

Expand Down Expand Up @@ -75,7 +76,7 @@ struct comp_buffer *buffer_new(const struct sof_ipc_buffer *desc, bool is_shared
return buffer;
}

int32_t ipc_comp_pipe_id(const struct ipc_comp_dev *icd)
__cold int32_t ipc_comp_pipe_id(const struct ipc_comp_dev *icd)
{
switch (icd->type) {
case COMP_TYPE_COMPONENT:
Expand All @@ -95,9 +96,9 @@ int32_t ipc_comp_pipe_id(const struct ipc_comp_dev *icd)
/* Function overwrites PCM parameters (frame_fmt, buffer_fmt, channels, rate)
* with buffer parameters when specific flag is set.
*/
static void comp_update_params(uint32_t flag,
struct sof_ipc_stream_params *params,
struct comp_buffer *buffer)
__cold static void comp_update_params(uint32_t flag,
struct sof_ipc_stream_params *params,
struct comp_buffer *buffer)
{
if (flag & BUFF_PARAMS_FRAME_FMT)
params->frame_fmt = audio_stream_get_frm_fmt(&buffer->stream);
Expand All @@ -112,8 +113,8 @@ static void comp_update_params(uint32_t flag,
params->rate = audio_stream_get_rate(&buffer->stream);
}

int comp_verify_params(struct comp_dev *dev, uint32_t flag,
struct sof_ipc_stream_params *params)
__cold int comp_verify_params(struct comp_dev *dev, uint32_t flag,
struct sof_ipc_stream_params *params)
{
struct list_item *buffer_list;
struct list_item *source_list;
Expand Down Expand Up @@ -179,8 +180,8 @@ int comp_verify_params(struct comp_dev *dev, uint32_t flag,
}
EXPORT_SYMBOL(comp_verify_params);

int comp_buffer_connect(struct comp_dev *comp, uint32_t comp_core,
struct comp_buffer *buffer, uint32_t dir)
__cold int comp_buffer_connect(struct comp_dev *comp, uint32_t comp_core,
struct comp_buffer *buffer, uint32_t dir)
{
/* check if it's a connection between cores */
if (buffer->core != comp_core) {
Expand All @@ -197,7 +198,7 @@ int comp_buffer_connect(struct comp_dev *comp, uint32_t comp_core,
return pipeline_connect(comp, buffer, dir);
}

int ipc_pipeline_complete(struct ipc *ipc, uint32_t comp_id)
__cold int ipc_pipeline_complete(struct ipc *ipc, uint32_t comp_id)
Copy link
Member

Choose a reason for hiding this comment

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

Can you check this, not sure if done in prepare() ? maybe for IPC3 only ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lgirdwood this is only called from

ipc4_pipeline_complete()
ipc4_pipeline_prepare()
ipc4_set_pipeline_state()				idc_ppl_state()
ipc4_process_glb_message()				idc_cmd()
ipc_cmd()						idc_handler()
ipc_platform_do_cmd()		idc_ipc()		P4WQ
ipc_do_cmd()			idc_cmd()
EDF scheduler			idc_handler()
				P4WQ

so, it's only called from the EDF scheduler or from IDC P4WQ, both of which use the EDF_ZEPHYR_PRIORITY priority (currently 1)

{
struct ipc_comp_dev *ipc_pipe;
struct ipc_comp_dev *icd;
Expand Down Expand Up @@ -260,7 +261,7 @@ int ipc_pipeline_complete(struct ipc *ipc, uint32_t comp_id)
ipc_ppl_sink->cd);
}

int ipc_comp_free(struct ipc *ipc, uint32_t comp_id)
__cold int ipc_comp_free(struct ipc *ipc, uint32_t comp_id)
{
struct ipc_comp_dev *icd;
struct list_item *clist, *tmp;
Expand Down
Loading
Loading