diff options
author | Mark Kettenis <kettenis@openbsd.org> | 2013-06-06 22:08:09 +0200 |
---|---|---|
committer | Jonathan Gray <jsg@jsg.id.au> | 2013-08-12 10:42:08 +1000 |
commit | 95e7d436cf8e159f08b94737e968ee145d94c4d3 (patch) | |
tree | 5dba4379d5eae924fd316c734a266a6860548cd0 /sys/dev/pci/drm/ttm | |
parent | ef1640659c699960a5e08e86122df44c02a4b78a (diff) |
add proper pmap flags to indicate cachability
Diffstat (limited to 'sys/dev/pci/drm/ttm')
-rw-r--r-- | sys/dev/pci/drm/ttm/ttm_bo_driver.h | 1 | ||||
-rw-r--r-- | sys/dev/pci/drm/ttm/ttm_bo_util.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/drm/ttm/ttm_bo_vm.c | 11 |
3 files changed, 15 insertions, 5 deletions
diff --git a/sys/dev/pci/drm/ttm/ttm_bo_driver.h b/sys/dev/pci/drm/ttm/ttm_bo_driver.h index ba44752e85c..8b45509b73b 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo_driver.h +++ b/sys/dev/pci/drm/ttm/ttm_bo_driver.h @@ -982,6 +982,7 @@ extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, * setting up a PTE with the caching model indicated by @c_state. */ extern vm_prot_t ttm_io_prot(uint32_t caching_flags); +extern int ttm_pmap_flags(uint32_t caching_flags); extern const struct ttm_mem_type_manager_func ttm_bo_manager_func; diff --git a/sys/dev/pci/drm/ttm/ttm_bo_util.c b/sys/dev/pci/drm/ttm/ttm_bo_util.c index c1f83e424f8..ae292c6c9f5 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo_util.c +++ b/sys/dev/pci/drm/ttm/ttm_bo_util.c @@ -520,6 +520,14 @@ vm_prot_t ttm_io_prot(uint32_t caching_flags) } EXPORT_SYMBOL(ttm_io_prot); +int ttm_pmap_flags(uint32_t caching_flags) +{ + if (caching_flags & TTM_PL_FLAG_WC) + return PMAP_WC; + else + return PMAP_NOCACHE; +} + static int ttm_bo_ioremap(struct ttm_buffer_object *bo, unsigned long offset, unsigned long size, diff --git a/sys/dev/pci/drm/ttm/ttm_bo_vm.c b/sys/dev/pci/drm/ttm/ttm_bo_vm.c index f55978e0a6a..e9ead0df650 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo_vm.c +++ b/sys/dev/pci/drm/ttm/ttm_bo_vm.c @@ -106,6 +106,7 @@ ttm_bo_vm_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr, vm_page_t *pps, struct vm_page *page; paddr_t paddr; vm_prot_t mapprot; + int pmap_flags; boolean_t locked = TRUE; int ret; int i; @@ -202,11 +203,11 @@ ttm_bo_vm_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr, vm_page_t *pps, */ mapprot = ufi->entry->protection; if (bo->mem.bus.is_iomem) { -// mapprot = ttm_io_prot(bo->mem.placement); + pmap_flags = ttm_pmap_flags(bo->mem.placement); } else { ttm = bo->ttm; - mapprot = (bo->mem.placement & TTM_PL_FLAG_CACHED) ? - mapprot : ttm_io_prot(bo->mem.placement); + pmap_flags = (bo->mem.placement & TTM_PL_FLAG_CACHED) ? + 0 : ttm_pmap_flags(bo->mem.placement); /* Allocate all page at once, most common usage */ if (ttm->bdev->driver->ttm_tt_populate(ttm)) { @@ -233,8 +234,8 @@ ttm_bo_vm_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr, vm_page_t *pps, paddr = VM_PAGE_TO_PHYS(page); } - ret = pmap_enter(ufi->orig_map->pmap, vaddr, paddr, - mapprot, PMAP_CANFAIL | mapprot); + ret = pmap_enter(ufi->orig_map->pmap, vaddr, + paddr | pmap_flags, mapprot, PMAP_CANFAIL | mapprot); /* * Somebody beat us to this PTE or prefaulting to |