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/0b1481cadd30
branches: netbsd-7
changeset: 798264:0b1481cadd30
user: martin <martin%NetBSD.org@localhost>
date: Mon Aug 18 07:49:10 2014 +0000
description:
Pull up following revision(s) (requested by riastradh in ticket #36):
sys/external/bsd/drm2/dist/drm/drm_gem.c: revision 1.5
sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c: revision 1.5
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.3
sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c: revision 1.6
bus_space_mmap cookies are not paddrs, so don't pmap_enter them!
For gem and ttm objects backed by uvm_aobjs, share the vmobjlock.
XXX pullup to 7
Simplify previous.
diffstat:
sys/external/bsd/drm2/dist/drm/drm_gem.c | 7 +++++++
sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c | 15 +++++++++++++++
sys/external/bsd/drm2/ttm/ttm_bo_vm.c | 21 ++++++++++++++-------
3 files changed, 36 insertions(+), 7 deletions(-)
diffs (101 lines):
diff -r 5a3780cae0c5 -r 0b1481cadd30 sys/external/bsd/drm2/dist/drm/drm_gem.c
--- a/sys/external/bsd/drm2/dist/drm/drm_gem.c Mon Aug 18 07:44:03 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_gem.c Mon Aug 18 07:49:10 2014 +0000
@@ -155,6 +155,13 @@
#ifdef __NetBSD__
obj->gemo_shm_uao = uao_create(size, 0);
+ /*
+ * XXX This is gross. We ought to do it the other way around:
+ * set the uao to have the main uvm object's lock. However,
+ * uvm_obj_setlock is not safe on uvm_aobjs.
+ */
+ mutex_obj_hold(obj->gemo_shm_uao->vmobjlock);
+ uvm_obj_setlock(&obj->gemo_uvmobj, obj->gemo_shm_uao->vmobjlock);
#else
filp = shmem_file_setup("drm mm object", size, VM_NORESERVE);
if (IS_ERR(filp))
diff -r 5a3780cae0c5 -r 0b1481cadd30 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c Mon Aug 18 07:44:03 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c Mon Aug 18 07:49:10 2014 +0000
@@ -33,6 +33,7 @@
#ifdef __NetBSD__
#include <sys/types.h>
#include <uvm/uvm_extern.h>
+#include <uvm/uvm_object.h>
#endif
#include <drm/ttm/ttm_module.h>
@@ -286,7 +287,21 @@
break;
}
+#ifdef __NetBSD__
+ if (ret)
+ return ret;
+
+ /*
+ * XXX This is gross. We ought to do it the other way around:
+ * set the uao to have the main uvm object's lock. However,
+ * uvm_obj_setlock is not safe on uvm_aobjs.
+ */
+ mutex_obj_hold(bo->ttm->swap_storage->vmobjlock);
+ uvm_obj_setlock(&bo->uvmobj, bo->ttm->swap_storage->vmobjlock);
+ return 0;
+#else
return ret;
+#endif
}
static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
diff -r 5a3780cae0c5 -r 0b1481cadd30 sys/external/bsd/drm2/ttm/ttm_bo_vm.c
--- a/sys/external/bsd/drm2/ttm/ttm_bo_vm.c Mon Aug 18 07:44:03 2014 +0000
+++ b/sys/external/bsd/drm2/ttm/ttm_bo_vm.c Mon Aug 18 07:49:10 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ttm_bo_vm.c,v 1.2 2014/08/09 00:18:58 riastradh Exp $ */
+/* $NetBSD: ttm_bo_vm.c,v 1.2.4.1 2014/08/18 07:49:10 martin Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.2 2014/08/09 00:18:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.2.4.1 2014/08/18 07:49:10 martin Exp $");
#include <sys/types.h>
@@ -89,6 +89,7 @@
unsigned i;
vm_prot_t vm_prot; /* VM_PROT_* */
pgprot_t pgprot; /* VM_PROT_* | PMAP_* cacheability flags */
+ unsigned mmapflags;
int ret;
/* Copy-on-write mappings make no sense for the graphics aperture. */
@@ -178,13 +179,19 @@
/* XXX PGO_ALLPAGES? */
if (pps[i] == PGO_DONTCARE)
continue;
- if (bo->mem.bus.is_iomem)
- paddr = bus_space_mmap(bdev->memt, u.base,
- ((startpage + i) << PAGE_SHIFT), vm_prot, 0);
- else
+ if (bo->mem.bus.is_iomem) {
+ const paddr_t cookie = bus_space_mmap(bdev->memt,
+ u.base, ((startpage + i) << PAGE_SHIFT), vm_prot,
+ 0);
+
+ paddr = pmap_phys_address(cookie);
+ mmapflags = pmap_mmap_flags(cookie);
+ } else {
paddr = page_to_phys(u.ttm->pages[startpage + i]);
+ mmapflags = 0;
+ }
ret = -pmap_enter(ufi->orig_map->pmap, vaddr + i*PAGE_SIZE,
- paddr, vm_prot, (PMAP_CANFAIL | pgprot));
+ paddr, vm_prot, (PMAP_CANFAIL | pgprot | mmapflags));
if (ret)
goto out3;
}
Home |
Main Index |
Thread Index |
Old Index