diff mbox

[6/6] drm/amdgpu: Use swiotlb_in_use() to know if swiotlb is enabled.

Message ID 1440615127-25834-7-git-send-email-jglisse@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jerome Glisse Aug. 26, 2015, 6:52 p.m. UTC
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/amd/amdgpu/amdgpu_ttm.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index dd3415d..bb48fc5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -38,7 +38,6 @@ 
 #include <drm/amdgpu_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>
@@ -692,11 +691,9 @@  static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 
 	adev = amdgpu_get_adev(ttm->bdev);
 
-#ifdef CONFIG_SWIOTLB
-	if (swiotlb_nr_tbl()) {
+	if (swiotlb_in_use(adev->dev)) {
 		return ttm_dma_populate(&gtt->ttm, adev->dev);
 	}
-#endif
 
 	r = ttm_pool_populate(ttm);
 	if (r) {
@@ -738,12 +735,10 @@  static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
 
 	adev = amdgpu_get_adev(ttm->bdev);
 
-#ifdef CONFIG_SWIOTLB
-	if (swiotlb_nr_tbl()) {
+	if (swiotlb_in_use(adev->dev)) {
 		ttm_dma_unpopulate(&gtt->ttm, adev->dev);
 		return;
 	}
-#endif
 
 	for (i = 0; i < ttm->num_pages; i++) {
 		if (gtt->ttm.dma_address[i]) {
@@ -1190,10 +1185,8 @@  static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
 
 	count = ARRAY_SIZE(amdgpu_ttm_debugfs_list);
 
-#ifdef CONFIG_SWIOTLB
-	if (!swiotlb_nr_tbl())
+	if (!swiotlb_in_use(adev->dev))
 		--count;
-#endif
 
 	return amdgpu_debugfs_add_files(adev, amdgpu_ttm_debugfs_list, count);
 #else