59aac79
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
59aac79
From: Karol Herbst <kherbst@redhat.com>
59aac79
Date: Tue, 28 Apr 2020 18:54:04 +0200
59aac79
Subject: [PATCH] device: detect vGPUs
59aac79
59aac79
Using ENODEV as this prevents probe failed errors in dmesg.
59aac79
59aac79
v2: move check further down
59aac79
59aac79
Signed-off-by: Karol Herbst <kherbst@redhat.com>
59aac79
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
59aac79
---
59aac79
 drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 15 ++++++++++++---
59aac79
 1 file changed, 12 insertions(+), 3 deletions(-)
59aac79
59aac79
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
59aac79
index c732074bf790..f977dddcd809 100644
59aac79
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
59aac79
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
59aac79
@@ -2948,7 +2948,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
59aac79
 {
59aac79
 	struct nvkm_subdev *subdev;
59aac79
 	u64 mmio_base, mmio_size;
59aac79
-	u32 boot0, strap;
59aac79
+	u32 boot0, boot1, strap;
59aac79
 	void __iomem *map = NULL;
59aac79
 	int ret = -EEXIST, i;
59aac79
 	unsigned chipset;
59aac79
@@ -2998,9 +2998,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
59aac79
 			}
59aac79
 		}
59aac79
59aac79
-		/* read boot0 and strapping information */
59aac79
 		boot0 = ioread32_native(map + 0x000000);
59aac79
-		strap = ioread32_native(map + 0x101000);
59aac79
59aac79
 		/* chipset can be overridden for devel/testing purposes */
59aac79
 		chipset = nvkm_longopt(device->cfgopt, "NvChipset", 0);
59aac79
@@ -3158,6 +3156,17 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
59aac79
 		nvdev_info(device, "NVIDIA %s (%08x)\n",
59aac79
 			   device->chip->name, boot0);
59aac79
59aac79
+		/* vGPU detection */
59aac79
+		boot1 = ioread32_native(map + 0x000004);
59aac79
+		if (device->card_type >= TU100 && (boot1 & 0x00030000)) {
59aac79
+			nvdev_info(device, "vGPUs are not supported\n");
59aac79
+			ret = -ENODEV;
59aac79
+			goto done;
59aac79
+		}
59aac79
+
59aac79
+		/* read strapping information */
59aac79
+		strap = ioread32_native(map + 0x101000);
59aac79
+
59aac79
 		/* determine frequency of timing crystal */
59aac79
 		if ( device->card_type <= NV_10 || device->chipset < 0x17 ||
59aac79
 		    (device->chipset >= 0x20 && device->chipset < 0x25))
59aac79
-- 
59aac79
2.26.2
59aac79