From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkeYz-0002r4-Bt for qemu-devel@nongnu.org; Mon, 17 Dec 2012 12:33:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkeYu-00012V-RY for qemu-devel@nongnu.org; Mon, 17 Dec 2012 12:33:13 -0500 Received: from cantor2.suse.de ([195.135.220.15]:39632 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkeYu-00012L-H1 for qemu-devel@nongnu.org; Mon, 17 Dec 2012 12:33:08 -0500 Message-ID: <50CF5749.5020701@suse.de> Date: Mon, 17 Dec 2012 18:32:57 +0100 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1355503606-54131-1-git-send-email-jfrei@linux.vnet.ibm.com> <1355503606-54131-4-git-send-email-jfrei@linux.vnet.ibm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/3] S390: Enable -cpu help and QMP query-cpu-definitions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Heinz Graalfs , qemu-devel , Viktor Mihajlovski , Christian Borntraeger , Jens Freimann , Cornelia Huck , Einar Lueck Am 17.12.2012 15:47, schrieb Alexander Graf: >=20 > On 14.12.2012, at 17:46, Jens Freimann wrote: >=20 >> From: Viktor Mihajlovski >> >> This enables qemu -cpu help to return a list of supported CPU models >> on s390 and also to query for cpu definitions in the monitor. >> Initially only cpu model =3D host is returned. This needs to be rework= ed >> into a full-fledged CPU model handling later on. >> This change is needed to allow libvirt exploiters (like OpenStack) >> to specify a CPU model. >> >> Signed-off-by: Viktor Mihajlovski >> Signed-off-by: Jens Freimann >> Reviewed-by: Christian Borntraeger >> --- >> v1 -> v2: >> * only print output with CONFIG_KVM >> >> --- >> hw/s390-virtio.c | 6 +++++- >> target-s390x/cpu.c | 23 +++++++++++++++++++++++ >> target-s390x/cpu.h | 3 +++ >> 3 files changed, 31 insertions(+), 1 deletion(-) >> >> diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c >> index a350430..60fde26 100644 >> --- a/hw/s390-virtio.c >> +++ b/hw/s390-virtio.c >> @@ -2,6 +2,7 @@ >> * QEMU S390 virtio target >> * >> * Copyright (c) 2009 Alexander Graf >> + * Copyright IBM Corp 2012 >> * >> * This library is free software; you can redistribute it and/or >> * modify it under the terms of the GNU Lesser General Public >> @@ -13,7 +14,10 @@ >> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> * Lesser General Public License for more details. >> * >> - * You should have received a copy of the GNU Lesser General Public >> + * Contributions after 2012-10-29 are licensed under the terms of the >> + * GNU GPL, version 2 or (at your option) any later version. >> + * >> + * You should have received a copy of the GNU (Lesser) General Public >> * License along with this library; if not, see . >> */ >> >> diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c >> index 75d4036..adca789 100644 >> --- a/target-s390x/cpu.c >> +++ b/target-s390x/cpu.c >> @@ -28,8 +28,31 @@ >> #include "hw/hw.h" >> #include "qemu-common.h" >> #include "qemu-timer.h" >> +#include "arch_init.h" >> >> >> +/* generate CPU information for cpu -? */ >> +void s390_cpu_list(FILE *f, fprintf_function cpu_fprintf) >> +{ >> +#ifdef CONFIG_KVM >> + (*cpu_fprintf)(f, "s390 %16s\n", "host"); >> +#endif >> +} >> + >=20 > static const struct CpuDefinitionInfo cpu_info[] =3D { > #ifdef CONFIG_KVM > { > .name =3D "host", > }, > #endif > }; >=20 > static const struct CPUDefinitionInfoList cpu_entry =3D { > value =3D cpu_info, > }; >=20 >> +CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp) >> +{ >> + CpuDefinitionInfoList *entry; >> + CpuDefinitionInfo *info; >> + >> + info =3D g_malloc0(sizeof(*info)); >> + info->name =3D g_strdup("host"); >> + >> + entry =3D g_malloc0(sizeof(*entry)); >> + entry->value =3D info; >=20 > return &entry; >=20 > (completely untested, don't you think the above would work? The code as= is looks quite leaky.) target-i386 does it the same way (well, not hardcoding "host" obviously), so if there's leaks they need to be solved in generic code. Mid-term we want to generate this list on the fly from CPU subclasses, so I don't see the utility of starting a static model list for QMP only. Given that subclasses are really easy to introduce, we might as well do that. We could leave s390-cpu non-abstract as fallback for the non-host cpu_models plus one host-s390-cpu for -cpu host; only thing to keep in mind then is that the base class is not automatically filtered out, as relied on for other targets. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg