yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-linux-headers-Update-for-NVLink2-passthrough-downstr.patch

ae23c9
From a0d3bac749cccf262986923b1b4f4e565472cfd8 Mon Sep 17 00:00:00 2001
ae23c9
From: David Gibson <dgibson@redhat.com>
ae23c9
Date: Thu, 30 May 2019 04:37:24 +0100
ae23c9
Subject: [PATCH 3/8] linux-headers: Update for NVLink2 passthrough [downstream
ae23c9
 only]
ae23c9
MIME-Version: 1.0
ae23c9
Content-Type: text/plain; charset=UTF-8
ae23c9
Content-Transfer-Encoding: 8bit
ae23c9
ae23c9
RH-Author: David Gibson <dgibson@redhat.com>
ae23c9
Message-id: <20190530043728.32575-3-dgibson@redhat.com>
ae23c9
Patchwork-id: 88424
ae23c9
O-Subject: [RHEL-8.1 qemu-kvm PATCH 2/6] linux-headers: Update for NVLink2 passthrough [downstream only]
ae23c9
Bugzilla: 1710662
ae23c9
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ae23c9
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
ae23c9
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
ae23c9
From: David Gibson <david@gibson.dropbear.id.au>
ae23c9
ae23c9
Update with the necessary pieces for vfio passthrough of NVLink2
ae23c9
devices.  Not a full header update, just pieces, since that's the
ae23c9
convention downwstream.
ae23c9
ae23c9
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1710662
ae23c9
ae23c9
Signed-off-by: David Gibson <dgibson@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 linux-headers/linux/vfio.h | 42 ++++++++++++++++++++++++++++++++++++++++++
ae23c9
 1 file changed, 42 insertions(+)
ae23c9
ae23c9
diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h
ae23c9
index 25c7b7d..12b23e5 100644
ae23c9
--- a/linux-headers/linux/vfio.h
ae23c9
+++ b/linux-headers/linux/vfio.h
ae23c9
@@ -304,6 +304,21 @@ struct vfio_region_info_cap_type {
ae23c9
 #define VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG	(3)
ae23c9
 
ae23c9
 /*
ae23c9
+ * 10de vendor sub-type
ae23c9
+ *
ae23c9
+ * NVIDIA GPU NVlink2 RAM is coherent RAM mapped onto the host address space.
ae23c9
+ */
ae23c9
+#define VFIO_REGION_SUBTYPE_NVIDIA_NVLINK2_RAM	(1)
ae23c9
+
ae23c9
+/*
ae23c9
+ * 1014 vendor sub-type
ae23c9
+ *
ae23c9
+ * IBM NPU NVlink2 ATSD (Address Translation Shootdown) register of NPU
ae23c9
+ * to do TLB invalidation on a GPU.
ae23c9
+ */
ae23c9
+#define VFIO_REGION_SUBTYPE_IBM_NVLINK2_ATSD	(1)
ae23c9
+
ae23c9
+/*
ae23c9
  * The MSIX mappable capability informs that MSIX data of a BAR can be mmapped
ae23c9
  * which allows direct access to non-MSIX registers which happened to be within
ae23c9
  * the same system page.
ae23c9
@@ -313,6 +328,33 @@ struct vfio_region_info_cap_type {
ae23c9
  */
ae23c9
 #define VFIO_REGION_INFO_CAP_MSIX_MAPPABLE	3
ae23c9
 
ae23c9
+/*
ae23c9
+ * Capability with compressed real address (aka SSA - small system address)
ae23c9
+ * where GPU RAM is mapped on a system bus. Used by a GPU for DMA routing
ae23c9
+ * and by the userspace to associate a NVLink bridge with a GPU.
ae23c9
+ */
ae23c9
+#define VFIO_REGION_INFO_CAP_NVLINK2_SSATGT	4
ae23c9
+
ae23c9
+struct vfio_region_info_cap_nvlink2_ssatgt {
ae23c9
+	struct vfio_info_cap_header header;
ae23c9
+	__u64 tgt;
ae23c9
+};
ae23c9
+
ae23c9
+/*
ae23c9
+ * Capability with an NVLink link speed. The value is read by
ae23c9
+ * the NVlink2 bridge driver from the bridge's "ibm,nvlink-speed"
ae23c9
+ * property in the device tree. The value is fixed in the hardware
ae23c9
+ * and failing to provide the correct value results in the link
ae23c9
+ * not working with no indication from the driver why.
ae23c9
+ */
ae23c9
+#define VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD	5
ae23c9
+
ae23c9
+struct vfio_region_info_cap_nvlink2_lnkspd {
ae23c9
+	struct vfio_info_cap_header header;
ae23c9
+	__u32 link_speed;
ae23c9
+	__u32 __pad;
ae23c9
+};
ae23c9
+
ae23c9
 /**
ae23c9
  * VFIO_DEVICE_GET_IRQ_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 9,
ae23c9
  *				    struct vfio_irq_info)
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9