diff options
author | Jason J. Herne <jjherne@linux.vnet.ibm.com> | 2015-06-26 14:10:16 -0400 |
---|---|---|
committer | Cornelia Huck <cornelia.huck@de.ibm.com> | 2015-09-03 12:17:54 +0200 |
commit | a08f0081c9886c1914d7bc2e6a29636a769fec84 (patch) | |
tree | 8cb75219e2c88d30fd00520825ed82245abc8091 /hw/s390x/s390-skeys.c | |
parent | a4538a5cc57dd493ed1545be98fa0ead0d391b8a (diff) |
s390x: Info skeys sub-command
Provide an info skeys hmp sub-command to allow the end user to dump a storage
key for a given address. This is useful for guest operating system developers.
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'hw/s390x/s390-skeys.c')
-rw-r--r-- | hw/s390x/s390-skeys.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index 98a6938523..e3860c1dfd 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -66,6 +66,29 @@ static void write_keys(QEMUFile *f, uint8_t *keys, uint64_t startgfn, } } +void hmp_info_skeys(Monitor *mon, const QDict *qdict) +{ + S390SKeysState *ss = s390_get_skeys_device(); + S390SKeysClass *skeyclass = S390_SKEYS_GET_CLASS(ss); + uint64_t addr = qdict_get_int(qdict, "addr"); + uint8_t key; + int r; + + /* Quick check to see if guest is using storage keys*/ + if (!skeyclass->skeys_enabled(ss)) { + monitor_printf(mon, "Error: This guest is not using storage keys\n"); + return; + } + + r = skeyclass->get_skeys(ss, addr / TARGET_PAGE_SIZE, 1, &key); + if (r < 0) { + monitor_printf(mon, "Error: %s\n", strerror(-r)); + return; + } + + monitor_printf(mon, " key: 0x%X\n", key); +} + void hmp_dump_skeys(Monitor *mon, const QDict *qdict) { const char *filename = qdict_get_str(qdict, "filename"); |