All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
To: iommu@lists.linux-foundation.org,
	virtualization@lists.linux-foundation.org,
	devicetree@vger.kernel.org
Cc: mark.rutland@arm.com, peter.maydell@linaro.org,
	lorenzo.pieralisi@arm.com, tnowicki@caviumnetworks.com,
	mst@redhat.com, marc.zyngier@arm.com, linux-pci@vger.kernel.org,
	will.deacon@arm.com, kvmarm@lists.cs.columbia.edu,
	eric.auger@redhat.com, robh+dt@kernel.org, robin.murphy@arm.com,
	joro@8bytes.org
Subject: [PATCH v3 2/7] dt-bindings: virtio: Add virtio-pci-iommu node
Date: Fri, 12 Oct 2018 15:59:12 +0100	[thread overview]
Message-ID: <20181012145917.6840-3-jean-philippe.brucker__44849.8156657026$1539356377$gmane$org@arm.com> (raw)
In-Reply-To: <20181012145917.6840-1-jean-philippe.brucker@arm.com>

Some systems implement virtio-iommu as a PCI endpoint. The operating
systems needs to discover the relationship between IOMMU and masters long
before the PCI endpoint gets probed. Add a PCI child node to describe the
virtio-iommu device.

The virtio-pci-iommu is conceptually split between a PCI programming
interface and a translation component on the parent bus. The latter
doesn't have a node in the device tree. The virtio-pci-iommu node
describes both, by linking the PCI endpoint to "iommus" property of DMA
master nodes and to "iommu-map" properties of bus nodes.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
---
 .../devicetree/bindings/virtio/iommu.txt      | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/virtio/iommu.txt

diff --git a/Documentation/devicetree/bindings/virtio/iommu.txt b/Documentation/devicetree/bindings/virtio/iommu.txt
new file mode 100644
index 000000000000..2407fea0651c
--- /dev/null
+++ b/Documentation/devicetree/bindings/virtio/iommu.txt
@@ -0,0 +1,66 @@
+* virtio IOMMU PCI device
+
+When virtio-iommu uses the PCI transport, its programming interface is
+discovered dynamically by the PCI probing infrastructure. However the
+device tree statically describes the relation between IOMMU and DMA
+masters. Therefore, the PCI root complex that hosts the virtio-iommu
+contains a child node representing the IOMMU device explicitly.
+
+Required properties:
+
+- compatible:	Should be "virtio,pci-iommu"
+- reg:		PCI address of the IOMMU. As defined in the PCI Bus
+		Binding reference [1], the reg property is a five-cell
+		address encoded as (phys.hi phys.mid phys.lo size.hi
+		size.lo). phys.hi should contain the device's BDF as
+		0b00000000 bbbbbbbb dddddfff 00000000. The other cells
+		should be zero.
+- #iommu-cells:	Each platform DMA master managed by the IOMMU is assigned
+		an endpoint ID, described by the "iommus" property [2].
+		For virtio-iommu, #iommu-cells must be 1.
+
+Notes:
+
+- DMA from the IOMMU device isn't managed by another IOMMU. Therefore the
+  virtio-iommu node doesn't have an "iommus" property, and is omitted from
+  the iommu-map property of the root complex.
+
+Example:
+
+pcie@10000000 {
+	compatible = "pci-host-ecam-generic";
+	...
+
+	/* The IOMMU programming interface uses slot 00:01.0 */
+	iommu0: iommu@0008 {
+		compatible = "virtio,pci-iommu";
+		reg = <0x00000800 0 0 0 0>;
+		#iommu-cells = <1>;
+	};
+
+	/*
+	 * The IOMMU manages all functions in this PCI domain except
+	 * itself. Omit BDF 00:01.0.
+	 */
+	iommu-map = <0x0 &iommu0 0x0 0x8>
+		    <0x9 &iommu0 0x9 0xfff7>;
+};
+
+pcie@20000000 {
+	compatible = "pci-host-ecam-generic";
+	...
+	/*
+	 * The IOMMU also manages all functions from this domain,
+	 * with endpoint IDs 0x10000 - 0x1ffff
+	 */
+	iommu-map = <0x0 &iommu0 0x10000 0x10000>;
+};
+
+ethernet@fe001000 {
+	...
+	/* The IOMMU manages this platform device with endpoint ID 0x20000 */
+	iommus = <&iommu0 0x20000>;
+};
+
+[1] Documentation/devicetree/bindings/pci/pci.txt
+[2] Documentation/devicetree/bindings/iommu/iommu.txt
-- 
2.19.1

  parent reply	other threads:[~2018-10-12 14:59 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-12 14:59 [PATCH v3 0/7] Add virtio-iommu driver Jean-Philippe Brucker
2018-10-12 14:59 ` Jean-Philippe Brucker
2018-10-12 14:59 ` [PATCH v3 1/7] dt-bindings: virtio-mmio: Add IOMMU description Jean-Philippe Brucker
2018-10-12 14:59 ` Jean-Philippe Brucker
2018-10-12 14:59   ` Jean-Philippe Brucker
2018-10-18  0:30   ` Rob Herring
     [not found]   ` <20181012145917.6840-2-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2018-10-18  0:30     ` Rob Herring
2018-10-18  0:30       ` Rob Herring
2018-11-15  8:45   ` Auger Eric
2018-11-15  8:45     ` Auger Eric
2018-10-12 14:59 ` Jean-Philippe Brucker [this message]
2018-10-12 14:59 ` [PATCH v3 2/7] dt-bindings: virtio: Add virtio-pci-iommu node Jean-Philippe Brucker
2018-10-12 14:59   ` Jean-Philippe Brucker
2018-10-18  0:35   ` Rob Herring
2018-10-18  0:35     ` Rob Herring
2018-10-18  0:35   ` Rob Herring
2018-11-15  8:45   ` Auger Eric
2018-11-15  8:45   ` Auger Eric
2018-11-15  8:45     ` Auger Eric
2018-10-12 14:59 ` [PATCH v3 3/7] PCI: OF: Allow endpoints to bypass the iommu Jean-Philippe Brucker
2018-10-12 14:59 ` Jean-Philippe Brucker
2018-10-12 14:59   ` Jean-Philippe Brucker
     [not found]   ` <20181012145917.6840-4-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2018-10-12 19:41     ` Bjorn Helgaas
2018-10-12 19:41       ` Bjorn Helgaas
2018-10-15 10:52       ` Michael S. Tsirkin
2018-10-15 11:32       ` Robin Murphy
     [not found]       ` <20181012194158.GX5906-1RhO1Y9PlrlHTL0Zs8A6p5iNqAH0jzoTYJqu5kTmcBRl57MIdRCFDg@public.gmane.org>
2018-10-15 10:52         ` Michael S. Tsirkin
2018-10-15 10:52           ` Michael S. Tsirkin
     [not found]           ` <20181015065024-mutt-send-email-mst-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-10-15 19:46             ` Jean-philippe Brucker
2018-10-15 19:46               ` Jean-philippe Brucker
2018-10-17 15:14               ` Michael S. Tsirkin
2018-10-17 15:14                 ` Michael S. Tsirkin
2018-10-18 10:47                 ` Robin Murphy
2018-10-18 10:47                 ` Robin Murphy
2018-10-18 10:47                   ` Robin Murphy
     [not found]                 ` <20181017111100-mutt-send-email-mst-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-10-22 11:27                   ` Jean-Philippe Brucker
2018-10-22 11:27                     ` Jean-Philippe Brucker
2018-10-22 11:27                 ` Jean-Philippe Brucker
2018-10-15 11:32         ` Robin Murphy
2018-10-15 11:32           ` Robin Murphy
2018-10-15 19:45         ` Jean-philippe Brucker
2018-10-15 19:45           ` Jean-philippe Brucker
2018-10-12 14:59 ` [PATCH v3 4/7] PCI: OF: Initialize dev->fwnode appropriately Jean-Philippe Brucker
2018-10-12 14:59   ` Jean-Philippe Brucker
     [not found]   ` <20181012145917.6840-5-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2018-10-12 19:44     ` Bjorn Helgaas
2018-10-12 19:44       ` Bjorn Helgaas
2018-10-12 14:59 ` Jean-Philippe Brucker
2018-10-12 14:59 ` [PATCH v3 5/7] iommu: Add virtio-iommu driver Jean-Philippe Brucker
2018-10-12 14:59   ` Jean-Philippe Brucker
2018-10-12 16:35   ` Michael S. Tsirkin
2018-10-12 16:35   ` Michael S. Tsirkin
2018-10-12 16:35     ` Michael S. Tsirkin
     [not found]     ` <20181012120953-mutt-send-email-mst-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-10-12 18:54       ` Jean-Philippe Brucker
2018-10-12 18:54         ` Jean-Philippe Brucker
2018-10-12 18:54     ` Jean-Philippe Brucker
2018-11-08 14:51     ` Auger Eric
2018-11-08 14:51       ` Auger Eric
2018-11-08 16:46       ` Jean-Philippe Brucker
2018-11-08 16:46         ` Jean-Philippe Brucker
2018-11-08 16:46       ` Jean-Philippe Brucker
2018-11-08 14:51     ` Auger Eric
2018-10-12 14:59 ` Jean-Philippe Brucker
2018-10-12 14:59 ` [PATCH v3 6/7] iommu/virtio: Add probe request Jean-Philippe Brucker
2018-10-12 14:59   ` Jean-Philippe Brucker
2018-10-12 16:42   ` Michael S. Tsirkin
2018-10-12 16:42     ` Michael S. Tsirkin
2018-11-08 14:48   ` Auger Eric
     [not found]   ` <20181012145917.6840-7-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2018-11-08 14:48     ` Auger Eric
2018-11-08 14:48       ` Auger Eric
     [not found]       ` <295d30bb-5aef-2727-01c0-ec10c7a8fa8c-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-11-08 16:46         ` Jean-Philippe Brucker
2018-11-08 16:46           ` Jean-Philippe Brucker
2018-11-08 16:46       ` Jean-Philippe Brucker
2018-11-15 13:20     ` Auger Eric
2018-11-15 13:20       ` Auger Eric
2018-11-15 16:22       ` Jean-Philippe Brucker
2018-11-15 16:22         ` Jean-Philippe Brucker
2018-11-15 16:22       ` Jean-Philippe Brucker
2018-11-15 13:20   ` Auger Eric
2018-10-12 14:59 ` Jean-Philippe Brucker
2018-10-12 14:59 ` [PATCH v3 7/7] iommu/virtio: Add event queue Jean-Philippe Brucker
2018-10-12 14:59 ` Jean-Philippe Brucker
2018-10-12 14:59   ` Jean-Philippe Brucker
2018-10-12 17:00 ` [PATCH v3 0/7] Add virtio-iommu driver Michael S. Tsirkin
     [not found] ` <20181012145917.6840-1-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2018-10-12 17:00   ` Michael S. Tsirkin
2018-10-12 17:00     ` Michael S. Tsirkin
2018-10-12 18:55     ` Jean-Philippe Brucker
     [not found]     ` <20181012125443-mutt-send-email-mst-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-10-12 18:55       ` Jean-Philippe Brucker
2018-10-12 18:55         ` Jean-Philippe Brucker
2018-10-16  9:25   ` Auger Eric
2018-10-16  9:25     ` Auger Eric
2018-10-16 18:44     ` Jean-Philippe Brucker
2018-10-16 18:44       ` Jean-Philippe Brucker
2018-10-16 20:31       ` Auger Eric
2018-10-16 20:31         ` Auger Eric
2018-10-17 11:54         ` Jean-Philippe Brucker
2018-10-17 11:54           ` Jean-Philippe Brucker
2018-10-17 15:23           ` Michael S. Tsirkin
2018-10-17 15:23             ` Michael S. Tsirkin
2018-10-17 15:23           ` Michael S. Tsirkin
2018-10-16 18:44     ` Jean-Philippe Brucker
2018-10-16  9:25 ` Auger Eric

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='20181012145917.6840-3-jean-philippe.brucker__44849.8156657026$1539356377$gmane$org@arm.com' \
    --to=jean-philippe.brucker@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=eric.auger@redhat.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=tnowicki@caviumnetworks.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=will.deacon@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.