From nobody Mon Feb 9 07:05:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488435836508872.7375720896167; Wed, 1 Mar 2017 22:23:56 -0800 (PST) Received: from localhost ([::1]:50619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjK9b-0003fA-8D for importer@patchew.org; Thu, 02 Mar 2017 01:23:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjK6Q-0001Zh-CM for qemu-devel@nongnu.org; Thu, 02 Mar 2017 01:20:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjK6N-0003N1-FD for qemu-devel@nongnu.org; Thu, 02 Mar 2017 01:20:38 -0500 Received: from mail.kernel.org ([198.145.29.136]:51154) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cjK6N-0003KR-65 for qemu-devel@nongnu.org; Thu, 02 Mar 2017 01:20:35 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 458AE20320; Thu, 2 Mar 2017 06:20:33 +0000 (UTC) Received: from redhat.com (pool-96-237-235-121.bstnma.fios.verizon.net [96.237.235.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7095D20303; Thu, 2 Mar 2017 06:20:31 +0000 (UTC) Date: Thu, 2 Mar 2017 08:20:30 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1488435591-17882-6-git-send-email-mst@redhat.com> References: <1488435591-17882-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1488435591-17882-1-git-send-email-mst@redhat.com> X-Mailer: git-send-email 2.8.0.287.g0deeb61 X-Mutt-Fcc: =sent X-Virus-Scanned: ClamAV using ClamSMTP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 198.145.29.136 Subject: [Qemu-devel] [PULL 05/15] qmp/hmp: add query-vm-generation-id and 'info vm-generation-id' commands 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: Peter Maydell , Ben Warren , Laszlo Ersek , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Add commands to query Virtual Machine Generation ID counter. QMP command example: { "execute": "query-vm-generation-id" } HMP command example: info vm-generation-id Signed-off-by: Igor Mammedov Reviewed-by: Eric Blake Signed-off-by: Ben Warren Reviewed-by: Laszlo Ersek Tested-by: Laszlo Ersek Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi-schema.json | 20 ++++++++++++++++++++ hmp.h | 1 + hmp.c | 9 +++++++++ hw/acpi/vmgenid.c | 16 ++++++++++++++++ stubs/vmgenid.c | 9 +++++++++ hmp-commands-info.hx | 14 ++++++++++++++ stubs/Makefile.objs | 1 + 7 files changed, 70 insertions(+) create mode 100644 stubs/vmgenid.c diff --git a/qapi-schema.json b/qapi-schema.json index d6186d4..84692da 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -6188,3 +6188,23 @@ # ## { 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'] } + +## +# @GuidInfo: +# +# GUID information. +# +# @guid: the globally unique identifier +# +# Since: 2.9 +## +{ 'struct': 'GuidInfo', 'data': {'guid': 'str'} } + +## +# @query-vm-generation-id: +# +# Show Virtual Machine Generation ID +# +# Since 2.9 +## +{ 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' } diff --git a/hmp.h b/hmp.h index 05daf7c..799fd37 100644 --- a/hmp.h +++ b/hmp.h @@ -137,5 +137,6 @@ void hmp_rocker_of_dpa_flows(Monitor *mon, const QDict = *qdict); void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict); void hmp_info_dump(Monitor *mon, const QDict *qdict); void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict); +void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict); =20 #endif diff --git a/hmp.c b/hmp.c index 83e287e..aadbcf5 100644 --- a/hmp.c +++ b/hmp.c @@ -2576,3 +2576,12 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict= *qdict) =20 qapi_free_HotpluggableCPUList(saved); } + +void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict) +{ + GuidInfo *info =3D qmp_query_vm_generation_id(NULL); + if (info) { + monitor_printf(mon, "%s\n", info->guid); + } + qapi_free_GuidInfo(info); +} diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index c8465df..744f284 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -240,3 +240,19 @@ static void vmgenid_register_types(void) } =20 type_init(vmgenid_register_types) + +GuidInfo *qmp_query_vm_generation_id(Error **errp) +{ + GuidInfo *info; + VmGenIdState *vms; + Object *obj =3D find_vmgenid_dev(); + + if (!obj) { + return NULL; + } + vms =3D VMGENID(obj); + + info =3D g_malloc0(sizeof(*info)); + info->guid =3D qemu_uuid_unparse_strdup(&vms->guid); + return info; +} diff --git a/stubs/vmgenid.c b/stubs/vmgenid.c new file mode 100644 index 0000000..c64eb7a --- /dev/null +++ b/stubs/vmgenid.c @@ -0,0 +1,9 @@ +#include "qemu/osdep.h" +#include "qmp-commands.h" +#include "qapi/qmp/qerror.h" + +GuidInfo *qmp_query_vm_generation_id(Error **errp) +{ + error_setg(errp, QERR_UNSUPPORTED); + return NULL; +} diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index b0f35e6..a53f105 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -802,6 +802,20 @@ Show information about hotpluggable CPUs ETEXI =20 STEXI +@item info vm-generation-id +@findex vm-generation-id +Show Virtual Machine Generation ID +ETEXI + + { + .name =3D "vm-generation-id", + .args_type =3D "", + .params =3D "", + .help =3D "Show Virtual Machine Generation ID", + .cmd =3D hmp_info_vm_generation_id, + }, + +STEXI @end table ETEXI =20 diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index aa6050f..224f04b 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -36,3 +36,4 @@ stub-obj-y +=3D qmp_pc_dimm_device_list.o stub-obj-y +=3D target-monitor-defs.o stub-obj-y +=3D target-get-monitor-def.o stub-obj-y +=3D pc_madt_cpu_entry.o +stub-obj-y +=3D vmgenid.o --=20 MST