Skip to contentSkip to conversation

rpmsg: virtio_rpmsg_bus: fix channel creation

PATCH In review Loic Pallardy 6 participants 12 messages Dec 15, 2016 – Jan 11, 2017 Remote processor messaging (rpmsg)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 rpmsg: virtio_rpmsg_bus: fix channel creation

Since commit 4dffed5b3ac796b ("rpmsg: Name rpmsg devices based on channel id"), it is no more possible for a firmware to register twice a service (on different endpoints). rpmsg_register_device function is failing when calling device_add for the second time as second device has the same name as first one already register.
It is because name is based only on service name and so is not more unique. Previously name was unique thanks to the use of rpmsg_dev_index.

This patch adds destination and source endpoint numbers device name to create an unique identifier.

---
v2: Update commit header with commit ID generating regression Fix rpmsg_core instead of virtio_rpmsg

 drivers/rpmsg/rpmsg_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rpmsg/rpmsg_core.c +2 -2
index a79cb5a..18c73e0 100644
@@ -453,8 +453,8 @@ int rpmsg_register_device(struct rpmsg_device *rpdev)
 	struct device *dev = &rpdev->dev;
 	int ret;
 
-	dev_set_name(&rpdev->dev, "%s:%s",
-		     dev_name(dev->parent), rpdev->id.name);
+	dev_set_name(&rpdev->dev, "%s.%d.%d.%s", dev_name(dev->parent),
+		     rpdev->src, rpdev->dst, rpdev->id.name);
 
 	rpdev->dev.bus = &rpmsg_bus;
 	rpdev->dev.release = rpmsg_release_device;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 8 lines · Loic Pallardy

Since commit 4dffed5b3ac796b ("rpmsg: Name rpmsg devices based on channel id"), it is no more possible for a firmware to register twice a service (on different endpoints). rpmsg_register_device function is failing when calling device_add for the second time as second device has the same name as first one already register.
It is because name is based only on service name and so is not more unique. Previously name was unique thanks to the use of rpmsg_dev_index.

Quoted 4 lines

This patch adds destination and source endpoint numbers device name to create an unique identifier.

Looks good, thanks.

Regards,
Bjorn

Quoted 25 lines

---
v2: Update commit header with commit ID generating regression Fix rpmsg_core instead of virtio_rpmsg

 drivers/rpmsg/rpmsg_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rpmsg/rpmsg_core.c +2 -2
index a79cb5a..18c73e0 100644
@@ -453,8 +453,8 @@ int rpmsg_register_device(struct rpmsg_device *rpdev)
 	struct device *dev = &rpdev->dev;
 	int ret;
 
-	dev_set_name(&rpdev->dev, "%s:%s",
-		     dev_name(dev->parent), rpdev->id.name);
+	dev_set_name(&rpdev->dev, "%s.%d.%d.%s", dev_name(dev->parent),
+		     rpdev->src, rpdev->dst, rpdev->id.name);
 
 	rpdev->dev.bus = &rpmsg_bus;
 	rpdev->dev.release = rpmsg_release_device;
Signature · 1 line
1.9.1
#2 lore raw

Hi Loic,

Quoted 10 lines · Bjorn Andersson
Quoted 8 lines · Loic Pallardy

Since commit 4dffed5b3ac796b ("rpmsg: Name rpmsg devices based on channel id"), it is no more possible for a firmware to register twice a service (on different endpoints). rpmsg_register_device function is failing when calling device_add for the second time as second device has the same name as first one already register.
It is because name is based only on service name and so is not more unique. Previously name was unique thanks to the use of rpmsg_dev_index.

Quoted 6 lines
Quoted 4 lines

This patch adds destination and source endpoint numbers device name to create an unique identifier.

Looks good, thanks.

Thanks for the patch, I have ran into the exact same issue as well.

Quoted 19 lines

Regards,
Bjorn

Quoted 15 lines

---
v2: Update commit header with commit ID generating regression Fix rpmsg_core instead of virtio_rpmsg

 drivers/rpmsg/rpmsg_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rpmsg/rpmsg_core.c +0 -0
index a79cb5a..18c73e0 100644
@@ -453,8 +453,8 @@ int rpmsg_register_device(struct rpmsg_device *rpdev)
 	struct device *dev = &rpdev->dev;
 	int ret;
 
Quoted 4 lines

drivers/rpmsg/rpmsg_core.c int rpmsg_register_device(struct rpmsg_device *rpdev) · line 457

Quoted 4 lines
drivers/rpmsg/rpmsg_core.c +2 -2
-	dev_set_name(&rpdev->dev, "%s:%s",
-		     dev_name(dev->parent), rpdev->id.name);
+	dev_set_name(&rpdev->dev, "%s.%d.%d.%s", dev_name(dev->parent),
+		     rpdev->src, rpdev->dst, rpdev->id.name);

This is fine, though I would have preferred the numbers at the end after the string literals (%s.%s.%d.%d instead of %s.%d.%d.%s)

regards
Suman

Quoted 11 lines
Quoted 6 lines
drivers/rpmsg/rpmsg_core.c +0 -0
 	rpdev->dev.bus = &rpmsg_bus;
 	rpdev->dev.release = rpmsg_release_device;
Signature · 1 line
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 41 lines · Suman Anna

Hi Loic,

Quoted 10 lines · Bjorn Andersson
Quoted 8 lines · Loic Pallardy

Since commit 4dffed5b3ac796b ("rpmsg: Name rpmsg devices based on channel id"), it is no more possible for a firmware to register twice a service (on different endpoints). rpmsg_register_device function is failing when calling device_add for the second time as second device has the same name as first one already register.
It is because name is based only on service name and so is not more unique. Previously name was unique thanks to the use of rpmsg_dev_index.

Quoted 6 lines
Quoted 4 lines

This patch adds destination and source endpoint numbers device name to create an unique identifier.

Looks good, thanks.

Thanks for the patch, I have ran into the exact same issue as well.

Quoted 19 lines

Regards,
Bjorn

Quoted 15 lines

---
v2: Update commit header with commit ID generating regression Fix rpmsg_core instead of virtio_rpmsg

 drivers/rpmsg/rpmsg_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rpmsg/rpmsg_core.c +0 -0
index a79cb5a..18c73e0 100644
@@ -453,8 +453,8 @@ int rpmsg_register_device(struct rpmsg_device *rpdev)
 	struct device *dev = &rpdev->dev;
 	int ret;
 
Quoted 8 lines
Quoted 4 lines

drivers/rpmsg/rpmsg_core.c int rpmsg_register_device(struct rpmsg_device *rpdev) · line 457

Quoted 4 lines
drivers/rpmsg/rpmsg_core.c +2 -2
-	dev_set_name(&rpdev->dev, "%s:%s",
-		     dev_name(dev->parent), rpdev->id.name);
+	dev_set_name(&rpdev->dev, "%s.%d.%d.%s", dev_name(dev->parent),
+		     rpdev->src, rpdev->dst, rpdev->id.name);

This is fine, though I would have preferred the numbers at the end after the string literals (%s.%s.%d.%d instead of %s.%d.%d.%s)

When using the Qualcomm SMD backend only the name is used to identify channels, so I set src & dst to RPMSG_ADDR_ANY. Moving the numbers to the end makes this slightly better looking and one could potentially trim those without changing the structure of the name.

Loic, I took the liberty of changing the order and have updated my for-next [1] with the following patches:

a0c10687ec95 Revert "remoteproc: Merge table_ptr and cached_table pointers" c81c0e0710f0 remoteproc: fix vdev reference management 63447646ac65 rpmsg: virtio_rpmsg_bus: fix channel creation

I will let them sit there a few days to get some additional build and boot test and hope you can give them a spin as well; before I send them to Linus.

[1] https://github.com/andersson/remoteproc/commits/for-next

Regards,
Bjorn

#4 lore raw
Quoted 66 lines · Bjorn Andersson
Quoted 41 lines · Suman Anna

Hi Loic,

Quoted 10 lines · Bjorn Andersson
Quoted 8 lines · Loic Pallardy

Since commit 4dffed5b3ac796b ("rpmsg: Name rpmsg devices based on channel id"), it is no more possible for a firmware to register twice a service (on different endpoints). rpmsg_register_device function is failing when calling device_add for the second time as second device has the same name as first one already register.
It is because name is based only on service name and so is not more unique. Previously name was unique thanks to the use of rpmsg_dev_index.

Quoted 6 lines
Quoted 4 lines

This patch adds destination and source endpoint numbers device name to create an unique identifier.

Looks good, thanks.

Thanks for the patch, I have ran into the exact same issue as well.

Quoted 19 lines

Regards,
Bjorn

Quoted 15 lines

---
v2: Update commit header with commit ID generating regression Fix rpmsg_core instead of virtio_rpmsg

 drivers/rpmsg/rpmsg_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rpmsg/rpmsg_core.c +0 -0
