All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V4 0/9] Add chrdev and name query support for GLINK
@ 2018-07-27 12:17 Arun Kumar Neelakantam
  2018-07-27 12:17   ` Arun Kumar Neelakantam
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-27 12:17 UTC (permalink / raw)
  To: ohad, bjorn.andersson, clew, robh+dt, arnaud.pouliquen, andy.gross
  Cc: linux-remoteproc, linux-kernel, Arun Kumar Neelakantam

Add support for the GLINK rpmsg transport to register a rpmsg chrdev.
This will create the rpmsg_ctrl nodes for userspace clients to open 
rpmsg epts. Create a label property that will help userspace clients
distinguish between the different GLINK links. The rpmsg chrdev 
allocation is done by allocating a local channel which also allocates
an ept. We need to add some guards against edge cases for this chrdev
because it will never fully open.

Changes since v3:
- Change to device_add_group for rpmsg name attr
- Add patch to unregister the rpmsg device
- Add patch to support compat ioctl for rpmsg char driver

Changes since v2:
- Revert change to make glink attribute table const

Changes since v1:
- Add explanation to dt-bindings commit message
- Add patch complete_all the open_req/ack variables
- Add patch to prevent null pointer dereference in chrdev channel release
- Change chrdev allocation to use glink channel allocation
- Change glink attr struct to const

Arun Kumar Neelakantam (2):
  rpmsg: glink: unregister rpmsg device during endpoint destroy
  rpmsg: Add compat ioctl for rpmsg char driver

Chris Lew (7):
  dt-bindings: soc: qcom: Add label for GLINK bindings
  rpmsg: glink: Store edge name for glink device
  rpmsg: glink: Use complete_all for open states
  rpmsg: Guard against null endpoint ops in destroy
  rpmsg: glink: Add support for rpmsg glink chrdev
  rpmsg: glink: Expose rpmsg name attr for glink
  rpmsg: glink: Remove chunk size word align warning

 .../devicetree/bindings/soc/qcom/qcom,glink.txt    |  5 ++
 drivers/rpmsg/qcom_glink_native.c                  | 88 ++++++++++++++++++++--
 drivers/rpmsg/rpmsg_char.c                         |  2 +
 drivers/rpmsg/rpmsg_core.c                         |  2 +-
 4 files changed, 90 insertions(+), 7 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH V4 1/9] dt-bindings: soc: qcom: Add label for GLINK bindings
  2018-07-27 12:17 [PATCH V4 0/9] Add chrdev and name query support for GLINK Arun Kumar Neelakantam
@ 2018-07-27 12:17   ` Arun Kumar Neelakantam
  2018-07-27 12:17 ` [PATCH V4 2/9] rpmsg: glink: Store edge name for glink device Arun Kumar Neelakantam
                     ` (7 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-27 12:17 UTC (permalink / raw)
  To: ohad, bjorn.andersson, clew, robh+dt, arnaud.pouliquen, andy.gross
  Cc: linux-remoteproc, linux-kernel, Arun Kumar Neelakantam,
	David Brown, Mark Rutland, open list:ARM/QUALCOMM SUPPORT,
	open list:ARM/QUALCOMM SUPPORT,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

From: Chris Lew <clew@codeaurora.org>

There are GLINK clients who open the same channel on multiple GLINK
links. These clients need a way to distinguish which remoteproc they
are communicating to. Add a label property to identify the edge this
node represents.

Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
index 9663cab..0b8cc53 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
@@ -10,6 +10,11 @@ edge.
 	Value type: <stringlist>
 	Definition: must be "qcom,glink-rpm"
 
+- label:
+	Usage: optional
+	Value type: <string>
+	Definition: should specify the subsystem name this edge corresponds to.
+
 - interrupts:
 	Usage: required
 	Value type: <prop-encoded-array>
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V4 1/9] dt-bindings: soc: qcom: Add label for GLINK bindings
@ 2018-07-27 12:17   ` Arun Kumar Neelakantam
  0 siblings, 0 replies; 13+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-27 12:17 UTC (permalink / raw)
  To: ohad, bjorn.andersson, clew, robh+dt, arnaud.pouliquen, andy.gross
  Cc: linux-remoteproc, linux-kernel, Arun Kumar Neelakantam,
	David Brown, Mark Rutland, open list:ARM/QUALCOMM SUPPORT,
	open list:ARM/QUALCOMM SUPPORT,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

From: Chris Lew <clew@codeaurora.org>

There are GLINK clients who open the same channel on multiple GLINK
links. These clients need a way to distinguish which remoteproc they
are communicating to. Add a label property to identify the edge this
node represents.

Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
index 9663cab..0b8cc53 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
@@ -10,6 +10,11 @@ edge.
 	Value type: <stringlist>
 	Definition: must be "qcom,glink-rpm"
 
+- label:
+	Usage: optional
+	Value type: <string>
+	Definition: should specify the subsystem name this edge corresponds to.
+
 - interrupts:
 	Usage: required
 	Value type: <prop-encoded-array>
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V4 2/9] rpmsg: glink: Store edge name for glink device
  2018-07-27 12:17 [PATCH V4 0/9] Add chrdev and name query support for GLINK Arun Kumar Neelakantam
  2018-07-27 12:17   ` Arun Kumar Neelakantam
