mirror of https://gitee.com/openkylin/libvirt.git
Add support for EOI with APIC
New options is added to support EOI (End of Interrupt) exposure for guests. As it makes sense only when APIC is enabled, I added this into the <apic> element in <features> because this should be tri-state option (cannot be handled as standalone feature).
This commit is contained in:
parent
b7ff9e6960
commit
4a8b7cba80
|
@ -1018,6 +1018,13 @@
|
|||
<dd>ACPI is useful for power management, for example, with
|
||||
KVM guests it is required for graceful shutdown to work.
|
||||
</dd>
|
||||
<dt><code>apic</code></dt>
|
||||
<dd>APIC allows the use of programmable IRQ
|
||||
management. <span class="since">Since 0.10.2 (QEMU only)</span>
|
||||
there is an optional attribute <code>eoi</code> with values "on"
|
||||
and "off" which toggles the availability of EOI (End of
|
||||
Interrupt) for the guest.
|
||||
</dd>
|
||||
<dt><code>hap</code></dt>
|
||||
<dd>Enable use of Hardware Assisted Paging if available in
|
||||
the hardware.
|
||||
|
|
|
@ -2910,7 +2910,14 @@
|
|||
</optional>
|
||||
<optional>
|
||||
<element name="apic">
|
||||
<empty/>
|
||||
<optional>
|
||||
<attribute name="eoi">
|
||||
<choice>
|
||||
<value>on</value>
|
||||
<value>off</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
|
|
|
@ -110,6 +110,11 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
|
|||
"viridian",
|
||||
"privnet")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainApicEoi, VIR_DOMAIN_APIC_EOI_LAST,
|
||||
"default",
|
||||
"on",
|
||||
"off")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainLifecycle, VIR_DOMAIN_LIFECYCLE_LAST,
|
||||
"destroy",
|
||||
"restart",
|
||||
|
@ -8840,6 +8845,21 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
|||
goto error;
|
||||
}
|
||||
def->features |= (1 << val);
|
||||
if (val == VIR_DOMAIN_FEATURE_APIC) {
|
||||
tmp = virXPathString("string(./features/apic/@eoi)", ctxt);
|
||||
if (tmp) {
|
||||
int eoi;
|
||||
if ((eoi = virDomainApicEoiTypeFromString(tmp)) <= 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown value for attribute eoi: %s"),
|
||||
tmp);
|
||||
VIR_FREE(tmp);
|
||||
goto error;
|
||||
}
|
||||
def->apic_eoi = eoi;
|
||||
VIR_FREE(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
VIR_FREE(nodes);
|
||||
}
|
||||
|
@ -13751,7 +13771,13 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||
_("unexpected feature %d"), i);
|
||||
goto cleanup;
|
||||
}
|
||||
virBufferAsprintf(buf, " <%s/>\n", name);
|
||||
virBufferAsprintf(buf, " <%s", name);
|
||||
if (i == VIR_DOMAIN_FEATURE_APIC && def->apic_eoi) {
|
||||
virBufferAsprintf(buf,
|
||||
" eoi='%s'",
|
||||
virDomainApicEoiTypeToString(def->apic_eoi));
|
||||
}
|
||||
virBufferAsprintf(buf, "/>\n");
|
||||
}
|
||||
}
|
||||
virBufferAddLit(buf, " </features>\n");
|
||||
|
|
|
@ -1370,6 +1370,14 @@ enum virDomainFeature {
|
|||
VIR_DOMAIN_FEATURE_LAST
|
||||
};
|
||||
|
||||
enum virDomainApicEoi {
|
||||
VIR_DOMAIN_APIC_EOI_DEFAULT = 0,
|
||||
VIR_DOMAIN_APIC_EOI_ON,
|
||||
VIR_DOMAIN_APIC_EOI_OFF,
|
||||
|
||||
VIR_DOMAIN_APIC_EOI_LAST,
|
||||
};
|
||||
|
||||
enum virDomainLifecycleAction {
|
||||
VIR_DOMAIN_LIFECYCLE_DESTROY,
|
||||
VIR_DOMAIN_LIFECYCLE_RESTART,
|
||||
|
@ -1661,6 +1669,8 @@ struct _virDomainDef {
|
|||
virDomainOSDef os;
|
||||
char *emulator;
|
||||
int features;
|
||||
/* enum virDomainApicEoi */
|
||||
int apic_eoi;
|
||||
|
||||
virDomainClockDef clock;
|
||||
|
||||
|
@ -2125,6 +2135,7 @@ VIR_ENUM_DECL(virDomainTaint)
|
|||
VIR_ENUM_DECL(virDomainVirt)
|
||||
VIR_ENUM_DECL(virDomainBoot)
|
||||
VIR_ENUM_DECL(virDomainFeature)
|
||||
VIR_ENUM_DECL(virDomainApicEoi)
|
||||
VIR_ENUM_DECL(virDomainLifecycle)
|
||||
VIR_ENUM_DECL(virDomainLifecycleCrash)
|
||||
VIR_ENUM_DECL(virDomainPMState)
|
||||
|
|
|
@ -264,6 +264,8 @@ virBlkioDeviceWeightArrayClear;
|
|||
virDiskNameToBusDeviceIndex;
|
||||
virDiskNameToIndex;
|
||||
virDomainActualNetDefFree;
|
||||
virDomainApicEoiTypeFromString;
|
||||
virDomainApicEoiTypeToString;
|
||||
virDomainAssignDef;
|
||||
virDomainBlockedReasonTypeFromString;
|
||||
virDomainBlockedReasonTypeToString;
|
||||
|
|
Loading…
Reference in New Issue