Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/drm2 Another round of whack-a-mole with nou...



details:   https://anonhg.NetBSD.org/src/rev/11b639e5ad17
branches:  trunk
changeset: 806468:11b639e5ad17
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Feb 25 17:29:42 2015 +0000

description:
Another round of whack-a-mole with nouveau.

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/mc.h                          |    3 +
 sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h                         |    1 -
 sys/external/bsd/drm2/dist/drm/nouveau/core/os.h                                         |    5 +
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_pll.c        |   12 +-
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/clock/nouveau_subdev_clock_base.c     |   11 +-
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/clock/nouveau_subdev_clock_nv50.c     |    7 +-
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/fbmem.h                       |   50 ++++
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/nouveau_subdev_devinit_nv04.c |    6 +-
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_nv50.c           |   62 +++++-
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_nvc0.c           |   67 +++++-
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nv50.h                             |    6 +
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nvc0.h                             |    6 +
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c           |   29 ++-
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_nv50.c         |    6 +-
 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/pwr/nouveau_subdev_pwr_base.c         |   26 +-
 sys/external/bsd/drm2/nouveau/files.nouveau                                              |  116 +++++++++-
 16 files changed, 374 insertions(+), 39 deletions(-)

diffs (truncated from 848 to 300 lines):

diff -r 1fbab54a9d68 -r 11b639e5ad17 sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/mc.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/mc.h   Wed Feb 25 17:03:42 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/mc.h   Wed Feb 25 17:29:42 2015 +0000
@@ -13,6 +13,9 @@
        struct nouveau_subdev base;
        bool use_msi;
        unsigned int irq;
+#ifdef __NetBSD__
+       void *irq_cookie;
+#endif
 };
 
 static inline struct nouveau_mc *
diff -r 1fbab54a9d68 -r 11b639e5ad17 sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h  Wed Feb 25 17:03:42 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h  Wed Feb 25 17:29:42 2015 +0000
@@ -32,7 +32,6 @@
 
                struct work_struct work;
 #ifdef __NetBSD__
-               struct mutex lock;
                drm_waitqueue_t wait;
 #else
                wait_queue_head_t wait;
diff -r 1fbab54a9d68 -r 11b639e5ad17 sys/external/bsd/drm2/dist/drm/nouveau/core/os.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h  Wed Feb 25 17:03:42 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h  Wed Feb 25 17:29:42 2015 +0000
@@ -27,6 +27,11 @@
 #include <linux/kref.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
+#include <linux/math64.h>
+#include <linux/io-mapping.h>
+#include <linux/jiffies.h>
+#include <linux/errno.h>
+#include <linux/workqueue.h>
 
 #include <asm/byteorder.h>
 #include <asm/io.h>
diff -r 1fbab54a9d68 -r 11b639e5ad17 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_pll.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_pll.c Wed Feb 25 17:03:42 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_pll.c Wed Feb 25 17:29:42 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_subdev_bios_pll.c,v 1.1.1.1 2014/08/06 12:36:29 riastradh Exp $        */
+/*     $NetBSD: nouveau_subdev_bios_pll.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $    */
 
 /*
  * Copyright 2005-2006 Erik Waling
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_bios_pll.c,v 1.1.1.1 2014/08/06 12:36:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_bios_pll.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
 
 #include <subdev/vga.h>
 #include <subdev/bios.h>
@@ -44,7 +44,7 @@
        { PLL_MEMORY, 0x680504 },
        { PLL_VPLL0 , 0x680508 },
        { PLL_VPLL1 , 0x680520 },
-       {}
+       { }
 };
 
 static struct pll_mapping
@@ -53,7 +53,7 @@
        { PLL_MEMORY, 0x004020 },
        { PLL_VPLL0 , 0x680508 },
        { PLL_VPLL1 , 0x680520 },
-       {}
+       { }
 };
 
 static struct pll_mapping
@@ -67,7 +67,7 @@
        { PLL_UNK42 , 0x00e824 },
        { PLL_VPLL0 , 0x614100 },
        { PLL_VPLL1 , 0x614900 },
-       {}
+       { }
 };
 
 static struct pll_mapping
@@ -79,7 +79,7 @@
        { PLL_UNK41 , 0x00e818 },
        { PLL_VPLL0 , 0x614100 },
        { PLL_VPLL1 , 0x614900 },
-       {}
+       { }
 };
 
 static u16
diff -r 1fbab54a9d68 -r 11b639e5ad17 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/clock/nouveau_subdev_clock_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/clock/nouveau_subdev_clock_base.c      Wed Feb 25 17:03:42 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/clock/nouveau_subdev_clock_base.c      Wed Feb 25 17:29:42 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_subdev_clock_base.c,v 1.1.1.1 2014/08/06 12:36:29 riastradh Exp $      */
+/*     $NetBSD: nouveau_subdev_clock_base.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $  */
 
 /*
  * Copyright 2013 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_clock_base.c,v 1.1.1.1 2014/08/06 12:36:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_clock_base.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
 
 #include <core/option.h>
 
@@ -488,13 +488,12 @@
                if (!strncasecmpz(mode, "disabled", arglen)) {
                        clk->ustate = -1;
                } else {
-                       char save = mode[arglen];
+                       char *m = kstrndup(mode, arglen, GFP_KERNEL);
                        long v;
 
-                       ((char *)mode)[arglen] = '\0';
-                       if (!kstrtol(mode, 0, &v))
+                       if (!kstrtol(m, 0, &v))
                                nouveau_clock_ustate_update(clk, v);
-                       ((char *)mode)[arglen] = save;
+                       kfree(m);
                }
        }
 
diff -r 1fbab54a9d68 -r 11b639e5ad17 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/clock/nouveau_subdev_clock_nv50.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/clock/nouveau_subdev_clock_nv50.c      Wed Feb 25 17:03:42 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/clock/nouveau_subdev_clock_nv50.c      Wed Feb 25 17:29:42 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_subdev_clock_nv50.c,v 1.1.1.1 2014/08/06 12:36:29 riastradh Exp $      */
+/*     $NetBSD: nouveau_subdev_clock_nv50.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $  */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_clock_nv50.c,v 1.1.1.1 2014/08/06 12:36:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_clock_nv50.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
 
 #include <subdev/bios.h>
 #include <subdev/bios/pll.h>
