From 20c2339970ed786a58c22c4a0014a5a017b29722 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 20 Dec 2024 15:05:29 +0100 Subject: [PATCH] [DNM] examples of cold code and data Only for testing - mark some functions and const objects for DRAM residency. Signed-off-by: Guennadi Liakhovetski --- src/audio/drc/drc.c | 8 ++-- src/audio/src/coef/src_ipc4_int32_table.h | 12 ++--- src/audio/src/src_ipc4.c | 2 +- src/ipc/ipc4/handler.c | 54 +++++++++++------------ src/schedule/edf_schedule.c | 2 +- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/audio/drc/drc.c b/src/audio/drc/drc.c index 000e804cbd00..b032d344eaf2 100644 --- a/src/audio/drc/drc.c +++ b/src/audio/drc/drc.c @@ -304,7 +304,7 @@ static int drc_process(struct processing_module *mod, } #if CONFIG_IPC_MAJOR_4 -static void drc_params(struct processing_module *mod) +__cold static void drc_params(struct processing_module *mod) { struct sof_ipc_stream_params *params = mod->stream_params; struct comp_buffer *sinkb, *sourceb; @@ -323,9 +323,9 @@ static void drc_params(struct processing_module *mod) } #endif /* CONFIG_IPC_MAJOR_4 */ -static int drc_prepare(struct processing_module *mod, - struct sof_source **sources, int num_of_sources, - struct sof_sink **sinks, int num_of_sinks) +__cold static int drc_prepare(struct processing_module *mod, + struct sof_source **sources, int num_of_sources, + struct sof_sink **sinks, int num_of_sinks) { struct drc_comp_data *cd = module_get_private_data(mod); struct comp_buffer *sourceb, *sinkb; diff --git a/src/audio/src/coef/src_ipc4_int32_table.h b/src/audio/src/coef/src_ipc4_int32_table.h index 55bf350bead1..ba8268205524 100644 --- a/src/audio/src/coef/src_ipc4_int32_table.h +++ b/src/audio/src/coef/src_ipc4_int32_table.h @@ -100,15 +100,15 @@ #include /* SRC table */ -static const int32_t fir_one = 1073741824; -static const struct src_stage src_int32_1_1_0_0 = { 0, 0, 1, 1, 1, 1, 1, 0, -1, &fir_one }; -static const struct src_stage src_int32_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, &fir_one }; -static const int src_in_fs[16] = { 8000, 11025, 12000, 16000, 18900, 22050, 24000, 32000, +__cold_rodata static const int32_t fir_one = 1073741824; +__cold_rodata static const struct src_stage src_int32_1_1_0_0 = { 0, 0, 1, 1, 1, 1, 1, 0, -1, &fir_one }; +__cold_rodata static const struct src_stage src_int32_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, &fir_one }; +__cold_rodata static const int src_in_fs[16] = { 8000, 11025, 12000, 16000, 18900, 22050, 24000, 32000, 37800, 44100, 48000, 64000, 88200, 96000, 176400, 192000 }; -static const int src_out_fs[10] = { 8000, 16000, 24000, 32000, 44100, 48000, 88200, 96000, +__cold_rodata static const int src_out_fs[10] = { 8000, 16000, 24000, 32000, 44100, 48000, 88200, 96000, 176400, 192000}; -static const struct src_stage * const src_table1[10][16] = { +__cold_rodata static const struct src_stage * const src_table1[10][16] = { { &src_int32_1_1_0_0, &src_int32_16_21_4319_5000, &src_int32_2_3_4535_5000, &src_int32_1_2_4535_5000, &src_int32_0_0_0_0, &src_int32_10_21_3455_5000, diff --git a/src/audio/src/src_ipc4.c b/src/audio/src/src_ipc4.c index c1244801d1c1..25be394a6d49 100644 --- a/src/audio/src/src_ipc4.c +++ b/src/audio/src/src_ipc4.c @@ -179,7 +179,7 @@ int src_prepare_general(struct processing_module *mod, return ret; } -int src_init(struct processing_module *mod) +__cold int src_init(struct processing_module *mod) { struct module_data *md = &mod->priv; struct module_config *cfg = &md->cfg; diff --git a/src/ipc/ipc4/handler.c b/src/ipc/ipc4/handler.c index 6645d6fd08e5..4ed3387ed0ad 100644 --- a/src/ipc/ipc4/handler.c +++ b/src/ipc/ipc4/handler.c @@ -131,14 +131,14 @@ static inline const struct ipc4_pipeline_set_state_data *ipc4_get_pipeline_data( /* * Global IPC Operations. */ -static int ipc4_new_pipeline(struct ipc4_message_request *ipc4) +__cold static int ipc4_new_pipeline(struct ipc4_message_request *ipc4) { struct ipc *ipc = ipc_get(); return ipc_pipeline_new(ipc, (ipc_pipe_new *)ipc4); } -static int ipc4_delete_pipeline(struct ipc4_message_request *ipc4) +__cold static int ipc4_delete_pipeline(struct ipc4_message_request *ipc4) { struct ipc4_pipeline_delete *pipe; struct ipc *ipc = ipc_get(); @@ -149,7 +149,7 @@ static int ipc4_delete_pipeline(struct ipc4_message_request *ipc4) return ipc_pipeline_free(ipc, pipe->primary.r.instance_id); } -static int ipc4_comp_params(struct comp_dev *current, +__cold static int ipc4_comp_params(struct comp_dev *current, struct comp_buffer *calling_buf, struct pipeline_walk_context *ctx, int dir) { @@ -171,7 +171,7 @@ static int ipc4_comp_params(struct comp_dev *current, return pipeline_for_each_comp(current, ctx, dir); } -static int ipc4_pipeline_params(struct pipeline *p, struct comp_dev *host) +__cold static int ipc4_pipeline_params(struct pipeline *p, struct comp_dev *host) { struct sof_ipc_pcm_params hw_params = {{ 0 }}; struct pipeline_data data = { @@ -189,7 +189,7 @@ static int ipc4_pipeline_params(struct pipeline *p, struct comp_dev *host) return param_ctx.comp_func(host, NULL, ¶m_ctx, host->direction); } -static int ipc4_pcm_params(struct ipc_comp_dev *pcm_dev) +__cold static int ipc4_pcm_params(struct ipc_comp_dev *pcm_dev) { int err, reset_err; @@ -229,7 +229,7 @@ static int ipc4_pcm_params(struct ipc_comp_dev *pcm_dev) return err; } -static bool is_any_ppl_active(void) +__cold static bool is_any_ppl_active(void) { struct ipc_comp_dev *icd; struct list_item *clist; @@ -246,7 +246,7 @@ static bool is_any_ppl_active(void) return false; } -static struct ipc_comp_dev *pipeline_get_host_dev(struct ipc_comp_dev *ppl_icd) +__cold static struct ipc_comp_dev *pipeline_get_host_dev(struct ipc_comp_dev *ppl_icd) { struct ipc_comp_dev *host_dev; struct ipc *ipc = ipc_get(); @@ -315,7 +315,7 @@ static struct ipc_comp_dev *pipeline_get_host_dev(struct ipc_comp_dev *ppl_icd) * / */ -int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd) +__cold int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd) { struct ipc_comp_dev *host = NULL; struct ipc *ipc = ipc_get(); @@ -404,7 +404,7 @@ int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd) return ret; } -int ipc4_pipeline_trigger(struct ipc_comp_dev *ppl_icd, uint32_t cmd, bool *delayed) +__cold int ipc4_pipeline_trigger(struct ipc_comp_dev *ppl_icd, uint32_t cmd, bool *delayed) { struct ipc_comp_dev *host; int status; @@ -496,7 +496,7 @@ int ipc4_pipeline_trigger(struct ipc_comp_dev *ppl_icd, uint32_t cmd, bool *dela return ret; } -static void ipc_compound_pre_start(int msg_id) +__cold static void ipc_compound_pre_start(int msg_id) { /* ipc thread will wait for all scheduled tasks to be complete * Use a reference count to check status of these tasks. @@ -504,7 +504,7 @@ static void ipc_compound_pre_start(int msg_id) atomic_add(&msg_data.delayed_reply, 1); } -static void ipc_compound_post_start(uint32_t msg_id, int ret, bool delayed) +__cold static void ipc_compound_post_start(uint32_t msg_id, int ret, bool delayed) { if (ret) { ipc_cmd_err(&ipc_tr, "failed to process msg %d status %d", msg_id, ret); @@ -517,7 +517,7 @@ static void ipc_compound_post_start(uint32_t msg_id, int ret, bool delayed) atomic_sub(&msg_data.delayed_reply, 1); } -static void ipc_compound_msg_done(uint32_t msg_id, int error) +__cold static void ipc_compound_msg_done(uint32_t msg_id, int error) { if (!atomic_read(&msg_data.delayed_reply)) { ipc_cmd_err(&ipc_tr, "unexpected delayed reply"); @@ -544,7 +544,7 @@ static int ipc_wait_for_compound_msg(void) return IPC4_SUCCESS; } #else -static int ipc_wait_for_compound_msg(void) +__cold static int ipc_wait_for_compound_msg(void) { int try_count = 30; @@ -562,7 +562,7 @@ static int ipc_wait_for_compound_msg(void) } #endif -const struct ipc4_pipeline_set_state_data *ipc4_get_pipeline_data_wrapper(void) +__cold const struct ipc4_pipeline_set_state_data *ipc4_get_pipeline_data_wrapper(void) { const struct ipc4_pipeline_set_state_data *ppl_data; @@ -571,7 +571,7 @@ const struct ipc4_pipeline_set_state_data *ipc4_get_pipeline_data_wrapper(void) return ppl_data; } -static int ipc4_set_pipeline_state(struct ipc4_message_request *ipc4) +__cold static int ipc4_set_pipeline_state(struct ipc4_message_request *ipc4) { const struct ipc4_pipeline_set_state_data *ppl_data; struct ipc4_pipeline_set_state state; @@ -700,7 +700,7 @@ static int ipc4_set_pipeline_state(struct ipc4_message_request *ipc4) } #if CONFIG_LIBRARY_MANAGER -static int ipc4_load_library(struct ipc4_message_request *ipc4) +__cold static int ipc4_load_library(struct ipc4_message_request *ipc4) { struct ipc4_module_load_library library; int ret; @@ -716,7 +716,7 @@ static int ipc4_load_library(struct ipc4_message_request *ipc4) } #endif -static int ipc4_process_chain_dma(struct ipc4_message_request *ipc4) +__cold static int ipc4_process_chain_dma(struct ipc4_message_request *ipc4) { #if CONFIG_COMP_CHAIN_DMA struct ipc_comp_dev *cdma_comp; @@ -771,7 +771,7 @@ static int ipc4_process_chain_dma(struct ipc4_message_request *ipc4) #endif } -static int ipc4_process_ipcgtw_cmd(struct ipc4_message_request *ipc4) +__cold static int ipc4_process_ipcgtw_cmd(struct ipc4_message_request *ipc4) { #if CONFIG_IPC4_GATEWAY struct ipc *ipc = ipc_get(); @@ -810,7 +810,7 @@ static int ipc4_process_ipcgtw_cmd(struct ipc4_message_request *ipc4) #endif } -static int ipc4_process_glb_message(struct ipc4_message_request *ipc4) +__cold static int ipc4_process_glb_message(struct ipc4_message_request *ipc4) { uint32_t type; int ret; @@ -891,7 +891,7 @@ static int ipc4_process_glb_message(struct ipc4_message_request *ipc4) * delete module <-------> free component */ -static int ipc4_init_module_instance(struct ipc4_message_request *ipc4) +__cold static int ipc4_init_module_instance(struct ipc4_message_request *ipc4) { struct ipc4_module_init_instance module_init; struct comp_dev *dev; @@ -921,7 +921,7 @@ static int ipc4_init_module_instance(struct ipc4_message_request *ipc4) return 0; } -static int ipc4_bind_module_instance(struct ipc4_message_request *ipc4) +__cold static int ipc4_bind_module_instance(struct ipc4_message_request *ipc4) { struct ipc4_module_bind_unbind bu; struct ipc *ipc = ipc_get(); @@ -937,7 +937,7 @@ static int ipc4_bind_module_instance(struct ipc4_message_request *ipc4) return ipc_comp_connect(ipc, (ipc_pipe_comp_connect *)&bu); } -static int ipc4_unbind_module_instance(struct ipc4_message_request *ipc4) +__cold static int ipc4_unbind_module_instance(struct ipc4_message_request *ipc4) { struct ipc4_module_bind_unbind bu; struct ipc *ipc = ipc_get(); @@ -953,7 +953,7 @@ static int ipc4_unbind_module_instance(struct ipc4_message_request *ipc4) return ipc_comp_disconnect(ipc, (ipc_pipe_comp_connect *)&bu); } -static int ipc4_get_vendor_config_module_instance(struct comp_dev *dev, +__cold static int ipc4_get_vendor_config_module_instance(struct comp_dev *dev, const struct comp_driver *drv, bool init_block, bool final_block, @@ -1046,7 +1046,7 @@ static int ipc4_get_vendor_config_module_instance(struct comp_dev *dev, return IPC4_SUCCESS; } -static int ipc4_get_large_config_module_instance(struct ipc4_message_request *ipc4) +__cold static int ipc4_get_large_config_module_instance(struct ipc4_message_request *ipc4) { struct ipc4_module_large_config_reply reply; struct ipc4_module_large_config config; @@ -1085,7 +1085,7 @@ static int ipc4_get_large_config_module_instance(struct ipc4_message_request *ip } if (!drv) - return IPC4_MOD_INVALID_ID; + return IPC4_MOD_INVALID_ID + (config.primary.r.module_id ? 7 : 8); if (!drv->ops.get_large_config) return IPC4_INVALID_REQUEST; @@ -1146,7 +1146,7 @@ static int ipc4_get_large_config_module_instance(struct ipc4_message_request *ip return ret; } -static int ipc4_set_vendor_config_module_instance(struct comp_dev *dev, +__cold static int ipc4_set_vendor_config_module_instance(struct comp_dev *dev, const struct comp_driver *drv, uint32_t module_id, uint32_t instance_id, @@ -1209,7 +1209,7 @@ static int ipc4_set_vendor_config_module_instance(struct comp_dev *dev, data_off_size, data); } -static int ipc4_set_large_config_module_instance(struct ipc4_message_request *ipc4) +__cold static int ipc4_set_large_config_module_instance(struct ipc4_message_request *ipc4) { struct ipc4_module_large_config config; struct comp_dev *dev = NULL; diff --git a/src/schedule/edf_schedule.c b/src/schedule/edf_schedule.c index 11bf195dba7a..dfc668cf94b3 100644 --- a/src/schedule/edf_schedule.c +++ b/src/schedule/edf_schedule.c @@ -33,7 +33,7 @@ struct edf_schedule_data { int irq; }; -static const struct scheduler_ops schedule_edf_ops; +__cold_rodata static const struct scheduler_ops schedule_edf_ops; static int schedule_edf_task_complete(void *data, struct task *task); static int schedule_edf_task_running(void *data, struct task *task);