Skip to contentSkip to conversation

nouveau: GM108 hangs at boot since "drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts" (6.18.64)

REGRESSION R. V. Lobato 3 participants 3 messages Nov 21 – Nov 22

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

Hi,

The 6.18.64 backport 15465d681517 ("drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts", upstream 2139cb633d48, review patch 426/686 <[email protected]>) breaks nouveau on my GM108 laptop GPU. The machine hangs during boot. 6.18.63 works. Reverting only the gf100.c hunk of this commit on top of 6.18.64 fixes it.

Hardware: HP Spectre x360 15-bl0XX, BIOS F.04, Intel HD 620 (i915, drives the panel) + NVIDIA GM108M [GeForce 940MX] [10de:134d], no display engine, runtime PM enabled.

On 6.18.64 the VRAM size is garbage and the boot stops shortly after:

nouveau 0000:01:00.0: NVIDIA GM108 (1180d0a2)
nouveau 0000:01:00.0: bios: version 82.08.62.00.15
nouveau 0000:01:00.0: fb: -1159778304 MiB GDDR5
nouveau 0000:01:00.0: bus: MMIO read of 00000000 FAULT at 6013d4 [ PRIVRING ] nouveau 0000:01:00.0: bus: MMIO read of 00000000 FAULT at 10f65c [ PRIVRING ] nouveau 0000:01:00.0: bus: MMIO read of 00000000 FAULT at 17e280 [ PRIVRING ] (no "drm: VRAM", no "Initialized nouveau"; the system hangs)

On 6.18.63 the same machine prints "fb: 2048 MiB GDDR5" and nouveau initializes normally.

My reading of the cause: the new code in gf100_devinit_preinit() runs the VGA CRTC check only when

!(nvkm_devinit_disable(base) & (1ULL << NVKM_ENGINE_DISP))

The guard expects nvkm_devinit_disable() to return a mask of disabled engines. In 6.18.64 it calls the void ->disable() hook, which disables subdevs with nvkm_subdev_disable(), and then always returns 0. So the guard is always true, also on boards without a display engine. On GM108 the VGA CRTC reads hit the PRIVRING fault at 0x6013d4 and, I infer, return a nonzero value (I did not log it), so post is set to false, the VBIOS init scripts never run, and the memory controller is left uninitialized.

nouveau.config=NvForcePost=1 lets the machine boot, but only fixes the first init, because force_post is cleared after the first preinit. On every runtime resume of the GPU the check skips devinit again:

  [   35.770421] nouveau 0000:01:00.0: Enabling HDA controller
  [   35.805652] nouveau 0000:01:00.0: fifo: fault 01 [WRITE] at 0000000000120000 engine 05 [BAR2] client 08 [HUB/HOST_CPU_NB] reason 02 [PTE] on channel -1 [007fd38000 unknown]
  [   35.806084] nouveau 0000:01:00.0: fifo: SCHED_ERROR 20 []
  ...
  [   75.453651] WARNING: CPU: 0 PID: 1081 at nvkm_runl_cgrp_get_cgid+0x79/0x110 [nouveau]

Counts per boot:

  kernel                        runtime resumes  fifo faults  SCHED_ERROR  WARNINGs
  6.18.63 (two boots)           25 / 30          0            0            0
  6.18.64 + NvForcePost=1       2                31           103381       39
  6.18.64 + gf100.c hunk revert 3                0            0            0

The revert I use (restores 6.18.63's gf100.c exactly):

drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c +0 -20
@@ -27,7 +27,6 @@
 #include <subdev/bios/init.h>
 #include <subdev/bios/pll.h>
 #include <subdev/clk/pll.h>
-#include <subdev/vga.h>
 
 int
 gf100_devinit_pll_set(struct nvkm_devinit *init, u32 type, u32 freq)
@@ -100,25 +99,6 @@
 	 * can use it as a reliable way to know whether we should run devinit.
 	 */
 	base->post = ((nvkm_rd32(device, 0x2240c) & BIT(1)) == 0);
-
-	/*
-	 * However some VBIOS init sequences miss this bit. So fall back to
-	 * the nv50 method of checking if the bit is not set. Running the
-	 * VBIOS multiple times may have detrimental effects.
-	 */
-	if (base->post) {
-		u64 disable = nvkm_devinit_disable(base);
-		/* magic to detect whether or not x86 vbios code has
-		 * executed the devinit scripts to initialise the
-		 * board. only works if there's a display engine.
-		 */
-		if (!(disable & (1ULL << NVKM_ENGINE_DISP))) {
-			if (nvkm_rdvgac(device, 0, 0x00) ||
-			    nvkm_rdvgac(device, 0, 0x1a)) {
-				base->post = false;
-			}
-		}
-	}
 }
 
 static const struct nvkm_devinit_func

