public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: Mask KVM_GET_SUPPORTED_CPUID data with Linux cpuid info
Date: Mon, 1 Nov 2010 13:58:17 -0200	[thread overview]
Message-ID: <20101101155817.GB1429@amt.cnet> (raw)
In-Reply-To: <1287927526-3234-3-git-send-email-avi@redhat.com>

On Sun, Oct 24, 2010 at 03:38:46PM +0200, Avi Kivity wrote:
> This allows Linux to mask cpuid bits if, for example, nx is enabled on only
> some cpus.
> 
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  arch/x86/kvm/x86.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 48ce015..54fda7e 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2229,6 +2229,11 @@ out:
>  	return r;
>  }
>  
> +static void cpuid_mask(u32 *word, int wordnum)
> +{
> +	*word &= boot_cpu_data.x86_capability[wordnum];
> +}
> +
>  static void do_cpuid_1_ent(struct kvm_cpuid_entry2 *entry, u32 function,
>  			   u32 index)
>  {
> @@ -2303,7 +2308,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
>  		break;
>  	case 1:
>  		entry->edx &= kvm_supported_word0_x86_features;
> +		cpuid_mask(&entry->edx, 0);
>  		entry->ecx &= kvm_supported_word4_x86_features;
> +		cpuid_mask(&entry->edx, 4);

ecx?

>  		/* we support x2apic emulation even if host does not support
>  		 * it since we emulate x2apic in software */
>  		entry->ecx |= F(X2APIC);
> @@ -2394,7 +2401,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
>  		break;
>  	case 0x80000001:
>  		entry->edx &= kvm_supported_word1_x86_features;
> +		cpuid_mask(&entry->edx, 1);
>  		entry->ecx &= kvm_supported_word6_x86_features;
> +		cpuid_mask(&entry->edx, 6);

ecx?


  reply	other threads:[~2010-11-01 17:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-24 13:38 [PATCH 0/2] Use host cpuid facilities Avi Kivity
2010-10-24 13:38 ` [PATCH 1/2] KVM: SVM: Replace svm_has() by standard Linux cpuid accessors Avi Kivity
2010-10-24 13:38 ` [PATCH 2/2] KVM: Mask KVM_GET_SUPPORTED_CPUID data with Linux cpuid info Avi Kivity
2010-11-01 15:58   ` Marcelo Tosatti [this message]
2010-11-09 14:08     ` Avi Kivity

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=20101101155817.GB1429@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    /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