From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYHQY-0002m8-IA for qemu-devel@nongnu.org; Fri, 03 May 2013 10:57:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UYHQW-0002Yd-W5 for qemu-devel@nongnu.org; Fri, 03 May 2013 10:57:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYHQW-0002YY-OS for qemu-devel@nongnu.org; Fri, 03 May 2013 10:57:36 -0400 Message-ID: <5183D05E.7020603@redhat.com> Date: Fri, 03 May 2013 08:57:34 -0600 From: Eric Blake MIME-Version: 1.0 References: <1366657220-776-1-git-send-email-ehabkost@redhat.com> <1366657220-776-7-git-send-email-ehabkost@redhat.com> In-Reply-To: <1366657220-776-7-git-send-email-ehabkost@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2IFJIDHVNWCUVLUUFKHAV" Subject: Re: [Qemu-devel] [PATCH qom-cpu 6/9] target-i386: Add "feature-words" property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: libvir-list@redhat.com, Igor Mammedov , Jiri Denemark , qemu-devel@nongnu.org, =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2IFJIDHVNWCUVLUUFKHAV Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 04/22/2013 01:00 PM, Eduardo Habkost wrote: > This property will be useful for libvirt, as libvirt already has logic > based on low-level feature bits (not feature names), so it will be > really easy to convert the current libvirt logic to something using the= > "feature-words" property. >=20 > The property will have two main use cases: > - Checking host capabilities, by checking the features of the "host" > CPU model > - Checking which features are enabled on each CPU model >=20 > item[6].cpuid-register: ECX > item[6].cpuid-input-eax: 1 > item[6].features: 2155880449 > item[7].cpuid-register: EDX > item[7].cpuid-input-eax: 1 > item[7].features: 126614521 I'm guessing the corresponding JSON passed over QMP would look something like: [ ... { "cpuid-register": "ECX", "cpuid-input-eax": 1, "features": 2155880449 }, { "cpuid-register": "EDX", "cpuid-input-eax": 1, "features": 126614521 } ] which libvirt can reasonably parse. >=20 > Signed-off-by: Eduardo Habkost > --- > Changes v1 -> v2: > * Merge the non-qapi and qapi patches, to keep series simpler > * Use the feature word array series as base, so we don't have > to set the feature word values one-by-one in the code > * Change type name of property from "x86-cpu-feature-words" to > "X86CPUFeatureWordInfo" > * Remove cpu-qapi-schema.json and simply add the type definitions > to qapi-schema.json, to keep the changes simpler > * This required compiling qapi-types.o and qapi-visit.o into > *-user as well > --- > .gitignore | 2 ++ > Makefile.objs | 7 +++++- > qapi-schema.json | 31 ++++++++++++++++++++++++ > target-i386/cpu.c | 70 +++++++++++++++++++++++++++++++++++++++++++++--= -------- > 4 files changed, 97 insertions(+), 13 deletions(-) I'm not sure I'm the best person to review cpu.c, but I can at least review the interface from what libvirt plans on using: > +++ b/qapi-schema.json > @@ -3505,3 +3505,34 @@ > '*asl_compiler_rev': 'uint32', > '*file': 'str', > '*data': 'str' }} > + > +# @X86CPURegister32 > +# > +# A X86 32-bit register > +# > +# Since: 1.5 Yes, I'd still like to get this into 1.5. On some enums, we have called out doc-text for each enum value; but I'm fine with your choice here to omit that. > +## > +{ 'enum': 'X86CPURegister32', > + 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }= Any reason you favored ALL-CAPS names? But it doesn't matter to me, as long as we stick to the name once baked into a release. > + > +## > +# @X86CPUFeatureWordInfo > +# > +# Information about a X86 CPU feature word > +# > +# @cpuid-input-eax: Input EAX value for CPUID instruction for that fea= ture word > +# > +# @cpuid-input-ecx: #optional Input ECX value for CPUID instruction fo= r that > +# feature word > +# > +# @cpuid-register: Output register containing the feature bits > +# > +# @features: value of output register, containing the feature bits > +# > +# Since: 1.5 > +## > +{ 'type': 'X86CPUFeatureWordInfo', > + 'data': { 'cpuid-input-eax': 'int', > + '*cpuid-input-ecx': 'int', > + 'cpuid-register': 'X86CPURegister32', > + 'features': 'int' } } Looks reasonable for the interface side of things. > =20 > +static void x86_cpu_get_feature_words(Object *obj, Visitor *v, void *o= paque, > + const char *name, Error **errp) Indentation looks off. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2IFJIDHVNWCUVLUUFKHAV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRg9BeAAoJEKeha0olJ0NqjIUH/2qkH4GvCeELYzm7wQQtx/F7 Z0j5bplLLUcVR7jhMIA/2R6uFhCOImzp0/F0cXvwudgCsIKSXrqQCO8K5dhVtI/G cJiHRhB42VNfosbFsi1kOyoqNRuJqpjXhnpI8+h656/TkVflV3gdqTfxLsLqicsk Z77el5KPJtcmW6RzI3brhuze2cN215qb253gg23m08GXMgZU71QgOTMh8KoWDkHU pfg53cEDvhulh/m5UtZ+pq7hZbblZCfBEEnplfW54QPWjQVAzX8i5FzdZ6crPvhy PicuPp3avVMMD7dA7vn+Ubo8y5SKLSO2H1stlxdcX/2VtWwmWIGFI4okOAAHhdI= =8Blp -----END PGP SIGNATURE----- ------enig2IFJIDHVNWCUVLUUFKHAV--