From: Francesco Valla <francesco@valla.it>
To: Bjorn Andersson <andersson@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Kees Cook <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Francesco Valla <francesco@valla.it>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
Frank Li <Frank.Li@nxp.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>, Peng Fan <peng.fan@nxp.com>
Cc: Robin Murphy <robin.murphy@arm.com>,
linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC v2 05/11] remoteproc: virtio: report VIRTIO_F_ACCESS_PLATFORM when required
Date: Mon, 02 Nov 2026 00:26:42 +0100 [thread overview]
Message-ID: <20261102-remoteproc_virtio_map-v2-5-26b300e01c62@valla.it> (raw)
In-Reply-To: <20261102-remoteproc_virtio_map-v2-0-26b300e01c62@valla.it>
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.
Existing use cases (e.g., rpmsg and virtio-console) are not impacted as
they are explicitly excluded.
Signed-off-by: Francesco Valla <francesco@valla.it>
---
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
next prev parent reply other threads:[~2026-11-01 23:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 23:26 [PATCH RFC v2 00/11] remoteproc: add support for any virtio device Francesco Valla
2026-11-01 23:26 ` [PATCH RFC v2 01/11] remoteproc: virtio: cleanup rproc_add_virtio_dev error path Francesco Valla
2026-11-01 23:26 ` [PATCH RFC v2 02/11] remoteproc: virtio: replace commas with semicolons Francesco Valla
2026-11-01 23:26 ` [PATCH RFC v2 03/11] remoteproc: virtio: support dynamic number of vrings Francesco Valla
2026-11-01 23:26 ` [PATCH RFC v2 04/11] remoteproc: report VIRTIO_F_VERSION_1 for non-rproc-specific vdevs Francesco Valla
2026-11-01 23:26 ` Francesco Valla [this message]
2026-11-01 23:26 ` [PATCH RFC v2 06/11] dt-bindings: remoteproc: add remoteproc-virtio Francesco Valla
2026-11-01 23:26 ` [PATCH RFC v2 07/11] remoteproc: assign fwnode during vdev registration Francesco Valla
2026-11-01 23:26 ` [PATCH RFC v2 08/11] Documentation: remoteproc: expand virtio support section Francesco Valla
2026-11-03 14:15 ` Daniel Pereira
2026-11-06 21:29 ` Francesco Valla
2026-11-01 23:26 ` [PATCH RFC v2 09/11] remoteproc: imx_rproc: always use non-blocking mailboxes Francesco Valla
2026-11-01 23:26 ` [PATCH RFC v2 10/11] dt-bindings: remoteproc: imx-rproc: support virtio Francesco Valla
2026-11-01 23:26 ` [PATCH RFC v2 11/11] PoC: arm64: dts: imx93-11x11-frdm: add multiple vdevs Francesco Valla
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=20261102-remoteproc_virtio_map-v2-5-26b300e01c62@valla.it \
--to=francesco@valla.it \
--cc=Frank.Li@nxp.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=gustavoars@kernel.org \
--cc=imx@lists.linux.dev \
--cc=kees@kernel.org \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=peng.fan@nxp.com \
--cc=rdunlap@infradead.org \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=s.hauer@pengutronix.de \
--cc=skhan@linuxfoundation.org \
/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®