A proper fix probably needs the guard to test whether the display engine actually exists (for example nvkm_device_engine(device, NVKM_ENGINE_DISP, 0) after ->disable() has run) instead of the return value of nvkm_devinit_disable(). I have not tested that. I have only tested 6.18.y; I can test patches on this machine.

#regzbot introduced: v6.18.63..v6.18.64

Thanks,
R. V. Lobato

maintainer
#1 lore raw
Quoted 4 lines

The 6.18.64 backport 15465d681517 ("drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts", upstream 2139cb633d48, review patch 426/686 <[email protected]>) breaks nouveau on my GM108 laptop GPU. The machine hangs during boot.

[...]

Quoted 4 lines

The guard expects nvkm_devinit_disable() to return a mask of disabled engines. In 6.18.64 it calls the void ->disable() hook, which disables subdevs with nvkm_subdev_disable(), and then always returns 0. So the guard is always true, also on boards without a display engine.

Thanks for the analysis, that matches what I see: nvkm_devinit_disable() has returned 0 since da2b1a0a40d8 ("drm/nouveau/devinit: Convert function disable() to be void").

I've reverted it for the next 7.3, 6.18 and 6.12 releases and dropped it from the 6.6, 6.1, 5.15 and 5.10 queues. Mainline has the same bug and still needs a fix.

Signature · 2 lines
Thanks,
Sasha
#2 lore raw
In reply to R. V. Lobato
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] drm/nouveau: missing Signed-off-by trailer and raw email commit message - [Medium]…

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [High] drm/nouveau: missing Signed-off-by trailer and raw email commit message
- [Medium] drm/nouveau/devinit: reverting fallback in gf100_devinit_preinit() vs device->disp
- [Low] drm/nouveau/devinit: missing Fixes trailer for commit 15465d681517
--

commit f69e16ffb3a4936b58c7bf63ef33b8ce793b99f6
Author: R. V. Lobato <[email protected]>

Quoted 52 lines

nouveau: GM108 hangs at boot since "drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts" (6.18.64)

Hi,

The 6.18.64 backport 15465d681517 ("drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts", upstream 2139cb633d48, review patch 426/686 <[email protected]>) breaks nouveau on my GM108 laptop GPU. The machine hangs during boot. 6.18.63 works. Reverting only the gf100.c hunk of this commit on top of 6.18.64 fixes it.

Hardware: HP Spectre x360 15-bl0XX, BIOS F.04, Intel HD 620 (i915, drives the panel) + NVIDIA GM108M [GeForce 940MX] [10de:134d], no display engine, runtime PM enabled.

On 6.18.64 the VRAM size is garbage and the boot stops shortly after:

nouveau 0000:01:00.0: NVIDIA GM108 (1180d0a2)
nouveau 0000:01:00.0: bios: version 82.08.62.00.15
nouveau 0000:01:00.0: fb: -1159778304 MiB GDDR5
nouveau 0000:01:00.0: bus: MMIO read of 00000000 FAULT at 6013d4 [ PRIVRING ] nouveau 0000:01:00.0: bus: MMIO read of 00000000 FAULT at 10f65c [ PRIVRING ] nouveau 0000:01:00.0: bus: MMIO read of 00000000 FAULT at 17e280 [ PRIVRING ] (no "drm: VRAM", no "Initialized nouveau"; the system hangs)

On 6.18.63 the same machine prints "fb: 2048 MiB GDDR5" and nouveau initializes normally.

My reading of the cause: the new code in gf100_devinit_preinit() runs the VGA CRTC check only when

