aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/ttm_object.h
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2018-09-26 15:50:13 +0200
committerThomas Hellstrom <thellstrom@vmware.com>2018-09-27 16:14:18 +0200
commitc7eae62666ade1c8c9960085911e420227144d5a (patch)
tree0013d1212a78270d4d112911ace94bdcbfe1a3bf /drivers/gpu/drm/vmwgfx/ttm_object.h
parentdrm/vmwgfx: Remove the user resource destructor check (diff)
downloadlinux-dev-c7eae62666ade1c8c9960085911e420227144d5a.tar.xz
linux-dev-c7eae62666ade1c8c9960085911e420227144d5a.zip
drm/vmwgfx: Make the object handles idr-generated
Instead of generating user-space object handles based on a, possibly processed, hash of the kernel address of the object, use idr to generate and lookup those handles. This might improve somewhat on security since we loose all connections to the object's kernel address. Also idr is designed to do just this. As a todo-item, since user-space handles are now generated in sequence, we can probably use a much simpler hash function to hash them. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/ttm_object.h')
-rw-r--r--drivers/gpu/drm/vmwgfx/ttm_object.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/gpu/drm/vmwgfx/ttm_object.h b/drivers/gpu/drm/vmwgfx/ttm_object.h
index 1c1b9cc118f8..7aa213f5d677 100644
--- a/drivers/gpu/drm/vmwgfx/ttm_object.h
+++ b/drivers/gpu/drm/vmwgfx/ttm_object.h
@@ -124,14 +124,14 @@ struct ttm_object_device;
struct ttm_base_object {
struct rcu_head rhead;
- struct drm_hash_item hash;
- enum ttm_object_type object_type;
- bool shareable;
struct ttm_object_file *tfile;
struct kref refcount;
void (*refcount_release) (struct ttm_base_object **base);
void (*ref_obj_release) (struct ttm_base_object *base,
enum ttm_ref_type ref_type);
+ u32 handle;
+ enum ttm_object_type object_type;
+ u32 shareable;
};
@@ -350,4 +350,11 @@ extern int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,
#define ttm_prime_object_kfree(__obj, __prime) \
kfree_rcu(__obj, __prime.base.rhead)
+
+/*
+ * Extra memory required by the base object's idr storage, which is allocated
+ * separately from the base object itself. We estimate an on-average 128 bytes
+ * per idr.
+ */
+#define TTM_OBJ_EXTRA_SIZE 128
#endif