qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/7] cpu model bug fixes and definition correcti


From: Jan Kiszka
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
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

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: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]