idc: add missing cache invalidation

Adds missing comp_dev invalidation before accessing it.
We also need to move core check a little bit further,
since it also uses both comp_dev and pipeline objects.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
Tomasz Lauda 2019-08-01 12:43:54 +02:00 committed by Liam Girdwood
parent f5e9cf69e3
commit 39b59af35f
1 changed files with 13 additions and 5 deletions

View File

@ -179,15 +179,19 @@ static int idc_pipeline_trigger(uint32_t cmd)
if (!pcm_dev)
return -ENODEV;
/* invalidate pipeline on start */
if (cmd == COMP_TRIGGER_START) {
/* invalidate cd before accessing it */
dcache_invalidate_region(pcm_dev->cd, sizeof(*pcm_dev->cd));
pipeline_cache(pcm_dev->cd->pipeline,
pcm_dev->cd, CACHE_INVALIDATE);
}
/* check whether we are executing from the right core */
if (arch_cpu_get_id() != pcm_dev->cd->pipeline->ipc_pipe.core)
return -EINVAL;
/* invalidate pipeline on start */
if (cmd == COMP_TRIGGER_START)
pipeline_cache(pcm_dev->cd->pipeline,
pcm_dev->cd, CACHE_INVALIDATE);
/* trigger pipeline */
ret = pipeline_trigger(pcm_dev->cd->pipeline, pcm_dev->cd, cmd);
@ -220,6 +224,10 @@ static int idc_component_command(uint32_t cmd)
if (!comp_dev)
return -ENODEV;
/* If we're here, then the pipeline is already running on this core.
* No need to invalidate any data.
*/
/* check whether we are executing from the right core */
if (arch_cpu_get_id() != comp_dev->cd->pipeline->ipc_pipe.core)
return -EINVAL;