<div dir="ltr"><div>They are not outdated, my bad. I went through the locks' code and
saw that they have been updated. But they are probably not necessary
here as most of the drivers do not use any form of locking in their
implementations. The generic implementations drm_gem_dumb_map_offset()
and drm_gem_ttm_dumb_map_offset() do not have any locking mechanisms
either.</div><div><br></div><div>Thanks and regards</div><font color="#888888"><div>Dipam Turkar</div></font></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 15, 2023 at 8:37 PM Dmitry Baryshkov <<a href="mailto:dmitry.baryshkov@linaro.org">dmitry.baryshkov@linaro.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, 15 Nov 2023 at 16:30, Dipam Turkar <<a href="mailto:dipamt1729@gmail.com" target="_blank">dipamt1729@gmail.com</a>> wrote:<br>
><br>
> Make msm use drm_gem_create_map_offset() instead of its custom<br>
> implementation for associating GEM object with a fake offset. Since,<br>
> we already have this generic implementation, we don't need the custom<br>
> implementation and it is better to standardize the code for GEM based<br>
> drivers. This also removes the outdated locking leftovers.<br>
<br>
Why are they outdated?<br>
<br>
><br>
> Signed-off-by: Dipam Turkar <<a href="mailto:dipamt1729@gmail.com" target="_blank">dipamt1729@gmail.com</a>><br>
> ---<br>
> drivers/gpu/drm/msm/msm_drv.c | 2 +-<br>
> drivers/gpu/drm/msm/msm_gem.c | 21 ---------------------<br>
> drivers/gpu/drm/msm/msm_gem.h | 2 --<br>
> 3 files changed, 1 insertion(+), 24 deletions(-)<br>
><br>
> Changes in v2:<br>
> Modify commit message to include the absence of internal locking leftovers<br>
> around allocating a fake offset in msm_gem_mmap_offset() in the generic<br>
> implementation drm_gem_create_map_offset().<br>
><br>
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c<br>
> index a428951ee539..86a15992c717 100644<br>
> --- a/drivers/gpu/drm/msm/msm_drv.c<br>
> +++ b/drivers/gpu/drm/msm/msm_drv.c<br>
> @@ -1085,7 +1085,7 @@ static const struct drm_driver msm_driver = {<br>
> .open = msm_open,<br>
> .postclose = msm_postclose,<br>
> .dumb_create = msm_gem_dumb_create,<br>
> - .dumb_map_offset = msm_gem_dumb_map_offset,<br>
> + .dumb_map_offset = drm_gem_dumb_map_offset,<br>
> .gem_prime_import_sg_table = msm_gem_prime_import_sg_table,<br>
> #ifdef CONFIG_DEBUG_FS<br>
> .debugfs_init = msm_debugfs_init,<br>
> diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c<br>
> index db1e748daa75..489694ef79cb 100644<br>
> --- a/drivers/gpu/drm/msm/msm_gem.c<br>
> +++ b/drivers/gpu/drm/msm/msm_gem.c<br>
> @@ -671,27 +671,6 @@ int msm_gem_dumb_create(struct drm_file *file, struct drm_device *dev,<br>
> MSM_BO_SCANOUT | MSM_BO_WC, &args->handle, "dumb");<br>
> }<br>
><br>
> -int msm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,<br>
> - uint32_t handle, uint64_t *offset)<br>
> -{<br>
> - struct drm_gem_object *obj;<br>
> - int ret = 0;<br>
> -<br>
> - /* GEM does all our handle to object mapping */<br>
> - obj = drm_gem_object_lookup(file, handle);<br>
> - if (obj == NULL) {<br>
> - ret = -ENOENT;<br>
> - goto fail;<br>
> - }<br>
> -<br>
> - *offset = msm_gem_mmap_offset(obj);<br>
> -<br>
> - drm_gem_object_put(obj);<br>
> -<br>
> -fail:<br>
> - return ret;<br>
> -}<br>
> -<br>
> static void *get_vaddr(struct drm_gem_object *obj, unsigned madv)<br>
> {<br>
> struct msm_gem_object *msm_obj = to_msm_bo(obj);<br>
> diff --git a/drivers/gpu/drm/msm/msm_gem.h b/drivers/gpu/drm/msm/msm_gem.h<br>
> index 8ddef5443140..dc74a0ef865d 100644<br>
> --- a/drivers/gpu/drm/msm/msm_gem.h<br>
> +++ b/drivers/gpu/drm/msm/msm_gem.h<br>
> @@ -139,8 +139,6 @@ struct page **msm_gem_pin_pages(struct drm_gem_object *obj);<br>
> void msm_gem_unpin_pages(struct drm_gem_object *obj);<br>
> int msm_gem_dumb_create(struct drm_file *file, struct drm_device *dev,<br>
> struct drm_mode_create_dumb *args);<br>
> -int msm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,<br>
> - uint32_t handle, uint64_t *offset);<br>
> void *msm_gem_get_vaddr_locked(struct drm_gem_object *obj);<br>
> void *msm_gem_get_vaddr(struct drm_gem_object *obj);<br>
> void *msm_gem_get_vaddr_active(struct drm_gem_object *obj);<br>
> --<br>
> 2.34.1<br>
><br>
<br>
<br>
-- <br>
With best wishes<br>
Dmitry<br>
</blockquote></div>