From nobody Tue May  6 22:02:44 2025
Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BDE52343C7;
	Wed,  2 Apr 2025 11:24:23 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
 arc=none smtp.client-ip=90.155.92.199
ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1743593066; cv=none;
 b=IgzTiAaBDo59O0BIYJ8Iemb6rk/JFLHZymilmDb+3T/apXmWHeiXeQ11HDhtpnxJzLBgGImPmyZKZPlNNt5Sqn6zj4ePoGuZo0pLHSI3qrHQfvccIo9DwH38BkDY/QOG+D8HHdjSw6jMCh0EwzH8xij3+G6Yk0ud3J9yHwCsXJk=
ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1743593066; c=relaxed/simple;
	bh=gWsC5lSSpCl3AFsLNF0y3hh4t8zumhmtHvAcZjPfZpI=;
	h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version;
 b=D0a+eKF8InMNVCMyVxiTQXUbT49E1bHdOS+QMSRhWVYv9zvSPTYE4CteKhgjyjZv/YKZ9jMMj1ILvT5hJEhbbQfDojLoIf9evwcNmODfaDG7jwjOLxsf8GgxOQAKBX0U6Pc730NnSlyoDv3aKs6ETclSuSqmWjwcFoIapF9bnrI=
ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
 dmarc=none (p=none dis=none) header.from=infradead.org;
 spf=none smtp.mailfrom=desiato.srs.infradead.org;
 dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org
 header.b=pwQLI+sZ; arc=none smtp.client-ip=90.155.92.199
Authentication-Results: smtp.subspace.kernel.org;
 dmarc=none (p=none dis=none) header.from=infradead.org
Authentication-Results: smtp.subspace.kernel.org;
 spf=none smtp.mailfrom=desiato.srs.infradead.org
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org
 header.b="pwQLI+sZ"
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding:
	MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:
	Reply-To:Content-Type:Content-ID:Content-Description;
	bh=dR5yqBxOY1y00T3cS+kzt6VXjNRVa+xGn9VwL1PqD0Q=; b=pwQLI+sZCyUVReTVywnobEOMiR
	7dqbFuGbqlV+D3xbpRsxE9ETZgtnjuhfSfZbtWT3sYJllAJE8Mty9cvP+P9UndVttjm0FPP6rNQBo
	r0TtClFvUKk6y3TFUkK77eFW6dw+iQMRzAsGbnbuphEN5M0XXtW1q4M7U8vh7xhYmYav4IVJxn9sq
	0xgy/WmZ9a5kitUplKZkuw/qLIGyK9aLQcul5Ig4w/dtsAyhvN7wHn4oxDGdp62AkqIsvZAZeNUgH
	hL8jU2mQELeFSLaIz7o4Z9dMvCHxaMu9bv/ezmjIbedfL41XnoVleDtlOCLpMK9db/UN3N1MwlG40
	MOPvwpCA==;
Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org)
	by desiato.infradead.org with esmtpsa (Exim 4.98.1 #2 (Red Hat Linux))
	id 1tzwCb-000000070eM-2dhn;
	Wed, 02 Apr 2025 11:24:13 +0000
Received: from dwoodhou by i7.infradead.org with local (Exim 4.98.1 #2 (Red
 Hat Linux))
	id 1tzwCa-00000008sIH-1UIn;
	Wed, 02 Apr 2025 12:24:12 +0100
From: David Woodhouse <dwmw2@infradead.org>
To: virtio-comment@lists.linux.dev
Cc: mst@redhat.com,
	hch@infradead.org,
	Claire Chang <tientzu@chromium.org>,
	linux-devicetree <devicetree@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	=?UTF-8?q?J=C3=B6rg=20Roedel?= <joro@8bytes.org>,
	iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org,
	graf@amazon.de
Subject: [RFC PATCH 1/3] content: Add VIRTIO_F_SWIOTLB to negotiate use of
 SWIOTLB bounce buffers
Date: Wed,  2 Apr 2025 12:04:45 +0100
Message-ID: <20250402112410.2086892-2-dwmw2@infradead.org>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250402112410.2086892-1-dwmw2@infradead.org>
References: <20250402112410.2086892-1-dwmw2@infradead.org>
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Sender: David Woodhouse <dwmw2@infradead.org>
X-SRS-Rewrite: SMTP reverse-path rewritten from <dwmw2@infradead.org> by
 desiato.infradead.org. See http://www.infradead.org/rpr.html
Content-Type: text/plain; charset="utf-8"

From: David Woodhouse <dwmw@amazon.co.uk>

