{
char *cpu = NULL;
- virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, NULL);
+ virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
+ VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL);
if (virConnectBaselineCPUEnsureACL(conn) < 0)
goto cleanup;
const virCPUx86Data *cpuData = NULL;
size_t i;
- virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, -1);
+ virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
+ VIR_CONNECT_BASELINE_CPU_MIGRATABLE, -1);
if (!data || !(map = virCPUx86GetMap()))
return -1;
goto out;
}
+ /* Remove non-migratable features if requested
+ * Note: this only works as long as no CPU model contains non-migratable
+ * features directly */
+ if (flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE) {
+ for (i = 0; i < cpuModel->nfeatures; i++) {
+ const struct x86_feature *feat;
+ for (feat = map->migrate_blockers; feat; feat = feat->next) {
+ if (STREQ(feat->name, cpuModel->features[i].name)) {
+ VIR_FREE(cpuModel->features[i].name);
+ VIR_DELETE_ELEMENT_INPLACE(cpuModel->features, i, cpuModel->nfeatures);
+ }
+ }
+ }
+ }
+
if (flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) {
if (!(copy = x86DataCopy(cpuData)) ||
!(features = x86DataFromCPUFeatures(cpuModel, map)))
const char *modelName;
bool matchingNames = true;
+ virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
+ VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL);
+
if (!(map = virCPUx86GetMap()))
goto error;
{
char *cpu = NULL;
- virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, NULL);
+ virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
+ VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL);
if (virConnectBaselineCPUEnsureACL(conn) < 0)
goto cleanup;
if (data->flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES)
suffix = "expanded";
+ else if (data->flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE)
+ suffix = "migratable";
else
suffix = "result";
if (virAsprintf(&result, "%s-%s", data->name, suffix) < 0)
char *label; \
if ((flags) & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) \
suffix = " (expanded)"; \
+ if ((flags) & VIR_CONNECT_BASELINE_CPU_MIGRATABLE) \
+ suffix = " (migratable)"; \
if (virAsprintf(&label, "%s%s", name, suffix) < 0) { \
ret = -1; \
} else { \
DO_TEST_BASELINE("x86", "4", VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, 0);
DO_TEST_BASELINE("x86", "5", 0, 0);
DO_TEST_BASELINE("x86", "5", VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, 0);
+ DO_TEST_BASELINE("x86", "6", 0, 0);
+ DO_TEST_BASELINE("x86", "6", VIR_CONNECT_BASELINE_CPU_MIGRATABLE, 0);
DO_TEST_BASELINE("ppc64", "incompatible-vendors", 0, -1);
DO_TEST_BASELINE("ppc64", "no-vendor", 0, 0);
--- /dev/null
+<cpu mode='custom' match='exact'>
+ <model fallback='allow'>SandyBridge</model>
+ <vendor>Intel</vendor>
+ <feature policy='require' name='hypervisor'/>
+ <feature policy='require' name='osxsave'/>
+ <feature policy='require' name='pcid'/>
+ <feature policy='require' name='ss'/>
+ <feature policy='require' name='vme'/>
+ <feature policy='disable' name='rdtscp'/>
+</cpu>
--- /dev/null
+<cpu mode='custom' match='exact'>
+ <model fallback='allow'>SandyBridge</model>
+ <vendor>Intel</vendor>
+ <feature policy='require' name='invtsc'/>
+ <feature policy='require' name='hypervisor'/>
+ <feature policy='require' name='osxsave'/>
+ <feature policy='require' name='pcid'/>
+ <feature policy='require' name='ss'/>
+ <feature policy='require' name='vme'/>
+ <feature policy='disable' name='rdtscp'/>
+</cpu>
--- /dev/null
+<cpuTest>
+<cpu>
+ <arch>x86_64</arch>
+ <model>Westmere</model>
+ <vendor>Intel</vendor>
+ <topology sockets='4' cores='1' threads='1'/>
+ <feature name='hypervisor'/>
+ <feature name='avx'/>
+ <feature name='osxsave'/>
+ <feature name='xsave'/>
+ <feature name='tsc-deadline'/>
+ <feature name='x2apic'/>
+ <feature name='pcid'/>
+ <feature name='pclmuldq'/>
+ <feature name='ss'/>
+ <feature name='vme'/>
+ <feature name='invtsc'/>
+</cpu>
+<cpu>
+ <arch>x86_64</arch>
+ <model>Nehalem</model>
+ <vendor>Intel</vendor>
+ <topology sockets='4' cores='1' threads='1'/>
+ <feature name='aes'/>
+ <feature name='hypervisor'/>
+ <feature name='avx'/>
+ <feature name='osxsave'/>
+ <feature name='xsave'/>
+ <feature name='tsc-deadline'/>
+ <feature name='x2apic'/>
+ <feature name='pcid'/>
+ <feature name='pclmuldq'/>
+ <feature name='ss'/>
+ <feature name='vme'/>
+ <feature name='invtsc'/>
+</cpu>
+</cpuTest>