@ 2018-07-27 12:17 ` Arun Kumar Neelakantam
  2018-07-27 12:17 ` [PATCH V4 3/9] rpmsg: glink: Use complete_all for open states Arun Kumar Neelakantam
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-27 12:17 UTC (permalink / raw)
  To: ohad, bjorn.andersson, clew, robh+dt, arnaud.pouliquen, andy.gross
  Cc: linux-remoteproc, linux-kernel, Arun Kumar Neelakantam

From: Chris Lew <clew@codeaurora.org>

Channels may need to identify the edge their channel was probed for.
Store the edge name by reading the label property from device tree or
default to the node name.

Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 drivers/rpmsg/qcom_glink_native.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index f505f58..22a3cac 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -93,6 +93,8 @@ struct glink_core_rx_intent {
 struct qcom_glink {
 	struct device *dev;
 
+	const char *name;
+
 	struct mbox_client mbox_client;
 	struct mbox_chan *mbox_chan;
 
@@ -1572,6 +1574,10 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev,
 	idr_init(&glink->lcids);
 	idr_init(&glink->rcids);
 
+	ret = of_property_read_string(dev->of_node, "label", &glink->name);
+	if (ret < 0)
+		glink->name = dev->of_node->name;
+
 	glink->mbox_client.dev = dev;
 	glink->mbox_client.knows_txdone = true;
 	glink->mbox_chan = mbox_request_channel(&glink->mbox_client, 0);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V4 3/9] rpmsg: glink: Use complete_all for open states
  2018-07-27 12:17 [PATCH V4 0/9] Add chrdev and name query support for GLINK Arun Kumar Neelakantam
  2018-07-27 12:17   ` Arun Kumar Neelakantam
  2018-07-27 12:17 ` [PATCH V4 2/9] rpmsg: glink: Store edge name for glink device Arun Kumar Neelakantam
@ 2018-07-27 12:17 ` Arun Kumar Neelakantam
  2018-07-27 12:17 ` [PATCH V4 4/9] rpmsg: Guard against null endpoint ops in destroy Arun Kumar Neelakantam
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-27 12:17 UTC (permalink / raw)
  To: ohad, bjorn.andersson, clew, robh+dt, arnaud.pouliquen, andy.gross
  Cc: linux-remoteproc, linux-kernel, Arun Kumar Neelakantam

From: Chris Lew <clew@codeaurora.org>

The open_req and open_ack completion variables are the state variables
to represet a remote channel as open. Use complete_all so there are no
races with waiters and using completion_done.

Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 drivers/rpmsg/qcom_glink_native.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 22a3cac..f43341d 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -949,7 +949,7 @@ static int qcom_glink_rx_open_ack(struct qcom_glink *glink, unsigned int lcid)
 		return -EINVAL;
 	}
 
-	complete(&channel->open_ack);
+	complete_all(&channel->open_ack);
 
 	return 0;
 }
@@ -1393,7 +1393,7 @@ static int qcom_glink_rx_open(struct qcom_glink *glink, unsigned int rcid,
 	channel->rcid = ret;
 	spin_unlock_irqrestore(&glink->idr_lock, flags);
 
-	complete(&channel->open_req);
+	complete_all(&channel->open_req);
 
 	if (create_device) {
 		rpdev = kzalloc(sizeof(*rpdev), GFP_KERNEL);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V4 4/9] rpmsg: Guard against null endpoint ops in destroy
  2018-07-27 12:17 [PATCH V4 0/9] Add chrdev and name query support for GLINK Arun Kumar Neelakantam
                   ` (2 preceding siblings ...)
  2018-07-27 12:17 ` [PATCH V4 3/9] rpmsg: glink: Use complete_all for open states Arun Kumar Neelakantam
@ 2018-07-27 12:17 ` Arun Kumar Neelakantam
  2018-07-27 12:17 ` [PATCH V4 5/9] rpmsg: glink: Add support for rpmsg glink chrdev Arun Kumar Neelakantam
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-27 12:17 UTC (permalink / raw)
  To: ohad, bjorn.andersson, clew, robh+dt, arnaud.pouliquen, andy.gross
  Cc: linux-remoteproc, linux-kernel, Arun Kumar Neelakantam

From: Chris Lew <clew@codeaurora.org>

In RPMSG GLINK the chrdev device will allocate an ept as part of the
rpdev creation. This device will not register endpoint ops even though
it has an allocated ept. Protect against the case where the device is
being destroyed.

Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 drivers/rpmsg/rpmsg_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
index b714a54..0860328 100644
--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -80,7 +80,7 @@ struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev,
  */
 void rpmsg_destroy_ept(struct rpmsg_endpoint *ept)
 {
-	if (ept)
+	if (ept && ept->ops)
 		ept->ops->destroy_ept(ept);
 }
 EXPORT_SYMBOL(rpmsg_destroy_ept);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V4 5/9] rpmsg: glink: Add support for rpmsg glink chrdev
  2018-07-27 12:17 [PATCH V4 0/9] Add chrdev and name query support for GLINK Arun Kumar Neelakantam
                   ` (3 preceding siblings ...)
  2018-07-27 12:17 ` [PATCH V4 4/9] rpmsg: Guard against null endpoint ops in destroy Arun Kumar Neelakantam
@ 2018-07-27 12:17 ` Arun Kumar Neelakantam
  2018-07-27 12:17 ` [PATCH V4 6/9] rpmsg: glink: Expose rpmsg name attr for glink Arun Kumar Neelakantam
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-27 12:17 UTC (permalink / raw)
  To: ohad, bjorn.andersson, clew, robh+dt, arnaud.pouliquen, andy.gross
  Cc: linux-remoteproc, linux-kernel, Arun Kumar Neelakantam

From: Chris Lew <clew@codeaurora.org>

RPMSG provides a char device interface to userspace. Probe the rpmsg
chrdev channel to enable the rpmsg_ctrl device creation on glink
transports.

Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 drivers/rpmsg/qcom_glink_native.c | 40 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index f43341d..9f3d026 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1158,7 +1158,7 @@ static int qcom_glink_announce_create(struct rpmsg_device *rpdev)
 	__be32 *val = defaults;
 	int size;
 
-	if (glink->intentless)
+	if (glink->intentless || !completion_done(&channel->open_ack))
 		return 0;
 
 	prop = of_find_property(np, "qcom,intents", NULL);
@@ -1544,6 +1544,40 @@ static void qcom_glink_work(struct work_struct *work)
 	}
 }
 
+static void qcom_glink_device_release(struct device *dev)
+{
+	struct rpmsg_device *rpdev = to_rpmsg_device(dev);
+	struct glink_channel *channel = to_glink_channel(rpdev->ept);
+
+	/* Release qcom_glink_alloc_channel() reference */
+	kref_put(&channel->refcount, qcom_glink_channel_release);
+	kfree(rpdev);
+}
+
+static int qcom_glink_create_chrdev(struct qcom_glink *glink)
+{
+	struct rpmsg_device *rpdev;
+	struct glink_channel *channel;
+
+	rpdev = kzalloc(sizeof(*rpdev), GFP_KERNEL);
+	if (!rpdev)
+		return -ENOMEM;
+
+	channel = qcom_glink_alloc_channel(glink, "rpmsg_chrdev");
+	if (IS_ERR(channel)) {
+		kfree(rpdev);
+		return PTR_ERR(channel);
+	}
+	channel->rpdev = rpdev;
+
+	rpdev->ept = &channel->ept;
+	rpdev->ops = &glink_device_ops;
+	rpdev->dev.parent = glink->dev;
+	rpdev->dev.release = qcom_glink_device_release;
+
+	return rpmsg_chrdev_register_device(rpdev);
+}
+
 struct qcom_glink *qcom_glink_native_probe(struct device *dev,
 					   unsigned long features,
 					   struct qcom_glink_pipe *rx,
@@ -1603,6 +1637,10 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev,
 	if (ret)
 		return ERR_PTR(ret);
 
+	ret = qcom_glink_create_chrdev(glink);
+	if (ret)
+		dev_err(glink->dev, "failed to register chrdev\n");
+
 	return glink;
 }
 EXPORT_SYMBOL_GPL(qcom_glink_native_probe);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V4 6/9] rpmsg: glink: Expose rpmsg name attr for glink
  2018-07-27 12:17 [PATCH V4 0/9] Add chrdev and name query support for GLINK Arun Kumar Neelakantam
                   ` (4 preceding siblings ...)
  2018-07-27 12:17 ` [PATCH V4 5/9] rpmsg: glink: Add support for rpmsg glink chrdev Arun Kumar Neelakantam
