All of lore.kernel.org
 help / color / mirror / Atom feed
* remove ttm trace and add iova debugfs (v2)
@ 2017-09-18 17:33 Tom St Denis
       [not found] ` <20170918173350.9543-1-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Tom St Denis @ 2017-09-18 17:33 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

In this respin I add some changes per feedback and make the iova
entry have proper read/write methods which access pages mapped
by amdgpu.  So there is no need for /dev/mem or /dev/fmem anymore
when reading system memory.

Patches 3/4 are unchanged and remove the TTM trace from amdgpu 
and from TTM itself.


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/4] drm/amd/amdgpu: Fold TTM debugfs entries into array (v2)
       [not found] ` <20170918173350.9543-1-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
@ 2017-09-18 17:33   ` Tom St Denis
       [not found]     ` <20170918173350.9543-2-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
  2017-09-18 17:33   ` [PATCH 2/4] drm/amd/amdgpu: add support for iova_to_phys to replace TTM trace (v3) Tom St Denis
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Tom St Denis @ 2017-09-18 17:33 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Tom St Denis, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>

(v2): add domains and avoid strcmp
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 54 ++++++++++++++++++---------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h |  4 +--
 2 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 8ee16dfdb8af..50d20903de4f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1809,6 +1809,19 @@ static const struct file_operations amdgpu_ttm_gtt_fops = {
 
 #endif
 
+
+
+static const struct {
+	char *name;
+	const struct file_operations *fops;
+	int domain;
+} ttm_debugfs_entries[] = {
+	{ "amdgpu_vram", &amdgpu_ttm_vram_fops, TTM_PL_VRAM },
+#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
+	{ "amdgpu_gtt", &amdgpu_ttm_gtt_fops, TTM_PL_TT },
+#endif
+};
+
 #endif
 
 static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
@@ -1819,22 +1832,21 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
 	struct drm_minor *minor = adev->ddev->primary;
 	struct dentry *ent, *root = minor->debugfs_root;
 
-	ent = debugfs_create_file("amdgpu_vram", S_IFREG | S_IRUGO, root,
-				  adev, &amdgpu_ttm_vram_fops);
-	if (IS_ERR(ent))
-		return PTR_ERR(ent);
-	i_size_write(ent->d_inode, adev->mc.mc_vram_size);
-	adev->mman.vram = ent;
-
-#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
-	ent = debugfs_create_file("amdgpu_gtt", S_IFREG | S_IRUGO, root,
-				  adev, &amdgpu_ttm_gtt_fops);
-	if (IS_ERR(ent))
-		return PTR_ERR(ent);
-	i_size_write(ent->d_inode, adev->mc.gart_size);
-	adev->mman.gtt = ent;
+	for (count = 0; count < ARRAY_SIZE(ttm_debugfs_entries); count++) {
+		ent = debugfs_create_file(
+				ttm_debugfs_entries[count].name,
+				S_IFREG | S_IRUGO, root,
+				adev,
+				ttm_debugfs_entries[count].fops);
+		if (IS_ERR(ent))
+			return PTR_ERR(ent);
+		if (ttm_debugfs_entries[count].domain == TTM_PL_VRAM)
+			i_size_write(ent->d_inode, adev->mc.mc_vram_size);
+		else if (ttm_debugfs_entries[count].domain == TTM_PL_TT)
+			i_size_write(ent->d_inode, adev->mc.gart_size);
+		adev->mman.debugfs_entries[count] = ent;
+	}
 
-#endif
 	count = ARRAY_SIZE(amdgpu_ttm_debugfs_list);
 
 #ifdef CONFIG_SWIOTLB
@@ -1844,7 +1856,6 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
 
 	return amdgpu_debugfs_add_files(adev, amdgpu_ttm_debugfs_list, count);
 #else
-
 	return 0;
 #endif
 }
@@ -1852,14 +1863,9 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
 static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev)
 {
 #if defined(CONFIG_DEBUG_FS)
+	unsigned i;
 
-	debugfs_remove(adev->mman.vram);
-	adev->mman.vram = NULL;
-
-#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
-	debugfs_remove(adev->mman.gtt);
-	adev->mman.gtt = NULL;
-#endif
-
+	for (i = 0; i < ARRAY_SIZE(ttm_debugfs_entries); i++)
+		debugfs_remove(adev->mman.debugfs_entries[i]);
 #endif
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index 64709e041d5b..7abae6867339 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -24,6 +24,7 @@
 #ifndef __AMDGPU_TTM_H__
 #define __AMDGPU_TTM_H__
 
+#include "amdgpu.h"
 #include "gpu_scheduler.h"
 
 #define AMDGPU_PL_GDS		(TTM_PL_PRIV + 0)
@@ -45,8 +46,7 @@ struct amdgpu_mman {
 	bool				initialized;
 
 #if defined(CONFIG_DEBUG_FS)
-	struct dentry			*vram;
-	struct dentry			*gtt;
+	struct dentry			*debugfs_entries[8];
 #endif
 
 	/* buffer handling */
-- 
2.12.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/4] drm/amd/amdgpu: add support for iova_to_phys to replace TTM trace (v3)
       [not found] ` <20170918173350.9543-1-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
  2017-09-18 17:33   ` [PATCH 1/4] drm/amd/amdgpu: Fold TTM debugfs entries into array (v2) Tom St Denis
@ 2017-09-18 17:33   ` Tom St Denis
  2017-09-19 11:11     ` Christian König
  2017-09-18 17:33   ` [PATCH 3/4] drm/amd/amdgpu: remove usage of ttm trace Tom St Denis
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Tom St Denis @ 2017-09-18 17:33 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Tom St Denis, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>

(v2): Add domain to iova debugfs
(v3): Add true read/write methods to access system memory of pages
      mapped to the device
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 104 ++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 50d20903de4f..02ae32378e1c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -43,6 +43,7 @@
 #include <linux/swap.h>
 #include <linux/pagemap.h>
 #include <linux/debugfs.h>
+#include <linux/iommu.h>
 #include "amdgpu.h"
 #include "amdgpu_trace.h"
 #include "bif/bif_4_1_d.h"
@@ -1810,6 +1811,108 @@ static const struct file_operations amdgpu_ttm_gtt_fops = {
 #endif
 
 
+static void *transform_page(uint64_t phys)
+{
+	if (PageHighMem(pfn_to_page(PFN_DOWN(phys))))
+		return kmap(pfn_to_page(PFN_DOWN(phys)));
+	else
+		return __va(phys);
+}
+
+static void untransform_page(uint64_t phys)
+{
+	if (PageHighMem(pfn_to_page(PFN_DOWN(phys))))
+		return kunmap(pfn_to_page(PFN_DOWN(phys)));
+}
+
+static ssize_t amdgpu_iova_to_phys_read(struct file *f, char __user *buf,
+				   size_t size, loff_t *pos)
+{
+	struct amdgpu_device *adev = file_inode(f)->i_private;
+	ssize_t result, n;
+	int r;
+	uint64_t phys;
+	void *ptr;
+
+	result = 0;
+	while (size) {
+		// get physical address and map
+		phys = iommu_iova_to_phys(iommu_get_domain_for_dev(adev->dev), *pos);
+
+		// copy upto one page
+		if (size > PAGE_SIZE)
+			n = PAGE_SIZE;
+		else
+			n = size;
+
+		// to end of the page
+		if (((*pos & (PAGE_SIZE - 1)) + n) >= PAGE_SIZE)
+			n = PAGE_SIZE - (*pos & (PAGE_SIZE - 1));
+
+		ptr = transform_page(phys);
+		if (!ptr)
+			return -EFAULT;
+
+		r = copy_to_user(buf, ptr, n);
+		untransform_page(phys);
+		if (r)
+			return -EFAULT;
+
+		*pos += n;
+		size -= n;
+		result += n;
+	}
+
+	return result;
+}
+
+static ssize_t amdgpu_iova_to_phys_write(struct file *f, const char __user *buf,
+				   size_t size, loff_t *pos)
+{
+	struct amdgpu_device *adev = file_inode(f)->i_private;
+	ssize_t result, n;
+	int r;
+	uint64_t phys;
+	void *ptr;
+
+	result = 0;
+	while (size) {
+		// get physical address and map
+		phys = iommu_iova_to_phys(iommu_get_domain_for_dev(adev->dev), *pos);
+
+		// copy upto one page
+		if (size > PAGE_SIZE)
+			n = PAGE_SIZE;
+		else
+			n = size;
+
+		// to end of the page
+		if (((*pos & (PAGE_SIZE - 1)) + n) >= PAGE_SIZE)
+			n = PAGE_SIZE - (*pos & (PAGE_SIZE - 1));
+
+		ptr = transform_page(phys);
+		if (!ptr)
+			return -EFAULT;
+
+		r = copy_from_user(ptr, buf, n);
+		untransform_page(phys);
+		if (r)
+			return -EFAULT;
+
+		*pos += n;
+		size -= n;
+		result += n;
+	}
+
+	return result;
+}
+
+static const struct file_operations amdgpu_ttm_iova_fops = {
+	.owner = THIS_MODULE,
+	.read = amdgpu_iova_to_phys_read,
+	.write = amdgpu_iova_to_phys_write,
+	.llseek = default_llseek
+};
 
 static const struct {
 	char *name;
@@ -1820,6 +1923,7 @@ static const struct {
 #ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
 	{ "amdgpu_gtt", &amdgpu_ttm_gtt_fops, TTM_PL_TT },
 #endif
+	{ "amdgpu_iova", &amdgpu_ttm_iova_fops, TTM_PL_SYSTEM },
 };
 
 #endif
-- 
2.12.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/4] drm/amd/amdgpu: remove usage of ttm trace
       [not found] ` <20170918173350.9543-1-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
  2017-09-18 17:33   ` [PATCH 1/4] drm/amd/amdgpu: Fold TTM debugfs entries into array (v2) Tom St Denis
  2017-09-18 17:33   ` [PATCH 2/4] drm/amd/amdgpu: add support for iova_to_phys to replace TTM trace (v3) Tom St Denis
@ 2017-09-18 17:33   ` Tom St Denis
  2017-09-19 11:12     ` Christian König
  2017-09-18 17:33   ` [PATCH 4/4] drm/ttm: Remove TTM dma tracepoint since it's not required anymore Tom St Denis
  2017-09-18 23:53   ` remove ttm trace and add iova debugfs (v2) StDenis, Tom
  4 siblings, 1 reply; 13+ messages in thread
From: Tom St Denis @ 2017-09-18 17:33 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Tom St Denis, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 36 +++------------------------------
 1 file changed, 3 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 02ae32378e1c..b41d03226c26 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -34,7 +34,6 @@
 #include <drm/ttm/ttm_placement.h>
 #include <drm/ttm/ttm_module.h>
 #include <drm/ttm/ttm_page_alloc.h>
-#include <drm/ttm/ttm_debug.h>
 #include <drm/drmP.h>
 #include <drm/amdgpu_drm.h>
 #include <linux/seq_file.h>
@@ -704,22 +703,6 @@ void amdgpu_ttm_tt_mark_user_pages(struct ttm_tt *ttm)
 	}
 }
 
-static void amdgpu_trace_dma_map(struct ttm_tt *ttm)
-{
-	struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev);
-	struct amdgpu_ttm_tt *gtt = (void *)ttm;
-
-	ttm_trace_dma_map(adev->dev, &gtt->ttm);
-}
-
-static void amdgpu_trace_dma_unmap(struct ttm_tt *ttm)
-{
-	struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev);
-	struct amdgpu_ttm_tt *gtt = (void *)ttm;
-
-	ttm_trace_dma_unmap(adev->dev, &gtt->ttm);
-}
-
 /* prepare the sg table with the user pages */
 static int amdgpu_ttm_tt_pin_userptr(struct ttm_tt *ttm)
 {
@@ -746,8 +729,6 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_tt *ttm)
 	drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
 					 gtt->ttm.dma_address, ttm->num_pages);
 
-	amdgpu_trace_dma_map(ttm);
-
 	return 0;
 
 release_sg:
@@ -773,8 +754,6 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
 
 	amdgpu_ttm_tt_mark_user_pages(ttm);
 
-	amdgpu_trace_dma_unmap(ttm);
-
 	sg_free_table(ttm->sg);
 }
 
@@ -958,7 +937,6 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 {
 	struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev);
 	struct amdgpu_ttm_tt *gtt = (void *)ttm;
-	int r;
 	bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
 
 	if (ttm->state != tt_unpopulated)
@@ -978,22 +956,16 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 		drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
 						 gtt->ttm.dma_address, ttm->num_pages);
 		ttm->state = tt_unbound;
-		r = 0;
-		goto trace_mappings;
+		return 0;
 	}
 
 #ifdef CONFIG_SWIOTLB
 	if (swiotlb_nr_tbl()) {
-		r = ttm_dma_populate(&gtt->ttm, adev->dev);
-		goto trace_mappings;
+		return ttm_dma_populate(&gtt->ttm, adev->dev);
 	}
 #endif
 
-	r = ttm_populate_and_map_pages(adev->dev, &gtt->ttm);
-trace_mappings:
-	if (likely(!r))
-		amdgpu_trace_dma_map(ttm);
-	return r;
+	return ttm_populate_and_map_pages(adev->dev, &gtt->ttm);
 }
 
 static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
@@ -1014,8 +986,6 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
 
 	adev = amdgpu_ttm_adev(ttm->bdev);
 
-	amdgpu_trace_dma_unmap(ttm);
-
 #ifdef CONFIG_SWIOTLB
 	if (swiotlb_nr_tbl()) {
 		ttm_dma_unpopulate(&gtt->ttm, adev->dev);
-- 
2.12.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/4] drm/ttm: Remove TTM dma tracepoint since it's not required anymore
       [not found] ` <20170918173350.9543-1-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-09-18 17:33   ` [PATCH 3/4] drm/amd/amdgpu: remove usage of ttm trace Tom St Denis
@ 2017-09-18 17:33   ` Tom St Denis
  2017-09-19 11:13     ` Christian König
  2017-09-18 23:53   ` remove ttm trace and add iova debugfs (v2) StDenis, Tom
  4 siblings, 1 reply; 13+ messages in thread
From: Tom St Denis @ 2017-09-18 17:33 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Tom St Denis, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
---
 drivers/gpu/drm/ttm/Makefile          |  2 +-
 drivers/gpu/drm/ttm/ttm_debug.c       | 74 -----------------------------
 drivers/gpu/drm/ttm/ttm_trace.h       | 87 -----------------------------------
 drivers/gpu/drm/ttm/ttm_tracepoints.c | 45 ------------------
 4 files changed, 1 insertion(+), 207 deletions(-)
 delete mode 100644 drivers/gpu/drm/ttm/ttm_debug.c
 delete mode 100644 drivers/gpu/drm/ttm/ttm_trace.h
 delete mode 100644 drivers/gpu/drm/ttm/ttm_tracepoints.c

diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
index ab2bef1219e5..4d0c938ff4b2 100644
--- a/drivers/gpu/drm/ttm/Makefile
+++ b/drivers/gpu/drm/ttm/Makefile
@@ -4,7 +4,7 @@
 ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
 	ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
 	ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
-	ttm_bo_manager.o ttm_page_alloc_dma.o ttm_debug.o ttm_tracepoints.o
+	ttm_bo_manager.o ttm_page_alloc_dma.o
 ttm-$(CONFIG_AGP) += ttm_agp_backend.o
 
 obj-$(CONFIG_DRM_TTM) += ttm.o
diff --git a/drivers/gpu/drm/ttm/ttm_debug.c b/drivers/gpu/drm/ttm/ttm_debug.c
deleted file mode 100644
index ef5f0d090154..000000000000
--- a/drivers/gpu/drm/ttm/ttm_debug.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/**************************************************************************
- *
- * Copyright (c) 2017 Advanced Micro Devices, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-/*
- * Authors: Tom St Denis <tom.stdenis@amd.com>
- */
-#include <linux/sched.h>
-#include <linux/highmem.h>
-#include <linux/pagemap.h>
-#include <linux/shmem_fs.h>
-#include <linux/file.h>
-#include <linux/swap.h>
-#include <linux/slab.h>
-#include <linux/export.h>
-#include <drm/drm_cache.h>
-#include <drm/ttm/ttm_module.h>
-#include <drm/ttm/ttm_bo_driver.h>
-#include <drm/ttm/ttm_placement.h>
-#include <drm/ttm/ttm_page_alloc.h>
-#include "ttm_trace.h"
-
-void ttm_trace_dma_map(struct device *dev, struct ttm_dma_tt *tt)
-{
-	unsigned i;
-
-	if (unlikely(trace_ttm_dma_map_enabled())) {
-		for (i = 0; i < tt->ttm.num_pages; i++) {
-			trace_ttm_dma_map(
-				dev,
-				tt->ttm.pages[i],
-				tt->dma_address[i]);
-		}
-	}
-}
-EXPORT_SYMBOL(ttm_trace_dma_map);
-
-void ttm_trace_dma_unmap(struct device *dev, struct ttm_dma_tt *tt)
-{
-	unsigned i;
-
-	if (unlikely(trace_ttm_dma_unmap_enabled())) {
-		for (i = 0; i < tt->ttm.num_pages; i++) {
-			trace_ttm_dma_unmap(
-				dev,
-				tt->ttm.pages[i],
-				tt->dma_address[i]);
-		}
-	}
-}
-EXPORT_SYMBOL(ttm_trace_dma_unmap);
-
diff --git a/drivers/gpu/drm/ttm/ttm_trace.h b/drivers/gpu/drm/ttm/ttm_trace.h
deleted file mode 100644
index 715ce68b7b33..000000000000
--- a/drivers/gpu/drm/ttm/ttm_trace.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/**************************************************************************
- *
- * Copyright (c) 2017 Advanced Micro Devices, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-/*
- * Authors: Tom St Denis <tom.stdenis@amd.com>
- */
-#if !defined(_TTM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TTM_TRACE_H_
-
-#include <linux/stringify.h>
-#include <linux/types.h>
-#include <linux/tracepoint.h>
-
-#include <drm/drmP.h>
-
-#undef TRACE_SYSTEM
-#define TRACE_SYSTEM ttm
-#define TRACE_INCLUDE_FILE ttm_trace
-
-TRACE_EVENT(ttm_dma_map,
-	    TP_PROTO(struct device *dev, struct page *page, dma_addr_t dma_address),
-	    TP_ARGS(dev, page, dma_address),
-	    TP_STRUCT__entry(
-				__string(device, dev_name(dev))
-				__field(dma_addr_t, dma)
-				__field(phys_addr_t, phys)
-			    ),
-	    TP_fast_assign(
-			   __assign_str(device, dev_name(dev));
-			   __entry->dma = dma_address;
-			   __entry->phys = page_to_phys(page);
-			   ),
-	    TP_printk("%s: %pad => %pa",
-		      __get_str(device),
-		      &__entry->dma,
-		      &__entry->phys)
-);
-
-TRACE_EVENT(ttm_dma_unmap,
-	    TP_PROTO(struct device *dev, struct page *page, dma_addr_t dma_address),
-	    TP_ARGS(dev, page, dma_address),
-	    TP_STRUCT__entry(
-				__string(device, dev_name(dev))
-				__field(dma_addr_t, dma)
-				__field(phys_addr_t, phys)
-			    ),
-	    TP_fast_assign(
-			   __assign_str(device, dev_name(dev));
-			   __entry->dma = dma_address;
-			   __entry->phys = page_to_phys(page);
-			   ),
-	    TP_printk("%s: %pad => %pa",
-		      __get_str(device),
-		      &__entry->dma,
-		      &__entry->phys)
-);
-
-#endif
-
-/* This part must be outside protection */
-#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/ttm/
-#include <trace/define_trace.h>
-
diff --git a/drivers/gpu/drm/ttm/ttm_tracepoints.c b/drivers/gpu/drm/ttm/ttm_tracepoints.c
deleted file mode 100644
index 861a6266822b..000000000000
--- a/drivers/gpu/drm/ttm/ttm_tracepoints.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/**************************************************************************
- *
- * Copyright (c) 2017 Advanced Micro Devices, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-/*
- * Authors: Tom St Denis <tom.stdenis@amd.com>
- */
-#include <linux/sched.h>
-#include <linux/highmem.h>
-#include <linux/pagemap.h>
-#include <linux/shmem_fs.h>
-#include <linux/file.h>
-#include <linux/swap.h>
-#include <linux/slab.h>
-#include <linux/export.h>
-#include <drm/drm_cache.h>
-#include <drm/ttm/ttm_module.h>
-#include <drm/ttm/ttm_bo_driver.h>
-#include <drm/ttm/ttm_placement.h>
-#include <drm/ttm/ttm_page_alloc.h>
-
-#define CREATE_TRACE_POINTS
-#include "ttm_trace.h"
-- 
2.12.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: remove ttm trace and add iova debugfs (v2)
       [not found] ` <20170918173350.9543-1-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
                     ` (3 preceding siblings ...)
  2017-09-18 17:33   ` [PATCH 4/4] drm/ttm: Remove TTM dma tracepoint since it's not required anymore Tom St Denis
@ 2017-09-18 23:53   ` StDenis, Tom
  4 siblings, 0 replies; 13+ messages in thread
From: StDenis, Tom @ 2017-09-18 23:53 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Should add I was able to read/write system memory mapped by amdgpu with these patches in place on my polaris10 device (with iommu enabled of course).

________________________________________
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Tom St Denis <tom.stdenis@amd.com>
Sent: Monday, September 18, 2017 13:33
To: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: remove ttm trace and add iova debugfs (v2)

In this respin I add some changes per feedback and make the iova
entry have proper read/write methods which access pages mapped
by amdgpu.  So there is no need for /dev/mem or /dev/fmem anymore
when reading system memory.

Patches 3/4 are unchanged and remove the TTM trace from amdgpu
and from TTM itself.


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] drm/amd/amdgpu: Fold TTM debugfs entries into array (v2)
       [not found]     ` <20170918173350.9543-2-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
@ 2017-09-19 11:08       ` Christian König
  0 siblings, 0 replies; 13+ messages in thread
From: Christian König @ 2017-09-19 11:08 UTC (permalink / raw)
  To: Tom St Denis, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Am 18.09.2017 um 19:33 schrieb Tom St Denis:
> Signed-off-by: Tom St Denis <tom.stdenis@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

>
> (v2): add domains and avoid strcmp
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 54 ++++++++++++++++++---------------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h |  4 +--
>   2 files changed, 32 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 8ee16dfdb8af..50d20903de4f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -1809,6 +1809,19 @@ static const struct file_operations amdgpu_ttm_gtt_fops = {
>   
>   #endif
>   
> +
> +
> +static const struct {
> +	char *name;
> +	const struct file_operations *fops;
> +	int domain;
> +} ttm_debugfs_entries[] = {
> +	{ "amdgpu_vram", &amdgpu_ttm_vram_fops, TTM_PL_VRAM },
> +#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
> +	{ "amdgpu_gtt", &amdgpu_ttm_gtt_fops, TTM_PL_TT },
> +#endif
> +};
> +
>   #endif
>   
>   static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
> @@ -1819,22 +1832,21 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
>   	struct drm_minor *minor = adev->ddev->primary;
>   	struct dentry *ent, *root = minor->debugfs_root;
>   
> -	ent = debugfs_create_file("amdgpu_vram", S_IFREG | S_IRUGO, root,
> -				  adev, &amdgpu_ttm_vram_fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> -	i_size_write(ent->d_inode, adev->mc.mc_vram_size);
> -	adev->mman.vram = ent;
> -
> -#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
> -	ent = debugfs_create_file("amdgpu_gtt", S_IFREG | S_IRUGO, root,
> -				  adev, &amdgpu_ttm_gtt_fops);
> -	if (IS_ERR(ent))
> -		return PTR_ERR(ent);
> -	i_size_write(ent->d_inode, adev->mc.gart_size);
> -	adev->mman.gtt = ent;
> +	for (count = 0; count < ARRAY_SIZE(ttm_debugfs_entries); count++) {
> +		ent = debugfs_create_file(
> +				ttm_debugfs_entries[count].name,
> +				S_IFREG | S_IRUGO, root,
> +				adev,
> +				ttm_debugfs_entries[count].fops);
> +		if (IS_ERR(ent))
> +			return PTR_ERR(ent);
> +		if (ttm_debugfs_entries[count].domain == TTM_PL_VRAM)
> +			i_size_write(ent->d_inode, adev->mc.mc_vram_size);
> +		else if (ttm_debugfs_entries[count].domain == TTM_PL_TT)
> +			i_size_write(ent->d_inode, adev->mc.gart_size);
> +		adev->mman.debugfs_entries[count] = ent;
> +	}
>   
> -#endif
>   	count = ARRAY_SIZE(amdgpu_ttm_debugfs_list);
>   
>   #ifdef CONFIG_SWIOTLB
> @@ -1844,7 +1856,6 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
>   
>   	return amdgpu_debugfs_add_files(adev, amdgpu_ttm_debugfs_list, count);
>   #else
> -
>   	return 0;
>   #endif
>   }
> @@ -1852,14 +1863,9 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
>   static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev)
>   {
>   #if defined(CONFIG_DEBUG_FS)
> +	unsigned i;
>   
> -	debugfs_remove(adev->mman.vram);
> -	adev->mman.vram = NULL;
> -
> -#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
> -	debugfs_remove(adev->mman.gtt);
> -	adev->mman.gtt = NULL;
> -#endif
> -
> +	for (i = 0; i < ARRAY_SIZE(ttm_debugfs_entries); i++)
> +		debugfs_remove(adev->mman.debugfs_entries[i]);
>   #endif
>   }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
> index 64709e041d5b..7abae6867339 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
> @@ -24,6 +24,7 @@
>   #ifndef __AMDGPU_TTM_H__
>   #define __AMDGPU_TTM_H__
>   
> +#include "amdgpu.h"
>   #include "gpu_scheduler.h"
>   
>   #define AMDGPU_PL_GDS		(TTM_PL_PRIV + 0)
> @@ -45,8 +46,7 @@ struct amdgpu_mman {
>   	bool				initialized;
>   
>   #if defined(CONFIG_DEBUG_FS)
> -	struct dentry			*vram;
> -	struct dentry			*gtt;
> +	struct dentry			*debugfs_entries[8];
>   #endif
>   
>   	/* buffer handling */


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/4] drm/amd/amdgpu: add support for iova_to_phys to replace TTM trace (v3)
  2017-09-18 17:33   ` [PATCH 2/4] drm/amd/amdgpu: add support for iova_to_phys to replace TTM trace (v3) Tom St Denis
@ 2017-09-19 11:11     ` Christian König
  0 siblings, 0 replies; 13+ messages in thread
From: Christian König @ 2017-09-19 11:11 UTC (permalink / raw)
  To: Tom St Denis, amd-gfx; +Cc: dri-devel

Am 18.09.2017 um 19:33 schrieb Tom St Denis:
> Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
>
> (v2): Add domain to iova debugfs
> (v3): Add true read/write methods to access system memory of pages
>        mapped to the device
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 104 ++++++++++++++++++++++++++++++++
>   1 file changed, 104 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 50d20903de4f..02ae32378e1c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -43,6 +43,7 @@
>   #include <linux/swap.h>
>   #include <linux/pagemap.h>
>   #include <linux/debugfs.h>
> +#include <linux/iommu.h>
>   #include "amdgpu.h"
>   #include "amdgpu_trace.h"
>   #include "bif/bif_4_1_d.h"
> @@ -1810,6 +1811,108 @@ static const struct file_operations amdgpu_ttm_gtt_fops = {
>   #endif
>   
>   
> +static void *transform_page(uint64_t phys)
> +{
> +	if (PageHighMem(pfn_to_page(PFN_DOWN(phys))))
> +		return kmap(pfn_to_page(PFN_DOWN(phys)));
> +	else
> +		return __va(phys);
> +}
> +
> +static void untransform_page(uint64_t phys)
> +{
> +	if (PageHighMem(pfn_to_page(PFN_DOWN(phys))))
> +		return kunmap(pfn_to_page(PFN_DOWN(phys)));
> +}

No need for the extra PageHighMem check, just use kmap()/kunmap() they 
should do the right thing IIRC.

> +
> +static ssize_t amdgpu_iova_to_phys_read(struct file *f, char __user *buf,
> +				   size_t size, loff_t *pos)
> +{
> +	struct amdgpu_device *adev = file_inode(f)->i_private;
> +	ssize_t result, n;
> +	int r;
> +	uint64_t phys;
> +	void *ptr;
> +
> +	result = 0;
> +	while (size) {
> +		// get physical address and map
> +		phys = iommu_iova_to_phys(iommu_get_domain_for_dev(adev->dev), *pos);

Not sure what iommu_get_domain_for_dev does exactly, but the iommu 
domain for the device should always be the same so I would call the 
function only once before the loop.

Also failing with -ENODEV here when iommu_get_domain_for_dev() returns 
NULL sounds like a good idea to me.

> +
> +		// copy upto one page
> +		if (size > PAGE_SIZE)
> +			n = PAGE_SIZE;
> +		else
> +			n = size;
> +
> +		// to end of the page
> +		if (((*pos & (PAGE_SIZE - 1)) + n) >= PAGE_SIZE)
> +			n = PAGE_SIZE - (*pos & (PAGE_SIZE - 1));
> +
> +		ptr = transform_page(phys);
> +		if (!ptr)
> +			return -EFAULT;
> +
> +		r = copy_to_user(buf, ptr, n);
> +		untransform_page(phys);
> +		if (r)
> +			return -EFAULT;
> +
> +		*pos += n;
> +		size -= n;
> +		result += n;
> +	}
> +
> +	return result;
> +}
> +
> +static ssize_t amdgpu_iova_to_phys_write(struct file *f, const char __user *buf,
> +				   size_t size, loff_t *pos)
> +{
> +	struct amdgpu_device *adev = file_inode(f)->i_private;
> +	ssize_t result, n;
> +	int r;
> +	uint64_t phys;
> +	void *ptr;
> +
> +	result = 0;
> +	while (size) {
> +		// get physical address and map
> +		phys = iommu_iova_to_phys(iommu_get_domain_for_dev(adev->dev), *pos);

Same comment as above.

Apart from that looks good to me,
Christian.

> +
> +		// copy upto one page
> +		if (size > PAGE_SIZE)
> +			n = PAGE_SIZE;
> +		else
> +			n = size;
> +
> +		// to end of the page
> +		if (((*pos & (PAGE_SIZE - 1)) + n) >= PAGE_SIZE)
> +			n = PAGE_SIZE - (*pos & (PAGE_SIZE - 1));
> +
> +		ptr = transform_page(phys);
> +		if (!ptr)
> +			return -EFAULT;
> +
> +		r = copy_from_user(ptr, buf, n);
> +		untransform_page(phys);
> +		if (r)
> +			return -EFAULT;
> +
> +		*pos += n;
> +		size -= n;
> +		result += n;
> +	}
> +
> +	return result;
> +}
> +
> +static const struct file_operations amdgpu_ttm_iova_fops = {
> +	.owner = THIS_MODULE,
> +	.read = amdgpu_iova_to_phys_read,
> +	.write = amdgpu_iova_to_phys_write,
> +	.llseek = default_llseek
> +};
>   
>   static const struct {
>   	char *name;
> @@ -1820,6 +1923,7 @@ static const struct {
>   #ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
>   	{ "amdgpu_gtt", &amdgpu_ttm_gtt_fops, TTM_PL_TT },
>   #endif
> +	{ "amdgpu_iova", &amdgpu_ttm_iova_fops, TTM_PL_SYSTEM },
>   };
>   
>   #endif


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/4] drm/amd/amdgpu: remove usage of ttm trace
  2017-09-18 17:33   ` [PATCH 3/4] drm/amd/amdgpu: remove usage of ttm trace Tom St Denis
@ 2017-09-19 11:12     ` Christian König
  0 siblings, 0 replies; 13+ messages in thread
From: Christian König @ 2017-09-19 11:12 UTC (permalink / raw)
  To: Tom St Denis, amd-gfx; +Cc: dri-devel

Am 18.09.2017 um 19:33 schrieb Tom St Denis:
> Signed-off-by: Tom St Denis <tom.stdenis@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 36 +++------------------------------
>   1 file changed, 3 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 02ae32378e1c..b41d03226c26 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -34,7 +34,6 @@
>   #include <drm/ttm/ttm_placement.h>
>   #include <drm/ttm/ttm_module.h>
>   #include <drm/ttm/ttm_page_alloc.h>
> -#include <drm/ttm/ttm_debug.h>
>   #include <drm/drmP.h>
>   #include <drm/amdgpu_drm.h>
>   #include <linux/seq_file.h>
> @@ -704,22 +703,6 @@ void amdgpu_ttm_tt_mark_user_pages(struct ttm_tt *ttm)
>   	}
>   }
>   
> -static void amdgpu_trace_dma_map(struct ttm_tt *ttm)
> -{
> -	struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev);
> -	struct amdgpu_ttm_tt *gtt = (void *)ttm;
> -
> -	ttm_trace_dma_map(adev->dev, &gtt->ttm);
> -}
> -
> -static void amdgpu_trace_dma_unmap(struct ttm_tt *ttm)
> -{
> -	struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev);
> -	struct amdgpu_ttm_tt *gtt = (void *)ttm;
> -
> -	ttm_trace_dma_unmap(adev->dev, &gtt->ttm);
> -}
> -
>   /* prepare the sg table with the user pages */
>   static int amdgpu_ttm_tt_pin_userptr(struct ttm_tt *ttm)
>   {
> @@ -746,8 +729,6 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_tt *ttm)
>   	drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
>   					 gtt->ttm.dma_address, ttm->num_pages);
>   
> -	amdgpu_trace_dma_map(ttm);
> -
>   	return 0;
>   
>   release_sg:
> @@ -773,8 +754,6 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
>   
>   	amdgpu_ttm_tt_mark_user_pages(ttm);
>   
> -	amdgpu_trace_dma_unmap(ttm);
> -
>   	sg_free_table(ttm->sg);
>   }
>   
> @@ -958,7 +937,6 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
>   {
>   	struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev);
>   	struct amdgpu_ttm_tt *gtt = (void *)ttm;
> -	int r;
>   	bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
>   
>   	if (ttm->state != tt_unpopulated)
> @@ -978,22 +956,16 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
>   		drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
>   						 gtt->ttm.dma_address, ttm->num_pages);
>   		ttm->state = tt_unbound;
> -		r = 0;
> -		goto trace_mappings;
> +		return 0;
>   	}
>   
>   #ifdef CONFIG_SWIOTLB
>   	if (swiotlb_nr_tbl()) {
> -		r = ttm_dma_populate(&gtt->ttm, adev->dev);
> -		goto trace_mappings;
> +		return ttm_dma_populate(&gtt->ttm, adev->dev);
>   	}
>   #endif
>   
> -	r = ttm_populate_and_map_pages(adev->dev, &gtt->ttm);
> -trace_mappings:
> -	if (likely(!r))
> -		amdgpu_trace_dma_map(ttm);
> -	return r;
> +	return ttm_populate_and_map_pages(adev->dev, &gtt->ttm);
>   }
>   
>   static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
> @@ -1014,8 +986,6 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
>   
>   	adev = amdgpu_ttm_adev(ttm->bdev);
>   
> -	amdgpu_trace_dma_unmap(ttm);
> -
>   #ifdef CONFIG_SWIOTLB
>   	if (swiotlb_nr_tbl()) {
>   		ttm_dma_unpopulate(&gtt->ttm, adev->dev);


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] drm/ttm: Remove TTM dma tracepoint since it's not required anymore
  2017-09-18 17:33   ` [PATCH 4/4] drm/ttm: Remove TTM dma tracepoint since it's not required anymore Tom St Denis
@ 2017-09-19 11:13     ` Christian König
       [not found]       ` <1eef2bc2-742d-1737-1250-87c74dfb11da-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Christian König @ 2017-09-19 11:13 UTC (permalink / raw)
  To: Tom St Denis, amd-gfx; +Cc: dri-devel

Am 18.09.2017 um 19:33 schrieb Tom St Denis:
> Signed-off-by: Tom St Denis <tom.stdenis@amd.com>

Mhm, I sometimes have good use for those. But just adding a printk at 
the right place does the job as well.

So patch is Reviewed-by: Christian König <christian.koenig@amd.com>.

Regards,
Christian.

> ---
>   drivers/gpu/drm/ttm/Makefile          |  2 +-
>   drivers/gpu/drm/ttm/ttm_debug.c       | 74 -----------------------------
>   drivers/gpu/drm/ttm/ttm_trace.h       | 87 -----------------------------------
>   drivers/gpu/drm/ttm/ttm_tracepoints.c | 45 ------------------
>   4 files changed, 1 insertion(+), 207 deletions(-)
>   delete mode 100644 drivers/gpu/drm/ttm/ttm_debug.c
>   delete mode 100644 drivers/gpu/drm/ttm/ttm_trace.h
>   delete mode 100644 drivers/gpu/drm/ttm/ttm_tracepoints.c
>
> diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
> index ab2bef1219e5..4d0c938ff4b2 100644
> --- a/drivers/gpu/drm/ttm/Makefile
> +++ b/drivers/gpu/drm/ttm/Makefile
> @@ -4,7 +4,7 @@
>   ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
>   	ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
>   	ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
> -	ttm_bo_manager.o ttm_page_alloc_dma.o ttm_debug.o ttm_tracepoints.o
> +	ttm_bo_manager.o ttm_page_alloc_dma.o
>   ttm-$(CONFIG_AGP) += ttm_agp_backend.o
>   
>   obj-$(CONFIG_DRM_TTM) += ttm.o
> diff --git a/drivers/gpu/drm/ttm/ttm_debug.c b/drivers/gpu/drm/ttm/ttm_debug.c
> deleted file mode 100644
> index ef5f0d090154..000000000000
> --- a/drivers/gpu/drm/ttm/ttm_debug.c
> +++ /dev/null
> @@ -1,74 +0,0 @@
> -/**************************************************************************
> - *
> - * Copyright (c) 2017 Advanced Micro Devices, Inc.
> - * All Rights Reserved.
> - *
> - * Permission is hereby granted, free of charge, to any person obtaining a
> - * copy of this software and associated documentation files (the
> - * "Software"), to deal in the Software without restriction, including
> - * without limitation the rights to use, copy, modify, merge, publish,
> - * distribute, sub license, and/or sell copies of the Software, and to
> - * permit persons to whom the Software is furnished to do so, subject to
> - * the following conditions:
> - *
> - * The above copyright notice and this permission notice (including the
> - * next paragraph) shall be included in all copies or substantial portions
> - * of the Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
> - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
> - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
> - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
> - * USE OR OTHER DEALINGS IN THE SOFTWARE.
> - *
> - **************************************************************************/
> -/*
> - * Authors: Tom St Denis <tom.stdenis@amd.com>
> - */
> -#include <linux/sched.h>
> -#include <linux/highmem.h>
> -#include <linux/pagemap.h>
> -#include <linux/shmem_fs.h>
> -#include <linux/file.h>
> -#include <linux/swap.h>
> -#include <linux/slab.h>
> -#include <linux/export.h>
> -#include <drm/drm_cache.h>
> -#include <drm/ttm/ttm_module.h>
> -#include <drm/ttm/ttm_bo_driver.h>
> -#include <drm/ttm/ttm_placement.h>
> -#include <drm/ttm/ttm_page_alloc.h>
> -#include "ttm_trace.h"
> -
> -void ttm_trace_dma_map(struct device *dev, struct ttm_dma_tt *tt)
> -{
> -	unsigned i;
> -
> -	if (unlikely(trace_ttm_dma_map_enabled())) {
> -		for (i = 0; i < tt->ttm.num_pages; i++) {
> -			trace_ttm_dma_map(
> -				dev,
> -				tt->ttm.pages[i],
> -				tt->dma_address[i]);
> -		}
> -	}
> -}
> -EXPORT_SYMBOL(ttm_trace_dma_map);
> -
> -void ttm_trace_dma_unmap(struct device *dev, struct ttm_dma_tt *tt)
> -{
> -	unsigned i;
> -
> -	if (unlikely(trace_ttm_dma_unmap_enabled())) {
> -		for (i = 0; i < tt->ttm.num_pages; i++) {
> -			trace_ttm_dma_unmap(
> -				dev,
> -				tt->ttm.pages[i],
> -				tt->dma_address[i]);
> -		}
> -	}
> -}
> -EXPORT_SYMBOL(ttm_trace_dma_unmap);
> -
> diff --git a/drivers/gpu/drm/ttm/ttm_trace.h b/drivers/gpu/drm/ttm/ttm_trace.h
> deleted file mode 100644
> index 715ce68b7b33..000000000000
> --- a/drivers/gpu/drm/ttm/ttm_trace.h
> +++ /dev/null
> @@ -1,87 +0,0 @@
> -/**************************************************************************
> - *
> - * Copyright (c) 2017 Advanced Micro Devices, Inc.
> - * All Rights Reserved.
> - *
> - * Permission is hereby granted, free of charge, to any person obtaining a
> - * copy of this software and associated documentation files (the
> - * "Software"), to deal in the Software without restriction, including
> - * without limitation the rights to use, copy, modify, merge, publish,
> - * distribute, sub license, and/or sell copies of the Software, and to
> - * permit persons to whom the Software is furnished to do so, subject to
> - * the following conditions:
> - *
> - * The above copyright notice and this permission notice (including the
> - * next paragraph) shall be included in all copies or substantial portions
> - * of the Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
> - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
> - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
> - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
> - * USE OR OTHER DEALINGS IN THE SOFTWARE.
> - *
> - **************************************************************************/
> -/*
> - * Authors: Tom St Denis <tom.stdenis@amd.com>
> - */
> -#if !defined(_TTM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
> -#define _TTM_TRACE_H_
> -
> -#include <linux/stringify.h>
> -#include <linux/types.h>
> -#include <linux/tracepoint.h>
> -
> -#include <drm/drmP.h>
> -
> -#undef TRACE_SYSTEM
> -#define TRACE_SYSTEM ttm
> -#define TRACE_INCLUDE_FILE ttm_trace
> -
> -TRACE_EVENT(ttm_dma_map,
> -	    TP_PROTO(struct device *dev, struct page *page, dma_addr_t dma_address),
> -	    TP_ARGS(dev, page, dma_address),
> -	    TP_STRUCT__entry(
> -				__string(device, dev_name(dev))
> -				__field(dma_addr_t, dma)
> -				__field(phys_addr_t, phys)
> -			    ),
> -	    TP_fast_assign(
> -			   __assign_str(device, dev_name(dev));
> -			   __entry->dma = dma_address;
> -			   __entry->phys = page_to_phys(page);
> -			   ),
> -	    TP_printk("%s: %pad => %pa",
> -		      __get_str(device),
> -		      &__entry->dma,
> -		      &__entry->phys)
> -);
> -
> -TRACE_EVENT(ttm_dma_unmap,
> -	    TP_PROTO(struct device *dev, struct page *page, dma_addr_t dma_address),
> -	    TP_ARGS(dev, page, dma_address),
> -	    TP_STRUCT__entry(
> -				__string(device, dev_name(dev))
> -				__field(dma_addr_t, dma)
> -				__field(phys_addr_t, phys)
> -			    ),
> -	    TP_fast_assign(
> -			   __assign_str(device, dev_name(dev));
> -			   __entry->dma = dma_address;
> -			   __entry->phys = page_to_phys(page);
> -			   ),
> -	    TP_printk("%s: %pad => %pa",
> -		      __get_str(device),
> -		      &__entry->dma,
> -		      &__entry->phys)
> -);
> -
> -#endif
> -
> -/* This part must be outside protection */
> -#undef TRACE_INCLUDE_PATH
> -#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/ttm/
> -#include <trace/define_trace.h>
> -
> diff --git a/drivers/gpu/drm/ttm/ttm_tracepoints.c b/drivers/gpu/drm/ttm/ttm_tracepoints.c
> deleted file mode 100644
> index 861a6266822b..000000000000
> --- a/drivers/gpu/drm/ttm/ttm_tracepoints.c
> +++ /dev/null
> @@ -1,45 +0,0 @@
> -/**************************************************************************
> - *
> - * Copyright (c) 2017 Advanced Micro Devices, Inc.
> - * All Rights Reserved.
> - *
> - * Permission is hereby granted, free of charge, to any person obtaining a
> - * copy of this software and associated documentation files (the
> - * "Software"), to deal in the Software without restriction, including
> - * without limitation the rights to use, copy, modify, merge, publish,
> - * distribute, sub license, and/or sell copies of the Software, and to
> - * permit persons to whom the Software is furnished to do so, subject to
> - * the following conditions:
> - *
> - * The above copyright notice and this permission notice (including the
> - * next paragraph) shall be included in all copies or substantial portions
> - * of the Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
> - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
> - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
> - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
> - * USE OR OTHER DEALINGS IN THE SOFTWARE.
> - *
> - **************************************************************************/
> -/*
> - * Authors: Tom St Denis <tom.stdenis@amd.com>
> - */
> -#include <linux/sched.h>
> -#include <linux/highmem.h>
> -#include <linux/pagemap.h>
> -#include <linux/shmem_fs.h>
> -#include <linux/file.h>
> -#include <linux/swap.h>
> -#include <linux/slab.h>
> -#include <linux/export.h>
> -#include <drm/drm_cache.h>
> -#include <drm/ttm/ttm_module.h>
> -#include <drm/ttm/ttm_bo_driver.h>
> -#include <drm/ttm/ttm_placement.h>
> -#include <drm/ttm/ttm_page_alloc.h>
> -
> -#define CREATE_TRACE_POINTS
> -#include "ttm_trace.h"


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] drm/ttm: Remove TTM dma tracepoint since it's not required anymore
       [not found]       ` <1eef2bc2-742d-1737-1250-87c74dfb11da-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-09-19 11:15         ` Tom St Denis
  2017-09-19 11:46           ` Christian König
  0 siblings, 1 reply; 13+ messages in thread
