From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLKo-0004Vv-5E for qemu-devel@nongnu.org; Tue, 21 Jun 2016 09:03:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFLKh-0007g7-6s for qemu-devel@nongnu.org; Tue, 21 Jun 2016 09:03:18 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:3167 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLKh-0007ft-2G for qemu-devel@nongnu.org; Tue, 21 Jun 2016 09:03:11 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u5LCxOwG044652 for ; Tue, 21 Jun 2016 09:03:10 -0400 Received: from e06smtp17.uk.ibm.com (e06smtp17.uk.ibm.com [195.75.94.113]) by mx0b-001b2d01.pphosted.com with ESMTP id 23pygp6ub3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 21 Jun 2016 09:03:10 -0400 Received: from localhost by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 21 Jun 2016 14:03:08 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id DDBA91B08069 for ; Tue, 21 Jun 2016 14:04:18 +0100 (BST) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u5LD37qM58064936 for ; Tue, 21 Jun 2016 13:03:07 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u5LC39tn018156 for ; Tue, 21 Jun 2016 06:03:09 -0600 From: David Hildenbrand Date: Tue, 21 Jun 2016 15:02:29 +0200 In-Reply-To: <1466514153-85777-1-git-send-email-dahi@linux.vnet.ibm.com> References: <1466514153-85777-1-git-send-email-dahi@linux.vnet.ibm.com> Message-Id: <1466514153-85777-25-git-send-email-dahi@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC 24/28] qmp: add QMP interface "query-cpu-model-comparison" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Let's provide a standardized interface to compare two CPU models. query-cpu-model-compare takes two models and returns what it knows about their compability. If modelA is a subset of modelB or if both are identical, modelA will run in the same configuration as modelB. If modelA is however a superset of modelB or if both are incompatible, one can try to create a compatible one by "baselining" both models (follow up patch). The host CPU model has the same semantics as for "query-cpu-model-expansion". Acked-by: Cornelia Huck Signed-off-by: David Hildenbrand --- include/sysemu/arch_init.h | 3 ++ qapi-schema.json | 59 +++++++++++++++++++++++++++++++++ qmp-commands.hx | 6 ++++ qmp.c | 7 ++++ stubs/Makefile.objs | 1 + stubs/arch-query-cpu-model-comparison.c | 12 +++++++ 6 files changed, 88 insertions(+) create mode 100644 stubs/arch-query-cpu-model-comparison.c diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h index 37b2e86..96d47c0 100644 --- a/include/sysemu/arch_init.h +++ b/include/sysemu/arch_init.h @@ -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 diff --git a/qapi-schema.json b/qapi-schema.json index 5b72dc0..34df86f 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -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. diff --git a/qmp-commands.hx b/qmp-commands.hx index b279fc5..4ee7937 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -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, diff --git a/qmp.c b/qmp.c index c54f0a0..afa8c77 100644 --- a/qmp.c +++ b/qmp.c @@ -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) diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 83915f5..b831dbc 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -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 diff --git a/stubs/arch-query-cpu-model-comparison.c b/stubs/arch-query-cpu-model-comparison.c new file mode 100644 index 0000000..d5486ae --- /dev/null +++ b/stubs/arch-query-cpu-model-comparison.c @@ -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; +} -- 2.6.6