@ 2018-07-27 12:17 ` Arun Kumar Neelakantam
  2018-07-27 12:17 ` [PATCH V4 7/9] rpmsg: glink: Remove chunk size word align warning Arun Kumar Neelakantam
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-27 12:17 UTC (permalink / raw)
  To: ohad, bjorn.andersson, clew, robh+dt, arnaud.pouliquen, andy.gross
  Cc: linux-remoteproc, linux-kernel, Arun Kumar Neelakantam

From: Chris Lew <clew@codeaurora.org>

Expose the name field as an attr so clients listening to uevents for
rpmsg can identify the edge the events correspond to.

Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 drivers/rpmsg/qcom_glink_native.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 9f3d026..7b4ffa0 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1544,6 +1544,26 @@ static void qcom_glink_work(struct work_struct *work)
 	}
 }
 
+static ssize_t rpmsg_name_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	const char *name;
+
+	ret = of_property_read_string(dev->of_node, "label", &name);
+	if (ret < 0)
+		name = dev->of_node->name;
+
+	return snprintf(buf, RPMSG_NAME_SIZE, "%s\n", name);
+}
+static DEVICE_ATTR_RO(rpmsg_name);
+
+static struct attribute *qcom_glink_attrs[] = {
+	&dev_attr_rpmsg_name.attr,
+	NULL
+};
+ATTRIBUTE_GROUPS(qcom_glink);
+
 static void qcom_glink_device_release(struct device *dev)
 {
 	struct rpmsg_device *rpdev = to_rpmsg_device(dev);
@@ -1593,6 +1613,12 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev,
 		return ERR_PTR(-ENOMEM);
 
 	glink->dev = dev;
+	glink->dev->groups = qcom_glink_groups;
+
+	ret = device_add_groups(dev, qcom_glink_groups);
+	if (ret)
+		dev_err(dev, "failed to add groups\n");
+
 	glink->tx_pipe = tx;
 	glink->rx_pipe = rx;
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V4 7/9] rpmsg: glink: Remove chunk size word align warning
  2018-07-27 12:17 [PATCH V4 0/9] Add chrdev and name query support for GLINK Arun Kumar Neelakantam
                   ` (5 preceding siblings ...)
  2018-07-27 12:17 ` [PATCH V4 6/9] rpmsg: glink: Expose rpmsg name attr for glink Arun Kumar Neelakantam
