diff mbox

[0/6] Properly detect swiotlb.

Message ID CADnq5_PQmbqN1EU19T+Rjbb2tBftPNw-Gbe=Uc0mg2nPw6oKoA@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Deucher Aug. 31, 2015, 4:04 p.m. UTC
On Wed, Aug 26, 2015 at 2:52 PM,  <jglisse@redhat.com> wrote:
> So this is only build tested as i am away from hardware right now.
> Idea is to provide reliable way to check if swiotlb is in use for
> a device or not. It seems swiotlb_nr_tbl() is no longer reliable
> for that.
>
> Please test.

Even with these patches applied, we are still ending up in the
ttm_dma_populate() path in the amdgpu driver rather than
ttm_pool_populate() even with a hw iommu enabled.  Any idea?

The attached patch gives us a 20% performance boost in some apps, but
obviously has potential issues if a hw iommu is not present.

Alex

>
> Cheers,
> Jérôme Glisse
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

From 054d47be0545ef13350222a5cbdbcbdc4a3d3609 Mon Sep 17 00:00:00 2001
From: "monk.liu" <monk.liu@amd.com>
Date: Fri, 21 Aug 2015 15:36:38 +0800
Subject: [PATCH 1/2] drm/amdgpu: use ttm_pool instead of ttm_dma

ttm_dma_populate is very time costing,
this could rasie around 20% fps of Nexuiz test.

Signed-off-by: monk.liu <monk.liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 2b6aa65..2346a6e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -699,12 +699,6 @@  static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 
 	adev = amdgpu_get_adev(ttm->bdev);
 
-#ifdef CONFIG_SWIOTLB
-	if (swiotlb_nr_tbl()) {
-		return ttm_dma_populate(&gtt->ttm, adev->dev);
-	}
-#endif
-
 	r = ttm_pool_populate(ttm);
 	if (r) {
 		return r;
@@ -745,13 +739,6 @@  static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
 
 	adev = amdgpu_get_adev(ttm->bdev);
 
-#ifdef CONFIG_SWIOTLB
-	if (swiotlb_nr_tbl()) {
-		ttm_dma_unpopulate(&gtt->ttm, adev->dev);
-		return;
-	}
-#endif
-
 	for (i = 0; i < ttm->num_pages; i++) {
 		if (gtt->ttm.dma_address[i]) {
 			pci_unmap_page(adev->pdev, gtt->ttm.dma_address[i],
-- 
2.0.0