From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c810C-0000Y1-Jv for qemu-devel@nongnu.org; Sat, 19 Nov 2016 03:28:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c8108-0004Jw-L4 for qemu-devel@nongnu.org; Sat, 19 Nov 2016 03:28:00 -0500 Received: from 10.mo53.mail-out.ovh.net ([87.98.189.210]:49520) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c8108-0004Jb-Ex for qemu-devel@nongnu.org; Sat, 19 Nov 2016 03:27:56 -0500 Received: from player158.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo53.mail-out.ovh.net (Postfix) with ESMTP id 1F95144BC0 for ; Sat, 19 Nov 2016 09:27:54 +0100 (CET) Date: Sat, 19 Nov 2016 09:27:38 +0100 From: Greg Kurz Message-ID: <20161119092738.17268815@bahia> In-Reply-To: <1479248275-18889-11-git-send-email-david@gibson.dropbear.id.au> References: <1479248275-18889-1-git-send-email-david@gibson.dropbear.id.au> <1479248275-18889-11-git-send-email-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFCv2 10/12] pseries: Move CPU compatibility property to machine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: clg@kaod.org, aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, nikunj@linux.vnet.ibm.com, agraf@suse.de, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, abologna@redhat.com, thuth@redhat.com, lvivier@redhat.com Hi David, I've started to go through the testing you suggest in the cover letter. QEMU crashes when trying to use the deprecated "compat" CPU property. On Wed, 16 Nov 2016 09:17:53 +1100 David Gibson wrote: > Server class POWER CPUs have a "compat" property, which is used to set the > backwards compatibility mode for the processor. However, this only makes > sense for machine types which don't give the guest access to hypervisor > privilege - otherwise the compatibility level is under the guest's control. > > To reflect this, this removes the CPU 'compat' property and instead > creates a 'max-cpu-compat' property on the pseries machine. Strictly > speaking this breaks compatibility, but AFAIK the 'compat' option was > never (directly) used with -device or device_add. > > The option was used with -cpu. So, to maintain compatibility, this patch > adds a hack to the cpu option parsing to strip out any compat options > supplied with -cpu and set them on the machine property instead of the new > removed cpu property. > > Signed-off-by: David Gibson > --- [...] > +static void getset_compat_deprecated(Object *obj, Visitor *v, const char *name, > + void *opaque, Error **errp) > { > - Error *error = NULL; > - char *value = NULL; > - Property *prop = opaque; > - uint32_t *max_compat = qdev_get_prop_ptr(DEVICE(obj), prop); > - > - visit_type_str(v, name, &value, &error); > - if (error) { > - error_propagate(errp, error); > - return; > - } > - > - if (strcmp(value, "power6") == 0) { > - *max_compat = CPU_POWERPC_LOGICAL_2_05; > - } else if (strcmp(value, "power7") == 0) { > - *max_compat = CPU_POWERPC_LOGICAL_2_06; > - } else if (strcmp(value, "power8") == 0) { > - *max_compat = CPU_POWERPC_LOGICAL_2_07; > - } else { > - error_setg(errp, "Invalid compatibility mode \"%s\"", value); > - } > - > - g_free(value); > + error_report("CPU 'compat' property is deprecated and has no effect; use max-cpu-compat machine property instead"); > + visit_type_null(v, name, errp); The string input and output visitors don't support explicit null yet. I have a tentative patch for that. Cheers. -- Greg > } > > -static PropertyInfo powerpc_compat_propinfo = { > +static PropertyInfo ppc_compat_deprecated_propinfo = { > .name = "str", > - .description = "compatibility mode, power6/power7/power8", > - .get = powerpc_get_compat, > - .set = powerpc_set_compat, > + .description = "compatibility mode (deprecated)", > + .get = getset_compat_deprecated, > + .set = getset_compat_deprecated, > }; > - > -#define DEFINE_PROP_POWERPC_COMPAT(_n, _s, _f) \ > - DEFINE_PROP(_n, _s, _f, powerpc_compat_propinfo, uint32_t) > - > static Property powerpc_servercpu_properties[] = { > - DEFINE_PROP_POWERPC_COMPAT("compat", PowerPCCPU, max_compat), > + { > + .name = "compat", > + .info = &ppc_compat_deprecated_propinfo, > + }, > DEFINE_PROP_END_OF_LIST(), > }; >