Skip to content

Conversation

@ranj063
Copy link
Collaborator

@ranj063 ranj063 commented Jul 31, 2020

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

Copy link
Collaborator

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

Copy link
Member

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.

Copy link
Collaborator

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

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.

question and comment below. Thanks @ranj063

Copy link
Member

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

Copy link
Collaborator Author

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

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.

Copy link
Member

Choose a reason for hiding this comment

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

but that comment

/* Now notify DSP that the core has been powered up */
is not longer correct then, you change the meaning of the IPC from telling the DSP has been turned on to requesting the firmware to turn a core on.

Copy link
Collaborator Author

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

Copy link
Member

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.

@plbossart
Copy link
Member

@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.

@ranj063
Copy link
Collaborator Author

ranj063 commented Aug 14, 2020

@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.

Copy link

@RanderWang RanderWang left a 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>
@ranj063 ranj063 force-pushed the fix/core_power_mask branch from ff5213f to fc47921 Compare August 19, 2020 17:33
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>
@ranj063 ranj063 force-pushed the fix/core_power_mask branch from fc47921 to f8b66f8 Compare August 19, 2020 17:34
@ranj063 ranj063 requested a review from RanderWang August 19, 2020 23:13
Copy link

@RanderWang RanderWang left a comment

Choose a reason for hiding this comment

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

LGTM

@keyonjie
Copy link

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?

@ranj063
Copy link
Collaborator Author

ranj063 commented Aug 20, 2020

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.

@keyonjie
Copy link

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.

@plbossart plbossart merged commit 85b94fd into thesofproject:topic/sof-dev Aug 24, 2020
@ranj063 ranj063 deleted the fix/core_power_mask branch February 13, 2022 05:08
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.

6 participants