Device-tree bindings for `restricted-dma-pool` were defined in 2021, which
allow devices to be restricted to a given SWIOTLB pool instead of allowing
DMA to arbitrary system memory:
https://lore.kernel.org/all/20210624155526.2775863-1-tientzu@chromium.org/

This facility was not specific to virtio-mmio, but does apply to it. No
attempt was made to ensure backward-compatibility for virtio-mmio devices.

Define a VIRTIO_F_SWIOTLB feature which allows the device and driver to
agree on the use of the SWIOTLB, if present. This enables the device to
refuse to operate further if the driver does not support the SWIOTLB
requirement expressed in the device-tree.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 content.tex | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/content.tex b/content.tex
index c17ffa6..63d075f 100644
--- a/content.tex
+++ b/content.tex
@@ -773,6 +773,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feat=
ure Bits}
 Currently these device-independent feature bits are defined:
=20
 \begin{description}
+  \item[VIRTIO_F_SWIOTLB (27)] This feature indicates that the device
+  transport provides a memory region which is to be used for bounce
+  buffering, rather than permitting direct memory access to system memory.
   \item[VIRTIO_F_INDIRECT_DESC (28)] Negotiating this feature indicates
   that the driver can use descriptors with the VIRTQ_DESC_F_INDIRECT
   flag set, as described in \ref{sec:Basic Facilities of a Virtio
@@ -807,6 +810,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feat=
ure Bits}
   the driver. When clear, this overrides any platform-specific description=
 of
   whether device access is limited or translated in any way, e.g.
   whether an IOMMU may be present.
+  If a the device transport provides a software IOTLB bounce buffer,
+  addresses within its range are not subject to the requirements of
+  VIRTIO_F_ACCESS_PLATFORM as they are considered to be ``on-device''.
   \item[VIRTIO_F_RING_PACKED(34)] This feature indicates
   support for the packed virtqueue layout as described in
   \ref{sec:Basic Facilities of a Virtio Device / Packed Virtqueues}~\namer=
ef{sec:Basic Facilities of a Virtio Device / Packed Virtqueues}.
@@ -885,6 +891,10 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Fea=
ture Bits}
 VIRTIO_F_ACCESS_PLATFORM is not offered, then a driver MUST pass only phys=
ical
 addresses to the device.
=20
+A driver SHOULD accept VIRTIO_F_SWIOTLB if it is offered, and it MUST
+then pass only addresses within the Software IOTLB bounce buffer to the
+device.
+
 A driver SHOULD accept VIRTIO_F_RING_PACKED if it is offered.
=20
 A driver SHOULD accept VIRTIO_F_ORDER_PLATFORM if it is offered.
@@ -921,6 +931,8 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feat=
ure Bits}
 A device MAY fail to operate further if VIRTIO_F_ACCESS_PLATFORM is not
 accepted.
=20
+A device MAY fail to operate further if VIRTIO_F_SWIOTLB is not accepted.
+
 If VIRTIO_F_IN_ORDER has been negotiated, a device MUST use
 buffers in the same order in which they have been available.
=20
--=20
2.49.0
From nobody Tue May  6 22:02:44 2025
Received: from casper.infradead.org (casper.infradead.org [90.155.50.34])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8200230BF1;
	Wed,  2 Apr 2025 11:24:16 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
 arc=none smtp.client-ip=90.155.50.34
ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1743593066; cv=none;
 b=MN7jLS2dPMRtpK8cpJGjCtlG/4jPOLnOaHdXt8hlKeaEcUivMDWZoQexf7GvdmOeewq/wRIhXb5mF6zYJxMvAP9RhlWQb9kCZYOG8Q4HBn5K+9hIM3TgGwXjJovo646dPsGEhD7Tl3j+R/IHo6xZLJONI6pn2zlJDEs8kKH35mo=
ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1743593066; c=relaxed/simple;
	bh=jf5CojdeST3TNkM95k70JY0ej5/VdqX1yFYSmEvypE8=;
	h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version;
 b=fYBEhTh7ALE1ARP92xrhbnB1rAABedb4ynFjkKNsDgwynmJdFROFw9hv4I2hbvVTvgP/YHVMn3XoHU4b5mqwsbYK308WLDPeIYTfexEu7+2pqeCT/RnSfdw41oWsiwNKp1pODlVEVVOVJXjfXJ3uXX7dKbEnoEcIUSLYmXZCjQ0=
ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
 dmarc=none (p=none dis=none) header.from=infradead.org;
 spf=none smtp.mailfrom=casper.srs.infradead.org;
 dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org
 header.b=AM0lQWsI; arc=none smtp.client-ip=90.155.50.34
