]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/nouveau: expose VBIOS via debugfs on GSP-RM systems
authorTimur Tabi <ttabi@nvidia.com>
Tue, 28 Apr 2026 20:28:25 +0000 (15:28 -0500)
committerDanilo Krummrich <dakr@kernel.org>
Wed, 29 Apr 2026 21:54:47 +0000 (23:54 +0200)
When Nouveau boots with GSP-RM, it bypasses several traditional code
paths to allow GSP-RM to handle those features.  In particular,
some VBIOS parsing is skipped, and a side effect is that the VBIOS
is not exposed in the DRM debugfs entries.

Fix this by updating the drm BIOS struct (nvbios) with the VBIOS data
from the nvkm BIOS struct (nvkm_bios).  This happens normally in
NVInitVBIOS(), but that function is skipped when booting with GSP-RM.

Signed-off-by: Timur Tabi <ttabi@nvidia.com>
Link: https://patch.msgid.link/20260428202825.1123719-1-ttabi@nvidia.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/gpu/drm/nouveau/nouveau_bios.c

index c8335f5b49dbf55ab64b6e49edf218e8ffd91b48..38032bb9582623aa9900ac734f1bd4c61c29cd6f 100644 (file)
@@ -2085,10 +2085,27 @@ nouveau_bios_init(struct drm_device *dev)
        int ret;
 
        /* only relevant for PCI devices */
-       if (!dev_is_pci(dev->dev) ||
-           nvkm_gsp_rm(nvxx_device(drm)->gsp))
+       if (!dev_is_pci(dev->dev))
                return 0;
 
+       if (nvkm_gsp_rm(nvxx_device(drm)->gsp)) {
+               struct nvkm_bios *nvkm_bios = nvxx_bios(drm);
+
+               /*
+                * If this GPU has an nvkm_device_chip.bios entry, then the VBIOS
+                * data was already read by the nvkm layer during nvkm_bios_new().
+                * Point the legacy DRM-level VBIOS structure at the same buffer
+                * so that any remaining legacy code can access it. This exposes
+                * the VBIOS via the DRM debugfs entries.
+                */
+               if (nvkm_bios) {
+                       bios->data = nvkm_bios->data;
+                       bios->length = nvkm_bios->size;
+               }
+
+               return 0;
+       }
+
        if (!NVInitVBIOS(dev))
                return -ENODEV;