From: Tom St Denis @ 2017-09-19 11:15 UTC (permalink / raw)
  To: christian.koenig-5C7GfCeVMHo, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 19/09/17 07:13 AM, Christian König wrote:
> Am 18.09.2017 um 19:33 schrieb Tom St Denis:
>> Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
> 
> Mhm, I sometimes have good use for those. But just adding a printk at 
> the right place does the job as well.
> 
> So patch is Reviewed-by: Christian König <christian.koenig@amd.com>.

Well if you want to keep them we should not apply patch #3 then since 
we're the only users of it :-)

I'm ok with dropping #3/#4 if you want (also less work for Alex since we 
won't have to prune that history out of the branch we submit upstream).

umr has already been ported over to the new iova file though so it won't 
be using the trace.

Cheers,
Tom


> 
> Regards,
> Christian.
> 
>> ---
>>   drivers/gpu/drm/ttm/Makefile          |  2 +-
>>   drivers/gpu/drm/ttm/ttm_debug.c       | 74 
>> -----------------------------
>>   drivers/gpu/drm/ttm/ttm_trace.h       | 87 
>> -----------------------------------
>>   drivers/gpu/drm/ttm/ttm_tracepoints.c | 45 ------------------
>>   4 files changed, 1 insertion(+), 207 deletions(-)
>>   delete mode 100644 drivers/gpu/drm/ttm/ttm_debug.c
>>   delete mode 100644 drivers/gpu/drm/ttm/ttm_trace.h
>>   delete mode 100644 drivers/gpu/drm/ttm/ttm_tracepoints.c
>>
>> diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
>> index ab2bef1219e5..4d0c938ff4b2 100644
>> --- a/drivers/gpu/drm/ttm/Makefile
>> +++ b/drivers/gpu/drm/ttm/Makefile
>> @@ -4,7 +4,7 @@
>>   ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
>>       ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
>>       ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
>> -    ttm_bo_manager.o ttm_page_alloc_dma.o ttm_debug.o ttm_tracepoints.o
>> +    ttm_bo_manager.o ttm_page_alloc_dma.o
>>   ttm-$(CONFIG_AGP) += ttm_agp_backend.o
>>   obj-$(CONFIG_DRM_TTM) += ttm.o
>> diff --git a/drivers/gpu/drm/ttm/ttm_debug.c 
>> b/drivers/gpu/drm/ttm/ttm_debug.c
>> deleted file mode 100644
>> index ef5f0d090154..000000000000
>> --- a/drivers/gpu/drm/ttm/ttm_debug.c
>> +++ /dev/null
>> @@ -1,74 +0,0 @@
>> -/************************************************************************** 
>>
>> - *
>> - * Copyright (c) 2017 Advanced Micro Devices, Inc.
>> - * All Rights Reserved.
>> - *
>> - * Permission is hereby granted, free of charge, to any person 
>> obtaining a
>> - * copy of this software and associated documentation files (the
>> - * "Software"), to deal in the Software without restriction, including
>> - * without limitation the rights to use, copy, modify, merge, publish,
>> - * distribute, sub license, and/or sell copies of the Software, and to
>> - * permit persons to whom the Software is furnished to do so, subject to
>> - * the following conditions:
>> - *
>> - * The above copyright notice and this permission notice (including the
>> - * next paragraph) shall be included in all copies or substantial 
>> portions
>> - * of the Software.
>> - *
>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
>> EXPRESS OR
>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
>> MERCHANTABILITY,
>> - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT 
>> SHALL
>> - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR 
>> ANY CLAIM,
>> - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
>> - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
>> OR THE
>> - * USE OR OTHER DEALINGS IN THE SOFTWARE.
>> - *
>> - 
>> **************************************************************************/ 
>>
>> -/*
>> - * Authors: Tom St Denis <tom.stdenis@amd.com>
>> - */
>> -#include <linux/sched.h>
>> -#include <linux/highmem.h>
>> -#include <linux/pagemap.h>
>> -#include <linux/shmem_fs.h>
>> -#include <linux/file.h>
>> -#include <linux/swap.h>
>> -#include <linux/slab.h>
>> -#include <linux/export.h>
>> -#include <drm/drm_cache.h>
>> -#include <drm/ttm/ttm_module.h>
>> -#include <drm/ttm/ttm_bo_driver.h>
>> -#include <drm/ttm/ttm_placement.h>
>> -#include <drm/ttm/ttm_page_alloc.h>
>> -#include "ttm_trace.h"
>> -
>> -void ttm_trace_dma_map(struct device *dev, struct ttm_dma_tt *tt)
>> -{
>> -    unsigned i;
>> -
>> -    if (unlikely(trace_ttm_dma_map_enabled())) {
>> -        for (i = 0; i < tt->ttm.num_pages; i++) {
>> -            trace_ttm_dma_map(
>> -                dev,
>> -                tt->ttm.pages[i],
>> -                tt->dma_address[i]);
>> -        }
>> -    }
>> -}
>> -EXPORT_SYMBOL(ttm_trace_dma_map);
>> -
>> -void ttm_trace_dma_unmap(struct device *dev, struct ttm_dma_tt *tt)
>> -{
>> -    unsigned i;
>> -
>> -    if (unlikely(trace_ttm_dma_unmap_enabled())) {
>> -        for (i = 0; i < tt->ttm.num_pages; i++) {
>> -            trace_ttm_dma_unmap(
>> -                dev,
>> -                tt->ttm.pages[i],
>> -                tt->dma_address[i]);
>> -        }
>> -    }
>> -}
>> -EXPORT_SYMBOL(ttm_trace_dma_unmap);
>> -
>> diff --git a/drivers/gpu/drm/ttm/ttm_trace.h 
>> b/drivers/gpu/drm/ttm/ttm_trace.h
>> deleted file mode 100644
>> index 715ce68b7b33..000000000000
>> --- a/drivers/gpu/drm/ttm/ttm_trace.h
>> +++ /dev/null
>> @@ -1,87 +0,0 @@
>> -/************************************************************************** 
>>
>> - *
>> - * Copyright (c) 2017 Advanced Micro Devices, Inc.
>> - * All Rights Reserved.
>> - *
>> - * Permission is hereby granted, free of charge, to any person 
>> obtaining a
>> - * copy of this software and associated documentation files (the
>> - * "Software"), to deal in the Software without restriction, including
>> - * without limitation the rights to use, copy, modify, merge, publish,
>> - * distribute, sub license, and/or sell copies of the Software, and to
>> - * permit persons to whom the Software is furnished to do so, subject to
>> - * the following conditions:
>> - *
>> - * The above copyright notice and this permission notice (including the
>> - * next paragraph) shall be included in all copies or substantial 
>> portions
>> - * of the Software.
>> - *
>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
>> EXPRESS OR
>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
>> MERCHANTABILITY,
>> - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT 
>> SHALL
>> - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR 
>> ANY CLAIM,
>> - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
>> - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
>> OR THE
>> - * USE OR OTHER DEALINGS IN THE SOFTWARE.
>> - *
>> - 
>> **************************************************************************/ 
>>
>> -/*
>> - * Authors: Tom St Denis <tom.stdenis@amd.com>
>> - */
>> -#if !defined(_TTM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
>> -#define _TTM_TRACE_H_
>> -
>> -#include <linux/stringify.h>
>> -#include <linux/types.h>
>> -#include <linux/tracepoint.h>
>> -
>> -#include <drm/drmP.h>
>> -
>> -#undef TRACE_SYSTEM
>> -#define TRACE_SYSTEM ttm
>> -#define TRACE_INCLUDE_FILE ttm_trace
>> -
>> -TRACE_EVENT(ttm_dma_map,
>> -        TP_PROTO(struct device *dev, struct page *page, dma_addr_t 
>> dma_address),
>> -        TP_ARGS(dev, page, dma_address),
>> -        TP_STRUCT__entry(
>> -                __string(device, dev_name(dev))
>> -                __field(dma_addr_t, dma)
>> -                __field(phys_addr_t, phys)
>> -                ),
>> -        TP_fast_assign(
>> -               __assign_str(device, dev_name(dev));
>> -               __entry->dma = dma_address;
>> -               __entry->phys = page_to_phys(page);
>> -               ),
>> -        TP_printk("%s: %pad => %pa",
>> -              __get_str(device),
>> -              &__entry->dma,
>> -              &__entry->phys)
>> -);
>> -
>> -TRACE_EVENT(ttm_dma_unmap,
>> -        TP_PROTO(struct device *dev, struct page *page, dma_addr_t 
>> dma_address),
>> -        TP_ARGS(dev, page, dma_address),
>> -        TP_STRUCT__entry(
>> -                __string(device, dev_name(dev))
>> -                __field(dma_addr_t, dma)
>> -                __field(phys_addr_t, phys)
>> -                ),
>> -        TP_fast_assign(
>> -               __assign_str(device, dev_name(dev));
>> -               __entry->dma = dma_address;
>> -               __entry->phys = page_to_phys(page);
>> -               ),
>> -        TP_printk("%s: %pad => %pa",
>> -              __get_str(device),
>> -              &__entry->dma,
>> -              &__entry->phys)
>> -);
>> -
>> -#endif
>> -
>> -/* This part must be outside protection */
>> -#undef TRACE_INCLUDE_PATH
>> -#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/ttm/
>> -#include <trace/define_trace.h>
>> -
>> diff --git a/drivers/gpu/drm/ttm/ttm_tracepoints.c 
>> b/drivers/gpu/drm/ttm/ttm_tracepoints.c
>> deleted file mode 100644
>> index 861a6266822b..000000000000
>> --- a/drivers/gpu/drm/ttm/ttm_tracepoints.c
>> +++ /dev/null
>> @@ -1,45 +0,0 @@
>> -/************************************************************************** 
>>
>> - *
>> - * Copyright (c) 2017 Advanced Micro Devices, Inc.
>> - * All Rights Reserved.
>> - *
>> - * Permission is hereby granted, free of charge, to any person 
>> obtaining a
>> - * copy of this software and associated documentation files (the
>> - * "Software"), to deal in the Software without restriction, including
>> - * without limitation the rights to use, copy, modify, merge, publish,
>> - * distribute, sub license, and/or sell copies of the Software, and to
>> - * permit persons to whom the Software is furnished to do so, subject to
>> - * the following conditions:
>> - *
>> - * The above copyright notice and this permission notice (including the
>> - * next paragraph) shall be included in all copies or substantial 
>> portions
>> - * of the Software.
>> - *
>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
>> EXPRESS OR
>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
>> MERCHANTABILITY,
>> - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT 
>> SHALL
>> - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR 
>> ANY CLAIM,
>> - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
>> - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
>> OR THE
>> - * USE OR OTHER DEALINGS IN THE SOFTWARE.
>> - *
>> - 
>> **************************************************************************/ 
>>
>> -/*
>> - * Authors: Tom St Denis <tom.stdenis@amd.com>
>> - */
>> -#include <linux/sched.h>
>> -#include <linux/highmem.h>
>> -#include <linux/pagemap.h>
>> -#include <linux/shmem_fs.h>
>> -#include <linux/file.h>
>> -#include <linux/swap.h>
>> -#include <linux/slab.h>
>> -#include <linux/export.h>
>> -#include <drm/drm_cache.h>
>> -#include <drm/ttm/ttm_module.h>
>> -#include <drm/ttm/ttm_bo_driver.h>
>> -#include <drm/ttm/ttm_placement.h>
>> -#include <drm/ttm/ttm_page_alloc.h>
>> -
>> -#define CREATE_TRACE_POINTS
>> -#include "ttm_trace.h"
> 
> 

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] drm/ttm: Remove TTM dma tracepoint since it's not required anymore
  2017-09-19 11:15         ` Tom St Denis
@ 2017-09-19 11:46           ` Christian König
  0 siblings, 0 replies; 13+ messages in thread
From: Christian König @ 2017-09-19 11:46 UTC (permalink / raw)
  To: Tom St Denis, amd-gfx; +Cc: dri-devel

Am 19.09.2017 um 13:15 schrieb Tom St Denis:
> On 19/09/17 07:13 AM, Christian König wrote:
>> Am 18.09.2017 um 19:33 schrieb Tom St Denis:
>>> Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
>>
>> Mhm, I sometimes have good use for those. But just adding a printk at 
>> the right place does the job as well.
>>
>> So patch is Reviewed-by: Christian König <christian.koenig@amd.com>.
>
> Well if you want to keep them we should not apply patch #3 then since 
> we're the only users of it :-)
>
> I'm ok with dropping #3/#4 if you want (also less work for Alex since 
> we won't have to prune that history out of the branch we submit 
> upstream).

Please remove that for now. The next time I need it I can cleanup and 
resubmit the patches so that they work for all drivers in the kernel.

Christian.

>
> umr has already been ported over to the new iova file though so it 
> won't be using the trace.
>
> Cheers,
> Tom
>
>
>>
>> Regards,
>> Christian.
>>
>>> ---
>>>   drivers/gpu/drm/ttm/Makefile          |  2 +-
>>>   drivers/gpu/drm/ttm/ttm_debug.c       | 74 
>>> -----------------------------
>>>   drivers/gpu/drm/ttm/ttm_trace.h       | 87 
>>> -----------------------------------
>>>   drivers/gpu/drm/ttm/ttm_tracepoints.c | 45 ------------------
>>>   4 files changed, 1 insertion(+), 207 deletions(-)
>>>   delete mode 100644 drivers/gpu/drm/ttm/ttm_debug.c
>>>   delete mode 100644 drivers/gpu/drm/ttm/ttm_trace.h
>>>   delete mode 100644 drivers/gpu/drm/ttm/ttm_tracepoints.c
>>>
>>> diff --git a/drivers/gpu/drm/ttm/Makefile 
>>> b/drivers/gpu/drm/ttm/Makefile
>>> index ab2bef1219e5..4d0c938ff4b2 100644
>>> --- a/drivers/gpu/drm/ttm/Makefile
>>> +++ b/drivers/gpu/drm/ttm/Makefile
>>> @@ -4,7 +4,7 @@
>>>   ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
>>>       ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
>>>       ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
>>> -    ttm_bo_manager.o ttm_page_alloc_dma.o ttm_debug.o 
>>> ttm_tracepoints.o
>>> +    ttm_bo_manager.o ttm_page_alloc_dma.o
>>>   ttm-$(CONFIG_AGP) += ttm_agp_backend.o
>>>   obj-$(CONFIG_DRM_TTM) += ttm.o
>>> diff --git a/drivers/gpu/drm/ttm/ttm_debug.c 
>>> b/drivers/gpu/drm/ttm/ttm_debug.c
>>> deleted file mode 100644
>>> index ef5f0d090154..000000000000
>>> --- a/drivers/gpu/drm/ttm/ttm_debug.c
>>> +++ /dev/null
>>> @@ -1,74 +0,0 @@
>>> -/************************************************************************** 
>>>
>>> - *
>>> - * Copyright (c) 2017 Advanced Micro Devices, Inc.
>>> - * All Rights Reserved.
>>> - *
>>> - * Permission is hereby granted, free of charge, to any person 
>>> obtaining a
>>> - * copy of this software and associated documentation files (the
>>> - * "Software"), to deal in the Software without restriction, including
>>> - * without limitation the rights to use, copy, modify, merge, publish,
>>> - * distribute, sub license, and/or sell copies of the Software, and to
>>> - * permit persons to whom the Software is furnished to do so, 
>>> subject to
>>> - * the following conditions:
>>> - *
>>> - * The above copyright notice and this permission notice (including 
>>> the
>>> - * next paragraph) shall be included in all copies or substantial 
>>> portions
>>> - * of the Software.
>>> - *
>>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
>>> EXPRESS OR
>>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
>>> MERCHANTABILITY,
>>> - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO 
>>> EVENT SHALL
>>> - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE 
>>> FOR ANY CLAIM,
>>> - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
>>> TORT OR
>>> - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
>>> SOFTWARE OR THE
>>> - * USE OR OTHER DEALINGS IN THE SOFTWARE.
>>> - *
>>> - 
>>> **************************************************************************/ 
>>>
>>> -/*
>>> - * Authors: Tom St Denis <tom.stdenis@amd.com>
>>> - */
>>> -#include <linux/sched.h>
>>> -#include <linux/highmem.h>
>>> -#include <linux/pagemap.h>
>>> -#include <linux/shmem_fs.h>
>>> -#include <linux/file.h>
>>> -#include <linux/swap.h>
>>> -#include <linux/slab.h>
>>> -#include <linux/export.h>
>>> -#include <drm/drm_cache.h>
>>> -#include <drm/ttm/ttm_module.h>
>>> -#include <drm/ttm/ttm_bo_driver.h>
>>> -#include <drm/ttm/ttm_placement.h>
>>> -#include <drm/ttm/ttm_page_alloc.h>
>>> -#include "ttm_trace.h"
>>> -
>>> -void ttm_trace_dma_map(struct device *dev, struct ttm_dma_tt *tt)
>>> -{
>>> -    unsigned i;
>>> -
>>> -    if (unlikely(trace_ttm_dma_map_enabled())) {
>>> -        for (i = 0; i < tt->ttm.num_pages; i++) {
>>> -            trace_ttm_dma_map(
>>> -                dev,
>>> -                tt->ttm.pages[i],
>>> -                tt->dma_address[i]);
>>> -        }
>>> -    }
>>> -}
>>> -EXPORT_SYMBOL(ttm_trace_dma_map);
>>> -
>>> -void ttm_trace_dma_unmap(struct device *dev, struct ttm_dma_tt *tt)
>>> -{
>>> -    unsigned i;
>>> -
>>> -    if (unlikely(trace_ttm_dma_unmap_enabled())) {
>>> -        for (i = 0; i < tt->ttm.num_pages; i++) {
>>> -            trace_ttm_dma_unmap(
>>> -                dev,
>>> -                tt->ttm.pages[i],
>>> -                tt->dma_address[i]);
>>> -        }
>>> -    }
>>> -}
>>> -EXPORT_SYMBOL(ttm_trace_dma_unmap);
>>> -
>>> diff --git a/drivers/gpu/drm/ttm/ttm_trace.h 
>>> b/drivers/gpu/drm/ttm/ttm_trace.h
>>> deleted file mode 100644
>>> index 715ce68b7b33..000000000000
>>> --- a/drivers/gpu/drm/ttm/ttm_trace.h
>>> +++ /dev/null
>>> @@ -1,87 +0,0 @@
>>> -/************************************************************************** 
>>>
>>> - *
>>> - * Copyright (c) 2017 Advanced Micro Devices, Inc.
>>> - * All Rights Reserved.
>>> - *
>>> - * Permission is hereby granted, free of charge, to any person 
>>> obtaining a
>>> - * copy of this software and associated documentation files (the
>>> - * "Software"), to deal in the Software without restriction, including
>>> - * without limitation the rights to use, copy, modify, merge, publish,
>>> - * distribute, sub license, and/or sell copies of the Software, and to
>>> - * permit persons to whom the Software is furnished to do so, 
>>> subject to
>>> - * the following conditions:
>>> - *
>>> - * The above copyright notice and this permission notice (including 
>>> the
>>> - * next paragraph) shall be included in all copies or substantial 
>>> portions
>>> - * of the Software.
>>> - *
>>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
>>> EXPRESS OR
>>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
>>> MERCHANTABILITY,
>>> - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO 
>>> EVENT SHALL
>>> - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE 
>>> FOR ANY CLAIM,
>>> - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
>>> TORT OR
>>> - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
>>> SOFTWARE OR THE
>>> - * USE OR OTHER DEALINGS IN THE SOFTWARE.
>>> - *
>>> - 
>>> **************************************************************************/ 
>>>
>>> -/*
>>> - * Authors: Tom St Denis <tom.stdenis@amd.com>
>>> - */
>>> -#if !defined(_TTM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
>>> -#define _TTM_TRACE_H_
>>> -
>>> -#include <linux/stringify.h>
>>> -#include <linux/types.h>
>>> -#include <linux/tracepoint.h>
>>> -
>>> -#include <drm/drmP.h>
>>> -
>>> -#undef TRACE_SYSTEM
>>> -#define TRACE_SYSTEM ttm
>>> -#define TRACE_INCLUDE_FILE ttm_trace
>>> -
>>> -TRACE_EVENT(ttm_dma_map,
>>> -        TP_PROTO(struct device *dev, struct page *page, dma_addr_t 
>>> dma_address),
>>> -        TP_ARGS(dev, page, dma_address),
>>> -        TP_STRUCT__entry(
>>> -                __string(device, dev_name(dev))
>>> -                __field(dma_addr_t, dma)
>>> -                __field(phys_addr_t, phys)
>>> -                ),
>>> -        TP_fast_assign(
>>> -               __assign_str(device, dev_name(dev));
>>> -               __entry->dma = dma_address;
>>> -               __entry->phys = page_to_phys(page);
>>> -               ),
>>> -        TP_printk("%s: %pad => %pa",
>>> -              __get_str(device),
>>> -              &__entry->dma,
>>> -              &__entry->phys)
>>> -);
>>> -
>>> -TRACE_EVENT(ttm_dma_unmap,
>>> -        TP_PROTO(struct device *dev, struct page *page, dma_addr_t 
>>> dma_address),
>>> -        TP_ARGS(dev, page, dma_address),
>>> -        TP_STRUCT__entry(
>>> -                __string(device, dev_name(dev))
>>> -                __field(dma_addr_t, dma)
>>> -                __field(phys_addr_t, phys)
>>> -                ),
>>> -        TP_fast_assign(
>>> -               __assign_str(device, dev_name(dev));
>>> -               __entry->dma = dma_address;
>>> -               __entry->phys = page_to_phys(page);
>>> -               ),
>>> -        TP_printk("%s: %pad => %pa",
>>> -              __get_str(device),
>>> -              &__entry->dma,
>>> -              &__entry->phys)
>>> -);
>>> -
>>> -#endif
>>> -
>>> -/* This part must be outside protection */
>>> -#undef TRACE_INCLUDE_PATH
>>> -#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/ttm/
>>> -#include <trace/define_trace.h>
>>> -
>>> diff --git a/drivers/gpu/drm/ttm/ttm_tracepoints.c 
>>> b/drivers/gpu/drm/ttm/ttm_tracepoints.c
>>> deleted file mode 100644
>>> index 861a6266822b..000000000000
>>> --- a/drivers/gpu/drm/ttm/ttm_tracepoints.c
>>> +++ /dev/null
>>> @@ -1,45 +0,0 @@
>>> -/************************************************************************** 
>>>
>>> - *
>>> - * Copyright (c) 2017 Advanced Micro Devices, Inc.
>>> - * All Rights Reserved.
>>> - *
>>> - * Permission is hereby granted, free of charge, to any person 
>>> obtaining a
>>> - * copy of this software and associated documentation files (the
>>> - * "Software"), to deal in the Software without restriction, including
>>> - * without limitation the rights to use, copy, modify, merge, publish,
>>> - * distribute, sub license, and/or sell copies of the Software, and to
>>> - * permit persons to whom the Software is furnished to do so, 
>>> subject to
>>> - * the following conditions:
>>> - *
>>> - * The above copyright notice and this permission notice (including 
>>> the
>>> - * next paragraph) shall be included in all copies or substantial 
>>> portions
>>> - * of the Software.
>>> - *
>>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
>>> EXPRESS OR
>>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
>>> MERCHANTABILITY,
>>> - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO 
>>> EVENT SHALL
>>> - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE 
>>> FOR ANY CLAIM,
>>> - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
>>> TORT OR
>>> - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
>>> SOFTWARE OR THE
>>> - * USE OR OTHER DEALINGS IN THE SOFTWARE.
>>> - *
>>> - 
>>> **************************************************************************/ 
>>>
>>> -/*
>>> - * Authors: Tom St Denis <tom.stdenis@amd.com>
>>> - */
>>> -#include <linux/sched.h>
>>> -#include <linux/highmem.h>
>>> -#include <linux/pagemap.h>
>>> -#include <linux/shmem_fs.h>
>>> -#include <linux/file.h>
>>> -#include <linux/swap.h>
>>> -#include <linux/slab.h>
>>> -#include <linux/export.h>
>>> -#include <drm/drm_cache.h>
>>> -#include <drm/ttm/ttm_module.h>
>>> -#include <drm/ttm/ttm_bo_driver.h>
>>> -#include <drm/ttm/ttm_placement.h>
>>> -#include <drm/ttm/ttm_page_alloc.h>
>>> -
>>> -#define CREATE_TRACE_POINTS
>>> -#include "ttm_trace.h"
>>
>>
>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 3/4] drm/amd/amdgpu: remove usage of ttm trace
  2017-09-18 12:35 Remove TTM trace and use proper IOMMU api Tom St Denis
