qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <dahi@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: ehabkost@redhat.com, jdenemar@redhat.com, imammedo@redhat.com,
	cornelia.huck@de.ibm.com, borntraeger@de.ibm.com,
	fiuczy@linux.vnet.ibm.com, mimu@linux.vnet.ibm.com
Subject: [Qemu-devel] [RFC 23/28] qmp: add QMP interface "query-cpu-model-expansion"
Date: Tue, 21 Jun 2016 15:02:28 +0200	[thread overview]
Message-ID: <1466514153-85777-24-git-send-email-dahi@linux.vnet.ibm.com> (raw)
In-Reply-To: <1466514153-85777-1-git-send-email-dahi@linux.vnet.ibm.com>

Let's provide a standardized interface to expand CPU models, like the
host model.

To take care of all architectures, different detail levels for an expansion
are introduced. Certain architectures might not support all detail levels.

When the host CPU model is to be expanded, at least the accelerator
QEMU has been started with affects the result. Some architectures
might decide to take the QEMU machine also into account.

E.g. for s390x, the host CPU model will only depend on the accelerator.

The result  of "stable" will be a migration safe CPU model, that will
produce the same guest ABI on other QEMU versions. This interface is very
helpful when CPU models are to be updated between QEMU versions. The
updated model can then simply be expanded to a migration safe
representation.

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
---
 include/sysemu/arch_init.h             |  3 ++
 qapi-schema.json                       | 81 ++++++++++++++++++++++++++++++++++
 qmp-commands.hx                        |  6 +++
 qmp.c                                  |  7 +++
 stubs/Makefile.objs                    |  1 +
 stubs/arch-query-cpu-model-expansion.c | 12 +++++
 6 files changed, 110 insertions(+)
 create mode 100644 stubs/arch-query-cpu-model-expansion.c

diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index d690dfa..37b2e86 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -35,5 +35,8 @@ int kvm_available(void);
 int xen_available(void);
 
 CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp);
+CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type,
+                                                      CpuModelInfo *mode,
+                                                      Error **errp);
 
 #endif
diff --git a/qapi-schema.json b/qapi-schema.json
index 0964eec..5b72dc0 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3026,6 +3026,87 @@
 ##
 { 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'] }
 
+##
+# @CpuModelInfo:
+#
+# Virtual CPU model.
+#
+# A CPU model consists of the name of a CPU definition, to which
+# delta changes are applied (e.g. features added/removed). Most magic values
+# that an architecture might require should be hidden behind the name.
+# However, if required, architectures can expose relevant properties.
+#
+# @name: the name of the CPU definition the model is based on
+# @props: #optional a dictionary of properties to be applied
+#
+# Since: 2.7.0
+##
+{ 'struct': 'CpuModelInfo',
+  'data': { 'name': 'str',
+            '*props': 'any' } }
+
+##
+# @CpuModelExpansionType
+#
+# An enumeration of CPU model expansion types.
+#
+# @stable: Expand to a stable CPU model, creating a migration-safe
+#          representation with only delta changes.
+#
+# @migratable: Expand all migratable properties, hiding unmigratable
+#              properties.
+#
+# @full: Expand all properties, including unmigratable ones.
+#
+# Since: 2.7.0
+##
+{ 'enum': 'CpuModelExpansionType',
+  'data': [ 'stable', 'migratable', 'full' ] }
+
+
+##
+# @CpuModelExpansionInfo
+#
+# The result of a cpu model expansion.
+#
+# @model: the expanded CpuModelInfo.
+#
+# Since: 2.7.0
+##
+{ 'struct': 'CpuModelExpansionInfo',
+  'data': { 'model': 'CpuModelInfo' } }
+
+
+##
+# @query-cpu-model-expansion:
+#
+# Expands the given CPU model to the requested detail level.
+# For "stable", a migration-safe representation is created, which will look
+# the same on all QEMU versions and only contains delta changes. "migratable"
+# and "full" will expose properties in a more detailed way. Not all types
+# might be supported for an architecture.
+#
+# Expanding CPU models is in general independant of the accelerator, except
+# for models like "host" that explicitly rely on an accelerator and can
+# vary in different configurations. On certain architectures, the result may
+# rely on the QEMU machine.
+#
+# This interface can therefore also be used to query the "host" capabilities
+# on supporting architectures.
+#
+# Returns: a CpuModelExpansionInfo. Returns an error if CPU models are not
+#          supported, if the model cannot be expanded, if the model contains
+#          an unknown cpu definition name, unknown properties or properties
+#          with a wrong type. Also returns an error if an expansion type is
+#          not supported.
+#
+# Since: 2.7.0
+##
+{ 'command': 'query-cpu-model-expansion',
+  'data': { 'type': 'CpuModelExpansionType',
+            'model': 'CpuModelInfo' },
+  'returns': 'CpuModelExpansionInfo' }
+
 # @AddfdInfo:
 #
 # Information about a file descriptor that was added to an fd set.
diff --git a/qmp-commands.hx b/qmp-commands.hx
index b444c20..b279fc5 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3930,6 +3930,12 @@ EQMP
     },
 
     {
+        .name       = "query-cpu-model-expansion",
+        .args_type  = "model:q",
+        .mhandler.cmd_new = qmp_marshal_query_cpu_model_expansion,
+    },
+
+    {
         .name       = "query-target",
         .args_type  = "",
         .mhandler.cmd_new = qmp_marshal_query_target,
diff --git a/qmp.c b/qmp.c
index 7df6543..c54f0a0 100644
--- a/qmp.c
+++ b/qmp.c
@@ -607,6 +607,13 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
     return arch_query_cpu_definitions(errp);
 }
 
+CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
+                                                     CpuModelInfo *model,
+                                                     Error **errp)
+{
+    return arch_query_cpu_model_expansion(type, model, errp);
+}
+
 void qmp_add_client(const char *protocol, const char *fdname,
                     bool has_skipauth, bool skipauth, bool has_tls, bool tls,
                     Error **errp)
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 4b258a6..83915f5 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -1,4 +1,5 @@
 stub-obj-y += arch-query-cpu-def.o
+stub-obj-y += arch-query-cpu-model-expansion.o
 stub-obj-y += bdrv-next-monitor-owned.o
 stub-obj-y += blk-commit-all.o
 stub-obj-y += blockdev-close-all-bdrv-states.o
diff --git a/stubs/arch-query-cpu-model-expansion.c b/stubs/arch-query-cpu-model-expansion.c
new file mode 100644
index 0000000..ae7cf55
--- /dev/null
+++ b/stubs/arch-query-cpu-model-expansion.c
@@ -0,0 +1,12 @@
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "sysemu/arch_init.h"
+#include "qapi/qmp/qerror.h"
+
+CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type,
+                                                      CpuModelInfo *mode,
+                                                      Error **errp)
+{
+    error_setg(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
-- 
2.6.6

  parent reply	other threads:[~2016-06-21 13:03 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-21 13:02 [Qemu-devel] [RFC 00/28] s390x CPU models: exposing features David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 01/28] s390x/cpumodel: "host" and "qemu" as CPU subclasses David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 02/28] s390x/cpumodel: expose CPU class properties David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 03/28] s390x/cpumodel: introduce CPU features David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 04/28] s390x/cpumodel: generate CPU feature lists for CPU models David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 05/28] s390x/cpumodel: generate CPU feature group lists David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 06/28] s390x/cpumodel: introduce CPU feature group definitions David Hildenbrand
2016-06-21 20:14   ` Thomas Huth
2016-06-22  6:19     ` David Hildenbrand
2016-06-22 18:00       ` Eduardo Habkost
2016-06-21 13:02 ` [Qemu-devel] [RFC 07/28] s390x/cpumodel: register defined CPU models as subclasses David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 08/28] s390x/cpumodel: store the CPU model in the CPU instance David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 09/28] s390x/cpumodel: expose features and feature groups as properties David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 10/28] s390x/cpumodel: let the CPU model handle feature checks David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 11/28] s390x/cpumodel: check and apply the CPU model David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 12/28] s390x/sclp: factor out preparation of cpu entries David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 13/28] s390x/sclp: introduce sclp feature blocks David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 14/28] s390x/sclp: indicate sclp features David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 15/28] s390x/sclp: propagate the ibc val(lowest and unblocked ibc) David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 16/28] s390x/sclp: propagate the mha via sclp David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 17/28] s390x/sclp: propagate hmfai David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 18/28] update linux headers (CPU model) David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 19/28] s390x/kvm: allow runtime-instrumentation for "none" machine David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 20/28] s390x/kvm: implement CPU model support David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 21/28] s390x/kvm: disable host model for existing compat machines David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 22/28] s390x/kvm: let the CPU model control CMM(A) David Hildenbrand
2016-06-21 13:02 ` David Hildenbrand [this message]
2016-06-21 13:02 ` [Qemu-devel] [RFC 24/28] qmp: add QMP interface "query-cpu-model-comparison" David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 25/28] qmp: add QMP interface "query-cpu-model-baseline" David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 26/28] s390x/cpumodel: implement QMP interface "query-cpu-model-expansion" David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 27/28] s390x/cpumodel: implement QMP interface "query-cpu-model-comparison" David Hildenbrand
2016-06-21 13:02 ` [Qemu-devel] [RFC 28/28] s390x/cpumodel: implement QMP interface "query-cpu-model-baseline" David Hildenbrand
2016-06-21 16:44 ` [Qemu-devel] [RFC 00/28] s390x CPU models: exposing features Eduardo Habkost
2016-06-21 17:01   ` David Hildenbrand
2016-06-21 20:33     ` Eduardo Habkost
2016-06-21 21:09       ` Jiri Denemark
2016-06-21 21:22         ` Eduardo Habkost
2016-06-22  7:11           ` [Qemu-devel] [libvirt] " Jiri Denemark
2016-06-22  7:14             ` David Hildenbrand
2016-06-22  6:51         ` [Qemu-devel] " David Hildenbrand
2016-06-22  7:26           ` Jiri Denemark
2016-06-22  7:34             ` David Hildenbrand
2016-06-22  7:53               ` Jiri Denemark
2016-06-22  7:54                 ` David Hildenbrand
2016-06-22  8:05                   ` Jiri Denemark
2016-06-23  6:41                     ` David Hildenbrand
2016-06-21 20:56   ` Jiri Denemark
2016-06-22  6:43     ` David Hildenbrand
2016-06-22 18:21     ` Eduardo Habkost
2016-06-23  6:33       ` David Hildenbrand
2016-06-30  7:32 ` David Hildenbrand
2016-06-30 15:07   ` Eduardo Habkost
2016-07-11 10:50   ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1466514153-85777-24-git-send-email-dahi@linux.vnet.ibm.com \
    --to=dahi@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=ehabkost@redhat.com \
    --cc=fiuczy@linux.vnet.ibm.com \
    --cc=imammedo@redhat.com \
    --cc=jdenemar@redhat.com \
    --cc=mimu@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).