-
Notifications
You must be signed in to change notification settings - Fork 140
[RFC] Use virtual bus implementation in SOF #1841
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
Conversation
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.
Looks like a good start to me. Thanks @ranj063
lgirdwood
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.
I do need to read the virtio bus patches, but some questions that may impact the client PM.
kv2019i
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 ok so far. Biggest thing seems to be how we manage the sof_virtbus_dev objects as part of sdev and how we link back.
|
@plbossart @lgirdwood @lyakh @kv2019i this PR is now updated to include the second step ir registering a client drv and probing client devices after FW boot is done. The client device probe still does nothing atm but once we agree upon the registration model, I will add that to this PR. |
sound/soc/sof/sof-client.c
Outdated
|
|
||
| mutex_lock(&sof_client_mutex); | ||
| list_for_each_entry_safe(cdev, _cdev, &client_list, list) { | ||
| if (cdev->drv == drv) { |
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.
Your client_list is global, and as far as I understand we can in theory at some point get multiple DSPs. Would they then possibly use the same driver? Then this matching would break?
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.
@lyakh I'm not sure about this case. But my guess would be that if there are multiple DSP, they possibly should not share the same driver. @lgirdwood could you please chime in?
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 same driver can be used for multiple devices, but each would need to have its own context and not a shared variable.
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 How would that work though? If you look at sof_client_drv_register() today, we create a client device for each client drv that is registered. If multiple devices share the same driver, then we probably need some kind of id table just like the virtbus driver, right?
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.
We can create a new global context (which can hold lists etc) per detected DSP device, i.e. on PCI/ACPI probe.
145d738 to
c0251fe
Compare
|
@ranj063 I must be missing something here. If I look at the IPC, there is first layer that probes/removed the virtbus driver. And then the probe registers an SOF client, which results in a second level probe. Is this really necessary? seems to me you are bolting a bus on top of a bus? |
@plbossart the virtbus devices are actually only virtual devices. They need to be probed first before they can register with SOF for IPC. And we can probe the client devices only after the SOF core device has finished booting the DSP. So I cant imagine how we can avoid the 2-level probe that we have here. |
It was my understanding that all clients would be represented with a device that's a child of the PCI/ACPI/DT parent, which would by construction guarantee that the parent remains active as long as any of its children is active. |
c0251fe to
b7cfa48
Compare
|
@lgirdwood @plbossart I've updated this PR based on our discussions last week. The last 3 patches are the ones relevant for SOF. Please let me know what you think |
b7cfa48 to
0e1b090
Compare
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.
Thanks @ranj063 I must be missing a bit of context on the need for a list and the pointer v. structure nesting.
48cd91f to
d120705
Compare
b71cc9c to
2df63f4
Compare
kv2019i
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 @ranj063 . Really the only thing in the documentation was use of MFD versus PCI multifunction. Otherwise seems good.
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.
Sorry for chiming in late, the PCI part is just completely wrong.
|
|
||
| Virtual bus devices are created and registered by a multi-function PCI device. | ||
| Therefore, they are typically encapsulated within a structure defined by | ||
| parent PCI device which contains the virtual bus device and any associated |
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.
defined by the device or driver?
| void *data; | ||
| }; | ||
| The parent PCI device would then register the virtual bus device by calling |
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 'core' driver does the registration...
kv2019i
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.
A few minor notes on doc, but looks good. At least this now explicitly discussed the platform bus and MFD and why virtbus is added.
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.
Nice improvement on the documentation @ranj063
a couple of comments below to make it even nicer
This is the initial implementation of the Virtual Bus, virtbus_device and virtbus_driver. The virtual bus is a software based bus intended to support splitting the functionality of a subsystem's core device into orthogonal parts. This bus is also meant to be generic and be available to be used by any type of parent device (PCI/ACPI/DT). Signed-off-by: Dave Ertman <david.m.ertman@intel.com> Signed-off-by: Kiran Patil <kiran.patil@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
A client in the SOF (Sound Open Firmware) context is a device 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> Signed-off-by: Fred Oh <fred.oh@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Create an SOF client driver for IPC flood test. This driver is used to set up the debugfs entries and the read/write ops for initiating the IPC flood test that would be used to measure the min/max/avg response times for sending IPCs to the DSP. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Fred Oh <fred.oh@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Add a new op for registering clients. The clients to be registered depend on the DSP capabilities and the ACPI/DT information. For now, we only add 2 IPC test clients that will be used for run tandem IPC flood tests for all Intel platforms. For ACPI platforms, change the Kconfig to select SND_SOC_SOF_PROBE_WORK_QUEUE to allow the virtbus driver to probe when the client is registered. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Fred Oh <fred.oh@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Remove the IPC flood test support in the SOF core as it is now added in the IPC flood test client. Signed-off-by: Fred Oh <fred.oh@linux.intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
lyakh
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.
if you decide to fix the presumable '?' typo, this would be a perfect case for a "fixup" patch.
| Virtbus drivers register themselves with the bus by calling | ||
| virtbus_register_driver(). The id_table contains the names of virtbus devices | ||
| that a driver can bind with? |
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.
why a question mark? A typo?
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 think it was my suggestion with a question mark that was copied verbatim...
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, sorry about that. The documentation is so verbose now that I missed it :(
|
@ranj063 Can we close this, seems obsolete now...? |
This PR just shows the use virtual bus devices in SOF. The virtbus dev is encapsulated within a sof_client_dev to enable extending the ops supported by the virtbus_dev to include SOF client specific ops and data. This PR is now updated with the complete implementation for the dummy IPC client.
Please note that the first patch is still under review here:
http://patchwork.ozlabs.org/patch/1247882/