Message ID | 1603495075-11462-4-git-send-email-hemantk@codeaurora.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | userspace MHI client interface driver | expand |
On Fri, 23 Oct 2020 16:17:54 -0700 Hemant Kumar wrote: > +UCI driver enables userspace clients to communicate to external MHI devices > +like modem and WLAN. UCI driver probe creates standard character device file > +nodes for userspace clients to perform open, read, write, poll and release file > +operations. What's the user space that talks to this?
On 10/25/2020 3:46 PM, Jakub Kicinski wrote: > On Fri, 23 Oct 2020 16:17:54 -0700 Hemant Kumar wrote: >> +UCI driver enables userspace clients to communicate to external MHI devices >> +like modem and WLAN. UCI driver probe creates standard character device file >> +nodes for userspace clients to perform open, read, write, poll and release file >> +operations. > > What's the user space that talks to this? > Multiple. Each channel has a different purpose. There it is expected that a different userspace application would be using it. Hemant implemented the loopback channel, which is a simple channel that just sends you back anything you send it. Typically this is consumed by a test application. Diag is a typical channel to be consumed by userspace. This is consumed by various applications that talk to the remote device for diagnostic information (logs and such). Sahara is another common channel that is usually used for the multistage firmware loading process.
On Mon, 2020-10-26 at 07:38 -0600, Jeffrey Hugo wrote: > On 10/25/2020 3:46 PM, Jakub Kicinski wrote: > > On Fri, 23 Oct 2020 16:17:54 -0700 Hemant Kumar wrote: > > > +UCI driver enables userspace clients to communicate to external > > > MHI devices > > > +like modem and WLAN. UCI driver probe creates standard character > > > device file > > > +nodes for userspace clients to perform open, read, write, poll > > > and release file > > > +operations. > > > > What's the user space that talks to this? > > > > Multiple. > > Each channel has a different purpose. There it is expected that a > different userspace application would be using it. > > Hemant implemented the loopback channel, which is a simple channel > that > just sends you back anything you send it. Typically this is consumed > by > a test application. > > Diag is a typical channel to be consumed by userspace. This is > consumed > by various applications that talk to the remote device for > diagnostic > information (logs and such). QMI too? Dan > Sahara is another common channel that is usually used for the > multistage > firmware loading process. >
On 10/26/2020 7:46 AM, Dan Williams wrote: > On Mon, 2020-10-26 at 07:38 -0600, Jeffrey Hugo wrote: >> On 10/25/2020 3:46 PM, Jakub Kicinski wrote: >>> On Fri, 23 Oct 2020 16:17:54 -0700 Hemant Kumar wrote: >>>> +UCI driver enables userspace clients to communicate to external >>>> MHI devices >>>> +like modem and WLAN. UCI driver probe creates standard character >>>> device file >>>> +nodes for userspace clients to perform open, read, write, poll >>>> and release file >>>> +operations. >>> >>> What's the user space that talks to this? >>> >> >> Multiple. >> >> Each channel has a different purpose. There it is expected that a >> different userspace application would be using it. >> >> Hemant implemented the loopback channel, which is a simple channel >> that >> just sends you back anything you send it. Typically this is consumed >> by >> a test application. >> >> Diag is a typical channel to be consumed by userspace. This is >> consumed >> by various applications that talk to the remote device for >> diagnostic >> information (logs and such). > > QMI too? > Dan Interesting question. My product doesn't use QMI. I would expect that all QMI runs through Router these days, but I am seeing some QMI channels in the downstream source. Hemant, Do you know what is the usecase for the QMI0/QMI1 channels?
On 10/26/20 6:56 AM, Jeffrey Hugo wrote: > On 10/26/2020 7:46 AM, Dan Williams wrote: >> On Mon, 2020-10-26 at 07:38 -0600, Jeffrey Hugo wrote: >>> On 10/25/2020 3:46 PM, Jakub Kicinski wrote: >>>> On Fri, 23 Oct 2020 16:17:54 -0700 Hemant Kumar wrote: >>>>> +UCI driver enables userspace clients to communicate to external >>>>> MHI devices >>>>> +like modem and WLAN. UCI driver probe creates standard character >>>>> device file >>>>> +nodes for userspace clients to perform open, read, write, poll >>>>> and release file >>>>> +operations. >>>> >>>> What's the user space that talks to this? >>>> >>> >>> Multiple. >>> >>> Each channel has a different purpose. There it is expected that a >>> different userspace application would be using it. >>> >>> Hemant implemented the loopback channel, which is a simple channel >>> that >>> just sends you back anything you send it. Typically this is consumed >>> by >>> a test application. >>> >>> Diag is a typical channel to be consumed by userspace. This is >>> consumed >>> by various applications that talk to the remote device for >>> diagnostic >>> information (logs and such). >> >> QMI too? >> Dan > > Interesting question. My product doesn't use QMI. I would expect that > all QMI runs through Router these days, but I am seeing some QMI > channels in the downstream source. > > Hemant, Do you know what is the usecase for the QMI0/QMI1 channels? > QMI0/QMI1 is used to send QMI message (control path) to bring the qmi rmnet data call. Thanks, Hemant
On Mon, 26 Oct 2020 07:38:46 -0600 Jeffrey Hugo wrote: > On 10/25/2020 3:46 PM, Jakub Kicinski wrote: > > On Fri, 23 Oct 2020 16:17:54 -0700 Hemant Kumar wrote: > >> +UCI driver enables userspace clients to communicate to external MHI devices > >> +like modem and WLAN. UCI driver probe creates standard character device file > >> +nodes for userspace clients to perform open, read, write, poll and release file > >> +operations. > > > > What's the user space that talks to this? > > Multiple. > > Each channel has a different purpose. There it is expected that a > different userspace application would be using it. > > Hemant implemented the loopback channel, which is a simple channel that > just sends you back anything you send it. Typically this is consumed by > a test application. > > Diag is a typical channel to be consumed by userspace. This is consumed > by various applications that talk to the remote device for diagnostic > information (logs and such). > > Sahara is another common channel that is usually used for the multistage > firmware loading process. Thanks for the info, are there any open source tests based on the loopback channel (perhaps even in tree?) Since that's the only channel enabled in this set its the only one we can comment on.
Hi Jakub, On 10/26/20 3:56 PM, Jakub Kicinski wrote: > On Mon, 26 Oct 2020 07:38:46 -0600 Jeffrey Hugo wrote: >> On 10/25/2020 3:46 PM, Jakub Kicinski wrote: >>> On Fri, 23 Oct 2020 16:17:54 -0700 Hemant Kumar wrote: >>>> +UCI driver enables userspace clients to communicate to external MHI devices >>>> +like modem and WLAN. UCI driver probe creates standard character device file >>>> +nodes for userspace clients to perform open, read, write, poll and release file >>>> +operations. >>> >>> What's the user space that talks to this? >> >> Multiple. >> >> Each channel has a different purpose. There it is expected that a >> different userspace application would be using it. >> >> Hemant implemented the loopback channel, which is a simple channel that >> just sends you back anything you send it. Typically this is consumed by >> a test application. >> >> Diag is a typical channel to be consumed by userspace. This is consumed >> by various applications that talk to the remote device for diagnostic >> information (logs and such). >> >> Sahara is another common channel that is usually used for the multistage >> firmware loading process. > > Thanks for the info, are there any open source tests based on the > loopback channel (perhaps even in tree?) > > Since that's the only channel enabled in this set its the only one > we can comment on. > i am not aware of any open source tests based on loopback channel. My testing includes multiple sessions of echo, cat etc using adb to confirm what is sent is received back. Loic is using UCI driver for his use case too. Loic, in case you have any use case (which is part of open source) which can use UCI driver, pls share that info ? I think as soon as UCI becomes part of the tree, more and more channels would get added to the driver having open source code for that from other folks in community (Loic would be one of them i guess). Thanks, Hemant
diff --git a/Documentation/mhi/index.rst b/Documentation/mhi/index.rst index 1d8dec3..c75a371 100644 --- a/Documentation/mhi/index.rst +++ b/Documentation/mhi/index.rst @@ -9,6 +9,7 @@ MHI mhi topology + uci .. only:: subproject and html diff --git a/Documentation/mhi/uci.rst b/Documentation/mhi/uci.rst new file mode 100644 index 0000000..fe901c4 --- /dev/null +++ b/Documentation/mhi/uci.rst @@ -0,0 +1,83 @@ +.. SPDX-License-Identifier: GPL-2.0 + +================================= +Userspace Client Interface (UCI) +================================= + +UCI driver enables userspace clients to communicate to external MHI devices +like modem and WLAN. UCI driver probe creates standard character device file +nodes for userspace clients to perform open, read, write, poll and release file +operations. + +Operations +========== + +open +---- + +Instantiates UCI channel object and starts MHI channels to move it to running +state. Inbound buffers are queued to downlink channel transfer ring. Every +subsequent open() increments UCI device reference count as well as UCI channel +reference count. + +read +---- + +When data transfer is completed on downlink channel, TRE buffer is copied to +pending list. Reader is unblocked and data is copied to userspace buffer. TRE +buffer is queued back to downlink channel transfer ring. + +write +----- + +Write buffer is queued to uplink channel transfer ring if ring is not full. Upon +uplink transfer completion buffer is freed. + +poll +---- + +Returns EPOLLIN | EPOLLRDNORM mask if pending list has buffers to be read by +userspace. Returns EPOLLOUT | EPOLLWRNORM mask if MHI uplink channel transfer +ring is not empty. Returns EPOLLERR when UCI driver is removed. MHI channels +move to disabled state upon driver remove. + +release +------- + +Decrements UCI device reference count and UCI channel reference count upon last +release(). UCI channel clean up is performed. MHI channel moves to disabled +state and inbound buffers are freed. + +Usage +===== + +Device file node is created with format:- + +/dev/mhi_<controller_name>_<mhi_device_name> + +controller_name is the name of underlying bus used to transfer data. mhi_device +name is the name of the MHI channel being used by MHI client in userspace to +send or receive data using MHI protocol. + +There is a separate character device file node created for each channel +specified in mhi device id table. MHI channels are statically defined by MHI +specification. The list of supported channels is in the channel list variable +of mhi_device_id table in UCI driver. + +LOOPBACK Channel +---------------- + +Userspace MHI client using LOOPBACK channel opens device file node. As part of +open operation TREs to transfer ring of LOOPBACK channel 1 gets queued and channel +doorbell is rung. When userspace MHI client performs write operation on device node, +data buffer gets queued as a TRE to transfer ring of LOOPBACK channel 0. MHI Core +driver rings the channel doorbell for MHI device to move data over underlying bus. +When userspace MHI client driver performs read operation, same data gets looped back +to MHI host using LOOPBACK channel 1. LOOPBACK channel is used to verify data path +and data integrity between MHI Host and MHI device. + +Other Use Cases +--------------- + +Getting MHI device specific diagnostics information to userspace MHI diag client +using DIAG channel 4 (Host to device) and 5 (Device to Host).
MHI userspace client driver is creating device file node for user application to perform file operations. File operations are handled by MHI core driver. Currently Loopback MHI channel is supported by this driver. Signed-off-by: Hemant Kumar <hemantk@codeaurora.org> --- Documentation/mhi/index.rst | 1 + Documentation/mhi/uci.rst | 83 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 Documentation/mhi/uci.rst