@@ -117,6 +117,9 @@
                break;
        default:
                BUG_ON(1);
+               M = 0;          /* XXX GCC is stupid */
+               N = 0;          /* XXX GCC is stupid */
+               N = P;          /* XXX GCC is stupid */
        }
 
        if (M)
diff -r 1fbab54a9d68 -r 11b639e5ad17 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/fbmem.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/fbmem.h        Wed Feb 25 17:03:42 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/fbmem.h        Wed Feb 25 17:29:42 2015 +0000
@@ -64,8 +64,14 @@
 static inline struct io_mapping *
 fbmem_init(struct nouveau_device *dev)
 {
+#ifdef __NetBSD__
+       return bus_space_io_mapping_create_wc(nv_device_resource_tag(dev, 1),
+           nv_device_resource_start(dev, 1),
+           nv_device_resource_len(dev, 1));
+#else
        return io_mapping_create_wc(nv_device_resource_start(dev, 1),
                                    nv_device_resource_len(dev, 1));
+#endif
 }
 
 static inline void
@@ -74,12 +80,45 @@
        io_mapping_free(fb);
 }
 
+#ifdef __NetBSD__
+/*
+ * XXX Consider using bus_space_reserve/map instead.  Don't want to use
+ * bus_space_map because presumably that will eat too much KVA.
+ */
+
+#  define      __iomem         volatile
+#  define      ioread32        fake_ioread32
+#  define      iowrite32       fake_iowrite32
+
+static inline uint32_t
+fake_ioread32(const void __iomem *p)
+{
+       const uint32_t v = *(const uint32_t __iomem *)p;
+
+       membar_consumer();
+
+       return v;
+}
+
+static inline void
+fake_iowrite32(uint32_t v, void __iomem *p)
+{
+
+       membar_producer();
+       *(uint32_t __iomem *)p = v;
+}
+#endif
+
 static inline u32
 fbmem_peek(struct io_mapping *fb, u32 off)
 {
        u8 __iomem *p = io_mapping_map_atomic_wc(fb, off & PAGE_MASK);
        u32 val = ioread32(p + (off & ~PAGE_MASK));
+#ifdef __NetBSD__
+       io_mapping_unmap_atomic(fb, __UNVOLATILE(p));
+#else
        io_mapping_unmap_atomic(p);
+#endif
        return val;
 }
 
@@ -88,8 +127,13 @@
 {
        u8 __iomem *p = io_mapping_map_atomic_wc(fb, off & PAGE_MASK);
        iowrite32(val, p + (off & ~PAGE_MASK));
+#ifdef __NetBSD__
+       membar_producer();
+       io_mapping_unmap_atomic(fb, __UNVOLATILE(p));
+#else
        wmb();
        io_mapping_unmap_atomic(p);
+#endif
 }
 
 static inline bool
@@ -98,3 +142,9 @@
        fbmem_poke(fb, off, val);
        return val == fbmem_peek(fb, off);
 }
+
+#ifdef __NetBSD__
+#  undef       __iomem
+#  undef       ioread32
+#  undef       iowrite32
+#endif
diff -r 1fbab54a9d68 -r 11b639e5ad17 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/nouveau_subdev_devinit_nv04.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/nouveau_subdev_devinit_nv04.c  Wed Feb 25 17:03:42 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/nouveau_subdev_devinit_nv04.c  Wed Feb 25 17:29:42 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_subdev_devinit_nv04.c,v 1.1.1.1 2014/08/06 12:36:30 riastradh Exp $    */
+/*     $NetBSD: nouveau_subdev_devinit_nv04.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $        */
 
 /*
  * Copyright (C) 2010 Francisco Jerez.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_devinit_nv04.c,v 1.1.1.1 2014/08/06 12:36:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_devinit_nv04.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
 
 #include <subdev/vga.h>
 
@@ -403,8 +403,10 @@
                return ret;
 
        /* unslave crtcs */
+#if 0  /* XXX Can't happen: priv->owner is unsigned.  */
        if (priv->owner < 0)
                priv->owner = nv_rdvgaowner(priv);
+#endif
        nv_wrvgaowner(priv, 0);
 
        return 0;
diff -r 1fbab54a9d68 -r 11b639e5ad17 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_nv50.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_nv50.c    Wed Feb 25 17:03:42 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_nv50.c    Wed Feb 25 17:29:42 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_subdev_fb_nv50.c,v 1.1.1.1 2014/08/06 12:36:30 riastradh Exp $ */
+/*     $NetBSD: nouveau_subdev_fb_nv50.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $     */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_fb_nv50.c,v 1.1.1.1 2014/08/06 12:36:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_fb_nv50.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
 
 #include <core/client.h>
 #include <core/enum.h>
@@ -253,6 +253,52 @@
        if (ret)
                return ret;
 
+#ifdef __NetBSD__
+    {
+       /* XXX pa_dmat or pa_dmat64?  */
+       const bus_dma_tag_t dmat = device->pdev->pd_pa.pa_dmat64;
+       int nsegs;



Home | Main Index | Thread Index | Old Index