From: Francesco Valla <francesco@valla.it>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>,
Bjorn Andersson <andersson@kernel.org>,
Kees Cook <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Frank Li <Frank.Li@nxp.com>,
Peng Fan <peng.fan@nxp.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, virtualization@lists.linux.dev,
imx@lists.linux.dev, iommu@lists.linux.dev,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH RFC 06/12] remoteproc: virtio: add bounce buffering for data buffers
Date: Fri, 25 Sep 2026 21:05:43 +0200 [thread overview]
Message-ID: <arbEmz1jy0V7gjrU@bywater> (raw)
In-Reply-To: <1b55f680-2413-4db1-b928-ed5741696d07@arm.com>
Hi Robin, Mathieu,
On Fri, Sep 25, 2026 at 05:48:25PM +0100, Robin Murphy wrote:
> On 25/09/2026 4:07 pm, Mathieu Poirier wrote:
> > On Wed, Sep 23, 2026 at 06:05:35PM +0200, Francesco Valla wrote:
> > > On Wed, Sep 23, 2026 at 08:44:41AM -0600, Mathieu Poirier wrote:
> > > > On Tue, 22 Sept 2026 at 13:39, Francesco Valla <francesco@valla.it> wrote:
> > > > >
> > > > > On Tue, Sep 22, 2026 at 09:58:53AM -0600, Mathieu Poirier wrote:
> > > > > > On Wed, Sep 16, 2026 at 11:10:51PM +0200, 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 rpmsg
> > > > > > > and the rproc flavor of virtio-console;
> > > > > > > - be allocated from generic kmem, and thus not accessible directly by
> > > > > > > the remote processor.
> > > > > > >
> > > > > > > Exploiting the map operations, which are used by the virtio framework
> > > > > > > when VIRTIO_F_ACCESS_PLATFORM is part of a vdev's feature flags, add
> > > > > > > bounce buffering for the second case: when the map() callback is called
> > > > > > > for a buffer, one or more pages of coherent memory are allocated and
> > > > > > > data is copied to them, then they are exposed to the remote processor;
> > > > > > > the data is then bounced back on unmap().
> > > > > > >
> > > > > > > The first case is not impacted, since buffers already suitable for
> > > > > > > remote transmission are passed through.
> > > > > > >
> > > > > > > With the bounce buffering in place, any kind of virtio device can be
> > > > > > > supported through the remoteproc-virtio transport, at least from a
> > > > > > > data exchange standpoint.
> > > > > >
> > > > > > Is this _necessary_ for the imx93 platform you are implementing feature for?
> > > > > >
> > > > >
> > > > > If I don't want to fundamentally change how the remoteproc integration
> > > > > works (i.e.: using buffers only from a pre-shared area), yes. While in
> > > > > my test environment the Cortex-M33 serving as remoteproc is able to
> > > > > access the whole RAM space, that is not always the case.
> > > >
> > > > The first sentence tells me it is mandatory while the second says it
> > > > is not. I understand the use case but don't want to bloat the
> > > > subsystem with code that is trying to address a problem you currently
> > > > don't have.
> > > >
> > >
> > > Let me rephrase: while on i.MX93 the Cortex-M33 can theoretically access
> > > the whole RAM space, that is not a good idea from a security point of
> > > view and can be the source of a number of bugs. The target is to
> > > statically define a static shared memory area (as I am doing on i.MX95)
> > > and only use that.
> >
> > As Robin pointed out, have you looked at using a restricted-dma-pool for that?
> > Note that I am not familiar with the concept but open to go that way if it can
> > work for us.
> >
> > Robin, can you point us to a simple example we could look at?
> The only in-tree example is mt8192-asurada.dtsi, but even there the
> fundamental principle seems exactly the same - the system interconnect is
> locked down such that there's only a particular region of "shared" memory
> that PCIe DMA can access, so the restricted pool is placed there, and in
> that case can occupy the entire region since the wifi adapter only really
> does streaming DMA - restricted pools have some limited ability to act as a
> fallback for coherent allocations, which won't work for everything, but does
> happen to be enough for that wifi driver.
>
> Here it would be a case of reserving some of the shared region for a
> restricted pool alongside the "vdevbuffer" coherent pool, adding it to the
> memory-region list of the relevant device(s), and usually that would then
> just work, since the setup is all done automatically by the core DT code.
> However I know remoteproc does some funky stuff with child devices, so it's
> quite possible there might need to be something more done there. But still
> far, far less than reimplementing a whole other bounce-buffering system.
>
> Thanks,
> Robin.
I took a look at the restricted-memory-pool - with which I wasn't
familiar - and seems exactly what is needed here.
I am working on a new prototype with it - if everything works as
expected (I still did not have time to try it) it should only need some
very limited glue code, cutting the modifications in the
remoteproc_virtio driver by 95%. I'll let you knwow.
Thank you for the hint!
Regards,
Francesco
next prev parent reply other threads:[~2026-09-25 19:06 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 21:10 [PATCH RFC 00/12] remoteproc: add support for any virtio device Francesco Valla
2026-09-16 21:10 ` [PATCH RFC 01/12] remoteproc: virtio: cleanup rproc_add_virtio_dev error path Francesco Valla
2026-09-16 21:10 ` [PATCH RFC 02/12] remoteproc: virtio: replace commas with semicolons Francesco Valla
2026-09-16 21:10 ` [PATCH RFC 03/12] remoteproc: virtio: support dynamic number of vrings Francesco Valla
2026-09-16 21:10 ` [PATCH RFC 04/12] dma-coherent: add base and size APIs Francesco Valla
2026-09-16 21:10 ` [PATCH RFC 05/12] remoteproc: always report VIRTIO_F_VERSION_1 feature Francesco Valla
2026-09-21 15:47 ` Mathieu Poirier
2026-09-22 6:32 ` Francesco Valla
2026-09-22 15:10 ` Mathieu Poirier
2026-09-16 21:10 ` [PATCH RFC 06/12] remoteproc: virtio: add bounce buffering for data buffers Francesco Valla
2026-09-22 15:58 ` Mathieu Poirier
2026-09-22 19:39 ` Francesco Valla
2026-09-23 14:44 ` Mathieu Poirier
2026-09-23 16:05 ` Francesco Valla
2026-09-25 15:07 ` Mathieu Poirier
2026-09-25 16:48 ` Robin Murphy
2026-09-25 19:05 ` Francesco Valla [this message]
2026-09-25 17:03 ` Robin Murphy
2026-09-16 21:10 ` [PATCH RFC 07/12] dt-bindings: spi: add bindings for spi-virtio Francesco Valla
2026-09-16 21:10 ` [PATCH RFC 08/12] dt-bindings: remoteproc: add remoteproc-virtio Francesco Valla
2026-09-22 15:40 ` Mathieu Poirier
2026-09-22 19:44 ` Francesco Valla
2026-09-23 14:56 ` Mathieu Poirier
2026-09-16 21:10 ` [PATCH RFC 09/12] remoteproc: search for a fwnode during vdev registration Francesco Valla
2026-09-16 21:10 ` [PATCH RFC 10/12] remoteproc: imx_rproc: always use non-blocking mailboxes Francesco Valla
2026-09-16 21:10 ` [PATCH RFC 11/12] dt-bindings: remoteproc: imx-rproc: support virtio Francesco Valla
2026-09-16 21:10 ` [PATCH RFC 12/12] PoC: arm64: dts: imx93-11x11-frdm: add multiple vdevs Francesco Valla
2026-09-22 15:43 ` Mathieu Poirier
2026-09-22 20:19 ` Francesco Valla
2026-09-23 15:48 ` Mathieu Poirier
2026-09-23 18:42 ` Francesco Valla
2026-09-24 15:49 ` Mathieu Poirier
2026-09-25 19:13 ` Francesco Valla
2026-09-25 8:39 ` Alexander Stein
2026-09-25 19:26 ` Francesco Valla
2026-09-18 16:53 ` [PATCH RFC 00/12] remoteproc: add support for any virtio device Mathieu Poirier
2026-09-19 7:33 ` Francesco Valla
2026-09-21 3:31 ` Mathieu Poirier
2026-09-22 6:28 ` Francesco Valla
2026-09-22 13:53 ` Mathieu Poirier
2026-09-23 15:13 ` Robin Murphy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=arbEmz1jy0V7gjrU@bywater \
--to=francesco@valla.it \
--cc=Frank.Li@nxp.com \
--cc=andersson@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gustavoars@kernel.org \
--cc=imx@lists.linux.dev \
--cc=iommu@lists.linux.dev \
--cc=kees@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mathieu.poirier@linaro.org \
--cc=peng.fan@nxp.com \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=s.hauer@pengutronix.de \
--cc=virtualization@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®