[Nouveau] [PATCH v2 3/3] device: detect vGPUs

Karol Herbst kherbst at redhat.com
Fri Apr 17 18:09:32 UTC 2020


Using ENODEV as this prevents probe failed errors in dmesg.

Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 drm/nouveau/nvkm/engine/device/base.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drm/nouveau/nvkm/engine/device/base.c b/drm/nouveau/nvkm/engine/device/base.c
index ddaa96a75..70effb36e 100644
--- a/drm/nouveau/nvkm/engine/device/base.c
+++ b/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;
 	int ret = -EEXIST, i;
 	unsigned chipset;
@@ -2993,8 +2993,19 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
 			}
 		}
 
-		/* read boot0 and strapping information */
+		/* vGPU detection */
 		boot0 = ioread32_native(map + 0x000000);
+		boot1 = ioread32_native(map + 0x000004);
+		chipset = (boot0 & 0x1ff00000) >> 20;
+
+		if (chipset >= 0x160 && (boot1 & 0x00030000)) {
+			iounmap(map);
+			nvdev_info(device, "vGPUs are not supported\n");
+			ret = -ENODEV;
+			goto done;
+		}
+
+		/* read strapping information */
 		strap = ioread32_native(map + 0x101000);
 		iounmap(map);
 
-- 
2.25.2



More information about the Nouveau mailing list