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.
This commit is contained in:
parent
30f1271254
commit
15c31783b0
|
@ -155,6 +155,13 @@ int drm_gem_object_init(struct drm_device *dev,
|
|||
|
||||
#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))
|
||||
|
|
|
@ -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 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc)
|
|||
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,
|
||||
|
|
|
@ -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 @@ ttm_bo_uvm_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr,
|
|||
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 @@ ttm_bo_uvm_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr,
|
|||
/* 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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue