Bug 101601

Summary: Nvidia GT 1030 (NV138/GP108) support
Product: xorg Reporter: Carlo Caione <carlo>
Component: Driver/nouveauAssignee: Nouveau Project <nouveau>
Status: RESOLVED MOVED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: jan.public, rhyskidd
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
journal trace GP108
none
VBIOS
none
log_gf119_disp_pioc_init_returns_0
none
MMIOTRACE
none
patch to check if heads are there before initialization
none
log patch drm-next
none
backport fix none

Description Carlo Caione 2017-06-26 14:10:59 UTC
Created attachment 132255 [details]
journal trace GP108

I'm trying to make nouveau working with this card. I'm only interested in modesetting.

On an unmodified kernel the chipset is not recognized and at boot I get

[    0.874915] nouveau 0000:01:00.0: unknown chipset (138000a1)
[    0.874918] nouveau: probe of 0000:01:00.0 failed with error -12

I also tried to use the same settings as for the NV137 adding in base.c:

case 0x138: device->chip = &nv137_chipset; break;

With this change at boot I get a black screen and nouveau timeouts.

In attachment the journal using nouveau.bebug=trace (with the kernel modification).
Comment 1 Carlo Caione 2017-06-26 14:11:43 UTC
Created attachment 132256 [details]
VBIOS

VBIOS exctracted with nvagetbios -s prom
Comment 2 Carlo Caione 2017-06-27 13:50:24 UTC
Created attachment 132283 [details]
log_gf119_disp_pioc_init_returns_0

The problem is that gf119_disp_pioc_init() is returning -EBUSY.

Modesetting works fine (let's say 90% of the times) if I force gf119_disp_pioc_init() to return 0. Of course I highly doubt this is a reasonable fix but at least it could give an hint where the real issue is.

In attachment the log with this ugly change (but at least I was able to have a reasonable resolution).
Comment 3 Carlo Caione 2017-06-27 16:06:10 UTC
Created attachment 132286 [details]
MMIOTRACE

In attachment mmiotrace (modprobe + xorg start)
Comment 4 Ilia Mirkin 2017-06-27 18:12:32 UTC
So it seems like there are only 2 heads instead of 4. Carlo hardcoded the heads from 4 to 2 in gf119_disp_new_ and crtc's to 2 in nv50_display_create and was able to get something up and running.

22448 indeed returns 4. Looking over the mmiotrace, 2245c returns 2. No clue if that just happens to be 2 or if that's the number of heads.
Comment 5 Ilia Mirkin 2017-06-28 03:11:11 UTC
Created attachment 132292 [details] [review]
patch to check if heads are there before initialization

Based on comments from Ben, I wrote this patch against drm-next. Entirely untested. (Won't apply to 4.12, sadly.)
Comment 6 Carlo Caione 2017-06-28 07:23:54 UTC
Created attachment 132293 [details]
log patch drm-next

> Based on comments from Ben, I wrote this patch against drm-next. Entirely 
> untested. (Won't apply to 4.12, sadly.)
The patch doesn't seem to work fine. In attachment the log.

For reference:

# ./nvapeek 612004
00612004: 30700f03
Comment 7 Carlo Caione 2017-06-28 08:07:46 UTC
Created attachment 132296 [details] [review]
backport fix

Well, your patch backported to 4.12 works fine. Attached the patch I'm using.
Comment 8 Carlo Caione 2017-06-28 08:38:06 UTC
Ok, tested again the latest drm-next __without__ the patch proposed by Ilia and it fails with the same error:

nouveau 0000:01:00.0: DRM: curs917a allocation failed: -16
nouveau: probe of 0000:01:00.0 failed with error -16

So the problem is not related to your patch (that at this point I'm fairly confident it should work fine since it works correctly backporting it) but with drm-next itself I guess.
Comment 9 Ilia Mirkin 2017-06-28 12:18:25 UTC
drm-next appears to be hitting this logic in nv50_disp_chan_ctor:

        if (disp->chan[chan->chid.user]) {
                chan->chid.user = -1;
                return -EBUSY;
        }

when constructing the cursor for head 1.

drm/nouveau/nvkm/engine/disp/nv50.h:    struct nv50_disp_chan *chan[17];

Oops. That should be [21]. It was reading/writing random memory :(
Comment 10 Ilia Mirkin 2017-06-28 12:32:42 UTC
https://patchwork.freedesktop.org/patch/164205/

See if that helps with drm-next (in addition to the other patch).
Comment 11 Carlo Caione 2017-06-28 13:58:46 UTC
Yeah, that solved the issue.
So your patch works fine with that fix on top and adding:

case 0x138: device->chip = &nv137_chipset; break;

Thanks,
Comment 12 Carlo Caione 2017-07-04 12:29:11 UTC
Hey guys,
anything else we can do to help you upstreaming the patch? We have a bunch of nvidia boards around, just ask if you need any more test / data / trace.

thanks,
Comment 13 Ilia Mirkin 2017-07-05 16:01:27 UTC
Note that the preparatory patches are in Ben's tree now, should show up in 4.13 or 4.14. The one to actually enable GP108 is being delayed as he'd like some time with the mmiotrace to double-check a few things.
Comment 14 Ilia Mirkin 2017-07-05 16:02:55 UTC
BTW, this is the patch I sent to enable GP108: https://patchwork.freedesktop.org/patch/164973/

And this is Ben's tree with the updated versions of those patches: https://github.com/skeggsb/nouveau/commits/master
Comment 15 Daniel Drake 2017-08-11 09:48:38 UTC
The patch titled " disp/gf119-: avoid creating non-existent heads " is not in linux-next, does this mean it's no longer planned for inclusion in 4.14?

Also I guess the GP108 one is still pending the mmiotrace analysis?
Comment 16 Ilia Mirkin 2017-08-11 12:58:55 UTC
(In reply to Daniel Drake from comment #15)
> The patch titled " disp/gf119-: avoid creating non-existent heads " is not
> in linux-next, does this mean it's no longer planned for inclusion in 4.14?
> 
> Also I guess the GP108 one is still pending the mmiotrace analysis?

A drm-next nouveau pull for 4.14 has not been submitted yet. You can see the current queue at

https://github.com/skeggsb/nouveau/commits/master
Comment 17 Daniel Drake 2017-11-24 11:12:47 UTC
"disp/gf119-: avoid creating non-existent heads" is still not in linus tree, is there any news here?
Comment 18 Pierre Moreau 2017-11-24 11:59:51 UTC
(In reply to Daniel Drake from comment #17)
> "disp/gf119-: avoid creating non-existent heads" is still not in linus tree,
> is there any news here?

It is definitely in Linus’ tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v4.14&id=eba5e56db65b7a44d57a98f5f382b2a2b9991321
and looking at the source from 4.14, the patch seems to be there as well: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/nouveau/nv50_display.c?h=v4.14#n4457
Comment 19 Martin Peres 2019-12-04 09:29:39 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/driver/xf86-video-nouveau/issues/357.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.