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

SOF client support (auxiliary bus) - take3 #3136

Merged

Conversation

ujfalusi
Copy link
Collaborator

@ujfalusi ujfalusi commented Sep 3, 2021

Hi,

This is the continuation of #3007, which grown a bit and it is impossible to follow the comments and discussions.

-- keeping it Draft still. --

The main change is that I have squashed the patches and the last four patch is the core SOF client support.

Notable changes compared to the last version of #3007 are:

  • The compressed module_get_on_open() support is changed to the one I have sent upstream for comments:
    https://lore.kernel.org/alsa-devel/20210901095255.3617-1-peter.ujfalusi@linux.intel.com/
  • Patches moved around to have the SOF client support at the top
  • dma-trace support should work on i.MX as well with the new Kconfig setup and module parameter
  • Yet another fw_state introduced: SOF_FW_BOOT_READY_OK to indicate that the BOOT_READY message is OK

Notable no changes:

  • the auxiliary device's suspend and resume callbacks are used to make suspend/resume work with clients which needs to care about such a thing.

PS: Take3 since the previous "SOF client support (auxiliary bus)" was in fact take2, but I used a new name. compared to the first version from me.

@ujfalusi ujfalusi force-pushed the peter/sof/pr/sof_clients_03 branch 2 times, most recently from aefada4 to 6e1af95 Compare September 3, 2021 12:43
@ujfalusi
Copy link
Collaborator Author

ujfalusi commented Sep 3, 2021

Changes since v1:

  • checkpatch reports fixed

For v0 SOF CI reported 3 FAIL for APL_UP2_HDA, all three are capture tests and we only have playback support on the device.

@ujfalusi
Copy link
Collaborator Author

ujfalusi commented Sep 3, 2021

Interesting, typo fix in a comment and alignment fix for a function parameter broke CML_RVP_SDW and TGLH_RVP_HDA...

@ujfalusi
Copy link
Collaborator Author

ujfalusi commented Sep 6, 2021

Interesting, typo fix in a comment and alignment fix for a function parameter broke CML_RVP_SDW and TGLH_RVP_HDA...

for the record, the diff between v1 and v2 is:

diff --git a/include/sound/sof.h b/include/sound/sof.h
index cdedf7da2e44..9102fdbe1d46 100644
--- a/include/sound/sof.h
+++ b/include/sound/sof.h
@@ -24,8 +24,9 @@ struct snd_sof_dsp_ops;
  * @SOF_FW_BOOT_IN_PROGRESS:	firmware boot is in progress
  * @SOF_FW_BOOT_FAILED:		firmware boot failed
  * @SOF_FW_BOOT_READY_FAILED:	firmware booted but fw_ready op failed
+ * @SOF_FW_BOOT_READY_OK:	firmware booted and fw_ready op is OK
  * @SOF_FW_BOOT_COMPLETE:	firmware is booted up and functional
