aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-05-02 11:21:02 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-05-02 11:21:02 +0100
commit37560c259d7a0d6aceb96e9d6903ee002f4e5e0c (patch)
treeec4a2ca2ebff19f5620c50a147d972562928866e
parentf75d15231e56cb0f2bafe19faf1229c459a60731 (diff)
parent574d96933ceff60b2d13fe97602572fc7e95f7c6 (diff)
downloadqemu-37560c259d7a0d6aceb96e9d6903ee002f4e5e0c.zip
qemu-37560c259d7a0d6aceb96e9d6903ee002f4e5e0c.tar.gz
qemu-37560c259d7a0d6aceb96e9d6903ee002f4e5e0c.tar.bz2
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20190501' into staging
HMP pull New gva2gpa command delvm now uses hmp_handle_error so gets Error: prefix in messages # gpg: Signature made Wed 01 May 2019 11:57:43 BST # gpg: using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7 # gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" [full] # Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A 9FA9 0516 331E BC5B FDE7 * remotes/dgilbert/tags/pull-hmp-20190501: hmp: gva2gpa debug command hmp: delvm: use hmp_handle_error Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hmp-commands.hx15
-rw-r--r--hmp.c7
-rw-r--r--monitor.c22
-rw-r--r--tests/test-hmp.c1
4 files changed, 42 insertions, 3 deletions
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 9b40359..a2c3ffc 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -588,6 +588,21 @@ is mapped.
ETEXI
{
+ .name = "gva2gpa",
+ .args_type = "addr:l",
+ .params = "addr",
+ .help = "print the guest physical address corresponding to a guest virtual address",
+ .cmd = hmp_gva2gpa,
+ },
+
+STEXI
+@item gva2gpa @var{addr}
+@findex gva2gpa
+Print the guest physical address at which the guest's virtual address @var{addr}
+is mapped based on the mapping for the current CPU.
+ETEXI
+
+ {
.name = "p|print",
.args_type = "fmt:/,val:l",
.params = "/fmt expr",
diff --git a/hmp.c b/hmp.c
index 4bb3af7..56a3ed7 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1480,10 +1480,11 @@ void hmp_delvm(Monitor *mon, const QDict *qdict)
const char *name = qdict_get_str(qdict, "name");
if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) {
- error_reportf_err(err,
- "Error while deleting snapshot on device '%s': ",
- bdrv_get_device_name(bs));
+ error_prepend(&err,
+ "deleting snapshot on device '%s': ",
+ bdrv_get_device_name(bs));
}
+ hmp_handle_error(mon, &err);
}
void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
diff --git a/monitor.c b/monitor.c
index 9b5f10b..bb48997 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1673,6 +1673,28 @@ static void hmp_gpa2hva(Monitor *mon, const QDict *qdict)
memory_region_unref(mr);
}
+static void hmp_gva2gpa(Monitor *mon, const QDict *qdict)
+{
+ target_ulong addr = qdict_get_int(qdict, "addr");
+ MemTxAttrs attrs;
+ CPUState *cs = mon_get_cpu();
+ hwaddr gpa;
+
+ if (!cs) {
+ monitor_printf(mon, "No cpu\n");
+ return;
+ }
+
+ gpa = cpu_get_phys_page_attrs_debug(mon_get_cpu(),
+ addr & TARGET_PAGE_MASK, &attrs);
+ if (gpa == -1) {
+ monitor_printf(mon, "Unmapped\n");
+ } else {
+ monitor_printf(mon, "gpa: %#" HWADDR_PRIx "\n",
+ gpa + (addr & ~TARGET_PAGE_MASK));
+ }
+}
+
#ifdef CONFIG_LINUX
static uint64_t vtop(void *ptr, Error **errp)
{
diff --git a/tests/test-hmp.c b/tests/test-hmp.c
index 54a0182..e344947 100644
--- a/tests/test-hmp.c
+++ b/tests/test-hmp.c
@@ -39,6 +39,7 @@ static const char *hmp_cmds[] = {
"dump-guest-memory /dev/null 0 4096",
"dump-guest-memory /dev/null",
"gdbserver",
+ "gva2gpa 0",
"hostfwd_add tcp::43210-:43210",
"hostfwd_remove tcp::43210-:43210",
"i /w 0",