Skip to contentSkip to conversation

rpmsg: Make RPMSG name service modular

PATCH Applied Mathieu Poirier 4 participants 16 messages Nov 20, 2020 – Dec 7, 2020 Remote processor messaging (rpmsg)

lore
Share & tools
lore

Mathieu Poirier

author maintainer
#0 lore raw

v7 cover rpmsg: Make RPMSG name service modular

This revision addresses comments received from the previous revision, i.e V6. Please see details below.

It starts by making the RPMSG protocol transport agnostic by moving the headers it uses to generic types and using those in the current implementation. From there it re-uses the work that Arnaud published[1] to make the name service modular.

Tested on stm32mp157 with the RPMSG client sample application. Applies cleanly on rpmsg-next.

Thanks,
Mathieu

[1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=338335

-------
New for V7:
- Fixed error path in rpmsg_probe() as reported by Guennadi

Arnaud Pouliquen (4):
rpmsg: virtio: Rename rpmsg_create_channel
rpmsg: core: Add channel creation internal API
rpmsg: virtio: Add rpmsg channel device ops
rpmsg: Turn name service into a stand alone driver

Mathieu Poirier (4):
rpmsg: Introduce __rpmsg{16|32|64} types
rpmsg: virtio: Move from virtio to rpmsg byte conversion
rpmsg: Move structure rpmsg_ns_msg to header file
rpmsg: Make rpmsg_{register|unregister}_device() public

 drivers/rpmsg/Kconfig            |   9 ++
 drivers/rpmsg/Makefile           |   1 +
 drivers/rpmsg/rpmsg_core.c       |  44 ++++++++
 drivers/rpmsg/rpmsg_internal.h   |  14 ++-
 drivers/rpmsg/rpmsg_ns.c         | 126 +++++++++++++++++++++
 drivers/rpmsg/virtio_rpmsg_bus.c | 186 +++++++++++--------------------
 include/linux/rpmsg.h            |  63 ++++++++++-
 include/linux/rpmsg/byteorder.h  |  67 +++++++++++
 include/linux/rpmsg/ns.h         |  45 ++++++++
 include/uapi/linux/rpmsg_types.h |  11 ++
 10 files changed, 439 insertions(+), 127 deletions(-)
 create mode 100644 drivers/rpmsg/rpmsg_ns.c
 create mode 100644 include/linux/rpmsg/byteorder.h
 create mode 100644 include/linux/rpmsg/ns.h
 create mode 100644 include/uapi/linux/rpmsg_types.h
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH v7 1/8 rpmsg: Introduce __rpmsg{16|32|64} types

Introduce __rpmsg{16|32|64} types along with byte order conversion functions based on an rpmsg_device operation as a foundation to make RPMSG modular and transport agnostic.

---
 include/linux/rpmsg.h            | 51 ++++++++++++++++++++++++
 include/linux/rpmsg/byteorder.h  | 67 ++++++++++++++++++++++++++++++++
 include/uapi/linux/rpmsg_types.h | 11 ++++++
 3 files changed, 129 insertions(+)
 create mode 100644 include/linux/rpmsg/byteorder.h
 create mode 100644 include/uapi/linux/rpmsg_types.h
include/linux/rpmsg.h +51 -0
index 9fe156d1c018..faf2daff6238 100644
@@ -17,6 +17,7 @@
 #include <linux/kref.h>
 #include <linux/mutex.h>
 #include <linux/poll.h>
+#include <linux/rpmsg/byteorder.h>
 
 #define RPMSG_ADDR_ANY		0xFFFFFFFF
 
@@ -46,6 +47,7 @@ struct rpmsg_channel_info {
  * @dst: destination address
  * @ept: the rpmsg endpoint of this channel
  * @announce: if set, rpmsg will announce the creation/removal of this channel
+ * @little_endian: True if transport is using little endian byte representation
  */
 struct rpmsg_device {
 	struct device dev;
@@ -55,6 +57,7 @@ struct rpmsg_device {
 	u32 dst;
 	struct rpmsg_endpoint *ept;
 	bool announce;
+	bool little_endian;
 
 	const struct rpmsg_device_ops *ops;
 };
@@ -111,6 +114,54 @@ struct rpmsg_driver {
 	int (*callback)(struct rpmsg_device *, void *, int, void *, u32);
 };
 
+static inline u16 rpmsg16_to_cpu(struct rpmsg_device *rpdev, __rpmsg16 val)
+{
+	if (!rpdev)
+		return __rpmsg16_to_cpu(rpmsg_is_little_endian(), val);
+	else
+		return __rpmsg16_to_cpu(rpdev->little_endian, val);
+}
+
+static inline __rpmsg16 cpu_to_rpmsg16(struct rpmsg_device *rpdev, u16 val)
+{
+	if (!rpdev)
+		return __cpu_to_rpmsg16(rpmsg_is_little_endian(), val);
+	else
+		return __cpu_to_rpmsg16(rpdev->little_endian, val);
+}
+
+static inline u32 rpmsg32_to_cpu(struct rpmsg_device *rpdev, __rpmsg32 val)
+{
+	if (!rpdev)
+		return __rpmsg32_to_cpu(rpmsg_is_little_endian(), val);
+	else
+		return __rpmsg32_to_cpu(rpdev->little_endian, val);
+}
+
+static inline __rpmsg32 cpu_to_rpmsg32(struct rpmsg_device *rpdev, u32 val)
+{
+	if (!rpdev)
+		return __cpu_to_rpmsg32(rpmsg_is_little_endian(), val);
+	else
+		return __cpu_to_rpmsg32(rpdev->little_endian, val);
+}
+
+static inline u64 rpmsg64_to_cpu(struct rpmsg_device *rpdev, __rpmsg64 val)
+{
+	if (!rpdev)
+		return __rpmsg64_to_cpu(rpmsg_is_little_endian(), val);
+	else
+		return __rpmsg64_to_cpu(rpdev->little_endian, val);
+}
+
+static inline __rpmsg64 cpu_to_rpmsg64(struct rpmsg_device *rpdev, u64 val)
+{
+	if (!rpdev)
+		return __cpu_to_rpmsg64(rpmsg_is_little_endian(), val);
+	else
+		return __cpu_to_rpmsg64(rpdev->little_endian, val);
+}
+
 #if IS_ENABLED(CONFIG_RPMSG)
 
 int register_rpmsg_device(struct rpmsg_device *dev);
include/linux/rpmsg/byteorder.h new file +67 -0

67 lines not on this page · raw message

include/uapi/linux/rpmsg_types.h new file +11 -0
new file mode 100644
index 000000000000..36e3b9404391
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_LINUX_RPMSG_TYPES_H
+#define _UAPI_LINUX_RPMSG_TYPES_H
+
+#include <linux/types.h>
+
+typedef __u16 __bitwise __rpmsg16;
+typedef __u32 __bitwise __rpmsg32;
+typedef __u64 __bitwise __rpmsg64;
+
+#endif /* _UAPI_LINUX_RPMSG_TYPES_H */
Signature · 1 line
2.25.1
author maintainer
#2 lore raw

PATCH v7 2/8 rpmsg: virtio: Move from virtio to rpmsg byte conversion

In reply to Mathieu Poirier

Use rpmsg byte conversion functions in order for the RPMSG headers and generic functions to be used by external entities.

---
 drivers/rpmsg/virtio_rpmsg_bus.c | 53 +++++++++++++++++---------------
 1 file changed, 28 insertions(+), 25 deletions(-)
drivers/rpmsg/virtio_rpmsg_bus.c +28 -25
index 7d7ed4e5cce7..5259fbbc8e68 100644
@@ -19,11 +19,11 @@
 #include <linux/mutex.h>
 #include <linux/of_device.h>
 #include <linux/rpmsg.h>
+#include <linux/rpmsg/byteorder.h>
 #include <linux/scatterlist.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
 #include <linux/virtio.h>
-#include <linux/virtio_byteorder.h>
 #include <linux/virtio_ids.h>
 #include <linux/virtio_config.h>
 #include <linux/wait.h>
@@ -85,11 +85,11 @@ struct virtproc_info {
  * Every message sent(/received) on the rpmsg bus begins with this header.
  */
 struct rpmsg_hdr {
-	__virtio32 src;
-	__virtio32 dst;
-	__virtio32 reserved;
-	__virtio16 len;
-	__virtio16 flags;
+	__rpmsg32 src;
+	__rpmsg32 dst;
+	__rpmsg32 reserved;
+	__rpmsg16 len;
+	__rpmsg16 flags;
 	u8 data[];
 } __packed;
 
@@ -107,8 +107,8 @@ struct rpmsg_hdr {
  */
 struct rpmsg_ns_msg {
 	char name[RPMSG_NAME_SIZE];
-	__virtio32 addr;
-	__virtio32 flags;
+	__rpmsg32 addr;
+	__rpmsg32 flags;
 } __packed;
 
 /**
@@ -341,8 +341,8 @@ static int virtio_rpmsg_announce_create(struct rpmsg_device *rpdev)
 		struct rpmsg_ns_msg nsm;
 
 		strncpy(nsm.name, rpdev->id.name, RPMSG_NAME_SIZE);
-		nsm.addr = cpu_to_virtio32(vrp->vdev, rpdev->ept->addr);
-		nsm.flags = cpu_to_virtio32(vrp->vdev, RPMSG_NS_CREATE);
+		nsm.addr = cpu_to_rpmsg32(rpdev, rpdev->ept->addr);
+		nsm.flags = cpu_to_rpmsg32(rpdev, RPMSG_NS_CREATE);
 
 		err = rpmsg_sendto(rpdev->ept, &nsm, sizeof(nsm), RPMSG_NS_ADDR);
 		if (err)
@@ -365,8 +365,8 @@ static int virtio_rpmsg_announce_destroy(struct rpmsg_device *rpdev)
 		struct rpmsg_ns_msg nsm;
 
 		strncpy(nsm.name, rpdev->id.name, RPMSG_NAME_SIZE);
-		nsm.addr = cpu_to_virtio32(vrp->vdev, rpdev->ept->addr);
-		nsm.flags = cpu_to_virtio32(vrp->vdev, RPMSG_NS_DESTROY);
+		nsm.addr = cpu_to_rpmsg32(rpdev, rpdev->ept->addr);
+		nsm.flags = cpu_to_rpmsg32(rpdev, RPMSG_NS_DESTROY);
 
 		err = rpmsg_sendto(rpdev->ept, &nsm, sizeof(nsm), RPMSG_NS_ADDR);
 		if (err)
@@ -425,6 +425,7 @@ static struct rpmsg_device *rpmsg_create_channel(struct virtproc_info *vrp,
 	rpdev->src = chinfo->src;
 	rpdev->dst = chinfo->dst;
 	rpdev->ops = &virtio_rpmsg_ops;
+	rpdev->little_endian = virtio_is_little_endian(vrp->vdev);
 
 	/*
 	 * rpmsg server channels has predefined local address (for now),
@@ -618,10 +619,10 @@ static int rpmsg_send_offchannel_raw(struct rpmsg_device *rpdev,
 		}
 	}
 
-	msg->len = cpu_to_virtio16(vrp->vdev, len);
+	msg->len = cpu_to_rpmsg16(rpdev, len);
 	msg->flags = 0;
-	msg->src = cpu_to_virtio32(vrp->vdev, src);
-	msg->dst = cpu_to_virtio32(vrp->vdev, dst);
+	msg->src = cpu_to_rpmsg32(rpdev, src);
+	msg->dst = cpu_to_rpmsg32(rpdev, dst);
 	msg->reserved = 0;
 	memcpy(msg->data, data, len);
 
@@ -710,14 +711,15 @@ static int rpmsg_recv_single(struct virtproc_info *vrp, struct device *dev,
 {
 	struct rpmsg_endpoint *ept;
 	struct scatterlist sg;
-	unsigned int msg_len = virtio16_to_cpu(vrp->vdev, msg->len);
+	bool little_endian = virtio_is_little_endian(vrp->vdev);
+	unsigned int msg_len = __rpmsg16_to_cpu(little_endian, msg->len);
 	int err;
 
 	dev_dbg(dev, "From: 0x%x, To: 0x%x, Len: %d, Flags: %d, Reserved: %d\n",
-		virtio32_to_cpu(vrp->vdev, msg->src),
-		virtio32_to_cpu(vrp->vdev, msg->dst), msg_len,
-		virtio16_to_cpu(vrp->vdev, msg->flags),
-		virtio32_to_cpu(vrp->vdev, msg->reserved));
+		__rpmsg32_to_cpu(little_endian, msg->src),
+		__rpmsg32_to_cpu(little_endian, msg->dst), msg_len,
+		__rpmsg16_to_cpu(little_endian, msg->flags),
+		__rpmsg32_to_cpu(little_endian, msg->reserved));
 #if defined(CONFIG_DYNAMIC_DEBUG)
 	dynamic_hex_dump("rpmsg_virtio RX: ", DUMP_PREFIX_NONE, 16, 1,
 			 msg, sizeof(*msg) + msg_len, true);
@@ -736,7 +738,7 @@ static int rpmsg_recv_single(struct virtproc_info *vrp, struct device *dev,
 	/* use the dst addr to fetch the callback of the appropriate user */
 	mutex_lock(&vrp->endpoints_lock);
 
-	ept = idr_find(&vrp->endpoints, virtio32_to_cpu(vrp->vdev, msg->dst));
+	ept = idr_find(&vrp->endpoints, __rpmsg32_to_cpu(little_endian, msg->dst));
 
 	/* let's make sure no one deallocates ept while we use it */
 	if (ept)
@@ -750,7 +752,7 @@ static int rpmsg_recv_single(struct virtproc_info *vrp, struct device *dev,
 
 		if (ept->cb)
 			ept->cb(ept->rpdev, msg->data, msg_len, ept->priv,
-				virtio32_to_cpu(vrp->vdev, msg->src));
+				__rpmsg32_to_cpu(little_endian, msg->src));
 
 		mutex_unlock(&ept->cb_lock);
 
@@ -830,6 +832,7 @@ static int rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len,
 	struct rpmsg_channel_info chinfo;
 	struct virtproc_info *vrp = priv;
 	struct device *dev = &vrp->vdev->dev;
+	bool little_endian = virtio_is_little_endian(vrp->vdev);
 	int ret;
 
 #if defined(CONFIG_DYNAMIC_DEBUG)
@@ -858,13 +861,13 @@ static int rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len,
 
 	strncpy(chinfo.name, msg->name, sizeof(chinfo.name));
 	chinfo.src = RPMSG_ADDR_ANY;
-	chinfo.dst = virtio32_to_cpu(vrp->vdev, msg->addr);
+	chinfo.dst = __rpmsg32_to_cpu(little_endian, msg->addr);
 
 	dev_info(dev, "%sing channel %s addr 0x%x\n",
-		 virtio32_to_cpu(vrp->vdev, msg->flags) & RPMSG_NS_DESTROY ?
+		 __rpmsg32_to_cpu(little_endian, msg->flags) & RPMSG_NS_DESTROY ?
 		 "destroy" : "creat", msg->name, chinfo.dst);
 
-	if (virtio32_to_cpu(vrp->vdev, msg->flags) & RPMSG_NS_DESTROY) {
+	if (__rpmsg32_to_cpu(little_endian, msg->flags) & RPMSG_NS_DESTROY) {
 		ret = rpmsg_unregister_device(&vrp->vdev->dev, &chinfo);
 		if (ret)
 			dev_err(dev, "rpmsg_destroy_channel failed: %d\n", ret);
Signature · 1 line
2.25.1
author maintainer
#3 lore raw

PATCH v7 3/8 rpmsg: Move structure rpmsg_ns_msg to header file

In reply to Mathieu Poirier

Move structure rpmsg_ns_msg to its own header file so that it can be used by other entities.

---
 drivers/rpmsg/virtio_rpmsg_bus.c | 32 +-----------------------
 include/linux/rpmsg/ns.h         | 42 ++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 31 deletions(-)
 create mode 100644 include/linux/rpmsg/ns.h
drivers/rpmsg/virtio_rpmsg_bus.c +1 -31
index 5259fbbc8e68..20d0cf909bea 100644
@@ -20,6 +20,7 @@
 #include <linux/of_device.h>
 #include <linux/rpmsg.h>
 #include <linux/rpmsg/byteorder.h>
+#include <linux/rpmsg/ns.h>
 #include <linux/scatterlist.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
@@ -93,34 +94,6 @@ struct rpmsg_hdr {
 	u8 data[];
 } __packed;
 
-/**
- * struct rpmsg_ns_msg - dynamic name service announcement message
- * @name: name of remote service that is published
- * @addr: address of remote service that is published
- * @flags: indicates whether service is created or destroyed
- *
- * This message is sent across to publish a new service, or announce
- * about its removal. When we receive these messages, an appropriate
- * rpmsg channel (i.e device) is created/destroyed. In turn, the ->probe()
- * or ->remove() handler of the appropriate rpmsg driver will be invoked
- * (if/as-soon-as one is registered).
- */
-struct rpmsg_ns_msg {
-	char name[RPMSG_NAME_SIZE];
-	__rpmsg32 addr;
-	__rpmsg32 flags;
-} __packed;
-
-/**
- * enum rpmsg_ns_flags - dynamic name service announcement flags
- *
- * @RPMSG_NS_CREATE: a new remote service was just created
- * @RPMSG_NS_DESTROY: a known remote service was just destroyed
- */
-enum rpmsg_ns_flags {
-	RPMSG_NS_CREATE		= 0,
-	RPMSG_NS_DESTROY	= 1,
-};
 
 /**
  * struct virtio_rpmsg_channel - rpmsg channel descriptor
@@ -167,9 +140,6 @@ struct virtio_rpmsg_channel {
  */
 #define RPMSG_RESERVED_ADDRESSES	(1024)
 
-/* Address 53 is reserved for advertising remote services */
-#define RPMSG_NS_ADDR			(53)
-
 static void virtio_rpmsg_destroy_ept(struct rpmsg_endpoint *ept);
 static int virtio_rpmsg_send(struct rpmsg_endpoint *ept, void *data, int len);
 static int virtio_rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len,
include/linux/rpmsg/ns.h new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#4 lore raw

PATCH v7 4/8 rpmsg: virtio: Rename rpmsg_create_channel

In reply to Mathieu Poirier

From: Arnaud Pouliquen <[email protected]>

Rename the internal function as it is internal, and as the name will be used in rpmsg_core.

---
 drivers/rpmsg/virtio_rpmsg_bus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/rpmsg/virtio_rpmsg_bus.c +3 -3
index 20d0cf909bea..2253936593c5 100644
@@ -365,8 +365,8 @@ static void virtio_rpmsg_release_device(struct device *dev)
  * this function will be used to create both static and dynamic
  * channels.
  */
-static struct rpmsg_device *rpmsg_create_channel(struct virtproc_info *vrp,
-						 struct rpmsg_channel_info *chinfo)
+static struct rpmsg_device *__rpmsg_create_channel(struct virtproc_info *vrp,
+						   struct rpmsg_channel_info *chinfo)
 {
 	struct virtio_rpmsg_channel *vch;
 	struct rpmsg_device *rpdev;
@@ -842,7 +842,7 @@ static int rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len,
 		if (ret)
 			dev_err(dev, "rpmsg_destroy_channel failed: %d\n", ret);
 	} else {
-		newch = rpmsg_create_channel(vrp, &chinfo);
+		newch = __rpmsg_create_channel(vrp, &chinfo);
 		if (!newch)
 			dev_err(dev, "rpmsg_create_channel failed\n");
 	}
Signature · 1 line
2.25.1
author maintainer
#5 lore raw

PATCH v7 5/8 rpmsg: core: Add channel creation internal API

In reply to Mathieu Poirier

From: Arnaud Pouliquen <[email protected]>

Add the channel creation API as a first step to be able to define the name service announcement as a rpmsg driver independent from the RPMsg virtio bus.

---
 drivers/rpmsg/rpmsg_core.c     | 44 ++++++++++++++++++++++++++++++++++
 drivers/rpmsg/rpmsg_internal.h | 10 ++++++++
 2 files changed, 54 insertions(+)
drivers/rpmsg/rpmsg_core.c +44 -0
index 91de940896e3..e5daee4f9373 100644
@@ -20,6 +20,50 @@
 
 #include "rpmsg_internal.h"
 
+/**
+ * rpmsg_create_channel() - create a new rpmsg channel
+ * using its name and address info.
+ * @rpdev: rpmsg device
+ * @chinfo: channel_info to bind
+ *
+ * Returns a pointer to the new rpmsg device on success, or NULL on error.
+ */
+struct rpmsg_device *rpmsg_create_channel(struct rpmsg_device *rpdev,
+					  struct rpmsg_channel_info *chinfo)
+{
+	if (WARN_ON(!rpdev))
+		return NULL;
+	if (!rpdev->ops || !rpdev->ops->create_channel) {
+		dev_err(&rpdev->dev, "no create_channel ops found\n");
+		return NULL;
+	}
+
+	return rpdev->ops->create_channel(rpdev, chinfo);
+}
+EXPORT_SYMBOL(rpmsg_create_channel);
+
+/**
+ * rpmsg_release_channel() - release a rpmsg channel
+ * using its name and address info.
+ * @rpdev: rpmsg device
+ * @chinfo: channel_info to bind
+ *
+ * Returns 0 on success or an appropriate error value.
+ */
+int rpmsg_release_channel(struct rpmsg_device *rpdev,
+			  struct rpmsg_channel_info *chinfo)
+{
+	if (WARN_ON(!rpdev))
+		return -EINVAL;
+	if (!rpdev->ops || !rpdev->ops->release_channel) {
+		dev_err(&rpdev->dev, "no release_channel ops found\n");
+		return -ENXIO;
+	}
+
+	return rpdev->ops->release_channel(rpdev, chinfo);
+}
+EXPORT_SYMBOL(rpmsg_release_channel);
+
 /**
  * rpmsg_create_ept() - create a new rpmsg_endpoint
  * @rpdev: rpmsg channel device
drivers/rpmsg/rpmsg_internal.h +10 -0
index 3fc83cd50e98..f1de73e0f2d6 100644
@@ -20,6 +20,8 @@
 
 /**
  * struct rpmsg_device_ops - indirection table for the rpmsg_device operations
+ * @create_channel:	create backend-specific channel, optional
+ * @release_channel:	release backend-specific channel, optional
  * @create_ept:		create backend-specific endpoint, required
  * @announce_create:	announce presence of new channel, optional
  * @announce_destroy:	announce destruction of channel, optional
@@ -29,6 +31,10 @@
  * advertise new channels implicitly by creating the endpoints.
  */
 struct rpmsg_device_ops {
+	struct rpmsg_device *(*create_channel)(struct rpmsg_device *rpdev,
+					       struct rpmsg_channel_info *chinfo);
+	int (*release_channel)(struct rpmsg_device *rpdev,
+			       struct rpmsg_channel_info *chinfo);
 	struct rpmsg_endpoint *(*create_ept)(struct rpmsg_device *rpdev,
 					    rpmsg_rx_cb_t cb, void *priv,
 					    struct rpmsg_channel_info chinfo);
@@ -75,6 +81,10 @@ int rpmsg_unregister_device(struct device *parent,
 struct device *rpmsg_find_device(struct device *parent,
 				 struct rpmsg_channel_info *chinfo);
 
+struct rpmsg_device *rpmsg_create_channel(struct rpmsg_device *rpdev,
+					  struct rpmsg_channel_info *chinfo);
+int rpmsg_release_channel(struct rpmsg_device *rpdev,
+			  struct rpmsg_channel_info *chinfo);
 /**
  * rpmsg_chrdev_register_device() - register chrdev device based on rpdev
  * @rpdev:	prepared rpdev to be used for creating endpoints
Signature · 1 line
2.25.1
author maintainer
#6 lore raw

PATCH v7 6/8 rpmsg: virtio: Add rpmsg channel device ops

In reply to Mathieu Poirier

From: Arnaud Pouliquen <[email protected]>

Implement the create and release of the RPMsg channel for the RPMsg virtio bus.

---
 drivers/rpmsg/virtio_rpmsg_bus.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
drivers/rpmsg/virtio_rpmsg_bus.c +22 -0
index 2253936593c5..6ec299f7f790 100644
@@ -151,6 +151,8 @@ static int virtio_rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data,
 				  int len, u32 dst);
 static int virtio_rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src,
 					   u32 dst, void *data, int len);
+static struct rpmsg_device *__rpmsg_create_channel(struct virtproc_info *vrp,
+						   struct rpmsg_channel_info *chinfo);
 
 static const struct rpmsg_endpoint_ops virtio_endpoint_ops = {
 	.destroy_ept = virtio_rpmsg_destroy_ept,
@@ -255,6 +257,24 @@ static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp,
 	return NULL;
 }
 
+static struct rpmsg_device *virtio_rpmsg_create_channel(struct rpmsg_device *rpdev,
+							struct rpmsg_channel_info *chinfo)
+{
+	struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev);
+	struct virtproc_info *vrp = vch->vrp;
+
+	return __rpmsg_create_channel(vrp, chinfo);
+}
+
+static int virtio_rpmsg_release_channel(struct rpmsg_device *rpdev,
+					struct rpmsg_channel_info *chinfo)
+{
+	struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev);
+	struct virtproc_info *vrp = vch->vrp;
+
+	return rpmsg_unregister_device(&vrp->vdev->dev, chinfo);
+}
+
 static struct rpmsg_endpoint *virtio_rpmsg_create_ept(struct rpmsg_device *rpdev,
 						      rpmsg_rx_cb_t cb,
 						      void *priv,
@@ -347,6 +367,8 @@ static int virtio_rpmsg_announce_destroy(struct rpmsg_device *rpdev)
 }
 
 static const struct rpmsg_device_ops virtio_rpmsg_ops = {
+	.create_channel = virtio_rpmsg_create_channel,
+	.release_channel = virtio_rpmsg_release_channel,
 	.create_ept = virtio_rpmsg_create_ept,
 	.announce_create = virtio_rpmsg_announce_create,
 	.announce_destroy = virtio_rpmsg_announce_destroy,
Signature · 1 line
2.25.1
author maintainer
#7 lore raw

PATCH v7 7/8 rpmsg: Make rpmsg_{register|unregister}_device() public

In reply to Mathieu Poirier

Make function rpmsg_register_device() and rpmsg_unregister_device() functions public so that they can be used by other clients. While doing so get rid of two obsolete function, i.e register_rpmsg_device() and unregister_rpmsg_device(), to prevent confusion.

---
 drivers/rpmsg/rpmsg_internal.h |  4 ----
 include/linux/rpmsg.h          | 12 ++++++++----
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/rpmsg/rpmsg_internal.h +0 -4
index f1de73e0f2d6..a76c344253bf 100644
@@ -74,10 +74,6 @@ struct rpmsg_endpoint_ops {
 			     poll_table *wait);
 };
 
-int rpmsg_register_device(struct rpmsg_device *rpdev);
-int rpmsg_unregister_device(struct device *parent,
-			    struct rpmsg_channel_info *chinfo);
-
 struct device *rpmsg_find_device(struct device *parent,
 				 struct rpmsg_channel_info *chinfo);
 
include/linux/rpmsg.h +8 -4
index faf2daff6238..a5db828b2420 100644
@@ -164,8 +164,9 @@ static inline __rpmsg64 cpu_to_rpmsg64(struct rpmsg_device *rpdev, u64 val)
 
 #if IS_ENABLED(CONFIG_RPMSG)
 
-int register_rpmsg_device(struct rpmsg_device *dev);
-void unregister_rpmsg_device(struct rpmsg_device *dev);
+int rpmsg_register_device(struct rpmsg_device *rpdev);
+int rpmsg_unregister_device(struct device *parent,
+			    struct rpmsg_channel_info *chinfo);
 int __register_rpmsg_driver(struct rpmsg_driver *drv, struct module *owner);
 void unregister_rpmsg_driver(struct rpmsg_driver *drv);
 void rpmsg_destroy_ept(struct rpmsg_endpoint *);
@@ -188,15 +189,18 @@ __poll_t rpmsg_poll(struct rpmsg_endpoint *ept, struct file *filp,
 
 #else
 
-static inline int register_rpmsg_device(struct rpmsg_device *dev)
+static inline int rpmsg_register_device(struct rpmsg_device *rpdev)
 {
 	return -ENXIO;
 }
 
-static inline void unregister_rpmsg_device(struct rpmsg_device *dev)
+static inline int rpmsg_unregister_device(struct device *parent,
+					  struct rpmsg_channel_info *chinfo)
 {
 	/* This shouldn't be possible */
 	WARN_ON(1);
+
+	return -ENXIO;
 }
 
 static inline int __register_rpmsg_driver(struct rpmsg_driver *drv,
Signature · 1 line
2.25.1
author maintainer
#8 lore raw

PATCH v7 8/8 rpmsg: Turn name service into a stand alone driver

In reply to Mathieu Poirier

From: Arnaud Pouliquen <[email protected]>

Make the RPMSG name service announcement a stand alone driver so that it can be reused by other subsystems. It is also the first step in making the functionatlity transport independent, i.e that is not tied to virtIO.

---
 drivers/rpmsg/Kconfig            |   9 +++
 drivers/rpmsg/Makefile           |   1 +
 drivers/rpmsg/rpmsg_ns.c         | 126 +++++++++++++++++++++++++++++++
 drivers/rpmsg/virtio_rpmsg_bus.c |  87 +++++----------------
 include/linux/rpmsg/ns.h         |   3 +
 5 files changed, 159 insertions(+), 67 deletions(-)
 create mode 100644 drivers/rpmsg/rpmsg_ns.c
drivers/rpmsg/Kconfig +9 -0
index f96716893c2a..0b4407abdf13 100644
@@ -15,6 +15,14 @@ config RPMSG_CHAR
 	  in /dev. They make it possible for user-space programs to send and
 	  receive rpmsg packets.
 
+config RPMSG_NS
+	tristate "RPMSG name service announcement"
+	depends on RPMSG
+	help
+	  Say Y here to enable the support of the name service announcement
+	  channel that probes the associated RPMsg device on remote endpoint
+	  service announcement.
+
 config RPMSG_MTK_SCP
 	tristate "MediaTek SCP"
 	depends on MTK_SCP
@@ -62,6 +70,7 @@ config RPMSG_VIRTIO
 	tristate "Virtio RPMSG bus driver"
 	depends on HAS_DMA
 	select RPMSG
+	select RPMSG_NS
 	select VIRTIO
 
 endmenu
drivers/rpmsg/Makefile +1 -0
index ffe932ef6050..8d452656f0ee 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_RPMSG)		+= rpmsg_core.o
 obj-$(CONFIG_RPMSG_CHAR)	+= rpmsg_char.o
+obj-$(CONFIG_RPMSG_NS)		+= rpmsg_ns.o
 obj-$(CONFIG_RPMSG_MTK_SCP)	+= mtk_rpmsg.o
 qcom_glink-objs			:= qcom_glink_native.o qcom_glink_ssr.o
 obj-$(CONFIG_RPMSG_QCOM_GLINK) += qcom_glink.o
drivers/rpmsg/rpmsg_ns.c new file +126 -0

126 lines not on this page · raw message

drivers/rpmsg/virtio_rpmsg_bus.c +20 -67

132 lines not on this page · raw message

include/linux/rpmsg/ns.h +3 -0
index 73ecc91dc26f..a7804edd6d58 100644
@@ -4,6 +4,7 @@
 #define _LINUX_RPMSG_NS_H
 
 #include <linux/mod_devicetable.h>
+#include <linux/rpmsg.h>
 #include <linux/rpmsg/byteorder.h>
 #include <linux/types.h>
 
@@ -39,4 +40,6 @@ enum rpmsg_ns_flags {
 /* Address 53 is reserved for advertising remote services */
 #define RPMSG_NS_ADDR			(53)
 
+int rpmsg_ns_register_device(struct rpmsg_device *rpdev);
+
 #endif
Signature · 1 line
2.25.1
Tested-by Reviewed-by on the v7 series
#9 lore raw
In reply to Mathieu Poirier

Hi Mathieu,

Thanks for bringing all the stuff together and for polishing it!

For the entire series:

Thanks
Guennadi

Quoted 51 lines · Mathieu Poirier

This revision addresses comments received from the previous revision, i.e V6. Please see details below.

It starts by making the RPMSG protocol transport agnostic by moving the headers it uses to generic types and using those in the current implementation. From there it re-uses the work that Arnaud published[1] to make the name service modular.

Tested on stm32mp157 with the RPMSG client sample application. Applies cleanly on rpmsg-next.

Thanks,
Mathieu

[1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=338335

-------
New for V7:
- Fixed error path in rpmsg_probe() as reported by Guennadi

Arnaud Pouliquen (4):
rpmsg: virtio: Rename rpmsg_create_channel
rpmsg: core: Add channel creation internal API
rpmsg: virtio: Add rpmsg channel device ops
rpmsg: Turn name service into a stand alone driver

Mathieu Poirier (4):
rpmsg: Introduce __rpmsg{16|32|64} types
rpmsg: virtio: Move from virtio to rpmsg byte conversion
rpmsg: Move structure rpmsg_ns_msg to header file
rpmsg: Make rpmsg_{register|unregister}_device() public

 drivers/rpmsg/Kconfig            |   9 ++
 drivers/rpmsg/Makefile           |   1 +
 drivers/rpmsg/rpmsg_core.c       |  44 ++++++++
 drivers/rpmsg/rpmsg_internal.h   |  14 ++-
 drivers/rpmsg/rpmsg_ns.c         | 126 +++++++++++++++++++++
 drivers/rpmsg/virtio_rpmsg_bus.c | 186 +++++++++++--------------------
 include/linux/rpmsg.h            |  63 ++++++++++-
 include/linux/rpmsg/byteorder.h  |  67 +++++++++++
 include/linux/rpmsg/ns.h         |  45 ++++++++
 include/uapi/linux/rpmsg_types.h |  11 ++
 10 files changed, 439 insertions(+), 127 deletions(-)
 create mode 100644 drivers/rpmsg/rpmsg_ns.c
 create mode 100644 include/linux/rpmsg/byteorder.h
 create mode 100644 include/linux/rpmsg/ns.h
 create mode 100644 include/uapi/linux/rpmsg_types.h
Signature · 1 line
2.25.1
#10 lore raw

Hi Mathieu,

I'd like to resume reviewing and begin upstreaming of the next steps of my Audio DSP Virtualisation work, based on this your patch set. How confident are we that it's going to be upstreamed in its present form? What's the plan to push it to "next?"

Thanks
Guennadi

Quoted 64 lines · Guennadi Liakhovetski

Hi Mathieu,

Thanks for bringing all the stuff together and for polishing it!

For the entire series:

Thanks
Guennadi

Quoted 51 lines · Mathieu Poirier

This revision addresses comments received from the previous revision, i.e V6. Please see details below.

It starts by making the RPMSG protocol transport agnostic by moving the headers it uses to generic types and using those in the current implementation. From there it re-uses the work that Arnaud published[1] to make the name service modular.

Tested on stm32mp157 with the RPMSG client sample application. Applies cleanly on rpmsg-next.

Thanks,
Mathieu

[1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=338335

-------
New for V7:
- Fixed error path in rpmsg_probe() as reported by Guennadi

Arnaud Pouliquen (4):
rpmsg: virtio: Rename rpmsg_create_channel
rpmsg: core: Add channel creation internal API
rpmsg: virtio: Add rpmsg channel device ops
rpmsg: Turn name service into a stand alone driver

Mathieu Poirier (4):
rpmsg: Introduce __rpmsg{16|32|64} types
rpmsg: virtio: Move from virtio to rpmsg byte conversion
rpmsg: Move structure rpmsg_ns_msg to header file
rpmsg: Make rpmsg_{register|unregister}_device() public

 drivers/rpmsg/Kconfig            |   9 ++
 drivers/rpmsg/Makefile           |   1 +
 drivers/rpmsg/rpmsg_core.c       |  44 ++++++++
 drivers/rpmsg/rpmsg_internal.h   |  14 ++-
 drivers/rpmsg/rpmsg_ns.c         | 126 +++++++++++++++++++++
 drivers/rpmsg/virtio_rpmsg_bus.c | 186 +++++++++++--------------------
 include/linux/rpmsg.h            |  63 ++++++++++-
 include/linux/rpmsg/byteorder.h  |  67 +++++++++++
 include/linux/rpmsg/ns.h         |  45 ++++++++
 include/uapi/linux/rpmsg_types.h |  11 ++
 10 files changed, 439 insertions(+), 127 deletions(-)
 create mode 100644 drivers/rpmsg/rpmsg_ns.c
 create mode 100644 include/linux/rpmsg/byteorder.h
 create mode 100644 include/linux/rpmsg/ns.h
 create mode 100644 include/uapi/linux/rpmsg_types.h
Signature · 1 line
2.25.1
author maintainer
#11 lore raw

Good day,

Quoted 4 lines · Guennadi Liakhovetski

Hi Mathieu,

I'd like to resume reviewing and begin upstreaming of the next steps of my Audio DSP Virtualisation work, based on this your patch set. How

I'm all for it too.

Quoted 3 lines

confident are we that it's going to be upstreamed in its present form? What's the plan to push it to "next?"

I thought we were pretty unanimous that something like what Kishon did was the way to go.

Quoted 68 lines

Thanks
Guennadi

Quoted 64 lines · Guennadi Liakhovetski

Hi Mathieu,

Thanks for bringing all the stuff together and for polishing it!

For the entire series:

Thanks
Guennadi

Quoted 51 lines · Mathieu Poirier

This revision addresses comments received from the previous revision, i.e V6. Please see details below.

It starts by making the RPMSG protocol transport agnostic by moving the headers it uses to generic types and using those in the current implementation. From there it re-uses the work that Arnaud published[1] to make the name service modular.

Tested on stm32mp157 with the RPMSG client sample application. Applies cleanly on rpmsg-next.

Thanks,
Mathieu

[1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=338335

-------
New for V7:
- Fixed error path in rpmsg_probe() as reported by Guennadi

Arnaud Pouliquen (4):
rpmsg: virtio: Rename rpmsg_create_channel
rpmsg: core: Add channel creation internal API
rpmsg: virtio: Add rpmsg channel device ops
rpmsg: Turn name service into a stand alone driver

Mathieu Poirier (4):
rpmsg: Introduce __rpmsg{16|32|64} types
rpmsg: virtio: Move from virtio to rpmsg byte conversion
rpmsg: Move structure rpmsg_ns_msg to header file
rpmsg: Make rpmsg_{register|unregister}_device() public

 drivers/rpmsg/Kconfig            |   9 ++
 drivers/rpmsg/Makefile           |   1 +
 drivers/rpmsg/rpmsg_core.c       |  44 ++++++++
 drivers/rpmsg/rpmsg_internal.h   |  14 ++-
 drivers/rpmsg/rpmsg_ns.c         | 126 +++++++++++++++++++++
 drivers/rpmsg/virtio_rpmsg_bus.c | 186 +++++++++++--------------------
 include/linux/rpmsg.h            |  63 ++++++++++-
 include/linux/rpmsg/byteorder.h  |  67 +++++++++++
 include/linux/rpmsg/ns.h         |  45 ++++++++
 include/uapi/linux/rpmsg_types.h |  11 ++
 10 files changed, 439 insertions(+), 127 deletions(-)
 create mode 100644 drivers/rpmsg/rpmsg_ns.c
 create mode 100644 include/linux/rpmsg/byteorder.h
 create mode 100644 include/linux/rpmsg/ns.h
 create mode 100644 include/uapi/linux/rpmsg_types.h
Signature · 1 line
2.25.1
#12 lore raw

(adding vhost maintainers and the author of [1])

Hi,

I'm working on an Audio DSP virtualisation solution [2] and the next step in its upstreaming should be an RPMsg vhost implementation, based on [3], which contains a simple addition to the current library-style vhost API. Later in [1] a different approach has been presented, converting the vhost framework to a proper bus-type and device driver. Therefore my questions:

1. if the latter approach is prefered, should we expect follow up versions of [1] and their upstreaming?
2. judging by the size and complexity of [1] would it maybe be preferable to first extract a minimum patch set just to add vhost rpmsg? Looking at the patch set it should be doable and not too difficult? Kishon, would it be something you could submit?
3. or would it be preferable to keep vhost in its present form, use
[3] for rpmsg support and re-implement [1] based on a different vhost / vringh approach?

Thanks
Guennadi

[1] https://www.spinics.net/lists/kvm/msg219632.html
[2] https://mailman.alsa-project.org/pipermail/sound-open-firmware/2020-April/003766.html
[3] https://www.spinics.net/lists/linux-virtualization/msg43359.html

Quoted 85 lines · Mathieu Poirier

Good day,

Quoted 4 lines · Guennadi Liakhovetski

Hi Mathieu,

I'd like to resume reviewing and begin upstreaming of the next steps of my Audio DSP Virtualisation work, based on this your patch set. How

I'm all for it too.

Quoted 3 lines

confident are we that it's going to be upstreamed in its present form? What's the plan to push it to "next?"

I thought we were pretty unanimous that something like what Kishon did was the way to go.

Quoted 68 lines

Thanks
Guennadi

Quoted 64 lines · Guennadi Liakhovetski

Hi Mathieu,

Thanks for bringing all the stuff together and for polishing it!

For the entire series:

Thanks
Guennadi

Quoted 51 lines · Mathieu Poirier

This revision addresses comments received from the previous revision, i.e V6. Please see details below.

It starts by making the RPMSG protocol transport agnostic by moving the headers it uses to generic types and using those in the current implementation. From there it re-uses the work that Arnaud published[1] to make the name service modular.

Tested on stm32mp157 with the RPMSG client sample application. Applies cleanly on rpmsg-next.

Thanks,
Mathieu

[1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=338335

-------
New for V7:
- Fixed error path in rpmsg_probe() as reported by Guennadi

Arnaud Pouliquen (4):
rpmsg: virtio: Rename rpmsg_create_channel
rpmsg: core: Add channel creation internal API
rpmsg: virtio: Add rpmsg channel device ops
rpmsg: Turn name service into a stand alone driver

Mathieu Poirier (4):
rpmsg: Introduce __rpmsg{16|32|64} types
rpmsg: virtio: Move from virtio to rpmsg byte conversion
rpmsg: Move structure rpmsg_ns_msg to header file
rpmsg: Make rpmsg_{register|unregister}_device() public

 drivers/rpmsg/Kconfig            |   9 ++
 drivers/rpmsg/Makefile           |   1 +
 drivers/rpmsg/rpmsg_core.c       |  44 ++++++++
 drivers/rpmsg/rpmsg_internal.h   |  14 ++-
 drivers/rpmsg/rpmsg_ns.c         | 126 +++++++++++++++++++++
 drivers/rpmsg/virtio_rpmsg_bus.c | 186 +++++++++++--------------------
 include/linux/rpmsg.h            |  63 ++++++++++-
 include/linux/rpmsg/byteorder.h  |  67 +++++++++++
 include/linux/rpmsg/ns.h         |  45 ++++++++
 include/uapi/linux/rpmsg_types.h |  11 ++
 10 files changed, 439 insertions(+), 127 deletions(-)
 create mode 100644 drivers/rpmsg/rpmsg_ns.c
 create mode 100644 include/linux/rpmsg/byteorder.h
 create mode 100644 include/linux/rpmsg/ns.h
 create mode 100644 include/uapi/linux/rpmsg_types.h
Signature · 1 line
2.25.1
author maintainer
#13 lore raw

I am adding Vincent Whitchurch and the virtualization mailing list...

Quoted 12 lines · Guennadi Liakhovetski

(adding vhost maintainers and the author of [1])

Hi,

I'm working on an Audio DSP virtualisation solution [2] and the next step in its upstreaming should be an RPMsg vhost implementation, based on [3], which contains a simple addition to the current library-style vhost API. Later in [1] a different approach has been presented, converting the vhost framework to a proper bus-type and device driver. Therefore my questions:

Quoted 6 lines

1. if the latter approach is prefered, should we expect follow up versions of [1] and their upstreaming?
2. judging by the size and complexity of [1] would it maybe be preferable to first extract a minimum patch set just to add vhost rpmsg? Looking at the patch set it should be doable and not too difficult? Kishon, would it be something you could submit?

To me that is the best approach. It might be best for you to do the work and credit Kishon where needed.

Quoted 97 lines

3. or would it be preferable to keep vhost in its present form, use
[3] for rpmsg support and re-implement [1] based on a different vhost / vringh approach?

Thanks
Guennadi

[1] https://www.spinics.net/lists/kvm/msg219632.html
[2] https://mailman.alsa-project.org/pipermail/sound-open-firmware/2020-April/003766.html
[3] https://www.spinics.net/lists/linux-virtualization/msg43359.html

Quoted 85 lines · Mathieu Poirier

Good day,

Quoted 4 lines · Guennadi Liakhovetski

Hi Mathieu,

I'd like to resume reviewing and begin upstreaming of the next steps of my Audio DSP Virtualisation work, based on this your patch set. How

I'm all for it too.

Quoted 3 lines

confident are we that it's going to be upstreamed in its present form? What's the plan to push it to "next?"

I thought we were pretty unanimous that something like what Kishon did was the way to go.

Quoted 68 lines

Thanks
Guennadi

Quoted 64 lines · Guennadi Liakhovetski

Hi Mathieu,

Thanks for bringing all the stuff together and for polishing it!

For the entire series:

Thanks
Guennadi

Quoted 51 lines · Mathieu Poirier

This revision addresses comments received from the previous revision, i.e V6. Please see details below.

It starts by making the RPMSG protocol transport agnostic by moving the headers it uses to generic types and using those in the current implementation. From there it re-uses the work that Arnaud published[1] to make the name service modular.

Tested on stm32mp157 with the RPMSG client sample application. Applies cleanly on rpmsg-next.

Thanks,
Mathieu

[1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=338335

-------
New for V7:
- Fixed error path in rpmsg_probe() as reported by Guennadi

Arnaud Pouliquen (4):
rpmsg: virtio: Rename rpmsg_create_channel
rpmsg: core: Add channel creation internal API
rpmsg: virtio: Add rpmsg channel device ops
rpmsg: Turn name service into a stand alone driver

Mathieu Poirier (4):
rpmsg: Introduce __rpmsg{16|32|64} types
rpmsg: virtio: Move from virtio to rpmsg byte conversion
rpmsg: Move structure rpmsg_ns_msg to header file
rpmsg: Make rpmsg_{register|unregister}_device() public

 drivers/rpmsg/Kconfig            |   9 ++
 drivers/rpmsg/Makefile           |   1 +
 drivers/rpmsg/rpmsg_core.c       |  44 ++++++++
 drivers/rpmsg/rpmsg_internal.h   |  14 ++-
 drivers/rpmsg/rpmsg_ns.c         | 126 +++++++++++++++++++++
 drivers/rpmsg/virtio_rpmsg_bus.c | 186 +++++++++++--------------------
 include/linux/rpmsg.h            |  63 ++++++++++-
 include/linux/rpmsg/byteorder.h  |  67 +++++++++++
 include/linux/rpmsg/ns.h         |  45 ++++++++
 include/uapi/linux/rpmsg_types.h |  11 ++
 10 files changed, 439 insertions(+), 127 deletions(-)
 create mode 100644 drivers/rpmsg/rpmsg_ns.c
 create mode 100644 include/linux/rpmsg/byteorder.h
 create mode 100644 include/linux/rpmsg/ns.h
 create mode 100644 include/uapi/linux/rpmsg_types.h

--
2.25.1

#14 lore raw

+Lorenzo, Bjorn, Rob

Hi Guennadi,

Quoted 23 lines · Mathieu Poirier

I am adding Vincent Whitchurch and the virtualization mailing list...

Quoted 12 lines · Guennadi Liakhovetski

(adding vhost maintainers and the author of [1])

Hi,

I'm working on an Audio DSP virtualisation solution [2] and the next step in its upstreaming should be an RPMsg vhost implementation, based on [3], which contains a simple addition to the current library-style vhost API. Later in [1] a different approach has been presented, converting the vhost framework to a proper bus-type and device driver. Therefore my questions:

Quoted 6 lines

1. if the latter approach is prefered, should we expect follow up versions of [1] and their upstreaming?
2. judging by the size and complexity of [1] would it maybe be preferable to first extract a minimum patch set just to add vhost rpmsg? Looking at the patch set it should be doable and not too difficult? Kishon, would it be something you could submit?

Quoted 2 lines

To me that is the best approach. It might be best for you to do the work and credit Kishon where needed.

Yeah, my focus right now is to get my NTB patch series upstreamed [A], So I might not be able to get to this any sooner. As Mathieu suggested, I recommend you to pick the generic parts of my series that doesn't involve PCI or NTB or VHOST MMIO.

The following patches in my series should get the generic vhost infrastructure part up.

0001-vhost-Make-_feature_-bits-a-property-of-vhost-device.patch 0002-vhost-Introduce-standard-Linux-driver-model-in-VHOST.patch 0003-vhost-Add-ops-for-the-VHOST-driver-to-configure-VHOS.patch

0006-vhost-Introduce-configfs-entry-for-configuring-VHOST.patch

0008-rpmsg-virtio_rpmsg_bus-Disable-receive-virtqueue-cal.patch 0009-rpmsg-Introduce-configfs-entry-for-configuring-rpmsg.patch 0010-rpmsg-virtio_rpmsg_bus-Add-Address-Service-Notificat.patch 0011-rpmsg-virtio_rpmsg_bus-Move-generic-rpmsg-structure-.patch

0014-rpmsg-Add-VHOST-based-remote-processor-messaging-bus.patch 0015-samples-rpmsg-Setup-delayed-work-to-send-message.patch 0016-samples-rpmsg-Wait-for-address-to-be-bound-to-rpdev-.patch 0017-rpmsg.txt-Add-Documentation-to-configure-rpmsg-using.patch

Let me know if you have any questions or need further clarifications.

Thank you for working on this.

Best Regards,
Kishon

[A] -> http://lore.kernel.org/r/[email protected]

Quoted 98 lines
Quoted 98 lines

3. or would it be preferable to keep vhost in its present form, use
[3] for rpmsg support and re-implement [1] based on a different vhost / vringh approach?

Thanks
Guennadi

[1] https://www.spinics.net/lists/kvm/msg219632.html
[2] https://mailman.alsa-project.org/pipermail/sound-open-firmware/2020-April/003766.html
[3] https://www.spinics.net/lists/linux-virtualization/msg43359.html

Quoted 85 lines · Mathieu Poirier

Good day,

Quoted 4 lines · Guennadi Liakhovetski

Hi Mathieu,

I'd like to resume reviewing and begin upstreaming of the next steps of my Audio DSP Virtualisation work, based on this your patch set. How

I'm all for it too.

Quoted 3 lines

confident are we that it's going to be upstreamed in its present form? What's the plan to push it to "next?"

I thought we were pretty unanimous that something like what Kishon did was the way to go.

Quoted 68 lines

Thanks
Guennadi

Quoted 64 lines · Guennadi Liakhovetski

Hi Mathieu,

Thanks for bringing all the stuff together and for polishing it!

For the entire series:

Thanks
Guennadi

Quoted 51 lines · Mathieu Poirier

This revision addresses comments received from the previous revision, i.e V6. Please see details below.

It starts by making the RPMSG protocol transport agnostic by moving the headers it uses to generic types and using those in the current implementation. From there it re-uses the work that Arnaud published[1] to make the name service modular.

Tested on stm32mp157 with the RPMSG client sample application. Applies cleanly on rpmsg-next.

Thanks,
Mathieu

[1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=338335

-------
New for V7:
- Fixed error path in rpmsg_probe() as reported by Guennadi

Arnaud Pouliquen (4):
rpmsg: virtio: Rename rpmsg_create_channel
rpmsg: core: Add channel creation internal API
rpmsg: virtio: Add rpmsg channel device ops
rpmsg: Turn name service into a stand alone driver

Mathieu Poirier (4):
rpmsg: Introduce __rpmsg{16|32|64} types
rpmsg: virtio: Move from virtio to rpmsg byte conversion
rpmsg: Move structure rpmsg_ns_msg to header file
rpmsg: Make rpmsg_{register|unregister}_device() public

 drivers/rpmsg/Kconfig            |   9 ++
 drivers/rpmsg/Makefile           |   1 +
 drivers/rpmsg/rpmsg_core.c       |  44 ++++++++
 drivers/rpmsg/rpmsg_internal.h   |  14 ++-
 drivers/rpmsg/rpmsg_ns.c         | 126 +++++++++++++++++++++
 drivers/rpmsg/virtio_rpmsg_bus.c | 186 +++++++++++--------------------
 include/linux/rpmsg.h            |  63 ++++++++++-
 include/linux/rpmsg/byteorder.h  |  67 +++++++++++
 include/linux/rpmsg/ns.h         |  45 ++++++++
 include/uapi/linux/rpmsg_types.h |  11 ++
 10 files changed, 439 insertions(+), 127 deletions(-)
 create mode 100644 drivers/rpmsg/rpmsg_ns.c
 create mode 100644 include/linux/rpmsg/byteorder.h
 create mode 100644 include/linux/rpmsg/ns.h
 create mode 100644 include/uapi/linux/rpmsg_types.h

--
2.25.1

#15 lore raw
In reply to Mathieu Poirier
This series was applied to andersson/remoteproc.git (refs/heads/for-next):

Hello:

This series was applied to andersson/remoteproc.git (refs/heads/for-next):

Quoted 9 lines · On Fri, 20 Nov 2020 14:42:37 -0700 you wrote:

This revision addresses comments received from the previous revision, i.e V6. Please see details below.

It starts by making the RPMSG protocol transport agnostic by moving the headers it uses to generic types and using those in the current implementation. From there it re-uses the work that Arnaud published[1] to make the name service modular.

[...]

Here is the summary with links:
- [v7,1/8] rpmsg: Introduce __rpmsg{16|32|64} types

    https://git.kernel.org/andersson/remoteproc/c/6bef038011a0
  - [v7,2/8] rpmsg: virtio: Move from virtio to rpmsg byte conversion
    https://git.kernel.org/andersson/remoteproc/c/5f2f6b7db119
  - [v7,3/8] rpmsg: Move structure rpmsg_ns_msg to header file
    https://git.kernel.org/andersson/remoteproc/c/c435a04189de
  - [v7,4/8] rpmsg: virtio: Rename rpmsg_create_channel
    https://git.kernel.org/andersson/remoteproc/c/77d372989db9
  - [v7,5/8] rpmsg: core: Add channel creation internal API
    https://git.kernel.org/andersson/remoteproc/c/9753e12cd3bd
  - [v7,6/8] rpmsg: virtio: Add rpmsg channel device ops
    https://git.kernel.org/andersson/remoteproc/c/1ee1e5e162af
  - [v7,7/8] rpmsg: Make rpmsg_{register|unregister}_device() public
    https://git.kernel.org/andersson/remoteproc/c/55488110acc1
  - [v7,8/8] rpmsg: Turn name service into a stand alone driver
    https://git.kernel.org/andersson/remoteproc/c/950a7388f02b

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html