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/dist/drm/nouveau provide a ttm-backed ...



details:   https://anonhg.NetBSD.org/src/rev/43497d4912db
branches:  trunk
changeset: 341274:43497d4912db
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu Oct 29 08:08:52 2015 +0000

description:
provide a ttm-backed set of nouveau_uvm_ops{} in the ttm_bo_driver{}.
fixes NULL pointer derefs inside UVM due to lack of pager ops.

copy the DRM_FILE_PAGE_OFFSET vs !_LP64 workaround.

with these, X starts up on my GTX 440.

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c  |  15 +++++++++++++--
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h |   4 ++++
 2 files changed, 17 insertions(+), 2 deletions(-)

diffs (55 lines):

diff -r fe224adfd587 -r 43497d4912db sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c       Thu Oct 29 07:46:08 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c       Thu Oct 29 08:08:52 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_bo.c,v 1.5 2014/08/23 08:03:33 riastradh Exp $ */
+/*     $NetBSD: nouveau_bo.c,v 1.6 2015/10/29 08:08:52 mrg Exp $       */
 
 /*
  * Copyright 2007 Dave Airlied
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_bo.c,v 1.5 2014/08/23 08:03:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_bo.c,v 1.6 2015/10/29 08:08:52 mrg Exp $");
 
 #include <core/engine.h>
 #include <linux/swiotlb.h>
@@ -1568,10 +1568,21 @@
        return 0;
 }
 
+#ifdef __NetBSD__
+static const struct uvm_pagerops nouveau_uvm_ops = {
+       .pgo_reference = &ttm_bo_uvm_reference,
+       .pgo_detach = &ttm_bo_uvm_detach,
+       .pgo_fault = &ttm_bo_uvm_fault,
+};
+#endif
+
 struct ttm_bo_driver nouveau_bo_driver = {
        .ttm_tt_create = &nouveau_ttm_tt_create,
        .ttm_tt_populate = &nouveau_ttm_tt_populate,
        .ttm_tt_unpopulate = &nouveau_ttm_tt_unpopulate,
+#ifdef __NetBSD__
+       .ttm_uvm_ops = &nouveau_uvm_ops,
+#endif
        .invalidate_caches = nouveau_bo_invalidate_caches,
        .init_mem_type = nouveau_bo_init_mem_type,
        .evict_flags = nouveau_bo_evict_flags,
diff -r fe224adfd587 -r 43497d4912db sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h      Thu Oct 29 07:46:08 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h      Thu Oct 29 08:08:52 2015 +0000
@@ -40,7 +40,11 @@
 
 struct nouveau_channel;
 
+#ifdef _LP64
 #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
+#else
+#define DRM_FILE_PAGE_OFFSET (0xa0000000UL >> PAGE_SHIFT)
+#endif
 
 #include "nouveau_fence.h"
 #include "nouveau_bios.h"



Home | Main Index | Thread Index | Old Index