From patchwork Thu May 23 10:24:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 10957395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 83C4416C1 for ; Thu, 23 May 2019 10:50:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6902A26E54 for ; Thu, 23 May 2019 10:50:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BD1C27861; Thu, 23 May 2019 10:50:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0813326E54 for ; Thu, 23 May 2019 10:50:12 +0000 (UTC) Received: from localhost ([127.0.0.1]:33485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTlIZ-00017P-9t for patchwork-qemu-devel@patchwork.kernel.org; Thu, 23 May 2019 06:50:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTkwc-0006zR-Oo for qemu-devel@nongnu.org; Thu, 23 May 2019 06:27:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTkwb-0002Vv-Lt for qemu-devel@nongnu.org; Thu, 23 May 2019 06:27:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52682) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTkwb-0002Vd-HT for qemu-devel@nongnu.org; Thu, 23 May 2019 06:27:29 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF2D980C26; Thu, 23 May 2019 10:27:28 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (ovpn-116-162.sin2.redhat.com [10.67.116.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03D6269181; Thu, 23 May 2019 10:27:08 +0000 (UTC) From: Pankaj Gupta To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 15:54:47 +0530 Message-Id: <20190523102449.2642-6-pagupta@redhat.com> In-Reply-To: <20190523102449.2642-1-pagupta@redhat.com> References: <20190523102449.2642-1-pagupta@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 23 May 2019 10:27:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 5/7] hmp: Handle virtio-pmem when printing memory device infos X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, aarcange@redhat.com, cohuck@redhat.com, xiaoguangrong.eric@gmail.com, mst@redhat.com, pagupta@redhat.com, riel@surriel.com, david@redhat.com, armbru@redhat.com, ehabkost@redhat.com, lcapitulino@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, imammedo@redhat.com, dan.j.williams@intel.com, nilal@redhat.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: David Hildenbrand Print the memory device info just like for PCDIMM/NVDIMM. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: David Hildenbrand --- hmp.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/hmp.c b/hmp.c index 92941142af..e1866bc7f1 100644 --- a/hmp.c +++ b/hmp.c @@ -2650,6 +2650,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; @@ -2659,19 +2660,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 : ""); @@ -2684,6 +2675,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(); } } }