[PATCH 1/2] Add support for EOI with APIC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).
---
 docs/formatdomain.html.in     |  7 +++++++
 docs/schemas/domaincommon.rng |  9 ++++++++-
 src/conf/domain_conf.c        | 35 ++++++++++++++++++++++++++++++++++-
 src/conf/domain_conf.h        | 11 +++++++++++
 src/libvirt_private.syms      |  2 ++
 5 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 503685f..66319d0 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -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 toggle 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.
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index c2c6184..029c796 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2859,7 +2859,14 @@
           </optional>
           <optional>
             <element name="apic">
-              <empty/>
+              <optional>
+                <attribute name="eoi">
+                  <choice>
+                    <value>on</value>
+                    <value>off</value>
+                  </choice>
+                </attribute>
+              </optional>
             </element>
           </optional>
           <optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 292cc9a..89c08da 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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",
@@ -8621,6 +8626,28 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
                 goto error;
             }
             def->features |= (1 << val);
+            if (val == VIR_DOMAIN_FEATURE_APIC) {
+                char *attrstr = NULL;
+                if (virAsprintf(&attrstr,
+                                "string(./features/%s/@eoi)",
+                                nodes[i]->name) < 0)
+                    goto no_memory;
+
+                tmp = virXPathString(attrstr, ctxt);
+                if (tmp) {
+                    int eoi;
+                    if ((eoi = virDomainApicEoiTypeFromString(tmp)) < 0) {
+                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                                       _("unknown value for attribute eoi: %s"),
+                                       nodes[i]->name);
+                        VIR_FREE(tmp);
+                        goto error;
+                    }
+                    def->apic_eoi = eoi;
+                    VIR_FREE(tmp);
+                }
+                VIR_FREE(attrstr);
+            }
         }
         VIR_FREE(nodes);
     }
@@ -13413,7 +13440,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");
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3995c2d..86dae7d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1351,6 +1351,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,
@@ -1642,6 +1650,8 @@ struct _virDomainDef {
     virDomainOSDef os;
     char *emulator;
     int features;
+    /* enum virDomainApicEoi */
+    int apic_eoi;

     virDomainClockDef clock;

@@ -2104,6 +2114,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)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0494e1f..5dd9313 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -263,6 +263,8 @@ virBlkioDeviceWeightArrayClear;
 virDiskNameToBusDeviceIndex;
 virDiskNameToIndex;
 virDomainActualNetDefFree;
+virDomainApicEoiTypeFromString;
+virDomainApicEoiTypeToString;
 virDomainAssignDef;
 virDomainBlockedReasonTypeFromString;
 virDomainBlockedReasonTypeToString;
-- 
1.7.12

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]