From: <th...@ke...> - 2009-05-04 21:19:24
|
linux-core/openchrome/via_buffer.c | 16 - linux-core/openchrome/via_execbuf.c | 24 +- linux-core/ttm/ttm_agp_backend.c | 4 linux-core/ttm/ttm_bo.c | 338 ++++++++++++++-------------------- linux-core/ttm/ttm_bo_api.h | 134 ++++++++----- linux-core/ttm/ttm_bo_driver.h | 11 - linux-core/ttm/ttm_bo_util.c | 65 +++--- linux-core/ttm/ttm_bo_vm.c | 40 ++-- linux-core/ttm/ttm_execbuf_util.c | 4 linux-core/ttm/ttm_fence.c | 27 -- linux-core/ttm/ttm_fence_user.c | 4 linux-core/ttm/ttm_memory.c | 7 linux-core/ttm/ttm_object.c | 6 linux-core/ttm/ttm_pat_compat.c | 4 linux-core/ttm/ttm_placement_common.h | 6 linux-core/ttm/ttm_placement_user.c | 37 +-- linux-core/ttm/ttm_tt.c | 12 - 17 files changed, 357 insertions(+), 382 deletions(-) New commits: commit c060b56467c6de03327ad8814fac2924bde94e00 Author: Thomas Hellstrom <thomas-at-shipmail-dot-org> Date: Mon May 4 23:15:35 2009 +0200 ttm: Fix up printouts. Signed-off-by: Thomas Hellstrom <thomas-at-shipmail-dot-org> diff --git a/linux-core/ttm/ttm_agp_backend.c b/linux-core/ttm/ttm_agp_backend.c index f5aef06..47961bb 100644 --- a/linux-core/ttm/ttm_agp_backend.c +++ b/linux-core/ttm/ttm_agp_backend.c @@ -83,7 +83,7 @@ static int ttm_agp_bind(struct ttm_backend *backend, struct ttm_mem_reg *bo_mem) ret = agp_bind_memory(mem, bo_mem->mm_node->start); if (ret) - printk(KERN_ERR "AGP Bind memory failed.\n"); + printk(KERN_ERR TTM_PFX "AGP Bind memory failed.\n"); return ret; } diff --git a/linux-core/ttm/ttm_bo.c b/linux-core/ttm/ttm_bo.c index 4f859d5..1e6e2d9 100644 --- a/linux-core/ttm/ttm_bo.c +++ b/linux-core/ttm/ttm_bo.c @@ -244,7 +244,7 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo) ttm_tt_destroy(bo->ttm); break; default: - printk(KERN_ERR "Illegal buffer object type\n"); + printk(KERN_ERR TTM_PFX "Illegal buffer object type\n"); ret = -EINVAL; break; } @@ -316,7 +316,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, if (bo->evicted) { ret = bdev->driver->invalidate_caches(bdev, bo->mem.placement); if (ret) - printk(KERN_ERR "Can not flush read caches\n"); + printk(KERN_ERR TTM_PFX "Can not flush read caches\n"); bo->evicted = false; } @@ -523,7 +523,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, unsigned mem_type, spin_unlock(&bo->lock); if (ret && ret != -ERESTART) { - printk(KERN_ERR "Failed to expire sync object before " + printk(KERN_ERR TTM_PFX "Failed to expire sync object before " "buffer eviction.\n"); goto out; } @@ -543,7 +543,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, unsigned mem_type, if (ret) { if (ret != -ERESTART) - printk(KERN_ERR "Failed to find memory space for " + printk(KERN_ERR TTM_PFX "Failed to find memory space for " "buffer 0x%p eviction.\n", bo); goto out; } @@ -551,7 +551,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, unsigned mem_type, ret = ttm_bo_handle_move_mem(bo, &evict_mem, true, interruptible, no_wait); if (ret) { if (ret != -ERESTART) - printk(KERN_ERR "Buffer eviction failed\n"); + printk(KERN_ERR TTM_PFX "Buffer eviction failed\n"); goto out; } @@ -880,11 +880,11 @@ int ttm_buffer_object_validate(struct ttm_buffer_object *bo, interruptible, no_wait); if (ret) { if (ret != -ERESTART) - printk(KERN_ERR "Failed moving buffer. " + printk(KERN_ERR TTM_PFX "Failed moving buffer. " "Proposed placement 0x%08x\n", bo->proposed_placement); if (ret == -ENOMEM) - printk(KERN_ERR "Out of aperture space or " + printk(KERN_ERR TTM_PFX "Out of aperture space or " "DRM memory quota.\n"); return ret; } @@ -918,21 +918,21 @@ ttm_bo_check_placement(struct ttm_buffer_object *bo, uint32_t new_mask = set_flags | clr_flags; if ((bo->type == ttm_bo_type_user) && (clr_flags & TTM_PL_FLAG_CACHED)) { - printk(KERN_ERR + printk(KERN_ERR TTM_PFX "User buffers require cache-coherent memory.\n"); return -EINVAL; } if (!capable(CAP_SYS_ADMIN)) { if (new_mask & TTM_PL_FLAG_NO_EVICT) { - printk(KERN_ERR "Need to be root to modify" + printk(KERN_ERR TTM_PFX "Need to be root to modify" " NO_EVICT status.\n"); return -EINVAL; } if ((clr_flags & bo->mem.placement & TTM_PL_MASK_MEMTYPE) && (bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { - printk(KERN_ERR "Incompatible memory specification" + printk(KERN_ERR TTM_PFX "Incompatible memory specification" " for NO_EVICT buffer.\n"); return -EINVAL; } @@ -958,7 +958,7 @@ int ttm_buffer_object_init(struct ttm_bo_device *bdev, size += buffer_start & ~PAGE_MASK; num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; if (num_pages == 0) { - printk(KERN_ERR "Illegal buffer object size.\n"); + printk(KERN_ERR TTM_PFX "Illegal buffer object size.\n"); return -EINVAL; } bo->destroy = destroy; @@ -1088,7 +1088,7 @@ static int ttm_bo_leave_list(struct ttm_buffer_object *bo, goto out; } else { ret = 0; - printk(KERN_ERR "Cleanup eviction failed\n"); + printk(KERN_ERR TTM_PFX "Cleanup eviction failed\n"); } } @@ -1136,12 +1136,12 @@ int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type) int ret = -EINVAL; if (mem_type >= TTM_NUM_MEM_TYPES) { - printk(KERN_ERR "Illegal memory type %d\n", mem_type); + printk(KERN_ERR TTM_PFX "Illegal memory type %d\n", mem_type); return ret; } if (!man->has_type) { - printk(KERN_ERR "Trying to take down uninitialized " + printk(KERN_ERR TTM_PFX "Trying to take down uninitialized " "memory manager type %u\n", mem_type); return ret; } @@ -1170,13 +1170,13 @@ int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type) struct ttm_mem_type_manager *man = &bdev->man[mem_type]; if (mem_type == 0 || mem_type >= TTM_NUM_MEM_TYPES) { - printk(KERN_ERR "Illegal memory manager memory type %u.\n", + printk(KERN_ERR TTM_PFX "Illegal memory manager memory type %u.\n", mem_type); return -EINVAL; } if (!man->has_type) { - printk(KERN_ERR "Memory type %u has not been initialized.\n", + printk(KERN_ERR TTM_PFX "Memory type %u has not been initialized.\n", mem_type); return 0; } @@ -1191,13 +1191,13 @@ int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type, struct ttm_mem_type_manager *man; if (type >= TTM_NUM_MEM_TYPES) { - printk(KERN_ERR "Illegal memory type %d\n", type); + printk(KERN_ERR TTM_PFX "Illegal memory type %d\n", type); return ret; } man = &bdev->man[type]; if (man->has_type) { - printk(KERN_ERR + printk(KERN_ERR TTM_PFX "Memory manager already initialized for type %d\n", type); return ret; @@ -1210,7 +1210,7 @@ int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type, ret = 0; if (type != TTM_PL_SYSTEM) { if (!p_size) { - printk(KERN_ERR "Zero size memory manager type %d\n", + printk(KERN_ERR TTM_PFX "Zero size memory manager type %d\n", type); return ret; } @@ -1239,7 +1239,7 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev) man->use_type = false; if ((i != TTM_PL_SYSTEM) && ttm_bo_clean_mm(bdev, i)) { ret = -EBUSY; - printk(KERN_ERR "DRM memory manager type %d " + printk(KERN_ERR TTM_PFX "DRM memory manager type %d " "is not clean.\n", i); } man->has_type = false; @@ -1318,7 +1318,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev, ttm_mem_init_shrink(&bdev->shrink, ttm_bo_swapout); ret = ttm_mem_register_shrink(mem_glob, &bdev->shrink); if (unlikely(ret != 0)) { - printk(KERN_ERR "Could not register buffer object swapout.\n"); + printk(KERN_ERR TTM_PFX "Could not register buffer object swapout.\n"); goto out_err2; } diff --git a/linux-core/ttm/ttm_bo_vm.c b/linux-core/ttm/ttm_bo_vm.c index 8fd2190..dee00d1 100644 --- a/linux-core/ttm/ttm_bo_vm.c +++ b/linux-core/ttm/ttm_bo_vm.c @@ -272,7 +272,7 @@ static unsigned long ttm_bo_vm_nopfn(struct vm_area_struct *vma, ret = ttm_bo_pci_offset(bdev, &bo->mem, &bus_base, &bus_offset, &bus_size); if (unlikely(ret != 0)) { - printk(KERN_ERR "Attempted buffer object access " + printk(KERN_ERR TTM_PFX "Attempted buffer object access " "of unmappable object.\n"); retval = NOPFN_SIGBUS; goto out_unlock; @@ -287,7 +287,7 @@ static unsigned long ttm_bo_vm_nopfn(struct vm_area_struct *vma, bo->vm_node->start - vma->vm_pgoff; if (unlikely(page_offset >= bo->num_pages)) { - printk(KERN_ERR "Attempted buffer object access " + printk(KERN_ERR TTM_PFX "Attempted buffer object access " "outside object.\n"); retval = NOPFN_SIGBUS; goto out_unlock; @@ -408,7 +408,7 @@ int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma, read_unlock(&bdev->vm_lock); if (unlikely(bo == NULL)) { - printk(KERN_ERR "Could not find buffer object to map.\n"); + printk(KERN_ERR TTM_PFX "Could not find buffer object to map.\n"); return -EINVAL; } diff --git a/linux-core/ttm/ttm_fence.c b/linux-core/ttm/ttm_fence.c index 2f61fad..19d2ad1 100644 --- a/linux-core/ttm/ttm_fence.c +++ b/linux-core/ttm/ttm_fence.c @@ -35,8 +35,7 @@ #include <linux/wait.h> #include <linux/sched.h> -#include "drmP.h" - +#define TTM_PFX "[TTM] " /* * Simple implementation for now. */ @@ -45,7 +44,7 @@ static void ttm_fence_lockup(struct ttm_fence_object *fence, uint32_t mask) { struct ttm_fence_class_manager *fc = ttm_fence_fc(fence); - printk(KERN_ERR "GPU lockup dectected on engine %u " + printk(KERN_ERR TTM_PFX "GPU lockup dectected on engine %u " "fence type 0x%08x\n", (unsigned int)fence->fence_class, (unsigned int)mask); /* @@ -143,10 +142,6 @@ void ttm_fence_handler(struct ttm_fence_device *fdev, uint32_t fence_class, if (&fence->ring == &fc->ring) break; - DRM_DEBUG("Fence 0x%08lx, sequence 0x%08x, type 0x%08x\n", - (unsigned long)fence, fence->sequence, - fence->fence_type); - if (error) { fence->info.error = error; fence->info.signaled_types = fence->fence_type; @@ -161,10 +156,6 @@ void ttm_fence_handler(struct ttm_fence_device *fdev, uint32_t fence_class, if (new_type) { fence->info.signaled_types |= new_type; - DRM_DEBUG("Fence 0x%08lx signaled 0x%08x\n", - (unsigned long)fence, - fence->info.signaled_types); - if (unlikely(driver->signaled)) driver->signaled(fence); @@ -180,8 +171,6 @@ void ttm_fence_handler(struct ttm_fence_device *fdev, uint32_t fence_class, fence->waiting_types & ~fence->info.signaled_types; if (!(fence->fence_type & ~fence->info.signaled_types)) { - DRM_DEBUG("Fence completely signaled 0x%08lx\n", - (unsigned long)fence); list_del_init(&fence->ring); } } @@ -250,8 +239,8 @@ int ttm_fence_object_flush(struct ttm_fence_object *fence, uint32_t type) bool call_flush; if (type & ~fence->fence_type) { - DRM_ERROR("Flush trying to extend fence type, " - "0x%x, 0x%x\n", type, fence->fence_type); + printk(KERN_ERR TTM_PFX "Flush trying to extend fence type, " + "0x%x, 0x%x\n", type, fence->fence_type); return -EINVAL; } @@ -342,8 +331,8 @@ int ttm_fence_object_wait(struct ttm_fence_object *fence, unsigned long to_jiffies; if (mask & ~fence->fence_type) { - DRM_ERROR("Wait trying to extend fence type" - " 0x%08x 0x%08x\n", mask, fence->fence_type); + printk(KERN_ERR TTM_PFX "Wait trying to extend fence type" + " 0x%08x 0x%08x\n", mask, fence->fence_type); BUG(); return -EINVAL; } @@ -460,13 +449,13 @@ int ttm_fence_object_create(struct ttm_fence_device *fdev, ret = ttm_mem_global_alloc(fdev->mem_glob, sizeof(*fence), false, false, false); if (unlikely(ret != 0)) { - printk(KERN_ERR "Out of memory creating fence object\n"); + printk(KERN_ERR TTM_PFX "Out of memory creating fence object\n"); return ret; } fence = kmalloc(sizeof(*fence), GFP_KERNEL); if (!fence) { - printk(KERN_ERR "Out of memory creating fence object\n"); + printk(KERN_ERR TTM_PFX "Out of memory creating fence object\n"); ttm_mem_global_free(fdev->mem_glob, sizeof(*fence), false); return -ENOMEM; } diff --git a/linux-core/ttm/ttm_fence_user.c b/linux-core/ttm/ttm_fence_user.c index f382ef2..92785c2 100644 --- a/linux-core/ttm/ttm_fence_user.c +++ b/linux-core/ttm/ttm_fence_user.c @@ -60,14 +60,14 @@ static struct ttm_fence_user_object *ttm_fence_user_object_lookup(struct base = ttm_base_object_lookup(tfile, handle); if (unlikely(base == NULL)) { - printk(KERN_ERR "Invalid fence handle 0x%08lx\n", + printk(KERN_ERR TTM_PFX "Invalid fence handle 0x%08lx\n", (unsigned long)handle); return NULL; } if (unlikely(base->object_type != ttm_fence_type)) { ttm_base_object_unref(&base); - printk(KERN_ERR "Invalid fence handle 0x%08lx\n", + printk(KERN_ERR TTM_PFX "Invalid fence handle 0x%08lx\n", (unsigned long)handle); return NULL; } diff --git a/linux-core/ttm/ttm_memory.c b/linux-core/ttm/ttm_memory.c index 73c45ed..1ac1bb9 100644 --- a/linux-core/ttm/ttm_memory.c +++ b/linux-core/ttm/ttm_memory.c @@ -33,6 +33,7 @@ #include <linux/wait.h> #include <linux/mm.h> +#define TTM_PFX "[TTM] " #define TTM_MEMORY_ALLOC_RETRIES 4 /** @@ -119,9 +120,9 @@ int ttm_mem_global_init(struct ttm_mem_global *glob) glob->total_memory_swap_limit = glob->max_total_memory - (mem >> 3); - printk(KERN_INFO "TTM available graphics memory: %llu MiB\n", + printk(KERN_INFO TTM_PFX "TTM available graphics memory: %llu MiB\n", glob->max_total_memory >> 20); - printk(KERN_INFO "TTM available object memory: %llu MiB\n", + printk(KERN_INFO TTM_PFX "TTM available object memory: %llu MiB\n", glob->max_memory >> 20); return 0; @@ -129,7 +130,7 @@ int ttm_mem_global_init(struct ttm_mem_global *glob) void ttm_mem_global_release(struct ttm_mem_global *glob) { - printk(KERN_INFO "Used total memory is %llu bytes.\n", + printk(KERN_INFO TTM_PFX "Used total memory is %llu bytes.\n", (unsigned long long)glob->used_total_memory); flush_workqueue(glob->swap_queue); destroy_workqueue(glob->swap_queue); diff --git a/linux-core/ttm/ttm_object.c b/linux-core/ttm/ttm_object.c index 45cd2bb..48a5df0 100644 --- a/linux-core/ttm/ttm_object.c +++ b/linux-core/ttm/ttm_object.c @@ -36,6 +36,8 @@ * and release on file close. */ +#define TTM_PFX "[TTM] " + /** * struct ttm_object_file * @@ -126,7 +128,6 @@ static void ttm_object_file_destroy(struct kref *kref) struct ttm_object_file *tfile = container_of(kref, struct ttm_object_file, refcount); - printk(KERN_INFO "Freeing 0x%08lx\n", (unsigned long) tfile); kfree(tfile); } @@ -198,7 +199,6 @@ void ttm_base_object_unref(struct ttm_base_object **p_base) struct ttm_base_object *base = *p_base; struct ttm_object_device *tdev = base->tfile->tdev; - // printk(KERN_INFO "TTM base object unref.\n"); *p_base = NULL; /* @@ -232,7 +232,7 @@ struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile, return NULL; if (tfile != base->tfile && !base->shareable) { - printk(KERN_ERR "Attempted access of non-shareable object.\n"); + printk(KERN_ERR TTM_PFX "Attempted access of non-shareable object.\n"); ttm_base_object_unref(&base); return NULL; } diff --git a/linux-core/ttm/ttm_pat_compat.c b/linux-core/ttm/ttm_pat_compat.c index c32dbb2..41e5781 100644 --- a/linux-core/ttm/ttm_pat_compat.c +++ b/linux-core/ttm/ttm_pat_compat.c @@ -43,6 +43,8 @@ #include <linux/notifier.h> #include <linux/cpu.h> +#define TTM_PFX "[TTM] " + #ifndef MSR_IA32_CR_PAT #define MSR_IA32_CR_PAT 0x0277 #endif @@ -77,7 +79,7 @@ static void ttm_pat_enable(void) #else if (on_each_cpu(ttm_pat_ipi_handler, NULL, 1) != 0) { #endif - printk(KERN_ERR "Timed out setting up CPU PAT.\n"); + printk(KERN_ERR TTM_PFX "Timed out setting up CPU PAT.\n"); } } diff --git a/linux-core/ttm/ttm_placement_common.h b/linux-core/ttm/ttm_placement_common.h index 7e259f9..7be6754 100644 --- a/linux-core/ttm/ttm_placement_common.h +++ b/linux-core/ttm/ttm_placement_common.h @@ -91,4 +91,10 @@ #define TTM_ACCESS_READ (1 << 0) #define TTM_ACCESS_WRITE (1 << 1) +/** + * Log message prefix. + */ + +#define TTM_PFX "[TTM] " + #endif diff --git a/linux-core/ttm/ttm_placement_user.c b/linux-core/ttm/ttm_placement_user.c index 93815a4..76291e1 100644 --- a/linux-core/ttm/ttm_placement_user.c +++ b/linux-core/ttm/ttm_placement_user.c @@ -61,14 +61,14 @@ static struct ttm_bo_user_object *ttm_bo_user_lookup(struct ttm_object_file base = ttm_base_object_lookup(tfile, handle); if (unlikely(base == NULL)) { - printk(KERN_ERR "Invalid buffer object handle 0x%08lx.\n", + printk(KERN_ERR TTM_PFX "Invalid buffer object handle 0x%08lx.\n", (unsigned long)handle); return NULL; } if (unlikely(base->object_type != ttm_buffer_type)) { ttm_base_object_unref(&base); - printk(KERN_ERR "Invalid buffer object handle 0x%08lx.\n", + printk(KERN_ERR TTM_PFX "Invalid buffer object handle 0x%08lx.\n", (unsigned long)handle); return NULL; } @@ -292,14 +292,14 @@ int ttm_pl_reference_ioctl(struct ttm_object_file *tfile, void *data) user_bo = ttm_bo_user_lookup(tfile, arg->req.handle); if (unlikely(user_bo == NULL)) { - printk(KERN_ERR "Could not reference buffer object.\n"); + printk(KERN_ERR TTM_PFX "Could not reference buffer object.\n"); return -EINVAL; } bo = &user_bo->bo; ret = ttm_ref_object_add(tfile, &user_bo->base, TTM_REF_USAGE, NULL); if (unlikely(ret != 0)) { - printk(KERN_ERR + printk(KERN_ERR TTM_PFX "Could not add a reference to buffer object.\n"); goto out; } @@ -332,7 +332,7 @@ int ttm_pl_synccpu_ioctl(struct ttm_object_file *tfile, void *data) case TTM_PL_SYNCCPU_OP_GRAB: user_bo = ttm_bo_user_lookup(tfile, arg->handle); if (unlikely(user_bo == NULL)) { - printk(KERN_ERR + printk(KERN_ERR TTM_PFX "Could not find buffer object for synccpu.\n"); return -EINVAL; } @@ -375,7 +375,7 @@ int ttm_pl_setstatus_ioctl(struct ttm_object_file *tfile, bo = ttm_buffer_object_lookup(tfile, req->handle); if (unlikely(bo == NULL)) { - printk(KERN_ERR + printk(KERN_ERR TTM_PFX "Could not find buffer object for setstatus.\n"); return -EINVAL; } @@ -423,7 +423,7 @@ int ttm_pl_waitidle_ioctl(struct ttm_object_file *tfile, void *data) bo = ttm_buffer_object_lookup(tfile, arg->handle); if (unlikely(bo == NULL)) { - printk(KERN_ERR "Could not find buffer object for waitidle.\n"); + printk(KERN_ERR TTM_PFX "Could not find buffer object for waitidle.\n"); return -EINVAL; } diff --git a/linux-core/ttm/ttm_tt.c b/linux-core/ttm/ttm_tt.c index afd60e7..4b891f0 100644 --- a/linux-core/ttm/ttm_tt.c +++ b/linux-core/ttm/ttm_tt.c @@ -86,7 +86,7 @@ void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages) } #else if (on_each_cpu(ttm_tt_ipi_handler, NULL, 1, 1) != 0) - printk(KERN_ERR "Timed out waiting for drm cache flush.\n"); + printk(KERN_ERR TTM_PFX "Timed out waiting for drm cache flush.\n"); #endif } @@ -341,7 +341,7 @@ static void ttm_tt_free_alloced_pages(struct ttm_tt *ttm) ttm->pages[i] = NULL; if (cur_page) { if (page_count(cur_page) != 1) - printk(KERN_ERR + printk(KERN_ERR TTM_PFX "Erroneous page count. Leaking pages.\n"); ttm_mem_global_free(ttm->bdev->mem_glob, PAGE_SIZE, PageHighMem(cur_page)); @@ -446,13 +446,13 @@ struct ttm_tt *ttm_tt_create(struct ttm_bo_device *bdev, unsigned long size, ttm_tt_alloc_page_directory(ttm); if (!ttm->pages) { ttm_tt_destroy(ttm); - printk(KERN_ERR "Failed allocating page table\n"); + printk(KERN_ERR TTM_PFX "Failed allocating page table\n"); return NULL; } ttm->be = bo_driver->create_ttm_backend_entry(bdev); if (!ttm->be) { ttm_tt_destroy(ttm); - printk(KERN_ERR "Failed creating ttm backend entry\n"); + printk(KERN_ERR TTM_PFX "Failed creating ttm backend entry\n"); return NULL; } ttm->state = tt_unpopulated; @@ -490,7 +490,7 @@ int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem) ret = be->func->bind(be, bo_mem); if (ret) { - printk(KERN_ERR "Couldn't bind backend.\n"); + printk(KERN_ERR TTM_PFX "Couldn't bind backend.\n"); return ret; } @@ -587,7 +587,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage) ttm->num_pages << PAGE_SHIFT, 0); if (unlikely(IS_ERR(swap_storage))) { - printk(KERN_ERR "Failed allocating swap storage.\n"); + printk(KERN_ERR TTM_PFX "Failed allocating swap storage.\n"); return -ENOMEM; } #else commit 9d0f33b178abb871f07c88a928f3fb288664574a Author: Thomas Hellstrom <thellstrom-at-vmware-dot-com> Date: Mon May 4 22:43:56 2009 +0200 ttm: Replace the ttm_buffer_object::mutex with a spinlock. Signed-off-by: Thomas Hellstrom <thomas-at-shipmail-dot-org> diff --git a/linux-core/openchrome/via_execbuf.c b/linux-core/openchrome/via_execbuf.c index 12009df..468c9c2 100644 --- a/linux-core/openchrome/via_execbuf.c +++ b/linux-core/openchrome/via_execbuf.c @@ -551,7 +551,6 @@ static int via_validate_buffer_list(struct drm_file *file_priv, item->ret = 0; req = &item->req; - mutex_lock(&bo->mutex); ret = via_placement_fence_type(bo, req->set_flags, req->clear_flags, @@ -570,7 +569,6 @@ static int via_validate_buffer_list(struct drm_file *file_priv, item->offset = bo->offset; item->flags = bo->mem.placement; - mutex_unlock(&bo->mutex); ret = via_check_presumed(&item->req, bo, item->user_val_arg, &item->po_correct); @@ -587,7 +585,6 @@ static int via_validate_buffer_list(struct drm_file *file_priv, return 0; out_err: - mutex_unlock(&bo->mutex); item->ret = ret; return ret; } @@ -612,13 +609,13 @@ static int via_handle_copyback(struct drm_device *dev, if (!arg.ret) { struct ttm_buffer_object *bo = entry->bo; - mutex_lock(&bo->mutex); - arg.d.rep.gpu_offset = bo->offset; - arg.d.rep.placement = bo->mem.placement; + arg.d.rep.gpu_offset = vbuf->offset; + arg.d.rep.placement = vbuf->flags; + spin_lock(&bo->lock); arg.d.rep.fence_type_mask = (uint32_t) (unsigned long) entry->new_sync_obj_arg; - mutex_unlock(&bo->mutex); + spin_unlock(&bo->lock); } if (__copy_to_user(vbuf->user_val_arg, diff --git a/linux-core/ttm/ttm_bo.c b/linux-core/ttm/ttm_bo.c index cae883e..4f859d5 100644 --- a/linux-core/ttm/ttm_bo.c +++ b/linux-core/ttm/ttm_bo.c @@ -320,9 +320,13 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, bo->evicted = false; } - if (bo->mem.mm_node) + if (bo->mem.mm_node) { + spin_lock(&bo->lock); bo->offset = (bo->mem.mm_node->start << PAGE_SHIFT) + bdev->man[bo->mem.mem_type].gpu_offset; + bo->cur_placement = bo->mem.placement; + spin_unlock(&bo->lock); + } return 0; @@ -337,37 +341,6 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, return ret; } -static int ttm_bo_expire_sync_obj(struct ttm_buffer_object *bo, - bool allow_errors) -{ - struct ttm_bo_device *bdev = bo->bdev; - struct ttm_bo_driver *driver = bdev->driver; - - if (bo->sync_obj) { - if (bdev->nice_mode) { - unsigned long _end = jiffies + 3 * HZ; - int ret; - do { - ret = ttm_bo_wait(bo, false, false, false); - if (ret && allow_errors) - return ret; - - } while (ret && !time_after_eq(jiffies, _end)); - - if (bo->sync_obj) { - bdev->nice_mode = false; - printk(KERN_ERR "Detected probable GPU lockup. " - "Evicting buffer.\n"); - } - } - if (bo->sync_obj) { - driver->sync_obj_unref(&bo->sync_obj); - clear_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); - } - } - return 0; -} - /** * If bo idle, remove from delayed- and lru lists, and unref. * If not idle, and already on delayed list, do nothing. @@ -381,23 +354,20 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all) struct ttm_bo_driver *driver = bdev->driver; int ret; - mutex_lock(&bo->mutex); - - if (bo->sync_obj && driver->sync_obj_signaled(bo->sync_obj, - bo->sync_obj_arg)) { - driver->sync_obj_unref(&bo->sync_obj); - clear_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); - } - - if (bo->sync_obj && remove_all) - (void)ttm_bo_expire_sync_obj(bo, false); + spin_lock(&bo->lock); + (void) ttm_bo_wait(bo, false, false, !remove_all); if (!bo->sync_obj) { int put_count; + spin_unlock(&bo->lock); + + spin_lock(&bdev->lru_lock); + ret = ttm_bo_reserve_locked(bo, false, false, false, 0); + BUG_ON(ret); if (bo->ttm) ttm_tt_unbind(bo->ttm); - spin_lock(&bdev->lru_lock); + if (!list_empty(&bo->ddestroy)) { list_del_init(&bo->ddestroy); kref_put(&bo->list_kref, ttm_bo_ref_bug); @@ -408,7 +378,9 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all) } put_count = ttm_bo_del_from_lru(bo); spin_unlock(&bdev->lru_lock); - mutex_unlock(&bo->mutex); + + atomic_set(&bo->reserved, 0); + while (put_count--) kref_put(&bo->list_kref, ttm_bo_release_list); @@ -417,22 +389,26 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all) spin_lock(&bdev->lru_lock); if (list_empty(&bo->ddestroy)) { + void *sync_obj = bo->sync_obj; + void *sync_obj_arg = bo->sync_obj_arg; + + kref_get(&bo->list_kref); + list_add_tail(&bo->ddestroy, &bdev->ddestroy); spin_unlock(&bdev->lru_lock); - driver->sync_obj_flush(bo->sync_obj, bo->sync_obj_arg); - spin_lock(&bdev->lru_lock); - if (list_empty(&bo->ddestroy)) { - kref_get(&bo->list_kref); - list_add_tail(&bo->ddestroy, &bdev->ddestroy); - } - spin_unlock(&bdev->lru_lock); + spin_unlock(&bo->lock); + + if (sync_obj) + driver->sync_obj_flush(sync_obj, sync_obj_arg); schedule_delayed_work(&bdev->wq, ((HZ / 100) < 1) ? 1 : HZ / 100); ret = 0; + } else { spin_unlock(&bdev->lru_lock); + spin_unlock(&bo->lock); ret = -EBUSY; } - mutex_unlock(&bo->mutex); + return ret; } @@ -542,7 +518,10 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, unsigned mem_type, if (bo->mem.mem_type != mem_type) goto out; + spin_lock(&bo->lock); ret = ttm_bo_wait(bo, false, interruptible, no_wait); + spin_unlock(&bo->lock); + if (ret && ret != -ERESTART) { printk(KERN_ERR "Failed to expire sync object before " "buffer eviction.\n"); @@ -637,9 +616,7 @@ static int ttm_bo_mem_force_space(struct ttm_bo_device *bdev, while (put_count--) kref_put(&entry->list_kref, ttm_bo_ref_bug); - mutex_lock(&entry->mutex); ret = ttm_bo_evict(entry, mem_type, interruptible, no_wait); - mutex_unlock(&entry->mutex); ttm_bo_unreserve(entry); @@ -807,33 +784,6 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, return ret; } -/* - * Call bo->mutex locked. - * Returns 1 if the buffer is currently rendered to or from. 0 otherwise. - */ - -static int ttm_bo_busy(struct ttm_buffer_object *bo) -{ - void *sync_obj = bo->sync_obj; - struct ttm_bo_driver *driver = bo->bdev->driver; - - if (sync_obj) { - if (driver->sync_obj_signaled(sync_obj, bo->sync_obj_arg)) { - driver->sync_obj_unref(&bo->sync_obj); - clear_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); - return 0; - } - driver->sync_obj_flush(sync_obj, bo->sync_obj_arg); - if (driver->sync_obj_signaled(sync_obj, bo->sync_obj_arg)) { - driver->sync_obj_unref(&bo->sync_obj); - clear_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); - return 0; - } - return 1; - } - return 0; -} - int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait) { int ret = 0; @@ -866,8 +816,10 @@ int ttm_bo_move_buffer(struct ttm_buffer_object *bo, * instead of doing it here. */ - ttm_bo_busy(bo); + spin_lock(&bo->lock); ret = ttm_bo_wait(bo, false, interruptible, no_wait); + spin_unlock(&bo->lock); + if (ret) return ret; @@ -1011,8 +963,7 @@ int ttm_buffer_object_init(struct ttm_bo_device *bdev, } bo->destroy = destroy; - mutex_init(&bo->mutex); - mutex_lock(&bo->mutex); + spin_lock_init(&bo->lock); kref_init(&bo->kref); kref_init(&bo->list_kref); atomic_set(&bo->cpu_writers, 0); @@ -1061,12 +1012,10 @@ int ttm_buffer_object_init(struct ttm_bo_device *bdev, if (ret) goto out_err; - mutex_unlock(&bo->mutex); ttm_bo_unreserve(bo); return 0; out_err: - mutex_unlock(&bo->mutex); ttm_bo_unreserve(bo); ttm_bo_unref(&bo); @@ -1124,10 +1073,11 @@ static int ttm_bo_leave_list(struct ttm_buffer_object *bo, { int ret; - mutex_lock(&bo->mutex); + spin_lock(&bo->lock); + ret = ttm_bo_wait(bo, false, false, false); + spin_unlock(&bo->lock); - ret = ttm_bo_expire_sync_obj(bo, allow_errors); - if (ret) + if (ret && allow_errors) goto out; if (bo->mem.mem_type == mem_type) @@ -1143,7 +1093,6 @@ static int ttm_bo_leave_list(struct ttm_buffer_object *bo, } out: - mutex_unlock(&bo->mutex); return ret; } @@ -1522,36 +1471,48 @@ int ttm_bo_wait(struct ttm_buffer_object *bo, void *sync_obj; void *sync_obj_arg; int ret = 0; + + if (likely(bo->sync_obj == NULL)) + return 0; while (bo->sync_obj) { + if (driver->sync_obj_signaled(bo->sync_obj, bo->sync_obj_arg)) { - driver->sync_obj_unref(&bo->sync_obj); + void *tmp_obj = bo->sync_obj; + bo->sync_obj = NULL; clear_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); - goto out; - } - if (no_wait) { - ret = -EBUSY; - goto out; + spin_unlock(&bo->lock); + driver->sync_obj_unref(&tmp_obj); + spin_lock(&bo->lock); + continue; } + + if (no_wait) + return -EBUSY; + sync_obj = driver->sync_obj_ref(bo->sync_obj); sync_obj_arg = bo->sync_obj_arg; - mutex_unlock(&bo->mutex); + spin_unlock(&bo->lock); ret = driver->sync_obj_wait(sync_obj, sync_obj_arg, lazy, interruptible); - - mutex_lock(&bo->mutex); if (unlikely(ret != 0)) { driver->sync_obj_unref(&sync_obj); + spin_lock(&bo->lock); return ret; } - - if (bo->sync_obj == sync_obj) { - driver->sync_obj_unref(&bo->sync_obj); - clear_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); + spin_lock(&bo->lock); + if (likely(bo->sync_obj == sync_obj && + bo->sync_obj_arg == sync_obj_arg)) { + void *tmp_obj = bo->sync_obj; + bo->sync_obj = NULL; + clear_bit(TTM_BO_PRIV_FLAG_MOVING, + &bo->priv_flags); + spin_unlock(&bo->lock); + driver->sync_obj_unref(&sync_obj); + driver->sync_obj_unref(&tmp_obj); + spin_lock(&bo->lock); } - driver->sync_obj_unref(&sync_obj); } - out: return 0; } @@ -1594,13 +1555,11 @@ int ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait) ret = ttm_bo_reserve(bo, true, no_wait, false, 0); if (unlikely(ret != 0)) return ret; - mutex_lock(&bo->mutex); + spin_lock(&bo->lock); ret = ttm_bo_wait(bo, false, true, no_wait); - if (unlikely(ret != 0)) - goto out_err0; - atomic_inc(&bo->cpu_writers); - out_err0: - mutex_unlock(&bo->mutex); + spin_unlock(&bo->lock); + if (likely(ret == 0)) + atomic_inc(&bo->cpu_writers); ttm_bo_unreserve(bo); return ret; } @@ -1662,8 +1621,10 @@ static int ttm_bo_swapout(struct ttm_mem_shrink *shrink) * Wait for GPU, then move to system cached. */ - mutex_lock(&bo->mutex); + spin_lock(&bo->lock); ret = ttm_bo_wait(bo, false, false, false); + spin_unlock(&bo->lock); + if (unlikely(ret != 0)) goto out; @@ -1689,7 +1650,6 @@ static int ttm_bo_swapout(struct ttm_mem_shrink *shrink) ret = ttm_tt_swapout(bo->ttm, bo->persistant_swap_storage); out: - mutex_unlock(&bo->mutex); /** * diff --git a/linux-core/ttm/ttm_bo_api.h b/linux-core/ttm/ttm_bo_api.h index 4f2424a..04a1760 100644 --- a/linux-core/ttm/ttm_bo_api.h +++ b/linux-core/ttm/ttm_bo_api.h @@ -110,14 +110,11 @@ struct ttm_tt; * keeps one refcount. When this refcount reaches zero, * the object is destroyed. * @event_queue: Queue for processes waiting on buffer object status change. - * @mutex: Lock protecting all members with the exception of constant members - * and list heads. We should really use a spinlock here. + * @lock: spinlock protecting mostly synchronization members. * @proposed_placement: Proposed placement for the buffer. Changed only by the * creator prior to validation as opposed to bo->mem.proposed_flags which is * changed by the implementation prior to a buffer move if it wants to outsmart * the buffer creator / user. This latter happens, for example, at eviction. - * @offset: The current GPU offset, which can have different meanings - * depending on the memory type. For SYSTEM type memory, it should be 0. * @mem: structure describing current placement. * @persistant_swap_storage: Usually the swap storage is deleted for buffers * pinned in physical memory. If this behaviour is not desired, this member @@ -139,6 +136,9 @@ struct ttm_tt; * @priv_flags: Flags describing buffer object internal state. * @vm_rb: Rb node for the vm rb tree. * @vm_node: Address space manager node. + * @offset: The current GPU offset, which can have different meanings + * depending on the memory type. For SYSTEM type memory, it should be 0. + * @cur_placement: Hint of current placement. * * Base class for TTM buffer object, that deals with data placement and CPU * mappings. GPU mappings are really up to the driver, but for simpler GPUs @@ -172,14 +172,13 @@ struct ttm_buffer_object { struct kref kref; struct kref list_kref; wait_queue_head_t event_queue; - struct mutex mutex; + spinlock_t lock; /** * Members protected by the bo::reserved lock. */ uint32_t proposed_placement; - unsigned long offset; struct ttm_mem_reg mem; struct file *persistant_swap_storage; struct ttm_tt *ttm; @@ -210,7 +209,7 @@ struct ttm_buffer_object { /** - * Members protected by the bo::mutex + * Members protected by the bo::lock */ void *sync_obj_arg; @@ -225,6 +224,14 @@ struct ttm_buffer_object { struct drm_mm_node *vm_node; + /** + * Special members that are protected by the reserve lock + * and the bo::lock when written to. Can be read with + * either of these locks held. + */ + + unsigned long offset; + uint32_t cur_placement; }; /** diff --git a/linux-core/ttm/ttm_bo_util.c b/linux-core/ttm/ttm_bo_util.c index d53474f..278c24b 100644 --- a/linux-core/ttm/ttm_bo_util.c +++ b/linux-core/ttm/ttm_bo_util.c @@ -287,8 +287,7 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, * TODO: Explicit member copy would probably be better here. */ - mutex_init(&fbo->mutex); - mutex_lock(&fbo->mutex); + spin_lock_init(&fbo->lock); init_waitqueue_head(&fbo->event_queue); INIT_LIST_HEAD(&fbo->ddestroy); INIT_LIST_HEAD(&fbo->lru); @@ -302,8 +301,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, kref_init(&fbo->kref); fbo->destroy = &ttm_transfered_destroy; - mutex_unlock(&fbo->mutex); - *new_obj = fbo; return 0; } @@ -497,17 +494,28 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, int ret; uint32_t save_flags = old_mem->placement; struct ttm_buffer_object *ghost_obj; - if (bo->sync_obj) - driver->sync_obj_unref(&bo->sync_obj); + void *tmp_obj = NULL; + + spin_lock(&bo->lock); + if (bo->sync_obj) { + tmp_obj = bo->sync_obj; + bo->sync_obj = NULL; + } bo->sync_obj = driver->sync_obj_ref(sync_obj); bo->sync_obj_arg = sync_obj_arg; - if (evict) { + if (evict) { ret = ttm_bo_wait(bo, false, false, false); + spin_unlock(&bo->lock); + driver->sync_obj_unref(&bo->sync_obj); + if (ret) return ret; + ttm_bo_free_old_node(bo); if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) && (bo->ttm != NULL)) { - ttm_tt_unbind(bo->ttm); ttm_tt_destroy(bo->ttm); bo->ttm = NULL; + ttm_tt_unbind(bo->ttm); + ttm_tt_destroy(bo->ttm); + bo->ttm = NULL; } } else { /** @@ -518,6 +526,9 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, * operation has completed. */ + set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); + spin_unlock(&bo->lock); + ret = ttm_buffer_object_transfer(bo, &ghost_obj); if (ret) return ret; @@ -533,7 +544,6 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, else bo->ttm = NULL; - set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); ttm_bo_unreserve(ghost_obj); ttm_bo_unref(&ghost_obj); } diff --git a/linux-core/ttm/ttm_bo_vm.c b/linux-core/ttm/ttm_bo_vm.c index 7df9858..8fd2190 100644 --- a/linux-core/ttm/ttm_bo_vm.c +++ b/linux-core/ttm/ttm_bo_vm.c @@ -108,21 +108,23 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) return VM_FAULT_NOPAGE; } - mutex_lock(&bo->mutex); - /* * Wait for buffer data in transit, due to a pipelined * move. */ + spin_lock(&bo->lock); if (test_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags)) { ret = ttm_bo_wait(bo, false, true, false); + spin_unlock(&bo->lock); if (unlikely(ret != 0)) { retval = (ret != -ERESTART) ? VM_FAULT_SIGBUS : VM_FAULT_NOPAGE; goto out_unlock; } - } + } else + spin_unlock(&bo->lock); + ret = ttm_bo_pci_offset(bdev, &bo->mem, &bus_base, &bus_offset, &bus_size); @@ -213,7 +215,6 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) } out_unlock: - mutex_unlock(&bo->mutex); ttm_bo_unreserve(bo); return retval; } @@ -252,21 +253,21 @@ static unsigned long ttm_bo_vm_nopfn(struct vm_area_struct *vma, return NOPFN_REFAULT; } - mutex_lock(&bo->mutex); - /* * Wait for buffer data in transit, due to a pipelined * move. */ - + spin_lock(&bo->lock); if (test_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags)) { ret = ttm_bo_wait(bo, false, true, false); + spin_unlock(&bo->lock); if (unlikely(ret != 0)) { retval = (ret != -ERESTART) ? NOPFN_SIGBUS : NOPFN_REFAULT; goto out_unlock; } - } + } else + spin_unlock(&bo->lock); ret = ttm_bo_pci_offset(bdev, &bo->mem, &bus_base, &bus_offset, &bus_size); @@ -360,7 +361,6 @@ static unsigned long ttm_bo_vm_nopfn(struct vm_area_struct *vma, } out_unlock: - mutex_unlock(&bo->mutex); ttm_bo_unreserve(bo); return retval; } diff --git a/linux-core/ttm/ttm_execbuf_util.c b/linux-core/ttm/ttm_execbuf_util.c index 4a34c18..09495c7 100644 --- a/linux-core/ttm/ttm_execbuf_util.c +++ b/linux-core/ttm/ttm_execbuf_util.c @@ -102,11 +102,11 @@ void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj) struct ttm_bo_driver *driver = bo->bdev->driver; void *old_sync_obj; - mutex_lock(&bo->mutex); + spin_lock(&bo->lock); old_sync_obj = bo->sync_obj; bo->sync_obj = driver->sync_obj_ref(sync_obj); bo->sync_obj_arg = entry->new_sync_obj_arg; - mutex_unlock(&bo->mutex); + spin_unlock(&bo->lock); ttm_bo_unreserve(bo); entry->reserved = false; if (old_sync_obj) diff --git a/linux-core/ttm/ttm_placement_user.c b/linux-core/ttm/ttm_placement_user.c index 87df2c7..93815a4 100644 --- a/linux-core/ttm/ttm_placement_user.c +++ b/linux-core/ttm/ttm_placement_user.c @@ -139,12 +139,15 @@ static void ttm_pl_fill_rep(struct ttm_buffer_object *bo, struct ttm_bo_user_object *user_bo = container_of(bo, struct ttm_bo_user_object, bo); - rep->gpu_offset = bo->offset; rep->bo_size = bo->num_pages << PAGE_SHIFT; rep->map_handle = bo->addr_space_offset; - rep->placement = bo->mem.placement; rep->handle = user_bo->base.hash.key; + + spin_lock(&bo->lock); + rep->placement = bo->cur_placement; + rep->gpu_offset = bo->offset; rep->sync_object_arg = (uint32_t) (unsigned long)bo->sync_obj_arg; + spin_unlock(&bo->lock); } int ttm_pl_create_ioctl(struct ttm_object_file *tfile, @@ -204,9 +207,7 @@ int ttm_pl_create_ioctl(struct ttm_object_file *tfile, if (unlikely(ret != 0)) goto out_err; - mutex_lock(&bo->mutex); ttm_pl_fill_rep(bo, rep); - mutex_unlock(&bo->mutex); ttm_bo_unref(&bo); out: return 0; @@ -270,9 +271,7 @@ int ttm_pl_ub_create_ioctl(struct ttm_object_file *tfile, if (unlikely(ret != 0)) goto out_err; - mutex_lock(&bo->mutex); ttm_pl_fill_rep(bo, rep); - mutex_unlock(&bo->mutex); ttm_bo_unref(&bo); out: return ret; @@ -305,9 +304,7 @@ int ttm_pl_reference_ioctl(struct ttm_object_file *tfile, void *data) goto out; } - mutex_lock(&bo->mutex); ttm_pl_fill_rep(bo, rep); - mutex_unlock(&bo->mutex); out: base = &user_bo->base; @@ -397,7 +394,6 @@ int ttm_pl_setstatus_ioctl(struct ttm_object_file *tfile, if (unlikely(ret != 0)) goto out_err2; - mutex_lock(&bo->mutex); ret = ttm_bo_check_placement(bo, req->set_placement, req->clr_placement); if (unlikely(ret != 0)) @@ -411,7 +407,6 @@ int ttm_pl_setstatus_ioctl(struct ttm_object_file *tfile, ttm_pl_fill_rep(bo, rep); out_err2: - mutex_unlock(&bo->mutex); ttm_bo_unreserve(bo); out_err1: ttm_read_unlock(lock); @@ -437,11 +432,11 @@ int ttm_pl_waitidle_ioctl(struct ttm_object_file *tfile, void *data) arg->mode & TTM_PL_WAITIDLE_MODE_NO_BLOCK); if (unlikely(ret != 0)) goto out; - mutex_lock(&bo->mutex); + spin_lock(&bo->lock); ret = ttm_bo_wait(bo, arg->mode & TTM_PL_WAITIDLE_MODE_LAZY, true, arg->mode & TTM_PL_WAITIDLE_MODE_NO_BLOCK); - mutex_unlock(&bo->mutex); + spin_unlock(&bo->lock); ttm_bo_unblock_reservation(bo); out: ttm_bo_unref(&bo); commit a87bc3c061b17f8f3b55994b8449ac5a350a7425 Author: Thomas Hellstrom <thomas-at-shipmail-dot-org> Date: Mon May 4 15:23:20 2009 +0200 ttm: s/flags/placement/ Signed-off-by: Thomas Hellstrom <thomas-at-shipmail-dot-org> diff --git a/linux-core/openchrome/via_buffer.c b/linux-core/openchrome/via_buffer.c index 84f20e0..d6aa566 100644 --- a/linux-core/openchrome/via_buffer.c +++ b/linux-core/openchrome/via_buffer.c @@ -112,7 +112,7 @@ int via_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, uint32_t via_evict_flags(struct ttm_buffer_object * bo) { - uint32_t cur_placement = bo->mem.flags & ~TTM_PL_MASK_MEMTYPE; + uint32_t cur_placement = bo->mem.placement & ~TTM_PL_MASK_MEMTYPE; switch (bo->mem.mem_type) { /* diff --git a/linux-core/openchrome/via_execbuf.c b/linux-core/openchrome/via_execbuf.c index aef3977..12009df 100644 --- a/linux-core/openchrome/via_execbuf.c +++ b/linux-core/openchrome/via_execbuf.c @@ -92,7 +92,7 @@ via_placement_fence_type(struct ttm_buffer_object *bo, /* * FIXME */ - if (bo->mem.proposed_flags & TTM_PL_FLAG_SYSTEM) + if (bo->mem.proposed_placement & TTM_PL_FLAG_SYSTEM) n_fence_type |= VIA_FENCE_TYPE_SYSMEM; #endif break; @@ -110,8 +110,8 @@ via_placement_fence_type(struct ttm_buffer_object *bo, return ret; } - bo->proposed_flags |= set_flags & TTM_PL_MASK_MEMTYPE; - bo->proposed_flags &= ~(clr_flags & TTM_PL_MASK_MEMTYPE); + bo->proposed_placement |= set_flags & TTM_PL_MASK_MEMTYPE; + bo->proposed_placement &= ~(clr_flags & TTM_PL_MASK_MEMTYPE); return 0; } @@ -439,7 +439,7 @@ static int via_check_presumed(struct drm_via_validate_req *req, if (bo->offset == req->presumed_gpu_offset && !((req->presumed_flags & VIA_PRESUMED_AGP) && - !(bo->mem.flags & (TTM_PL_FLAG_PRIV0 | TTM_PL_FLAG_TT)))) { + !(bo->mem.placement & (TTM_PL_FLAG_PRIV0 | TTM_PL_FLAG_TT)))) { *presumed_ok = 1; return 0; } @@ -559,7 +559,7 @@ static int via_validate_buffer_list(struct drm_file *file_priv, if (unlikely(ret != 0)) goto out_err; - ret = ttm_buffer_object_validate(bo, bo->proposed_flags, + ret = ttm_buffer_object_validate(bo, bo->proposed_placement, true, false); if (unlikely(ret != 0)) @@ -569,7 +569,7 @@ static int via_validate_buffer_list(struct drm_file *file_priv, entry->new_sync_obj_arg = (void *)(unsigned long)cur_fence_type; item->offset = bo->offset; - item->flags = bo->mem.flags; + item->flags = bo->mem.placement; mutex_unlock(&bo->mutex); ret = via_check_presumed(&item->req, bo, item->user_val_arg, @@ -614,7 +614,7 @@ static int via_handle_copyback(struct drm_device *dev, mutex_lock(&bo->mutex); arg.d.rep.gpu_offset = bo->offset; - arg.d.rep.placement = bo->mem.flags; + arg.d.rep.placement = bo->mem.placement; arg.d.rep.fence_type_mask = (uint32_t) (unsigned long) entry->new_sync_obj_arg; diff --git a/linux-core/ttm/ttm_agp_backend.c b/linux-core/ttm/ttm_agp_backend.c index 28fbe3b..f5aef06 100644 --- a/linux-core/ttm/ttm_agp_backend.c +++ b/linux-core/ttm/ttm_agp_backend.c @@ -75,7 +75,7 @@ static int ttm_agp_bind(struct ttm_backend *backend, struct ttm_mem_reg *bo_mem) struct ttm_agp_backend *agp_be = container_of(backend, struct ttm_agp_backend, backend); struct agp_memory *mem = agp_be->mem; - int cached = (bo_mem->flags & TTM_PL_FLAG_CACHED); + int cached = (bo_mem->placement & TTM_PL_FLAG_CACHED); int ret; mem->is_flushed = 1; diff --git a/linux-core/ttm/ttm_bo.c b/linux-core/ttm/ttm_bo.c index 28b4853..cae883e 100644 --- a/linux-core/ttm/ttm_bo.c +++ b/linux-core/ttm/ttm_bo.c @@ -98,7 +98,7 @@ static void ttm_bo_add_to_lru(struct ttm_buffer_object *bo) BUG_ON(!atomic_read(&bo->reserved)); - if (!(bo->mem.flags & TTM_PL_FLAG_NO_EVICT)) { + if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { BUG_ON(!list_empty(&bo->lru)); @@ -264,7 +264,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, int ret = 0; if (old_is_pci || new_is_pci || - ((mem->flags & bo->mem.flags & TTM_PL_MASK_CACHING) == 0)) + ((mem->placement & bo->mem.placement & TTM_PL_MASK_CACHING) == 0)) ttm_bo_unmap_virtual(bo); /* @@ -276,7 +276,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, if (ret) goto out_err; - ret = ttm_tt_set_placement_caching(bo->ttm, mem->flags); + ret = ttm_tt_set_placement_caching(bo->ttm, mem->placement); if (ret) return ret; @@ -289,11 +289,11 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, if (bo->mem.mem_type == TTM_PL_SYSTEM) { struct ttm_mem_reg *old_mem = &bo->mem; - uint32_t save_flags = old_mem->flags; + uint32_t save_flags = old_mem->placement; *old_mem = *mem; mem->mm_node = NULL; - ttm_flag_masked(&save_flags, mem->flags, + ttm_flag_masked(&save_flags, mem->placement, TTM_PL_MASK_MEMTYPE); goto moved; } @@ -314,7 +314,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, moved: if (bo->evicted) { - ret = bdev->driver->invalidate_caches(bdev, bo->mem.flags); + ret = bdev->driver->invalidate_caches(bdev, bo->mem.placement); if (ret) printk(KERN_ERR "Can not flush read caches\n"); bo->evicted = false; @@ -768,7 +768,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, if ((type_ok && (mem_type == TTM_PL_SYSTEM)) || node) { mem->mm_node = node; mem->mem_type = mem_type; - mem->flags = cur_flags; + mem->placement = cur_flags; return 0; } @@ -795,7 +795,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, interruptible, no_wait); if (ret == 0 && mem->mm_node) { - mem->flags = cur_flags; + mem->placement = cur_flags; return 0; } @@ -898,9 +898,9 @@ int ttm_bo_move_buffer(struct ttm_buffer_object *bo, static int ttm_bo_mem_compat(uint32_t proposed_placement, struct ttm_mem_reg *mem) { - if ((proposed_placement & mem->flags & TTM_PL_MASK_MEM) == 0) + if ((proposed_placement & mem->placement & TTM_PL_MASK_MEM) == 0) return 0; - if ((proposed_placement & mem->flags & TTM_PL_MASK_CACHING) == 0) + if ((proposed_placement & mem->placement & TTM_PL_MASK_CACHING) == 0) return 0; return 1; @@ -913,24 +913,24 @@ int ttm_buffer_object_validate(struct ttm_buffer_object *bo, int ret; BUG_ON(!atomic_read(&bo->reserved)); - bo->proposed_flags = proposed_placement; + bo->proposed_placement = proposed_placement; TTM_DEBUG("Proposed placement 0x%08lx, Old flags 0x%08lx\n", (unsigned long)proposed_placement, - (unsigned long)bo->mem.flags); + (unsigned long)bo->mem.placement); /* * Check whether we need to move buffer. */ - if (!ttm_bo_mem_compat(bo->proposed_flags, &bo->mem)) { - ret = ttm_bo_move_buffer(bo, bo->proposed_flags, + if (!ttm_bo_mem_compat(bo->proposed_placement, &bo->mem)) { + ret = ttm_bo_move_buffer(bo, bo->proposed_placement, interruptible, no_wait); if (ret) { if (ret != -ERESTART) printk(KERN_ERR "Failed moving buffer. " "Proposed placement 0x%08x\n", - bo->proposed_flags); + bo->proposed_placement); if (ret == -ENOMEM) printk(KERN_ERR "Out of aperture space or " "DRM memory quota.\n"); @@ -953,7 +953,7 @@ int ttm_buffer_object_validate(struct ttm_buffer_object *bo, * the active flags */ - ttm_flag_masked(&bo->mem.flags, bo->proposed_flags, + ttm_flag_masked(&bo->mem.placement, bo->proposed_placement, ~TTM_PL_MASK_MEMTYPE); return 0; @@ -978,8 +978,8 @@ ttm_bo_check_placement(struct ttm_buffer_object *bo, return -EINVAL; } - if ((clr_flags & bo->mem.flags & TTM_PL_MASK_MEMTYPE) && - (bo->mem.flags & TTM_PL_FLAG_NO_EVICT)) { + if ((clr_flags & bo->mem.placement & TTM_PL_MASK_MEMTYPE) && + (bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { printk(KERN_ERR "Incompatible memory specification" " for NO_EVICT buffer.\n"); return -EINVAL; @@ -1030,7 +1030,7 @@ int ttm_buffer_object_init(struct ttm_bo_device *bdev, bo->mem.page_alignment = page_alignment; bo->buffer_start = buffer_start & PAGE_MASK; bo->priv_flags = 0; - bo->mem.flags = (TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED); + bo->mem.placement = (TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED); bo->seq_valid = false; bo->persistant_swap_storage = persistant_swap_storage; bo->acc_size = acc_size; @@ -1404,7 +1404,7 @@ bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) if (man->flags & TTM_MEMTYPE_FLAG_CMA) return false; - if (mem->flags & TTM_PL_FLAG_CACHED) + if (mem->placement & TTM_PL_FLAG_CACHED) return false; } return true; @@ -1667,12 +1667,12 @@ static int ttm_bo_swapout(struct ttm_mem_shrink *shrink) if (unlikely(ret != 0)) goto out; - if ((bo->mem.flags & swap_placement) != swap_placement) { + if ((bo->mem.placement & swap_placement) != swap_placement) { struct ttm_mem_reg evict_mem; evict_mem = bo->mem; evict_mem.mm_node = NULL; - evict_mem.flags = TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED; + evict_mem.placement = TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED; evict_mem.mem_type = TTM_PL_SYSTEM; ret = ttm_bo_handle_move_mem(bo, &evict_mem, true, false, false); diff --git a/linux-core/ttm/ttm_bo_api.h b/linux-core/ttm/ttm_bo_api.h index 5c1d47c..4f2424a 100644 --- a/linux-core/ttm/ttm_bo_api.h +++ b/linux-core/ttm/ttm_bo_api.h @@ -53,8 +53,7 @@ struct drm_mm_node; * @size: Requested size of memory region. * @num_pages: Actual size of memory region in pages. * @page_alignment: Page alignment. - * @flags: Placement flags. - * @proposed_flags: Proposed placement flags. + * @placement: Placement flags. * * Structure indicating the placement and space resources used by a * buffer object. @@ -66,7 +65,7 @@ struct ttm_mem_reg { unsigned long num_pages; uint32_t page_alignment; uint32_t mem_type; - uint32_t flags; + uint32_t placement; }; /** @@ -113,7 +112,7 @@ struct ttm_tt; * @event_queue: Queue for processes waiting on buffer object status change. * @mutex: Lock protecting all members with the exception of constant members * and list heads. We should really use a spinlock here. - * @proposed_flags: Proposed placement for the buffer. Changed only by the + * @proposed_placement: Proposed placement for the buffer. Changed only by the * creator prior to validation as opposed to bo->mem.proposed_flags which is * changed by the implementation prior to a buffer move if it wants to outsmart * the buffer creator / user. This latter happens, for example, at eviction. @@ -179,7 +178,7 @@ struct ttm_buffer_object { * Members protected by the bo::reserved lock. */ - uint32_t proposed_flags; + uint32_t proposed_placement; unsigned long offset; struct ttm_mem_reg mem; struct file *persistant_swap_storage; diff --git a/linux-core/ttm/ttm_bo_util.c b/linux-core/ttm/ttm_bo_util.c index 48b8dcc..d53474f 100644 --- a/linux-core/ttm/ttm_bo_util.c +++ b/linux-core/ttm/ttm_bo_util.c @@ -55,19 +55,19 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo, { struct ttm_tt *ttm = bo->ttm; struct ttm_mem_reg *old_mem = &bo->mem; - uint32_t save_flags = old_mem->flags; + uint32_t save_flags = old_mem->placement; int ret; if (old_mem->mem_type != TTM_PL_SYSTEM) { ttm_tt_unbind(ttm); ttm_bo_free_old_node(bo); - ttm_flag_masked(&old_mem->flags, TTM_PL_FLAG_SYSTEM, + ttm_flag_masked(&old_mem->placement, TTM_PL_FLAG_SYSTEM, TTM_PL_MASK_MEM); old_mem->mem_type = TTM_PL_SYSTEM; - save_flags = old_mem->flags; + save_flags = old_mem->placement; } - ret = ttm_tt_set_placement_caching(ttm, new_mem->flags); + ret = ttm_tt_set_placement_caching(ttm, new_mem->placement); if (unlikely(ret != 0)) return ret; @@ -79,7 +79,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo, *old_mem = *new_mem; new_mem->mm_node = NULL; - ttm_flag_masked(&save_flags, new_mem->flags, TTM_PL_MASK_MEMTYPE); + ttm_flag_masked(&save_flags, new_mem->placement, TTM_PL_MASK_MEMTYPE); return 0; } @@ -102,7 +102,7 @@ int ttm_mem_reg_ioremap(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem, addr = (void *)(((u8 *) man->io_addr) + bus_offset); else { #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)) - if (mem->flags & TTM_PL_FLAG_WC) + if (mem->placement & TTM_PL_FLAG_WC) addr = ioremap_wc(bus_base + bus_offset, bus_size); else addr = ioremap_nocache(bus_base + bus_offset, bus_size); @@ -189,7 +189,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, void *old_iomap; void *new_iomap; int ret; - uint32_t save_flags = old_mem->flags; + uint32_t save_flags = old_mem->placement; unsigned long i; unsigned long page; unsigned long add = 0; @@ -234,7 +234,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, *old_mem = *new_mem; new_mem->mm_node = NULL; - ttm_flag_masked(&save_flags, new_mem->flags, TTM_PL_MASK_MEMTYPE); + ttm_flag_masked(&save_flags, new_mem->placement, TTM_PL_MASK_MEMTYPE); if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) && (ttm != NULL)) { ttm_tt_unbind(ttm); @@ -351,7 +351,7 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo, map->virtual = (void *)(((u8 *) man->io_addr) + bus_offset);} else { map->bo_kmap_type = ttm_bo_map_iomap; #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)) - if (mem->flags & TTM_PL_FLAG_WC) + if (mem->placement & TTM_PL_FLAG_WC) map->virtual = ioremap_wc(bus_base + bus_offset, bus_size); else map->virtual = ioremap_nocache(bus_base + bus_offset, bus_size); @@ -372,7 +372,7 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, struct page * d; int i; BUG_ON(!ttm); - if (num_pages == 1 && (mem->flags & TTM_PL_FLAG_CACHED)) { + if (num_pages == 1 && (mem->placement & TTM_PL_FLAG_CACHED)) { /* * We're mapping a single page, and the desired * page protection is consistent with the bo. @@ -393,9 +393,9 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, * We need to use vmap to get the desired page protection * or to make the buffer object look contigous. */ - prot = (mem->flags & TTM_PL_FLAG_CACHED) ? + prot = (mem->placement & TTM_PL_FLAG_CACHED) ? PAGE_KERNEL : - ttm_io_prot(mem->flags, PAGE_KERNEL); + ttm_io_prot(mem->placement, PAGE_KERNEL); map->bo_kmap_type = ttm_bo_map_vmap; map->virtual = vmap(ttm->pages + start_page, num_pages, 0, prot); } @@ -479,8 +479,7 @@ int ttm_bo_pfn_prot(struct ttm_buffer_object *bo, *pfn = page_to_pfn(ttm_tt_get_page(bo->ttm, dst_offset >> PAGE_SHIFT)); *prot = - (mem->flags & TTM_PL_FLAG_CACHED) ? PAGE_KERNEL : ttm_io_prot(mem-> - flags, + (mem->placement & TTM_PL_FLAG_CACHED) ? PAGE_KERNEL : ttm_io_prot(mem->placement, PAGE_KERNEL); return 0; } @@ -496,7 +495,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, struct ttm_mem_type_manager * man = &bdev->man[new_mem->mem_type]; struct ttm_mem_reg * old_mem = &bo->mem; int ret; - uint32_t save_flags = old_mem->flags; + uint32_t save_flags = old_mem->placement; struct ttm_buffer_object *ghost_obj; if (bo->sync_obj) driver->sync_obj_unref(&bo->sync_obj); @@ -541,6 +540,6 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, *old_mem = *new_mem; new_mem->mm_node = NULL; - ttm_flag_masked(&save_flags, new_mem->flags, TTM_PL_MASK_MEMTYPE); + ttm_flag_masked(&save_flags, new_mem->placement, TTM_PL_MASK_MEMTYPE); return 0; } diff --git a/linux-core/ttm/ttm_bo_vm.c b/linux-core/ttm/ttm_bo_vm.c index c207b77..7df9858 100644 --- a/linux-core/ttm/ttm_bo_vm.c +++ b/linux-core/ttm/ttm_bo_vm.c @@ -158,13 +158,13 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) */ if (is_iomem) { - vma->vm_page_prot = ttm_io_prot(bo->mem.flags, + vma->vm_page_prot = ttm_io_prot(bo->mem.placement, vma->vm_page_prot); } else { ttm = bo->ttm; - vma->vm_page_prot = (bo->mem.flags & TTM_PL_FLAG_CACHED) ? + vma->vm_page_prot = (bo->mem.placement & TTM_PL_FLAG_CACHED) ? vm_get_page_prot(vma->vm_flags) : - ttm_io_prot(bo->mem.flags, vma->vm_page_prot); + ttm_io_prot(bo->mem.placement, vma->vm_page_prot); } /* @@ -307,13 +307,13 @@ static unsigned long ttm_bo_vm_nopfn(struct vm_area_struct *vma, */ if (is_iomem) { - vma->vm_page_prot = ttm_io_prot(bo->mem.flags, + vma->vm_page_prot = ttm_io_prot(bo->mem.placement, vma->vm_page_prot); } else { ttm = bo->ttm; - vma->vm_page_prot = (bo->mem.flags & TTM_PL_FLAG_CACHED) ? + vma->vm_page_prot = (bo->mem.placement & TTM_PL_FLAG_CACHED) ? vm_get_page_prot(vma->vm_flags) : - ttm_io_prot(bo->mem.flags, vma->vm_page_prot); + ttm_io_prot(bo->mem.placement, vma->vm_page_prot); } /* diff --git a/linux-core/ttm/ttm_placement_user.c b/linux-core/ttm/ttm_placement_user.c index e162b9c..87df2c7 100644 --- a/linux-core/ttm/ttm_placement_user.c +++ b/linux-core/ttm/ttm_placement_user.c @@ -142,7 +142,7 @@ static void ttm_pl_fill_rep(struct ttm_buffer_object *bo, rep->gpu_offset = bo->offset; rep->bo_size = bo->num_pages << PAGE_SHIFT; rep->map_handle = bo->addr_space_offset; - rep->placement = bo->mem.flags; + rep->placement = bo->mem.placement; rep->handle = user_bo->base.hash.key; rep->sync_object_arg = (uint32_t) (unsigned long)bo->sync_obj_arg; } @@ -403,9 +403,9 @@ int ttm_pl_setstatus_ioctl(struct ttm_object_file *tfile, if (unlikely(ret != 0)) goto out_err2; - bo->proposed_flags = (bo->proposed_flags | req->set_placement) + bo->proposed_placement = (bo->proposed_placement | req->set_placement) & ~req->clr_placement; - ret = ttm_buffer_object_validate(bo, bo->proposed_flags, true, false); + ret = ttm_buffer_object_validate(bo, bo->proposed_placement, true, false); if (unlikely(ret != 0)) goto out_err2; commit f421b2b10fc49e0197ad5213e31a2a57230062af Author: Thomas Hellstrom <thomas-at-shipmail-dot-org> Date: Mon May 4 15:15:10 2009 +0200 ttm: Remove the struct ttm_mem_reg::proposed_flags member. Signed-off-by: Thomas Hellstrom <thomas-at-shipmail-dot-org> diff --git a/linux-core/openchrome/via_buffer.c b/linux-core/openchrome/via_buffer.c index 57d1d59..84f20e0 100644 --- a/linux-core/openchrome/via_buffer.c +++ b/linux-core/openchrome/via_buffer.c @@ -178,9 +178,6 @@ static int via_move_vram_tt(struct ttm_buffer_object *bo, struct ttm_mem_reg tmp_mem = *old_mem; tmp_mem.mm_node = NULL; - tmp_mem.proposed_flags &= ~TTM_PL_MASK_MEM; - tmp_mem.proposed_flags |= (TTM_PL_FLAG_SYSTEM | - TTM_PL_FLAG_CACHED); tmp_mem.mem_type = TTM_PL_SYSTEM; ret = ttm_bo_move_ttm(bo, evict, no_wait, &tmp_mem); if (ret) @@ -191,9 +188,6 @@ static int via_move_vram_tt(struct ttm_buffer_object *bo, struct ttm_mem_reg tmp_mem = *new_mem; tmp_mem.mm_node = NULL; - tmp_mem.proposed_flags &= ~TTM_PL_MASK_MEM; - tmp_mem.proposed_flags |= (TTM_PL_FL... [truncated message content] |