]> xenbits.xensource.com Git - libvirt.git/commitdiff
gic: Introduce VIR_GIC_VERSION_DEFAULT alias
authorAndrea Bolognani <abologna@redhat.com>
Thu, 18 Feb 2016 15:13:42 +0000 (16:13 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 19 Feb 2016 17:24:58 +0000 (18:24 +0100)
GIC v2 is the default, but checking against that specific version when
we want to know whether the default has been selected is potentially
error prone; using an alias instead makes it safer.

src/qemu/qemu_command.c
src/qemu/qemu_domain.c
src/util/virgic.h

index b751f043a4b8b2a0ce1194bffc64a67478f25841..287a2b933ca4b58c1b5f1c6055e01d35046ebeb6 100644 (file)
@@ -5306,10 +5306,9 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
                     return -1;
                 }
 
-                /* 2 is the default, so we don't put it as option for
-                 * backwards compatibility
-                 */
-                if (def->gic_version != VIR_GIC_VERSION_2) {
+                /* The default GIC version should not be specified on the
+                 * QEMU commandline for backwards compatibility reasons */
+                if (def->gic_version != VIR_GIC_VERSION_DEFAULT) {
                     if (!virQEMUCapsGet(qemuCaps,
                                         QEMU_CAPS_MACH_VIRT_GIC_VERSION)) {
                         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
index 4ea9a71f46b36cc031fce2b2fd7d107839a7d7e7..c56f9f1b960a4c2f4ca86163740587e53ea1b3d7 100644 (file)
@@ -1264,10 +1264,10 @@ qemuDomainDefEnableDefaultFeatures(virDomainDefPtr def)
         break;
     }
 
-    /* Default to GIC v2 if no version was specified */
+    /* Use the default GIC version if no version was specified */
     if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON &&
         def->gic_version == VIR_GIC_VERSION_NONE)
-        def->gic_version = VIR_GIC_VERSION_2;
+        def->gic_version = VIR_GIC_VERSION_DEFAULT;
 }
 
 
index a2ba3005f92643beb4fff3d98ef6d9c63c897565..470ce95c14884945e9474aee3617deb46705743e 100644 (file)
@@ -35,4 +35,7 @@ typedef enum {
 
 VIR_ENUM_DECL(virGICVersion);
 
+/* Consider GIC v2 the default */
+# define VIR_GIC_VERSION_DEFAULT VIR_GIC_VERSION_2
+
 #endif /* __VIR_GIC_H__ */