diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-10-21 02:16:54 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-10-21 02:16:54 +0000 |
commit | 262a5f06556dc390956b4227df05be4feea79841 (patch) | |
tree | f5bfc3277eee981d421b1296010d6ec64802bd41 /sys | |
parent | deb4f2e2006d1af20943a8063d60f77db67d0c1a (diff) |
change drm_vma function arguments to take struct drm_file *
reduces the diff to linux 5.7.y
ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/amdgpu_ttm.c | 3 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_gem.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_vma_manager.c | 6 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915/gem/i915_gem_mman.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915/gem/i915_gem_object.c | 2 | ||||
-rw-r--r-- | sys/dev/pci/drm/include/drm/drm_vma_manager.h | 10 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_ttm.c | 3 |
7 files changed, 19 insertions, 17 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_ttm.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_ttm.c index 8014d760f69..de0afe174d1 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_ttm.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_ttm.c @@ -217,6 +217,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp) { struct amdgpu_bo *abo = ttm_to_amdgpu_bo(bo); + struct drm_file *file_priv = (void *)filp; /* * Don't verify access for KFD BOs. They don't have a GEM @@ -227,7 +228,7 @@ static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp) if (amdgpu_ttm_tt_get_usermm(bo->ttm)) return -EPERM; - return drm_vma_node_verify_access(&abo->tbo.base.vma_node, filp); + return drm_vma_node_verify_access(&abo->tbo.base.vma_node, file_priv); } /** diff --git a/sys/dev/pci/drm/drm_gem.c b/sys/dev/pci/drm/drm_gem.c index 73f2794e180..4a47860c1f6 100644 --- a/sys/dev/pci/drm/drm_gem.c +++ b/sys/dev/pci/drm/drm_gem.c @@ -199,7 +199,7 @@ udv_attach_drm(dev_t device, vm_prot_t accessprot, voff_t off, vsize_t size) if (!obj) return NULL; - if (!drm_vma_node_is_allowed(node, filp)) { + if (!drm_vma_node_is_allowed(node, priv)) { drm_gem_object_put_unlocked(obj); return NULL; } @@ -440,7 +440,7 @@ drm_gem_object_release_handle(int id, void *ptr, void *data) dev->driver->gem_close_object(obj, file_priv); drm_gem_remove_prime_handles(obj, file_priv); - drm_vma_node_revoke(&obj->vma_node, file_priv->filp); + drm_vma_node_revoke(&obj->vma_node, file_priv); drm_gem_object_handle_put_unlocked(obj); @@ -584,7 +584,7 @@ drm_gem_handle_create_tail(struct drm_file *file_priv, handle = ret; - ret = drm_vma_node_allow(&obj->vma_node, file_priv->filp); + ret = drm_vma_node_allow(&obj->vma_node, file_priv); if (ret) goto err_remove; @@ -602,7 +602,7 @@ drm_gem_handle_create_tail(struct drm_file *file_priv, return 0; err_revoke: - drm_vma_node_revoke(&obj->vma_node, file_priv->filp); + drm_vma_node_revoke(&obj->vma_node, file_priv); err_remove: spin_lock(&file_priv->table_lock); idr_remove(&file_priv->object_idr, handle); diff --git a/sys/dev/pci/drm/drm_vma_manager.c b/sys/dev/pci/drm/drm_vma_manager.c index 9d80892528d..7b17da77006 100644 --- a/sys/dev/pci/drm/drm_vma_manager.c +++ b/sys/dev/pci/drm/drm_vma_manager.c @@ -260,7 +260,7 @@ EXPORT_SYMBOL(drm_vma_offset_remove); * RETURNS: * 0 on success, negative error code on internal failure (out-of-mem) */ -int drm_vma_node_allow(struct drm_vma_offset_node *node, struct file *tag) +int drm_vma_node_allow(struct drm_vma_offset_node *node, struct drm_file *tag) { struct rb_node **iter; struct rb_node *parent = NULL; @@ -323,7 +323,7 @@ EXPORT_SYMBOL(drm_vma_node_allow); * If @tag is not on the list, nothing is done. */ void drm_vma_node_revoke(struct drm_vma_offset_node *node, - struct file *tag) + struct drm_file *tag) { struct drm_vma_offset_file *entry; struct rb_node *iter; @@ -364,7 +364,7 @@ EXPORT_SYMBOL(drm_vma_node_revoke); * true iff @filp is on the list */ bool drm_vma_node_is_allowed(struct drm_vma_offset_node *node, - struct file *tag) + struct drm_file *tag) { struct drm_vma_offset_file *entry; struct rb_node *iter; diff --git a/sys/dev/pci/drm/i915/gem/i915_gem_mman.c b/sys/dev/pci/drm/i915/gem/i915_gem_mman.c index 3e627edcba6..23423395aa2 100644 --- a/sys/dev/pci/drm/i915/gem/i915_gem_mman.c +++ b/sys/dev/pci/drm/i915/gem/i915_gem_mman.c @@ -911,7 +911,7 @@ insert: GEM_BUG_ON(lookup_mmo(obj, mmap_type) != mmo); out: if (file) - drm_vma_node_allow(&mmo->vma_node, file->filp); + drm_vma_node_allow(&mmo->vma_node, file); return mmo; err: @@ -1240,7 +1240,7 @@ i915_gem_mmap(struct file *filp, vm_prot_t accessprot, node = drm_vma_offset_exact_lookup_locked(dev->vma_offset_manager, off >> PAGE_SHIFT, atop(round_page(size))); - if (node && drm_vma_node_is_allowed(node, filp)) { + if (node && drm_vma_node_is_allowed(node, priv)) { /* * Skip 0-refcnted objects as it is in the process of being * destroyed and will be invalid when the vma manager lock diff --git a/sys/dev/pci/drm/i915/gem/i915_gem_object.c b/sys/dev/pci/drm/i915/gem/i915_gem_object.c index 7511a515a4d..8dd99dc0894 100644 --- a/sys/dev/pci/drm/i915/gem/i915_gem_object.c +++ b/sys/dev/pci/drm/i915/gem/i915_gem_object.c @@ -134,7 +134,7 @@ void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *file) spin_lock(&obj->mmo.lock); rbtree_postorder_for_each_entry_safe(mmo, mn, &obj->mmo.offsets, offset) - drm_vma_node_revoke(&mmo->vma_node, file->filp); + drm_vma_node_revoke(&mmo->vma_node, file); spin_unlock(&obj->mmo.lock); list_for_each_entry_safe(lut, ln, &close, obj_link) { diff --git a/sys/dev/pci/drm/include/drm/drm_vma_manager.h b/sys/dev/pci/drm/include/drm/drm_vma_manager.h index c0b83478bdc..42a848898f2 100644 --- a/sys/dev/pci/drm/include/drm/drm_vma_manager.h +++ b/sys/dev/pci/drm/include/drm/drm_vma_manager.h @@ -45,7 +45,7 @@ struct drm_file; struct drm_vma_offset_file { struct rb_node vm_rb; - struct file *vm_tag; + struct drm_file *vm_tag; unsigned long vm_count; }; @@ -73,11 +73,11 @@ int drm_vma_offset_add(struct drm_vma_offset_manager *mgr, void drm_vma_offset_remove(struct drm_vma_offset_manager *mgr, struct drm_vma_offset_node *node); -int drm_vma_node_allow(struct drm_vma_offset_node *node, struct file *tag); +int drm_vma_node_allow(struct drm_vma_offset_node *node, struct drm_file *tag); void drm_vma_node_revoke(struct drm_vma_offset_node *node, - struct file *tag); + struct drm_file *tag); bool drm_vma_node_is_allowed(struct drm_vma_offset_node *node, - struct file *tag); + struct drm_file *tag); /** * drm_vma_offset_exact_lookup_locked() - Look up node by exact address @@ -240,7 +240,7 @@ static inline void drm_vma_node_unmap(struct drm_vma_offset_node *node, * 0 if access is granted, -EACCES otherwise. */ static inline int drm_vma_node_verify_access(struct drm_vma_offset_node *node, - struct file *tag) + struct drm_file *tag) { return drm_vma_node_is_allowed(node, tag) ? 0 : -EACCES; } diff --git a/sys/dev/pci/drm/radeon/radeon_ttm.c b/sys/dev/pci/drm/radeon/radeon_ttm.c index e20c42a715c..7c116a385d5 100644 --- a/sys/dev/pci/drm/radeon/radeon_ttm.c +++ b/sys/dev/pci/drm/radeon/radeon_ttm.c @@ -186,10 +186,11 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo, static int radeon_verify_access(struct ttm_buffer_object *bo, struct file *filp) { struct radeon_bo *rbo = container_of(bo, struct radeon_bo, tbo); + struct drm_file *file_priv = (void *)filp; if (radeon_ttm_tt_has_userptr(bo->ttm)) return -EPERM; - return drm_vma_node_verify_access(&rbo->tbo.base.vma_node, filp); + return drm_vma_node_verify_access(&rbo->tbo.base.vma_node, file_priv); } static void radeon_move_null(struct ttm_buffer_object *bo, |