mbox series

[v8,0/4] userspace MHI client interface driver

Message ID 1603354958-24025-1-git-send-email-hemantk@codeaurora.org (mailing list archive)
Headers show
Series userspace MHI client interface driver | expand

Message

Hemant Kumar Oct. 22, 2020, 8:22 a.m. UTC
This patch series adds support for UCI driver. 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. These file
operations call MHI core layer APIs to perform data transfer using MHI bus
to communicate with MHI device. Patch is tested using arm64 based platform.

V8:
- Fixed kernel test robot compilation error by changing %lu to %zu for
  size_t.
- Replaced uci with UCI in Kconfig, commit text, and comments in driver
  code.
- Fixed minor style related comments.

V7:
- Decoupled uci device and uci channel objects. uci device is
  associated with device file node. uci channel is associated
  with MHI channels. uci device refers to uci channel to perform
  MHI channel operations for device file operations like read()
  and write(). uci device increments its reference count for
  every open(). uci device calls mhi_uci_dev_start_chan() to start
  the MHI channel. uci channel object is tracking number of times
  MHI channel is referred. This allows to keep the MHI channel in
  start state until last release() is called. After that uci channel
  reference count goes to 0 and uci channel clean up is performed
  which stops the MHI channel. After the last call to release() if
  driver is removed uci reference count becomes 0 and uci object is
  cleaned up.
- Use separate uci channel read and write lock to fine grain locking
  between reader and writer.
- Use uci device lock to synchronize open, release and driver remove.
- Optimize for downlink only or uplink only UCI device.

V6:
- Moved uci.c to mhi directory.
- Updated Kconfig to add module information.
- Updated Makefile to rename uci object file name as mhi_uci
- Removed kref for open count

V5:
- Removed mhi_uci_drv structure.
- Used idr instead of creating global list of uci devices.
- Used kref instead of local ref counting for uci device and
  open count.
- Removed unlikely macro.

V4:
- Fix locking to protect proper struct members.
- Updated documentation describing uci client driver use cases.
- Fixed uci ref counting in mhi_uci_open for error case.
- Addressed style related review comments.

V3: Added documentation for MHI UCI driver.

V2: Added mutex lock to prevent multiple readers to access same
mhi buffer which can result into use after free.
Hemant Kumar (4):
  bus: mhi: core: Add helper API to return number of free TREs
  bus: mhi: core: Move MHI_MAX_MTU to external header file
  docs: Add documentation for userspace client interface
  bus: mhi: Add userspace client interface driver

 Documentation/mhi/index.rst     |   1 +
 Documentation/mhi/uci.rst       |  83 +++++
 drivers/bus/mhi/Kconfig         |  13 +
 drivers/bus/mhi/Makefile        |   4 +
 drivers/bus/mhi/core/internal.h |   1 -
 drivers/bus/mhi/core/main.c     |  12 +
 drivers/bus/mhi/uci.c           | 657 ++++++++++++++++++++++++++++++++++++++++
 include/linux/mhi.h             |  12 +
 8 files changed, 782 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/mhi/uci.rst
 create mode 100644 drivers/bus/mhi/uci.c

Comments

Jakub Kicinski Oct. 23, 2020, 4:37 p.m. UTC | #1
On Thu, 22 Oct 2020 01:22:34 -0700 Hemant Kumar wrote:
> This patch series adds support for UCI driver. 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. These file
> operations call MHI core layer APIs to perform data transfer using MHI bus
> to communicate with MHI device. Patch is tested using arm64 based platform.

Until you CC netdev on this (as suggested [1]), here's my:

Nacked-by: Jakub Kicinski <kuba@kernel.org>

[1]
https://lore.kernel.org/netdev/20201016183759.7fa7c0ef@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com/
Hemant Kumar Oct. 23, 2020, 5:22 p.m. UTC | #2
Hi Jakub,

On 10/23/20 9:37 AM, Jakub Kicinski wrote:
> On Thu, 22 Oct 2020 01:22:34 -0700 Hemant Kumar wrote:
>> This patch series adds support for UCI driver. 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. These file
>> operations call MHI core layer APIs to perform data transfer using MHI bus
>> to communicate with MHI device. Patch is tested using arm64 based platform.
> 
> Until you CC netdev on this (as suggested [1]), here's my:
> 
> Nacked-by: Jakub Kicinski <kuba@kernel.org>
> 
> [1]
> https://lore.kernel.org/netdev/20201016183759.7fa7c0ef@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com/
> 

UCI driver patch series includes following patches

1)   bus: mhi: core: Add helper API to return number of free TREs
2)   bus: mhi: core: Move MHI_MAX_MTU to external header file
3)   docs: Add documentation for userspace client interface
4)   bus: mhi: Add userspace client interface driver

mhi net driver can use  #1 and #2 and these two are part of MHI core 
driver change. These are helper API/macro which can be used by any mhi 
clients like UCI or mhi net dev.

#3 and #4 are MHI UCI character driver completely unrelated to netdev.

How about splitting the patch series between #1,#2 and #3, #4 and add 
netdev to #1, #2?

#1,#2 were already reviewed by two folks in community so it would be 
much easier for netdev folks to refer that in context of mhi net device 
driver.

Please let me know what do you think about this idea.

Thanks,
Hemant
Jakub Kicinski Oct. 23, 2020, 5:38 p.m. UTC | #3
On Fri, 23 Oct 2020 10:22:19 -0700 Hemant Kumar wrote:
> On 10/23/20 9:37 AM, Jakub Kicinski wrote:
> > On Thu, 22 Oct 2020 01:22:34 -0700 Hemant Kumar wrote:  
> >> This patch series adds support for UCI driver. 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. These file
> >> operations call MHI core layer APIs to perform data transfer using MHI bus
> >> to communicate with MHI device. Patch is tested using arm64 based platform.  
> > 
> > Until you CC netdev on this (as suggested [1]), here's my:
> > 
> > Nacked-by: Jakub Kicinski <kuba@kernel.org>
> > 
> > [1]
> > https://lore.kernel.org/netdev/20201016183759.7fa7c0ef@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com/
> >   
> 
> UCI driver patch series includes following patches
> 
> 1)   bus: mhi: core: Add helper API to return number of free TREs
> 2)   bus: mhi: core: Move MHI_MAX_MTU to external header file
> 3)   docs: Add documentation for userspace client interface
> 4)   bus: mhi: Add userspace client interface driver
> 
> mhi net driver can use  #1 and #2 and these two are part of MHI core 
> driver change. These are helper API/macro which can be used by any mhi 
> clients like UCI or mhi net dev.
> 
> #3 and #4 are MHI UCI character driver completely unrelated to netdev.
> 
> How about splitting the patch series between #1,#2 and #3, #4 and add 
> netdev to #1, #2?
> 
> #1,#2 were already reviewed by two folks in community so it would be 
> much easier for netdev folks to refer that in context of mhi net device 
> driver.
> 
> Please let me know what do you think about this idea.

CC netdev on the entire series.

We will judge what is and isn't related to networking.