All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: john cooper <john.cooper@redhat.com>
Cc: "Roedel, Joerg" <Joerg.Roedel@amd.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/7] cpu model bug fixes and definition corrections: Add kvm emulated x2apic flag to config defined cpu models
Date: Sat, 28 May 2011 10:39:13 +0200	[thread overview]
Message-ID: <4DE0B4B1.1000407@web.de> (raw)
In-Reply-To: <4DDAD5CF.5050805@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1861 bytes --]

On 2011-05-23 23:46, john cooper wrote:
> Add kvm emulated x2apic flag to config defined cpu models
> and general support for such hypervisor emulated flags.
> 
> In addition to checking user request flags against the host
> we also selectively check against kvm for emulated flags.

As you are already digging through this jungle, could you also check how
much of this diff from qemu-kvm is obsolete now?

diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index e479a4d..091d812 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -1175,6 +1175,31 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t
index, uint32_t count,
                 *ecx |= 1 << 1;    /* CmpLegacy bit */
             }
         }
+        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 */
+            if (!kvm_nested)
+                *ecx &= ~CPUID_EXT3_SVM;
+            /* 3dnow */
+            *edx &= ~0xc0000000;
+        }
         break;
     case 0x80000002:
     case 0x80000003:

If something is still missing in upstream, it should be ported - except
for kvm_nested which should be controllable via '-cpu ...,+/-svm'. TIA!

Jörg, how to deal with -enable-nesting in qemu-kvm to align behavior
with upstream?

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

  reply	other threads:[~2011-05-28  8:39 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 21:46 [Qemu-devel] [PATCH 3/7] cpu model bug fixes and definition corrections: Add kvm emulated x2apic flag to config defined cpu models john cooper
2011-05-28  8:39 ` Jan Kiszka [this message]
2011-05-30  8:18   ` Roedel, Joerg
2011-05-30 14:04     ` drop -enable-nesting (was: [PATCH 3/7] cpu model bug fixes and definition corrections...) Jan Kiszka
2011-05-30 14:04       ` [Qemu-devel] " Jan Kiszka
2011-05-30 14:38       ` Nadav Har'El
2011-05-30 14:38         ` [Qemu-devel] " Nadav Har'El
2011-05-30 15:04         ` drop -enable-nesting Jan Kiszka
2011-05-30 15:04           ` [Qemu-devel] " Jan Kiszka
2011-05-30 15:10           ` Roedel, Joerg
2011-05-30 15:10             ` [Qemu-devel] " Roedel, Joerg
2011-05-30 15:15             ` Jan Kiszka
2011-05-30 15:15               ` [Qemu-devel] " Jan Kiszka
2011-05-30 15:19               ` Avi Kivity
2011-05-30 15:19                 ` [Qemu-devel] " Avi Kivity
2011-05-30 15:27                 ` Jan Kiszka
2011-05-30 15:27                   ` [Qemu-devel] " Jan Kiszka
2011-05-30 15:42                   ` Jan Kiszka
2011-05-30 15:42                     ` [Qemu-devel] " Jan Kiszka
2011-05-31  8:44                 ` Daniel P. Berrange
2011-05-31  8:44                   ` [Qemu-devel] " Daniel P. Berrange
2011-05-31  8:58                   ` Avi Kivity
2011-05-31  8:58                     ` [Qemu-devel] " Avi Kivity
2011-05-31  9:06                     ` Roedel, Joerg
2011-05-31  9:06                       ` [Qemu-devel] " Roedel, Joerg
2011-05-31  9:15                     ` Paolo Bonzini
2011-05-31  9:15                       ` [Qemu-devel] " Paolo Bonzini
2011-05-31  9:16                       ` Avi Kivity
2011-05-31  9:16                         ` [Qemu-devel] " Avi Kivity
2011-05-30 15:16           ` Nadav Har'El
2011-05-30 15:16             ` [Qemu-devel] " Nadav Har'El
2011-05-30 15:59             ` Jan Kiszka
2011-05-30 15:59               ` [Qemu-devel] " Jan Kiszka

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=4DE0B4B1.1000407@web.de \
    --to=jan.kiszka@web.de \
    --cc=Joerg.Roedel@amd.com \
    --cc=aliguori@us.ibm.com \
    --cc=john.cooper@redhat.com \
    --cc=qemu-devel@nongnu.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.