qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Sheng Yang <sheng@linux.intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [Qemu-devel] Re: [PATCH] qemu-kvm: Enable xsave related CPUID
Date: Wed, 19 May 2010 19:58:02 +0300	[thread overview]
Message-ID: <4BF4189A.4030000@redhat.com> (raw)
In-Reply-To: <1274258090-12247-2-git-send-email-sheng@linux.intel.com>

On 05/19/2010 11:34 AM, Sheng Yang wrote:
> Signed-off-by: Sheng Yang<sheng@linux.intel.com>
> ---
>   target-i386/cpuid.c |   32 ++++++++++++++++++++++++++++++++
>    

Can send to Anthony directly, while tcg doesn't support xsave/ymm, all 
the code here is generic.

>   1 files changed, 32 insertions(+), 0 deletions(-)
>
> diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
> index eebf038..21e94f3 100644
> --- a/target-i386/cpuid.c
> +++ b/target-i386/cpuid.c
> @@ -1067,6 +1067,38 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
>           *ecx = 0;
>           *edx = 0;
>           break;
> +    case 0xD:
> +        /* Processor Extended State */
> +        if (!(env->cpuid_ext_features&  CPUID_EXT_XSAVE)) {
> +            *eax = 0;
> +            *ebx = 0;
> +            *ecx = 0;
> +            *edx = 0;
> +            break;
> +        }
> +        if (count == 0) {
> +            *eax = 0x7;
> +            *ebx = 0x340;
> +            *ecx = 0x340;
> +            *edx = 0;
> +        } else if (count == 1) {
> +            /* eax = 1, so we can continue with others */
> +            *eax = 1;
> +            *ebx = 0;
> +            *ecx = 0;
> +            *edx = 0;
> +        } else if (count == 2) {
> +            *eax = 0x100;
> +            *ebx = 0x240;
> +            *ecx = 0;
> +            *edx = 0;
> +        } else {
> +            *eax = 0;
> +            *ebx = 0;
> +            *ecx = 0;
> +            *edx = 0;
> +        }
> +        break;
>    

Lots of magic numbers.  Symbolic constants or explanatory comments.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

  reply	other threads:[~2010-05-19 16:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19  8:34 [Qemu-devel] [PATCH v2] KVM: VMX: Enable XSAVE/XRSTORE for guest Sheng Yang
2010-05-19  8:34 ` [Qemu-devel] [PATCH] qemu-kvm: Enable xsave related CPUID Sheng Yang
2010-05-19 16:58   ` Avi Kivity [this message]
2010-05-19 16:56 ` [Qemu-devel] Re: [PATCH v2] KVM: VMX: Enable XSAVE/XRSTORE for guest 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=4BF4189A.4030000@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sheng@linux.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;
as well as URLs for NNTP newsgroup(s).