index a79cb5a..18c73e0 100644
@@ -453,8 +453,8 @@ int rpmsg_register_device(struct rpmsg_device *rpdev)
 	struct device *dev = &rpdev->dev;
 	int ret;
 
Quoted 8 lines
Quoted 4 lines

drivers/rpmsg/rpmsg_core.c int rpmsg_register_device(struct rpmsg_device *rpdev) · line 457

Quoted 4 lines
drivers/rpmsg/rpmsg_core.c +2 -2
-	dev_set_name(&rpdev->dev, "%s:%s",
-		     dev_name(dev->parent), rpdev->id.name);
+	dev_set_name(&rpdev->dev, "%s.%d.%d.%s", dev_name(dev->parent),
+		     rpdev->src, rpdev->dst, rpdev->id.name);

This is fine, though I would have preferred the numbers at the end after the string literals (%s.%s.%d.%d instead of %s.%d.%d.%s)

When using the Qualcomm SMD backend only the name is used to identify channels, so I set src & dst to RPMSG_ADDR_ANY. Moving the numbers to the end makes this slightly better looking and one could potentially trim those without changing the structure of the name.

Loic, I took the liberty of changing the order and have updated my for-next [1] with the following patches:

a0c10687ec95 Revert "remoteproc: Merge table_ptr and cached_table pointers" c81c0e0710f0 remoteproc: fix vdev reference management 63447646ac65 rpmsg: virtio_rpmsg_bus: fix channel creation

Quoted 6 lines

I will let them sit there a few days to get some additional build and boot test and hope you can give them a spin as well; before I send them to Linus.

[1] https://github.com/andersson/remoteproc/commits/for-next

Loic, did you have a chance to give this a test run? I would appreciate your feedback before I send this off to Linus.

(The fixed version is part of linux-next as well)

Regards,
Bjorn

#5 lore raw
Quoted 72 lines · Bjorn Andersson
Quoted 70 lines · Bjorn Andersson
Quoted 41 lines · Suman Anna

Hi Loic,

Quoted 10 lines · Bjorn Andersson
Quoted 8 lines · Loic Pallardy

Since commit 4dffed5b3ac796b ("rpmsg: Name rpmsg devices based on channel id"), it is no more possible for a firmware to register twice a service (on different endpoints). rpmsg_register_device function is failing when calling device_add for the second time as second device has the same name as first one already register.
It is because name is based only on service name and so is not more unique. Previously name was unique thanks to the use of rpmsg_dev_index.

Quoted 6 lines
Quoted 4 lines

This patch adds destination and source endpoint numbers device name to create an unique identifier.

Looks good, thanks.

Thanks for the patch, I have ran into the exact same issue as well.

Quoted 19 lines

Regards,
Bjorn

Quoted 15 lines

---
v2: Update commit header with commit ID generating regression Fix rpmsg_core instead of virtio_rpmsg

 drivers/rpmsg/rpmsg_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rpmsg/rpmsg_core.c +0 -0
index a79cb5a..18c73e0 100644
@@ -453,8 +453,8 @@ int rpmsg_register_device(struct rpmsg_device *rpdev)
 	struct device *dev = &rpdev->dev;
 	int ret;
 
Quoted 8 lines
Quoted 4 lines

drivers/rpmsg/rpmsg_core.c int rpmsg_register_device(struct rpmsg_device *rpdev) · line 457

Quoted 4 lines
drivers/rpmsg/rpmsg_core.c +2 -2
-	dev_set_name(&rpdev->dev, "%s:%s",
-		     dev_name(dev->parent), rpdev->id.name);
+	dev_set_name(&rpdev->dev, "%s.%d.%d.%s", dev_name(dev->parent),
+		     rpdev->src, rpdev->dst, rpdev->id.name);

This is fine, though I would have preferred the numbers at the end after the string literals (%s.%s.%d.%d instead of %s.%d.%d.%s)

When using the Qualcomm SMD backend only the name is used to identify channels, so I set src & dst to RPMSG_ADDR_ANY. Moving the numbers to the end makes this slightly better looking and one could potentially trim those without changing the structure of the name.

Loic, I took the liberty of changing the order and have updated my for-next [1] with the following patches:

a0c10687ec95 Revert "remoteproc: Merge table_ptr and cached_table pointers" c81c0e0710f0 remoteproc: fix vdev reference management 63447646ac65 rpmsg: virtio_rpmsg_bus: fix channel creation

I will let them sit there a few days to get some additional build and boot test and hope you can give them a spin as well; before I send them to Linus.

Quoted 7 lines
Quoted 2 lines