Authentication-Results: smtp.subspace.kernel.org;
 dmarc=none (p=none dis=none) header.from=infradead.org
Authentication-Results: smtp.subspace.kernel.org;
 spf=none smtp.mailfrom=casper.srs.infradead.org
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org
 header.b="AM0lQWsI"
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding:
	MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:
	Reply-To:Content-Type:Content-ID:Content-Description;
	bh=6OwXAlJh0Aw9RERuSqgygQLxxN6Qq/DyOWZqyQFFVAM=; b=AM0lQWsIGRtT5vjstSm1/NMqCA
	BZZxNJHJ4LsIfE4vxcnCBwC6JZzdmJhTWZI0xZ8SXbL5ya/god+ex/1JN4i0ZvKHMqeCKrKjPD0Im
	5EiLdf8pwjjQhoGkmaTV8oUee/wK9XpXk3VXyeY5MCLOgTy4f4ITK8yDWyrgpp+FTsBfOUmndTTMw
	wb7ToNO0+kjvgS8iJpE3HV/FFFzo7wgcxNFNH2tZC2atxAMtC4ac8AgelYArG9SOb6bp2SKeRYOHU
	UjHBhRecd76uyBxTkS5c/jq1R2dLYsGpZln9Ococ8OFyKDmqrSLGhygG9AMrIkJNW5ZALhZKvzuZs
	4DY6TVEg==;
Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org)
	by casper.infradead.org with esmtpsa (Exim 4.98.1 #2 (Red Hat Linux))
	id 1tzwCa-00000009Lex-3222;
	Wed, 02 Apr 2025 11:24:12 +0000
Received: from dwoodhou by i7.infradead.org with local (Exim 4.98.1 #2 (Red
 Hat Linux))
	id 1tzwCa-00000008sIO-1mCG;
	Wed, 02 Apr 2025 12:24:12 +0100
From: David Woodhouse <dwmw2@infradead.org>
To: virtio-comment@lists.linux.dev
Cc: mst@redhat.com,
	hch@infradead.org,
	Claire Chang <tientzu@chromium.org>,
	linux-devicetree <devicetree@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	=?UTF-8?q?J=C3=B6rg=20Roedel?= <joro@8bytes.org>,
	iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org,
	graf@amazon.de
Subject: [RFC PATCH 2/3] transport-mmio: Document restricted-dma-pool SWIOTLB
 bounce buffer
Date: Wed,  2 Apr 2025 12:04:46 +0100
Message-ID: <20250402112410.2086892-3-dwmw2@infradead.org>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250402112410.2086892-1-dwmw2@infradead.org>
References: <20250402112410.2086892-1-dwmw2@infradead.org>
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Sender: David Woodhouse <dwmw2@infradead.org>
X-SRS-Rewrite: SMTP reverse-path rewritten from <dwmw2@infradead.org> by
 casper.infradead.org. See http://www.infradead.org/rpr.html
Content-Type: text/plain; charset="utf-8"

From: David Woodhouse <dwmw@amazon.co.uk>

Add explicit reference to the `restricted-dma-pool` DT schema in the
virtio-mmio transport options, and define its relationship to the
newly-added VIRTIO_F_SWIOTLB feature negotiation.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 transport-mmio.tex | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/transport-mmio.tex b/transport-mmio.tex
index 94a93a1..300783c 100644
--- a/transport-mmio.tex
+++ b/transport-mmio.tex
@@ -26,6 +26,39 @@ \subsection{MMIO Device Discovery}\label{sec:Virtio Tran=
sport Options / Virtio O
 }
 \end{lstlisting}
