From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: qemu-devel@nongnu.org
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, agraf@suse.de,
jjherne@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH v3 6/8] s390x: Info skeys sub-command
Date: Mon, 31 Aug 2015 13:00:32 +0200 [thread overview]
Message-ID: <1441018834-8993-7-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1441018834-8993-1-git-send-email-cornelia.huck@de.ibm.com>
From: "Jason J. Herne" <jjherne@linux.vnet.ibm.com>
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>
---
hmp-commands.hx | 2 ++
hw/s390x/s390-skeys.c | 23 +++++++++++++++++++++++
include/hw/s390x/storage-keys.h | 2 ++
monitor.c | 9 +++++++++
4 files changed, 36 insertions(+)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 803ff91..c61468e 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1806,6 +1806,8 @@ show roms
show the TPM device
@item info memory-devices
show the memory devices
+@item info skeys
+Display the value of a storage key (s390 only)
@end table
ETEXI
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
index 0ef3aea..b8aacc8 100644
--- a/hw/s390x/s390-skeys.c
+++ b/hw/s390x/s390-skeys.c
@@ -65,6 +65,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");
diff --git a/include/hw/s390x/storage-keys.h b/include/hw/s390x/storage-keys.h
index 0d04f19..18e08d2 100644
--- a/include/hw/s390x/storage-keys.h
+++ b/include/hw/s390x/storage-keys.h
@@ -54,4 +54,6 @@ void s390_skeys_init(void);
S390SKeysState *s390_get_skeys_device(void);
void hmp_dump_skeys(Monitor *mon, const QDict *qdict);
+void hmp_info_skeys(Monitor *mon, const QDict *qdict);
+
#endif /* __S390_STORAGE_KEYS_H */
diff --git a/monitor.c b/monitor.c
index 3deba38..451af6f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2881,6 +2881,15 @@ static mon_cmd_t info_cmds[] = {
.help = "Show rocker OF-DPA groups",
.mhandler.cmd = hmp_rocker_of_dpa_groups,
},
+#if defined(TARGET_S390X)
+ {
+ .name = "skeys",
+ .args_type = "addr:l",
+ .params = "address",
+ .help = "Display the value of a storage key",
+ .mhandler.cmd = hmp_info_skeys,
+ },
+#endif
{
.name = NULL,
},
--
2.5.1
next prev parent reply other threads:[~2015-08-31 11:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-31 11:00 [Qemu-devel] [PATCH v3 0/8] s390x: storage key migration Cornelia Huck
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 1/8] s390x: add 2.5 compat s390-ccw-virtio machine Cornelia Huck
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 2/8] s390x: Create QOM device for s390 storage keys Cornelia Huck
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 3/8] s390x: Enable new s390-storage-keys device Cornelia Huck
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 4/8] s390x: Dump storage keys qmp command Cornelia Huck
2015-08-31 14:48 ` Eric Blake
2015-08-31 15:20 ` Cornelia Huck
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 5/8] s390x: Dump-skeys hmp support Cornelia Huck
2015-08-31 16:30 ` Eric Blake
2015-08-31 18:57 ` Jason J. Herne
2015-09-01 14:30 ` Cornelia Huck
2015-09-01 16:05 ` Eric Blake
2015-09-01 16:22 ` Cornelia Huck
2015-08-31 11:00 ` Cornelia Huck [this message]
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 7/8] s390x: Migrate guest storage keys (initial memory only) Cornelia Huck
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 8/8] s390x: Disable storage key migration on old machine type Cornelia Huck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1441018834-8993-7-git-send-email-cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=jfrei@linux.vnet.ibm.com \
--cc=jjherne@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).