[1] https://github.com/andersson/remoteproc/commits/for-next

Loic, did you have a chance to give this a test run? I would appreciate your feedback before I send this off to Linus.

(The fixed version is part of linux-next as well)

FWIW, these work fine on TI platforms. I had run into the same issues that these commits were fixing.

regards
Suman

#6 lore raw
Quoted 2 lines · Suman Anna
Quoted 1 line · Bjorn Andersson

On Fri 30 Dec 11:56 PST 2016, Bjorn Andersson wrote:

[..]

Quoted 8 lines
Quoted 4 lines

Loic, did you have a chance to give this a test run? I would appreciate your feedback before I send this off to Linus.

(The fixed version is part of linux-next as well)

FWIW, these work fine on TI platforms. I had run into the same issues that these commits were fixing.

Thanks Suman!

Regards,
Bjorn

#7 lore raw
In reply to Bjorn Andersson
Quoted 88 lines

-----Original Message-----
From: Bjorn Andersson [mailto:[email protected]]
Sent: Tuesday, January 10, 2017 12:46 AM
To: Loic PALLARDY <[email protected]>; Suman Anna <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; Patrice CHOTARD <[email protected]>
Subject: Re: [PATCH v2 1/1] rpmsg: virtio_rpmsg_bus: fix channel creation

Quoted 8 lines · Bjorn Andersson
Quoted 6 lines · Suman Anna

Hi Loic,

Quoted 3 lines · Bjorn Andersson
Quoted 1 line · Loic Pallardy