@ 2018-07-27 12:17 ` Arun Kumar Neelakantam
  2018-07-27 12:17 ` [PATCH V4 8/9] rpmsg: glink: unregister rpmsg device during endpoint destroy Arun Kumar Neelakantam
  2018-07-27 12:17 ` [PATCH V4 9/9] rpmsg: Add compat ioctl for rpmsg char driver Arun Kumar Neelakantam
  8 siblings, 0 replies; 13+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-27 12:17 UTC (permalink / raw)
  To: ohad, bjorn.andersson, clew, robh+dt, arnaud.pouliquen, andy.gross
  Cc: linux-remoteproc, linux-kernel, Arun Kumar Neelakantam

From: Chris Lew <clew@codeaurora.org>

It is possible for the chunk sizes coming from the non RPM remote procs
to not be word aligned. Remove the alignment warning and continue to
read from the FIFO so execution is not stalled.

Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 drivers/rpmsg/qcom_glink_native.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 7b4ffa0..484b427 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -789,9 +789,6 @@ static int qcom_glink_rx_data(struct qcom_glink *glink, size_t avail)
 		return -EAGAIN;
 	}
 
-	if (WARN(chunk_size % 4, "Incoming data must be word aligned\n"))
-		return -EINVAL;
-
 	rcid = le16_to_cpu(hdr.msg.param1);
 	spin_lock_irqsave(&glink->idr_lock, flags);
 	channel = idr_find(&glink->rcids, rcid);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V4 8/9] rpmsg: glink: unregister rpmsg device during endpoint destroy
  2018-07-27 12:17 [PATCH V4 0/9] Add chrdev and name query support for GLINK Arun Kumar Neelakantam
                   ` (6 preceding siblings ...)
  2018-07-27 12:17 ` [PATCH V4 7/9] rpmsg: glink: Remove chunk size word align warning Arun Kumar Neelakantam
@ 2018-07-27 12:17 ` Arun Kumar Neelakantam
  2018-07-27 12:17 ` [PATCH V4 9/9] rpmsg: Add compat ioctl for rpmsg char driver Arun Kumar Neelakantam
  8 siblings, 0 replies; 13+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-27 12:17 UTC (permalink / raw)
  To: ohad, bjorn.andersson, clew, robh+dt, arnaud.pouliquen, andy.gross
  Cc: linux-remoteproc, linux-kernel, Arun Kumar Neelakantam

Rpmsg device unregister is not happening if channel close is triggered
from local side and causing re-registration of device failures.

Unregister rpmsg device for local close in endpoint destroy path.

Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 drivers/rpmsg/qcom_glink_native.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 484b427..d849bc4 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1184,6 +1184,7 @@ static void qcom_glink_destroy_ept(struct rpmsg_endpoint *ept)
 {
 	struct glink_channel *channel = to_glink_channel(ept);
 	struct qcom_glink *glink = channel->glink;
+	struct rpmsg_channel_info chinfo;
 	unsigned long flags;
 
 	spin_lock_irqsave(&channel->recv_lock, flags);
@@ -1191,6 +1192,13 @@ static void qcom_glink_destroy_ept(struct rpmsg_endpoint *ept)
 	spin_unlock_irqrestore(&channel->recv_lock, flags);
 
 	/* Decouple the potential rpdev from the channel */
+	if (channel->rpdev) {
+		strncpy(chinfo.name, channel->name, sizeof(chinfo.name));
+		chinfo.src = RPMSG_ADDR_ANY;
+		chinfo.dst = RPMSG_ADDR_ANY;
+
+		rpmsg_unregister_device(glink->dev, &chinfo);
+	}
 	channel->rpdev = NULL;
 
 	qcom_glink_send_close_req(glink, channel);
@@ -1456,6 +1464,7 @@ static void qcom_glink_rx_close(struct qcom_glink *glink, unsigned int rcid)
 
 		rpmsg_unregister_device(glink->dev, &chinfo);
 	}
+	channel->rpdev = NULL;
 
 	qcom_glink_send_close_ack(glink, channel->rcid);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V4 9/9] rpmsg: Add compat ioctl for rpmsg char driver
  2018-07-27 12:17 [PATCH V4 0/9] Add chrdev and name query support for GLINK Arun Kumar Neelakantam
                   ` (7 preceding siblings ...)
  2018-07-27 12:17 ` [PATCH V4 8/9] rpmsg: glink: unregister rpmsg device during endpoint destroy Arun Kumar Neelakantam
@ 2018-07-27 12:17 ` Arun Kumar Neelakantam
  8 siblings, 0 replies; 13+ messages in thread
From: Arun Kumar Neelakantam @ 2018-07-27 12:17 UTC (permalink / raw)
  To: ohad, bjorn.andersson, clew, robh+dt, arnaud.pouliquen, andy.gross
  Cc: linux-remoteproc, linux-kernel, Arun Kumar Neelakantam