!(nvkm_devinit_disable(base) & (1ULL << NVKM_ENGINE_DISP))

The guard expects nvkm_devinit_disable() to return a mask of disabled engines. In 6.18.64 it calls the void ->disable() hook, which disables subdevs with nvkm_subdev_disable(), and then always returns 0. So the guard is always true, also on boards without a display engine. On GM108 the VGA CRTC reads hit the PRIVRING fault at 0x6013d4 and, I infer, return a nonzero value (I did not log it), so post is set to false, the VBIOS init scripts never run, and the memory controller is left uninitialized.

nouveau.config=NvForcePost=1 lets the machine boot, but only fixes the first init, because force_post is cleared after the first preinit. On every runtime resume of the GPU the check skips devinit again:

  [   35.770421] nouveau 0000:01:00.0: Enabling HDA controller
  [   35.805652] nouveau 0000:01:00.0: fifo: fault 01 [WRITE] at 0000000000120000 engine 05 [BAR2] client 08 [HUB/HOST_CPU_NB] reason 02 [PTE] on channel -1 [007fd38000 unknown]
  [   35.806084] nouveau 0000:01:00.0: fifo: SCHED_ERROR 20 []
  ...
  [   75.453651] WARNING: CPU: 0 PID: 1081 at nvkm_runl_cgrp_get_cgid+0x79/0x110 [nouveau]
Quoted 8 lines

Counts per boot:

  kernel                        runtime resumes  fifo faults  SCHED_ERROR  WARNINGs
  6.18.63 (two boots)           25 / 30          0            0            0
  6.18.64 + NvForcePost=1       2                31           103381       39
  6.18.64 + gf100.c hunk revert 3                0            0            0

The revert I use (restores 6.18.63's gf100.c exactly):

[Severity: High]
This commit lacks a Signed-off-by: trailer certifying the Developer's Certificate of Origin. The commit message and subject are also formatted as a raw mailing list bug report email rather than a kernel changelog with a standard subsystem prefix.

[Severity: Low]
Should this regression fix include:

Fixes 15465d681517 ("drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts")
Quoted 4 lines
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c +0 -0
index 186e09ea0cb10..5368e705e7fd6 100644

[ ... ]

Quoted 14 lines
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c +0 -10
@@ -100,25 +99,6 @@ gf100_devinit_preinit(struct nvkm_devinit *base)
 	 * can use it as a reliable way to know whether we should run devinit.
 	 */
 	base->post = ((nvkm_rd32(device, 0x2240c) & BIT(1)) == 0);
-
-	/*
-	 * However some VBIOS init sequences miss this bit. So fall back to
-	 * the nv50 method of checking if the bit is not set. Running the
-	 * VBIOS multiple times may have detrimental effects.
-	 */
-	if (base->post) {
-		u64 disable = nvkm_devinit_disable(base);
-		/* magic to detect whether or not x86 vbios code has
-		 * executed the devinit scripts to initialise the

drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c gf100_devinit_preinit(struct nvkm_devinit *base) · line 102

Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c +0 -9
-		 * board. only works if there's a display engine.
-		 */
-		if (!(disable & (1ULL << NVKM_ENGINE_DISP))) {
-			if (nvkm_rdvgac(device, 0, 0x00) ||
-			    nvkm_rdvgac(device, 0, 0x1a)) {
-				base->post = false;
-			}
-		}
-	}
 }

[Severity: Medium]
Does removing this fallback reintroduce double execution of VBIOS devinit scripts on GF100+ GPUs that have a display engine but whose VBIOS does not set BIT(1) of 0x2240c?

Since a7f000ec5650 ("drm/nouveau/disp: switch to instanced constructor") and da2b1a0a40d8 ("drm/nouveau/devinit: Convert function disable() to be void"), nvkm_devinit_disable() disables absent subdevices via nvkm_subdev_disable() (clearing device->disp to NULL) and always returns 0. Calling nvkm_devinit_disable(base) and checking if (device->disp) before reading the VGA CRTC registers, as nv50_devinit_preinit() does, would avoid the PRIVRING faults on displayless GPUs like GM108 while preserving the fallback check on GPUs with a display engine.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1