]> Git Repo - qemu.git/commitdiff
kvm: work around supported cpuid ioctl() brokenness
authorMark McLoughlin <[email protected]>
Tue, 19 May 2009 17:55:21 +0000 (18:55 +0100)
committerAnthony Liguori <[email protected]>
Wed, 20 May 2009 14:12:57 +0000 (09:12 -0500)
KVM_GET_SUPPORTED_CPUID has been known to fail to return -E2BIG
when it runs out of entries. Detect this by always trying again
with a bigger table if the ioctl() fills the table.

Signed-off-by: Mark McLoughlin <[email protected]>
target-i386/kvm.c

index fe67eed0a21f4484f81227e186513056e299c94c..7cdcf31cabba8c41d26f77169f732609cd248106 100644 (file)
@@ -45,6 +45,9 @@ static struct kvm_cpuid2 *try_get_cpuid(KVMState *s, int max)
     cpuid = (struct kvm_cpuid2 *)qemu_mallocz(size);
     cpuid->nent = max;
     r = kvm_ioctl(s, KVM_GET_SUPPORTED_CPUID, cpuid);
+    if (r == 0 && cpuid->nent >= max) {
+        r = -E2BIG;
+    }
     if (r < 0) {
         if (r == -E2BIG) {
             qemu_free(cpuid);
This page took 0.022544 seconds and 4 git commands to generate.