Skip to content

Commit e2e9666

Browse files
committed
drm/ttm, drm/vmwgfx: Use a configuration option for the TTM dma page pool
Drivers like vmwgfx may want to test whether the dma page pool is present or not. Since it's activated by default by TTM if compiled-in, define a hidden configuration option that the driver can test for. Cc: Christian König <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Christian König <[email protected]>
1 parent 3ca3a9e commit e2e9666

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

drivers/gpu/drm/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ config DRM_TTM
179179
GPU memory types. Will be enabled automatically if a device driver
180180
uses it.
181181

182+
config DRM_TTM_DMA_PAGE_POOL
183+
bool
184+
depends on DRM_TTM && (SWIOTLB || INTEL_IOMMU)
185+
default y
186+
help
187+
Choose this if you need the TTM dma page pool
188+
182189
config DRM_VRAM_HELPER
183190
tristate
184191
depends on DRM

drivers/gpu/drm/ttm/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
66
ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
7-
ttm_execbuf_util.o ttm_page_alloc.o ttm_bo_manager.o \
8-
ttm_page_alloc_dma.o
7+
ttm_execbuf_util.o ttm_page_alloc.o ttm_bo_manager.o
98
ttm-$(CONFIG_AGP) += ttm_agp_backend.o
9+
ttm-$(CONFIG_DRM_TTM_DMA_PAGE_POOL) += ttm_page_alloc_dma.o
1010

1111
obj-$(CONFIG_DRM_TTM) += ttm.o

drivers/gpu/drm/ttm/ttm_page_alloc_dma.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
* when freed).
3434
*/
3535

36-
#if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU)
3736
#define pr_fmt(fmt) "[TTM] " fmt
3837

3938
#include <linux/dma-mapping.h>
@@ -1238,5 +1237,3 @@ int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data)
12381237
return 0;
12391238
}
12401239
EXPORT_SYMBOL_GPL(ttm_dma_page_alloc_debugfs);
1241-
1242-
#endif

drivers/gpu/drm/vmwgfx/vmwgfx_drv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,7 @@ static int vmw_dma_select_mode(struct vmw_private *dev_priv)
576576
else
577577
dev_priv->map_mode = vmw_dma_map_populate;
578578

579-
/* No TTM coherent page pool? FIXME: Ask TTM instead! */
580-
if (!(IS_ENABLED(CONFIG_SWIOTLB) || IS_ENABLED(CONFIG_INTEL_IOMMU)) &&
579+
if (!IS_ENABLED(CONFIG_DRM_TTM_DMA_PAGE_POOL) &&
581580
(dev_priv->map_mode == vmw_dma_alloc_coherent))
582581
return -EINVAL;
583582

include/drm/ttm/ttm_page_alloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt);
7474
*/
7575
int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
7676

77-
#if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU)
77+
#if defined(CONFIG_DRM_TTM_DMA_PAGE_POOL)
7878
/**
7979
* Initialize pool allocator.
8080
*/

0 commit comments

Comments
 (0)