diff mbox

drm/ttm: fix populate_and_map() functions once more

Message ID 20171127122106.17608-1-christian.koenig@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König Nov. 27, 2017, 12:21 p.m. UTC
This reverts "drm/ttm: Fix configuration error around populate_and_map()
functions".

This fix has gone into the wrong direction. Those helpers should be
available even when neither CONFIG_INTEL_IOMMU nor CONFIG_SWIOTLB are
set.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_page_alloc.c |  2 --
 include/drm/ttm/ttm_page_alloc.h     | 32 ++++++++++----------------------
 2 files changed, 10 insertions(+), 24 deletions(-)

Comments

Alex Deucher Nov. 27, 2017, 10:56 p.m. UTC | #1
On Mon, Nov 27, 2017 at 7:21 AM, Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
> This reverts "drm/ttm: Fix configuration error around populate_and_map()
> functions".
>
> This fix has gone into the wrong direction. Those helpers should be
> available even when neither CONFIG_INTEL_IOMMU nor CONFIG_SWIOTLB are
> set.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/ttm/ttm_page_alloc.c |  2 --
>  include/drm/ttm/ttm_page_alloc.h     | 32 ++++++++++----------------------
>  2 files changed, 10 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
> index 1543532b8740..c82d94cbbabc 100644
> --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
> +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
> @@ -1096,7 +1096,6 @@ void ttm_pool_unpopulate(struct ttm_tt *ttm)
>  }
>  EXPORT_SYMBOL(ttm_pool_unpopulate);
>
> -#if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU)
>  int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt)
>  {
>         unsigned i, j;
> @@ -1167,7 +1166,6 @@ void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt)
>         ttm_pool_unpopulate(&tt->ttm);
>  }
>  EXPORT_SYMBOL(ttm_unmap_and_unpopulate_pages);
> -#endif
>
>  int ttm_page_alloc_debugfs(struct seq_file *m, void *data)
>  {
> diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
> index 38a2b4770c35..593811362a91 100644
> --- a/include/drm/ttm/ttm_page_alloc.h
> +++ b/include/drm/ttm/ttm_page_alloc.h
> @@ -59,11 +59,20 @@ int ttm_pool_populate(struct ttm_tt *ttm);
>  void ttm_pool_unpopulate(struct ttm_tt *ttm);
>
>  /**
> + * Populates and DMA maps pages to fullfil a ttm_dma_populate() request
> + */
> +int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt);
> +
> +/**
> + * Unpopulates and DMA unmaps pages as part of a
> + * ttm_dma_unpopulate() request */
> +void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt);
> +
> +/**
>   * Output the state of pools to debugfs file
>   */
>  int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
>
> -
>  #if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU)
>  /**
>   * Initialize pool allocator.
> @@ -83,17 +92,6 @@ int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data);
>  int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev);
>  void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev);
>
> -
> -/**
> - * Populates and DMA maps pages to fullfil a ttm_dma_populate() request
> - */
> -int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt);
> -
> -/**
> - * Unpopulates and DMA unmaps pages as part of a
> - * ttm_dma_unpopulate() request */
> -void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt);
> -
>  #else
>  static inline int ttm_dma_page_alloc_init(struct ttm_mem_global *glob,
>                                           unsigned max_pages)
> @@ -116,16 +114,6 @@ static inline void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma,
>                                       struct device *dev)
>  {
>  }
> -
> -static inline int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt)
> -{
> -       return -ENOMEM;
> -}
> -
> -static inline void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt)
> -{
> -}
> -
>  #endif
>
>  #endif
> --
> 2.11.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index 1543532b8740..c82d94cbbabc 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -1096,7 +1096,6 @@  void ttm_pool_unpopulate(struct ttm_tt *ttm)
 }
 EXPORT_SYMBOL(ttm_pool_unpopulate);
 
-#if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU)
 int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt)
 {
 	unsigned i, j;
@@ -1167,7 +1166,6 @@  void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt)
 	ttm_pool_unpopulate(&tt->ttm);
 }
 EXPORT_SYMBOL(ttm_unmap_and_unpopulate_pages);
-#endif
 
 int ttm_page_alloc_debugfs(struct seq_file *m, void *data)
 {
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
index 38a2b4770c35..593811362a91 100644
--- a/include/drm/ttm/ttm_page_alloc.h
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -59,11 +59,20 @@  int ttm_pool_populate(struct ttm_tt *ttm);
 void ttm_pool_unpopulate(struct ttm_tt *ttm);
 
 /**
+ * Populates and DMA maps pages to fullfil a ttm_dma_populate() request
+ */
+int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt);
+
+/**
+ * Unpopulates and DMA unmaps pages as part of a
+ * ttm_dma_unpopulate() request */
+void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt);
+
+/**
  * Output the state of pools to debugfs file
  */
 int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
 
-
 #if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU)
 /**
  * Initialize pool allocator.
@@ -83,17 +92,6 @@  int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data);
 int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev);
 void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev);
 
-
-/**
- * Populates and DMA maps pages to fullfil a ttm_dma_populate() request
- */
-int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt);
-
-/**
- * Unpopulates and DMA unmaps pages as part of a
- * ttm_dma_unpopulate() request */
-void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt);
-
 #else
 static inline int ttm_dma_page_alloc_init(struct ttm_mem_global *glob,
 					  unsigned max_pages)
@@ -116,16 +114,6 @@  static inline void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma,
 				      struct device *dev)
 {
 }
-
-static inline int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt)
-{
-	return -ENOMEM;
-}
-
-static inline void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt)
-{
-}
-
 #endif
 
 #endif