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

Fixes for dynamic pipelines and multi-core #3019

Merged

Conversation

ranj063
Copy link
Collaborator

@ranj063 ranj063 commented Jun 30, 2021

No description provided.

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

This is somewhat challenging set to review, but the changes seem correct. The main concern I have are the new ops. It seems a get/put model is the way to go, but now that we introduce it, having the old power_up/down ops seem really out-of-place.

sound/soc/sof/sof-audio.c Show resolved Hide resolved
sound/soc/sof/sof-audio.c Outdated Show resolved Hide resolved
sound/soc/sof/ops.h Show resolved Hide resolved
@ranj063 ranj063 force-pushed the fix/multi_core_dyn_pipes branch 4 times, most recently from 9bfcc3f to 3f1488f Compare June 30, 2021 17:53
Copy link

@lyakh lyakh left a comment

Choose a reason for hiding this comment

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

I do think this API makes more sense than the previous one, looks nice! Just some minor clean up. Since none of the comments address real bugs, I'll make it a comment

sound/soc/sof/intel/hda-dai.c Outdated Show resolved Hide resolved
sound/soc/sof/intel/hda-dai.c Outdated Show resolved Hide resolved
sound/soc/sof/intel/hda.c Show resolved Hide resolved
sound/soc/sof/intel/shim.h Outdated Show resolved Hide resolved
drivers/soundwire/intel.c Outdated Show resolved Hide resolved
sound/soc/sof/sof-audio.c Outdated Show resolved Hide resolved

/* reset route setup status for all routes that contain this widget */
sof_reset_route_setup_status(sdev, swidget);
swidget->complete = 0;
dev_dbg(sdev->dev, "widget %s freed\n", swidget->widget->name);

return 0;
return ret;
Copy link

Choose a reason for hiding this comment

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

you can return a negative error code if the IPC failed but in fact you still performed the rest of the clean up. A failing IPC used to return an error from this before too, so you aren't changing that. There are many places in hda.c and hda-dai.c where this error code is propagated to the caller, hopefully they're all correct and are taking into account that this can be a "soft" failure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, the thing is the core ref_count needs to decremented even if the widget free fails. I think this is correct to do a core_put even if widget free failed. Otherwise, the core ref_count's will be messed up and will prevent D3

sound/soc/sof/sof-audio.c Outdated Show resolved Hide resolved
sound/soc/sof/intel/hda-dai.c Outdated Show resolved Hide resolved
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

I'll remove my request-changes for now.

@kv2019i kv2019i dismissed their stale review July 2, 2021 17:19

I'm not available for re-review

Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

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

I think we should remove SSP and SoundWire patches from this PR, they are controversial and need to be tested separately.

sound/soc/sof/imx/imx8.c Outdated Show resolved Hide resolved
sound/soc/sof/intel/shim.h Outdated Show resolved Hide resolved
drivers/soundwire/intel.c Outdated Show resolved Hide resolved
sound/soc/sof/ops.h Outdated Show resolved Hide resolved
sound/soc/sof/intel/tgl.c Show resolved Hide resolved
sound/soc/sof/intel/tgl.c Outdated Show resolved Hide resolved
sound/soc/sof/intel/hda-dsp.c Outdated Show resolved Hide resolved
sound/soc/sof/intel/cnl.c Show resolved Hide resolved
sound/soc/sof/sof-audio.c Show resolved Hide resolved
Add two fields num_cores and dsp_cores_ref_count to
struct snd_sof_dev. These will be used to maintain the
ref count for each core to determine when it should be
powered up or down.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Add ops to get/put a core that will be used to power
up/down a core along with incrementing/decrementing
its ref_count.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Set core_get/put() ops for TGL. When core_get()
is requested for a core, its ref_count is incremented
and the PM_CORE_ENABLE IPC sent to the firmware to
power up the core if the current ref_count is 1.
Conversely, the ref_count is decremented in core_put()
and an IPC is sent to the DSP to power off the core
if the ref_count is 0.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@ranj063 ranj063 force-pushed the fix/multi_core_dyn_pipes branch 2 times, most recently from 716ff58 to fe4f2a9 Compare July 28, 2021 00:35
@ranj063 ranj063 requested review from plbossart and lyakh and removed request for plbossart and lyakh August 2, 2021 20:20
@ranj063
Copy link
Collaborator Author

ranj063 commented Aug 2, 2021

@plbossart @lyakh do you have any more comments/concerns with this PR?

Set core_get/put ops for CNL/ICL platforms. These platforms
do not support enabling/disabling secondary cores
dynamically. So skip sending the IPC to power off the
cores in the core_put op.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Remove the function sof_load_pipeline_ipc() and directly
send the IPC instead. The pipeline core is already enabled
with the call to sof_pipeline_core_enable() in sof_widget_setup().

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
…ines

Free widgets for static pipelines in sof_tear_down_pipelines().
But this feature is unavailable in older firmware with ABI < 3.19.
Just reset widget use_count's for this case. This would ensure that
the secondary cores enabled required for topology setup are powered
down properly before the primary core is powered off during
system suspend.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
The core_power_up/down() ops will be deprecated. Use the
HDA platform-specific functions for powering up/down
the cores during probe/suspend/remove. The enabled_cores_mask
and the core ref_count's are manually updated in each of
these functions.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
This patch adds support for dynamic pipelines with multi-core
by using the platform-specific core_get/put() ops to
power up/down a core when a widget is set up/freed.

Along with this, a few redundant functions are removed:
1. sof_pipeline_core_enable() is no longer needed as the
pipeline core will be set up when the pipeline widget
is set up
2. sof_core_enable() is replaced with snd_sof_core_get()
4. core_power_up/down() DSP ops are deprecated and replaced with
core get/put ops.
5. Core power down in sof_widget_unload() during topology
removal is also removed as it is not really needed. For dynamic
pipelines, the cores will be powered off when they are not used.
For static pipelines, the cores will be powered off in the device
remove callback.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
To keep the widget use_counts balanced, free the DAI widget
during suspend and also during the stop trigger.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@bardliao
Copy link
Collaborator

bardliao commented Aug 3, 2021

There is no regression found when I run run-all-tests.sh on my CML device.

@plbossart
Copy link
Member

I started Intel test 5682 on this PR as the last verification prior to merge.

@plbossart
Copy link
Member

test 5682 did not show any new issues, let's merge.

@plbossart plbossart merged commit 16d5c45 into thesofproject:topic/sof-dev Aug 3, 2021
@ranj063 ranj063 deleted the fix/multi_core_dyn_pipes branch August 3, 2021 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants