From 921c52b0db3ac898d5cc4eda19fb861ad58d9a9e Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: May 05 2015 07:45:43 +0000 Subject: Introduce GIC feature Some platforms, like aarch64, don't have APIC but GIC. So there's no reason to have feature turned on. However, we are still missing feature. This commit introduces the feature to XML parser and formatter, adds documentation and updates RNG schema. Signed-off-by: Michal Privoznik --- diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index d484152..fe7f9c5 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1439,6 +1439,7 @@ <hidden state='on'/> </kvm> <pvspinlock/> + <gic version='2'/> </features> ... @@ -1545,6 +1546,15 @@ the emulation of VMWare IO port, for vmmouse etc. Since 1.2.16 +
gic
+
Enable for architectures using a General Interrupt + Controller instead of APIC in order to handle interrupts. + For example, the 'aarch64' architecture uses + gic instead of apic. The optional + attribute version specifies the GIC version; + however, it may not be supported by all hypervisors. Since 1.2.16 +

Time keeping

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 64d22ea..c151e92 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3965,7 +3965,7 @@ @@ -4035,6 +4035,15 @@ + + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fe8b8ca..4cd36a1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -144,7 +144,8 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST, "pvspinlock", "capabilities", "pmu", - "vmport") + "vmport", + "gic") VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST, "default", @@ -14511,6 +14512,22 @@ virDomainDefParseXML(xmlDocPtr xml, ctxt->node = node; break; + case VIR_DOMAIN_FEATURE_GIC: + node = ctxt->node; + ctxt->node = nodes[i]; + if ((tmp = virXPathString("string(./@version)", ctxt))) { + if (virStrToLong_uip(tmp, NULL, 10, &def->gic_version) < 0 || + def->gic_version == 0) { + virReportError(VIR_ERR_XML_ERROR, + _("malformed gic version: %s"), tmp); + goto error; + } + VIR_FREE(tmp); + } + def->features[val] = VIR_TRISTATE_SWITCH_ON; + ctxt->node = node; + break; + /* coverity[dead_error_begin] */ case VIR_DOMAIN_FEATURE_LAST: break; @@ -16593,6 +16610,14 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src, return false; } + /* GIC version */ + if (src->gic_version != dst->gic_version) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Source GIC version '%u' does not match destination '%u'"), + src->gic_version, dst->gic_version); + return false; + } + /* hyperv */ if (src->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) { for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) { @@ -21232,6 +21257,16 @@ virDomainDefFormatInternal(virDomainDefPtr def, virBufferAddLit(buf, "\n"); break; + case VIR_DOMAIN_FEATURE_GIC: + if (def->features[i] == VIR_TRISTATE_SWITCH_ON) { + virBufferAddLit(buf, "gic_version) + virBufferAsprintf(buf, " version='%u'", + def->gic_version); + virBufferAddLit(buf, "/>\n"); + } + break; + /* coverity[dead_error_begin] */ case VIR_DOMAIN_FEATURE_LAST: break; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index d2e3534..087d282 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1649,6 +1649,7 @@ typedef enum { VIR_DOMAIN_FEATURE_CAPABILITIES, VIR_DOMAIN_FEATURE_PMU, VIR_DOMAIN_FEATURE_VMPORT, + VIR_DOMAIN_FEATURE_GIC, VIR_DOMAIN_FEATURE_LAST } virDomainFeature; @@ -2179,6 +2180,7 @@ struct _virDomainDef { int hyperv_features[VIR_DOMAIN_HYPERV_LAST]; int kvm_features[VIR_DOMAIN_KVM_LAST]; unsigned int hyperv_spinlocks; + unsigned int gic_version; /* These options are of type virTristateSwitch: ON = keep, OFF = drop */ int caps_features[VIR_DOMAIN_CAPS_FEATURE_LAST];