- * @SOF_FW_CRASHED:		firmware crashed after sucessful boot
+ * @SOF_FW_CRASHED:		firmware crashed after successful boot
  */
 enum snd_sof_fw_state {
 	SOF_FW_BOOT_NOT_STARTED = 0,
diff --git a/sound/soc/sof/sof-client-dma-trace.c b/sound/soc/sof/sof-client-dma-trace.c
index f24e3da7216e..e7e542d68e2d 100644
--- a/sound/soc/sof/sof-client-dma-trace.c
+++ b/sound/soc/sof/sof-client-dma-trace.c
@@ -643,7 +643,7 @@ static int sof_dtrace_client_resume(struct auxiliary_device *auxdev)
 }
 
 static int sof_dtrace_client_suspend(struct auxiliary_device *auxdev,
-                                    pm_message_t state)
+				     pm_message_t state)
 {
 	struct sof_client_dev *cdev = auxiliary_dev_to_sof_client_dev(auxdev);

Something is not right for sure. It might be that IPC timeout should be treated as a feature and not a failure. Let me try that.

@ujfalusi ujfalusi force-pushed the peter/sof/pr/sof_clients_03 branch from 6e1af95 to 46fbe99 Compare September 6, 2021 06:11
@ujfalusi
Copy link
Collaborator Author

ujfalusi commented Sep 6, 2021

Changes since v2:

  • add dev_dbg() prints for firmware state changes
  • do not treat IPC tx timeout as failure.

@ujfalusi
Copy link
Collaborator Author

ujfalusi commented Sep 6, 2021

Removed all reviewers for now until I figure out the root cause of the random failures reported by CI

@ujfalusi ujfalusi force-pushed the peter/sof/pr/sof_clients_03 branch from 46fbe99 to 4bc265f Compare September 7, 2021 08:18
@ujfalusi
Copy link
Collaborator Author

ujfalusi commented Sep 7, 2021

Changes since v3:

  • IPC tx timeout is now a feature and the dumps will be re-enabled upon successful IPC tx:
    patch: ASoC: SOF: debug/ipc: Treat IPC tx timeout as feature, not failure
  • one typo in a comment.

@plbossart
Copy link
Member

@ujfalusi my HDaudio renaming patch creates a conflict, can you rebase/push? Thanks!

@ujfalusi
Copy link
Collaborator Author

@ujfalusi my HDaudio renaming patch creates a conflict, can you rebase/push? Thanks!

@plbossart, done. There were one missed hdac_ext_stream rename, nut I did converted it with the rebase.

@plbossart
Copy link
Member

@ujfalusi my HDaudio renaming patch creates a conflict, can you rebase/push? Thanks!

@plbossart, done. There were one missed hdac_ext_stream rename, nut I did converted it with the rebase.

Not following, are you saying I missed one rename or you missed one?

@ujfalusi
Copy link
Collaborator Author

@ujfalusi my HDaudio renaming patch creates a conflict, can you rebase/push? Thanks!

@plbossart, done. There were one missed hdac_ext_stream rename, nut I did converted it with the rebase.

Not following, are you saying I missed one rename or you missed one?

I think you have missed one in hda_probe_compr_trigger (in intel/hda-probes.c) which I have fixed as part of the client conversion

@ujfalusi
Copy link
Collaborator Author

I think you have missed one in hda_probe_compr_trigger (in intel/hda-probes.c) which I have fixed as part of the client conversion

Hmm, I think I will add a fixup patch prior to the conversion for your cleanup tomorrow first thing and push the PR again so we can have a cleaner cleanup and SOF client conversion?

@plbossart
Copy link
Member

plbossart commented Nov 17, 2021

I think you have missed one in hda_probe_compr_trigger (in intel/hda-probes.c) which I have fixed as part of the client conversion

Hmm, I think I will add a fixup patch prior to the conversion for your cleanup tomorrow first thing and push the PR again so we can have a cleaner cleanup and SOF client conversion?

sorry about the mess, I should have double-checked the new code with a regexp, I missed a couple.
PR #3280 should fix all this

Now the only matches are in the Skylake driver but I am not going to touch this.

git grep 'hdac_ext_stream \*hstream'
git grep 'hdac_ext_stream \*stream'

@ujfalusi ujfalusi force-pushed the peter/sof/pr/sof_clients_03 branch from c1d92d5 to c01419c Compare November 18, 2021 04:49
ujfalusi and others added 9 commits November 18, 2021 06:49
The only reference to D3_HOT and D3_COLD DSP power state is in
intel/hda-dsp.c in form of a dev_dbg() print.

Remove them as they are not used and even if they are they could be
re-added via the substate.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
… header

Move the enum sof_dsp_power_states to include/sound/sof.h
to be accessible outside of the core SOF stack.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…vents

Change the parameter list for the firmware initiated message (IPC event)
handler functions to:
handler(struct snd_sof_dev *sdev, void *full_msg);

Allocate memory and read the whole message in snd_sof_ipc_msgs_rx() then
pass the pointer to the function handling the message.
Do this only if we actually have a function which is tasked to process the
given type.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The utils.c contains wrappers and implementation for accessing iomem mapped
regions and a single unrelated function to create a compressed page table
from snd_dma_buffer for firmware use.

The latter is used by the PCM and the dma trace code and it needs to be
moved to a generic source/header for the client conversion to be possible.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
A client in the SOF (Sound Open Firmware) context is a driver that needs
to communicate with the DSP via IPC messages. The SOF core is responsible
for serializing the IPC messages to the DSP from the different clients.

One example of an SOF client would be an IPC test client that floods the
DSP with test IPC messages to validate if the serialization works as
expected.

Multi-client support will also add the ability to split the existing audio
cards into multiple ones, so as to e.g. to deal with HDMI with a dedicated
client instead of adding HDMI to all cards.

This patch introduces descriptors for SOF client driver and SOF client
device along with APIs for registering and unregistering a SOF client
driver, sending IPCs from a client device and accessing the SOF core
debugfs root entry.

Along with this, add a couple of new members to struct snd_sof_dev that
will be used for maintaining the list of clients.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Co-developed-by: Fred Oh <fred.oh@linux.intel.com>
Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…ework

Some SOF client can be of 'passive' type, meaning that they do not handle
PM framework callbacks by themselves but rely on the auxiliary driver's
suspend and resume callbacks to be notified about the core's suspend or
resume event.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Move the IPC flood test code out from the debug file as separate SOF client
driver.

Based on the kernel configuration, the device registration for the new IPC
flood test is going to happen in the core.
With the separate client driver it is going to be possible to run multiple
flood tests in parallel to increase the stress, the new Kconfig option can
be used to select this (defaults to 1).
In order to preserve backward compatibility with existing SW/scripts, the
first IPC flood test's debugfs files have been linked to the old files.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Co-developed-by: Fred Oh <fred.oh@linux.intel.com>
Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Move the IPC message injection code out from the debug file as separate
SOF client driver.

Based on the kernel configuration, the device registration for the new IPC
message injector is going to happen in the core.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Add a new client driver for probes support and move
all the probes-related code from the core to the
client driver.

The probes client driver registers a component driver
with one CPU DAI driver for extraction and creates a
new sound card with one DUMMY DAI link with a dummy codec
that will be used for extracting audio data from specific
points in the audio pipeline.

The probes debugfs ops are based on the initial
implementation by Cezary Rojewski and have been moved
out of the SOF core into the client driver making it
easier to maintain. This change will make it easier
for the probes functionality to be added for all platforms
without having the need to modify the existing(15+) machine
drivers.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Copy link
Collaborator

@ranj063 ranj063 left a comment

Choose a reason for hiding this comment

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

nice work @ujfalusi LGTM

@kv2019i
Copy link
Collaborator

kv2019i commented Nov 23, 2021

Thanks all, finally merging this one.

@kv2019i kv2019i merged commit d5c4c30 into thesofproject:topic/sof-dev Nov 23, 2021
@ujfalusi ujfalusi deleted the peter/sof/pr/sof_clients_03 branch November 18, 2022 07:14
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.

8 participants