From: Chunming Zhou <david1.zhou@amd.com>
To: dri-devel@lists.freedesktop.org
Cc: christian.koenig@amd.com
Subject: [PATCH 3/3] drm/radeon: only enable swiotlb path when need
Date: Thu, 8 Feb 2018 14:00:17 +0800 [thread overview]
Message-ID: <20180208060017.30780-3-david1.zhou@amd.com> (raw)
In-Reply-To: <20180208060017.30780-1-david1.zhou@amd.com>
swiotlb expands our card accessing range, but its path always is slower
than ttm pool allocation.
So add condition to use it.
Change-Id: I1802645833155a9cd808913f863981173a82145f
Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
---
drivers/gpu/drm/radeon/radeon.h | 1 +
drivers/gpu/drm/radeon/radeon_device.c | 2 ++
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 {
struct radeon_dummy_page dummy_page;
bool shutdown;
bool need_dma32;
+ bool need_swiotlb;
bool accel_working;
bool fastfb_working; /* IGP feature*/
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..62d8626e1fe8 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -29,6 +29,7 @@
#include <linux/slab.h>
#include <drm/drmP.h>
#include <drm/drm_crtc_helper.h>
+#include <drm/drm_cache.h>
#include <drm/radeon_drm.h>
#include <linux/pm_runtime.h>
#include <linux/vgaarb.h>
@@ -1367,6 +1368,7 @@ int radeon_device_init(struct radeon_device *rdev,
rdev->need_dma32 = true;
dma_bits = rdev->need_dma32 ? 32 : 40;
+ rdev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
r = pci_set_dma_mask(rdev->pdev, DMA_BIT_MASK(dma_bits));
if (r) {
rdev->need_dma32 = true;
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,
#endif
#ifdef CONFIG_SWIOTLB
- if (swiotlb_nr_tbl()) {
+ if (rdev->need_swiotlb && swiotlb_nr_tbl()) {
return ttm_dma_populate(>t->ttm, rdev->dev, ctx);
}
#endif
@@ -788,7 +788,7 @@ static void radeon_ttm_tt_unpopulate(struct ttm_tt *ttm)
#endif
#ifdef CONFIG_SWIOTLB
- if (swiotlb_nr_tbl()) {
+ if (rdev->need_swiotlb && swiotlb_nr_tbl()) {
ttm_dma_unpopulate(>t->ttm, rdev->dev);
return;
}
@@ -1155,7 +1155,7 @@ 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 (!(rdev->need_swiotlb && swiotlb_nr_tbl()))
--count;
#endif
--
2.14.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-02-08 6:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 6:00 [PATCH 1/3] drm: add func to get max iomem address Chunming Zhou
2018-02-08 6:00 ` [PATCH 2/3] drm/amdgpu: only enable swiotlb alloc when need Chunming Zhou
2018-02-08 8:07 ` Christian König
2018-02-08 6:00 ` Chunming Zhou [this message]
2018-02-19 9:48 ` [PATCH 1/3] drm: add func to get max iomem address Daniel Vetter
-- strict thread matches above, loose matches on Subject: below --
2018-02-08 5:14 Chunming Zhou
[not found] ` <20180208051409.30486-1-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-02-08 5:14 ` [PATCH 3/3] drm/radeon: only enable swiotlb path when need Chunming Zhou
[not found] ` <20180208051409.30486-3-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-02-08 6:58 ` Liu, Monk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180208060017.30780-3-david1.zhou@amd.com \
--to=david1.zhou@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.