=20
+\subsection{Software IOTLB Bounce Buffer}\label{sec:Virtio Transport Optio=
ns / Virtio Over MMIO / Software IOTLB Bounce Buffer}
+
+The device tree binding schema defines a ``restricted-dma-pool'' region
+which is intended to be used as a pool of restricted DMA buffers for
+specific devices. This allows devices to operate without DMA access to
+arbitrary system memory addresses.
+
+If a ``restricted-dma-pool'' is present, as in the example below, then
+bus addresses within the referenced range are not subject to the
+requirements of the VIRTIO_F_ORDER_PLATFORM capability, if negotiated.
+
+\begin{lstlisting}
+// EXAMPLE: virtio_block device with SWIOTLB bounce buffer at 0x50000000.
+restricted_dma_reserved: restricted-dma-pool@50000000 {
+        compatible =3D "restricted-dma-pool";
+        reg =3D <0x50000000 0x4000000>;
+};
+
+virtio_block@1e000 {
+        compatible =3D "virtio,mmio";
+        memory-region =3D <&restricted-dma-reserved>;
+        reg =3D <0x1e000 0x200>;
+        interrupts =3D <42>;
+};
+\end{lstlisting}
+
+\drivernormative{\subsubsection}{Software IOTLB Bounce Buffer}{Virtio Tran=
sport Options / Virtio Over MMIO / Software IOTLB Bounce Buffer}
+
+The driver SHOULD use the offered buffer in preference to passing system
+memory addresses to the device. If the driver accepts the VIRTIO_F_SWIOTLB
+feature, then the driver MUST use the offered buffer and never pass system
+memory addresses to the device.
+
 \subsection{MMIO Device Register Layout}\label{sec:Virtio Transport Option=
s / Virtio Over MMIO / MMIO Device Register Layout}
=20
 MMIO virtio devices provide a set of memory mapped control
--=20
2.49.0
From nobody Tue May  6 22:02:44 2025
Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BED12376F2;
	Wed,  2 Apr 2025 11:24:23 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
 arc=none smtp.client-ip=90.155.92.199
ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1743593065; cv=none;
 b=TuPYpJxIZsOs+U+wTT7SSoTYmHAa/kWj3Sld+44JaO1KTnotM31u8ZyzNYENRVV8buRSmzllA0ya3Ulg+uHF1PL2UT3wUK9ks/jBzfq3rnR5d3DcNZ2tq912tHZSHlO+UX77CPhhTv0a1ccELz2eALezyNc4CtVkahifF5SLaHM=
ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1743593065; c=relaxed/simple;
	bh=WSByO3ny/cr8sBI7EAUdzcVer0QodMHBvGSJaZ0OCMk=;
	h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version;
 b=cQRq4r+yVJFvJu+uAX6jlUHEYtsNcgSDPtRc6eA1AIP3QnMCLdr+F9OCjc5aEYMHCcfHZqnIGowG5k6C7zhGAAEkgQC7Qem1LokHzDTEaiwRwTlxIaX6REt2ZwfQY3W8z7WmYZW0z00pvwSj7C5p3Obtbi5NY8gnu2rNt5M1YEU=
ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
 dmarc=none (p=none dis=none) header.from=infradead.org;
 spf=none smtp.mailfrom=desiato.srs.infradead.org;
 dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org
 header.b=JcmpEGmG; arc=none smtp.client-ip=90.155.92.199
Authentication-Results: smtp.subspace.kernel.org;
 dmarc=none (p=none dis=none) header.from=infradead.org
Authentication-Results: smtp.subspace.kernel.org;
 spf=none smtp.mailfrom=desiato.srs.infradead.org
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org
 header.b="JcmpEGmG"
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding:
	MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:
	Reply-To:Content-Type:Content-ID:Content-Description;
	bh=kxrjLG1EvxP2WljkVi3c+txcSSC1Kui2MooC89w1RMI=; b=JcmpEGmGhheVjVIaBCuFCpTKTa
	G9Qc2MJXOnHZGDjcq2pqxf80FxTq1vckDKdhbXWk3UK+erTMP8GsqO+D2/4vEm9L/O/EoIoOQ2I04
	0J+aQtRVwWUXlru7FI36sGgjIWhckBvE/ajnIfQ13EfVxWncVlmx4ShGSfTXI7t6+QK8RU1PEiygb
	Eqz4OiAQqk7U/nRRmleygw5yM6f344Z9Axy5vD52o24lubce9r0oCWym49F+NXD+ucideRFDj6AlT
	QJyC0Kxo4pMpU/tP93fK/16NLmbxxMF4qHLwnlhelw1CcQyoc/hcsurxAMsE2YPthOs8rtN/RUQFH
	23SPrOhQ==;
Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org)
	by desiato.infradead.org with esmtpsa (Exim 4.98.1 #2 (Red Hat Linux))
	id 1tzwCb-000000070eN-2dkH;
	Wed, 02 Apr 2025 11:24:13 +0000
Received: from dwoodhou by i7.infradead.org with local (Exim 4.98.1 #2 (Red
 Hat Linux))
	id 1tzwCa-00000008sIT-23wY;
	Wed, 02 Apr 2025 12:24:12 +0100
