amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Zack Rusin <zackr@vmware.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
	alexander.deucher@amd.com, christian.koenig@amd.com,
	airlied@linux.ie, daniel@ffwll.ch, bskeggs@redhat.com,
	ray.huang@amd.com, linux-graphics-maintainer@vmware.com,
	sroland@vmware.com, shashank.sharma@amd.com, sam@ravnborg.org,
	emil.velikov@collabora.com, Felix.Kuehling@amd.com,
	nirmoy.das@amd.com
Cc: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 7/8] drm/vmwgfx: Inline vmw_verify_access()
Date: Wed, 7 Apr 2021 12:52:57 -0400	[thread overview]
Message-ID: <e9e0dc6a-31ef-14fc-c094-c7dd5d5292d2@vmware.com> (raw)
In-Reply-To: <20210406090903.7019-8-tzimmermann@suse.de>

On 4/6/21 5:09 AM, Thomas Zimmermann wrote:
> Vmwgfx is the only user of the TTM's verify_access callback. Inline
> the call and avoid the indirection through the function pointer.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>   drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 9 ---------
>   drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c   | 7 ++-----
>   2 files changed, 2 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
> index 2dc031fe4a90..a079734f9d68 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
> @@ -658,14 +658,6 @@ static void vmw_evict_flags(struct ttm_buffer_object *bo,
>   	*placement = vmw_sys_placement;
>   }
>   
> -static int vmw_verify_access(struct ttm_buffer_object *bo, struct file *filp)
> -{
> -	struct ttm_object_file *tfile =
> -		vmw_fpriv((struct drm_file *)filp->private_data)->tfile;
> -
> -	return vmw_user_bo_verify_access(bo, tfile);
> -}
> -
>   static int vmw_ttm_io_mem_reserve(struct ttm_device *bdev, struct ttm_resource *mem)
>   {
>   	struct vmw_private *dev_priv = container_of(bdev, struct vmw_private, bdev);
> @@ -768,7 +760,6 @@ struct ttm_device_funcs vmw_bo_driver = {
>   	.eviction_valuable = ttm_bo_eviction_valuable,
>   	.evict_flags = vmw_evict_flags,
>   	.move = vmw_move,
> -	.verify_access = vmw_verify_access,
>   	.swap_notify = vmw_swap_notify,
>   	.io_mem_reserve = &vmw_ttm_io_mem_reserve,
>   };
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
> index 3eaad00668f2..2574d4707407 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
> @@ -65,6 +65,7 @@ int vmw_mmap(struct file *filp, struct vm_area_struct *vma)
>   	};
>   	struct drm_file *file_priv = filp->private_data;
>   	struct vmw_private *dev_priv = vmw_priv(file_priv->minor->dev);
> +	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
>   	struct ttm_device *bdev = &dev_priv->bdev;
>   	struct ttm_buffer_object *bo;
>   	int ret;
> @@ -76,11 +77,7 @@ int vmw_mmap(struct file *filp, struct vm_area_struct *vma)
>   	if (unlikely(!bo))
>   		return -EINVAL;
>   
> -	if (unlikely(!bo->bdev->funcs->verify_access)) {
> -		ret = -EPERM;
> -		goto out_unref;
> -	}
> -	ret = bo->bdev->funcs->verify_access(bo, filp);
> +	ret = vmw_user_bo_verify_access(bo, tfile);
>   	if (unlikely(ret != 0))
>   		goto out_unref;
>   

Looks great.

Reviewed-by: Zack Rusin <zackr@vmware.com>

z

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2021-04-07 16:53 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06  9:08 [PATCH 0/8] drm: Clean up mmap for TTM-based GEM drivers Thomas Zimmermann
2021-04-06  9:08 ` [PATCH 1/8] drm/ttm: Don't override vm_ops callbacks, if set Thomas Zimmermann
2021-04-06  9:08 ` [PATCH 2/8] drm/amdgpu: Remove unused function amdgpu_bo_fbdev_mmap() Thomas Zimmermann
2021-04-06  9:43   ` Christian König
2021-04-06 10:21     ` Thomas Zimmermann
2021-04-06  9:08 ` [PATCH 3/8] drm/amdgpu: Implement mmap as GEM object function Thomas Zimmermann
2021-04-06  9:35   ` Christian König
2021-04-06 10:38     ` Thomas Zimmermann
2021-04-06 10:56       ` Christian König
2021-04-06 11:55         ` Thomas Zimmermann
2021-04-06 12:42           ` Christian König
2021-04-06 12:52             ` Thomas Zimmermann
2021-04-06 13:04               ` Christian König
2021-04-06 15:22                 ` Felix Kuehling
2021-04-06 15:27       ` Felix Kuehling
2021-04-07 11:25         ` Christian König
2021-04-07 19:34           ` Felix Kuehling
2021-04-07 19:49             ` Felix Kuehling
2021-04-08  4:45               ` Thomas Zimmermann
2021-04-14  7:44               ` Thomas Zimmermann
2021-04-14  8:37                 ` Felix Kuehling
2021-04-06  9:08 ` [PATCH 4/8] drm/radeon: " Thomas Zimmermann
2021-04-06  9:38   ` Christian König
2021-04-06 14:18   ` Alex Deucher
2021-04-06  9:09 ` [PATCH 5/8] drm/nouveau: " Thomas Zimmermann
2021-04-06  9:09 ` [PATCH 6/8] drm/vmwgfx: Inline ttm_bo_mmap() into vmwgfx driver Thomas Zimmermann
2021-04-07 16:52   ` Zack Rusin
2021-04-06  9:09 ` [PATCH 7/8] drm/vmwgfx: Inline vmw_verify_access() Thomas Zimmermann
2021-04-07 16:52   ` Zack Rusin [this message]
2021-04-06  9:09 ` [PATCH 8/8] drm/ttm: Remove ttm_bo_mmap() and friends Thomas Zimmermann
2021-04-06  9:40   ` Christian König
2021-04-08 11:19 ` [PATCH 0/8] drm: Clean up mmap for TTM-based GEM drivers Daniel Vetter
2021-04-08 11:38   ` Thomas Zimmermann
2021-04-08 11:42     ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e9e0dc6a-31ef-14fc-c094-c7dd5d5292d2@vmware.com \
    --to=zackr@vmware.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=bskeggs@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.velikov@collabora.com \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=nirmoy.das@amd.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=ray.huang@amd.com \
    --cc=sam@ravnborg.org \
    --cc=shashank.sharma@amd.com \
    --cc=sroland@vmware.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).