yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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