]> xenbits.xensource.com Git - libvirt.git/commitdiff
cpu_x86: Add support for passing guest CPUs to virCPUx86Baseline
authorJiri Denemark <jdenemar@redhat.com>
Tue, 15 May 2018 09:27:20 +0000 (11:27 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 28 May 2018 13:59:10 +0000 (15:59 +0200)
Modern host CPU models from domain capabilities XMLs are reported as
guest CPU definitions with feature policies. This patch updates
virCPUx86Baseline to properly handle such CPU models.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/cpu/cpu_x86.c

index 188d1eba75b8bc12afd3131e1f88a89dfc236eb6..6bef4089e914f13f4c05852318f9d33813af5a38 100644 (file)
@@ -2482,13 +2482,12 @@ virCPUx86Baseline(virCPUDefPtr *cpus,
     if (!(map = virCPUx86GetMap()))
         goto error;
 
-    if (!(base_model = x86ModelFromCPU(cpus[0], map, VIR_CPU_FEATURE_REQUIRE)))
+    if (!(base_model = x86ModelFromCPU(cpus[0], map, -1)))
         goto error;
 
     if (VIR_ALLOC(cpu) < 0)
         goto error;
 
-    cpu->arch = cpus[0]->arch;
     cpu->type = VIR_CPU_TYPE_GUEST;
     cpu->match = VIR_CPU_MATCH_EXACT;
 
@@ -2513,7 +2512,7 @@ virCPUx86Baseline(virCPUDefPtr *cpus,
             }
         }
 
-        if (!(model = x86ModelFromCPU(cpus[i], map, VIR_CPU_FEATURE_REQUIRE)))
+        if (!(model = x86ModelFromCPU(cpus[i], map, -1)))
             goto error;
 
         if (cpus[i]->vendor && model->vendor &&
@@ -2570,8 +2569,6 @@ virCPUx86Baseline(virCPUDefPtr *cpus,
     if (!outputVendor)
         VIR_FREE(cpu->vendor);
 
-    cpu->arch = VIR_ARCH_NONE;
-
  cleanup:
     x86ModelFree(base_model);