-
Notifications
You must be signed in to change notification settings - Fork 140
ASoC: SOF: Intel: hda: modify core_power_up/down op #2333
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
ASoC: SOF: Intel: hda: modify core_power_up/down op #2333
Conversation
e85ca86 to
f7a23e5
Compare
sound/soc/sof/intel/hda-dsp.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is interesting. So, chip->cores_mask is not all DSP cores, but only those, power managed by the host? .cores_num too? Looks like .cores_num isn't used at all. If anything it might be difficult to follow, IMHO we need at least comments in struct sof_intel_dsp_desc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the number of cores could be useful in future updates to verify that e.g. if we want a pipeline on core 3, well do we actually have a core3?
That said I wonder if we shouldn't use 'physical_cores' and 'power_managed_cores' to explain what this really means. cores_mask looks like number of cores, it really doesn't help understand the nuance about pm differences.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, would be good to make this a bit clearer
plbossart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question and comment below. Thanks @ranj063
sound/soc/sof/intel/hda-dsp.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also struggling a bit here. If e.g. a topology needs a pipeline on core 2, then how will core 2 be turned on? We're missing the IPC to the firmware, aren't we?
While I am at it, we should remove all the mask macros and use BIT() and GENMASK() for clarity. The use of HDA_DSP_CORE_MASK() is just not useful and prevents us from using GENMASK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plbossart we do 2 things during topology load today: Power up the cores and send the IPC
linux/sound/soc/sof/topology.c
Line 1292 in 06accba
| static int sof_core_enable(struct snd_sof_dev *sdev, int core) |
What we were missing was that we would unnecessarily set the SPA bits for the cores that cant possibly be powered on fom the host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but that comment
linux/sound/soc/sof/topology.c
Line 1317 in 06accba
| /* Now notify DSP that the core has been powered up */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right. let me add some more cleanups and comments to make this change a bit more intuitive
sound/soc/sof/intel/hda-dsp.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the number of cores could be useful in future updates to verify that e.g. if we want a pipeline on core 3, well do we actually have a core3?
That said I wonder if we shouldn't use 'physical_cores' and 'power_managed_cores' to explain what this really means. cores_mask looks like number of cores, it really doesn't help understand the nuance about pm differences.
|
@ranj063 do you mind updating this PR, there were only cosmetic comments from Guennadi and I, we should send this upstream when the merge window opens. |
@plbossart ack. I can do this by Monday. |
f7a23e5 to
7faf72f
Compare
7faf72f to
ff5213f
Compare
RanderWang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for me. Only one concern about "ret1"
Rename the cores_mask in struct sof_intel_dsp_desc to host_managed_cores_mask to be more indicative of the fact that only these cores can be powered up/down by the host. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Modify the core_power_up/down ops for HDA platforms to restrict the core_mask to the ones allowed by chip->cores_mask. This is needed because on some HDA platforms not all cores can be powered up/down by the host and this must be handled internally in the FW. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Remove the HDA_DSP_CORE_MASK() macro and use BIT() and GENMASK() macros directly for more clarity. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
ff5213f to
fc47921
Compare
Core power up involves 2 steps: The first step tries to power up the core by setting the ADSPCS.SPA bit for the host-managed cores. The second step involves sending the IPC to power up other cores that are not host managed. The enabled_cores_mask should be updated only when both these steps are successful. If the IPC to the DSP fails, the host-managed core that was powered in step 1 should be powered off before returning the error. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
fc47921 to
f8b66f8
Compare
RanderWang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Thanks for the refining here, @ranj063 it looks almost good to me, but how about the cores disable sequence, we might need similar logic like send IPC to FW first and then power down host_managed_cores and then update the enabled_cores_mask? |
@keyonjie you have a point but that will have to be another PR. Unfortunately during widget unload, we cant just power down the core its pipeline is scheduled on. We need some kind of refcounting to make sure there isnt anything else using it. |
Oh, yes, that is what my previous PR #888 did. So at this point, it looks good to me. |
Modify the core_power_up/down op for HDA platforms to restrict
the core_mask to the ones allowed by chip->cores_mask. This is needed
because on some HDA platforms not all cores can be powered up/down
by the host and this must be handled internally in the FW.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com