@ 2017-09-18 12:35 ` Tom St Denis
  0 siblings, 0 replies; 13+ messages in thread
From: Tom St Denis @ 2017-09-18 12:35 UTC (permalink / raw)
  To: amd-gfx; +Cc: Tom St Denis, dri-devel

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 36 +++------------------------------
 1 file changed, 3 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index b4c298925e2a..e0c37fe4d043 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -34,7 +34,6 @@
 #include <drm/ttm/ttm_placement.h>
 #include <drm/ttm/ttm_module.h>
 #include <drm/ttm/ttm_page_alloc.h>
-#include <drm/ttm/ttm_debug.h>
 #include <drm/drmP.h>
 #include <drm/amdgpu_drm.h>
 #include <linux/seq_file.h>
@@ -704,22 +703,6 @@ void amdgpu_ttm_tt_mark_user_pages(struct ttm_tt *ttm)
 	}
 }
 
-static void amdgpu_trace_dma_map(struct ttm_tt *ttm)
-{
-	struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev);
-	struct amdgpu_ttm_tt *gtt = (void *)ttm;
-
-	ttm_trace_dma_map(adev->dev, &gtt->ttm);
-}
-
-static void amdgpu_trace_dma_unmap(struct ttm_tt *ttm)
-{
-	struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev);
-	struct amdgpu_ttm_tt *gtt = (void *)ttm;
-
-	ttm_trace_dma_unmap(adev->dev, &gtt->ttm);
-}
-
 /* prepare the sg table with the user pages */
 static int amdgpu_ttm_tt_pin_userptr(struct ttm_tt *ttm)
 {
@@ -746,8 +729,6 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_tt *ttm)
 	drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
 					 gtt->ttm.dma_address, ttm->num_pages);
 
-	amdgpu_trace_dma_map(ttm);
-
 	return 0;
 
 release_sg:
@@ -773,8 +754,6 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
 
 	amdgpu_ttm_tt_mark_user_pages(ttm);
 
-	amdgpu_trace_dma_unmap(ttm);
-
 	sg_free_table(ttm->sg);
 }
 
@@ -958,7 +937,6 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 {
 	struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev);
 	struct amdgpu_ttm_tt *gtt = (void *)ttm;
-	int r;
 	bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
 
 	if (ttm->state != tt_unpopulated)
@@ -978,22 +956,16 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 		drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
 						 gtt->ttm.dma_address, ttm->num_pages);
 		ttm->state = tt_unbound;
-		r = 0;
-		goto trace_mappings;
+		return 0;
 	}
 
 #ifdef CONFIG_SWIOTLB
 	if (swiotlb_nr_tbl()) {
-		r = ttm_dma_populate(&gtt->ttm, adev->dev);
-		goto trace_mappings;
+		return ttm_dma_populate(&gtt->ttm, adev->dev);
 	}
 #endif
 
-	r = ttm_populate_and_map_pages(adev->dev, &gtt->ttm);
-trace_mappings:
-	if (likely(!r))
-		amdgpu_trace_dma_map(ttm);
-	return r;
+	return ttm_populate_and_map_pages(adev->dev, &gtt->ttm);
 }
 
 static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
@@ -1014,8 +986,6 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
 
 	adev = amdgpu_ttm_adev(ttm->bdev);
 
-	amdgpu_trace_dma_unmap(ttm);
-
 #ifdef CONFIG_SWIOTLB
 	if (swiotlb_nr_tbl()) {
 		ttm_dma_unpopulate(&gtt->ttm, adev->dev);
-- 
2.12.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-09-19 11:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-18 17:33 remove ttm trace and add iova debugfs (v2) Tom St Denis
     [not found] ` <20170918173350.9543-1-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
