Linux-remoteproc Archive on lore.kernel.org
 help / color / Atom feed
From: Arnaud Pouliquen <arnaud.pouliquen@st.com>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Ohad Ben-Cohen <ohad@wizery.com>,
	Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: <linux-remoteproc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<arnaud.pouliquen@st.com>
Subject: [PATCH 00/13] introduce IOCTL interface for RPMsg channel management
Date: Fri, 31 Jul 2020 14:10:30 +0200
Message-ID: <20200731121043.24199-1-arnaud.pouliquen@st.com> (raw)

This serie is inspired by the RPMsg char driver. The RPMsg char driver
provides interfaces that:
- expose a char RPMsg device for communication with the remote processor
- expose controls interface for applications to create and release channels

The purpose of this series is to decorrelate the two interfaces:
 - provide a char device for a RPMsg raw service similar to the rpmsg_char
   but that can be probed by a RPMsg bus on a ns announcement
 - generalize the use of the ioctl for all RPMsg services.

1) rpmsg raw driver: rpmsg_raw.c
For legacy reason, I created a new file instead of modifying the rpmsg_char
driver. But the rework of the rpmsg_char driver to only support the RPMsg
raw service could be an alternative
Few differences can be found:
    - The rpmsg class has not been implemented. The associated attributes
      are already available in /sys/bus/rpmsg/.
    - The eptdev device is now an RPMsg device probed by a RPMsg bus driver
      (probed only by the ioctl in rpmsg_char driver).
    - The associated endpoint is now created by the bus no more on the
      devfs open.

2) RPMsg control driver: rpmsg_ctrl.c
  This driver is based on the control part of the RPMsg_char driver. 
  On probe a /dev/rpmsg_ctrl<X> interface is created to allow to manage the
  channels.
  The principles are the following:
  - The RPMsg service driver registers it's name and the associated service
    using the rpmsg_ctrl_unregister_ctl API. The list of supported services
    is defined in  include/uapi/linux/rpmsg.h and exposed to the
    application thanks to a new field in rpmsg_endpoint_info struct.
  - On the RPMsg bus probe(e.g virtio bus) an rpmsg_ctrl device is
    registered that creates the control interface.
  - The application can then create or release a channel by specifying:
       - the name service
       - the source address (default: RPMSG_ADDR_ANY)
       - the destination address ( default: RPMSG_ADDR_ANY)
       - the associated service (new)
  - The rpmsg_ctrl uses the same interface than the ns announcement to
    create and release the channel but using the driver_override field to
    force the service name.
    The  "driver_override" allows to force the name service associated to
    an RPMsg driver, bypassing the rpmsg_device_id based match check.
  - At least for virtio bus, an associated ns announcement is sent to the
    remote side.  

Know current Limitations:
- Tested only with virtio RPMsg bus and for one vdev instance.
- rpmsg_device_match does not allow to match a local endpoint created by
  ioctl with a same service requested by the ns announcement callback.
- Current implementation of the release makes it possible to release any
  endpoint, even not created by the ioctl. Should we limit the release to
  the RPMsg channel created with the ioctl? 

This serie can be applied in Bjorn's rpmsg-next branch on top of the
RPMsg_ns series.

This series can be tested using rpmsgexport tools updated according to the
ioctl update and available here: https://github.com/arnopo/rpmsgexport. 

Arnaud Pouliquen (13):
  rpmsg: introduce rpmsg raw driver
  rpmsg: introduce rpmsg_control driver for channel creation
  rpmsg: add helper to create the rpmsg ctrl device
  rpmsg: virtio: probe the rpmsg_ctrl device
  rpmsg: uapi: add service param for create destroy ioctls
  rpmsg: add RPMsg control info structure
  rpmsg: control: add driver registration API
  rpmsg: raw: register service to the rpmsg control
  rpmsg: add override field in channel info
  rpmsg: ns: initialize channel info override field
  rpmsg: virtio: use the driver_override in channel creation
  rpmsg: control: implement the ioctrl function to create device
  rpmsg: ctrl: add support of the endpoints release

 drivers/rpmsg/Kconfig            |  17 ++
 drivers/rpmsg/Makefile           |   2 +
 drivers/rpmsg/rpmsg_ctrl.c       | 314 ++++++++++++++++++++++++++
 drivers/rpmsg/rpmsg_internal.h   |  18 ++
 drivers/rpmsg/rpmsg_ns.c         |   1 +
 drivers/rpmsg/rpmsg_raw.c        | 364 +++++++++++++++++++++++++++++++
 drivers/rpmsg/virtio_rpmsg_bus.c |  37 +++-
 include/linux/rpmsg.h            |  15 ++
 include/uapi/linux/rpmsg.h       |  17 ++
 9 files changed, 784 insertions(+), 1 deletion(-)
 create mode 100644 drivers/rpmsg/rpmsg_ctrl.c
 create mode 100644 drivers/rpmsg/rpmsg_raw.c

-- 
2.17.1


             reply index

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-31 12:10 Arnaud Pouliquen [this message]
2020-07-31 12:10 ` [PATCH 01/13] rpmsg: introduce rpmsg raw driver Arnaud Pouliquen
2020-07-31 12:10 ` [PATCH 02/13] rpmsg: introduce rpmsg_control driver for channel creation Arnaud Pouliquen
2020-07-31 15:56   ` Randy Dunlap
2020-07-31 12:10 ` [PATCH 03/13] rpmsg: add helper to create the rpmsg ctrl device Arnaud Pouliquen
2020-07-31 12:10 ` [PATCH 04/13] rpmsg: virtio: probe the rpmsg_ctrl device Arnaud Pouliquen
2020-07-31 12:10 ` [PATCH 05/13] rpmsg: uapi: add service param for create destroy ioctls Arnaud Pouliquen
2020-07-31 12:10 ` [PATCH 06/13] rpmsg: add RPMsg control info structure Arnaud Pouliquen
2020-07-31 12:10 ` [PATCH 07/13] rpmsg: control: add driver registration API Arnaud Pouliquen
2020-07-31 12:10 ` [PATCH 08/13] rpmsg: raw: register service to the rpmsg control Arnaud Pouliquen
2020-07-31 12:10 ` [PATCH 09/13] rpmsg: add override field in channel info Arnaud Pouliquen
2020-07-31 12:10 ` [PATCH 10/13] rpmsg: ns: initialize channel info override field Arnaud Pouliquen
2020-07-31 12:10 ` [PATCH 11/13] rpmsg: virtio: use the driver_override in channel creation Arnaud Pouliquen
2020-07-31 12:10 ` [PATCH 12/13] rpmsg: control: implement the ioctrl function to create device Arnaud Pouliquen
2020-07-31 12:10 ` [PATCH 13/13] rpmsg: ctrl: add support of the endpoints release Arnaud Pouliquen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200731121043.24199-1-arnaud.pouliquen@st.com \
    --to=arnaud.pouliquen@st.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=ohad@wizery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-remoteproc Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-remoteproc/0 linux-remoteproc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-remoteproc linux-remoteproc/ https://lore.kernel.org/linux-remoteproc \
		linux-remoteproc@vger.kernel.org
	public-inbox-index linux-remoteproc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-remoteproc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git