linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] remoteproc: core: Auto select rproc-virtio device id
@ 2022-10-13  2:28 Shengjiu Wang
  2022-10-13  8:27 ` Arnaud POULIQUEN
  2022-10-13 12:47 ` Peng Fan
  0 siblings, 2 replies; 4+ messages in thread
From: Shengjiu Wang @ 2022-10-13  2:28 UTC (permalink / raw)
  To: andersson, mathieu.poirier, arnaud.pouliquen
  Cc: linux-remoteproc, linux-kernel, shengjiu.wang

With multiple remoteproc device, there will below error:

sysfs: cannot create duplicate filename '/bus/platform/devices/rproc-virtio.0'

The rvdev_data.index is duplicate, that cause issue, so
need to use the PLATFORM_DEVID_AUTO instead.

Fixes: 1d7b61c06dc3 ("remoteproc: virtio: Create platform device for the remoteproc_virtio")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 drivers/remoteproc/remoteproc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 8768cb64f560..03a26498e879 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -509,7 +509,7 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr,
 	rvdev_data.rsc_offset = offset;
 	rvdev_data.rsc = rsc;
 
-	pdev = platform_device_register_data(dev, "rproc-virtio", rvdev_data.index, &rvdev_data,
+	pdev = platform_device_register_data(dev, "rproc-virtio", PLATFORM_DEVID_AUTO, &rvdev_data,
 					     sizeof(rvdev_data));
 	if (IS_ERR(pdev)) {
 		dev_err(dev, "failed to create rproc-virtio device\n");
-- 
2.34.1


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

* Re: [PATCH] remoteproc: core: Auto select rproc-virtio device id
  2022-10-13  2:28 [PATCH] remoteproc: core: Auto select rproc-virtio device id Shengjiu Wang
@ 2022-10-13  8:27 ` Arnaud POULIQUEN
  2022-10-13 12:45   ` Mukesh Ojha
  2022-10-13 12:47 ` Peng Fan
  1 sibling, 1 reply; 4+ messages in thread
From: Arnaud POULIQUEN @ 2022-10-13  8:27 UTC (permalink / raw)
  To: Shengjiu Wang, andersson, mathieu.poirier
  Cc: linux-remoteproc, linux-kernel, shengjiu.wang

Hi Shengju,

On 10/13/22 04:28, Shengjiu Wang wrote:
> With multiple remoteproc device, there will below error:
> 
> sysfs: cannot create duplicate filename '/bus/platform/devices/rproc-virtio.0'

Good catch! 
Previously the device created was 
/sys/class/remoteproc/remoteproc0/remoteproc0#vdev0buffer/

So with your fix it become something like 
/bus/platform/devices/rproc-virtio.2.auto


This works fine on my platform, also when creating two virtio devices for one
remoteproc device.
 
Just a remark, could be nice to indicate in the commit message the result of
your patch, means the name of the files created.

With that:
Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>

Thanks,
Arnaud


> 
> The rvdev_data.index is duplicate, that cause issue, so
> need to use the PLATFORM_DEVID_AUTO instead.
> 
> Fixes: 1d7b61c06dc3 ("remoteproc: virtio: Create platform device for the remoteproc_virtio")
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
>  drivers/remoteproc/remoteproc_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index 8768cb64f560..03a26498e879 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -509,7 +509,7 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr,
>  	rvdev_data.rsc_offset = offset;
>  	rvdev_data.rsc = rsc;
>  
> -	pdev = platform_device_register_data(dev, "rproc-virtio", rvdev_data.index, &rvdev_data,
> +	pdev = platform_device_register_data(dev, "rproc-virtio", PLATFORM_DEVID_AUTO, &rvdev_data,
>  					     sizeof(rvdev_data));
>  	if (IS_ERR(pdev)) {
>  		dev_err(dev, "failed to create rproc-virtio device\n");

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

* Re: [PATCH] remoteproc: core: Auto select rproc-virtio device id
  2022-10-13  8:27 ` Arnaud POULIQUEN
@ 2022-10-13 12:45   ` Mukesh Ojha
  0 siblings, 0 replies; 4+ messages in thread
From: Mukesh Ojha @ 2022-10-13 12:45 UTC (permalink / raw)
  To: Arnaud POULIQUEN, Shengjiu Wang, andersson, mathieu.poirier
  Cc: linux-remoteproc, linux-kernel, shengjiu.wang

Hi,

On 10/13/2022 1:57 PM, Arnaud POULIQUEN wrote:
> Hi Shengju,
> 
> On 10/13/22 04:28, Shengjiu Wang wrote:
>> With multiple remoteproc device, there will below error:
>>
>> sysfs: cannot create duplicate filename '/bus/platform/devices/rproc-virtio.0'
> 
> Good catch!
> Previously the device created was
> /sys/class/remoteproc/remoteproc0/remoteproc0#vdev0buffer/
> 
> So with your fix it become something like
> /bus/platform/devices/rproc-virtio.2.auto
> 
> 
> This works fine on my platform, also when creating two virtio devices for one
> remoteproc device.
>   
> Just a remark, could be nice to indicate in the commit message the result of
> your patch, means the name of the files created.

Agree with the suggestion of putting the output in commit message.

LGTM.
Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>

-Mukesh

> 
> With that:
> Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
> 
> Thanks,
> Arnaud
> 
> 
>>
>> The rvdev_data.index is duplicate, that cause issue, so
>> need to use the PLATFORM_DEVID_AUTO instead.
>>
>> Fixes: 1d7b61c06dc3 ("remoteproc: virtio: Create platform device for the remoteproc_virtio")
>> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
>> ---
>>   drivers/remoteproc/remoteproc_core.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
>> index 8768cb64f560..03a26498e879 100644
>> --- a/drivers/remoteproc/remoteproc_core.c
>> +++ b/drivers/remoteproc/remoteproc_core.c
>> @@ -509,7 +509,7 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr,
>>   	rvdev_data.rsc_offset = offset;
>>   	rvdev_data.rsc = rsc;
>>   
>> -	pdev = platform_device_register_data(dev, "rproc-virtio", rvdev_data.index, &rvdev_data,
>> +	pdev = platform_device_register_data(dev, "rproc-virtio", PLATFORM_DEVID_AUTO, &rvdev_data,
>>   					     sizeof(rvdev_data));
>>   	if (IS_ERR(pdev)) {
>>   		dev_err(dev, "failed to create rproc-virtio device\n");

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

* RE: [PATCH] remoteproc: core: Auto select rproc-virtio device id
  2022-10-13  2:28 [PATCH] remoteproc: core: Auto select rproc-virtio device id Shengjiu Wang
  2022-10-13  8:27 ` Arnaud POULIQUEN
@ 2022-10-13 12:47 ` Peng Fan
  1 sibling, 0 replies; 4+ messages in thread
From: Peng Fan @ 2022-10-13 12:47 UTC (permalink / raw)
  To: S.J. Wang, andersson, mathieu.poirier, arnaud.pouliquen
  Cc: linux-remoteproc, linux-kernel, shengjiu.wang

> Subject: [PATCH] remoteproc: core: Auto select rproc-virtio device id
> 
> With multiple remoteproc device, there will below error:
> 
> sysfs: cannot create duplicate filename '/bus/platform/devices/rproc-
> virtio.0'
> 
> The rvdev_data.index is duplicate, that cause issue, so need to use the
> PLATFORM_DEVID_AUTO instead.
> 
> Fixes: 1d7b61c06dc3 ("remoteproc: virtio: Create platform device for the
> remoteproc_virtio")
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>

Met same issue with on i.MX8QM-MEK dual CM4 case, and I tested same
approach as you did.

Tested-by: Peng Fan <peng.fan@nxp.com>

> ---
>  drivers/remoteproc/remoteproc_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_core.c
> b/drivers/remoteproc/remoteproc_core.c
> index 8768cb64f560..03a26498e879 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -509,7 +509,7 @@ static int rproc_handle_vdev(struct rproc *rproc,
> void *ptr,
>  	rvdev_data.rsc_offset = offset;
>  	rvdev_data.rsc = rsc;
> 
> -	pdev = platform_device_register_data(dev, "rproc-virtio",
> rvdev_data.index, &rvdev_data,
> +	pdev = platform_device_register_data(dev, "rproc-virtio",
> +PLATFORM_DEVID_AUTO, &rvdev_data,
>  					     sizeof(rvdev_data));
>  	if (IS_ERR(pdev)) {
>  		dev_err(dev, "failed to create rproc-virtio device\n");
> --
> 2.34.1


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

end of thread, other threads:[~2022-10-13 12:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-13  2:28 [PATCH] remoteproc: core: Auto select rproc-virtio device id Shengjiu Wang
2022-10-13  8:27 ` Arnaud POULIQUEN
2022-10-13 12:45   ` Mukesh Ojha
2022-10-13 12:47 ` Peng Fan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).