@@ -38,5 +38,8 @@ CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp);
CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type,
CpuModelInfo *mode,
Error **errp);
+CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *modela,
+ CpuModelInfo *modelb,
+ Error **errp);
#endif
@@ -3107,6 +3107,65 @@
'model': 'CpuModelInfo' },
'returns': 'CpuModelExpansionInfo' }
+##
+# @CpuModelCompareResult:
+#
+# An enumeration of CPU model comparation results.
+#
+# @incompatible: both model definition are incompatible
+#
+# @identical: model A == model B
+#
+# @superset: model A > model B
+#
+# @subset: model A < model B
+#
+# Since: 2.7.0
+##
+{ 'enum': 'CpuModelCompareResult',
+ 'data': [ 'incompatible', 'identical', 'superset', 'subset' ] }
+
+##
+# @CpuModelCompareInfo
+#
+# The result of a CPU model comparison.
+#
+# @result: The result of the compare operation.
+# @responsible-properties: List of properties that led to the comparison result
+# not being identical.
+#
+# @responsible-properties is a list of QOM property names that lead to
+# both CPUs not being detected as identical. For identical models, this
+# list is empty.
+# If the QOM property is read-only, that means there's no known
+# way to make the CPU models identical. If the special property name
+# "type" is included, the models are by definition not identical and
+# cannot be made identical.
+#
+# Since: 2.7.0
+##
+{ 'struct': 'CpuModelCompareInfo',
+ 'data': {'result': 'CpuModelCompareResult',
+ 'responsible-properties': ['str']
+ }
+}
+
+##
+# @query-cpu-model-comparison:
+#
+# Compares two CPU models.
+#
+# Returns: a CpuModelCompareInfo. 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-comparison',
+ 'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' },
+ 'returns': 'CpuModelCompareInfo' }
+
# @AddfdInfo:
#
# Information about a file descriptor that was added to an fd set.
@@ -3936,6 +3936,12 @@ EQMP
},
{
+ .name = "query-cpu-model-comparison",
+ .args_type = "modela:q,modelb:q",
+ .mhandler.cmd_new = qmp_marshal_query_cpu_model_comparison,
+ },
+
+ {
.name = "query-target",
.args_type = "",
.mhandler.cmd_new = qmp_marshal_query_target,
@@ -614,6 +614,13 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
return arch_query_cpu_model_expansion(type, model, errp);
}
+CpuModelCompareInfo *qmp_query_cpu_model_comparison(CpuModelInfo *modela,
+ CpuModelInfo *modelb,
+ Error **errp)
+{
+ return arch_query_cpu_model_comparison(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)
@@ -1,5 +1,6 @@
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 += bdrv-next-monitor-owned.o
stub-obj-y += blk-commit-all.o
stub-obj-y += blockdev-close-all-bdrv-states.o
new file mode 100644
@@ -0,0 +1,12 @@
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "sysemu/arch_init.h"
+#include "qapi/qmp/qerror.h"
+
+CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *modela,
+ CpuModelInfo *modelb,
+ Error **errp)
+{
+ error_setg(errp, QERR_UNSUPPORTED);
+ return NULL;
+}