[PATCH 2/6] drm/radeon: Use swiotlb_in_use() to know if swiotlb is enabled or not.

jglisse at redhat.com jglisse at redhat.com
Wed Aug 26 11:52:03 PDT 2015


From: Jérôme Glisse <jglisse at 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 at redhat.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
Cc: Alex Deucher <alexander.deucher at amd.com>
Cc: Ben Skeggs <bskeggs at redhat.com>
Cc: Dave Airlie <airlied at redhat.com>
Cc: lkml at vger.kernel.org
Cc: Daniel Vetter <daniel.vetter at 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(&gtt->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(&gtt->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
-- 
2.1.0



More information about the dri-devel mailing list