From: David Woodhouse <dwmw2@infradead.org>
To: virtio-comment@lists.linux.dev
Cc: mst@redhat.com,
	hch@infradead.org,
	Claire Chang <tientzu@chromium.org>,
	linux-devicetree <devicetree@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	=?UTF-8?q?J=C3=B6rg=20Roedel?= <joro@8bytes.org>,
	iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org,
	graf@amazon.de
Subject: [RFC PATCH 3/3] transport-pci: Add SWIOTLB bounce buffer capability
Date: Wed,  2 Apr 2025 12:04:47 +0100
Message-ID: <20250402112410.2086892-4-dwmw2@infradead.org>
X-Mailer: git-send-email 2.49.0
In-Reply-To: <20250402112410.2086892-1-dwmw2@infradead.org>
References: <20250402112410.2086892-1-dwmw2@infradead.org>
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Sender: David Woodhouse <dwmw2@infradead.org>
X-SRS-Rewrite: SMTP reverse-path rewritten from <dwmw2@infradead.org> by
 desiato.infradead.org. See http://www.infradead.org/rpr.html
Content-Type: text/plain; charset="utf-8"

From: David Woodhouse <dwmw@amazon.co.uk>

Add a VIRTIO_PCI_CAP_SWIOTLB capability which advertises a SWIOTLB bounce
buffer similar to the existing `restricted-dma-pool` device-tree feature.

The difference is that this is per-device; each device needs to have its
own. Perhaps we should add a UUID to the capability, and have a way for
a device to not *provide* its own buffer, but just to reference the UUID
of a buffer elsewhere?

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 transport-pci.tex | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/transport-pci.tex b/transport-pci.tex
index a5c6719..23e0d57 100644
--- a/transport-pci.tex
+++ b/transport-pci.tex
@@ -129,6 +129,7 @@ \subsection{Virtio Structure PCI Capabilities}\label{se=
c:Virtio Transport Option
 \item ISR Status
 \item Device-specific configuration (optional)
 \item PCI configuration access
+\item SWIOTLB bounce buffer
 \end{itemize}
=20
 Each structure can be mapped by a Base Address register (BAR) belonging to
@@ -188,6 +189,8 @@ \subsection{Virtio Structure PCI Capabilities}\label{se=
c:Virtio Transport Option
 #define VIRTIO_PCI_CAP_SHARED_MEMORY_CFG 8
 /* Vendor-specific data */
 #define VIRTIO_PCI_CAP_VENDOR_CFG        9
+/* Software IOTLB bounce buffer */
+#define VIRTIO_PCI_CAP_SWIOTLB           10
 \end{lstlisting}
=20
         Any other value is reserved for future use.
@@ -744,6 +747,36 @@ \subsubsection{Vendor data capability}\label{sec:Virtio
 The driver MUST qualify the \field{vendor_id} before
 interpreting or writing into the Vendor data capability.
=20
+\subsubsection{Software IOTLB bounce buffer capability}\label{sec:Virtio
+Transport Options / Virtio Over PCI Bus / PCI Device Layout /
+Software IOTLB bounce buffer capability}
+
+The optional Software IOTLB bounce buffer capability allows the
+device to provide a memory region which can be used by the driver
+driver for bounce buffering. This allows a device on the PCI
+transport to operate without DMA access to system memory addresses.
+
+The Software IOTLB region is referenced by the
+VIRTIO_PCI_CAP_SWIOTLB capability. Bus addresses within the referenced
+range are not subject to the requirements of the VIRTIO_F_ORDER_PLATFORM
+capability, if negotiated.
+
+\devicenormative{\paragraph}{Software IOTLB bounce buffer capability}{Virt=
io
+Transport Options / Virtio Over PCI Bus / PCI Device Layout /
+Software IOTLB bounce buffer capability}
+
+Devices which present the Software IOTLB bounce buffer capability
+SHOULD also offer the VIRTIO_F_SWIOTLB feature.
+
+\drivernormative{\paragraph}{Software IOTLB bounce buffer capability}{Virt=
io
+Transport Options / Virtio Over PCI Bus / PCI Device Layout /
+Software IOTLB bounce buffer capability}
+
+The driver SHOULD use the offered buffer in preference to passing system
+memory addresses to the device. If the driver accepts the VIRTIO_F_SWIOTLB
+feature, then the driver MUST use the offered buffer and never pass system
+memory addresses to the device.
+
 \subsubsection{PCI configuration access capability}\label{sec:Virtio Trans=
port Options / Virtio Over PCI Bus / PCI Device Layout / PCI configuration =
access capability}
=20
 The VIRTIO_PCI_CAP_PCI_CFG capability
--=20
2.49.0