Skip to contentSkip to conversation

Revert "switch over from ttm trace to iova debugfs entry (v3)"

PATCH New Tom St Denis 1 participant 2 messages Sep 20, 2017 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Revert "switch over from ttm trace to iova debugfs entry (v3)"

This reverts commit 0e1c378fce66db833e08770d888dda1c5ec7936a.

---
 src/lib/CMakeLists.txt |   1 +
 src/lib/close_asic.c   |   2 +-
 src/lib/discover.c     |   3 -
 src/lib/free_maps.c    |  44 ++++++++++
 src/lib/read_vram.c    | 218 ++++++++++++++++++++++++++++++++++++++++++++-----
 src/umr.h              |  14 +++-
 6 files changed, 254 insertions(+), 28 deletions(-)
 create mode 100644 src/lib/free_maps.c
src/lib/CMakeLists.txt +1 -0
index a21fdf8eea2d..78d827ac1bf1 100644
@@ -14,6 +14,7 @@ add_library(umrcore STATIC
   discover.c
   dump_ib.c
   find_reg.c
+  free_maps.c
   mmio.c
   query_drm.c
   read_sensor.c
src/lib/close_asic.c +1 -1
index a140409e617b..d532a11fa671 100644
@@ -29,6 +29,7 @@
 void umr_free_asic(struct umr_asic *asic)
 {
 	int x;
+	umr_free_maps(asic);
 	if (asic->pci.mem != NULL) {
 		// free PCI mapping
 		pci_device_unmap_range(asic->pci.pdevice, asic->pci.mem, asic->pci.pdevice->regions[asic->pci.region].size);
@@ -56,7 +57,6 @@ void umr_close_asic(struct umr_asic *asic)
 		cond_close(asic->fd.vram);
 		cond_close(asic->fd.gpr);
 		cond_close(asic->fd.drm);
-		cond_close(asic->fd.iova);
 		umr_free_asic(asic);
 	}
 }
src/lib/discover.c +0 -3
index ff7950e4e6ba..dcc212fc39e4 100644
@@ -222,8 +222,6 @@ struct umr_asic *umr_discover_asic(struct umr_options *options)
 			asic->fd.vram = open(fname, O_RDWR);
 			snprintf(fname, sizeof(fname)-1, "/sys/kernel/debug/dri/%d/amdgpu_gpr", asic->instance);
 			asic->fd.gpr = open(fname, O_RDWR);
-			snprintf(fname, sizeof(fname)-1, "/sys/kernel/debug/dri/%d/amdgpu_iova", asic->instance);
-			asic->fd.iova = open(fname, O_RDWR);
 			asic->fd.drm = -1; // default to closed
 			// if appending to the fd list remember to update close_asic() and discover_by_did()...
 		} else {
@@ -237,7 +235,6 @@ struct umr_asic *umr_discover_asic(struct umr_options *options)
 			asic->fd.vram = -1;
 			asic->fd.gpr = -1;
 			asic->fd.drm = -1;
-			asic->fd.iova = -1;
 		}
 
 		if (options->use_pci) {
src/lib/free_maps.c new file +44 -0

44 lines not on this page · raw message

src/lib/read_vram.c +196 -22

277 lines not on this page · raw message

src/umr.h +12 -2
index a374a0d23301..3d2252e35608 100644
@@ -210,6 +210,17 @@ struct umr_options {
 	} pci;
 };
 
+struct umr_dma_maps {
+	struct umr_map {
+		uint64_t
+			dma_addr,
+			phys_addr,
+			key;
+		int valid;
+		struct umr_map *left, *right;
+	} *maps;
+};
+
 struct umr_asic {
 	char *asicname;
 	int no_blocks;
@@ -232,8 +243,7 @@ struct umr_asic {
 		    drm,
 		    wave,
 		    vram,
-		    gpr,
-		    iova;
+		    gpr;
 	} fd;
 	struct {
 		struct pci_device *pdevice;
Signature · 6 lines
2.12.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 2/2 switch over from ttm trace to iova debugfs entry (v3)

(v3): Use original version of iova file but add support for non-iommu hosts.

---
 src/lib/CMakeLists.txt |   1 -
 src/lib/close_asic.c   |   2 +-
 src/lib/discover.c     |   3 +
 src/lib/free_maps.c    |  44 -------------
 src/lib/read_vram.c    | 169 ++-----------------------------------------------
 src/umr.h              |  14 +---
 6 files changed, 13 insertions(+), 220 deletions(-)
 delete mode 100644 src/lib/free_maps.c
src/lib/CMakeLists.txt +0 -1
index 78d827ac1bf1..a21fdf8eea2d 100644
@@ -14,7 +14,6 @@ add_library(umrcore STATIC
   discover.c
   dump_ib.c
   find_reg.c
-  free_maps.c
   mmio.c
   query_drm.c
   read_sensor.c
src/lib/close_asic.c +1 -1
index d532a11fa671..a140409e617b 100644
@@ -29,7 +29,6 @@
 void umr_free_asic(struct umr_asic *asic)
 {
 	int x;
-	umr_free_maps(asic);
 	if (asic->pci.mem != NULL) {
 		// free PCI mapping
 		pci_device_unmap_range(asic->pci.pdevice, asic->pci.mem, asic->pci.pdevice->regions[asic->pci.region].size);
@@ -57,6 +56,7 @@ void umr_close_asic(struct umr_asic *asic)
 		cond_close(asic->fd.vram);
 		cond_close(asic->fd.gpr);
 		cond_close(asic->fd.drm);
+		cond_close(asic->fd.iova);
 		umr_free_asic(asic);
 	}
 }
src/lib/discover.c +3 -0
index dcc212fc39e4..ff7950e4e6ba 100644
@@ -222,6 +222,8 @@ struct umr_asic *umr_discover_asic(struct umr_options *options)
 			asic->fd.vram = open(fname, O_RDWR);
 			snprintf(fname, sizeof(fname)-1, "/sys/kernel/debug/dri/%d/amdgpu_gpr", asic->instance);
 			asic->fd.gpr = open(fname, O_RDWR);
+			snprintf(fname, sizeof(fname)-1, "/sys/kernel/debug/dri/%d/amdgpu_iova", asic->instance);
+			asic->fd.iova = open(fname, O_RDWR);
 			asic->fd.drm = -1; // default to closed
 			// if appending to the fd list remember to update close_asic() and discover_by_did()...
 		} else {
@@ -235,6 +237,7 @@ struct umr_asic *umr_discover_asic(struct umr_options *options)
 			asic->fd.vram = -1;
 			asic->fd.gpr = -1;
 			asic->fd.drm = -1;
+			asic->fd.iova = -1;
 		}
 
 		if (options->use_pci) {
src/lib/free_maps.c deleted +0 -44

44 lines not on this page · raw message

src/lib/read_vram.c +7 -162

185 lines not on this page · raw message

src/umr.h +2 -12
index 3d2252e35608..a374a0d23301 100644
@@ -210,17 +210,6 @@ struct umr_options {
 	} pci;
 };
 
-struct umr_dma_maps {
-	struct umr_map {
-		uint64_t
-			dma_addr,
-			phys_addr,
-			key;
-		int valid;
-		struct umr_map *left, *right;
-	} *maps;
-};
-
 struct umr_asic {
 	char *asicname;
 	int no_blocks;
@@ -243,7 +232,8 @@ struct umr_asic {
 		    drm,
 		    wave,
 		    vram,
-		    gpr;
+		    gpr,
+		    iova;
 	} fd;
 	struct {
 		struct pci_device *pdevice;
Signature · 6 lines
2.12.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx