summary refs log tree commit diff
path: root/drivers/gpu/drm/nouveau
diff options
context:
space:
mode:
authorKarol Herbst <kherbst@redhat.com>2020-04-28 18:54:04 +0200
committerBen Skeggs <bskeggs@redhat.com>2020-05-22 11:13:50 +1000
commit2924779bcaead13828ce3101e573eb5663900b92 (patch)
tree74018d02e12b27fdc5e4b301bd7685226a1739e0 /drivers/gpu/drm/nouveau
parent51c05340e407b14b7d8ca5c6ad7027f269fc617b (diff)
downloadlinux-2924779bcaead13828ce3101e573eb5663900b92.tar.gz
drm/nouveau/device: detect vGPUs
Using ENODEV as this prevents probe failed errors in dmesg.

v2: move check further down

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/device/base.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
index c732074bf790..f977dddcd809 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
@@ -2948,7 +2948,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
 {
 	struct nvkm_subdev *subdev;
 	u64 mmio_base, mmio_size;
-	u32 boot0, strap;
+	u32 boot0, boot1, strap;
 	void __iomem *map = NULL;
 	int ret = -EEXIST, i;
 	unsigned chipset;
@@ -2998,9 +2998,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
 			}
 		}
 
-		/* read boot0 and strapping information */
 		boot0 = ioread32_native(map + 0x000000);
-		strap = ioread32_native(map + 0x101000);
 
 		/* chipset can be overridden for devel/testing purposes */
 		chipset = nvkm_longopt(device->cfgopt, "NvChipset", 0);
@@ -3158,6 +3156,17 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
 		nvdev_info(device, "NVIDIA %s (%08x)\n",
 			   device->chip->name, boot0);
 
+		/* vGPU detection */
+		boot1 = ioread32_native(map + 0x000004);
+		if (device->card_type >= TU100 && (boot1 & 0x00030000)) {
+			nvdev_info(device, "vGPUs are not supported\n");
+			ret = -ENODEV;
+			goto done;
+		}
+
+		/* read strapping information */
+		strap = ioread32_native(map + 0x101000);
+
 		/* determine frequency of timing crystal */
 		if ( device->card_type <= NV_10 || device->chipset < 0x17 ||
 		    (device->chipset >= 0x20 && device->chipset < 0x25))