aboutsummaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2019-06-19 15:19:05 +0530
committerMichael S. Tsirkin <mst@redhat.com>2019-07-04 17:00:32 -0400
commitd766b22bbd18c7766e2e0a28ea0d07c18db13f7e (patch)
treeed2a6582c204d338ee12fa5162ddeb034ce05ce3 /monitor
parentadf0748a494151fd7c10050820f2a3988768828a (diff)
hmp: Handle virtio-pmem when printing memory device infos
Print the memory device info just like for PCDIMM/NVDIMM. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20190619094907.10131-6-pagupta@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'monitor')
-rw-r--r--monitor/hmp-cmds.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index c283dde0e9..1c97926432 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -2653,6 +2653,7 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
Error *err = NULL;
MemoryDeviceInfoList *info_list = qmp_query_memory_devices(&err);
MemoryDeviceInfoList *info;
+ VirtioPMEMDeviceInfo *vpi;
MemoryDeviceInfo *value;
PCDIMMDeviceInfo *di;
@@ -2662,19 +2663,9 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
if (value) {
switch (value->type) {
case MEMORY_DEVICE_INFO_KIND_DIMM:
- di = value->u.dimm.data;
- break;
-
case MEMORY_DEVICE_INFO_KIND_NVDIMM:
- di = value->u.nvdimm.data;
- break;
-
- default:
- di = NULL;
- break;
- }
-
- if (di) {
+ di = value->type == MEMORY_DEVICE_INFO_KIND_DIMM ?
+ value->u.dimm.data : value->u.nvdimm.data;
monitor_printf(mon, "Memory device [%s]: \"%s\"\n",
MemoryDeviceInfoKind_str(value->type),
di->id ? di->id : "");
@@ -2687,6 +2678,18 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
di->hotplugged ? "true" : "false");
monitor_printf(mon, " hotpluggable: %s\n",
di->hotpluggable ? "true" : "false");
+ break;
+ case MEMORY_DEVICE_INFO_KIND_VIRTIO_PMEM:
+ vpi = value->u.virtio_pmem.data;
+ monitor_printf(mon, "Memory device [%s]: \"%s\"\n",
+ MemoryDeviceInfoKind_str(value->type),
+ vpi->id ? vpi->id : "");
+ monitor_printf(mon, " memaddr: 0x%" PRIx64 "\n", vpi->memaddr);
+ monitor_printf(mon, " size: %" PRIu64 "\n", vpi->size);
+ monitor_printf(mon, " memdev: %s\n", vpi->memdev);
+ break;
+ default:
+ g_assert_not_reached();
}
}
}