From: Marcelo Tosatti <mtosatti@redhat.com>
To: "Yang, Wei Y" <wei.y.yang@intel.com>
Cc: Avi Kivity <avi@redhat.com>, "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH v7 3/4] Mask function7 ebx against host capability word9
Date: Thu, 2 Jun 2011 22:27:05 -0300 [thread overview]
Message-ID: <20110603012705.GE5226@amt.cnet> (raw)
In-Reply-To: <5D8008F58939784290FAB48F5497519844E9278EFF@shsmsx502.ccr.corp.intel.com>
On Wed, Jun 01, 2011 at 09:07:51PM +0800, Yang, Wei Y wrote:
>
> This patch masks CPUID leaf 7 ebx against host capability word9.
>
> Signed-off-by: Yang, Wei <wei.y.yang@intel.com>
> Signed-off-by: Shan, Haitao <haitao.shan@intel.com>
> Signed-off-by: Li, Xin <xin.li@intel.com>
>
> ---
> arch/x86/kvm/x86.c | 21 ++++++++++++++++++++-
> 1 files changed, 20 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 91bfc40..d27202d 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2353,6 +2353,10 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
> F(ACE2) | F(ACE2_EN) | F(PHE) | F(PHE_EN) |
> F(PMM) | F(PMM_EN);
>
> + /* cpuid 7.0.ebx */
> + const u32 kvm_supported_word9_x86_features =
> + F(SMEP);
> +
> /* all calls to cpuid_count() should be made on the same cpu */
> get_cpu();
> do_cpuid_1_ent(entry, function, index);
> @@ -2387,7 +2391,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
> }
> break;
> }
> - /* function 4 and 0xb have additional index. */
> + /* function 4 has additional index. */
> case 4: {
> int i, cache_type;
>
> @@ -2404,6 +2408,21 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
> }
> break;
> }
> + case 7: {
> + entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
> + /* Mask ebx against host capbability word 9 */
> + if (index == 0) {
> + entry->ebx &= kvm_supported_word9_x86_features;
> + cpuid_mask(&entry->edx, 9);
ebx?
> + }
> + else
> + entry->ebx = 0;
indentation is wrong.
> + entry->eax = 0;
> + entry->ecx = 0;
> + entry->edx = 0;
> + break;
> + }
> + /* function 0xb has additional index. */
> case 0xb: {
> int i, level_type;
prev parent reply other threads:[~2011-06-03 1:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-01 13:07 [PATCH v7 3/4] Mask function7 ebx against host capability word9 Yang, Wei Y
2011-06-03 1:27 ` Marcelo Tosatti [this message]
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=20110603012705.GE5226@amt.cnet \
--to=mtosatti@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=wei.y.yang@intel.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