mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-20 10:30:11 +01:00
ttm: Fix up printouts.
Signed-off-by: Thomas Hellstrom <thomas-at-shipmail-dot-org>
This commit is contained in:
parent
9d0f33b178
commit
c060b56467
11 changed files with 64 additions and 66 deletions
|
|
@ -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);
|
ret = agp_bind_memory(mem, bo_mem->mm_node->start);
|
||||||
if (ret)
|
if (ret)
|
||||||
printk(KERN_ERR "AGP Bind memory failed.\n");
|
printk(KERN_ERR TTM_PFX "AGP Bind memory failed.\n");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo)
|
||||||
ttm_tt_destroy(bo->ttm);
|
ttm_tt_destroy(bo->ttm);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk(KERN_ERR "Illegal buffer object type\n");
|
printk(KERN_ERR TTM_PFX "Illegal buffer object type\n");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -316,7 +316,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
|
||||||
if (bo->evicted) {
|
if (bo->evicted) {
|
||||||
ret = bdev->driver->invalidate_caches(bdev, bo->mem.placement);
|
ret = bdev->driver->invalidate_caches(bdev, bo->mem.placement);
|
||||||
if (ret)
|
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;
|
bo->evicted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -523,7 +523,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, unsigned mem_type,
|
||||||
spin_unlock(&bo->lock);
|
spin_unlock(&bo->lock);
|
||||||
|
|
||||||
if (ret && ret != -ERESTART) {
|
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");
|
"buffer eviction.\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -543,7 +543,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, unsigned mem_type,
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (ret != -ERESTART)
|
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);
|
"buffer 0x%p eviction.\n", bo);
|
||||||
goto out;
|
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);
|
ret = ttm_bo_handle_move_mem(bo, &evict_mem, true, interruptible, no_wait);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (ret != -ERESTART)
|
if (ret != -ERESTART)
|
||||||
printk(KERN_ERR "Buffer eviction failed\n");
|
printk(KERN_ERR TTM_PFX "Buffer eviction failed\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -880,11 +880,11 @@ int ttm_buffer_object_validate(struct ttm_buffer_object *bo,
|
||||||
interruptible, no_wait);
|
interruptible, no_wait);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (ret != -ERESTART)
|
if (ret != -ERESTART)
|
||||||
printk(KERN_ERR "Failed moving buffer. "
|
printk(KERN_ERR TTM_PFX "Failed moving buffer. "
|
||||||
"Proposed placement 0x%08x\n",
|
"Proposed placement 0x%08x\n",
|
||||||
bo->proposed_placement);
|
bo->proposed_placement);
|
||||||
if (ret == -ENOMEM)
|
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");
|
"DRM memory quota.\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -918,21 +918,21 @@ ttm_bo_check_placement(struct ttm_buffer_object *bo,
|
||||||
uint32_t new_mask = set_flags | clr_flags;
|
uint32_t new_mask = set_flags | clr_flags;
|
||||||
|
|
||||||
if ((bo->type == ttm_bo_type_user) && (clr_flags & TTM_PL_FLAG_CACHED)) {
|
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");
|
"User buffers require cache-coherent memory.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!capable(CAP_SYS_ADMIN)) {
|
if (!capable(CAP_SYS_ADMIN)) {
|
||||||
if (new_mask & TTM_PL_FLAG_NO_EVICT) {
|
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");
|
" NO_EVICT status.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((clr_flags & bo->mem.placement & TTM_PL_MASK_MEMTYPE) &&
|
if ((clr_flags & bo->mem.placement & TTM_PL_MASK_MEMTYPE) &&
|
||||||
(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) {
|
(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");
|
" for NO_EVICT buffer.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
@ -958,7 +958,7 @@ int ttm_buffer_object_init(struct ttm_bo_device *bdev,
|
||||||
size += buffer_start & ~PAGE_MASK;
|
size += buffer_start & ~PAGE_MASK;
|
||||||
num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||||
if (num_pages == 0) {
|
if (num_pages == 0) {
|
||||||
printk(KERN_ERR "Illegal buffer object size.\n");
|
printk(KERN_ERR TTM_PFX "Illegal buffer object size.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
bo->destroy = destroy;
|
bo->destroy = destroy;
|
||||||
|
|
@ -1088,7 +1088,7 @@ static int ttm_bo_leave_list(struct ttm_buffer_object *bo,
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
ret = 0;
|
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;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
if (mem_type >= TTM_NUM_MEM_TYPES) {
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!man->has_type) {
|
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);
|
"memory manager type %u\n", mem_type);
|
||||||
return ret;
|
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];
|
struct ttm_mem_type_manager *man = &bdev->man[mem_type];
|
||||||
|
|
||||||
if (mem_type == 0 || mem_type >= TTM_NUM_MEM_TYPES) {
|
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);
|
mem_type);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!man->has_type) {
|
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);
|
mem_type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1191,13 +1191,13 @@ int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
|
||||||
struct ttm_mem_type_manager *man;
|
struct ttm_mem_type_manager *man;
|
||||||
|
|
||||||
if (type >= TTM_NUM_MEM_TYPES) {
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
man = &bdev->man[type];
|
man = &bdev->man[type];
|
||||||
if (man->has_type) {
|
if (man->has_type) {
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR TTM_PFX
|
||||||
"Memory manager already initialized for type %d\n",
|
"Memory manager already initialized for type %d\n",
|
||||||
type);
|
type);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -1210,7 +1210,7 @@ int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if (type != TTM_PL_SYSTEM) {
|
if (type != TTM_PL_SYSTEM) {
|
||||||
if (!p_size) {
|
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);
|
type);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -1239,7 +1239,7 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev)
|
||||||
man->use_type = false;
|
man->use_type = false;
|
||||||
if ((i != TTM_PL_SYSTEM) && ttm_bo_clean_mm(bdev, i)) {
|
if ((i != TTM_PL_SYSTEM) && ttm_bo_clean_mm(bdev, i)) {
|
||||||
ret = -EBUSY;
|
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);
|
"is not clean.\n", i);
|
||||||
}
|
}
|
||||||
man->has_type = false;
|
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);
|
ttm_mem_init_shrink(&bdev->shrink, ttm_bo_swapout);
|
||||||
ret = ttm_mem_register_shrink(mem_glob, &bdev->shrink);
|
ret = ttm_mem_register_shrink(mem_glob, &bdev->shrink);
|
||||||
if (unlikely(ret != 0)) {
|
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;
|
goto out_err2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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,
|
ret = ttm_bo_pci_offset(bdev, &bo->mem, &bus_base, &bus_offset,
|
||||||
&bus_size);
|
&bus_size);
|
||||||
if (unlikely(ret != 0)) {
|
if (unlikely(ret != 0)) {
|
||||||
printk(KERN_ERR "Attempted buffer object access "
|
printk(KERN_ERR TTM_PFX "Attempted buffer object access "
|
||||||
"of unmappable object.\n");
|
"of unmappable object.\n");
|
||||||
retval = NOPFN_SIGBUS;
|
retval = NOPFN_SIGBUS;
|
||||||
goto out_unlock;
|
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;
|
bo->vm_node->start - vma->vm_pgoff;
|
||||||
|
|
||||||
if (unlikely(page_offset >= bo->num_pages)) {
|
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");
|
"outside object.\n");
|
||||||
retval = NOPFN_SIGBUS;
|
retval = NOPFN_SIGBUS;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
@ -408,7 +408,7 @@ int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
|
||||||
read_unlock(&bdev->vm_lock);
|
read_unlock(&bdev->vm_lock);
|
||||||
|
|
||||||
if (unlikely(bo == NULL)) {
|
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;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,7 @@
|
||||||
#include <linux/wait.h>
|
#include <linux/wait.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
|
|
||||||
#include "drmP.h"
|
#define TTM_PFX "[TTM] "
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Simple implementation for now.
|
* 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);
|
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",
|
"fence type 0x%08x\n",
|
||||||
(unsigned int)fence->fence_class, (unsigned int)mask);
|
(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)
|
if (&fence->ring == &fc->ring)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
DRM_DEBUG("Fence 0x%08lx, sequence 0x%08x, type 0x%08x\n",
|
|
||||||
(unsigned long)fence, fence->sequence,
|
|
||||||
fence->fence_type);
|
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
fence->info.error = error;
|
fence->info.error = error;
|
||||||
fence->info.signaled_types = fence->fence_type;
|
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) {
|
if (new_type) {
|
||||||
fence->info.signaled_types |= 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))
|
if (unlikely(driver->signaled))
|
||||||
driver->signaled(fence);
|
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;
|
fence->waiting_types & ~fence->info.signaled_types;
|
||||||
|
|
||||||
if (!(fence->fence_type & ~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);
|
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;
|
bool call_flush;
|
||||||
|
|
||||||
if (type & ~fence->fence_type) {
|
if (type & ~fence->fence_type) {
|
||||||
DRM_ERROR("Flush trying to extend fence type, "
|
printk(KERN_ERR TTM_PFX "Flush trying to extend fence type, "
|
||||||
"0x%x, 0x%x\n", type, fence->fence_type);
|
"0x%x, 0x%x\n", type, fence->fence_type);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -342,8 +331,8 @@ int ttm_fence_object_wait(struct ttm_fence_object *fence,
|
||||||
unsigned long to_jiffies;
|
unsigned long to_jiffies;
|
||||||
|
|
||||||
if (mask & ~fence->fence_type) {
|
if (mask & ~fence->fence_type) {
|
||||||
DRM_ERROR("Wait trying to extend fence type"
|
printk(KERN_ERR TTM_PFX "Wait trying to extend fence type"
|
||||||
" 0x%08x 0x%08x\n", mask, fence->fence_type);
|
" 0x%08x 0x%08x\n", mask, fence->fence_type);
|
||||||
BUG();
|
BUG();
|
||||||
return -EINVAL;
|
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);
|
ret = ttm_mem_global_alloc(fdev->mem_glob, sizeof(*fence), false, false, false);
|
||||||
if (unlikely(ret != 0)) {
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
fence = kmalloc(sizeof(*fence), GFP_KERNEL);
|
fence = kmalloc(sizeof(*fence), GFP_KERNEL);
|
||||||
if (!fence) {
|
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);
|
ttm_mem_global_free(fdev->mem_glob, sizeof(*fence), false);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,14 +60,14 @@ static struct ttm_fence_user_object *ttm_fence_user_object_lookup(struct
|
||||||
|
|
||||||
base = ttm_base_object_lookup(tfile, handle);
|
base = ttm_base_object_lookup(tfile, handle);
|
||||||
if (unlikely(base == NULL)) {
|
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);
|
(unsigned long)handle);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(base->object_type != ttm_fence_type)) {
|
if (unlikely(base->object_type != ttm_fence_type)) {
|
||||||
ttm_base_object_unref(&base);
|
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);
|
(unsigned long)handle);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
#include <linux/wait.h>
|
#include <linux/wait.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
|
|
||||||
|
#define TTM_PFX "[TTM] "
|
||||||
#define TTM_MEMORY_ALLOC_RETRIES 4
|
#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);
|
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);
|
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);
|
glob->max_memory >> 20);
|
||||||
|
|
||||||
return 0;
|
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)
|
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);
|
(unsigned long long)glob->used_total_memory);
|
||||||
flush_workqueue(glob->swap_queue);
|
flush_workqueue(glob->swap_queue);
|
||||||
destroy_workqueue(glob->swap_queue);
|
destroy_workqueue(glob->swap_queue);
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@
|
||||||
* and release on file close.
|
* and release on file close.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define TTM_PFX "[TTM] "
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct ttm_object_file
|
* struct ttm_object_file
|
||||||
*
|
*
|
||||||
|
|
@ -126,7 +128,6 @@ static void ttm_object_file_destroy(struct kref *kref)
|
||||||
struct ttm_object_file *tfile =
|
struct ttm_object_file *tfile =
|
||||||
container_of(kref, struct ttm_object_file, refcount);
|
container_of(kref, struct ttm_object_file, refcount);
|
||||||
|
|
||||||
printk(KERN_INFO "Freeing 0x%08lx\n", (unsigned long) tfile);
|
|
||||||
kfree(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_base_object *base = *p_base;
|
||||||
struct ttm_object_device *tdev = base->tfile->tdev;
|
struct ttm_object_device *tdev = base->tfile->tdev;
|
||||||
|
|
||||||
// printk(KERN_INFO "TTM base object unref.\n");
|
|
||||||
*p_base = NULL;
|
*p_base = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -232,7 +232,7 @@ struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (tfile != base->tfile && !base->shareable) {
|
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);
|
ttm_base_object_unref(&base);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@
|
||||||
#include <linux/notifier.h>
|
#include <linux/notifier.h>
|
||||||
#include <linux/cpu.h>
|
#include <linux/cpu.h>
|
||||||
|
|
||||||
|
#define TTM_PFX "[TTM] "
|
||||||
|
|
||||||
#ifndef MSR_IA32_CR_PAT
|
#ifndef MSR_IA32_CR_PAT
|
||||||
#define MSR_IA32_CR_PAT 0x0277
|
#define MSR_IA32_CR_PAT 0x0277
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -77,7 +79,7 @@ static void ttm_pat_enable(void)
|
||||||
#else
|
#else
|
||||||
if (on_each_cpu(ttm_pat_ipi_handler, NULL, 1) != 0) {
|
if (on_each_cpu(ttm_pat_ipi_handler, NULL, 1) != 0) {
|
||||||
#endif
|
#endif
|
||||||
printk(KERN_ERR "Timed out setting up CPU PAT.\n");
|
printk(KERN_ERR TTM_PFX "Timed out setting up CPU PAT.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,4 +91,10 @@
|
||||||
#define TTM_ACCESS_READ (1 << 0)
|
#define TTM_ACCESS_READ (1 << 0)
|
||||||
#define TTM_ACCESS_WRITE (1 << 1)
|
#define TTM_ACCESS_WRITE (1 << 1)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log message prefix.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define TTM_PFX "[TTM] "
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -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);
|
base = ttm_base_object_lookup(tfile, handle);
|
||||||
if (unlikely(base == NULL)) {
|
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);
|
(unsigned long)handle);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(base->object_type != ttm_buffer_type)) {
|
if (unlikely(base->object_type != ttm_buffer_type)) {
|
||||||
ttm_base_object_unref(&base);
|
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);
|
(unsigned long)handle);
|
||||||
return NULL;
|
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);
|
user_bo = ttm_bo_user_lookup(tfile, arg->req.handle);
|
||||||
if (unlikely(user_bo == NULL)) {
|
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;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bo = &user_bo->bo;
|
bo = &user_bo->bo;
|
||||||
ret = ttm_ref_object_add(tfile, &user_bo->base, TTM_REF_USAGE, NULL);
|
ret = ttm_ref_object_add(tfile, &user_bo->base, TTM_REF_USAGE, NULL);
|
||||||
if (unlikely(ret != 0)) {
|
if (unlikely(ret != 0)) {
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR TTM_PFX
|
||||||
"Could not add a reference to buffer object.\n");
|
"Could not add a reference to buffer object.\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -332,7 +332,7 @@ int ttm_pl_synccpu_ioctl(struct ttm_object_file *tfile, void *data)
|
||||||
case TTM_PL_SYNCCPU_OP_GRAB:
|
case TTM_PL_SYNCCPU_OP_GRAB:
|
||||||
user_bo = ttm_bo_user_lookup(tfile, arg->handle);
|
user_bo = ttm_bo_user_lookup(tfile, arg->handle);
|
||||||
if (unlikely(user_bo == NULL)) {
|
if (unlikely(user_bo == NULL)) {
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR TTM_PFX
|
||||||
"Could not find buffer object for synccpu.\n");
|
"Could not find buffer object for synccpu.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
@ -375,7 +375,7 @@ int ttm_pl_setstatus_ioctl(struct ttm_object_file *tfile,
|
||||||
|
|
||||||
bo = ttm_buffer_object_lookup(tfile, req->handle);
|
bo = ttm_buffer_object_lookup(tfile, req->handle);
|
||||||
if (unlikely(bo == NULL)) {
|
if (unlikely(bo == NULL)) {
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR TTM_PFX
|
||||||
"Could not find buffer object for setstatus.\n");
|
"Could not find buffer object for setstatus.\n");
|
||||||
return -EINVAL;
|
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);
|
bo = ttm_buffer_object_lookup(tfile, arg->handle);
|
||||||
if (unlikely(bo == NULL)) {
|
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;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (on_each_cpu(ttm_tt_ipi_handler, NULL, 1, 1) != 0)
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -341,7 +341,7 @@ static void ttm_tt_free_alloced_pages(struct ttm_tt *ttm)
|
||||||
ttm->pages[i] = NULL;
|
ttm->pages[i] = NULL;
|
||||||
if (cur_page) {
|
if (cur_page) {
|
||||||
if (page_count(cur_page) != 1)
|
if (page_count(cur_page) != 1)
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR TTM_PFX
|
||||||
"Erroneous page count. Leaking pages.\n");
|
"Erroneous page count. Leaking pages.\n");
|
||||||
ttm_mem_global_free(ttm->bdev->mem_glob, PAGE_SIZE,
|
ttm_mem_global_free(ttm->bdev->mem_glob, PAGE_SIZE,
|
||||||
PageHighMem(cur_page));
|
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);
|
ttm_tt_alloc_page_directory(ttm);
|
||||||
if (!ttm->pages) {
|
if (!ttm->pages) {
|
||||||
ttm_tt_destroy(ttm);
|
ttm_tt_destroy(ttm);
|
||||||
printk(KERN_ERR "Failed allocating page table\n");
|
printk(KERN_ERR TTM_PFX "Failed allocating page table\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ttm->be = bo_driver->create_ttm_backend_entry(bdev);
|
ttm->be = bo_driver->create_ttm_backend_entry(bdev);
|
||||||
if (!ttm->be) {
|
if (!ttm->be) {
|
||||||
ttm_tt_destroy(ttm);
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
ttm->state = tt_unpopulated;
|
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);
|
ret = be->func->bind(be, bo_mem);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printk(KERN_ERR "Couldn't bind backend.\n");
|
printk(KERN_ERR TTM_PFX "Couldn't bind backend.\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -587,7 +587,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage)
|
||||||
ttm->num_pages << PAGE_SHIFT,
|
ttm->num_pages << PAGE_SHIFT,
|
||||||
0);
|
0);
|
||||||
if (unlikely(IS_ERR(swap_storage))) {
|
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;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue