From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 111371] [NV04] bios OOB on kernel driver initialization Date: Sun, 11 Aug 2019 20:53:55 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0245282209==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "Nouveau" To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============0245282209== Content-Type: multipart/alternative; boundary="15655568341.1e2CEc.21938" Content-Transfer-Encoding: 7bit --15655568341.1e2CEc.21938 Date: Sun, 11 Aug 2019 20:53:54 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated https://bugs.freedesktop.org/show_bug.cgi?id=3D111371 --- Comment #9 from Ilia Mirkin --- (In reply to Jorge Natz from comment #6) > When I try to use nvagetbios without arguments, it gives me this message: Congratulations on having such an old card. Esp one that still works, and a motherboard you can plug it into. From the PRAMIN data, we can see that it's 16MB Diamond Viper TNT AGP Video Card (which you probably knew already). So nvbios is (mostly) OK with this: ~/src/envytools/nvbios/nvbios pramin.bios=20 warning: No strap specified BIOS size 0x8000 [orig: 0x10000], 1 valid parts: BIOS part 0 at 0x0 size 0x8000 [init: 0x8800]. Sig: PCIR [rev 0x00]: PCI device: 0x10de:0x0020, class 0x030000 Code type 0x00, rev 0x0001 PCIR indicator: 0x80 BIOS type: NV04 Subsystem id: 0x1092:0x5802 BMP 0x00.01 at 0x2df2 Bios version 0x30.2e.8e.7e (note the straps thing is unrelated to this). No tables at all decoded by nvbios though. I think that was semi-common tho= ugh in those days. And the PCIR signature really is at 0x3b6f. It's weird since the bytes "PCIR" are definitely there in the dumps at 0x3b= 6f, however the driver clearly sees a 0 instead of 0x52494350. Oh, that's becau= se it thinks they're out-of-bounds... which in turn looks like it's because we only pre-fetch the first 4K. To make this work, we'd have to fetch the first 16K. Annoying. OK, so a super-quick workaround is to change drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c:shadow_image if (!shadow_fetch(bios, mthd, offset + 0x1000)) { to if (!shadow_fetch(bios, mthd, offset + 0x4000)) { This isn't generally OK - I don't know that all VBIOS's are even that large, but it's OK for these methods. Ben - what do you think an appropriate workaround is for something like thi= s? --=20 You are receiving this mail because: You are the assignee for the bug.= --15655568341.1e2CEc.21938 Date: Sun, 11 Aug 2019 20:53:54 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated

Commen= t # 9 on bug 11137= 1 from Ilia Mirkin
(In reply to Jorge Natz from comment #6)
> When I try to use nvagetbios without arguments, =
it gives me this message:

Congratulations on having such an old card. Esp one that still works, and a
motherboard you can plug it into. From the PRAMIN data, we can see that it's

16MB Diamond Viper TNT AGP Video Card

(which you probably knew already). So nvbios is (mostly) OK with this:

~/src/envytools/nvbios/nvbios pramin.bios=20
warning: No strap specified
BIOS size 0x8000 [orig: 0x10000], 1 valid parts:

BIOS part 0 at 0x0 size 0x8000 [init: 0x8800]. Sig:
PCIR [rev 0x00]:
PCI device: 0x10de:0x0020, class 0x030000
Code type 0x00, rev 0x0001
PCIR indicator: 0x80

BIOS type: NV04

Subsystem id: 0x1092:0x5802

BMP 0x00.01 at 0x2df2

Bios version 0x30.2e.8e.7e

(note the straps thing is unrelated to this).

No tables at all decoded by nvbios though. I think that was semi-common tho=
ugh
in those days. And the PCIR signature really is at 0x3b6f.

It's weird since the bytes "PCIR" are definitely there in the dum=
ps at 0x3b6f,
however the driver clearly sees a 0 instead of 0x52494350. Oh, that's becau=
se
it thinks they're out-of-bounds... which in turn looks like it's because we
only pre-fetch the first 4K. To make this work, we'd have to fetch the first
16K. Annoying.

OK, so a super-quick workaround is to change

drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c:shadow_image

                if (!shadow_fetch(bios, mthd, offset + 0x1000)) {

to

                if (!shadow_fetch(bios, mthd, offset + 0x4000)) {

This isn't generally OK - I don't know that all VBIOS's are even that large,
but it's OK for these methods.

Ben - what do you think an appropriate workaround is for something like thi=
s?


You are receiving this mail because:
  • You are the assignee for the bug.
= --15655568341.1e2CEc.21938-- --===============0245282209== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KTm91dmVhdSBt YWlsaW5nIGxpc3QKTm91dmVhdUBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0cy5m cmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9ub3V2ZWF1 --===============0245282209==--