Add compat ioctl callback to support 32bit user space applications.

Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 drivers/rpmsg/rpmsg_char.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
index 76a4477..a76b963 100644
--- a/drivers/rpmsg/rpmsg_char.c
+++ b/drivers/rpmsg/rpmsg_char.c
@@ -285,6 +285,7 @@ static long rpmsg_eptdev_ioctl(struct file *fp, unsigned int cmd,
 	.write = rpmsg_eptdev_write,
 	.poll = rpmsg_eptdev_poll,
 	.unlocked_ioctl = rpmsg_eptdev_ioctl,
+	.compat_ioctl = rpmsg_eptdev_ioctl,
 };
 
 static ssize_t name_show(struct device *dev, struct device_attribute *attr,
@@ -445,6 +446,7 @@ static long rpmsg_ctrldev_ioctl(struct file *fp, unsigned int cmd,
 	.open = rpmsg_ctrldev_open,
 	.release = rpmsg_ctrldev_release,
 	.unlocked_ioctl = rpmsg_ctrldev_ioctl,
+	.compat_ioctl = rpmsg_ctrldev_ioctl,
 };
 
 static void rpmsg_ctrldev_release_device(struct device *dev)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH V4 1/9] dt-bindings: soc: qcom: Add label for GLINK bindings
  2018-07-27 12:17   ` Arun Kumar Neelakantam
@ 2018-07-30 22:30     ` Rob Herring
  -1 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2018-07-30 22:30 UTC (permalink / raw)
  To: Arun Kumar Neelakantam
  Cc: ohad, bjorn.andersson, clew, arnaud.pouliquen, andy.gross,
	linux-remoteproc, linux-kernel, David Brown, Mark Rutland,
	open list:ARM/QUALCOMM SUPPORT, open list:ARM/QUALCOMM SUPPORT,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

On Fri, Jul 27, 2018 at 05:47:21PM +0530, Arun Kumar Neelakantam wrote:
> From: Chris Lew <clew@codeaurora.org>
> 
> There are GLINK clients who open the same channel on multiple GLINK
> links. These clients need a way to distinguish which remoteproc they
> are communicating to. Add a label property to identify the edge this
> node represents.
> 
> Signed-off-by: Chris Lew <clew@codeaurora.org>
> Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
> ---
>  Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt | 5 +++++
>  1 file changed, 5 insertions(+)

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH V4 1/9] dt-bindings: soc: qcom: Add label for GLINK bindings
@ 2018-07-30 22:30     ` Rob Herring
  0 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2018-07-30 22:30 UTC (permalink / raw)
  To: Arun Kumar Neelakantam
  Cc: ohad, bjorn.andersson, clew, arnaud.pouliquen, andy.gross,
	linux-remoteproc, linux-kernel, David Brown, Mark Rutland,
	open list:ARM/QUALCOMM SUPPORT, open list:ARM/QUALCOMM SUPPORT,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

On Fri, Jul 27, 2018 at 05:47:21PM +0530, Arun Kumar Neelakantam wrote:
> From: Chris Lew <clew@codeaurora.org>
> 
> There are GLINK clients who open the same channel on multiple GLINK
> links. These clients need a way to distinguish which remoteproc they
> are communicating to. Add a label property to identify the edge this
> node represents.
> 
> Signed-off-by: Chris Lew <clew@codeaurora.org>
> Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
> ---
>  Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt | 5 +++++
>  1 file changed, 5 insertions(+)

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-07-30 22:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-27 12:17 [PATCH V4 0/9] Add chrdev and name query support for GLINK Arun Kumar Neelakantam
2018-07-27 12:17 ` [PATCH V4 1/9] dt-bindings: soc: qcom: Add label for GLINK bindings Arun Kumar Neelakantam
2018-07-27 12:17   ` Arun Kumar Neelakantam
2018-07-30 22:30   ` Rob Herring
2018-07-30 22:30     ` Rob Herring
2018-07-27 12:17 ` [PATCH V4 2/9] rpmsg: glink: Store edge name for glink device Arun Kumar Neelakantam
2018-07-27 12:17 ` [PATCH V4 3/9] rpmsg: glink: Use complete_all for open states Arun Kumar Neelakantam
2018-07-27 12:17 ` [PATCH V4 4/9] rpmsg: Guard against null endpoint ops in destroy Arun Kumar Neelakantam
2018-07-27 12:17 ` [PATCH V4 5/9] rpmsg: glink: Add support for rpmsg glink chrdev Arun Kumar Neelakantam
2018-07-27 12:17 ` [PATCH V4 6/9] rpmsg: glink: Expose rpmsg name attr for glink Arun Kumar Neelakantam
2018-07-27 12:17 ` [PATCH V4 7/9] rpmsg: glink: Remove chunk size word align warning Arun Kumar Neelakantam
2018-07-27 12:17 ` [PATCH V4 8/9] rpmsg: glink: unregister rpmsg device during endpoint destroy Arun Kumar Neelakantam
2018-07-27 12:17 ` [PATCH V4 9/9] rpmsg: Add compat ioctl for rpmsg char driver Arun Kumar Neelakantam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.