Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/external/bsd/drm2 Pull up following revision(s) (requ...



details:   https://anonhg.NetBSD.org/src/rev/c8a886cd14dc
branches:  netbsd-7
changeset: 799881:c8a886cd14dc
user:      snj <snj%NetBSD.org@localhost>
date:      Fri Apr 15 08:46:42 2016 +0000

description:
Pull up following revision(s) (requested by riastradh in ticket #1157):
        sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c: revision 1.3
        sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c: revisions 1.9, 1.10
        sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/namedb.h: revision 1.2
        sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c: revisions 1.4, 1.5
        sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c: revision 1.3
        sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c: revision 1.8
        sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h: revision 1.4
        sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.4
        sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c: revision 1.3
        sys/external/bsd/drm2/include/linux/delay.h: revision 1.4
        sys/external/bsd/drm2/include/linux/spinlock.h: revision 1.7
        sys/external/bsd/drm2/nouveau/files.nouveau: revision 1.14
        sys/external/bsd/drm2/nouveau/nouveau_pci.c: revision 1.7
Set nouveau to a more reasonable debug level.
Match the compile-time and default run-time settings in Linux.
--
Pass a sensible device state pointer to nouveau suspend/resume ops.
Gives nouveau half a chance of suspending and resuming -- not that it
works on my test laptop yet, but it's a start.
--
Fix bus_space_subregion error branch.
Return error code, not 0 (!), on bus_space_subregion failure.
In answer to `XXX error branch' comment: if nouveau_barobj_ctor
fails, then the caller will call nouveau_barobj_dtor too.  So there's
no leak here.
Unlikely to fix any observed bugs with nouveau -- there's no error
branch in the Linux side here.  But maybe it will catch some other
bug earlier.
--
Map the same mmio size as Linux does.
Unlikely to have practical consequences -- just reduces differences
in behaviour from upstream, to rule them out.
--
Print error code for failure to map PRAMIN BAR.
--
In msleep use mdelay if cold
--
Use only the low 32 bits of the bar object's vma offset as intended.
Should fix PR kern/50372, seen by everyone trying to use nouveau on
amd64 with hardware that uses nv50-style BARs and not nvc0-style
BARs.
--
Destroy the lock before caller frees memory.
--
Destroy spin locks appropriately.
--
Destroy the mutex before free.
--
Provide reader/writer semantics with recursive readers.
--
Exclude VRAM and FIFO regions from MMIO register mapping.
Nouveau maps those separately, and it is not trivial to convert those
mappings to bus_space_subregion.

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c                   |   5 +-
 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c   |  14 +-
 sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/namedb.h                        |   7 +-
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c         |  20 +-
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c |  12 +-
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c                                     |  22 +-
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h                                     |   5 +
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c                                   |   5 +-
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c                              |   5 +-
 sys/external/bsd/drm2/include/linux/delay.h                                              |   5 +-
 sys/external/bsd/drm2/include/linux/spinlock.h                                           |  79 ++++++++-
 sys/external/bsd/drm2/nouveau/files.nouveau                                              |   7 +-
 sys/external/bsd/drm2/nouveau/nouveau_pci.c                                              |  10 +-
 13 files changed, 142 insertions(+), 54 deletions(-)

diffs (truncated from 471 to 300 lines):

diff -r 9ddac4389351 -r c8a886cd14dc sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c    Fri Apr 15 08:02:34 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c    Fri Apr 15 08:46:42 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_core_subdev.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $        */
+/*     $NetBSD: nouveau_core_subdev.c,v 1.2.4.1 2016/04/15 08:46:42 snj Exp $  */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_core_subdev.c,v 1.2 2014/08/06 15:01:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_core_subdev.c,v 1.2.4.1 2016/04/15 08:46:42 snj Exp $");
 
 #include <core/object.h>
 #include <core/subdev.h>
@@ -79,6 +79,7 @@
 {
        int subidx = nv_hclass(subdev) & 0xff;
        nv_device(subdev)->subdev[subidx] = NULL;
+       linux_mutex_destroy(&subdev->mutex);
        nouveau_object_destroy(&subdev->base);
 }
 
diff -r 9ddac4389351 -r c8a886cd14dc sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c    Fri Apr 15 08:02:34 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c    Fri Apr 15 08:46:42 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_engine_device_base.c,v 1.2.4.3 2016/02/11 23:00:30 snj Exp $   */
+/*     $NetBSD: nouveau_engine_device_base.c,v 1.2.4.4 2016/04/15 08:46:42 snj Exp $   */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.2.4.3 2016/02/11 23:00:30 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.2.4.4 2016/04/15 08:46:42 snj Exp $");
 
 #include <core/object.h>
 #include <core/device.h>
@@ -180,7 +180,7 @@
                if (mmio_size < 0x102000)
                        return -ENOMEM;
                /* XXX errno NetBSD->Linux */
-               ret = -bus_space_map(mmiot, mmio_base, mmio_size, 0, &mmioh);
+               ret = -bus_space_map(mmiot, mmio_base, 0x102000, 0, &mmioh);
                if (ret)
                        return ret;
 
@@ -193,7 +193,7 @@
 
                boot0 = bus_space_read_4(mmiot, mmioh, 0x000000);
                strap = bus_space_read_4(mmiot, mmioh, 0x101000);
-               bus_space_unmap(mmiot, mmioh, mmio_size);
+               bus_space_unmap(mmiot, mmioh, 0x102000);
 #else
                map = ioremap(mmio_base, 0x102000);
                if (map == NULL)
@@ -297,6 +297,12 @@
 #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 =
+                * 0x800000 and are mapped separately.
+                */
+               mmio_size = MIN(mmio_size, 0x800000);
                /* XXX errno NetBSD->Linux */
                ret = -bus_space_map(mmiot, mmio_base, mmio_size, 0, &mmioh);
                if (ret) {
diff -r 9ddac4389351 -r c8a886cd14dc sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/namedb.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/namedb.h Fri Apr 15 08:02:34 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/namedb.h Fri Apr 15 08:46:42 2016 +0000
@@ -28,8 +28,11 @@
        nouveau_parent_init(&(p)->base)
 #define nouveau_namedb_fini(p,s)                                               \
        nouveau_parent_fini(&(p)->base, (s))
-#define nouveau_namedb_destroy(p)                                              \
-       nouveau_parent_destroy(&(p)->base)
+#define nouveau_namedb_destroy(p) do                                           \
+{                                                                              \
+       rwlock_destroy(&(p)->lock);                                            \
+       nouveau_parent_destroy(&(p)->base);                                    \
+} while (0)
 
 int  nouveau_namedb_create_(struct nouveau_object *, struct nouveau_object *,
                            struct nouveau_oclass *, u32 pclass,
diff -r 9ddac4389351 -r c8a886cd14dc sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c  Fri Apr 15 08:02:34 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c  Fri Apr 15 08:46:42 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_subdev_bar_base.c,v 1.1.1.1.4.1 2014/09/21 17:41:52 snj Exp $  */
+/*     $NetBSD: nouveau_subdev_bar_base.c,v 1.1.1.1.4.2 2016/04/15 08:46:42 snj Exp $  */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_bar_base.c,v 1.1.1.1.4.1 2014/09/21 17:41:52 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_bar_base.c,v 1.1.1.1.4.2 2016/04/15 08:46:42 snj Exp $");
 
 #include <core/object.h>
 
@@ -65,11 +65,21 @@
                return ret;
 
 #ifdef __NetBSD__
+    {
+       /* Yes, truncation is really intended here.  */
+       uint32_t offset = barobj->vma.offset & 0xffffffffUL;
+
+       KASSERTMSG(offset < bar->iomemsz,
+           "bar object vma exceeds range: %"PRIx32" > %"PRIxMAX,
+           offset, (uintmax_t)bar->iomemsz);
+
        barobj->iomemt = bar->iomemt;
-       if (bus_space_subregion(bar->iomemt, bar->iomemh, barobj->vma.offset,
-               bar->iomemsz - barobj->vma.offset, &barobj->iomemh) != 0)
-               /* XXX error branch */
+       /* XXX errno NetBSD->Linux */
+       ret = -bus_space_subregion(bar->iomemt, bar->iomemh, offset,
+           bar->iomemsz - offset, &barobj->iomemh);
+       if (ret)
                return ret;
+    }
 #else
        barobj->iomem = bar->iomem + (u32)barobj->vma.offset;
 #endif
diff -r 9ddac4389351 -r c8a886cd14dc sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c  Fri Apr 15 08:02:34 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c  Fri Apr 15 08:46:42 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_subdev_instmem_nv40.c,v 1.1.1.1.4.1 2014/09/21 17:41:53 snj Exp $      */
+/*     $NetBSD: nouveau_subdev_instmem_nv40.c,v 1.1.1.1.4.2 2016/04/15 08:46:42 snj Exp $      */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_instmem_nv40.c,v 1.1.1.1.4.1 2014/09/21 17:41:53 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_instmem_nv40.c,v 1.1.1.1.4.2 2016/04/15 08:46:42 snj Exp $");
 
 #include <engine/graph/nv40.h>
 
@@ -80,10 +80,12 @@
 #ifdef __NetBSD__
        priv->iomemt = nv_device_resource_tag(device, bar);
        priv->iomemsz = nv_device_resource_len(device, bar);
-       if (bus_space_map(priv->iomemt, nv_device_resource_start(device, bar),
-               priv->iomemsz, 0, &priv->iomemh)) {
+       ret = bus_space_map(priv->iomemt,
+           nv_device_resource_start(device, bar),
+           priv->iomemsz, 0, &priv->iomemh);
+       if (ret) {
                priv->iomemsz = 0;
-               nv_error(priv, "unable to map PRAMIN BAR\n");
+               nv_error(priv, "unable to map PRAMIN BAR: %d\n", ret);
                return -EFAULT;
        }
 #else
diff -r 9ddac4389351 -r c8a886cd14dc sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c      Fri Apr 15 08:02:34 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c      Fri Apr 15 08:46:42 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_drm.c,v 1.2.4.4 2016/02/11 22:52:58 snj Exp $  */
+/*     $NetBSD: nouveau_drm.c,v 1.2.4.5 2016/04/15 08:46:42 snj Exp $  */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.2.4.4 2016/02/11 22:52:58 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.2.4.5 2016/04/15 08:46:42 snj Exp $");
 
 #include <linux/console.h>
 #include <linux/module.h>
@@ -612,12 +612,13 @@
        return ret;
 }
 
+#ifdef __NetBSD__
+int nouveau_pmops_suspend(struct drm_device *drm_dev)
+#else
 int nouveau_pmops_suspend(struct device *dev)
+#endif
 {
-#ifdef __NetBSD__
-       struct drm_device *drm_dev = device_private(dev);
-       struct pci_dev *pdev __unused = drm_dev->pdev;
-#else
+#ifndef __NetBSD__
        struct pci_dev *pdev = to_pci_dev(dev);
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
 #endif
@@ -674,12 +675,13 @@
        return 0;
 }
 
+#ifdef __NetBSD__
+int nouveau_pmops_resume(struct drm_device *drm_dev)
+#else
 int nouveau_pmops_resume(struct device *dev)
+#endif
 {
-#ifdef __NetBSD__
-       struct drm_device *drm_dev = device_private(dev);
-       struct pci_dev *pdev __unused = drm_dev->pdev;
-#else
+#ifndef __NetBSD__
        struct pci_dev *pdev = to_pci_dev(dev);
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
 #endif
diff -r 9ddac4389351 -r c8a886cd14dc sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h      Fri Apr 15 08:02:34 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h      Fri Apr 15 08:46:42 2016 +0000
@@ -160,8 +160,13 @@
        return nv_device(nouveau_drm(dev)->device);
 }
 
+#ifdef __NetBSD__
+int nouveau_pmops_suspend(struct drm_device *);
+int nouveau_pmops_resume(struct drm_device *);
+#else
 int nouveau_pmops_suspend(struct device *);
 int nouveau_pmops_resume(struct device *);
+#endif
 
 #define NV_FATAL(cli, fmt, args...) nv_fatal((cli), fmt, ##args)
 #define NV_ERROR(cli, fmt, args...) nv_error((cli), fmt, ##args)
diff -r 9ddac4389351 -r c8a886cd14dc sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c    Fri Apr 15 08:02:34 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c    Fri Apr 15 08:46:42 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_fence.c,v 1.2.4.1 2014/09/21 17:41:52 snj Exp $        */
+/*     $NetBSD: nouveau_fence.c,v 1.2.4.2 2016/04/15 08:46:42 snj Exp $        */
 
 /*
  * Copyright (C) 2007 Ben Skeggs.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_fence.c,v 1.2.4.1 2014/09/21 17:41:52 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_fence.c,v 1.2.4.2 2016/04/15 08:46:42 snj Exp $");
 
 #include <drm/drmP.h>
 
@@ -71,6 +71,7 @@
                nouveau_fence_signal(fence);
        }
        spin_unlock(&fctx->lock);
+       spin_lock_destroy(&fctx->lock);
 }
 
 void
diff -r 9ddac4389351 -r c8a886cd14dc sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c       Fri Apr 15 08:02:34 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c       Fri Apr 15 08:46:42 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_nv10_fence.c,v 1.1.1.1.4.1 2014/09/21 17:41:52 snj Exp $       */
+/*     $NetBSD: nouveau_nv10_fence.c,v 1.1.1.1.4.2 2016/04/15 08:46:42 snj Exp $       */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nv10_fence.c,v 1.1.1.1.4.1 2014/09/21 17:41:52 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nv10_fence.c,v 1.1.1.1.4.2 2016/04/15 08:46:42 snj Exp $");
 
 #include <core/object.h>
 #include <core/class.h>
@@ -95,6 +95,7 @@
                nouveau_bo_unpin(priv->bo);
        nouveau_bo_ref(NULL, &priv->bo);
        drm->fence = NULL;
+       spin_lock_destroy(&priv->lock);
        kfree(priv);
 }
 
diff -r 9ddac4389351 -r c8a886cd14dc sys/external/bsd/drm2/include/linux/delay.h
--- a/sys/external/bsd/drm2/include/linux/delay.h       Fri Apr 15 08:02:34 2016 +0000
+++ b/sys/external/bsd/drm2/include/linux/delay.h       Fri Apr 15 08:46:42 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: delay.h,v 1.3 2014/07/16 20:56:25 riastradh Exp $      */
+/*     $NetBSD: delay.h,v 1.3.2.1 2016/04/15 08:46:42 snj Exp $        */
 
 /*-



Home | Main Index | Thread Index | Old Index