* [PATCH] remoteproc: remoteproc_virtio: reset vdev before removing it
@ 2026-09-24 20:59 Tanmay Shah
2026-09-27 8:55 ` Francesco Valla
0 siblings, 1 reply; 5+ messages in thread
From: Tanmay Shah @ 2026-09-24 20:59 UTC (permalink / raw)
To: andersson, mathieu.poirier, ohad
Cc: linux-remoteproc, linux-kernel, Tanmay Shah
The virtio device is removed when the remoteproc device is removed. The
driver should issue reset on the virtio device so the remote can do
corresponding cleanup.
Fixes: 7a186941626d ("remoteproc: remove the single rpmsg vdev limitation")
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
---
drivers/remoteproc/remoteproc_virtio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
index d5e9ff045a28..1cb0ee0ea656 100644
--- a/drivers/remoteproc/remoteproc_virtio.c
+++ b/drivers/remoteproc/remoteproc_virtio.c
@@ -469,6 +469,8 @@ static int rproc_remove_virtio_dev(struct device *dev, void *data)
{
struct virtio_device *vdev = dev_to_virtio(dev);
+ virtio_reset_device(vdev);
+
unregister_virtio_device(vdev);
return 0;
}
base-commit: 5f639b3018c0026a5341949724b4b921cf3a3d5d
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] remoteproc: remoteproc_virtio: reset vdev before removing it
2026-09-24 20:59 [PATCH] remoteproc: remoteproc_virtio: reset vdev before removing it Tanmay Shah
@ 2026-09-27 8:55 ` Francesco Valla
2026-09-30 21:59 ` Shah, Tanmay
2026-10-01 16:50 ` Mathieu Poirier
0 siblings, 2 replies; 5+ messages in thread
From: Francesco Valla @ 2026-09-27 8:55 UTC (permalink / raw)
To: Tanmay Shah
Cc: andersson, mathieu.poirier, ohad, linux-remoteproc, linux-kernel
Hi Tanmay,
On Thu, Sep 24, 2026 at 01:59:02PM -0700, Tanmay Shah wrote:
> The virtio device is removed when the remoteproc device is removed. The
> driver should issue reset on the virtio device so the remote can do
> corresponding cleanup.
>
Shouldn't be the driver, and not the transport, the one that calls
virtio_reset_device()?
> Fixes: 7a186941626d ("remoteproc: remove the single rpmsg vdev limitation")
> Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
> ---
> drivers/remoteproc/remoteproc_virtio.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
> index d5e9ff045a28..1cb0ee0ea656 100644
> --- a/drivers/remoteproc/remoteproc_virtio.c
> +++ b/drivers/remoteproc/remoteproc_virtio.c
> @@ -469,6 +469,8 @@ static int rproc_remove_virtio_dev(struct device *dev, void *data)
> {
> struct virtio_device *vdev = dev_to_virtio(dev);
>
> + virtio_reset_device(vdev);
> +
> unregister_virtio_device(vdev);
> return 0;
> }
>
> base-commit: 5f639b3018c0026a5341949724b4b921cf3a3d5d
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] remoteproc: remoteproc_virtio: reset vdev before removing it
2026-09-27 8:55 ` Francesco Valla
@ 2026-09-30 21:59 ` Shah, Tanmay
2026-10-01 16:50 ` Mathieu Poirier
1 sibling, 0 replies; 5+ messages in thread
From: Shah, Tanmay @ 2026-09-30 21:59 UTC (permalink / raw)
To: Francesco Valla, Tanmay Shah
Cc: andersson, mathieu.poirier, ohad, linux-remoteproc, linux-kernel
On 9/27/2026 3:55 AM, Francesco Valla wrote:
> Hi Tanmay,
>
> On Thu, Sep 24, 2026 at 01:59:02PM -0700, Tanmay Shah wrote:
>> The virtio device is removed when the remoteproc device is removed. The
>> driver should issue reset on the virtio device so the remote can do
>> corresponding cleanup.
>>
>
> Shouldn't be the driver, and not the transport, the one that calls
> virtio_reset_device()?
>
Hello Francesco,
Thanks for your reviews. I will look into it.
Tanmay
>> Fixes: 7a186941626d ("remoteproc: remove the single rpmsg vdev limitation")
>> Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
>> ---
>> drivers/remoteproc/remoteproc_virtio.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
>> index d5e9ff045a28..1cb0ee0ea656 100644
>> --- a/drivers/remoteproc/remoteproc_virtio.c
>> +++ b/drivers/remoteproc/remoteproc_virtio.c
>> @@ -469,6 +469,8 @@ static int rproc_remove_virtio_dev(struct device *dev, void *data)
>> {
>> struct virtio_device *vdev = dev_to_virtio(dev);
>>
>> + virtio_reset_device(vdev);
>> +
>> unregister_virtio_device(vdev);
>> return 0;
>> }
>>
>> base-commit: 5f639b3018c0026a5341949724b4b921cf3a3d5d
>> --
>> 2.43.0
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] remoteproc: remoteproc_virtio: reset vdev before removing it
2026-09-27 8:55 ` Francesco Valla
2026-09-30 21:59 ` Shah, Tanmay
@ 2026-10-01 16:50 ` Mathieu Poirier
2026-10-01 17:18 ` Shah, Tanmay
1 sibling, 1 reply; 5+ messages in thread
From: Mathieu Poirier @ 2026-10-01 16:50 UTC (permalink / raw)
To: Francesco Valla
Cc: Tanmay Shah, andersson, ohad, linux-remoteproc, linux-kernel
On Sun, Sep 27, 2026 at 10:55:59AM +0200, Francesco Valla wrote:
> Hi Tanmay,
>
> On Thu, Sep 24, 2026 at 01:59:02PM -0700, Tanmay Shah wrote:
> > The virtio device is removed when the remoteproc device is removed. The
> > driver should issue reset on the virtio device so the remote can do
> > corresponding cleanup.
> >
>
> Shouldn't be the driver, and not the transport, the one that calls
> virtio_reset_device()?
Function rproc_remove_virtio_dev() calls unregister_virtio_device(), which calls
device_unregister(), which should end up calling virtio_bus.remove(), in this
case virtio_dev_remove(). virtio_dev_remove() calls drv->remove(). If we take
the RPMSG driver, rpmsg_remove() calls virtio_reset_device(), so explicitly
resetting devices as part of rproc_remove_virtio_dev() is not needed.
Tanmay, have you observed a scenario where the above isn't working?
>
> > Fixes: 7a186941626d ("remoteproc: remove the single rpmsg vdev limitation")
> > Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
> > ---
> > drivers/remoteproc/remoteproc_virtio.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
> > index d5e9ff045a28..1cb0ee0ea656 100644
> > --- a/drivers/remoteproc/remoteproc_virtio.c
> > +++ b/drivers/remoteproc/remoteproc_virtio.c
> > @@ -469,6 +469,8 @@ static int rproc_remove_virtio_dev(struct device *dev, void *data)
> > {
> > struct virtio_device *vdev = dev_to_virtio(dev);
> >
> > + virtio_reset_device(vdev);
> > +
> > unregister_virtio_device(vdev);
> > return 0;
> > }
> >
> > base-commit: 5f639b3018c0026a5341949724b4b921cf3a3d5d
> > --
> > 2.43.0
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] remoteproc: remoteproc_virtio: reset vdev before removing it
2026-10-01 16:50 ` Mathieu Poirier
@ 2026-10-01 17:18 ` Shah, Tanmay
0 siblings, 0 replies; 5+ messages in thread
From: Shah, Tanmay @ 2026-10-01 17:18 UTC (permalink / raw)
To: Mathieu Poirier, Francesco Valla
Cc: Tanmay Shah, andersson, ohad, linux-remoteproc, linux-kernel
On 10/1/2026 11:50 AM, Mathieu Poirier wrote:
> On Sun, Sep 27, 2026 at 10:55:59AM +0200, Francesco Valla wrote:
>> Hi Tanmay,
>>
>> On Thu, Sep 24, 2026 at 01:59:02PM -0700, Tanmay Shah wrote:
>>> The virtio device is removed when the remoteproc device is removed. The
>>> driver should issue reset on the virtio device so the remote can do
>>> corresponding cleanup.
>>>
>>
>> Shouldn't be the driver, and not the transport, the one that calls
>> virtio_reset_device()?
>
> Function rproc_remove_virtio_dev() calls unregister_virtio_device(), which calls
> device_unregister(), which should end up calling virtio_bus.remove(), in this
> case virtio_dev_remove(). virtio_dev_remove() calls drv->remove(). If we take
> the RPMSG driver, rpmsg_remove() calls virtio_reset_device(), so explicitly
> resetting devices as part of rproc_remove_virtio_dev() is not needed.
>
> Tanmay, have you observed a scenario where the above isn't working?
>
Nope. I didn't send the patch based on any practical scenario. This is
an old patch that I had used at the time to issue reset on shutdown. I
missed that the driver is already doing it. Probably my assessment was
incorrect at the time. I think we should remove this patch.
>>
>>> Fixes: 7a186941626d ("remoteproc: remove the single rpmsg vdev limitation")
>>> Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
>>> ---
>>> drivers/remoteproc/remoteproc_virtio.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
>>> index d5e9ff045a28..1cb0ee0ea656 100644
>>> --- a/drivers/remoteproc/remoteproc_virtio.c
>>> +++ b/drivers/remoteproc/remoteproc_virtio.c
>>> @@ -469,6 +469,8 @@ static int rproc_remove_virtio_dev(struct device *dev, void *data)
>>> {
>>> struct virtio_device *vdev = dev_to_virtio(dev);
>>>
>>> + virtio_reset_device(vdev);
>>> +
>>> unregister_virtio_device(vdev);
>>> return 0;
>>> }
>>>
>>> base-commit: 5f639b3018c0026a5341949724b4b921cf3a3d5d
>>> --
>>> 2.43.0
>>>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-01 17:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24 20:59 [PATCH] remoteproc: remoteproc_virtio: reset vdev before removing it Tanmay Shah
2026-09-27 8:55 ` Francesco Valla
2026-09-30 21:59 ` Shah, Tanmay
2026-10-01 16:50 ` Mathieu Poirier
2026-10-01 17:18 ` Shah, Tanmay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®