Skip to contentSkip to conversation

umr: Various cleanups and better VM decoding

PATCH New Tom St Denis 1 participant 5 messages Jul 25, 2017 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

This series is a revamp of the series I sent out earlier in the week. To recap:

Patch #1 removes the risky option and --print command.

Patch #2 allows you to specify VMIDs in hex as well as decimal

Patch #3 is a couple of simple cleanups found by review and static checking.

Patch #4 includes three changes that were worked on at the same time. First, you can halt SQ waves while reading them. Next, we add the --vm-decode command which is used to decode VM addresses (without reading data from the pages), and finally the read_vram functions have been overhauled to print out more useful information as well as fix some framebuffer offset bugs present on VI due to recent kernel changes.

In a subsequent series I plan to factor our the PDE/PTE decoding from the read_vram functions so that the --vm-decode can be less noisy. But that doesn't fit in with this series so it'll have to wait. So for now I apologize for the noisy --vm-decode output :-)

Cheers,
Tom

_______________________________________________
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 1/4 Remove 'risky' option --print command. (v2)

(v2) Remove --print from man page

---
 demo/update/read_sensor.sh |  2 +-
 doc/umr.1                  |  9 ---------
 src/app/main.c             |  8 +-------
 src/app/scan.c             |  1 -
 src/app/set_bit.c          |  1 -
 src/app/set_reg.c          |  1 -
 src/lib/ip/gfx60.c         | 15 ++-------------
 src/lib/ip/gfx70.c         | 15 ++-------------
 src/lib/ip/gfx72.c         | 15 ++-------------
 src/lib/ip/gfx80.c         | 15 ++-------------
 src/lib/ip/gfx81.c         | 15 ++-------------
 src/lib/ip/gfx90.c         | 13 -------------
 src/lib/ip/gfx91.c         | 13 -------------
 src/lib/ip/mmhub10.c       | 13 -------------
 src/lib/ip/mmhub91.c       | 13 -------------
 src/lib/ip/mp100.c         | 13 -------------
 src/lib/ip/mp90.c          | 13 -------------
 src/lib/ip/oss10.c         | 15 ++-------------
 src/lib/ip/oss20.c         | 15 ++-------------
 src/lib/ip/oss30.c         | 15 ++-------------
 src/lib/ip/smu60.c         | 15 ++-------------
 src/lib/ip/smu700.c        | 15 ++-------------
 src/lib/ip/smu701.c        | 15 ++-------------
 src/lib/ip/smu710.c        | 15 ++-------------
 src/lib/ip/smu711.c        | 15 ++-------------
 src/lib/ip/smu712.c        | 15 ++-------------
 src/lib/ip/smu713.c        | 15 ++-------------
 src/lib/ip/smu80.c         | 15 ++-------------
 src/umr.h                  |  1 -
 29 files changed, 34 insertions(+), 307 deletions(-)
demo/update/read_sensor.sh +1 -1
index 94267f45492f..406037b9c7ca 100755
@@ -6,7 +6,7 @@
 # In this case we're reading the NB voltage sensor from Carrizo
 
 # capture value in hex
-NB_VID=`umr -O risky,risky,read_smc -u carrizo.update -r carrizo.smu80.ixSMUSVI_NB_CURRENTVID | cut -b1-4`
+NB_VID=`umr -O read_smc -u carrizo.update -r carrizo.smu80.ixSMUSVI_NB_CURRENTVID | cut -b1-4`
 
 # convert to decimal
 NB_VID_DEC=`printf "%d" ${NB_VID}`
doc/umr.1 +0 -9
index 601866a57a7e..9384c2430bda 100644
@@ -21,9 +21,6 @@ is not yet loaded or a display is not yet attached.
 Force a specific PCI device using the domain:bus:slot.function format in hex.
 This is useful when more than one GPU is available. If the amdgpu driver is
 loaded the corresponding instance will be automatically detected.
-.IP "--print, -p"
-Enable scanning and printing all registers.  Defaults to off as it can
-be very verbose.
 .IP "--config, -c"
 Print out configuation data read from kernel driver.
 .IP "--enumerate, -e"
@@ -107,12 +104,6 @@ separated strings.  Options should be specified before --update or --force comma
 .B quiet
      Disable various informative but not required (for functionality) outputs.
 
-.B risky
-     enables scanning risky ip blocks (such as GFX).  Specify twice for SMU
-     blocks.  This flag is necessary since some blocks are not stable to blindly
-     --scan (or --print) without causing GPU hangs.  The flag is intended to prevent
-     accidental hangs.
-
 .B read_smc
      Enable scanning of SMC registers.
 
src/app/main.c +1 -7
index 4fc26510be32..d8278a93e1cc 100644
@@ -83,9 +83,7 @@ static void parse_options(char *str)
 		*p = 0;
 		if (*str == ',')
 			++str;
-		if (!strcmp(option, "risky")) {
-			options.risky++;
-		} else if (!strcmp(option, "named")) {
+		if (!strcmp(option, "named")) {
 			options.named = 1;
 		} else if (!strcmp(option, "many")) {
 			options.named = 1;
@@ -184,9 +182,6 @@ int main(int argc, char **argv)
 				printf("--pci requires domain:bus:slot.function\n");
 				return EXIT_FAILURE;
 			}
-		} else if (!strcmp(argv[i], "--print") || !strcmp(argv[i], "-p")) {
-			options.print = 1;
-			options.need_scan = 1;
 		} else if (!strcmp(argv[i], "--config") || !strcmp(argv[i], "-c")) {
 			if (!asic)
 				asic = get_asic();
@@ -398,7 +393,6 @@ int main(int argc, char **argv)
 	"\n\t\tForce a specific PCI device using the domain:bus:slot.function format in hex."
 	"\n\t\tThis is useful when more than one GPU is available. If the amdgpu driver is"
 	"\n\t\tloaded the corresponding instance will be automatically detected.\n"
-"\n\t--print, -p\n\t\tEnable dumping of all device registers. (default: off)\n"
 "\n\t--config, -c\n\t\tPrint out configuation data read from kernel driver.\n"
 "\n\t--enumerate, -e\n\t\tEnumerate all AMDGPU devices detected.\n"
 "\n\t--list-blocks, -lb\n\t\tList IP blocks discovered for this device.\n"
src/app/scan.c +0 -1
index 29a3e46ba3f7..f83b925f00ae 100644
@@ -45,7 +45,6 @@ int umr_scan_asic(struct umr_asic *asic, char *asicname, char *ipname, char *reg
 							r = asic->blocks[i]->grant(asic);
 							if (r) {
 								if (ipname[0]) {
-									fprintf(stderr, "[ERROR]: Must specify at least one 'risky' option before scanning specific blocks.\n");
 									exit(EXIT_FAILURE);
 								}
 								continue;
src/app/set_bit.c +0 -1
index 44cdf6ada0b5..c9941126f822 100644
@@ -64,7 +64,6 @@ int umr_set_register_bit(struct umr_asic *asic, char *regpath, char *regvalue)
 									}
 									if (asic->blocks[i]->grant) {
 										if (asic->blocks[i]->grant(asic)) {
-											fprintf(stderr, "[ERROR]: Must specify at least one 'risky' before writing to this block.\n");
 											return -1;
 										}
 									}
src/app/set_reg.c +0 -1
index 9952843ea6f3..79eab1c3e391 100644
@@ -61,7 +61,6 @@ int umr_set_register(struct umr_asic *asic, char *regpath, char *regvalue)
 
 							if (asic->blocks[i]->grant) {
 								if (asic->blocks[i]->grant(asic)) {
-									fprintf(stderr, "[ERROR]: Must specify at least one 'risky' before writing to this block.\n");
 									return -1;
 								}
 							}
src/lib/ip/gfx60.c +2 -13
index 73cf7878709d..d122bd4a9660 100644
@@ -30,22 +30,12 @@ static const struct umr_reg gfx60_registers[] = {
 #include "gfx60_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_gfx60(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_gfx60(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 1) ? grant : deny;
 	memcpy(ip->regs, gfx60_registers, sizeof(gfx60_registers));
 	return ip;
 }
src/lib/ip/gfx70.c +2 -13
index e9bfa4bca8f6..73e06f115285 100644
@@ -29,22 +29,12 @@ static const struct umr_reg gfx70_registers[] = {
 #include "gfx70_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_gfx70(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -56,7 +46,6 @@ struct umr_ip_block *umr_create_gfx70(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 1) ? grant : deny;
 	memcpy(ip->regs, gfx70_registers, sizeof(gfx70_registers));
 	return ip;
 }
src/lib/ip/gfx72.c +2 -13
index cd04f8df3a70..61fa00df3f77 100644
@@ -30,22 +30,12 @@ static const struct umr_reg gfx72_registers[] = {
 #include "gfx72_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_gfx72(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_gfx72(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 1) ? grant : deny;
 	memcpy(ip->regs, gfx72_registers, sizeof(gfx72_registers));
 	return ip;
 }
src/lib/ip/gfx80.c +2 -13
index 211c92570b21..ecdf7d236346 100644
@@ -30,22 +30,12 @@ static const struct umr_reg gfx80_registers[] = {
 #include "gfx80_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_gfx80(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_gfx80(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 1) ? grant : deny;
 	memcpy(ip->regs, gfx80_registers, sizeof(gfx80_registers));
 	return ip;
 }
src/lib/ip/gfx81.c +2 -13
index ef19203df141..cd485cc4af7f 100644
@@ -30,22 +30,12 @@ static const struct umr_reg gfx81_registers[] = {
 #include "gfx81_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_gfx81(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_gfx81(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 1) ? grant : deny;
 	memcpy(ip->regs, gfx81_registers, sizeof(gfx81_registers));
 	return ip;
 }
src/lib/ip/gfx90.c +0 -13
index e4a049ecb843..a1059c6cdc7d 100644
@@ -30,18 +30,6 @@ static const struct umr_reg_soc15 gfx90_registers[] = {
 #include "gfx90_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_gfx90(struct umr_ip_offsets_soc15 *soc15_offsets, struct umr_options *options)
 {
 	struct umr_ip_block *ip;
@@ -57,7 +45,6 @@ struct umr_ip_block *umr_create_gfx90(struct umr_ip_offsets_soc15 *soc15_offsets
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 1) ? grant : deny;
 
 	if (umr_transfer_soc15_to_reg(options, soc15_offsets, "GC", gfx90_registers, ip)) {
 		free(ip);
src/lib/ip/gfx91.c +0 -13
index 14ca0fd3a634..a647a713eadc 100644
@@ -30,18 +30,6 @@ static const struct umr_reg_soc15 gfx91_registers[] = {
 #include "gfx91_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_gfx91(struct umr_ip_offsets_soc15 *soc15_offsets, struct umr_options *options)
 {
 	struct umr_ip_block *ip;
@@ -57,7 +45,6 @@ struct umr_ip_block *umr_create_gfx91(struct umr_ip_offsets_soc15 *soc15_offsets
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 1) ? grant : deny;
 
 	if (umr_transfer_soc15_to_reg(options, soc15_offsets, "GC", gfx91_registers, ip)) {
 		free(ip);
src/lib/ip/mmhub10.c +0 -13
index 48589c7d0838..edb49a43a854 100644
@@ -30,18 +30,6 @@ static const struct umr_reg_soc15 mmhub10_registers[] = {
 #include "mmhub10_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_mmhub10(struct umr_ip_offsets_soc15 *soc15_offsets, struct umr_options *options)
 {
 	struct umr_ip_block *ip;
@@ -57,7 +45,6 @@ struct umr_ip_block *umr_create_mmhub10(struct umr_ip_offsets_soc15 *soc15_offse
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 1) ? grant : deny;
 
 	if (umr_transfer_soc15_to_reg(options, soc15_offsets, "MMHUB", mmhub10_registers, ip)) {
 		free(ip);
src/lib/ip/mmhub91.c +0 -13
index 5274a4f84024..d3b6b17ce1f8 100644
@@ -30,18 +30,6 @@ static const struct umr_reg_soc15 mmhub91_registers[] = {
 #include "mmhub91_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_mmhub91(struct umr_ip_offsets_soc15 *soc15_offsets, struct umr_options *options)
 {
 	struct umr_ip_block *ip;
@@ -57,7 +45,6 @@ struct umr_ip_block *umr_create_mmhub91(struct umr_ip_offsets_soc15 *soc15_offse
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 1) ? grant : deny;
 
 	if (umr_transfer_soc15_to_reg(options, soc15_offsets, "MMHUB", mmhub91_registers, ip)) {
 		free(ip);
src/lib/ip/mp100.c +0 -13
index 575511acc14f..f313ac7fbca1 100644
@@ -30,18 +30,6 @@ static const struct umr_reg_soc15 mp100_registers[] = {
 #include "mp100_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_mp100(struct umr_ip_offsets_soc15 *soc15_offsets, struct umr_options *options)
 {
 	struct umr_ip_block *ip;
@@ -57,7 +45,6 @@ struct umr_ip_block *umr_create_mp100(struct umr_ip_offsets_soc15 *soc15_offsets
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 1) ? grant : deny;
 
 	if (umr_transfer_soc15_to_reg(options, soc15_offsets, "MP0", mp100_registers, ip)) { // this might be broken because there is MP1/2 as well
 		free(ip);
src/lib/ip/mp90.c +0 -13
index 787f296f16ec..29b37069b461 100644
@@ -30,18 +30,6 @@ static const struct umr_reg_soc15 mp90_registers[] = {
 #include "mp90_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_mp90(struct umr_ip_offsets_soc15 *soc15_offsets, struct umr_options *options)
 {
 	struct umr_ip_block *ip;
@@ -57,7 +45,6 @@ struct umr_ip_block *umr_create_mp90(struct umr_ip_offsets_soc15 *soc15_offsets,
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 1) ? grant : deny;
 
 	if (umr_transfer_soc15_to_reg(options, soc15_offsets, "MP0", mp90_registers, ip)) { // this might be broken because there is MP1/2 as well
 		free(ip);
src/lib/ip/oss10.c +2 -13
index 7d820da64de2..6105620e04b1 100644
@@ -30,22 +30,12 @@ static const struct umr_reg oss10_registers[] = {
 #include "oss10_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_oss10(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_oss10(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 2) ? grant : deny;
 	memcpy(ip->regs, oss10_registers, sizeof(oss10_registers));
 	return ip;
 }
src/lib/ip/oss20.c +2 -13
index 26da1cd1fbc4..c50f188f4622 100644
@@ -30,22 +30,12 @@ static const struct umr_reg oss20_registers[] = {
 #include "oss20_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_oss20(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_oss20(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 2) ? grant : deny;
 	memcpy(ip->regs, oss20_registers, sizeof(oss20_registers));
 	return ip;
 }
src/lib/ip/oss30.c +2 -13
index a44421af7e43..9cd423f53a3f 100644
@@ -30,22 +30,12 @@ static const struct umr_reg oss30_registers[] = {
 #include "oss30_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_oss30(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_oss30(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 2) ? grant : deny;
 	memcpy(ip->regs, oss30_registers, sizeof(oss30_registers));
 	return ip;
 }
src/lib/ip/smu60.c +2 -13
index 545d1bafd268..d55c9a8db379 100644
@@ -30,22 +30,12 @@ static const struct umr_reg smu60_registers[] = {
 #include "smu60_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_smu60(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_smu60(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 2) ? grant : deny;
 	memcpy(ip->regs, smu60_registers, sizeof(smu60_registers));
 	return ip;
 }
src/lib/ip/smu700.c +2 -13
index 86d242609d17..9d06f7cf804e 100644
@@ -30,22 +30,12 @@ static const struct umr_reg smu700_registers[] = {
 #include "smu700_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_smu700(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_smu700(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 2) ? grant : deny;
 	memcpy(ip->regs, smu700_registers, sizeof(smu700_registers));
 	return ip;
 }
src/lib/ip/smu701.c +2 -13
index 06c811e50eaf..c6eb5bbb06de 100644
@@ -30,22 +30,12 @@ static const struct umr_reg smu701_registers[] = {
 #include "smu701_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_smu701(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_smu701(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 2) ? grant : deny;
 	memcpy(ip->regs, smu701_registers, sizeof(smu701_registers));
 	return ip;
 }
src/lib/ip/smu710.c +2 -13
index 6d68464e78d0..b34aa6fe9a20 100644
@@ -30,22 +30,12 @@ static const struct umr_reg smu710_registers[] = {
 #include "smu710_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_smu710(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_smu710(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 2) ? grant : deny;
 	memcpy(ip->regs, smu710_registers, sizeof(smu710_registers));
 	return ip;
 }
src/lib/ip/smu711.c +2 -13
index 00a9f2bd0214..4594dacb5493 100644
@@ -30,22 +30,12 @@ static const struct umr_reg smu711_registers[] = {
 #include "smu711_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_smu711(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_smu711(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 2) ? grant : deny;
 	memcpy(ip->regs, smu711_registers, sizeof(smu711_registers));
 	return ip;
 }
src/lib/ip/smu712.c +2 -13
index 45b1b1e71eaf..a57929b17d55 100644
@@ -30,22 +30,12 @@ static const struct umr_reg smu712_registers[] = {
 #include "smu712_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_smu712(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_smu712(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 2) ? grant : deny;
 	memcpy(ip->regs, smu712_registers, sizeof(smu712_registers));
 	return ip;
 }
src/lib/ip/smu713.c +2 -13
index c1e0ff8f3547..376e796d5c92 100644
@@ -30,22 +30,12 @@ static const struct umr_reg smu713_registers[] = {
 #include "smu713_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_smu713(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_smu713(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 2) ? grant : deny;
 	memcpy(ip->regs, smu713_registers, sizeof(smu713_registers));
 	return ip;
 }
src/lib/ip/smu80.c +2 -13
index d1cd966fecd5..da0abe888677 100644
@@ -30,22 +30,12 @@ static const struct umr_reg smu80_registers[] = {
 #include "smu80_regs.i"
 };
 
-static int grant(struct umr_asic *asic)
-{
-	(void)asic;
-	return 0;
-}
-
-static int deny(struct umr_asic *asic)
-{
-	(void)asic;
-	return -1;
-}
-
 struct umr_ip_block *umr_create_smu80(struct umr_options *options)
 {
 	struct umr_ip_block *ip;
 
+	(void)options;
+
 	ip = calloc(1, sizeof *ip);
 	if (!ip)
 		return NULL;
@@ -57,7 +47,6 @@ struct umr_ip_block *umr_create_smu80(struct umr_options *options)
 		free(ip);
 		return NULL;
 	}
-	ip->grant = (options->risky >= 2) ? grant : deny;
 	memcpy(ip->regs, smu80_registers, sizeof(smu80_registers));
 	return ip;
 }
src/umr.h +0 -1
index 51690400f583..a0e94a7e4db9 100644
@@ -162,7 +162,6 @@ struct umr_options {
 	    instance,
 	    need_scan,
 	    print,
-	    risky,
 	    bitfields,
 	    bitfields_full,
 	    named,
Signature · 6 lines
2.12.0

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

PATCH 2/4 Add ability to specify VMID in hex

In reply to a message not in the archive
---
 doc/umr.1      |  5 +++--
 src/app/main.c | 11 +++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)
doc/umr.1 +3 -2
index 9384c2430bda..0a991f9923a4 100644
@@ -89,8 +89,9 @@ will operate regardless of whether GFX PG is enabled or not.  Can use
 to decode the wave bitfields.
 .IP "--vram, -v [vmid@]<address> <size>"
 Read 'size' bytes (in hex) from the address specified (in hexadecimal) from VRAM
-to stdout.  Optionally specify the VMID (in decimal) treating the address as a
-virtual address instead.  Can use 'use_pci' to directly access VRAM.
+to stdout.  Optionally specify the VMID (in decimal or in hex with a 0x prefix)
+treating the address as a virtual address instead.  Can use 'use_pci' to
+directly access VRAM.
 
 .IP "--update, -u" <filename>
 Specify update file to add, change, or delete registers from the register
src/app/main.c +7 -4
index d8278a93e1cc..6e0bc57200b0 100644
@@ -346,10 +346,13 @@ int main(int argc, char **argv)
 				if (!asic)
 					asic = get_asic();
 
-				if ((n = sscanf(argv[i+1], "%"SCNu32"@%"SCNx64, &vmid, &address)) != 2) {
-					sscanf(argv[i+1], "%"SCNx64, &address);
-					vmid = 0xFFFF;
-				}
+				// allow specifying the vmid in hex as well so
+				// people can add the HUB flags more easily
+				if ((n = sscanf(argv[i+1], "0x%"SCNx32"@%"SCNx64, &vmid, &address)) != 2)
+					if ((n = sscanf(argv[i+1], "%"SCNu32"@%"SCNx64, &vmid, &address)) != 2) {
+						sscanf(argv[i+1], "%"SCNx64, &address);
+						vmid = UMR_LINEAR_HUB;
+					}
 				sscanf(argv[i+2], "%"SCNx32, &size);
 				while (size) {
 					n = size > sizeof(buf) ? sizeof(buf) : size;
Signature · 6 lines
2.12.0

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

PATCH 3/4 Various cleanups found by static analysis. (v2)

In reply to a message not in the archive

(v2): Updated enumerate to not stop on other AMD PCI devices

---
 src/app/enum.c               | 4 +---
 src/lib/create_asic_helper.c | 5 +++++
 src/lib/discover.c           | 9 +++++++--
 src/lib/mmio.c               | 8 ++++++++
 4 files changed, 21 insertions(+), 5 deletions(-)
src/app/enum.c +1 -3
index 2c4b7695e3cb..1c56fe643616 100644
@@ -55,7 +55,6 @@ void umr_enumerate_devices(void)
 		return;
 	}
 	do {
-		x = 0;
 		do {
 			pdevice = pci_device_next(pci_iter);
 		} while (pdevice && pdevice->vendor_id != 0x1002);
@@ -64,12 +63,11 @@ void umr_enumerate_devices(void)
 			asics[devices].instance = -1;
 			asics[devices].asic->pci.pdevice = &asics[devices].pcopy;
 			asics[devices++].pcopy = *pdevice;
-			x = 1;
 		}
 	} while (pdevice && devices < MAX_DEV);
 
 	// now try to match devices against instances
-	for (y = 0; y < MAX_DEV; y++) {
+	for (y = 0; y < devices; y++) {
 		snprintf(path, sizeof(path)-1, "/sys/kernel/debug/dri/%d/name", y);
 		dri = fopen(path, "r");
 		if (dri) {
src/lib/create_asic_helper.c +5 -0
index d0ee34ac951e..ffca35d7af93 100644
@@ -48,6 +48,11 @@ struct umr_asic *umr_create_asic_helper(char *name, int family, ...)
 	}
 	va_end(ap);
 
+	if (!asic->no_blocks) {
+		free(asic);
+		return NULL;
+	}
+
 	asic->blocks = calloc(asic->no_blocks, sizeof(struct umr_ip_block *));
 	if (!asic->blocks) {
 		free(asic);
src/lib/discover.c +7 -2
index 0c4ee1c09ad8..0fc053712e37 100644
@@ -269,20 +269,25 @@ struct umr_asic *umr_discover_asic(struct umr_options *options)
 				goto err_pci;
 			}
 			pci_iterator_destroy(pci_iter);
+
+			// enable device if kernel module isn't present
+			if (asic->options.no_kernel)
+				pci_device_enable(asic->pci.pdevice);
+
 			pci_device_probe(asic->pci.pdevice);
 
 			use_region = 6;
 			// try to detect based on ASIC family
 			if (asic->family <= FAMILY_SI) {
 				// try region 2 for SI
-				if (	asic->pci.pdevice->regions[2].is_64 == 0 &&
+				if (asic->pci.pdevice->regions[2].is_64 == 0 &&
 					asic->pci.pdevice->regions[2].is_prefetchable == 0 &&
 					asic->pci.pdevice->regions[2].is_IO == 0) {
 						use_region = 2;
 				}
 			} else if (asic->family <= FAMILY_VI) {
 				// try region 5 for CIK..VI
-				if (	asic->pci.pdevice->regions[5].is_64 == 0 &&
+				if (asic->pci.pdevice->regions[5].is_64 == 0 &&
 					asic->pci.pdevice->regions[5].is_prefetchable == 0 &&
 					asic->pci.pdevice->regions[5].is_IO == 0) {
 						use_region = 5;
src/lib/mmio.c +8 -0
index 987704cb9944..47e5150d3201 100644
@@ -88,6 +88,10 @@ uint32_t umr_read_reg(struct umr_asic *asic, uint64_t addr, enum regclass type)
 	if (addr == 0xFFFFFFFF)
 		fprintf(stderr, "[BUG]: reading from addr==0xFFFFFFFF is likely a bug\n");
 
+	// lop off top bits in no-kernel mode
+	if (asic->options.no_kernel)
+		addr &= 0xFFFFFF;
+
 	switch (type) {
 		case REG_MMIO:
 			if (asic->pci.mem && !(addr & ~0xFFFFFULL)) { // only use pci if enabled and not using high bits 
@@ -113,6 +117,10 @@ int umr_write_reg(struct umr_asic *asic, uint64_t addr, uint32_t value, enum reg
 	if (addr == 0xFFFFFFFF)
 		fprintf(stderr, "[BUG]: reading from addr==0xFFFFFFFF is likely a bug\n");
 
+	// lop off top bits in no-kernel mode
+	if (asic->options.no_kernel)
+		addr &= 0xFFFFFF;
+
 	switch (type) {
 		case REG_MMIO:
 			if (asic->pci.mem && !(addr & ~0xFFFFFULL)) {
Signature · 6 lines
2.12.0

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

PATCH 4/4 Add ability to halt waves and better VM decoding (v3)

In reply to a message not in the archive

This patch involves two things I was working on at once so the patches are a bit intertwined. It adds

1. The ability to halt SQ waves when reading waves on CIK and later ASICs.

2. The ability to enable verbose decoding when reading vram

3. The ability to decode virtual addresses in the mmhub (for say VCN)

(v2): Tidy up AI verbose VM decoding output
(v3): More details in verbose output and removed some duplicate DEBUG output

---
 doc/umr.1                   |  13 +++
 src/app/main.c              |  56 ++++++++-
 src/app/print_waves.c       |   6 +
 src/lib/CMakeLists.txt      |   1 +
 src/lib/dump_ib.c           |   6 +-
 src/lib/find_reg.c          |  11 +-
 src/lib/mmio.c              |  36 ++++--
 src/lib/read_vram.c         | 270 +++++++++++++++++++++++++++++++++-----------
 src/lib/ring_decode.c       |   4 +-
 src/lib/sq_cmd_halt_waves.c |  57 ++++++++++
 src/umr.h                   |  26 +++++
 11 files changed, 403 insertions(+), 83 deletions(-)
 create mode 100644 src/lib/sq_cmd_halt_waves.c
doc/umr.1 +13 -0
index 0a991f9923a4..06950925b7b6 100644
@@ -87,6 +87,13 @@ invoking it very rapidly.  Unlike the wave count reading in --top this command
 will operate regardless of whether GFX PG is enabled or not.  Can use
 .B bits
 to decode the wave bitfields.
+
+.IP "--vm-decode, -vm vmid@<address> <num_of_pages>"
+Decode page mappings at a specified address (in hex) from the VMID specified.
+The VMID can be specified in hexadecimal (with leading '0x') or in decimal.
+Implies '-O verbose' for the duration of the command so does not require it
+to be manually specified.
+
 .IP "--vram, -v [vmid@]<address> <size>"
 Read 'size' bytes (in hex) from the address specified (in hexadecimal) from VRAM
 to stdout.  Optionally specify the VMID (in decimal or in hex with a 0x prefix)
@@ -145,6 +152,12 @@ separated strings.  Options should be specified before --update or --force comma
      be used only if the KMD is hung or otherwise not working correctly.  Using it on live systems
      may result in race conditions.
 
+.B verbose
+     Enable verbose diagnostics (used in --vram).
+
+.B halt_waves
+     Halt/resume all waves while reading wave status.
+
 .SH "Notes"
 
 - The "Waves" field in the DRM section of --top only works if GFX PG has been disabled.  Otherwise,
src/app/main.c +50 -6

87 lines not on this page · raw message

src/app/print_waves.c +6 -0
index e157db9f9386..1efd8a13bd28 100644
@@ -40,6 +40,9 @@ void umr_print_waves(struct umr_asic *asic)
 	struct umr_wave_status ws;
 	int first = 1, col = 0;
 
+	if (asic->options.halt_waves)
+		umr_sq_cmd_halt_waves(asic, UMR_SQ_CMD_HALT);
+
 	if (asic->family <= FAMILY_CIK)
 		shift = 3;  // on SI..CIK allocations were done in 8-dword blocks
 	else
@@ -206,4 +209,7 @@ void umr_print_waves(struct umr_asic *asic)
 	}
 	if (first)
 		printf("No active waves!\n");
+
+	if (asic->options.halt_waves)
+		umr_sq_cmd_halt_waves(asic, UMR_SQ_CMD_RESUME);
 }
src/lib/CMakeLists.txt +1 -0
index 217ae80cdfd7..fcb4f9c9dc80 100644
@@ -21,6 +21,7 @@ add_library(umrcore STATIC
   read_vram.c
   ring_decode.c
   scan_config.c
+  sq_cmd_halt_waves.c
   transfer_soc15.c
   wave_status.c
   update.c
src/lib/dump_ib.c +4 -2
index 4e81dbe3eb09..cba497373fe2 100644
@@ -28,9 +28,11 @@
 void umr_dump_ib(struct umr_asic *asic, struct umr_ring_decoder *decoder)
 {
 	uint32_t *data = NULL, x;
+	static const char *hubs[] = { "gfxhub", "mmhub" };
 
-	printf("Dumping IB at VMID:%u 0x%llx of %u words\n",
-		(unsigned)decoder->next_ib_info.vmid,
+	printf("Dumping IB at (%s) VMID:%u 0x%llx of %u words\n",
+		hubs[decoder->next_ib_info.vmid >> 8],
+		(unsigned)decoder->next_ib_info.vmid & 0xFF,
 		(unsigned long long)decoder->next_ib_info.ib_addr,
 		(unsigned)decoder->next_ib_info.size/4);
 
src/lib/find_reg.c +9 -2
index d4647163ea63..ecd7f132c9c9 100644
@@ -36,14 +36,21 @@ uint32_t umr_find_reg(struct umr_asic *asic, char *regname)
 	return 0xFFFFFFFF;
 }
 
-struct umr_reg *umr_find_reg_data(struct umr_asic *asic, char *regname)
+struct umr_reg *umr_find_reg_data_by_ip(struct umr_asic *asic, char *ip, char *regname)
 {
 	int i, j;
 
-	for (i = 0; i < asic->no_blocks; i++)
+	for (i = 0; i < asic->no_blocks; i++) {
+		if (ip && memcmp(asic->blocks[i]->ipname, ip, strlen(ip))) continue;
 		for (j = 0; j < asic->blocks[i]->no_regs; j++)
 			if (!strcmp(asic->blocks[i]->regs[j].regname, regname))
 				return &asic->blocks[i]->regs[j];
+	}
 	fprintf(stderr, "[BUG]: reg [%s] not found on asic [%s]\n", regname, asic->asicname);
 	return NULL;
 }
+
+struct umr_reg *umr_find_reg_data(struct umr_asic *asic, char *regname)
+{
+	return umr_find_reg_data_by_ip(asic, NULL, regname);
+}
src/lib/mmio.c +28 -8
index 47e5150d3201..eb91e289404f 100644
@@ -145,26 +145,36 @@ int umr_write_reg(struct umr_asic *asic, uint64_t addr, uint32_t value, enum reg
 	return 0;
 }
 
-uint32_t umr_read_reg_by_name(struct umr_asic *asic, char *name)
+uint32_t umr_read_reg_by_name_by_ip(struct umr_asic *asic, char *ip, char *name)
 {
 	struct umr_reg *reg;
-	reg = umr_find_reg_data(asic, name);
+	reg = umr_find_reg_data_by_ip(asic, ip, name);
 	if (reg)
 		return umr_read_reg(asic, reg->addr * (reg->type == REG_MMIO ? 4 : 1), reg->type);
 	else
 		return 0;
 }
 
-int umr_write_reg_by_name(struct umr_asic *asic, char *name, uint32_t value)
+uint32_t umr_read_reg_by_name(struct umr_asic *asic, char *name)
+{
+	return umr_read_reg_by_name_by_ip(asic, NULL, name);
+}
+
+int umr_write_reg_by_name_by_ip(struct umr_asic *asic, char *ip, char *name, uint32_t value)
 {
 	struct umr_reg *reg;
-	reg = umr_find_reg_data(asic, name);
+	reg = umr_find_reg_data_by_ip(asic, ip, name);
 	if (reg)
 		return umr_write_reg(asic, reg->addr * (reg->type == REG_MMIO ? 4 : 1), value, reg->type);
 	else
 		return -1;
 }
 
+int umr_write_reg_by_name(struct umr_asic *asic, char *name, uint32_t value)
+{
+	return umr_write_reg_by_name_by_ip(asic, NULL, name, value);
+}
+
 uint32_t umr_bitslice_reg(struct umr_asic *asic, struct umr_reg *reg, char *bitname, uint32_t regvalue)
 {
 	int i;
@@ -193,26 +203,36 @@ uint32_t umr_bitslice_compose_value(struct umr_asic *asic, struct umr_reg *reg,
 	return 0;
 }
 
-uint32_t umr_bitslice_reg_by_name(struct umr_asic *asic, char *regname, char *bitname, uint32_t regvalue)
+uint32_t umr_bitslice_reg_by_name_by_ip(struct umr_asic *asic, char *ip, char *regname, char *bitname, uint32_t regvalue)
 {
 	struct umr_reg *reg;
-	reg = umr_find_reg_data(asic, regname);
+	reg = umr_find_reg_data_by_ip(asic, ip, regname);
 	if (reg)
 		return umr_bitslice_reg(asic, reg, bitname, regvalue);
 	else
 		return 0;
 }
 
-uint32_t umr_bitslice_compose_value_by_name(struct umr_asic *asic, char *regname, char *bitname, uint32_t regvalue)
+uint32_t umr_bitslice_reg_by_name(struct umr_asic *asic, char *regname, char *bitname, uint32_t regvalue)
+{
+	return umr_bitslice_reg_by_name_by_ip(asic, NULL, regname, bitname, regvalue);
+}
+
+uint32_t umr_bitslice_compose_value_by_name_by_ip(struct umr_asic *asic, char *ip, char *regname, char *bitname, uint32_t regvalue)
 {
 	struct umr_reg *reg;
-	reg = umr_find_reg_data(asic, regname);
+	reg = umr_find_reg_data_by_ip(asic, ip, regname);
 	if (reg)
 		return umr_bitslice_compose_value(asic, reg, bitname, regvalue);
 	else
 		return 0;
 }
 
+uint32_t umr_bitslice_compose_value_by_name(struct umr_asic *asic, char *regname, char *bitname, uint32_t regvalue)
+{
+	return umr_bitslice_compose_value_by_name_by_ip(asic, NULL, regname, bitname, regvalue);
+}
+
 int umr_grbm_select_index(struct umr_asic *asic, uint32_t se, uint32_t sh, uint32_t instance)
 {
 	struct umr_reg *grbm_idx;
src/lib/read_vram.c +207 -63

467 lines not on this page · raw message

src/lib/ring_decode.c +2 -2
index 35e72ed58e4f..772ea49dda6f 100644
@@ -589,7 +589,7 @@ static void print_decode_pm4(struct umr_asic *asic, struct umr_ring_decoder *dec
 			// detect VCN/UVD IBs and chain them once all
 			// 4 pieces of information are found
 			if (!strcmp(name, "mmUVD_LMI_RBC_IB_VMID")) {
-				decoder->pm4.next_ib_state.ib_vmid = ib;
+				decoder->pm4.next_ib_state.ib_vmid = ib | ((asic->family <= FAMILY_VI) ? 0 : UMR_MM_HUB);
 				decoder->pm4.next_ib_state.tally |= 1;
 			} else if (!strcmp(name, "mmUVD_LMI_RBC_IB_64BIT_BAR_LOW")) {
 				decoder->pm4.next_ib_state.ib_addr_lo = ib;
@@ -598,7 +598,7 @@ static void print_decode_pm4(struct umr_asic *asic, struct umr_ring_decoder *dec
 				decoder->pm4.next_ib_state.ib_addr_hi = ib;
 				decoder->pm4.next_ib_state.tally |= 4;
 			} else if (!strcmp(name, "mmUVD_RBC_IB_SIZE")) {
-				decoder->pm4.next_ib_state.ib_size = ib;
+				decoder->pm4.next_ib_state.ib_size = ib * 4;
 				decoder->pm4.next_ib_state.tally |= 8;
 			}
 
src/lib/sq_cmd_halt_waves.c new file +57 -0

57 lines not on this page · raw message

src/umr.h +26 -0
index a0e94a7e4db9..dd7f80c38f0c 100644
@@ -33,6 +33,20 @@
 #include <pciaccess.h>
 #include <pthread.h>
 
+/* SQ_CMD halt/resume */
+enum umr_sq_cmd_halt_resume {
+	UMR_SQ_CMD_HALT=0,
+	UMR_SQ_CMD_RESUME,
+};
+
+/* memory space hubs */
+enum umr_hub_space {
+	UMR_GFX_HUB = 0 << 8,        // default on everything before AI
+	UMR_MM_HUB = 1 << 8,         // available on AI and later
+
+	UMR_LINEAR_HUB = 0xFF << 8,  // this is for linear access to vram
+};
+
 /* sourced from amd_powerplay.h from the kernel */
 enum amd_pp_sensors {
 	AMDGPU_PP_SENSOR_GFX_SCLK = 0,
@@ -174,6 +188,8 @@ struct umr_options {
 	    read_smc,
 	    quiet,
 	    follow_ib,
+	    verbose,
+	    halt_waves,
 	    no_kernel;
 	unsigned
 	    instance_bank,
@@ -477,6 +493,7 @@ int umr_create_mmio_accel(struct umr_asic *asic);
 uint32_t umr_find_reg(struct umr_asic *asic, char *regname);
 
 // find the register data for a register
+struct umr_reg *umr_find_reg_data_by_ip(struct umr_asic *asic, char *ip, char *regname);
 struct umr_reg *umr_find_reg_data(struct umr_asic *asic, char *regname);
 
 // read/write a 32-bit register given a BYTE address
@@ -487,17 +504,26 @@ int umr_write_reg(struct umr_asic *asic, uint64_t addr, uint32_t value, enum reg
 uint32_t umr_read_reg_by_name(struct umr_asic *asic, char *name);
 int umr_write_reg_by_name(struct umr_asic *asic, char *name, uint32_t value);
 
+// read/write a register by ip/name
+uint32_t umr_read_reg_by_name_by_ip(struct umr_asic *asic, char *ip, char *name);
+int umr_write_reg_by_name_by_ip(struct umr_asic *asic, char *ip, char *name, uint32_t value);
+
 // slice a full register into bits (shifted into LSB)
 uint32_t umr_bitslice_reg(struct umr_asic *asic, struct umr_reg *reg, char *bitname, uint32_t regvalue);
 uint32_t umr_bitslice_reg_by_name(struct umr_asic *asic, char *regname, char *bitname, uint32_t regvalue);
+uint32_t umr_bitslice_reg_by_name_by_ip(struct umr_asic *asic, char *ip, char *regname, char *bitname, uint32_t regvalue);
 
 // compose a 32-bit register with a value and a bitfield
 uint32_t umr_bitslice_compose_value(struct umr_asic *asic, struct umr_reg *reg, char *bitname, uint32_t regvalue);
 uint32_t umr_bitslice_compose_value_by_name(struct umr_asic *asic, char *reg, char *bitname, uint32_t regvalue);
+uint32_t umr_bitslice_compose_value_by_name_by_ip(struct umr_asic *asic, char *ip, char *regname, char *bitname, uint32_t regvalue);
 
 // select a GRBM_GFX_IDX
 int umr_grbm_select_index(struct umr_asic *asic, uint32_t se, uint32_t sh, uint32_t instance);
 
+// halt/resume SQ waves
+int umr_sq_cmd_halt_waves(struct umr_asic *asic, enum umr_sq_cmd_halt_resume mode);
+
 /* IB/ring decoding/dumping/etc */
 void umr_print_decode(struct umr_asic *asic, struct umr_ring_decoder *decoder, uint32_t ib);
 void umr_dump_ib(struct umr_asic *asic, struct umr_ring_decoder *decoder);
Signature · 6 lines
2.12.0

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