<mode name='host-passthrough' supported='yes'/>
<mode name='host-model' supported='yes'/>
<mode name='custom' supported='yes'>
- <model>Broadwell</model>
- <model>Broadwell-noTSX</model>
- <model>Haswell</model>
+ <model usable='no'>Broadwell</model>
+ <model usable='yes'>Broadwell-noTSX</model>
+ <model usable='no'>Haswell</model>
...
</mode>
</cpu>
<dd>
The <code>mode</code> element contains a list of supported CPU
models, each described by a dedicated <code>model</code> element.
+ The <code>usable</code> attribute specifies whether the model can
+ be used on the host. A special value <code>unknown</code> indicates
+ libvirt does not have enough information to provide the usability
+ data.
</dd>
</dl>
<ref name='supported'/>
<zeroOrMore>
<element name='model'>
+ <attribute name='usable'>
+ <choice>
+ <value>yes</value>
+ <value>no</value>
+ <value>unknown</value>
+ </choice>
+ </attribute>
<text/>
</element>
</zeroOrMore>
#define VIR_FROM_THIS VIR_FROM_CAPABILITIES
+VIR_ENUM_IMPL(virDomainCapsCPUUsable, VIR_DOMCAPS_CPU_USABLE_LAST,
+ "unknown", "yes", "no");
+
static virClassPtr virDomainCapsClass;
static virClassPtr virDomainCapsCPUModelsClass;
return NULL;
for (i = 0; i < old->nmodels; i++) {
- if (virDomainCapsCPUModelsAdd(cpuModels, old->models[i].name, -1) < 0)
+ if (virDomainCapsCPUModelsAdd(cpuModels,
+ old->models[i].name, -1,
+ old->models[i].usable) < 0)
goto error;
}
continue;
if (virDomainCapsCPUModelsAdd(cpuModels,
- old->models[i].name, -1) < 0)
+ old->models[i].name, -1,
+ old->models[i].usable) < 0)
goto error;
}
int
virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels,
- char **name)
+ char **name,
+ virDomainCapsCPUUsable usable)
{
if (VIR_RESIZE_N(cpuModels->models, cpuModels->nmodels_max,
cpuModels->nmodels, 1) < 0)
return -1;
- VIR_STEAL_PTR(cpuModels->models[cpuModels->nmodels++].name, *name);
+ cpuModels->models[cpuModels->nmodels].usable = usable;
+ VIR_STEAL_PTR(cpuModels->models[cpuModels->nmodels].name, *name);
+ cpuModels->nmodels++;
return 0;
}
int
virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,
const char *name,
- ssize_t nameLen)
+ ssize_t nameLen,
+ virDomainCapsCPUUsable usable)
{
char *copy = NULL;
if (VIR_STRNDUP(copy, name, nameLen) < 0)
goto error;
- if (virDomainCapsCPUModelsAddSteal(cpuModels, ©) < 0)
+ if (virDomainCapsCPUModelsAddSteal(cpuModels, ©, usable) < 0)
goto error;
return 0;
virBufferAdjustIndent(buf, 2);
for (i = 0; i < custom->nmodels; i++) {
- virBufferAsprintf(buf, "<model>%s</model>\n",
- custom->models[i].name);
+ virDomainCapsCPUModelPtr model = custom->models + i;
+ virBufferAsprintf(buf, "<model usable='%s'>%s</model>\n",
+ virDomainCapsCPUUsableTypeToString(model->usable),
+ model->name);
}
virBufferAdjustIndent(buf, -2);
virDomainCapsEnum version; /* Info about virGICVersion */
};
+typedef enum {
+ VIR_DOMCAPS_CPU_USABLE_UNKNOWN,
+ VIR_DOMCAPS_CPU_USABLE_YES,
+ VIR_DOMCAPS_CPU_USABLE_NO,
+
+ VIR_DOMCAPS_CPU_USABLE_LAST
+} virDomainCapsCPUUsable;
+VIR_ENUM_DECL(virDomainCapsCPUUsable);
+
typedef struct _virDomainCapsCPUModel virDomainCapsCPUModel;
typedef virDomainCapsCPUModel *virDomainCapsCPUModelPtr;
struct _virDomainCapsCPUModel {
char *name;
+ virDomainCapsCPUUsable usable;
};
typedef struct _virDomainCapsCPUModels virDomainCapsCPUModels;
virDomainCapsCPUModelsPtr virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
const char **models);
int virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels,
- char **name);
+ char **name,
+ virDomainCapsCPUUsable usable);
int virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,
const char *name,
- ssize_t nameLen);
+ ssize_t nameLen,
+ virDomainCapsCPUUsable usable);
# define VIR_DOMAIN_CAPS_ENUM_SET(capsEnum, ...) \
do { \
virDomainCapsCPUModelsCopy;
virDomainCapsCPUModelsFilter;
virDomainCapsCPUModelsNew;
+virDomainCapsCPUUsableTypeFromString;
+virDomainCapsCPUUsableTypeToString;
virDomainCapsEnumClear;
virDomainCapsEnumSet;
virDomainCapsFormat;
len -= 2;
}
- if (virDomainCapsCPUModelsAdd(cpus, p, len) < 0)
+ if (virDomainCapsCPUModelsAdd(cpus, p, len,
+ VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
goto error;
} while ((p = next));
if (*p == '\n')
continue;
- if (virDomainCapsCPUModelsAdd(cpus, p, t - p - 1) < 0)
+ if (virDomainCapsCPUModelsAdd(cpus, p, t - p - 1,
+ VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
goto error;
} while ((p = next));
return -1;
for (i = 0; i < count; i++) {
- if (virDomainCapsCPUModelsAdd(qemuCaps->cpuDefinitions, name[i], -1) < 0)
+ if (virDomainCapsCPUModelsAdd(qemuCaps->cpuDefinitions, name[i], -1,
+ VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
return -1;
}
for (i = 0; i < ncpus; i++) {
if (virDomainCapsCPUModelsAddSteal(qemuCaps->cpuDefinitions,
- &cpus[i]->name) < 0)
+ &cpus[i]->name,
+ VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
goto cleanup;
}
}
if (virDomainCapsCPUModelsAddSteal(qemuCaps->cpuDefinitions,
- &str) < 0)
+ &str,
+ VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
goto cleanup;
}
}
<mode name='host-passthrough' supported='yes'/>
<mode name='host-model' supported='yes'/>
<mode name='custom' supported='yes'>
- <model>Model1</model>
- <model>Model2</model>
- <model>Model3</model>
+ <model usable='unknown'>Model1</model>
+ <model usable='no'>Model2</model>
+ <model usable='yes'>Model3</model>
</mode>
</cpu>
<devices>
<mode name='host-passthrough' supported='yes'/>
<mode name='host-model' supported='yes'/>
<mode name='custom' supported='yes'>
- <model>Opteron_G5</model>
- <model>Opteron_G4</model>
- <model>Opteron_G3</model>
- <model>Opteron_G2</model>
- <model>Opteron_G1</model>
- <model>Haswell</model>
- <model>SandyBridge</model>
- <model>Westmere</model>
- <model>Nehalem</model>
- <model>Penryn</model>
- <model>Conroe</model>
- <model>n270</model>
- <model>athlon</model>
- <model>pentium3</model>
- <model>pentium2</model>
- <model>pentium</model>
- <model>486</model>
- <model>coreduo</model>
- <model>kvm32</model>
- <model>qemu32</model>
- <model>kvm64</model>
- <model>core2duo</model>
- <model>phenom</model>
- <model>qemu64</model>
+ <model usable='unknown'>Opteron_G5</model>
+ <model usable='unknown'>Opteron_G4</model>
+ <model usable='unknown'>Opteron_G3</model>
+ <model usable='unknown'>Opteron_G2</model>
+ <model usable='unknown'>Opteron_G1</model>
+ <model usable='unknown'>Haswell</model>
+ <model usable='unknown'>SandyBridge</model>
+ <model usable='unknown'>Westmere</model>
+ <model usable='unknown'>Nehalem</model>
+ <model usable='unknown'>Penryn</model>
+ <model usable='unknown'>Conroe</model>
+ <model usable='unknown'>n270</model>
+ <model usable='unknown'>athlon</model>
+ <model usable='unknown'>pentium3</model>
+ <model usable='unknown'>pentium2</model>
+ <model usable='unknown'>pentium</model>
+ <model usable='unknown'>486</model>
+ <model usable='unknown'>coreduo</model>
+ <model usable='unknown'>kvm32</model>
+ <model usable='unknown'>qemu32</model>
+ <model usable='unknown'>kvm64</model>
+ <model usable='unknown'>core2duo</model>
+ <model usable='unknown'>phenom</model>
+ <model usable='unknown'>qemu64</model>
</mode>
</cpu>
<devices>
<mode name='host-passthrough' supported='yes'/>
<mode name='host-model' supported='yes'/>
<mode name='custom' supported='yes'>
- <model>pxa262</model>
- <model>pxa270-a0</model>
- <model>arm1136</model>
- <model>cortex-a15</model>
- <model>pxa260</model>
- <model>arm1136-r2</model>
- <model>pxa261</model>
- <model>pxa255</model>
- <model>arm926</model>
- <model>arm11mpcore</model>
- <model>pxa250</model>
- <model>ti925t</model>
- <model>cortex-a57</model>
- <model>sa1110</model>
- <model>arm1176</model>
- <model>cortex-a53</model>
- <model>sa1100</model>
- <model>pxa270-c5</model>
- <model>cortex-a9</model>
- <model>cortex-a8</model>
- <model>pxa270-c0</model>
- <model>arm1026</model>
- <model>pxa270-b1</model>
- <model>cortex-m3</model>
- <model>cortex-m4</model>
- <model>pxa270-b0</model>
- <model>arm946</model>
- <model>cortex-r5</model>
- <model>pxa270-a1</model>
- <model>pxa270</model>
+ <model usable='unknown'>pxa262</model>
+ <model usable='unknown'>pxa270-a0</model>
+ <model usable='unknown'>arm1136</model>
+ <model usable='unknown'>cortex-a15</model>
+ <model usable='unknown'>pxa260</model>
+ <model usable='unknown'>arm1136-r2</model>
+ <model usable='unknown'>pxa261</model>
+ <model usable='unknown'>pxa255</model>
+ <model usable='unknown'>arm926</model>
+ <model usable='unknown'>arm11mpcore</model>
+ <model usable='unknown'>pxa250</model>
+ <model usable='unknown'>ti925t</model>
+ <model usable='unknown'>cortex-a57</model>
+ <model usable='unknown'>sa1110</model>
+ <model usable='unknown'>arm1176</model>
+ <model usable='unknown'>cortex-a53</model>
+ <model usable='unknown'>sa1100</model>
+ <model usable='unknown'>pxa270-c5</model>
+ <model usable='unknown'>cortex-a9</model>
+ <model usable='unknown'>cortex-a8</model>
+ <model usable='unknown'>pxa270-c0</model>
+ <model usable='unknown'>arm1026</model>
+ <model usable='unknown'>pxa270-b1</model>
+ <model usable='unknown'>cortex-m3</model>
+ <model usable='unknown'>cortex-m4</model>
+ <model usable='unknown'>pxa270-b0</model>
+ <model usable='unknown'>arm946</model>
+ <model usable='unknown'>cortex-r5</model>
+ <model usable='unknown'>pxa270-a1</model>
+ <model usable='unknown'>pxa270</model>
</mode>
</cpu>
<devices>
<mode name='host-passthrough' supported='yes'/>
<mode name='host-model' supported='yes'/>
<mode name='custom' supported='yes'>
- <model>pxa262</model>
- <model>pxa270-a0</model>
- <model>arm1136</model>
- <model>cortex-a15</model>
- <model>pxa260</model>
- <model>arm1136-r2</model>
- <model>pxa261</model>
- <model>pxa255</model>
- <model>arm926</model>
- <model>arm11mpcore</model>
- <model>pxa250</model>
- <model>ti925t</model>
- <model>cortex-a57</model>
- <model>sa1110</model>
- <model>arm1176</model>
- <model>cortex-a53</model>
- <model>sa1100</model>
- <model>pxa270-c5</model>
- <model>cortex-a9</model>
- <model>cortex-a8</model>
- <model>pxa270-c0</model>
- <model>arm1026</model>
- <model>pxa270-b1</model>
- <model>cortex-m3</model>
- <model>cortex-m4</model>
- <model>pxa270-b0</model>
- <model>arm946</model>
- <model>cortex-r5</model>
- <model>pxa270-a1</model>
- <model>pxa270</model>
+ <model usable='unknown'>pxa262</model>
+ <model usable='unknown'>pxa270-a0</model>
+ <model usable='unknown'>arm1136</model>
+ <model usable='unknown'>cortex-a15</model>
+ <model usable='unknown'>pxa260</model>
+ <model usable='unknown'>arm1136-r2</model>
+ <model usable='unknown'>pxa261</model>
+ <model usable='unknown'>pxa255</model>
+ <model usable='unknown'>arm926</model>
+ <model usable='unknown'>arm11mpcore</model>
+ <model usable='unknown'>pxa250</model>
+ <model usable='unknown'>ti925t</model>
+ <model usable='unknown'>cortex-a57</model>
+ <model usable='unknown'>sa1110</model>
+ <model usable='unknown'>arm1176</model>
+ <model usable='unknown'>cortex-a53</model>
+ <model usable='unknown'>sa1100</model>
+ <model usable='unknown'>pxa270-c5</model>
+ <model usable='unknown'>cortex-a9</model>
+ <model usable='unknown'>cortex-a8</model>
+ <model usable='unknown'>pxa270-c0</model>
+ <model usable='unknown'>arm1026</model>
+ <model usable='unknown'>pxa270-b1</model>
+ <model usable='unknown'>cortex-m3</model>
+ <model usable='unknown'>cortex-m4</model>
+ <model usable='unknown'>pxa270-b0</model>
+ <model usable='unknown'>arm946</model>
+ <model usable='unknown'>cortex-r5</model>
+ <model usable='unknown'>pxa270-a1</model>
+ <model usable='unknown'>pxa270</model>
</mode>
</cpu>
<devices>
<mode name='host-passthrough' supported='yes'/>
<mode name='host-model' supported='yes'/>
<mode name='custom' supported='yes'>
- <model>pxa262</model>
- <model>pxa270-a0</model>
- <model>arm1136</model>
- <model>cortex-a15</model>
- <model>pxa260</model>
- <model>arm1136-r2</model>
- <model>pxa261</model>
- <model>pxa255</model>
- <model>arm926</model>
- <model>arm11mpcore</model>
- <model>pxa250</model>
- <model>ti925t</model>
- <model>cortex-a57</model>
- <model>sa1110</model>
- <model>arm1176</model>
- <model>cortex-a53</model>
- <model>sa1100</model>
- <model>pxa270-c5</model>
- <model>cortex-a9</model>
- <model>cortex-a8</model>
- <model>pxa270-c0</model>
- <model>arm1026</model>
- <model>pxa270-b1</model>
- <model>cortex-m3</model>
- <model>cortex-m4</model>
- <model>pxa270-b0</model>
- <model>arm946</model>
- <model>cortex-r5</model>
- <model>pxa270-a1</model>
- <model>pxa270</model>
+ <model usable='unknown'>pxa262</model>
+ <model usable='unknown'>pxa270-a0</model>
+ <model usable='unknown'>arm1136</model>
+ <model usable='unknown'>cortex-a15</model>
+ <model usable='unknown'>pxa260</model>
+ <model usable='unknown'>arm1136-r2</model>
+ <model usable='unknown'>pxa261</model>
+ <model usable='unknown'>pxa255</model>
+ <model usable='unknown'>arm926</model>
+ <model usable='unknown'>arm11mpcore</model>
+ <model usable='unknown'>pxa250</model>
+ <model usable='unknown'>ti925t</model>
+ <model usable='unknown'>cortex-a57</model>
+ <model usable='unknown'>sa1110</model>
+ <model usable='unknown'>arm1176</model>
+ <model usable='unknown'>cortex-a53</model>
+ <model usable='unknown'>sa1100</model>
+ <model usable='unknown'>pxa270-c5</model>
+ <model usable='unknown'>cortex-a9</model>
+ <model usable='unknown'>cortex-a8</model>
+ <model usable='unknown'>pxa270-c0</model>
+ <model usable='unknown'>arm1026</model>
+ <model usable='unknown'>pxa270-b1</model>
+ <model usable='unknown'>cortex-m3</model>
+ <model usable='unknown'>cortex-m4</model>
+ <model usable='unknown'>pxa270-b0</model>
+ <model usable='unknown'>arm946</model>
+ <model usable='unknown'>cortex-r5</model>
+ <model usable='unknown'>pxa270-a1</model>
+ <model usable='unknown'>pxa270</model>
</mode>
</cpu>
<devices>
<mode name='host-passthrough' supported='yes'/>
<mode name='host-model' supported='yes'/>
<mode name='custom' supported='yes'>
- <model>POWER8</model>
- <model>POWER7</model>
+ <model usable='unknown'>POWER8</model>
+ <model usable='unknown'>POWER7</model>
</mode>
</cpu>
<devices>
<mode name='host-passthrough' supported='yes'/>
<mode name='host-model' supported='yes'/>
<mode name='custom' supported='yes'>
- <model>Opteron_G5</model>
- <model>Opteron_G4</model>
- <model>Opteron_G3</model>
- <model>Opteron_G2</model>
- <model>Opteron_G1</model>
- <model>Broadwell</model>
- <model>Broadwell-noTSX</model>
- <model>Haswell</model>
- <model>Haswell-noTSX</model>
- <model>IvyBridge</model>
- <model>SandyBridge</model>
- <model>Westmere</model>
- <model>Nehalem</model>
- <model>Penryn</model>
- <model>Conroe</model>
- <model>n270</model>
- <model>athlon</model>
- <model>pentium3</model>
- <model>pentium2</model>
- <model>pentium</model>
- <model>486</model>
- <model>coreduo</model>
- <model>kvm32</model>
- <model>qemu32</model>
- <model>kvm64</model>
- <model>core2duo</model>
- <model>phenom</model>
- <model>qemu64</model>
+ <model usable='unknown'>Opteron_G5</model>
+ <model usable='unknown'>Opteron_G4</model>
+ <model usable='unknown'>Opteron_G3</model>
+ <model usable='unknown'>Opteron_G2</model>
+ <model usable='unknown'>Opteron_G1</model>
+ <model usable='unknown'>Broadwell</model>
+ <model usable='unknown'>Broadwell-noTSX</model>
+ <model usable='unknown'>Haswell</model>
+ <model usable='unknown'>Haswell-noTSX</model>
+ <model usable='unknown'>IvyBridge</model>
+ <model usable='unknown'>SandyBridge</model>
+ <model usable='unknown'>Westmere</model>
+ <model usable='unknown'>Nehalem</model>
+ <model usable='unknown'>Penryn</model>
+ <model usable='unknown'>Conroe</model>
+ <model usable='unknown'>n270</model>
+ <model usable='unknown'>athlon</model>
+ <model usable='unknown'>pentium3</model>
+ <model usable='unknown'>pentium2</model>
+ <model usable='unknown'>pentium</model>
+ <model usable='unknown'>486</model>
+ <model usable='unknown'>coreduo</model>
+ <model usable='unknown'>kvm32</model>
+ <model usable='unknown'>qemu32</model>
+ <model usable='unknown'>kvm64</model>
+ <model usable='unknown'>core2duo</model>
+ <model usable='unknown'>phenom</model>
+ <model usable='unknown'>qemu64</model>
</mode>
</cpu>
<devices>
cpu->hostPassthrough = true;
cpu->hostModel = true;
if (!(cpu->custom = virDomainCapsCPUModelsNew(3)) ||
- virDomainCapsCPUModelsAdd(cpu->custom, "Model1", -1) < 0 ||
- virDomainCapsCPUModelsAdd(cpu->custom, "Model2", -1) < 0 ||
- virDomainCapsCPUModelsAdd(cpu->custom, "Model3", -1) < 0)
+ virDomainCapsCPUModelsAdd(cpu->custom, "Model1", -1,
+ VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
+ virDomainCapsCPUModelsAdd(cpu->custom, "Model2", -1,
+ VIR_DOMCAPS_CPU_USABLE_NO) < 0 ||
+ virDomainCapsCPUModelsAdd(cpu->custom, "Model3", -1,
+ VIR_DOMCAPS_CPU_USABLE_YES) < 0)
return -1;
disk->supported = true;