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.
This commit is contained in:
mrg 2015-10-29 08:08:52 +00:00
parent e7cd356db3
commit 961142429c
2 changed files with 17 additions and 2 deletions

View File

@ -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 @@ nouveau_bo_fence_flush(void *sync_obj)
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,

View File

@ -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"