]> xenbits.xensource.com Git - libvirt.git/commitdiff
Take disabled/forced CPU features into account
authorJiri Denemark <jdenemar@redhat.com>
Tue, 12 Jan 2010 14:25:50 +0000 (15:25 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 19 Jan 2010 11:29:29 +0000 (12:29 +0100)
When comparing x86 CPUs, features with 'disabled' policy were mistakenly
required to be supported by the host CPU.

Likewise, features with 'force' policy which were supported by host CPU
would make CPUs incompatible if 'strict' match was used by guest CPU.

This patch fixes both issues.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/cpu/cpu_x86.c

index 51f5d5434694a7f05177eeac1fae21174e8978a7..42fdf49db492d1e6b4545f7e7c3e7f944ccb1a1f 100644 (file)
@@ -829,11 +829,14 @@ x86Compute(virCPUDefPtr host,
     if (!(cpu_forbid = x86ModelFromCPU(cpu, map, VIR_CPU_FEATURE_FORBID)))
         goto error;
 
+    x86ModelSubtract(cpu_require, cpu_disable);
+
     if ((diff = x86ModelCopy(host_model)) == NULL)
         goto no_memory;
 
     x86ModelSubtract(diff, cpu_require);
     x86ModelSubtract(diff, cpu_optional);
+    x86ModelSubtract(diff, cpu_force);
 
     for (i = 0; i < cpu_forbid->ncpuid; i++) {
         const struct cpuX86cpuid *cpuid1;