]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/ttm, drm/vmwgfx: Move the lock- and object functionality to the vmwgfx driver
authorThomas Hellstrom <thellstrom@vmware.com>
Wed, 26 Sep 2018 18:15:36 +0000 (20:15 +0200)
committerThomas Hellstrom <thellstrom@vmware.com>
Thu, 27 Sep 2018 13:19:20 +0000 (15:19 +0200)
No other driver is using this functionality so move it out of TTM and
into the vmwgfx driver. Update includes and remove exports.
Also annotate to remove false static analyzer lock balance warnings.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
drivers/gpu/drm/ttm/Makefile
drivers/gpu/drm/vmwgfx/Makefile
drivers/gpu/drm/vmwgfx/ttm_lock.c [moved from drivers/gpu/drm/ttm/ttm_lock.c with 95% similarity]
drivers/gpu/drm/vmwgfx/ttm_lock.h [moved from include/drm/ttm/ttm_lock.h with 100% similarity]
drivers/gpu/drm/vmwgfx/ttm_object.c [moved from drivers/gpu/drm/ttm/ttm_object.c with 96% similarity]
drivers/gpu/drm/vmwgfx/ttm_object.h [moved from include/drm/ttm/ttm_object.h with 99% similarity]
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
drivers/gpu/drm/vmwgfx/vmwgfx_prime.c

index a60e560804e0ad3c64c6cf2b632a8c5085b59fde..01fc670ce7a21978881c2603034c84142d943bea 100644 (file)
@@ -4,8 +4,8 @@
 
 ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
        ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
-       ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
-       ttm_bo_manager.o ttm_page_alloc_dma.o
+       ttm_execbuf_util.o ttm_page_alloc.o ttm_bo_manager.o \
+       ttm_page_alloc_dma.o
 ttm-$(CONFIG_AGP) += ttm_agp_backend.o
 
 obj-$(CONFIG_DRM_TTM) += ttm.o
index 09b2aa08363e6b5ca7c13c25a72b4b73d080cdde..22fdc07e03ad348a63af6215c84d544662df0ed3 100644 (file)
@@ -7,6 +7,7 @@ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \
            vmwgfx_surface.o vmwgfx_prime.o vmwgfx_mob.o vmwgfx_shader.o \
            vmwgfx_cmdbuf_res.o vmwgfx_cmdbuf.o vmwgfx_stdu.o \
            vmwgfx_cotable.o vmwgfx_so.o vmwgfx_binding.o vmwgfx_msg.o \
-           vmwgfx_simple_resource.o vmwgfx_va.o vmwgfx_blit.o
+           vmwgfx_simple_resource.o vmwgfx_va.o vmwgfx_blit.o \
+           ttm_object.o ttm_lock.o
 
 obj-$(CONFIG_DRM_VMWGFX) := vmwgfx.o
similarity index 95%
rename from drivers/gpu/drm/ttm/ttm_lock.c
rename to drivers/gpu/drm/vmwgfx/ttm_lock.c
index 20694b8a01cac415581c181f9a4f0005d3517586..0d59f5a19e17c0f82d0be5ffa30eca8faea929ae 100644 (file)
  * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
  */
 
-#include <drm/ttm/ttm_lock.h>
 #include <drm/ttm/ttm_module.h>
 #include <linux/atomic.h>
 #include <linux/errno.h>
 #include <linux/wait.h>
 #include <linux/sched/signal.h>
-#include <linux/module.h>
+#include "ttm_lock.h"
+#include "ttm_object.h"
 
 #define TTM_WRITE_LOCK_PENDING    (1 << 0)
 #define TTM_VT_LOCK_PENDING       (1 << 1)
@@ -52,7 +52,6 @@ void ttm_lock_init(struct ttm_lock *lock)
        lock->kill_takers = false;
        lock->signal = SIGKILL;
 }
-EXPORT_SYMBOL(ttm_lock_init);
 
 void ttm_read_unlock(struct ttm_lock *lock)
 {
@@ -61,7 +60,6 @@ void ttm_read_unlock(struct ttm_lock *lock)
                wake_up_all(&lock->queue);
        spin_unlock(&lock->lock);
 }
-EXPORT_SYMBOL(ttm_read_unlock);
 
 static bool __ttm_read_lock(struct ttm_lock *lock)
 {
@@ -92,7 +90,6 @@ int ttm_read_lock(struct ttm_lock *lock, bool interruptible)
                wait_event(lock->queue, __ttm_read_lock(lock));
        return ret;
 }
-EXPORT_SYMBOL(ttm_read_lock);
 
 static bool __ttm_read_trylock(struct ttm_lock *lock, bool *locked)
 {
@@ -144,7 +141,6 @@ void ttm_write_unlock(struct ttm_lock *lock)
        wake_up_all(&lock->queue);
        spin_unlock(&lock->lock);
 }
-EXPORT_SYMBOL(ttm_write_unlock);
 
 static bool __ttm_write_lock(struct ttm_lock *lock)
 {
@@ -185,7 +181,6 @@ int ttm_write_lock(struct ttm_lock *lock, bool interruptible)
 
        return ret;
 }
-EXPORT_SYMBOL(ttm_write_lock);
 
 static int __ttm_vt_unlock(struct ttm_lock *lock)
 {
@@ -262,14 +257,12 @@ int ttm_vt_lock(struct ttm_lock *lock,
 
        return ret;
 }
-EXPORT_SYMBOL(ttm_vt_lock);
 
 int ttm_vt_unlock(struct ttm_lock *lock)
 {
        return ttm_ref_object_base_unref(lock->vt_holder,
                                         lock->base.hash.key, TTM_REF_USAGE);
 }
-EXPORT_SYMBOL(ttm_vt_unlock);
 
 void ttm_suspend_unlock(struct ttm_lock *lock)
 {
@@ -278,7 +271,6 @@ void ttm_suspend_unlock(struct ttm_lock *lock)
        wake_up_all(&lock->queue);
        spin_unlock(&lock->lock);
 }
-EXPORT_SYMBOL(ttm_suspend_unlock);
 
 static bool __ttm_suspend_lock(struct ttm_lock *lock)
 {
@@ -300,4 +292,3 @@ void ttm_suspend_lock(struct ttm_lock *lock)
 {
        wait_event(lock->queue, __ttm_suspend_lock(lock));
 }
-EXPORT_SYMBOL(ttm_suspend_lock);
similarity index 96%
rename from drivers/gpu/drm/ttm/ttm_object.c
rename to drivers/gpu/drm/vmwgfx/ttm_object.c
index 74f1b1eb1f8ead99fda9955df5c6ade71038fe60..190e2591e1f540c9f6b97a9c84f8a012745f4b18 100644 (file)
 
 #define pr_fmt(fmt) "[TTM] " fmt
 
-#include <drm/ttm/ttm_object.h>
 #include <drm/ttm/ttm_module.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
-#include <linux/module.h>
 #include <linux/atomic.h>
+#include "ttm_object.h"
 
 struct ttm_object_file {
        struct ttm_object_device *tdev;
@@ -194,7 +193,6 @@ int ttm_base_object_init(struct ttm_object_file *tfile,
 out_err0:
        return ret;
 }
-EXPORT_SYMBOL(ttm_base_object_init);
 
 static void ttm_release_base(struct kref *kref)
 {
@@ -225,7 +223,6 @@ void ttm_base_object_unref(struct ttm_base_object **p_base)
 
        kref_put(&base->refcount, ttm_release_base);
 }
-EXPORT_SYMBOL(ttm_base_object_unref);
 
 struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile,
                                               uint32_t key)
@@ -247,7 +244,6 @@ struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile,
 
        return base;
 }
-EXPORT_SYMBOL(ttm_base_object_lookup);
 
 struct ttm_base_object *
 ttm_base_object_lookup_for_ref(struct ttm_object_device *tdev, uint32_t key)
@@ -269,7 +265,6 @@ ttm_base_object_lookup_for_ref(struct ttm_object_device *tdev, uint32_t key)
 
        return base;
 }
