Commit 56b3d204 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/ttm: make the device list mutex static

This way it can protect the whole BO global state.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarJunwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 27eb1fa9
...@@ -45,6 +45,11 @@ ...@@ -45,6 +45,11 @@
static void ttm_bo_global_kobj_release(struct kobject *kobj); static void ttm_bo_global_kobj_release(struct kobject *kobj);
/**
* ttm_global_mutex - protecting the global BO state
*/
DEFINE_MUTEX(ttm_global_mutex);
static struct attribute ttm_bo_count = { static struct attribute ttm_bo_count = {
.name = "bo_count", .name = "bo_count",
.mode = S_IRUGO .mode = S_IRUGO
...@@ -1539,7 +1544,6 @@ int ttm_bo_global_init(struct ttm_bo_global *glob) ...@@ -1539,7 +1544,6 @@ int ttm_bo_global_init(struct ttm_bo_global *glob)
if (ret) if (ret)
return ret; return ret;
mutex_init(&glob->device_list_mutex);
spin_lock_init(&glob->lru_lock); spin_lock_init(&glob->lru_lock);
glob->mem_glob = &ttm_mem_glob; glob->mem_glob = &ttm_mem_glob;
glob->mem_glob->bo_glob = glob; glob->mem_glob->bo_glob = glob;
...@@ -1587,9 +1591,9 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev) ...@@ -1587,9 +1591,9 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev)
} }
} }
mutex_lock(&glob->device_list_mutex); mutex_lock(&ttm_global_mutex);
list_del(&bdev->device_list); list_del(&bdev->device_list);
mutex_unlock(&glob->device_list_mutex); mutex_unlock(&ttm_global_mutex);
cancel_delayed_work_sync(&bdev->wq); cancel_delayed_work_sync(&bdev->wq);
...@@ -1636,9 +1640,9 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev, ...@@ -1636,9 +1640,9 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,
bdev->dev_mapping = mapping; bdev->dev_mapping = mapping;
bdev->glob = glob; bdev->glob = glob;
bdev->need_dma32 = need_dma32; bdev->need_dma32 = need_dma32;
mutex_lock(&glob->device_list_mutex); mutex_lock(&ttm_global_mutex);
list_add_tail(&bdev->device_list, &glob->device_list); list_add_tail(&bdev->device_list, &glob->device_list);
mutex_unlock(&glob->device_list_mutex); mutex_unlock(&ttm_global_mutex);
return 0; return 0;
out_no_sys: out_no_sys:
......
...@@ -407,7 +407,6 @@ struct ttm_bo_global { ...@@ -407,7 +407,6 @@ struct ttm_bo_global {
struct kobject kobj; struct kobject kobj;
struct ttm_mem_global *mem_glob; struct ttm_mem_global *mem_glob;
struct page *dummy_read_page; struct page *dummy_read_page;
struct mutex device_list_mutex;
spinlock_t lru_lock; spinlock_t lru_lock;
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment