diff mbox series

[v4,14/15] drm/vma: Add a driver_private member to vma_node.

Message ID 20210526113259.1661914-15-thomas.hellstrom@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Move LMEM (VRAM) management over to TTM | expand

Commit Message

Thomas Hellstrom May 26, 2021, 11:32 a.m. UTC
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

This allows drivers to distinguish between different types of vma_node's.
The readonly flag was unused and is thus removed.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/drm_gem.c     | 9 ---------
 include/drm/drm_vma_manager.h | 2 +-
 2 files changed, 1 insertion(+), 10 deletions(-)

Comments

Thomas Hellström (Intel) May 27, 2021, 8:16 a.m. UTC | #1
Hi Maarten,

On 5/26/21 1:32 PM, Thomas Hellström wrote:
> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>
> This allows drivers to distinguish between different types of vma_node's.
> The readonly flag was unused and is thus removed.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>

This one was acked by danvet on IRC, but he wanted a more verbose commit 
message stating that it would be temporary until all mmap-capable gem 
obj backends could be moved over to TTM for discrete.

/Thomas


> ---
>   drivers/gpu/drm/drm_gem.c     | 9 ---------
>   include/drm/drm_vma_manager.h | 2 +-
>   2 files changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index 9989425e9875..e710e79069f6 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -1149,15 +1149,6 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
>   		return -EACCES;
>   	}
>   
> -	if (node->readonly) {
> -		if (vma->vm_flags & VM_WRITE) {
> -			drm_gem_object_put(obj);
> -			return -EINVAL;
> -		}
> -
> -		vma->vm_flags &= ~VM_MAYWRITE;
> -	}
> -
>   	ret = drm_gem_mmap_obj(obj, drm_vma_node_size(node) << PAGE_SHIFT,
>   			       vma);
>   
> diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h
> index 76ac5e97a559..4f8c35206f7c 100644
> --- a/include/drm/drm_vma_manager.h
> +++ b/include/drm/drm_vma_manager.h
> @@ -53,7 +53,7 @@ struct drm_vma_offset_node {
>   	rwlock_t vm_lock;
>   	struct drm_mm_node vm_node;
>   	struct rb_root vm_files;
> -	bool readonly:1;
> +	void *driver_private;
>   };
>   
>   struct drm_vma_offset_manager {
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 9989425e9875..e710e79069f6 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -1149,15 +1149,6 @@  int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
 		return -EACCES;
 	}
 
-	if (node->readonly) {
-		if (vma->vm_flags & VM_WRITE) {
-			drm_gem_object_put(obj);
-			return -EINVAL;
-		}
-
-		vma->vm_flags &= ~VM_MAYWRITE;
-	}
-
 	ret = drm_gem_mmap_obj(obj, drm_vma_node_size(node) << PAGE_SHIFT,
 			       vma);
 
diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h
index 76ac5e97a559..4f8c35206f7c 100644
--- a/include/drm/drm_vma_manager.h
+++ b/include/drm/drm_vma_manager.h
@@ -53,7 +53,7 @@  struct drm_vma_offset_node {
 	rwlock_t vm_lock;
 	struct drm_mm_node vm_node;
 	struct rb_root vm_files;
-	bool readonly:1;
+	void *driver_private;
 };
 
 struct drm_vma_offset_manager {