conf: add 'state' attribute to <hap> feature

Most hypervisors use Hardware Assisted Paging by default and don't
require specifying the feature in domain conf. But some hypervisors
support disabling HAP on a per-domain basis. To enable HAP by default
yet provide a knob to disable it, extend the <hap> feature with a
'state=on|off' attribute, similar to <pvspinlock> and <vmport> features.

In the absence of <hap>, the hypervisor default (on) is used. <hap>
without the state attribute would be the same as <hap state='on'/> for
backwards compatibility. And of course <hap state='off'/> disables hap.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
Jim Fehlig 2016-02-22 17:03:21 -07:00
parent 109017d9b3
commit 9d243e0895
3 changed files with 11 additions and 5 deletions

View File

@ -1494,8 +1494,10 @@
Interrupt) for the guest.
</dd>
<dt><code>hap</code></dt>
<dd>Enable use of Hardware Assisted Paging if available in
the hardware.
<dd>Depending on the <code>state</code> attribute (values <code>on</code>,
<code>off</code>) enable or disable use of Hardware Assisted Paging.
The default is <code>on</code> if the hypervisor detects availability
of Hardware Assisted Paging.
</dd>
<dt><code>viridian</code></dt>
<dd>Enable Viridian hypervisor extensions for paravirtualizing

View File

@ -4144,7 +4144,11 @@
</optional>
<optional>
<element name="hap">
<empty/>
<optional>
<attribute name="state">
<ref name="virOnOff"/>
</attribute>
</optional>
</element>
</optional>
<optional>

View File

@ -15497,7 +15497,6 @@ virDomainDefParseXML(xmlDocPtr xml,
/* fallthrough */
case VIR_DOMAIN_FEATURE_ACPI:
case VIR_DOMAIN_FEATURE_PAE:
case VIR_DOMAIN_FEATURE_HAP:
case VIR_DOMAIN_FEATURE_VIRIDIAN:
case VIR_DOMAIN_FEATURE_PRIVNET:
case VIR_DOMAIN_FEATURE_HYPERV:
@ -15522,6 +15521,7 @@ virDomainDefParseXML(xmlDocPtr xml,
ctxt->node = node;
break;
case VIR_DOMAIN_FEATURE_HAP:
case VIR_DOMAIN_FEATURE_PMU:
case VIR_DOMAIN_FEATURE_PVSPINLOCK:
case VIR_DOMAIN_FEATURE_VMPORT:
@ -22288,7 +22288,6 @@ virDomainDefFormatInternal(virDomainDefPtr def,
switch ((virDomainFeature) i) {
case VIR_DOMAIN_FEATURE_ACPI:
case VIR_DOMAIN_FEATURE_PAE:
case VIR_DOMAIN_FEATURE_HAP:
case VIR_DOMAIN_FEATURE_VIRIDIAN:
case VIR_DOMAIN_FEATURE_PRIVNET:
switch ((virTristateSwitch) def->features[i]) {
@ -22310,6 +22309,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
break;
case VIR_DOMAIN_FEATURE_HAP:
case VIR_DOMAIN_FEATURE_PMU:
case VIR_DOMAIN_FEATURE_PVSPINLOCK:
case VIR_DOMAIN_FEATURE_VMPORT: