public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Muli Ben-Yehuda <muli@il.ibm.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: avi@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Store multiple cpuid entries for a single function
Date: Mon, 12 Jan 2009 22:39:31 +0200	[thread overview]
Message-ID: <20090112203931.GC13839@il.ibm.com> (raw)
In-Reply-To: <1231757365-15717-3-git-send-email-amit.shah@redhat.com>

On Mon, Jan 12, 2009 at 10:49:25AM +0000, Amit Shah wrote:
> CPUID functions 4, 0xb and 0xd behave differently for different values of ECX.
> Store these values if userspace passes them.
> 
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> ---
>  arch/x86/kvm/x86.c |   18 +++++++++++++++---
>  1 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 06b44fb..8dc4b29 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1126,7 +1126,7 @@ static int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu,
>  				    struct kvm_cpuid *cpuid,
>  				    struct kvm_cpuid_entry __user *entries)
>  {
> -	int r, i;
> +	int r, i, count;
>  	struct kvm_cpuid_entry *cpuid_entries;
>  
>  	r = -E2BIG;
> @@ -1146,8 +1146,20 @@ static int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu,
>  		vcpu->arch.cpuid_entries[i].ebx = cpuid_entries[i].ebx;
>  		vcpu->arch.cpuid_entries[i].ecx = cpuid_entries[i].ecx;
>  		vcpu->arch.cpuid_entries[i].edx = cpuid_entries[i].edx;
> -		vcpu->arch.cpuid_entries[i].index = 0;
> -		vcpu->arch.cpuid_entries[i].flags = 0;
> +		switch (cpuid_entries[i].function) {
> +		case 4:
> +		case 0xb:
> +		case 0xd:
> +			vcpu->arch.cpuid_entries[i].index = count++;

Isn't this using count uninitialized?

Cheers,
Muli
-- 
SYSTOR 2009---The Israeli Experimental Systems Conference
May 4-6, 2009, Haifa, Israel
http://www.haifa.il.ibm.com/conferences/systor2009/

  reply	other threads:[~2009-01-12 20:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-12 10:49 CPUID handling: cleanups and support for storing subleaf values Amit Shah
2009-01-12 10:49 ` [PATCH] KVM: x86: Fix typos and whitespace errors Amit Shah
2009-01-12 10:49   ` [PATCH] KVM: x86: Store multiple cpuid entries for a single function Amit Shah
2009-01-12 20:39     ` Muli Ben-Yehuda [this message]
2009-01-13  5:23       ` Amit Shah
2009-01-13  9:27     ` Avi Kivity
2009-01-13  9:40       ` Amit Shah
2009-01-13  9:45         ` Avi Kivity
2009-01-13  9:58           ` Amit Shah

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=20090112203931.GC13839@il.ibm.com \
    --to=muli@il.ibm.com \
    --cc=amit.shah@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