Re: [PATCH] qemu-kvm: Ask kernel about supported svm features

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

 



On 04/22/2010 03:02 PM, Joerg Roedel wrote:

Signed-off-by: Joerg Roedel<joerg.roedel@xxxxxxx>
---
  qemu-kvm-x86.c |   14 ++++++++++++--
  1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 748ff69..6eccd69 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -1327,8 +1327,18 @@ int kvm_arch_init_vcpu(CPUState *cenv)
      qemu_kvm_cpuid_on_env(&copy);
      limit = copy.regs[R_EAX];

-    for (i = 0x80000000; i<= limit; ++i)
-	do_cpuid_ent(&cpuid_ent[cpuid_nent++], i, 0,&copy);
+    for (i = 0x80000000; i<= limit; ++i) {
+        do_cpuid_ent(&cpuid_ent[cpuid_nent], i, 0,&copy);
+        switch (i) {
+            case 0x8000000a:
+                cpuid_ent[cpuid_nent].eax = kvm_arch_get_supported_cpuid(cenv, 0x8000000a, R_EAX);
+                cpuid_ent[cpuid_nent].ebx = kvm_arch_get_supported_cpuid(cenv, 0x8000000a, R_EBX);
+                cpuid_ent[cpuid_nent].ebx = kvm_arch_get_supported_cpuid(cenv, 0x8000000a, R_EBX);
+                cpuid_ent[cpuid_nent].edx = kvm_arch_get_supported_cpuid(cenv, 0x8000000a, R_EDX);
+                break;
+        }
+        cpuid_nent += 1;
+    }
I don't understand why this is different compared to all other cpuid bits.
Because for the SVM features we report to the guest we need to ask the
kernel which of them are supported.

That's true for all cpuid features.

We can't just take the host-cpuid
because most of the additional svm features need special emulation in
the kernel. Or do you think this should better be handled in
target-i386/cpuid.c?

Yes. -cpu host should take KVM_GET_SUPPORTED_CPUID output and loop it back to the vcpu configuration, others just take the qemu configuration, mask it with supported bits, and pass it back (see check_features_against_host()).

(need feature names for the bits, too, so you can enable or disable them from the command line)

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux