conf: add vapic and spinlocks to hyperv features

Add new CPU features for HyperV:
vapic for virtual APIC support
spinlocks for setting spinlock support

<features>
  <hyperv>
    <vapic state='on'/>
    <spinlocks state='on' retries='4096'/>
  </hyperv>
</features>

https://bugzilla.redhat.com/show_bug.cgi?id=784836
This commit is contained in:
Ján Tomko 2013-06-21 12:20:12 +02:00
parent ce2400676d
commit 800b51d7b0
5 changed files with 104 additions and 3 deletions

View File

@ -1147,6 +1147,8 @@
&lt;privnet/&gt;
&lt;hyperv&gt;
&lt;relaxed state='on'/&gt;
&lt;vapic state='on'/&gt;
&lt;spinlocks state='on' retries='4096'&lt;/spinlocks&gt;
&lt;/hyperv&gt;
&lt;/features&gt;
@ -1197,14 +1199,27 @@
<th>Feature</th>
<th>Description</th>
<th>Value</th>
<th>Since</th>
</tr>
<tr>
<td>relaxed</td>
<td>Relax contstraints on timers</td>
<td> on, off</td>
<td><span class="since">1.0.0 (QEMU only)</span></td>
</tr>
<tr>
<td>vapic</td>
<td>Enable virtual APIC</td>
<td>on, off</td>
<td><span class="since">1.1.0 (QEMU only)</span></td>
</tr>
<tr>
<td>spinlocks</td>
<td>Enable spinlock support</td>
<td>on, off; retries - at least 4095</td>
<td><span class="since">1.1.0 (QEMU only)</span></td>
</tr>
</table>
<span class="since">Since 1.0.0 (QEMU only)</span>
</dd>
</dl>

View File

@ -4015,6 +4015,19 @@
<ref name="hypervtristate"/>
</element>
</optional>
<optional>
<element name="vapic">
<ref name="hypervtristate"/>
</element>
</optional>
<optional>
<element name="spinlocks">
<ref name="hypervtristate"/>
<attribute name="retries">
<data type="integer"/>
</attribute>
</element>
</optional>
</interleave>
</element>
</define>

View File

@ -149,7 +149,9 @@ VIR_ENUM_IMPL(virDomainFeatureState, VIR_DOMAIN_FEATURE_STATE_LAST,
"off")
VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST,
"relaxed")
"relaxed",
"vapic",
"spinlocks")
VIR_ENUM_IMPL(virDomainLifecycle, VIR_DOMAIN_LIFECYCLE_LAST,
"destroy",
@ -11084,6 +11086,7 @@ virDomainDefParseXML(xmlDocPtr xml,
switch ((enum virDomainHyperv) feature) {
case VIR_DOMAIN_HYPERV_RELAXED:
case VIR_DOMAIN_HYPERV_VAPIC:
if (!(tmp = virXPathString("string(./@state)", ctxt))) {
virReportError(VIR_ERR_XML_ERROR,
_("missing 'state' attribute for "
@ -11104,6 +11107,48 @@ virDomainDefParseXML(xmlDocPtr xml,
def->hyperv_features[feature] = value;
break;
case VIR_DOMAIN_HYPERV_SPINLOCKS:
if (!(tmp = virXPathString("string(./@state)", ctxt))) {
virReportError(VIR_ERR_XML_ERROR,
_("missing 'state' attribute for "
"HyperV Enlightenment feature '%s'"),
nodes[i]->name);
goto error;
}
if ((value = virDomainFeatureStateTypeFromString(tmp)) < 0) {
virReportError(VIR_ERR_XML_ERROR,
_("invalid value of state argument "
"for HyperV Enlightenment feature '%s'"),
nodes[i]->name);
goto error;
}
VIR_FREE(tmp);
if (!(tmp = virXPathString("string(./@retries)", ctxt))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("missing HyperV spinlock retry count"));
goto error;
}
if (virStrToLong_ui(tmp, NULL, 0,
&def->hyperv_spinlocks) < 0) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Cannot parse HyperV spinlock retry "
"count"));
goto error;
}
if (def->hyperv_spinlocks < 0xFFF) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("HyperV spinlock retry count must be "
"at least 4095"));
goto error;
}
VIR_FREE(tmp);
def->hyperv_features[feature] = value;
break;
case VIR_DOMAIN_HYPERV_LAST:
break;
}
@ -16224,10 +16269,25 @@ virDomainDefFormatInternal(virDomainDefPtr def,
for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
switch ((enum virDomainHyperv) i) {
case VIR_DOMAIN_HYPERV_RELAXED:
case VIR_DOMAIN_HYPERV_VAPIC:
if (def->hyperv_features[i])
virBufferAsprintf(buf, " <%s state='%s'/>\n",
virDomainHypervTypeToString(i),
virDomainFeatureStateTypeToString(def->hyperv_features[i]));
virDomainFeatureStateTypeToString(
def->hyperv_features[i]));
break;
case VIR_DOMAIN_HYPERV_SPINLOCKS:
if (def->hyperv_features[i] == 0)
break;
virBufferAsprintf(buf, " <spinlocks state='%s'",
virDomainFeatureStateTypeToString(
def->hyperv_features[i]));
if (def->hyperv_features[i] == VIR_DOMAIN_FEATURE_STATE_ON)
virBufferAsprintf(buf, " retries='%d'",
def->hyperv_spinlocks);
virBufferAddLit(buf, "/>\n");
break;
case VIR_DOMAIN_HYPERV_LAST:

View File

@ -1584,6 +1584,8 @@ enum virDomainFeatureState {
enum virDomainHyperv {
VIR_DOMAIN_HYPERV_RELAXED = 0,
VIR_DOMAIN_HYPERV_VAPIC,
VIR_DOMAIN_HYPERV_SPINLOCKS,
VIR_DOMAIN_HYPERV_LAST
};
@ -1926,6 +1928,7 @@ struct _virDomainDef {
int apic_eoi;
/* These options are of type virDomainFeatureState */
int hyperv_features[VIR_DOMAIN_HYPERV_LAST];
unsigned int hyperv_spinlocks;
virDomainClockDef clock;

View File

@ -5791,6 +5791,11 @@ qemuBuildCpuArgStr(const virQEMUDriverPtr driver,
virDomainHypervTypeToString(i));
break;
case VIR_DOMAIN_HYPERV_VAPIC:
case VIR_DOMAIN_HYPERV_SPINLOCKS:
/* implemented in the next commit */
break;
case VIR_DOMAIN_HYPERV_LAST:
break;
}
@ -9726,6 +9731,11 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
dom->hyperv_features[f] = VIR_DOMAIN_FEATURE_STATE_ON;
break;
case VIR_DOMAIN_HYPERV_VAPIC:
case VIR_DOMAIN_HYPERV_SPINLOCKS:
/* implemented in the next commit */
break;
case VIR_DOMAIN_HYPERV_LAST:
break;
}