Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net> On 03/09/2017 06:06 AM, Tom St Denis wrote: > Updates the --vram command to add the ability to read from > one of the VM domains instead. > > Signed-off-by: Tom St Denis <tom.stdenis at amd.com> > --- > doc/umr.1 | 7 ++++--- > src/app/main.c | 16 ++++++++++------ > 2 files changed, 14 insertions(+), 9 deletions(-) > > diff --git a/doc/umr.1 b/doc/umr.1 > index a12dfb0a00ff..90be2d6316ce 100644 > --- a/doc/umr.1 > +++ b/doc/umr.1 > @@ -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 > diff --git a/src/app/main.c b/src/app/main.c > index 99e014888571..e8f786b39743 100644 > --- a/src/app/main.c > +++ b/src/app/main.c > @@ -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); > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20170309/ddc1d3e3/attachment.sig>