linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: linuxppc-dev@lists.ozlabs.org
Cc: kvm@vger.kernel.org, Alexey Kardashevskiy <aik@ozlabs.ru>,
	Alistair Popple <alistair@popple.id.au>,
	kvm-ppc@vger.kernel.org,
	Alex Williamson <alex.williamson@redhat.com>,
	Reza Arbab <arbab@linux.ibm.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH kernel 2/3] vfio_pci: Allow regions to add own capabilities
Date: Mon, 15 Oct 2018 20:42:32 +1100	[thread overview]
Message-ID: <20181015094233.1324-3-aik@ozlabs.ru> (raw)
In-Reply-To: <20181015094233.1324-1-aik@ozlabs.ru>

VFIO regions already support region capabilities with a limited set of
fields. However the subdriver might have to report to the userspace
additional bits.

This adds an add_capability() hook to vfio_pci_regops.

This is aiming Witherspoon POWER9 machines which have multiple
interconnected NVIDIA V100 GPUs with coherent RAM; each GPU's RAM
is mapped to a system bus and to each of GPU internal system bus and
the GPUs use this for DMA routing as DMA trafic can go via any
of many NVLink2 (GPU-GPU or GPU-CPU) or even stay local within a GPU.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---

This is based on top of "vfio_pci: Allow mapping extra regions"
---
 drivers/vfio/pci/vfio_pci_private.h | 3 +++
 drivers/vfio/pci/vfio_pci.c         | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h
index 86aab05..93c1738 100644
--- a/drivers/vfio/pci/vfio_pci_private.h
+++ b/drivers/vfio/pci/vfio_pci_private.h
@@ -62,6 +62,9 @@ struct vfio_pci_regops {
 	int	(*mmap)(struct vfio_pci_device *vdev,
 			struct vfio_pci_region *region,
 			struct vm_area_struct *vma);
+	int	(*add_capability)(struct vfio_pci_device *vdev,
+				  struct vfio_pci_region *region,
+				  struct vfio_info_cap *caps);
 };
 
 struct vfio_pci_region {
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index 7923314..4a3b93e 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -759,6 +759,12 @@ static long vfio_pci_ioctl(void *device_data,
 			if (ret)
 				return ret;
 
+			if (vdev->region[i].ops->add_capability) {
+				ret = vdev->region[i].ops->add_capability(vdev,
+						&vdev->region[i], &caps);
+				if (ret)
+					return ret;
+			}
 		}
 		}
 
-- 
2.11.0


  parent reply	other threads:[~2018-10-15  9:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-15  9:42 [PATCH kernel 0/3] vfio/spapr_tce: Reworks for NVIDIA V100 + P9 passthrough (part 3) Alexey Kardashevskiy
2018-10-15  9:42 ` [PATCH kernel 1/3] vfio_pci: Allow mapping extra regions Alexey Kardashevskiy
2018-11-08  6:04   ` David Gibson
2018-10-15  9:42 ` Alexey Kardashevskiy [this message]
2018-11-08  6:21   ` [PATCH kernel 2/3] vfio_pci: Allow regions to add own capabilities David Gibson
2018-11-08  6:48     ` Alexey Kardashevskiy
2018-11-08  7:16       ` David Gibson
2018-10-15  9:42 ` [PATCH kernel 3/3] vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] [10de:1db1] subdriver Alexey Kardashevskiy
2018-10-16 19:08   ` Alex Williamson
2018-10-17  1:19     ` Alexey Kardashevskiy
2018-10-17 21:52       ` Alex Williamson
2018-10-17 23:42         ` Piotr Jaroszyński
2018-10-18  0:31         ` Alexey Kardashevskiy
2018-10-18 16:55           ` Alex Williamson
2018-10-18 17:37             ` Piotr Jaroszynski
2018-10-18 18:05               ` Alex Williamson
2018-10-18 18:40                 ` Piotr Jaroszynski
2018-10-19  6:25                   ` Christoph Hellwig
2018-10-19  0:53                 ` Alexey Kardashevskiy
2018-11-12  1:08                   ` David Gibson
2018-11-12  2:36                     ` Alexey Kardashevskiy
2018-11-12  4:23                       ` David Gibson
2018-11-12  4:56                         ` Alexey Kardashevskiy

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=20181015094233.1324-3-aik@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=alex.williamson@redhat.com \
    --cc=alistair@popple.id.au \
    --cc=arbab@linux.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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).