thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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