-EXPORT_SYMBOL(ttm_base_object_lookup_for_ref);
 
 /**
  * ttm_ref_object_exists - Check whether a caller has a valid ref object
@@ -315,7 +310,6 @@ bool ttm_ref_object_exists(struct ttm_object_file *tfile,
        rcu_read_unlock();
        return false;
 }
-EXPORT_SYMBOL(ttm_ref_object_exists);
 
 int ttm_ref_object_add(struct ttm_object_file *tfile,
                       struct ttm_base_object *base,
@@ -391,9 +385,9 @@ int ttm_ref_object_add(struct ttm_object_file *tfile,
 
        return ret;
 }
-EXPORT_SYMBOL(ttm_ref_object_add);
 
-static void ttm_ref_object_release(struct kref *kref)
+static void __releases(tfile->lock) __acquires(tfile->lock)
+ttm_ref_object_release(struct kref *kref)
 {
        struct ttm_ref_object *ref =
            container_of(kref, struct ttm_ref_object, kref);
@@ -435,7 +429,6 @@ int ttm_ref_object_base_unref(struct ttm_object_file *tfile,
        spin_unlock(&tfile->lock);
        return 0;
 }
-EXPORT_SYMBOL(ttm_ref_object_base_unref);
 
 void ttm_object_file_release(struct ttm_object_file **p_tfile)
 {
@@ -464,7 +457,6 @@ void ttm_object_file_release(struct ttm_object_file **p_tfile)
 
        ttm_object_file_unref(&tfile);
 }
-EXPORT_SYMBOL(ttm_object_file_release);
 
 struct ttm_object_file *ttm_object_file_init(struct ttm_object_device *tdev,
                                             unsigned int hash_order)
@@ -499,7 +491,6 @@ struct ttm_object_file *ttm_object_file_init(struct ttm_object_device *tdev,
 
        return NULL;
 }
-EXPORT_SYMBOL(ttm_object_file_init);
 
 struct ttm_object_device *
 ttm_object_device_init(struct ttm_mem_global *mem_glob,
@@ -530,7 +521,6 @@ ttm_object_device_init(struct ttm_mem_global *mem_glob,
        kfree(tdev);
        return NULL;
 }
-EXPORT_SYMBOL(ttm_object_device_init);
 
 void ttm_object_device_release(struct ttm_object_device **p_tdev)
 {
@@ -542,7 +532,6 @@ void ttm_object_device_release(struct ttm_object_device **p_tdev)
 
        kfree(tdev);
 }
-EXPORT_SYMBOL(ttm_object_device_release);
 
 /**
  * get_dma_buf_unless_doomed - get a dma_buf reference if possible.
@@ -648,7 +637,6 @@ int ttm_prime_fd_to_handle(struct ttm_object_file *tfile,
 
        return ret;
 }
-EXPORT_SYMBOL_GPL(ttm_prime_fd_to_handle);
 
 /**
  * ttm_prime_handle_to_fd - Return a dma_buf fd from a ttm prime object
@@ -739,7 +727,6 @@ int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,
                ttm_base_object_unref(&base);
        return ret;
 }
-EXPORT_SYMBOL_GPL(ttm_prime_handle_to_fd);
 
 /**
  * ttm_prime_object_init - Initialize a ttm_prime_object
@@ -772,4 +759,3 @@ int ttm_prime_object_init(struct ttm_object_file *tfile, size_t size,
                                    ttm_prime_refcount_release,
                                    ref_obj_release);
 }
-EXPORT_SYMBOL(ttm_prime_object_init);
similarity index 99%
rename from include/drm/ttm/ttm_object.h
rename to drivers/gpu/drm/vmwgfx/ttm_object.h
index a98bfeb4239edf09be7d253c09a9211fcdc134c6..1c1b9cc118f89e395af818a1f32d05c484629bda 100644 (file)
@@ -42,8 +42,7 @@
 #include <linux/kref.h>
 #include <linux/rcupdate.h>
 #include <linux/dma-buf.h>
-
-#include "ttm_memory.h"
+#include <drm/ttm/ttm_memory.h>
 
 /**
  * enum ttm_ref_type
index 2dda0334576154ff3c22d56c0a8813dfee375dcd..36e84acee3ea0e6ee015c5245771de7aa375ccde 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <drm/drmP.h>
 #include "vmwgfx_drv.h"
-#include "drm/ttm/ttm_object.h"
+#include "ttm_object.h"
 
 
 /**
index bb6dbbe188358f040c1a1e17425874b9b581e367..d9c178e235b4a1dd76e06c704ce6db067323629c 100644 (file)
@@ -30,9 +30,9 @@
 #include <drm/drmP.h>
 #include "vmwgfx_drv.h"
 #include "vmwgfx_binding.h"
+#include "ttm_object.h"
 #include <drm/ttm/ttm_placement.h>
 #include <drm/ttm/ttm_bo_driver.h>
-#include <drm/ttm/ttm_object.h>
 #include <drm/ttm/ttm_module.h>
 #include <linux/dma_remapping.h>
 
index 1abe21758b0d7523a0b66631f615f55e0d07796a..1aa11c39f07f724e3697da3349299b7eadcad1e2 100644 (file)
 #include <drm/drm_auth.h>
 #include <linux/suspend.h>
 #include <drm/ttm/ttm_bo_driver.h>
-#include <drm/ttm/ttm_object.h>
-#include <drm/ttm/ttm_lock.h>
 #include <drm/ttm/ttm_execbuf_util.h>
 #include <drm/ttm/ttm_module.h>
 #include "vmwgfx_fence.h"
+#include "ttm_object.h"
+#include "ttm_lock.h"
 #include <linux/sync_file.h>
 
 #define VMWGFX_DRIVER_NAME "vmwgfx"
index 0861c821a7fe399540726ec93e54baab5d383152..e420675e8db3ceb19b669fdd1f517dd5f276e899 100644 (file)
@@ -31,8 +31,8 @@
  */
 
 #include "vmwgfx_drv.h"
+#include "ttm_object.h"
 #include <linux/dma-buf.h>
-#include <drm/ttm/ttm_object.h>
 
 /*
  * DMA-BUF attach- and mapping methods. No need to implement