]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
cpu: Rework cpuUpdate
authorJiri Denemark <jdenemar@redhat.com>
Thu, 23 Jun 2016 13:27:07 +0000 (15:27 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 22 Sep 2016 13:40:09 +0000 (15:40 +0200)
The reworked API is now called virCPUUpdate and it should change the
provided CPU definition into a one which can be consumed by the QEMU
command line builder:

    - host-passthrough remains unchanged
    - host-model is turned into custom CPU with a model and features
      copied from host
    - custom CPU with minimum match is converted similarly to host-model
    - optional features are updated according to host's CPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
19 files changed:
po/POTFILES.in
src/cpu/cpu.c
src/cpu/cpu.h
src/cpu/cpu_arm.c
src/cpu/cpu_ppc64.c
src/cpu/cpu_x86.c
src/libvirt_private.syms
src/qemu/qemu_command.c
src/qemu/qemu_domain.c
src/qemu/qemu_process.c
tests/cputest.c
tests/cputestdata/x86-host+host-model-nofallback.xml
tests/cputestdata/x86-host+host-model.xml
tests/cputestdata/x86-host+host-passthrough-features.xml [new file with mode: 0644]
tests/cputestdata/x86-host+host-passthrough.xml
tests/cputestdata/x86-host+min.xml
tests/cputestdata/x86-host+pentium3.xml
tests/cputestdata/x86-host-invtsc+host-model.xml
tests/cputestdata/x86-host-passthrough-features.xml [new file with mode: 0644]

index 25dbc842d866c607c8da4efefd23a83925ae5c60..14692402216a4039729bf7855dbd520864e0e3a8 100644 (file)
@@ -43,6 +43,7 @@ src/conf/virchrdev.c
 src/conf/virdomainobjlist.c
 src/conf/virsecretobj.c
 src/cpu/cpu.c
+src/cpu/cpu_arm.c
 src/cpu/cpu_map.c
 src/cpu/cpu_ppc64.c
 src/cpu/cpu_x86.c
index fae3885ef5abc897d5a183415c7749b63eb11495..e6f6335ff5ab6b0fc54f9c75515b8723d68a21e3 100644 (file)
@@ -579,38 +579,71 @@ cpuBaseline(virCPUDefPtr *cpus,
 
 
 /**
- * cpuUpdate:
+ * virCPUUpdate:
  *
- * @guest: guest CPU definition
+ * @arch: CPU architecture
+ * @guest: guest CPU definition to be updated
  * @host: host CPU definition
  *
  * Updates @guest CPU definition according to @host CPU. This is required to
- * support guest CPU definition which are relative to host CPU, such as CPUs
- * with VIR_CPU_MODE_CUSTOM and optional features or VIR_CPU_MATCH_MINIMUM, or
- * CPUs with non-custom mode (VIR_CPU_MODE_HOST_MODEL,
- * VIR_CPU_MODE_HOST_PASSTHROUGH).
+ * support guest CPU definitions specified relatively to host CPU, such as
+ * CPUs with VIR_CPU_MODE_CUSTOM and optional features or
+ * VIR_CPU_MATCH_MINIMUM, or CPUs with VIR_CPU_MODE_HOST_MODEL.
+ * When the guest CPU was not specified relatively, the function does nothing
+ * and returns success.
  *
  * Returns 0 on success, -1 on error.
  */
 int
-cpuUpdate(virCPUDefPtr guest,
-          const virCPUDef *host)
+virCPUUpdate(virArch arch,
+             virCPUDefPtr guest,
+             const virCPUDef *host)
 {
     struct cpuArchDriver *driver;
 
-    VIR_DEBUG("guest=%p, host=%p", guest, host);
+    VIR_DEBUG("arch=%s, guest=%p mode=%s model=%s, host=%p model=%s",
+              virArchToString(arch), guest, virCPUModeTypeToString(guest->mode),
+              NULLSTR(guest->model), host, NULLSTR(host ? host->model : NULL));
 
-    if ((driver = cpuGetSubDriver(host->arch)) == NULL)
+    if (!(driver = cpuGetSubDriver(arch)))
         return -1;
 
-    if (driver->update == NULL) {
+    if (guest->mode == VIR_CPU_MODE_HOST_PASSTHROUGH)
+        return 0;
+
+    if (guest->mode == VIR_CPU_MODE_CUSTOM &&
+        guest->match != VIR_CPU_MATCH_MINIMUM) {
+        size_t i;
+        bool optional = false;
+
+        for (i = 0; i < guest->nfeatures; i++) {
+            if (guest->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) {
+                optional = true;
+                break;
+            }
+        }
+
+        if (!optional)
+            return 0;
+    }
+
+    /* We get here if guest CPU is either
+     *  - host-model
+     *  - custom with minimum match
+     *  - custom with optional features
+     */
+    if (!driver->update) {
         virReportError(VIR_ERR_NO_SUPPORT,
-                       _("cannot update guest CPU data for %s architecture"),
-                       virArchToString(host->arch));
+                       _("cannot update guest CPU for %s architecture"),
+                       virArchToString(arch));
         return -1;
     }
 
-    return driver->update(guest, host);
+    if (driver->update(guest, host) < 0)
+        return -1;
+
+    VIR_DEBUG("model=%s", NULLSTR(guest->model));
+    return 0;
 }
 
 
index 422818ec49e696569d118907028aab79f68c9111..dac76881267000b3abed9d7647bca631676f8d18 100644 (file)
@@ -87,8 +87,8 @@ typedef virCPUDefPtr
                      unsigned int flags);
 
 typedef int
-(*cpuArchUpdate)    (virCPUDefPtr guest,
-                     const virCPUDef *host);
+(*virCPUArchUpdate)(virCPUDefPtr guest,
+                    const virCPUDef *host);
 
 typedef int
 (*cpuArchHasFeature) (const virCPUData *data,
@@ -114,7 +114,7 @@ struct cpuArchDriver {
     cpuArchNodeData     nodeData;
     cpuArchGuestData    guestData;
     cpuArchBaseline     baseline;
-    cpuArchUpdate       update;
+    virCPUArchUpdate    update;
     cpuArchHasFeature    hasFeature;
     cpuArchDataFormat   dataFormat;
     cpuArchDataParse    dataParse;
@@ -182,9 +182,10 @@ cpuBaseline (virCPUDefPtr *cpus,
     ATTRIBUTE_NONNULL(1);
 
 int
-cpuUpdate   (virCPUDefPtr guest,
+virCPUUpdate(virArch arch,
+             virCPUDefPtr guest,
              const virCPUDef *host)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+    ATTRIBUTE_NONNULL(2);
 
 int
 cpuHasFeature(const virCPUData *data,
index a3aed6bc8cd7243d69754194111c072b6d849943..e8ab954ce7107f16107f046d2793ae8e41df8993 100644 (file)
@@ -43,15 +43,41 @@ armDataFree(virCPUDataPtr data)
     VIR_FREE(data);
 }
 
+
 static int
-armUpdate(virCPUDefPtr guest,
-          const virCPUDef *host)
+virCPUarmUpdate(virCPUDefPtr guest,
+                const virCPUDef *host)
 {
+    int ret = -1;
+    virCPUDefPtr updated = NULL;
+
+    if (guest->mode != VIR_CPU_MODE_HOST_MODEL)
+        return 0;
+
+    if (!host) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("unknown host CPU model"));
+        goto cleanup;
+    }
+
+    if (!(updated = virCPUDefCopyWithoutModel(guest)))
+        goto cleanup;
+
+    updated->mode = VIR_CPU_MODE_CUSTOM;
+    if (virCPUDefCopyModel(updated, host, true) < 0)
+        goto cleanup;
+
+    virCPUDefStealModel(guest, updated);
+    guest->mode = VIR_CPU_MODE_CUSTOM;
     guest->match = VIR_CPU_MATCH_EXACT;
-    virCPUDefFreeModel(guest);
-    return virCPUDefCopyModel(guest, host, true);
+    ret = 0;
+
+ cleanup:
+    virCPUDefFree(updated);
+    return ret;
 }
 
+
 static virCPUCompareResult
 armGuestData(virCPUDefPtr host ATTRIBUTE_UNUSED,
              virCPUDefPtr guest ATTRIBUTE_UNUSED,
@@ -104,6 +130,6 @@ struct cpuArchDriver cpuDriverArm = {
     .nodeData = NULL,
     .guestData = armGuestData,
     .baseline = armBaseline,
-    .update = armUpdate,
+    .update = virCPUarmUpdate,
     .hasFeature = NULL,
 };
index ad2d6a7ea1bfa8647f5355508570b41c7bd1aad5..00faa22904a2d5e708d1adea5ab034e41227e50b 100644 (file)
@@ -751,27 +751,21 @@ ppc64DriverGuestData(virCPUDefPtr host,
 }
 
 static int
-ppc64DriverUpdate(virCPUDefPtr guest,
-                  const virCPUDef *host)
+virCPUppc64Update(virCPUDefPtr guest,
+                  const virCPUDef *host ATTRIBUTE_UNUSED)
 {
-    switch ((virCPUMode) guest->mode) {
-    case VIR_CPU_MODE_HOST_PASSTHROUGH:
+    /*
+     * - host-passthrough doesn't even get here
+     * - host-model is used for host CPU running in a compatibility mode and
+     *   it needs to remain unchanged
+     * - custom doesn't support any optional features, there's nothing to
+     *   update
+     */
+
+    if (guest->mode == VIR_CPU_MODE_CUSTOM)
         guest->match = VIR_CPU_MATCH_EXACT;
-        guest->fallback = VIR_CPU_FALLBACK_FORBID;
-        virCPUDefFreeModel(guest);
-        return virCPUDefCopyModel(guest, host, true);
 
-    case VIR_CPU_MODE_HOST_MODEL:
-    case VIR_CPU_MODE_CUSTOM:
-        return 0;
-
-    case VIR_CPU_MODE_LAST:
-        break;
-    }
-
-    virReportError(VIR_ERR_INTERNAL_ERROR,
-                   _("Unexpected CPU mode: %d"), guest->mode);
-    return -1;
+    return 0;
 }
 
 static virCPUDefPtr
@@ -915,7 +909,7 @@ struct cpuArchDriver cpuDriverPPC64 = {
     .nodeData   = ppc64DriverNodeData,
     .guestData  = ppc64DriverGuestData,
     .baseline   = ppc64DriverBaseline,
-    .update     = ppc64DriverUpdate,
+    .update     = virCPUppc64Update,
     .hasFeature = NULL,
     .getModels  = ppc64DriverGetModels,
 };
index 8c95b7a1e1889cb9c40847ac4e2e11ae1a419295..bd2670374ced8eaa46bec4a3b73fdd1ab4e19dfd 100644 (file)
@@ -1122,40 +1122,6 @@ x86ModelFromCPU(const virCPUDef *cpu,
 }
 
 
-static int
-x86ModelSubtractCPU(virCPUx86ModelPtr model,
-                    const virCPUDef *cpu,
-                    virCPUx86MapPtr map)
-{
-    virCPUx86ModelPtr cpu_model;
-    size_t i;
-
-    if (!(cpu_model = x86ModelFind(map, cpu->model))) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Unknown CPU model %s"),
-                       cpu->model);
-        return -1;
-    }
-
-    x86DataSubtract(&model->data, &cpu_model->data);
-
-    for (i = 0; i < cpu->nfeatures; i++) {
-        virCPUx86FeaturePtr feature;
-
-        if (!(feature = x86FeatureFind(map, cpu->features[i].name))) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Unknown CPU feature %s"),
-                           cpu->features[i].name);
-            return -1;
-        }
-
-        x86DataSubtract(&model->data, &feature->data);
-    }
-
-    return 0;
-}
-
-
 static virCPUx86CompareResult
 x86ModelCompare(virCPUx86ModelPtr model1,
                 virCPUx86ModelPtr model2)
@@ -2533,132 +2499,106 @@ x86Baseline(virCPUDefPtr *cpus,
 
 
 static int
-x86UpdateCustom(virCPUDefPtr guest,
-                const virCPUDef *host)
+x86UpdateHostModel(virCPUDefPtr guest,
+                   const virCPUDef *host,
+                   virCPUx86MapPtr map)
 {
-    int ret = -1;
+    virCPUDefPtr updated = NULL;
     size_t i;
-    virCPUx86MapPtr map;
-    virCPUx86ModelPtr host_model = NULL;
+    int ret = -1;
 
-    if (!(map = virCPUx86GetMap()) ||
-        !(host_model = x86ModelFromCPU(host, map, VIR_CPU_FEATURE_REQUIRE)))
+    if (!(updated = virCPUDefCopyWithoutModel(host)))
         goto cleanup;
 
-    for (i = 0; i < guest->nfeatures; i++) {
-        if (guest->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) {
-            int supported = x86FeatureInData(guest->features[i].name,
-                                             &host_model->data, map);
+    /* Remove non-migratable features by default */
+    updated->type = VIR_CPU_TYPE_GUEST;
+    updated->mode = VIR_CPU_MODE_CUSTOM;
+    if (virCPUDefCopyModel(updated, host, true) < 0)
+        goto cleanup;
 
-            if (supported < 0)
-                goto cleanup;
-            else if (supported)
-                guest->features[i].policy = VIR_CPU_FEATURE_REQUIRE;
-            else
-                guest->features[i].policy = VIR_CPU_FEATURE_DISABLE;
+    i = 0;
+    while (i < updated->nfeatures) {
+        if (x86FeatureIsMigratable(updated->features[i].name, map) &&
+            STRNEQ(updated->features[i].name, "cmt") &&
+            STRNEQ(updated->features[i].name, "mbm_total") &&
+            STRNEQ(updated->features[i].name, "mbm_local")) {
+            i++;
+        } else {
+            VIR_FREE(updated->features[i].name);
+            VIR_DELETE_ELEMENT_INPLACE(updated->features, i, updated->nfeatures);
         }
     }
 
-    if (guest->match == VIR_CPU_MATCH_MINIMUM) {
-        guest->match = VIR_CPU_MATCH_EXACT;
-        if (x86ModelSubtractCPU(host_model, guest, map) ||
-            x86DataToCPUFeatures(guest, VIR_CPU_FEATURE_REQUIRE,
-                                 &host_model->data, map))
+    if (guest->vendor_id) {
+        VIR_FREE(updated->vendor_id);
+        if (VIR_STRDUP(updated->vendor_id, guest->vendor_id) < 0)
+            goto cleanup;
+    }
+
+    for (i = 0; i < guest->nfeatures; i++) {
+        if (virCPUDefUpdateFeature(updated,
+                                   guest->features[i].name,
+                                   guest->features[i].policy) < 0)
             goto cleanup;
     }
 
+    virCPUDefStealModel(guest, updated);
+    guest->mode = VIR_CPU_MODE_CUSTOM;
+    guest->match = VIR_CPU_MATCH_EXACT;
     ret = 0;
 
  cleanup:
-    x86ModelFree(host_model);
+    virCPUDefFree(updated);
     return ret;
 }
 
 
 static int
-x86UpdateHostModel(virCPUDefPtr guest,
-                   const virCPUDef *host,
-                   bool passthrough)
+virCPUx86Update(virCPUDefPtr guest,
+                const virCPUDef *host)
 {
-    virCPUDefPtr oldguest = NULL;
+    virCPUx86ModelPtr model = NULL;
     virCPUx86MapPtr map;
-    size_t i;
     int ret = -1;
+    size_t i;
 
-    if (!(map = virCPUx86GetMap()))
-        goto cleanup;
+    if (!host) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("unknown host CPU model"));
+        return -1;
+    }
 
-    /* update the host model according to the desired configuration */
-    if (!(oldguest = virCPUDefCopy(guest)))
-        goto cleanup;
+    if (!(map = virCPUx86GetMap()))
+        return -1;
 
-    virCPUDefFreeModel(guest);
-    if (virCPUDefCopyModel(guest, host, true) < 0)
+    if (!(model = x86ModelFromCPU(host, map, -1)))
         goto cleanup;
 
-    if (oldguest->vendor_id) {
-        VIR_FREE(guest->vendor_id);
-        if (VIR_STRDUP(guest->vendor_id, oldguest->vendor_id) < 0)
-            goto cleanup;
-    }
-
-    /* Remove non-migratable features and CMT related features which QEMU
-     * knows nothing about.
-     * Note: this only works as long as no CPU model contains non-migratable
-     * features directly */
-    i = 0;
-    while (i < guest->nfeatures) {
-        if (x86FeatureIsMigratable(guest->features[i].name, map) &&
-            STRNEQ(guest->features[i].name, "cmt") &&
-            STRNEQ(guest->features[i].name, "mbm_total") &&
-            STRNEQ(guest->features[i].name, "mbm_local")) {
-            i++;
-        } else {
-            VIR_FREE(guest->features[i].name);
-            VIR_DELETE_ELEMENT_INPLACE(guest->features, i, guest->nfeatures);
+    for (i = 0; i < guest->nfeatures; i++) {
+        if (guest->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) {
+            int supported = x86FeatureInData(guest->features[i].name,
+                                             &model->data, map);
+            if (supported < 0)
+                goto cleanup;
+            else if (supported)
+                guest->features[i].policy = VIR_CPU_FEATURE_REQUIRE;
+            else
+                guest->features[i].policy = VIR_CPU_FEATURE_DISABLE;
         }
     }
-    for (i = 0; !passthrough && i < oldguest->nfeatures; i++) {
-        if (virCPUDefUpdateFeature(guest,
-                                   oldguest->features[i].name,
-                                   oldguest->features[i].policy) < 0)
-            goto cleanup;
-    }
 
-    ret = 0;
+    if (guest->mode == VIR_CPU_MODE_HOST_MODEL ||
+        guest->match == VIR_CPU_MATCH_MINIMUM)
+        ret = x86UpdateHostModel(guest, host, map);
+    else
+        ret = 0;
 
  cleanup:
-    virCPUDefFree(oldguest);
+    x86ModelFree(model);
     return ret;
 }
 
 
-static int
-x86Update(virCPUDefPtr guest,
-          const virCPUDef *host)
-{
-    switch ((virCPUMode) guest->mode) {
-    case VIR_CPU_MODE_CUSTOM:
-        return x86UpdateCustom(guest, host);
-
-    case VIR_CPU_MODE_HOST_MODEL:
-        guest->match = VIR_CPU_MATCH_EXACT;
-        return x86UpdateHostModel(guest, host, false);
-
-    case VIR_CPU_MODE_HOST_PASSTHROUGH:
-        guest->match = VIR_CPU_MATCH_MINIMUM;
-        return x86UpdateHostModel(guest, host, true);
-
-    case VIR_CPU_MODE_LAST:
-        break;
-    }
-
-    virReportError(VIR_ERR_INTERNAL_ERROR,
-                   _("Unexpected CPU mode: %d"), guest->mode);
-    return -1;
-}
-
-
 static int
 x86HasFeature(const virCPUData *data,
               const char *name)
@@ -2716,7 +2656,7 @@ struct cpuArchDriver cpuDriverX86 = {
 #endif
     .guestData  = x86GuestData,
     .baseline   = x86Baseline,
-    .update     = x86Update,
+    .update     = virCPUx86Update,
     .hasFeature = x86HasFeature,
     .dataFormat = x86CPUDataFormat,
     .dataParse  = x86CPUDataParse,
index c1285700add9d63ea0f30449cfafb1cfb2694712..6dfab8284a2faa63da583cc322f7bb70ad70a8df 100644 (file)
@@ -981,7 +981,7 @@ cpuGetModels;
 cpuGuestData;
 cpuHasFeature;
 cpuNodeData;
-cpuUpdate;
+virCPUUpdate;
 
 
 # cpu/cpu_x86.h
index f3549d2f1b9a8c2b7823154751b22a32a9fc3afc..8b56ef7e4ca89d8a123a8cf79303ea85f5355580 100644 (file)
@@ -6568,7 +6568,7 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
 
     if (cpu->mode == VIR_CPU_MODE_HOST_MODEL &&
         !migrating &&
-        cpuUpdate(cpu, host) < 0)
+        virCPUUpdate(def->os.arch, cpu, host) < 0)
         goto cleanup;
 
     if (compareAgainstHost &&
index 309d21b793ff3de74b44a47832d0de5fe4db57ae..537024f22eb16043fd9de8a510509cd88dcf5d03 100644 (file)
@@ -3407,7 +3407,7 @@ qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
             goto cleanup;
         }
 
-        if (cpuUpdate(def->cpu, caps->host.cpu) < 0)
+        if (virCPUUpdate(def->os.arch, def->cpu, caps->host.cpu) < 0)
             goto cleanup;
     }
 
index d2d28489d7b884ea0414a00ccd322449c4e47640..b6e050c3b6452584e76645eb8a81620f3b1d45f7 100644 (file)
@@ -4522,7 +4522,7 @@ qemuProcessStartValidateGuestCPU(virDomainObjPtr vm,
 
     if (cpu->mode == VIR_CPU_MODE_HOST_MODEL &&
         flags & VIR_QEMU_PROCESS_START_NEW &&
-        cpuUpdate(cpu, host) < 0)
+        virCPUUpdate(vm->def->os.arch, cpu, host) < 0)
         goto cleanup;
 
     cmp = cpuGuestData(host, cpu, &data, &compare_msg);
index ee779fb7c6b1257a8795dd5dade22d34afa5bfae..e6696e94beafcf51d0ee6c49d87b3dc4b9b2f68c 100644 (file)
@@ -398,7 +398,7 @@ cpuTestUpdate(const void *arg)
         !(cpu = cpuTestLoadXML(data->arch, data->name)))
         goto cleanup;
 
-    if (cpuUpdate(cpu, host) < 0)
+    if (virCPUUpdate(host->arch, cpu, host) < 0)
         goto cleanup;
 
     if (virAsprintf(&result, "%s+%s", data->host, data->name) < 0)
@@ -622,11 +622,14 @@ mymain(void)
             host "/" cpu " (" #result ")",                              \
             host, cpu, NULL, 0, NULL, 0, result)
 
+#define DO_TEST_UPDATE_ONLY(arch, host, cpu)                            \
+    DO_TEST(arch, cpuTestUpdate,                                        \
+            cpu " on " host,                                            \
+            host, cpu, NULL, 0, NULL, 0, 0)                             \
+
 #define DO_TEST_UPDATE(arch, host, cpu, result)                         \
     do {                                                                \
-        DO_TEST(arch, cpuTestUpdate,                                    \
-                cpu " on " host,                                        \
-                host, cpu, NULL, 0, NULL, 0, 0);                        \
+        DO_TEST_UPDATE_ONLY(arch, host, cpu);                           \
         DO_TEST_COMPARE(arch, host, host "+" cpu, result);              \
     } while (0)
 
@@ -737,8 +740,9 @@ mymain(void)
     DO_TEST_UPDATE("x86", "host", "guest", VIR_CPU_COMPARE_SUPERSET);
     DO_TEST_UPDATE("x86", "host", "host-model", VIR_CPU_COMPARE_IDENTICAL);
     DO_TEST_UPDATE("x86", "host", "host-model-nofallback", VIR_CPU_COMPARE_IDENTICAL);
-    DO_TEST_UPDATE("x86", "host", "host-passthrough", VIR_CPU_COMPARE_IDENTICAL);
     DO_TEST_UPDATE("x86", "host-invtsc", "host-model", VIR_CPU_COMPARE_SUPERSET);
+    DO_TEST_UPDATE_ONLY("x86", "host", "host-passthrough");
+    DO_TEST_UPDATE_ONLY("x86", "host", "host-passthrough-features");
 
     DO_TEST_UPDATE("ppc64", "host", "guest", VIR_CPU_COMPARE_IDENTICAL);
     DO_TEST_UPDATE("ppc64", "host", "guest-nofallback", VIR_CPU_COMPARE_INCOMPATIBLE);
index bbb68fb6efbd08144cec70f44db8fc65e1c3d0f0..0c3ede0f6a96b316a2e35d8944e14db27024150d 100644 (file)
@@ -1,4 +1,4 @@
-<cpu mode='host-model' match='exact'>
+<cpu mode='custom' match='exact'>
   <model fallback='forbid'>Penryn</model>
   <vendor>Intel</vendor>
   <topology sockets='1' cores='2' threads='1'/>
index c1014e2de74283a06dd2e5cf7bb07a553032befe..a2847673793f558099ec8398ca82729c77a4e85a 100644 (file)
@@ -1,4 +1,4 @@
-<cpu mode='host-model' match='exact'>
+<cpu mode='custom' match='exact'>
   <model fallback='allow'>Penryn</model>
   <vendor>Intel</vendor>
   <feature policy='require' name='dca'/>
diff --git a/tests/cputestdata/x86-host+host-passthrough-features.xml b/tests/cputestdata/x86-host+host-passthrough-features.xml
new file mode 100644 (file)
index 0000000..dc2b775
--- /dev/null
@@ -0,0 +1,4 @@
+<cpu mode='host-passthrough'>
+  <feature policy='disable' name='dca'/>
+  <feature policy='force' name='vmx'/>
+</cpu>
index 721fae5836dadfdc8a83aafbd43557a0b9c90364..655c7a7f60158bbe5e867b5ffcc39defd907d882 100644 (file)
@@ -1,18 +1 @@
-<cpu mode='host-passthrough' match='minimum'>
-  <model>Penryn</model>
-  <vendor>Intel</vendor>
-  <feature policy='require' name='dca'/>
-  <feature policy='require' name='xtpr'/>
-  <feature policy='require' name='tm2'/>
-  <feature policy='require' name='est'/>
-  <feature policy='require' name='vmx'/>
-  <feature policy='require' name='ds_cpl'/>
-  <feature policy='require' name='monitor'/>
-  <feature policy='require' name='pbe'/>
-  <feature policy='require' name='tm'/>
-  <feature policy='require' name='ht'/>
-  <feature policy='require' name='ss'/>
-  <feature policy='require' name='acpi'/>
-  <feature policy='require' name='ds'/>
-  <feature policy='require' name='vme'/>
-</cpu>
+<cpu mode='host-passthrough'/>
index 6d2d5cda3526adbefacbce301dc69117a195397d..a2847673793f558099ec8398ca82729c77a4e85a 100644 (file)
@@ -1,17 +1,18 @@
 <cpu mode='custom' match='exact'>
   <model fallback='allow'>Penryn</model>
-  <feature policy='require' name='vme'/>
-  <feature policy='require' name='ds'/>
-  <feature policy='require' name='acpi'/>
-  <feature policy='require' name='ss'/>
-  <feature policy='require' name='ht'/>
-  <feature policy='require' name='tm'/>
-  <feature policy='require' name='pbe'/>
-  <feature policy='require' name='monitor'/>
-  <feature policy='require' name='ds_cpl'/>
-  <feature policy='require' name='vmx'/>
-  <feature policy='require' name='est'/>
-  <feature policy='require' name='tm2'/>
-  <feature policy='require' name='xtpr'/>
+  <vendor>Intel</vendor>
   <feature policy='require' name='dca'/>
+  <feature policy='require' name='xtpr'/>
+  <feature policy='require' name='tm2'/>
+  <feature policy='require' name='est'/>
+  <feature policy='require' name='vmx'/>
+  <feature policy='require' name='ds_cpl'/>
+  <feature policy='require' name='monitor'/>
+  <feature policy='require' name='pbe'/>
+  <feature policy='require' name='tm'/>
+  <feature policy='require' name='ht'/>
+  <feature policy='require' name='ss'/>
+  <feature policy='require' name='acpi'/>
+  <feature policy='require' name='ds'/>
+  <feature policy='require' name='vme'/>
 </cpu>
index a8c15f433aa572f90c3e5a93380f39a3f34a94a4..a2847673793f558099ec8398ca82729c77a4e85a 100644 (file)
@@ -1,27 +1,18 @@
 <cpu mode='custom' match='exact'>
-  <model fallback='allow'>pentium3</model>
-  <feature policy='require' name='apic'/>
-  <feature policy='require' name='clflush'/>
-  <feature policy='require' name='ds'/>
-  <feature policy='require' name='acpi'/>
-  <feature policy='require' name='sse2'/>
-  <feature policy='require' name='ss'/>
-  <feature policy='require' name='ht'/>
-  <feature policy='require' name='tm'/>
-  <feature policy='require' name='pbe'/>
-  <feature policy='require' name='pni'/>
-  <feature policy='require' name='monitor'/>
-  <feature policy='require' name='ds_cpl'/>
-  <feature policy='require' name='vmx'/>
-  <feature policy='require' name='est'/>
-  <feature policy='require' name='tm2'/>
-  <feature policy='require' name='ssse3'/>
-  <feature policy='require' name='cx16'/>
-  <feature policy='require' name='xtpr'/>
+  <model fallback='allow'>Penryn</model>
+  <vendor>Intel</vendor>
   <feature policy='require' name='dca'/>
-  <feature policy='require' name='sse4.1'/>
-  <feature policy='require' name='syscall'/>
-  <feature policy='require' name='nx'/>
-  <feature policy='require' name='lm'/>
-  <feature policy='require' name='lahf_lm'/>
+  <feature policy='require' name='xtpr'/>
+  <feature policy='require' name='tm2'/>
+  <feature policy='require' name='est'/>
+  <feature policy='require' name='vmx'/>
+  <feature policy='require' name='ds_cpl'/>
+  <feature policy='require' name='monitor'/>
+  <feature policy='require' name='pbe'/>
+  <feature policy='require' name='tm'/>
+  <feature policy='require' name='ht'/>
+  <feature policy='require' name='ss'/>
+  <feature policy='require' name='acpi'/>
+  <feature policy='require' name='ds'/>
+  <feature policy='require' name='vme'/>
 </cpu>
index ad1bbf807cbb54bf4beafd8211ecd10f71ea9c77..998ed23d7bef59b80e3092c83defa239b8e3052e 100644 (file)
@@ -1,4 +1,4 @@
-<cpu mode='host-model' match='exact'>
+<cpu mode='custom' match='exact'>
   <model fallback='allow'>SandyBridge</model>
   <vendor>Intel</vendor>
   <feature policy='require' name='osxsave'/>
diff --git a/tests/cputestdata/x86-host-passthrough-features.xml b/tests/cputestdata/x86-host-passthrough-features.xml
new file mode 100644 (file)
index 0000000..dc2b775
--- /dev/null
@@ -0,0 +1,4 @@
+<cpu mode='host-passthrough'>
+  <feature policy='disable' name='dca'/>
+  <feature policy='force' name='vmx'/>
+</cpu>