iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: iommu@lists.linux-foundation.org,
	virtualization@lists.linux-foundation.org,
	virtio-dev@lists.oasis-open.org, linux-pci@vger.kernel.org
Cc: Jean-Philippe Brucker <jean-philippe@linaro.org>,
	kevin.tian@intel.com, mst@redhat.com, sebastien.boeuf@intel.com,
	bhelgaas@google.com, jasowang@redhat.com
Subject: [PATCH v3 4/6] iommu/virtio: Add topology definitions
Date: Fri, 21 Aug 2020 15:15:38 +0200	[thread overview]
Message-ID: <20200821131540.2801801-5-jean-philippe@linaro.org> (raw)
In-Reply-To: <20200821131540.2801801-1-jean-philippe@linaro.org>

Add struct definitions for describing endpoints managed by the
virtio-iommu. When VIRTIO_IOMMU_F_TOPOLOGY is offered, an array of
virtio_iommu_topo_* structures in config space describes the endpoints,
identified either by their PCI BDF or their physical MMIO address.

Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
 include/uapi/linux/virtio_iommu.h | 44 +++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/include/uapi/linux/virtio_iommu.h b/include/uapi/linux/virtio_iommu.h
index 237e36a280cb..70cba30644d5 100644
--- a/include/uapi/linux/virtio_iommu.h
+++ b/include/uapi/linux/virtio_iommu.h
@@ -16,6 +16,7 @@
 #define VIRTIO_IOMMU_F_BYPASS			3
 #define VIRTIO_IOMMU_F_PROBE			4
 #define VIRTIO_IOMMU_F_MMIO			5
+#define VIRTIO_IOMMU_F_TOPOLOGY			6
 
 struct virtio_iommu_range_64 {
 	__le64					start;
@@ -27,6 +28,17 @@ struct virtio_iommu_range_32 {
 	__le32					end;
 };
 
+struct virtio_iommu_topo_config {
+	/* Number of topology description structures */
+	__le16					count;
+	/*
+	 * Offset to the first topology description structure
+	 * (virtio_iommu_topo_*) from the start of the virtio_iommu config
+	 * space. Aligned on 8 bytes.
+	 */
+	__le16					offset;
+};
+
 struct virtio_iommu_config {
 	/* Supported page sizes */
 	__le64					page_size_mask;
@@ -36,6 +48,38 @@ struct virtio_iommu_config {
 	struct virtio_iommu_range_32		domain_range;
 	/* Probe buffer size */
 	__le32					probe_size;
+	struct virtio_iommu_topo_config		topo_config;
+};
+
+#define VIRTIO_IOMMU_TOPO_PCI_RANGE		0x1
+#define VIRTIO_IOMMU_TOPO_MMIO			0x2
+
+struct virtio_iommu_topo_pci_range {
+	/* VIRTIO_IOMMU_TOPO_PCI_RANGE */
+	__u8					type;
+	__u8					reserved;
+	/* Length of this structure */
+	__le16					length;
+	/* First endpoint ID in the range */
+	__le32					endpoint_start;
+	/* PCI domain number */
+	__le16					segment;
+	/* PCI Bus:Device.Function range */
+	__le16					bdf_start;
+	__le16					bdf_end;
+	__le16					padding;
+};
+
+struct virtio_iommu_topo_mmio {
+	/* VIRTIO_IOMMU_TOPO_MMIO */
+	__u8					type;
+	__u8					reserved;
+	/* Length of this structure */
+	__le16					length;
+	/* Endpoint ID */
+	__le32					endpoint;
+	/* Address of the first MMIO region */
+	__le64					address;
 };
 
 /* Request types */
-- 
2.28.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  parent reply	other threads:[~2020-08-21 13:16 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 13:15 [PATCH v3 0/6] Add virtio-iommu built-in topology Jean-Philippe Brucker
2020-08-21 13:15 ` [PATCH v3 1/6] iommu/virtio: Move to drivers/iommu/virtio/ Jean-Philippe Brucker
2020-09-04 15:29   ` Auger Eric
2020-08-21 13:15 ` [PATCH v3 2/6] iommu/virtio: Add topology helpers Jean-Philippe Brucker
2020-09-04 16:22   ` Auger Eric
2020-09-24  8:31     ` Jean-Philippe Brucker
2020-08-21 13:15 ` [PATCH v3 3/6] PCI: Add DMA configuration for virtual platforms Jean-Philippe Brucker
2020-08-21 13:15 ` Jean-Philippe Brucker [this message]
2020-09-04 15:30   ` [PATCH v3 4/6] iommu/virtio: Add topology definitions Auger Eric
2020-08-21 13:15 ` [PATCH v3 5/6] iommu/virtio: Support topology description in config space Jean-Philippe Brucker
2020-09-04 16:05   ` Auger Eric
2020-09-24  8:33     ` Jean-Philippe Brucker
2020-09-24 15:22   ` Bjorn Helgaas
2020-09-25  8:12     ` Jean-Philippe Brucker
2020-09-25 15:34       ` Bjorn Helgaas
2020-08-21 13:15 ` [PATCH v3 6/6] iommu/virtio: Enable x86 support Jean-Philippe Brucker
2020-08-26 13:26 ` [PATCH v3 0/6] Add virtio-iommu built-in topology Michael S. Tsirkin
2020-08-27  8:01   ` Jean-Philippe Brucker
2020-09-04 16:24 ` Auger Eric
2020-09-24  9:00   ` Michael S. Tsirkin
2020-09-24  9:21     ` Joerg Roedel
2020-09-24  9:38       ` Michael S. Tsirkin
2020-09-24  9:54         ` Auger Eric
2020-09-29 17:28           ` Al Stone
2020-10-02 18:23           ` Al Stone
2020-10-06 15:23             ` Auger Eric
2020-11-03 20:09               ` Al Stone
2020-11-04  9:33                 ` Jean-Philippe Brucker
2020-11-04 20:56                   ` Al Stone
2020-09-24 10:02         ` Joerg Roedel
2020-09-24 10:24           ` Gerd Hoffmann
2020-09-24 10:29           ` Jean-Philippe Brucker
2020-09-24 11:50             ` Joerg Roedel
2020-09-24 12:41           ` Michael S. Tsirkin
2020-09-24 12:50             ` Joerg Roedel
2020-09-25 10:22               ` Michael S. Tsirkin
2020-09-25  8:48 ` Jean-Philippe Brucker
2020-09-25 10:22   ` Michael S. Tsirkin
2020-09-25 11:26     ` Jean-Philippe Brucker
2020-09-25 13:44       ` Michael S. Tsirkin
2020-09-25 14:14         ` [virtio-dev] " Gerd Hoffmann

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=20200821131540.2801801-5-jean-philippe@linaro.org \
    --to=jean-philippe@linaro.org \
    --cc=bhelgaas@google.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jasowang@redhat.com \
    --cc=kevin.tian@intel.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=sebastien.boeuf@intel.com \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtualization@lists.linux-foundation.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;
as well as URLs for NNTP newsgroup(s).