qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 25/28] qmp: add QMP interface "query-cpu-model-baselin


From: David Hildenbrand
Subject: [Qemu-devel] [RFC 25/28] qmp: add QMP interface "query-cpu-model-baseline"
Date: Tue, 21 Jun 2016 15:02:30 +0200

Let's provide a standardized interface to baseline two CPU models, to
create a third, compatible one.

For now, we allow two baseline modes. "stable" tries to create a
better tested model, e.g. by minimizing CPU definition changes.
"maximum" rather tries to get the maxmimum possible model,
e.g. by maximizing features.

The host CPU model has the same semantics as for "query-cpu-model-expansion".

Acked-by: Cornelia Huck <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
 include/sysemu/arch_init.h            |  4 ++++
 qapi-schema.json                      | 44 +++++++++++++++++++++++++++++++++++
 qmp-commands.hx                       |  6 +++++
 qmp.c                                 |  8 +++++++
 stubs/Makefile.objs                   |  1 +
 stubs/arch-query-cpu-model-baseline.c | 13 +++++++++++
 6 files changed, 76 insertions(+)
 create mode 100644 stubs/arch-query-cpu-model-baseline.c

diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index 96d47c0..1b35e90 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -41,5 +41,9 @@ CpuModelExpansionInfo 
*arch_query_cpu_model_expansion(CpuModelExpansionType type
 CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *modela,
                                                      CpuModelInfo *modelb,
                                                      Error **errp);
+CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelBaselineType type,
+                                                    CpuModelInfo *modela,
+                                                    CpuModelInfo *modelb,
+                                                    Error **errp);
 
 #endif
diff --git a/qapi-schema.json b/qapi-schema.json
index 34df86f..3a3fccb 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3166,6 +3166,50 @@
   'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' },
   'returns': 'CpuModelCompareInfo' }
 
+##
+# @CpuModelBaselineType
+#
+# An enumeration of CPU model baseline types.
+#
+# @stable: Find a compatible, stable model (e.g. least feature changes).
+#
+# @maximum: Find a compatible, maximum model (e.g. maximizing features)
+#
+# Since: 2.7.0
+##
+{ 'enum': 'CpuModelBaselineType',
+  'data': [ 'stable', 'maximum' ] }
+
+##
+# @CpuModelBaselineInfo
+#
+# The result of a CPU model baseline.
+#
+# @model: the baselined CpuModelInfo.
+#
+# Since: 2.7.0
+##
+{ 'struct': 'CpuModelBaselineInfo',
+  'data': { 'model': 'CpuModelInfo' } }
+
+##
+# @query-cpu-model-baseline:
+#
+# Baseline two CPU models, creating a compatible third model.
+#
+# Returns: a CpuModelBaselineInfo. Returns an error if CPU models are not
+#          supported, if a model cannot be used, if the model contains
+#          an unknown cpu definition name, unknown properties or properties
+#          with a wrong type.
+#
+# Since: 2.7.0
+##
+{ 'command': 'query-cpu-model-baseline',
+  'data': { 'type' : 'CpuModelBaselineType',
+            'modela': 'CpuModelInfo',
+            'modelb': 'CpuModelInfo' },
+  'returns': 'CpuModelBaselineInfo' }
+
 # @AddfdInfo:
 #
 # Information about a file descriptor that was added to an fd set.
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 4ee7937..42b3853 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3942,6 +3942,12 @@ EQMP
     },
 
     {
+        .name       = "query-cpu-model-baseline",
+        .args_type  = "type:s,modela:q,modelb:q",
+        .mhandler.cmd_new = qmp_marshal_query_cpu_model_baseline,
+    },
+
+    {
         .name       = "query-target",
         .args_type  = "",
         .mhandler.cmd_new = qmp_marshal_query_target,
diff --git a/qmp.c b/qmp.c
index afa8c77..6e5437f 100644
--- a/qmp.c
+++ b/qmp.c
@@ -621,6 +621,14 @@ CpuModelCompareInfo 
*qmp_query_cpu_model_comparison(CpuModelInfo *modela,
     return arch_query_cpu_model_comparison(modela, modelb, errp);
 }
 
+CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelBaselineType type,
+                                                   CpuModelInfo *modela,
+                                                   CpuModelInfo *modelb,
+                                                   Error **errp)
+{
+    return arch_query_cpu_model_baseline(type, modela, modelb, 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 b831dbc..56bddd8 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -1,6 +1,7 @@
 stub-obj-y += arch-query-cpu-def.o
 stub-obj-y += arch-query-cpu-model-expansion.o
 stub-obj-y += arch-query-cpu-model-comparison.o
+stub-obj-y += arch-query-cpu-model-baseline.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-baseline.c 
b/stubs/arch-query-cpu-model-baseline.c
new file mode 100644
index 0000000..407d323
--- /dev/null
+++ b/stubs/arch-query-cpu-model-baseline.c
@@ -0,0 +1,13 @@
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "sysemu/arch_init.h"
+#include "qapi/qmp/qerror.h"
+
+CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelBaselineType type,
+                                                    CpuModelInfo *modela,
+                                                    CpuModelInfo *modelb,
+                                                    Error **errp)
+{
+    error_setg(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
-- 
2.6.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]