NetBSD Problem Report #54274

From wiz@yt.nih.at  Wed Jun  5 21:54:27 2019
Return-Path: <wiz@yt.nih.at>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id CBC8F7A14F
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  5 Jun 2019 21:54:27 +0000 (UTC)
Message-Id: <20190605215424.205022AC0FC@yt.nih.at>
Date: Wed,  5 Jun 2019 23:54:24 +0200 (CEST)
From: Thomas Klausner <wiz@NetBSD.org>
Reply-To: Thomas Klausner <wiz@NetBSD.org>
To: gnats-bugs@NetBSD.org
Subject: firmware loading issue in nouveau driver
X-Send-Pr-Version: 3.95

>Number:         54274
>Category:       kern
>Synopsis:       firmware loading issue in nouveau driver
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 05 21:55:01 +0000 2019
>Closed-Date:    Wed Jul 03 20:47:36 +0000 2019
>Last-Modified:  Sun Mar 08 09:30:01 +0000 2020
>Originator:     Thomas Klausner
>Release:        NetBSD 8.99.41
>Organization:
Curiosity is the very basis of education and if you tell me that
curiosity killed the cat, I say only that the cat died nobly.
- Arnold Edinborough
>Environment:


Architecture: x86_64
Machine: amd64
>Description:
When booting a Geforce GTX 960 on my system, I see:

nouveau0 at pci12 dev 0 function 0: vendor 10de product 1401 (rev. 0xa1)
nouveau0: info: NVIDIA GM206 (126010a1)                  
nouveau0: info: bios: version 84.06.14.00.ff                      
nouveau0: info: gr: using external firmware              
firmware_open(nouveau/nvidia/gm206/fecs_inst.bin) called too early.
nouveau0: autoconfiguration error: error: gr: failed to load fecs_inst
nouveau0: notice: disp: dcb 15 type 8 unknown                        
nouveau0: info: fb: 4096 MiB GDDR5                                   
Zone  kernel: Available graphics memory: 17983376 kiB                
Zone   dma32: Available graphics memory: 2097152 kiB                      
nouveau0: info: DRM: VRAM: 4096 MiB                                   
nouveau0: info: DRM: GART: 1048576 MiB                   
nouveau0: info: DRM: TMDS table version 2.0
nouveau0: info: DRM: DCB version 4.1                                    
nouveau0: info: DRM: DCB outp 00: 01000f02 00020030
nouveau0: info: DRM: DCB outp 01: 02000f00 00000000
nouveau0: info: DRM: DCB outp 02: 02811f76 04400020               
nouveau0: info: DRM: DCB outp 03: 02011f72 00020020
nouveau0: info: DRM: DCB outp 04: 04822f86 04400010
nouveau0: info: DRM: DCB outp 05: 04022f82 00020010               
nouveau0: info: DRM: DCB outp 06: 04833f96 04400020
nouveau0: info: DRM: DCB outp 07: 04033f92 00020020
nouveau0: info: DRM: DCB outp 08: 02044f62 00020010               
nouveau0: info: DRM: DCB outp 15: 01df5ff8 00000000
nouveau0: info: DRM: DCB conn 00: 00001030
nouveau0: info: DRM: DCB conn 01: 00020146                        
nouveau0: info: DRM: DCB conn 02: 01000246
nouveau0: info: DRM: DCB conn 03: 02000346
nouveau0: info: DRM: DCB conn 04: 00010461                        
nouveau0: info: DRM: DCB conn 05: 00000570
nouveau0: autoconfiguration error: error: DRM: Pointer to flat panel table invalid
nouveau0: autoconfiguration error: warn: DRM: unknown connector type 70
nouveau0: autoconfiguration error: warn: DRM: failed to create encoder 1/8/0: -19
nouveau0: autoconfiguration error: warn: DRM: Unknown-1 has no encoders, removing
kern info: [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
kern info: [drm] Driver supports precise vblank timestamp query.
nouveau0: info: DRM: MM: using COPY for buffer copies
nouveaufb0 at nouveau0                                             
nouveaufb0: framebuffer at 0xffff95965b7ec000, size 1920x1080, depth 32, stride 7680
wsdisplay0 at nouveaufb0 kbdmux 1: console (default, vt100 emulation)

In particular:

firmware_open(nouveau/nvidia/gm206/fecs_inst.bin) called too early.

The code in firmware.c looks like this:

        if (cwdi0.cwdi_cdir == NULL) {
                printf("firmware_open(%s/%s) called too early.\n",
                        drvname, imgname);
                return ENOENT;
        }

That's before the function is even trying path lookups - cwdi0 doesn't
seem to be filled in enough yet. All the lines are before wd0 is even
detected (I'm not sure if that's necessary, but that's where / lives).

Is nouveau called to early, or does it need to call something before
firmware_open?

Another problem is that the files are actually not distributed with
NetBSD, but we can tackle that later.

A third possible problem: nouveau does not depend on firmload.

I guess this won't change much, but I think this is definitely needed:

/usr/src/sys/external/bsd/drm2> cvs di
Index: nouveau/files.nouveau                                            
===================================================================
RCS file: /cvsroot/src/sys/external/bsd/drm2/nouveau/files.nouveau,v           
retrieving revision 1.26                                              
diff -u -r1.26 files.nouveau             
--- nouveau/files.nouveau       4 Feb 2019 08:18:08 -0000       1.26
+++ nouveau/files.nouveau       3 Jun 2019 14:06:57 -0000
@@ -3,7 +3,7 @@                                             
 version        20180827                        

 define nouveaufbbus    { }                             
-device nouveau: drmkms, drmkms_ttm, nouveaufbbus
+device nouveau: drmkms, drmkms_ttm, nouveaufbbus, firmload               

 attach nouveau at pci with nouveau_pci: drmkms_pci
 file   external/bsd/drm2/nouveau/nouveau_pci.c                 nouveau_pci


For comparison:
/usr/src/sys/external/bsd/drm2> grep -r firmload .                                                         
./i915drm/files.i915drmkms:device       i915drmkms: drmkms, drmkms_pci, intelfbbus, agp_i810, firmload                
...                                                                                                                                    
./radeon/files.radeon:device    radeon: drmkms, drmkms_pci, drmkms_ttm, radeonfbbus, firmload
./amdgpu/files.amdgpu:device    amdgpu: drmkms, drmkms_pci, drmkms_ttm, amdgpufbbus, firmload


>How-To-Repeat:
Boot with a Geforce GTX 960 (perhaps only on my system).
>Fix:
Please.

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Wed, 03 Jul 2019 20:47:36 +0000
State-Changed-Why:
I fixed it.


From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54274 CVS commit: src/sys/external/bsd/drm2/nouveau
Date: Wed, 3 Jul 2019 20:47:22 +0000

 Module Name:	src
 Committed By:	wiz
 Date:		Wed Jul  3 20:47:22 UTC 2019

 Modified Files:
 	src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

 Log Message:
 Improve nouveau pci attachment code so it waits for the availability of /
 before trying to load firmware.

 Fixes my PR 54274.

 LGTM mrg


 To generate a diff of this commit:
 cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54274 CVS commit: [netbsd-8] src/sys/external/bsd/drm2/nouveau
Date: Sun, 8 Mar 2020 09:28:04 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Mar  8 09:28:04 UTC 2020

 Modified Files:
 	src/sys/external/bsd/drm2/nouveau [netbsd-8]: nouveau_pci.c

 Log Message:
 Pull up following revision(s) (requested by mrg in ticket #1512):

 	sys/external/bsd/drm2/nouveau/nouveau_pci.c: revision 1.24,1.25
 	(via patch)

 Improve nouveau pci attachment code so it waits for the availability of /
 before trying to load firmware.
 Fixes my PR 54274.

 LGTM mrg

 list the PCI ID range for new nvidia TU117 and TU116.

 adjust the check to simply be >= 0x1580, which is the
 first pciid not support.

 should fix PR#54600.


 To generate a diff of this commit:
 cvs rdiff -u -r1.8.10.2 -r1.8.10.3 \
     src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.