Add ability to read from virtual memory
PATCH 1/1 Add ability to read from virtual memory
Updates the --vram command to add the ability to read from one of the VM domains instead.
Signed-off-by Tom St Denis <[email protected]>
--- doc/umr.1 | 7 ++++--- src/app/main.c | 16 ++++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-)
doc/umr.1 +4 -3
@@ -85,9 +85,10 @@ 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 "--vram, -v <address> <size>" -Read 'size' bytes (in decimal) from the address specified (in hexadecimal) from VRAM -to stdout. Can use 'use_pci' to directly access VRAM. +.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. .IP "--option, -O <string>[,<string>,...]" Specify options to the tool. Multiple options can be specified as comma
src/app/main.c +10 -6
@@ -320,16 +320,19 @@ int main(int argc, char **argv)if (i +2 < argc) {unsigned char buf[256 ];uint64_t address; -uint32_t size, n; +uint32_t size, n, vmid;if (!asic) asic =get_asic (); -sscanf (argv[i+1 ],"%" SCNx64, &address); -sscanf (argv[i+2 ],"%" SCNu32, &size); +if ((n =sscanf (argv[i+1 ],"%" SCNu32"@%" SCNx64, &vmid, &address)) !=2 ) { +sscanf (argv[i+1 ],"%" SCNx64, &address); + vmid =0xFFFF ; + } +sscanf (argv[i+2 ],"%" SCNx32, &size);while (size) { n = size >sizeof (buf) ?sizeof (buf) : size; -umr_read_vram (asic,0xFFFF , address, n, buf); +umr_read_vram (asic, vmid, address, n, buf);fwrite (buf,1 , n, stdout); size -= n; address += n;
@@ -383,8 +386,9 @@ int main(int argc, char **argv)"\n\t\toptions 'use_colour' to colourize output and 'use_pci' to improve efficiency.\n" "\n\t--waves, -wa\n\t\tPrint out information about any active CU waves. Can use '-O bits'" "\n\t\tto see decoding of various wave fields.\n" -"\n\t--vram, -v <address> <size>" -"\n\t\tRead 'size' bytes (in decimal) from a given address (in hex) to stdout.\n" +"\n\t--vram, -v [<vmid>@]<address> <size>" +"\n\t\tRead 'size' bytes (in hex) from a given address (in hex) to stdout. Optionally" +"\n\t\tspecify the VMID (in decimal) treating the address as a virtual address instead.\n" "\n\t--option -O <string>[,<string>,...]\n\t\tEnable various flags: risky, bits, bitsfull, empty_log, follow, named, many," "\n\t\tuse_pci, use_colour, read_smc, quiet.\n" "\n\n", UMR_BUILD_VER, UMR_BUILD_REV);
Signature · 6 lines
2.11.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]
Edward O'Callaghan
Reviewed-byReviewed-by Edward O'Callaghan <[email protected]>
Quoted 58 lines · Tom St Denis
Updates the --vram command to add the ability to read from one of the VM domains instead.
Signed-off-by Tom St Denis <[email protected]>--- doc/umr.1 | 7 ++++--- src/app/main.c | 16 ++++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-)doc/umr.1 +4
-3@@ -85,9 +85,10 @@ 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 "--vram, -v <address> <size>" -Read 'size' bytes (in decimal) from the address specified (in hexadecimal) from VRAM -to stdout. Can use 'use_pci' to directly access VRAM. +.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. .IP "--option, -O <string>[,<string>,...]" Specify options to the tool. Multiple options can be specified as commasrc/app/main.c +7
-4@@ -320,16 +320,19 @@ int main(int argc, char **argv)if (i +2 < argc) {unsigned char buf[256 ];uint64_t address; -uint32_t size, n; +uint32_t size, n, vmid;if (!asic) asic =get_asic (); -sscanf (argv[i+1 ],"%" SCNx64, &address); -sscanf (argv[i+2 ],"%" SCNu32, &size); +if ((n =sscanf (argv[i+1 ],"%" SCNu32"@%" SCNx64, &vmid, &address)) !=2 ) { +sscanf (argv[i+1 ],"%" SCNx64, &address); + vmid =0xFFFF ; + } +sscanf (argv[i+2 ],"%" SCNx32, &size);while (size) { n = size >sizeof (buf) ?sizeof (buf) : size; -umr_read_vram (asic,0xFFFF , address, n, buf); +umr_read_vram (asic, vmid, address, n, buf);fwrite (buf,1 , n, stdout); size -= n; address += n;@@ -383,8 +386,9 @@ int main(int argc, char **argv)"\n\t\toptions 'use_colour' to colourize output and 'use_pci' to improve efficiency.\n"
src/app/main.c int main(int argc, char **argv) · line 394
Quoted 10 lines
src/app/main.c +3
-2"\n\t--waves, -wa\n\t\tPrint out information about any active CU waves. Can use '-O bits'" "\n\t\tto see decoding of various wave fields.\n" -"\n\t--vram, -v <address> <size>" -"\n\t\tRead 'size' bytes (in decimal) from a given address (in hex) to stdout.\n" +"\n\t--vram, -v [<vmid>@]<address> <size>" +"\n\t\tRead 'size' bytes (in hex) from a given address (in hex) to stdout. Optionally" +"\n\t\tspecify the VMID (in decimal) treating the address as a virtual address instead.\n" "\n\t--option -O <string>[,<string>,...]\n\t\tEnable various flags: risky, bits, bitsfull, empty_log, follow, named, many," "\n\t\tuse_pci, use_colour, read_smc, quiet.\n" "\n\n", UMR_BUILD_VER, UMR_BUILD_REV);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx