[06/15] drm/i915: Drop dma_buf->k(un)map
diff mbox series

Message ID 20191118103536.17675-7-daniel.vetter@ffwll.ch
State New
Headers show
Series
  • Retire dma_buf_k(un)map
Related show

Commit Message

Daniel Vetter Nov. 18, 2019, 10:35 a.m. UTC
No in-tree users left.

Aside, I think mock_dmabuf would be a nice addition to drm
mock/selftest helpers (we have some already), with an
EXPORT_SYMBOL_FOR_TESTS_ONLY.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: "Christian König" <christian.koenig@amd.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c    | 36 -------------------
 .../gpu/drm/i915/gem/selftests/mock_dmabuf.c  | 16 ---------
 2 files changed, 52 deletions(-)

Comments

Christian König Nov. 18, 2019, 11:38 a.m. UTC | #1
Am 18.11.19 um 11:35 schrieb Daniel Vetter:
> No in-tree users left.

Good to know, thanks.

>
> Aside, I think mock_dmabuf would be a nice addition to drm
> mock/selftest helpers (we have some already), with an
> EXPORT_SYMBOL_FOR_TESTS_ONLY.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: "Christian König" <christian.koenig@amd.com>

Acked-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c    | 36 -------------------
>   .../gpu/drm/i915/gem/selftests/mock_dmabuf.c  | 16 ---------
>   2 files changed, 52 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
> index eaea49d08eb5..372b57ca0efc 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
> @@ -93,40 +93,6 @@ static void i915_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
>   	i915_gem_object_unpin_map(obj);
>   }
>   
> -static void *i915_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long page_num)
> -{
> -	struct drm_i915_gem_object *obj = dma_buf_to_obj(dma_buf);
> -	struct page *page;
> -
> -	if (page_num >= obj->base.size >> PAGE_SHIFT)
> -		return NULL;
> -
> -	if (!i915_gem_object_has_struct_page(obj))
> -		return NULL;
> -
> -	if (i915_gem_object_pin_pages(obj))
> -		return NULL;
> -
> -	/* Synchronisation is left to the caller (via .begin_cpu_access()) */
> -	page = i915_gem_object_get_page(obj, page_num);
> -	if (IS_ERR(page))
> -		goto err_unpin;
> -
> -	return kmap(page);
> -
> -err_unpin:
> -	i915_gem_object_unpin_pages(obj);
> -	return NULL;
> -}
> -
> -static void i915_gem_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned long page_num, void *addr)
> -{
> -	struct drm_i915_gem_object *obj = dma_buf_to_obj(dma_buf);
> -
> -	kunmap(virt_to_page(addr));
> -	i915_gem_object_unpin_pages(obj);
> -}
> -
>   static int i915_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma)
>   {
>   	struct drm_i915_gem_object *obj = dma_buf_to_obj(dma_buf);
> @@ -195,8 +161,6 @@ static const struct dma_buf_ops i915_dmabuf_ops =  {
>   	.map_dma_buf = i915_gem_map_dma_buf,
>   	.unmap_dma_buf = i915_gem_unmap_dma_buf,
>   	.release = drm_gem_dmabuf_release,
> -	.map = i915_gem_dmabuf_kmap,
> -	.unmap = i915_gem_dmabuf_kunmap,
>   	.mmap = i915_gem_dmabuf_mmap,
>   	.vmap = i915_gem_dmabuf_vmap,
>   	.vunmap = i915_gem_dmabuf_vunmap,
> diff --git a/drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.c b/drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.c
> index b9e059d4328a..9272bef57092 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.c
> @@ -76,20 +76,6 @@ static void mock_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
>   	vm_unmap_ram(vaddr, mock->npages);
>   }
>   
> -static void *mock_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long page_num)
> -{
> -	struct mock_dmabuf *mock = to_mock(dma_buf);
> -
> -	return kmap(mock->pages[page_num]);
> -}
> -
> -static void mock_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned long page_num, void *addr)
> -{
> -	struct mock_dmabuf *mock = to_mock(dma_buf);
> -
> -	return kunmap(mock->pages[page_num]);
> -}
> -
>   static int mock_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma)
>   {
>   	return -ENODEV;
> @@ -99,8 +85,6 @@ static const struct dma_buf_ops mock_dmabuf_ops =  {
>   	.map_dma_buf = mock_map_dma_buf,
>   	.unmap_dma_buf = mock_unmap_dma_buf,
>   	.release = mock_dmabuf_release,
> -	.map = mock_dmabuf_kmap,
> -	.unmap = mock_dmabuf_kunmap,
>   	.mmap = mock_dmabuf_mmap,
>   	.vmap = mock_dmabuf_vmap,
>   	.vunmap = mock_dmabuf_vunmap,
Chris Wilson Nov. 18, 2019, 12:53 p.m. UTC | #2
Quoting Daniel Vetter (2019-11-18 10:35:27)
> No in-tree users left.

Fair enough then,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

> Aside, I think mock_dmabuf would be a nice addition to drm
> mock/selftest helpers (we have some already), with an
> EXPORT_SYMBOL_FOR_TESTS_ONLY.

We've also started on some dmabuf selftests, so maybe we can go further
and make mock objects and EXPORT_SYMBOL_FOR_TESTS_ONLY global. And of
course, make sure the efforts align with kunit...
-Chris

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
index eaea49d08eb5..372b57ca0efc 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
@@ -93,40 +93,6 @@  static void i915_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
 	i915_gem_object_unpin_map(obj);
 }
 
-static void *i915_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long page_num)
-{
-	struct drm_i915_gem_object *obj = dma_buf_to_obj(dma_buf);
-	struct page *page;
-
-	if (page_num >= obj->base.size >> PAGE_SHIFT)
-		return NULL;
-
-	if (!i915_gem_object_has_struct_page(obj))
-		return NULL;
-
-	if (i915_gem_object_pin_pages(obj))
-		return NULL;
-
-	/* Synchronisation is left to the caller (via .begin_cpu_access()) */
-	page = i915_gem_object_get_page(obj, page_num);
-	if (IS_ERR(page))
-		goto err_unpin;
-
-	return kmap(page);
-
-err_unpin:
-	i915_gem_object_unpin_pages(obj);
-	return NULL;
-}
-
-static void i915_gem_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned long page_num, void *addr)
-{
-	struct drm_i915_gem_object *obj = dma_buf_to_obj(dma_buf);
-
-	kunmap(virt_to_page(addr));
-	i915_gem_object_unpin_pages(obj);
-}
-
 static int i915_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma)
 {
 	struct drm_i915_gem_object *obj = dma_buf_to_obj(dma_buf);
@@ -195,8 +161,6 @@  static const struct dma_buf_ops i915_dmabuf_ops =  {
 	.map_dma_buf = i915_gem_map_dma_buf,
 	.unmap_dma_buf = i915_gem_unmap_dma_buf,
 	.release = drm_gem_dmabuf_release,
-	.map = i915_gem_dmabuf_kmap,
-	.unmap = i915_gem_dmabuf_kunmap,
 	.mmap = i915_gem_dmabuf_mmap,
 	.vmap = i915_gem_dmabuf_vmap,
 	.vunmap = i915_gem_dmabuf_vunmap,
diff --git a/drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.c b/drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.c
index b9e059d4328a..9272bef57092 100644
--- a/drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.c
@@ -76,20 +76,6 @@  static void mock_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
 	vm_unmap_ram(vaddr, mock->npages);
 }
 
-static void *mock_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long page_num)
-{
-	struct mock_dmabuf *mock = to_mock(dma_buf);
-
-	return kmap(mock->pages[page_num]);
-}
-
-static void mock_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned long page_num, void *addr)
-{
-	struct mock_dmabuf *mock = to_mock(dma_buf);
-
-	return kunmap(mock->pages[page_num]);
-}
-
 static int mock_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma)
 {
 	return -ENODEV;
@@ -99,8 +85,6 @@  static const struct dma_buf_ops mock_dmabuf_ops =  {
 	.map_dma_buf = mock_map_dma_buf,
 	.unmap_dma_buf = mock_unmap_dma_buf,
 	.release = mock_dmabuf_release,
-	.map = mock_dmabuf_kmap,
-	.unmap = mock_dmabuf_kunmap,
 	.mmap = mock_dmabuf_mmap,
 	.vmap = mock_dmabuf_vmap,
 	.vunmap = mock_dmabuf_vunmap,