From: Jérôme Glisse jglisse@redhat.com
We can not rely on swiotlb_nr_tbl() to know if swiotlb is in use or not for our device. Use the new helper to determine that.
Signed-off-by: Jérôme Glisse jglisse@redhat.com Cc: Konrad Rzeszutek Wilk konrad.wilk@oracle.com Cc: Alex Deucher alexander.deucher@amd.com Cc: Ben Skeggs bskeggs@redhat.com Cc: Dave Airlie airlied@redhat.com Cc: lkml@vger.kernel.org Cc: Daniel Vetter daniel.vetter@intel.com --- drivers/gpu/drm/radeon/radeon_ttm.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 06ac59fe..5c9814a 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -38,7 +38,6 @@ #include <drm/radeon_drm.h> #include <linux/seq_file.h> #include <linux/slab.h> -#include <linux/swiotlb.h> #include <linux/swap.h> #include <linux/pagemap.h> #include <linux/debugfs.h> @@ -742,11 +741,9 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm) } #endif
-#ifdef CONFIG_SWIOTLB - if (swiotlb_nr_tbl()) { + if (swiotlb_in_use(rdev->dev)) { return ttm_dma_populate(>t->ttm, rdev->dev); } -#endif
r = ttm_pool_populate(ttm); if (r) { @@ -794,12 +791,10 @@ static void radeon_ttm_tt_unpopulate(struct ttm_tt *ttm) } #endif
-#ifdef CONFIG_SWIOTLB - if (swiotlb_nr_tbl()) { + if (swiotlb_in_use(rdev->dev)) { ttm_dma_unpopulate(>t->ttm, rdev->dev); return; } -#endif
for (i = 0; i < ttm->num_pages; i++) { if (gtt->ttm.dma_address[i]) { @@ -1169,10 +1164,8 @@ static int radeon_ttm_debugfs_init(struct radeon_device *rdev)
count = ARRAY_SIZE(radeon_ttm_debugfs_list);
-#ifdef CONFIG_SWIOTLB - if (!swiotlb_nr_tbl()) + if (!swiotlb_in_use(rdev->dev)) --count; -#endif
return radeon_debugfs_add_files(rdev, radeon_ttm_debugfs_list, count); #else