2017-09-18 17:33   ` [PATCH 1/4] drm/amd/amdgpu: Fold TTM debugfs entries into array (v2) Tom St Denis
     [not found]     ` <20170918173350.9543-2-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
2017-09-19 11:08       ` Christian König
2017-09-18 17:33   ` [PATCH 2/4] drm/amd/amdgpu: add support for iova_to_phys to replace TTM trace (v3) Tom St Denis
2017-09-19 11:11     ` Christian König
2017-09-18 17:33   ` [PATCH 3/4] drm/amd/amdgpu: remove usage of ttm trace Tom St Denis
2017-09-19 11:12     ` Christian König
2017-09-18 17:33   ` [PATCH 4/4] drm/ttm: Remove TTM dma tracepoint since it's not required anymore Tom St Denis
2017-09-19 11:13     ` Christian König
     [not found]       ` <1eef2bc2-742d-1737-1250-87c74dfb11da-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-19 11:15         ` Tom St Denis
2017-09-19 11:46           ` Christian König
2017-09-18 23:53   ` remove ttm trace and add iova debugfs (v2) StDenis, Tom
  -- strict thread matches above, loose matches on Subject: below --
2017-09-18 12:35 Remove TTM trace and use proper IOMMU api Tom St Denis
2017-09-18 12:35 ` [PATCH 3/4] drm/amd/amdgpu: remove usage of ttm trace Tom St Denis

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.