drm/nouveau/pci: use nv46 MSI rearm for G94 (NVAC/MCP79)
Subsystems (3)
PATCH 1/3 drm/nouveau/pci: use nv46 MSI rearm for G94 (NVAC/MCP79)
The G94 PCI function uses nv40_pci_msi_rearm(), which re-arms MSI interrupts via memory-mapped register access. On NVAC (MCP79/MCP7A) chipsets this method is unreliable, causing sporadic FIFO errors and GPU hangs.
The closely related NVAA (MCP77/MCP73) chipset has MSI disabled entirely in the driver (.msi_rearm is not set), with a comment marking it as "reported broken". NVAC shares the same integrated GPU architecture (both are NV50/Tesla family, memory-mapped through the host bridge) but was not given the same treatment.
Switch to nv46_pci_msi_rearm(), which re-arms MSI via direct PCI config space access (pci_write_config_byte at offset 0x68). This method bypasses the memory-mapped register path that is problematic on these integrated chipsets.
Tested on Apple Mac Mini (MCP79, NVAC 0xac080b1) with DisplayPort output. System is stable with MSI enabled (no NvMSI=0 workaround needed), zero FIFO errors observed over extended operation including DPMS cycles.
--- drivers/gpu/drm/nouveau/nvkm/subdev/pci/g94.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/pci/g94.c +1 -1
@@ -28,7 +28,7 @@ g94_pci_func = { .cfg = { .addr = 0x088000, .size = 0x1000 }, .init = g84_pci_init, - .msi_rearm = nv40_pci_msi_rearm, + .msi_rearm = nv46_pci_msi_rearm, .pcie.init = g84_pcie_init, .pcie.set_link = g84_pcie_set_link,
Signature · 1 line
2.52.0
PATCH 2/3 drm/nouveau/kms: add NULL check for CRTC in nv50_sor_atomic_disable
nv50_sor_atomic_disable() calls nv50_head(nv_encoder->crtc) without checking whether nv_encoder->crtc is NULL. Under Wayland compositors that use atomic modesetting, a race condition can occur between atomic_check and atomic_commit: the encoder's CRTC reference may become NULL after validation but before the disable callback runs.
When this happens, nv50_head() receives a NULL drm_crtc pointer, and container_of() produces a garbage pointer, leading to a kernel crash (NULL pointer dereference or page fault).
Add an explicit NULL check for nv_encoder->crtc before dereferencing. If the CRTC is already gone, release the output resource and return early — there is nothing left to disable.
Note: checking nv50_head()'s return value would not work here because container_of(NULL, ...) never returns NULL; the bogus pointer must be prevented at the source.
Tested on NVAC (MCP79) with Weston --backend=drm. Without this patch, switching VTs or closing a Wayland session triggers a kernel oops. With this patch, Wayland session teardown and DPMS cycles are stable.
--- drivers/gpu/drm/nouveau/dispnv50/disp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/dispnv50/disp.c +7 -1
@@ -1565,7 +1565,13 @@ static void nv50_sor_atomic_disable(struct drm_encoder *encoder, struct drm_atomic_state *state) { struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); -struct nv50_head *head =nv50_head (nv_encoder->crtc); +struct nv50_head *head; + +if (!nv_encoder->crtc) { +nvif_outp_release (&nv_encoder->outp); +return ; + } + head =nv50_head (nv_encoder->crtc);#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT struct nouveau_connector *nv_connector =nv50_outp_get_old_connector (state, nv_encoder);struct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);
Signature · 1 line
2.52.0
PATCH 3/3 drm/nouveau/dp: retry link check once on HPD IRQ before disconnect
In reply to Marek CzernohousOn NV50/G94-family chipsets with DisplayPort, transient link glitches can trigger an HPD IRQ where the first nouveau_dp_link_check() fails momentarily. The driver then falls through to connector status re-detection, treating it as a disconnect event. This causes a brief display blackout followed by a re-plug, which is disruptive under both X11 and Wayland.
Add a single retry with a 100ms delay before giving up on the link. DisplayPort link training typically completes within a few milliseconds; 100ms is generous enough to cover worst-case re-negotiation on older hardware without adding perceptible latency for genuine unplug events.
The retry is bounded (exactly one attempt) and only applies to the IRQ path — plug/unplug events are not affected.
Tested on NVAC (MCP79) with DisplayPort output over extended DPMS on/off cycles. Without this patch, occasional display flickers were observed after DPMS resume. With this patch, all DPMS transitions are clean.
--- drivers/gpu/drm/nouveau/nouveau_display.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/nouveau/nouveau_display.c +4 -0
@@ -465,6 +465,10 @@ nouveau_display_hpd_work(struct work_struct *work)if (bits &NVIF_CONN_EVENT_V0_IRQ ) {if (nouveau_dp_link_check (nv_connector))continue ; +/* Retry once after 100ms for transient DP glitches (NV50/G94) */ +msleep (100 ); +if (nouveau_dp_link_check (nv_connector)) +continue ; } connector->status =drm_helper_probe_detect (connector,NULL , false);
Signature · 1 line
2.52.0