From nobody Mon Feb 9 07:25:54 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 1487287084265948.8495705711186; Thu, 16 Feb 2017 15:18:04 -0800 (PST) Received: from localhost ([::1]:50746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceVJL-0002Bd-4i for importer@patchew.org; Thu, 16 Feb 2017 18:18:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceVHC-0000S7-E9 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 18:15:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceVHB-0000wN-0W for qemu-devel@nongnu.org; Thu, 16 Feb 2017 18:15:50 -0500 Received: from mail-pg0-x22d.google.com ([2607:f8b0:400e:c05::22d]:36526) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ceVHA-0000vb-RL for qemu-devel@nongnu.org; Thu, 16 Feb 2017 18:15:48 -0500 Received: by mail-pg0-x22d.google.com with SMTP id v184so9799533pgv.3 for ; Thu, 16 Feb 2017 15:15:48 -0800 (PST) Received: from Arrow.corp.skyportsystems.com (67-207-112-138.static.wiline.com. [67.207.112.138]) by smtp.gmail.com with ESMTPSA id r74sm15455696pfb.67.2017.02.16.15.15.47 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 16 Feb 2017 15:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skyportsystems.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=gyHjqZnXzbyvjhes/Jj4Pi9sHX7eKK/i5wKmAW0ZREM=; b=qaiHcTyiQXSGZXZhbrufWTVJ3Iu0BhBc8poFEGK/QNfljo2El3rVJYzAanlCXTqeen aOyR753nBHqJ8EwPoLTSeqpGcUrl86bnHqWk/8FlmBw3mFYwU2CxIXb6Tss1aWo+vui+ gw4E095d9k9bhyjy1kw7fn/ll9BC1bWYlwZ4Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=gyHjqZnXzbyvjhes/Jj4Pi9sHX7eKK/i5wKmAW0ZREM=; b=Nu5CvdQULWviyb/U57Rdwa5K9KRe+WqLndcVac6LvTzldxifkYI4wFRfTvLS/wy5ZW acmX2XuH9DFAbQs1iEo+llYADGyTMjE2Z3IN1spp95tq78x7FW3cmWsoNdzDXInz6NfD HNyahlcFD777gYu50bVGK2Sc9XmxeoGULTFuiea2BBomO3rIjQ890rapRtQSKFKHcPHB o3vLPq5niKumSdvtK0ZWNjZx8pC9L2UYdCI6bmn91ar8dcghdKHROylQbDK6f27V41+7 6jJz6AdzdrdkXT9rx76Wjjb4K3xMR/l0k8vCLFmT6Ch67EW35W5kdHWKQOoY3vr2GiyH xEBw== X-Gm-Message-State: AMke39kIzBsyaKzU5Fk8cRRpOYFkTRk4La8R/yo2fJFw/U7uXJHI+eiJrs5dGPnDEXFhcqf/ X-Received: by 10.99.156.2 with SMTP id f2mr6088159pge.189.1487286947998; Thu, 16 Feb 2017 15:15:47 -0800 (PST) From: ben@skyportsystems.com To: qemu-devel@nongnu.org Date: Thu, 16 Feb 2017 15:15:37 -0800 Message-Id: <76fbc5294cefdcbd4c6344d77357f845868079e3.1487286467.git.ben@skyportsystems.com> X-Mailer: git-send-email 2.10.1 (Apple Git-78) In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::22d Subject: [Qemu-devel] [PATCH v8 5/8] 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: imammedo@redhat.com, lersek@redhat.com, Ben Warren , mst@redhat.com 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 MIME-Version: 1.0 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 --- hmp-commands-info.hx | 14 ++++++++++++++ hmp.c | 9 +++++++++ hmp.h | 1 + hw/acpi/vmgenid.c | 16 ++++++++++++++++ qapi-schema.json | 20 ++++++++++++++++++++ stubs/Makefile.objs | 1 + stubs/vmgenid.c | 9 +++++++++ 7 files changed, 70 insertions(+) create mode 100644 stubs/vmgenid.c 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/hmp.c b/hmp.c index 2bc4f06..535613d 100644 --- a/hmp.c +++ b/hmp.c @@ -2565,3 +2565,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/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/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/qapi-schema.json b/qapi-schema.json index 5edb08d..396e49c 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -6056,3 +6056,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/stubs/Makefile.objs b/stubs/Makefile.objs index a187295..0bffca6 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -35,3 +35,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 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; +} --=20 2.7.4