]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Introduce GIC feature
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 27 Apr 2015 12:03:19 +0000 (14:03 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 5 May 2015 07:45:43 +0000 (09:45 +0200)
Some platforms, like aarch64, don't have APIC but GIC. So there's
no reason to have <apic/> feature turned on. However, we are
still missing <gic/> feature. This commit introduces the feature
to XML parser and formatter, adds documentation and updates RNG
schema.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h

index d484152934f3cea3e9ac4b29356a3c58a16fd5d8..fe7f9c559cd9ed73c4520cd05e073d93cc11be58 100644 (file)
       &lt;hidden state='on'/&gt;
     &lt;/kvm&gt;
     &lt;pvspinlock/&gt;
+    &lt;gic version='2'/&gt;
 
   &lt;/features&gt;
   ...</pre>
         the emulation of VMWare IO port, for vmmouse etc.
         <span class="since">Since 1.2.16</span>
       </dd>
+      <dt><code>gic</code></dt>
+      <dd>Enable for architectures using a General Interrupt
+          Controller instead of APIC in order to handle interrupts.
+          For example, the 'aarch64' architecture uses
+          <code>gic</code> instead of <code>apic</code>. The optional
+          attribute <code>version</code> specifies the GIC version;
+          however, it may not be supported by all hypervisors. <span
+          class="since">Since 1.2.16</span>
+      </dd>
     </dl>
 
     <h3><a name="elementsTime">Time keeping</a></h3>
index 64d22eaf22ae3f07c4a6be8ebb9af50a27736986..c151e92974d298b93d9f4a2c3cab77ffb48bc4c5 100644 (file)
     </element>
   </define>
   <!--
-      A set of optional features: PAE, APIC, ACPI,
+      A set of optional features: PAE, APIC, ACPI, GIC,
       HyperV Enlightenment, KVM features, paravirtual spinlocks and HAP support
     -->
   <define name="features">
               </optional>
             </element>
           </optional>
+          <optional>
+            <element name="gic">
+              <optional>
+                <attribute name="version">
+                  <ref name="positiveInteger"/>
+                </attribute>
+              </optional>
+            </element>
+          </optional>
         </interleave>
       </element>
     </optional>
index fe8b8caac72fb74cc05123e40b39264aaf57a52f..4cd36a106604a1c8840f2df56c0e78dcf7b1a1af 100644 (file)
@@ -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, "</capabilities>\n");
                 break;
 
+            case VIR_DOMAIN_FEATURE_GIC:
+                if (def->features[i] == VIR_TRISTATE_SWITCH_ON) {
+                    virBufferAddLit(buf, "<gic");
+                    if (def->gic_version)
+                        virBufferAsprintf(buf, " version='%u'",
+                                          def->gic_version);
+                    virBufferAddLit(buf, "/>\n");
+                }
+                break;
+
             /* coverity[dead_error_begin] */
             case VIR_DOMAIN_FEATURE_LAST:
                 break;
index d2e3534b9520f326d0cb1af29089426b3fe4db19..087d282e28efed4ba8285d4bc3f7994314b11438 100644 (file)
@@ -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];