[PATCH umr] Allow specifying virtual devices now

Tom St Denis tom.stdenis at amd.com
Mon Dec 4 12:59:14 UTC 2017

Now you can specify a device not present in the system for the purposes
of using the --lookup command (also -lr and -lb).  Handy for decoding
register dumps for ASICs you don't have access to.

Simply use the --force command with a '.' prefix, e.g.

umr -f .vega10 -lb

Can be combined with NPI scripts as well, e.g.

umr -f .@/home/user/device.npi -lb

Signed-off-by: Tom St Denis <tom.stdenis at amd.com>
 doc/umr.1          | 5 ++++-
 src/lib/discover.c | 8 ++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/umr.1 b/doc/umr.1
index eb1b88bea8d0..eac77798d758 100644
--- a/doc/umr.1
+++ b/doc/umr.1
@@ -16,7 +16,10 @@ where 0 is the first card probed.
 Select a GFX INSTANCE/SH/SE bank in decimal.  Can use 'x' to denote a broadcast selection.
 .IP "--force -f <number>"
 Force a PCIE Device ID in hex or by asic name.  This is used in case the amdgpu driver
-is not yet loaded or a display is not yet attached.
+is not yet loaded or a display is not yet attached.  A '@' prefix will specify a path to
+ an NPI script, for instance, '@/home/user/device.npi'.  A '.' prefix will specify a virtual
+device which is handy for looking up register decodings for a device not present in the system,
+for instance, '.vega10'.
 .IP "--pci <device>"
 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
diff --git a/src/lib/discover.c b/src/lib/discover.c
index bf6d9fc00c35..e1ccea1d20e4 100644
--- a/src/lib/discover.c
+++ b/src/lib/discover.c
@@ -103,6 +103,14 @@ struct umr_asic *umr_discover_asic(struct umr_options *options)
 	long trydid = options->forcedid;
 	int busmatch = 0, parsed_did, need_config_scan = 0;
+	// virtual device
+	if (options->dev_name[0] == '.') {
+		asic = umr_discover_asic_by_name(options, options->dev_name + 1);
+		if (asic)
+			asic->options = *options;
+		return asic;
+	}
 	// Try to map to instance if we have a specific pci device
 	if (options->pci.domain || options->pci.bus ||
 	    options->pci.slot || options->pci.func) {

More information about the amd-gfx mailing list