From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLKu-0004ZZ-4p for qemu-devel@nongnu.org; Tue, 21 Jun 2016 09:03:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFLKj-0007hz-FY for qemu-devel@nongnu.org; Tue, 21 Jun 2016 09:03:23 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47745) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLKj-0007hb-7f for qemu-devel@nongnu.org; Tue, 21 Jun 2016 09:03:13 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u5LCxLJF004370 for ; Tue, 21 Jun 2016 09:03:12 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 23q1qmjen7-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 21 Jun 2016 09:03:12 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 21 Jun 2016 14:03:10 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 3CB6A17D8042 for ; Tue, 21 Jun 2016 14:04:24 +0100 (BST) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u5LD37MT49414356 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 u5LC39IN018177 for ; Tue, 21 Jun 2016 06:03:09 -0600 From: David Hildenbrand Date: Tue, 21 Jun 2016 15:02:30 +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-26-git-send-email-dahi@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC 25/28] qmp: add QMP interface "query-cpu-model-baseline" 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 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 Signed-off-by: David Hildenbrand --- 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