Skip to contentSkip to conversation

Add the ability to update the register/bitfield database at runtime. (v2)

PATCH New Tom St Denis 1 participant 1 message Apr 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add the ability to update the register/bitfield database at runtime. (v2)

The syntax is fairly simple but the parser isn't really robust so don't feed it garbage. It will happily eat whitespace between tokens so you can indent however you want.

Each command starts with "add", "edit", or "del" and then "bit" or "reg" followed by a path and then an address or start/stop pair, e.g.

add reg tonga.uvd5.mmFOO 0x12345678
add bit tonga.uvd5.mmFOO.BAZ_ENABLEMENT 0 1

or

edit reg tonga.uvd5.mmFOO 0x87654321

or

del reg tonga.uvd5.mmFOO

You use it by specifying "--update /path/to/script" after any other options/instance commands. It will ignore any updates for asics that aren't currently being used so you can specify multiple asic updates in a single file.

(v2): Considerable tidy up of code + add deletion support

---
 src/app/main.c         |  10 ++
 src/lib/CMakeLists.txt |   1 +
 src/lib/update.c       | 429 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/umr.h              |   1 +
 4 files changed, 441 insertions(+)
 create mode 100644 src/lib/update.c
src/app/main.c +10 -0
index 3fc1ee947a39..96a790cbec7c 100644
@@ -363,6 +363,16 @@ int main(int argc, char **argv)
 				printf("--option requires one parameter\n");
 				return EXIT_FAILURE;
 			}
+		} else if (!strcmp(argv[i], "--update") || !strcmp(argv[i], "-u")) {
+			if (!asic)
+				asic = get_asic();
+			if (i + 1 < argc) {
+				umr_update(asic, argv[i+1]);
+				++i;
+			} else {
+				printf("--update requires one parameter\n");
+				return EXIT_FAILURE;
+			}
 		} else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
 			printf("User Mode Register debugger v%s for AMDGPU devices (build: %s), Copyright (c) 2017, AMD Inc.\n"
 "\n\t--instance, -i <number>\n\t\tSelect a device instance to investigate. (default: 0)"
src/lib/CMakeLists.txt +1 -0
index b7c249452c36..dfdf44cf4ad2 100644
@@ -22,6 +22,7 @@ add_library(umrcore STATIC
   scan_config.c
   transfer_soc15.c
   wave_status.c
+  update.c
   $<TARGET_OBJECTS:asic> $<TARGET_OBJECTS:ip>
 )
 
src/lib/update.c new file +429 -0

429 lines not on this page · raw message

src/umr.h +1 -0
index 33a77fc24c57..27d0015d17a3 100644
@@ -444,6 +444,7 @@ void umr_free_asic(struct umr_asic *asic);
 void umr_close_asic(struct umr_asic *asic); // call this to close a fully open asic
 int umr_query_drm(struct umr_asic *asic, int field, uint64_t *ret);
 void umr_enumerate_devices(void);
+int umr_update(struct umr_asic *asic, char *script);
 
 /* lib helpers */
 int umr_get_wave_status(struct umr_asic *asic, unsigned se, unsigned sh, unsigned cu, unsigned simd, unsigned wave, struct umr_wave_status *ws);
Signature · 6 lines
2.12.0

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