Re: [PATCH RFC v2 05/11] remoteproc: virtio: report VIRTIO_F_ACCESS_PLATFORM when required

From: Mathieu Poirier

Date: Wed Nov 18 2026 - 10:42:27 EST


On Tue, Nov 17, 2026 at 11:18:03PM +0100, Francesco Valla wrote:
> On Mon, Nov 16, 2026 at 11:16:13AM -0600, Mathieu Poirier wrote:
> > On Mon, Nov 02, 2026 at 12:26:42AM +0100, Francesco Valla wrote:
> > > Depending on the driver originating them, data buffers used for virtio
> > > communication can either:
> > >
> > > - already be allocated from the coherent memory area that is
> > > accessible by the remote processor; this is the case of
> > > remoteproc-specific virtio devices, i.e., rpmsg and rproc-serial;
> > > - be allocated from generic kmem, and thus not necessarily accessible
> > > directly by the remote processor.
> > >
> > > In the second case, the DMA APIs can be exploited to obtain a
> > > functional communication, since they will take care of cache maintenance
> > > and - if required - bounce buffering. The VIRTIO_F_ACCESS_PLATFORM
> > > feature flag can be used for this purpose: with it set, the virtio
> > > framework will use the aforementioned DMA APIs to map and unmap buffers.
> > >
> > > Bounce buffering will be transparently used in two cases:
> > >
> > > - if the buffer address supplied by the virtio driver is not suitable
> > > for DMA transfers, or
> > > - if the reserved memory associated to the vdev is a
> > > restricted-dma-pool; in this case, *all* buffers will be bounced to
> > > and from this pool.
> > >
> > > With this support in place, any kind of virtio device can be supported
> > > through the remoteproc-virtio transport, at least from a data exchange
> > > standpoint.
> > >
> > > Note that remote processors behind an IOMMU need da == pa for the memory
> > > region(s) the buffers are allocated from.
> >
> > I'm not sure to understand the da == pa requirement - can you expand more on
> > that?
> >
>
> Yes! With a caveat: the IOMMU usage by the remoteproc framework and how
> it can integrate with this work is the main reason this is an RFC, as
> stated in the cover letter, because I'm not sure I understand all of it.
> See for example the dma-to-da conversion in [1] or the comment in [2].
>

The remoteproc subsystem was written a _very_ long time ago and the context of
some artefacts, such as [1] and [2], is long lost.

> That said: all the IOMMU setup that is done today by the remoteproc core
> is linked to the *remoteproc* device, not to the rproc_vdev (i.e., the
> device backing the virtio device). For that reason, the DMA subsystem
> should not be able to know that setup even exists, in particular while
> performing swiotlb operations. Hence, the requirement to have a 1:1
> mapping between da (i.e., the address the device uses) and pa (the
> physical memory map).

I would like to reserve the current remoteproc IOMMU design for handling legacy
rproc-virtio devices, i.e rpmsg and serial, and only use the modern
virtio/swiotlb API to handle authentic rproc-virtio devices.

Based on what I see here [3], I think above sentence:

"Note that remote processors behind an IOMMU need da == pa for the memory..."

should be replaced with:

"Note that remote processors not behind an IOMMU need da == pa for the memory..."

[3]. https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/remoteproc/remoteproc_core.c#L703

>
> > >
> > > Existing use cases (e.g., rpmsg and virtio-console) are not impacted as
> > > they are explicitly excluded.
> > >
> > > Signed-off-by: Francesco Valla <francesco@xxxxxxxx>
> > > ---
> > > drivers/remoteproc/remoteproc_virtio.c | 10 ++++++++--
> > > 1 file changed, 8 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
> > > index f1b362158a9c..1496659ddff9 100644
> > > --- a/drivers/remoteproc/remoteproc_virtio.c
> > > +++ b/drivers/remoteproc/remoteproc_virtio.c
> > > @@ -280,9 +280,14 @@ static u64 rproc_virtio_get_features(struct virtio_device *vdev)
> > > * All non-remoteproc-specific virtio devices are assumed to be
> > > * compliant with virtio specifications 1.x; there is no other method
> > > * to transmit this capability from the remote processor to the host.
> > > + *
> > > + * Virtio devices that are specific for remoteproc usage take care on
> > > + * their own to allocate memory from the device's coherent pool; use
> > > + * the DMA APIs for the others through VIRTIO_F_ACCESS_PLATFORM.
> > > */
> > > if (!rproc_virtio_rsc_vdev_rproc_specific(rsc))
> > > - features |= (1ULL << VIRTIO_F_VERSION_1);
> > > + features |= ((1ULL << VIRTIO_F_VERSION_1) |
> > > + (1ULL << VIRTIO_F_ACCESS_PLATFORM));
> > >
> > > return features;
> > > }
> > > @@ -312,7 +317,8 @@ static int rproc_virtio_finalize_features(struct virtio_device *vdev)
> > > features = vdev->features;
> > >
> > > if (!rproc_virtio_rsc_vdev_rproc_specific(rsc))
> > > - features &= ~(1ULL << VIRTIO_F_VERSION_1);
> > > + features &= ~((1ULL << VIRTIO_F_VERSION_1) |
> > > + (1ULL << VIRTIO_F_ACCESS_PLATFORM));
> > >
> > > if (WARN_ON((u32)vdev->features != features))
> > > return -EINVAL;
> > >
> > > --
> > > 2.56.0
> > >
> >
>
> Thank you!
>
> Reagrds,
> Francesco
>
> [1] https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/remoteproc/remoteproc_core.c#L716
> [2] https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/remoteproc/remoteproc_core.c#L461
>