From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vfraf-0002kE-8f for qemu-devel@nongnu.org; Mon, 11 Nov 2013 08:31:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VfraX-0005N9-HI for qemu-devel@nongnu.org; Mon, 11 Nov 2013 08:31:41 -0500 Message-ID: <5280DC32.9030606@suse.de> Date: Mon, 11 Nov 2013 14:31:30 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1384155875-26999-1-git-send-email-aik@ozlabs.ru> <1384155875-26999-7-git-send-email-aik@ozlabs.ru> In-Reply-To: <1384155875-26999-7-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 6/6] target-ppc: demonstrate new "vsx" property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy , qemu-devel@nongnu.org Cc: Igor Mammedov , qemu-ppc@nongnu.org, Alexander Graf Am 11.11.2013 08:44, schrieb Alexey Kardashevskiy: > This patch is to demonstrate a static property handling in PowerPC. > Running QEMU with -cpu host,-vsx disables VSX bit in > PowerPCCPU::env::flags. >=20 > Signed-off-by: Alexey Kardashevskiy > --- > target-ppc/translate_init.c | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c > index df0d81c..60ea235 100644 > --- a/target-ppc/translate_init.c > +++ b/target-ppc/translate_init.c > @@ -29,6 +29,7 @@ > #include "mmu-hash64.h" > #include "qemu/error-report.h" > #include "qapi/visitor.h" > +#include "hw/qdev-properties.h" > =20 > //#define PPC_DUMP_CPU > //#define PPC_DEBUG_SPR > @@ -8740,6 +8741,12 @@ static void ppc_cpu_class_init(ObjectClass *oc, = void *data) > =20 > dc->fw_name =3D "PowerPC,UNKNOWN"; > cc->parse_options =3D cpu_default_parse_options_func; > + > + static Property powerpc_properties[] =3D { > + DEFINE_PROP_BIT("vsx", PowerPCCPU, env.flags, BITNR(POWERPC_FL= AG_VSX), false), > + DEFINE_PROP_END_OF_LIST(), > + }; > + dc->props =3D powerpc_properties; > } > =20 > static const TypeInfo ppc_cpu_type_info =3D { This type of static property looks good to me, but two problems apart from the BITNR() discussed elsewhere: 1) Won't the default value of false always disable VSX for all models including POWER7 and higher? 2) Please move the array out of the function to just before the containing function. Igor has been facing a similar issue in his refactoring of x86 models and I believe evaluated to define the properties per model so that they have different defaults. Another way is overwriting that default in the model's instance_init or via globals specific to the subtype. Regards, 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