From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5E36606A33E for ; Wed, 18 Nov 2026 15:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=MoaDr+Wn; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Nj7KoNrv DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=CN3uhxZTJ97ugRoC/mFf/rnGzVK4gaQ4Bs/xHJQaLBY=; b=MoaDr+WnuJ1g1uSTh2a5NP1EQW FHmk3o7kxxYx4RzhXCiKQZ/sobi+IMZsEiUUDI/vvZ7z9rE91zFdce6RpTc+qnrNerfEW3UOhBn4K uWO9Qmm+G/2PFaHEI3cQO6kQ5EQSZ2XIQSkVSzGfJwx1ANZCvSEu7kF+8S9+L6d43nOvyYbbCmZDa 8VKPIzRHNXCVDSRV90IngQynFM5KSLtO5WYIwqsv5AMc/P+LqXo519jywl1DD60IEVWfZyS53Kgz+ P9DG1AUYsQdrdHboUNDyzhS0VBQGgsceDgs9v5kQTvA7k0v95vXpWAwx8Fa4rhn60ZxZeQ2cDB5dh VchaRiZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xThnj-00000009Lga-02LF; Wed, 18 Nov 2026 15:42:23 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xThnf-00000009LgE-0yd6 for linux-arm-kernel@lists.infradead.org; Wed, 18 Nov 2026 15:42:22 +0000 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-cdd9d0c9bbdso774527a12.1 for ; Wed, 18 Nov 2026 07:42:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1795016538; x=1795621338; darn=lists.infradead.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=CN3uhxZTJ97ugRoC/mFf/rnGzVK4gaQ4Bs/xHJQaLBY=; b=Nj7KoNrvU2hGqOWydLPkj0tPf+tfgxUjm7mP3D9dGbBhCo0t0XZQxffeCMxgFbDkfp iUvV+t9NBvG768FtlYDjp8iR9ARUibSiyEd25rBpVHxpIgJoB7Km99WuULsy2e+UGm0Q sH53V+zV3RQ6vD1F/mVs8cDLkeqAjRaf0uM7+xKeVCPN7BqE41IskpLo5ea4dCux2k1v FAx4BWC9Yju93rjrD9ODMandcBlPnCO3nb2ZI3ZpKhShBlN0BGxsEwKMUOo4EXFzuwlq hCZsvHEqPDhixbEi0wRWpZd+HD2+RNmXsOAZUM/at8duKIb2D3sm/me3lOFbu7MgNFnN 8stg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795016538; x=1795621338; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=CN3uhxZTJ97ugRoC/mFf/r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pPqfj8Ppp BI75rXACntUBIW7Q64Mh+wvvw13UqhBZwgwTq9SRhqHDdhiCnPVruhFC043gdfvYoirD1qTPzcS SlJ/kbI6cW8mlpxaBjd/t6m9cv/06YZ0cCBMAcylEW85bsVvnyT/LGspaYli5ZZJHXn73igT6zW P21ZiK3XVrZEx6S51Rc+1DgbMIbOoVyk6A== X-Received: by 2002:a17:902:d2cf:b0:2ef:e06c:38d2 with SMTP id d9443c01a7336-2eff756587bmr30526375ad.54.1795016538193; Wed, 18 Nov 2026 07:42:18 -0800 (PST) Received: from p14s ([2604:3d09:148c:c800:9f37:bd39:7f19:3b3c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2eff6246213sm16061995ad.56.2026.11.18.07.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 07:42:17 -0800 (PST) Date: Wed, 18 Nov 2026 09:42:14 -0600 From: Mathieu Poirier To: Francesco Valla Cc: Bjorn Andersson , Kees Cook , "Gustavo A. R. Silva" , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Shuah Khan , Randy Dunlap , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Peng Fan , Robin Murphy , 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: Re: [PATCH RFC v2 05/11] remoteproc: virtio: report VIRTIO_F_ACCESS_PLATFORM when required Message-ID: References: <20261102-remoteproc_virtio_map-v2-0-26b300e01c62@valla.it> <20261102-remoteproc_virtio_map-v2-5-26b300e01c62@valla.it> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261118_074219_292780_FD348D01 X-CRM114-Status: GOOD ( 46.30 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 > > > --- > > > 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 >