Since commit 4dffed5b3ac796b ("rpmsg: Name rpmsg devices based

on

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

channel id"), it is no more possible for a firmware to register twice a service (on different endpoints). rpmsg_register_device function is failing when calling device_add for the second time as second device has the same name as first one already register. It is because name is based only on service name and so is not more unique. Previously name was unique thanks to the use of

rpmsg_dev_index.

Quoted 18 lines
Quoted 18 lines
Quoted 7 lines
Quoted 5 lines

This patch adds destination and source endpoint numbers device name to create an unique identifier.

Looks good, thanks.

Thanks for the patch, I have ran into the exact same issue as well.

Quoted 8 lines

Regards,
Bjorn

Quoted 4 lines

---
v2: Update commit header with commit ID generating regression Fix rpmsg_core instead of virtio_rpmsg

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/rpmsg/rpmsg_core.c int rpmsg_register_device(struct

Quoted 8 lines
 drivers/rpmsg/rpmsg_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/rpmsg/rpmsg_core.c index a79cb5a..18c73e0 100644

drivers/rpmsg/rpmsg_core.c +0 -0
@@ -453,8 +453,8 @@ int rpmsg_register_device(struct

rpmsg_device *rpdev)

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/rpmsg/rpmsg_core.c int rpmsg_register_device(struct rpmsg_device *rpdev)

Quoted 6 lines
drivers/rpmsg/rpmsg_core.c +1 -2
 	struct device *dev = &rpdev->dev;
 	int ret;
 
-	dev_set_name(&rpdev->dev, "%s:%s",
-		     dev_name(dev->parent), rpdev->id.name);
+	dev_set_name(&rpdev->dev, "%s.%d.%d.%s",

dev_name(dev->parent),

Quoted 12 lines
Quoted 5 lines
Quoted 1 line

drivers/rpmsg/rpmsg_core.c int rpmsg_register_device(struct rpmsg_device *rpdev) · line 457

Quoted 1 line
drivers/rpmsg/rpmsg_core.c +1 -0
+		     rpdev->src, rpdev->dst, rpdev->id.name);

This is fine, though I would have preferred the numbers at the end after the string literals (%s.%s.%d.%d instead of %s.%d.%d.%s)

When using the Qualcomm SMD backend only the name is used to identify channels, so I set src & dst to RPMSG_ADDR_ANY. Moving the numbers to the end makes this slightly better looking and one could potentially trim those without changing the structure of the name.

Quoted 4 lines

Loic, I took the liberty of changing the order and have updated my for-next [1] with the following patches:

a0c10687ec95 Revert "remoteproc: Merge table_ptr and cached_table

pointers"

Quoted 8 lines

c81c0e0710f0 remoteproc: fix vdev reference management 63447646ac65 rpmsg: virtio_rpmsg_bus: fix channel creation

I will let them sit there a few days to get some additional build and boot test and hope you can give them a spin as well; before I send them to Linus.

Quoted 5 lines
Quoted 2 lines

[1] https://github.com/andersson/remoteproc/commits/for-next

Loic, did you have a chance to give this a test run? I would appreciate your feedback before I send this off to Linus.

Hi Bjorn,

Sorry for my late answer.
Tested on my side. Works fine on ST platform.
Thanks,
Loic

Quoted 5 lines

(The fixed version is part of linux-next as well)

Regards,
Bjorn

#8 lore raw
Quoted 1 line · Loic PALLARDY
Quoted 1 line

From: Bjorn Andersson [mailto:[email protected]]

[..]

Quoted 6 lines
Quoted 2 lines

Loic, did you have a chance to give this a test run? I would appreciate your feedback before I send this off to Linus.

Hi Bjorn,

Sorry for my late answer.
Tested on my side. Works fine on ST platform.

Thanks Loic!

Regards,
Bjorn

Acked-by on v2 1/1
#9 lore raw
In reply to Loic Pallardy

Hi Loic,

Quoted 8 lines · Loic Pallardy

Since commit 4dffed5b3ac796b ("rpmsg: Name rpmsg devices based on channel id"), it is no more possible for a firmware to register twice a service (on different endpoints). rpmsg_register_device function is failing when calling device_add for the second time as second device has the same name as first one already register.
It is because name is based only on service name and so is not more unique. Previously name was unique thanks to the use of rpmsg_dev_index.

Quoted 7 lines

This patch adds destination and source endpoint numbers device name to create an unique identifier.

---
v2: Update commit header with commit ID generating regression Fix rpmsg_core instead of virtio_rpmsg

regards,

Peter.

Acked-by on v2 1/1
#10 lore raw
In reply to Loic Pallardy
Quoted 11 lines · Loic Pallardy

Since commit 4dffed5b3ac796b ("rpmsg: Name rpmsg devices based on channel id"), it is no more possible for a firmware to register twice a service (on different endpoints). rpmsg_register_device function is failing when calling device_add for the second time as second device has the same name as first one already register.
It is because name is based only on service name and so is not more unique. Previously name was unique thanks to the use of rpmsg_dev_index.

This patch adds destination and source endpoint numbers device name to create an unique identifier.

Quoted 7 lines

---
v2: Update commit header with commit ID generating regression Fix rpmsg_core instead of virtio_rpmsg

 drivers/rpmsg/rpmsg_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 15 lines
drivers/rpmsg/rpmsg_core.c +2 -2
index a79cb5a..18c73e0 100644
@@ -453,8 +453,8 @@ int rpmsg_register_device(struct rpmsg_device *rpdev)
 	struct device *dev = &rpdev->dev;
 	int ret;
 
-	dev_set_name(&rpdev->dev, "%s:%s",
-		     dev_name(dev->parent), rpdev->id.name);
+	dev_set_name(&rpdev->dev, "%s.%d.%d.%s", dev_name(dev->parent),
+		     rpdev->src, rpdev->dst, rpdev->id.name);
 
 	rpdev->dev.bus = &rpmsg_bus;
 	rpdev->dev.release = rpmsg_release_device;
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
Acked-by
#11 lore raw
Quoted 11 lines · Loic Pallardy

Since commit 4dffed5b3ac796b ("rpmsg: Name rpmsg devices based on channel id"), it is no more possible for a firmware to register twice a service (on different endpoints). rpmsg_register_device function is failing when calling device_add for the second time as second device has the same name as first one already register.
It is because name is based only on service name and so is not more unique. Previously name was unique thanks to the use of rpmsg_dev_index.

This patch adds destination and source endpoint numbers device name to create an unique identifier.

Quoted 7 lines

---
v2: Update commit header with commit ID generating regression Fix rpmsg_core instead of virtio_rpmsg

  drivers/rpmsg/rpmsg_core.c | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 15 lines
drivers/rpmsg/rpmsg_core.c +0 -0
index a79cb5a..18c73e0 100644
@@ -453,8 +453,8 @@ int rpmsg_register_device(struct rpmsg_device *rpdev)
         struct device *dev = &rpdev->dev;
         int ret;


-     dev_set_name(&rpdev->dev, "%s:%s",
-                  dev_name(dev->parent), rpdev->id.name); +     dev_set_name(&rpdev->dev, "%s.%d.%d.%s", dev_name(dev->parent), +                  rpdev->src, rpdev->dst, rpdev->id.name);
        rpdev->dev.bus = &rpmsg_bus;
        rpdev->dev.release = rpmsg_release_device;

Signature · 3 lines
Marek Novak
Multicore Software Engineer
NXP Semiconductors