NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/51065: nouveau recently broken for GTX770 (NVE4/GK104)
The following reply was made to PR kern/51065; it has been noted by GNATS.
From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: coypu%sdf.org@localhost
Cc: gnats-bugs%NetBSD.org@localhost
Subject: Re: kern/51065: nouveau recently broken for GTX770 (NVE4/GK104)
Date: Sun, 17 Apr 2016 02:03:04 +0000
This is a multi-part message in MIME format.
--=_qCQ0Rh0fg4QR4007KeBY+E1/KDF2b5ky
[sent with wrong magic subject line for gnats at first]
Can you please try the attached patch? It is a different approach to
solving the problem that the change you cited also sought to solve.
I confirmed that this patch fixes the problem on my NV84 device, but I
have no NVE4 device to test.
--=_qCQ0Rh0fg4QR4007KeBY+E1/KDF2b5ky
Content-Type: text/plain; charset="ISO-8859-1"; name="fifo"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="fifo.patch"
Index: sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_en=
gine_device_base.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/d=
evice/nouveau_engine_device_base.c,v
retrieving revision 1.10
diff -p -u -r1.10 nouveau_engine_device_base.c
--- sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engin=
e_device_base.c 13 Apr 2016 08:50:51 -0000 1.10
+++ sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engin=
e_device_base.c 17 Apr 2016 01:11:16 -0000
@@ -297,12 +297,6 @@ nouveau_devobj_ctor(struct nouveau_objec
#ifdef __NetBSD__
if (!(args->disable & NV_DEVICE_DISABLE_MMIO) &&
!nv_subdev(device)->mmiosz) {
- /*
- * Map only through PRAMIN -- don't map the command
- * FIFO MMIO regions, which start at NV_FIFO_OFFSET =3D
- * 0x800000 and are mapped separately.
- */
- mmio_size =3D MIN(mmio_size, 0x800000);
/* XXX errno NetBSD->Linux */
ret =3D -bus_space_map(mmiot, mmio_base, mmio_size, 0, &mmioh);
if (ret) {
Index: sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engi=
ne_fifo_base.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/f=
ifo/nouveau_engine_fifo_base.c,v
retrieving revision 1.4
diff -p -u -r1.4 nouveau_engine_fifo_base.c
--- sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_=
fifo_base.c 10 Feb 2016 17:10:47 -0000 1.4
+++ sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_=
fifo_base.c 17 Apr 2016 01:11:16 -0000
@@ -92,13 +97,68 @@ nouveau_fifo_channel_create_(struct nouv
=20
/* map fifo control registers */
#ifdef __NetBSD__
- chan->bst =3D nv_device_resource_tag(device, bar);
- /* XXX errno NetBSD->Linux */
- ret =3D -bus_space_map(chan->bst, nv_device_resource_start(device, bar) +
- addr + (chan->chid * size), size, 0, &chan->bsh);
- if (ret)
- return ret;
- chan->mapped =3D true;
+ if (bar =3D=3D 0) {
+ /*
+ * We already map BAR 0 in the engine device base, so
+ * grab a subregion of that.
+ */
+ bus_space_tag_t mmiot =3D nv_subdev(device)->mmiot;
+ bus_space_handle_t mmioh =3D nv_subdev(device)->mmioh;
+ bus_size_t mmiosz =3D nv_subdev(device)->mmiosz;
+
+ /* Check whether it lies inside the region. */
+ if (mmiosz < addr ||
+ mmiosz - addr < chan->chid*size ||
+ mmiosz - addr - chan->chid*size < size) {
+ ret =3D EIO;
+ nv_error(priv, "fifo channel out of range:"
+ " addr 0x%"PRIxMAX
+ " chid 0x%"PRIxMAX" size 0x%"PRIxMAX
+ " mmiosz 0x%"PRIxMAX"\n",
+ (uintmax_t)addr,
+ (uintmax_t)chan->chid, (uintmax_t)size,
+ (uintmax_t)mmiosz);
+ return ret;
+ }
+
+ /* Grab a subregion. */
+ /* XXX errno NetBSD->Linux */
+ ret =3D -bus_space_subregion(mmiot, mmioh,
+ (addr + chan->chid*size), size, &chan->bsh);
+ if (ret) {
+ nv_error(priv, "bus_space_subregion failed: %d\n",
+ ret);
+ return ret;
+ }
+
+ /* Success! No need to unmap a subregion. */
+ chan->mapped =3D false;
+ chan->bst =3D mmiot;
+ } else {
+ chan->bst =3D nv_device_resource_tag(device, bar);
+ /* XXX errno NetBSD->Linux */
+ ret =3D -bus_space_map(chan->bst,
+ (nv_device_resource_start(device, bar) +
+ addr + (chan->chid * size)),
+ size, 0, &chan->bsh);
+ if (ret) {
+ printf("%s: bus_space_map"
+ " bar %d addr %"PRIxMAX" + %"PRIxMAX
+ " + (%"PRIxMAX" * %"PRIxMAX") =3D %"PRIxMAX
+ " size %"PRIxMAX" failed: %d\n",
+ __func__, bar,
+ (uintmax_t)nv_device_resource_start(device, bar),
+ (uintmax_t)addr,
+ (uintmax_t)chan->chid,
+ (uintmax_t)size,
+ (uintmax_t)(nv_device_resource_start(device, bar) +
+ addr + (chan->chid * size)),
+ (uintmax_t)size,
+ ret);
+ return ret;
+ }
+ chan->mapped =3D true;
+ }
#else
chan->user =3D ioremap(nv_device_resource_start(device, bar) + addr +
(chan->chid * size), size);
--=_qCQ0Rh0fg4QR4007KeBY+E1/KDF2b5ky--
Home |
Main Index |
Thread Index |
Old Index