@@ -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(>t->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(>t->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