From: Robert Hoo <robert.hu@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: robert.hu@intel.com, robert.hu@linux.intel.com, rth@twiddle.net,
ehabkost@redhat.com, thomas.lendacky@amd.com,
qemu-devel@nongnu.org, jingqi.liu@intel.com
Subject: Re: [Qemu-devel] [PATCH v3 3/3] Change other funcitons referring to feature_word_info[]
Date: Wed, 05 Sep 2018 13:47:55 +0800 [thread overview]
Message-ID: <1536126475.15675.1.camel@linux.intel.com> (raw)
In-Reply-To: <9e06fe89-2688-1e6e-16ec-d5e8cdc87ce4@redhat.com>
On Fri, 2018-08-17 at 17:52 +0200, Paolo Bonzini wrote:
> On 10/08/2018 16:06, Robert Hoo wrote:
> > x86_cpu_get_feature_words(): limit to CPUID_FEATURE_WORD only.
>
> This should also grow support for MSR feature words.
>
> My suggestion is that you add another patch after patch 1 that expands
> the definition of X86CPUFeatureWordInfo like this, and adjusts
> x86_cpu_get_feature_words() to match the new C structs. Then this
> patch can add MSR feature support somewhat easily.
>
> The QAPI definitions would then look like this:
>
> diff --git a/qapi/misc.json b/qapi/misc.json
> index d450cfef21..eae9243976 100644
> --- a/qapi/misc.json
> +++ b/qapi/misc.json
> @@ -2663,9 +2663,9 @@
> 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }
>
> ##
> -# @X86CPUFeatureWordInfo:
> +# @X86CPUIDFeatureWordInfo:
> #
> -# Information about a X86 CPU feature word
> +# Information about an X86 CPUID feature word
> #
> # @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word
> #
> @@ -2678,12 +2690,45 @@
> #
> # Since: 1.5
> ##
> -{ 'struct': 'X86CPUFeatureWordInfo',
> +{ 'struct': 'X86CPUIDFeatureWordInfo',
> 'data': { 'cpuid-input-eax': 'int',
> '*cpuid-input-ecx': 'int',
> 'cpuid-register': 'X86CPURegister32',
> 'features': 'int' } }
>
> +##
> +# @X86MSRFeatureWordInfo:
> +#
> +# Information about an X86 MSR feature word
> +#
> +# @index: Index of the model specific register
> +#
> +# @cpuid-feature: CPUID feature name that communicates the existance of the MSR
> +#
> +# @features: value of output register, containing the feature bits
> +#
> +# Since: 3.1
> +##
> +{ 'struct': 'X86MSRFeatureWordInfo',
> + 'data': { 'index': 'int',
> + 'cpuid-feature': 'str',
> + 'features': 'int' } }
> +
> +##
> +# @X86CPUFeatureWordInfo:
> +#
> +# A discriminated record of X86 CPU feature words
> +#
> +# Since: 3.1
> +##
> +
> +{ 'union': 'X86CPUFeatureWordInfo',
> + 'base': { 'type': 'X86CPUFeatureWordType' },
> + 'discriminator': 'type',
> + 'data': {
> + 'cpuid': 'X86CPUIDFeatureWordInfo',
> + 'msr': 'X86MSRFeatureWordInfo' }}
> +
> ##
> # @DummyForceArrays:
> #
[root@robert-ivt qemu]# git diff qapi/misc.json
diff --git a/qapi/misc.json b/qapi/misc.json
index d450cfe..7351dc2 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -2663,25 +2663,25 @@
'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }
##
-# @X86CPUFeatureWordInfo:
+# @X86CPUIDFeatureWordInfo:
#
-# Information about a X86 CPU feature word
+# Information about a X86 CPUID feature word
#
-# @cpuid-input-eax: Input EAX value for CPUID instruction for that
feature word
+# @input-eax: Input EAX value for CPUID instruction for that feature
word
#
-# @cpuid-input-ecx: Input ECX value for CPUID instruction for that
+# @input-ecx: Input ECX value for CPUID instruction for that
# feature word
#
-# @cpuid-register: Output register containing the feature bits
+# @register: Output register containing the feature bits
#
# @features: value of output register, containing the feature bits
#
# Since: 1.5
##
-{ 'struct': 'X86CPUFeatureWordInfo',
- 'data': { 'cpuid-input-eax': 'int',
- '*cpuid-input-ecx': 'int',
- 'cpuid-register': 'X86CPURegister32',
+{ 'struct': 'X86CPUIDFeatureWordInfo',
+ 'data': { 'input-eax': 'int',
+ '*input-ecx': 'int',
+ 'register': 'X86CPURegister32',
'features': 'int' } }
##
@@ -2694,6 +2694,50 @@
{ 'struct': 'DummyForceArrays',
'data': { 'unused': ['X86CPUFeatureWordInfo'] } }
+##
+# @X86MSRFeatureWordInfo:
+#
+# Information about an X86 MSR feature word
+#
+# @index: Index of the model specific register
+#
+# @cpuid-feature: CPUID feature name that communicates the existance of
the MSR
+#
+# @features: value of output register, containing the feature bits
+#
+# Since: 3.1
+##
+{ 'struct': 'X86MSRFeatureWordInfo',
+ 'data': { 'index': 'int',
+ 'cpuid-feature': 'str',
+ 'features': 'int' } }
+
+##
+# @X86CPUFeatureWordType:
+#
+# Kinds of X86 CPU feature words
+#
+# @cpuid: A CPUID leaf
+#
+# @msr: An MSR
+##
+{ 'enum': 'X86CPUFeatureWordType',
+ 'data': [ 'cpuid', 'msr' ] }
+
+##
+# @X86CPUFeatureWordInfo:
+#
+# A discriminated record of X86 CPU feature words
+#
+# Since: 3.1
+##
+{ 'union': 'X86CPUFeatureWordInfo',
+ 'base': { 'type': 'X86CPUFeatureWordType' },
+ 'discriminator': 'type',
+ 'data': {
+ 'cpuid': 'X86CPUIDFeatureWordInfo',
+ 'msr': 'X86MSRFeatureWordInfo' }}
+
##
# @NumaOptionsType:
Hi Paolo,
above is my draft change on the qapi json file. 1 question:
struct X86MSRFeatureWordInfo {
int64_t index;
char *cpuid_feature;
int64_t features;
};
how to have a "const" prefix the "char *"?
>
> I'm not sure if the cpuid-feature field is useful for libvirt and
> other management applications. Eduardo, what do you think?
>
> Thanks,
>
> Paolo
next prev parent reply other threads:[~2018-09-05 5:50 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-10 14:06 [Qemu-devel] [PATCH v3 0/3] x86: QEMU side support on MSR based features Robert Hoo
2018-08-10 14:06 ` [Qemu-devel] [PATCH v3 1/3] x86: Data structure changes to support " Robert Hoo
2018-08-17 3:10 ` Eduardo Habkost
2018-08-18 3:10 ` Robert Hoo
2018-08-18 5:48 ` Robert Hoo
2018-08-18 7:50 ` Paolo Bonzini
2018-08-17 15:50 ` Paolo Bonzini
2018-08-17 15:55 ` Eduardo Habkost
2018-08-17 17:34 ` Paolo Bonzini
2018-08-17 17:48 ` [Qemu-devel] X86CPU "feature-words" property on QEMU (was Re: [PATCH v3 1/3] x86: Data structure changes to support MSR based) features Eduardo Habkost
2018-08-17 17:59 ` Paolo Bonzini
2018-08-17 18:10 ` Eduardo Habkost
2018-08-10 14:06 ` [Qemu-devel] [PATCH v3 2/3] kvm: Add support to KVM_GET_MSR_FEATURE_INDEX_LIST and KVM_GET_MSRS system ioctl Robert Hoo
2018-08-17 13:18 ` Eduardo Habkost
2018-08-18 7:27 ` Robert Hoo
2018-08-18 15:05 ` Eduardo Habkost
2018-08-23 6:28 ` Robert Hoo
2018-08-23 17:11 ` Eduardo Habkost
2018-08-23 17:28 ` Paolo Bonzini
2018-08-23 17:36 ` Eduardo Habkost
2018-08-23 20:23 ` Paolo Bonzini
2018-08-25 17:27 ` Eduardo Habkost
2018-08-30 4:22 ` Robert Hoo
2018-08-30 18:28 ` Eduardo Habkost
2018-08-10 14:06 ` [Qemu-devel] [PATCH v3 3/3] Change other funcitons referring to feature_word_info[] Robert Hoo
2018-08-10 15:17 ` Eric Blake
2018-08-14 10:06 ` Robert Hoo
2018-08-17 13:28 ` Eduardo Habkost
2018-08-18 9:01 ` Robert Hoo
2018-08-18 15:10 ` Eduardo Habkost
2018-08-17 15:52 ` Paolo Bonzini
2018-08-18 12:53 ` Robert Hoo
2018-09-05 5:47 ` Robert Hoo [this message]
2018-09-05 14:10 ` Eduardo Habkost
2018-09-05 15:32 ` Eric Blake
2018-09-05 16:44 ` Eduardo Habkost
2018-09-05 17:41 ` Eric Blake
2018-09-06 6:00 ` Hu, Robert
2018-09-10 17:38 ` Eduardo Habkost
2018-09-11 1:44 ` Robert Hoo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1536126475.15675.1.camel@linux.intel.com \
--to=robert.hu@linux.intel.com \
--cc=ehabkost@redhat.com \
--cc=jingqi.liu@intel.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=robert.hu@intel.com \
--cc=rth@twiddle.net \
--cc=thomas.lendacky@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).