diff options
author | Chunming Zhou <david1.zhou@amd.com> | 2018-02-08 21:44:10 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-02-13 13:35:14 -0500 |
commit | 1bc3d3cce8c3b44c2b5ac6cee98c830bb40e6b0f (patch) | |
tree | 007968d3f7aeda3b5be83ced24ce407023728802 | |
parent | fd5fd480dd8fe4910546e7b080b3ae345e57fe9f (diff) |
drm/radeon: only enable swiotlb path when need v2
swiotlb expands our card accessing range, but its path always is slower
than ttm pool allocation.
So add condition to use it.
v2: move a bit later
Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180209024410.1469-3-david1.zhou@amd.com
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_device.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ttm.c | 6 |
3 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index d34887873dea..4a2eb409aacc 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -2387,6 +2387,7 @@ struct radeon_device { | |||
2387 | struct radeon_dummy_page dummy_page; | 2387 | struct radeon_dummy_page dummy_page; |
2388 | bool shutdown; | 2388 | bool shutdown; |
2389 | bool need_dma32; | 2389 | bool need_dma32; |
2390 | bool need_swiotlb; | ||
2390 | bool accel_working; | 2391 | bool accel_working; |
2391 | bool fastfb_working; /* IGP feature*/ | 2392 | bool fastfb_working; /* IGP feature*/ |
2392 | bool needs_reset, in_reset; | 2393 | bool needs_reset, in_reset; |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 8d3e3d2e0090..7f40c6f7c4dd 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <drm/drmP.h> | 30 | #include <drm/drmP.h> |
31 | #include <drm/drm_crtc_helper.h> | 31 | #include <drm/drm_crtc_helper.h> |
32 | #include <drm/drm_cache.h> | ||
32 | #include <drm/radeon_drm.h> | 33 | #include <drm/radeon_drm.h> |
33 | #include <linux/pm_runtime.h> | 34 | #include <linux/pm_runtime.h> |
34 | #include <linux/vgaarb.h> | 35 | #include <linux/vgaarb.h> |
@@ -1378,6 +1379,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1378 | pci_set_consistent_dma_mask(rdev->pdev, DMA_BIT_MASK(32)); | 1379 | pci_set_consistent_dma_mask(rdev->pdev, DMA_BIT_MASK(32)); |
1379 | pr_warn("radeon: No coherent DMA available\n"); | 1380 | pr_warn("radeon: No coherent DMA available\n"); |
1380 | } | 1381 | } |
1382 | rdev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits); | ||
1381 | 1383 | ||
1382 | /* Registers mapping */ | 1384 | /* Registers mapping */ |
1383 | /* TODO: block userspace mapping of io register */ | 1385 | /* TODO: block userspace mapping of io register */ |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index a0a839bc39bf..c1e3862a48a4 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -756,7 +756,7 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm, | |||
756 | #endif | 756 | #endif |
757 | 757 | ||
758 | #ifdef CONFIG_SWIOTLB | 758 | #ifdef CONFIG_SWIOTLB |
759 | if (swiotlb_nr_tbl()) { | 759 | if (rdev->need_swiotlb && swiotlb_nr_tbl()) { |
760 | return ttm_dma_populate(>t->ttm, rdev->dev, ctx); | 760 | return ttm_dma_populate(>t->ttm, rdev->dev, ctx); |
761 | } | 761 | } |
762 | #endif | 762 | #endif |
@@ -788,7 +788,7 @@ static void radeon_ttm_tt_unpopulate(struct ttm_tt *ttm) | |||
788 | #endif | 788 | #endif |
789 | 789 | ||
790 | #ifdef CONFIG_SWIOTLB | 790 | #ifdef CONFIG_SWIOTLB |
791 | if (swiotlb_nr_tbl()) { | 791 | if (rdev->need_swiotlb && swiotlb_nr_tbl()) { |
792 | ttm_dma_unpopulate(>t->ttm, rdev->dev); | 792 | ttm_dma_unpopulate(>t->ttm, rdev->dev); |
793 | return; | 793 | return; |
794 | } | 794 | } |
@@ -1155,7 +1155,7 @@ static int radeon_ttm_debugfs_init(struct radeon_device *rdev) | |||
1155 | count = ARRAY_SIZE(radeon_ttm_debugfs_list); | 1155 | count = ARRAY_SIZE(radeon_ttm_debugfs_list); |
1156 | 1156 | ||
1157 | #ifdef CONFIG_SWIOTLB | 1157 | #ifdef CONFIG_SWIOTLB |
1158 | if (!swiotlb_nr_tbl()) | 1158 | if (!(rdev->need_swiotlb && swiotlb_nr_tbl())) |
1159 | --count; | 1159 | --count; |
1160 | #endif | 1160 | #endif |
1161 | 1161 | ||