All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Andre Przywara <andre.przywara@amd.com>
Cc: avi@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] qemu-kvm: remove CPUID host hacks
Date: Wed, 1 Jul 2009 09:42:54 +0200	[thread overview]
Message-ID: <6D744C96-C9A2-4430-951A-AB90154F13F3@suse.de> (raw)
In-Reply-To: <1246432947-8693-1-git-send-email-andre.przywara@amd.com>


On 01.07.2009, at 09:22, Andre Przywara wrote:

> KVM provides an in-kernel feature to disable CPUID bits that are not
> present in the current host. So there is no need here to duplicate  
> this
> work. Additionally allows 3DNow! on capable processors, since the
> restriction seems to apply to QEMU/TCG only.
>
> Signed-off-by: Andre Przywara <andre.przywara@amd.com>
> ---
> target-i386/helper.c |   22 +---------------------
> 1 files changed, 1 insertions(+), 21 deletions(-)
>
> This is a rebased version of the qemu.git patch, which caused merge  
> conflicts.
> Please apply!
>
> Regards,
> Andre.
>
> diff --git a/target-i386/helper.c b/target-i386/helper.c
> index d76c224..30e1d77 100644
> --- a/target-i386/helper.c
> +++ b/target-i386/helper.c
> @@ -1645,29 +1645,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t  
> index, uint32_t count,
>         *edx = env->cpuid_ext2_features;
>
>         if (kvm_enabled()) {
> -            uint32_t h_eax, h_edx;
> -
> -            host_cpuid(index, 0, &h_eax, NULL, NULL, &h_edx);
> -
> -            /* disable CPU features that the host does not support */
> -
> -            /* long mode */
> -            if ((h_edx & 0x20000000) == 0 /* || !lm_capable_kernel  
> */)
> -                *edx &= ~0x20000000;
> -            /* syscall */
> -            if ((h_edx & 0x00000800) == 0)
> -                *edx &= ~0x00000800;
> -            /* nx */
> -            if ((h_edx & 0x00100000) == 0)
> -                *edx &= ~0x00100000;
> -
> -            /* disable CPU features that KVM cannot support */
> -
> -            /* svm */
> +            /* disable nested svm if not explicitly requested */
>             if (!kvm_nested)
>                 *ecx &= ~CPUID_EXT3_SVM;
> -            /* 3dnow */
> -            *edx &= ~0xc0000000;

I don't know why this is in, but it's definitely in a kvm_enabled() if  
statement, so it's not because of TCG :-).
Also kvm_nested should control the svm bit in the qemu description  
already. Preferably before the +/-feature bits are interpreted.

... this would lead to total removal of that hack function :-).

Alex


      reply	other threads:[~2009-07-01  7:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-01  7:22 [PATCH] qemu-kvm: remove CPUID host hacks Andre Przywara
2009-07-01  7:42 ` Alexander Graf [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=6D744C96-C9A2-4430-951A-AB90154F13F3@suse.de \
    --to=agraf@suse.de \
    --cc=andre.przywara@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.