@@ -4256,6 +4256,32 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
}
+static bool
+virQEMUCapsGICSupported(virArch arch,
+ virDomainVirtType virttype,
+ const char *machine,
+ virGICCapabilityPtr cap)
+{
+ if (arch != VIR_ARCH_ARMV7L &&
+ arch != VIR_ARCH_AARCH64)
+ return false;
+
+ if (STRNEQ(machine, "virt") &&
+ !STRPREFIX(machine, "virt-"))
+ return false;
+
+ if (virttype == VIR_DOMAIN_VIRT_KVM &&
+ !(cap->implementation & VIR_GIC_IMPLEMENTATION_KERNEL))
+ return false;
+
+ if (virttype == VIR_DOMAIN_VIRT_QEMU &&
+ !(cap->implementation & VIR_GIC_IMPLEMENTATION_EMULATED))
+ return false;
+
+ return true;
+}
+
+
/**
* virQEMUCapsFillDomainFeatureGICCaps:
* @qemuCaps: QEMU capabilities
@@ -4282,23 +4308,12 @@ virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qemuCaps,
virDomainCapsFeatureGICPtr gic = &domCaps->gic;
size_t i;
- if (domCaps->arch != VIR_ARCH_ARMV7L &&
- domCaps->arch != VIR_ARCH_AARCH64)
- return 0;
-
- if (STRNEQ(domCaps->machine, "virt") &&
- !STRPREFIX(domCaps->machine, "virt-"))
- return 0;
-
for (i = 0; i < qemuCaps->ngicCapabilities; i++) {
virGICCapabilityPtr cap = &qemuCaps->gicCapabilities[i];
-
- if (domCaps->virttype == VIR_DOMAIN_VIRT_KVM &&
- !(cap->implementation & VIR_GIC_IMPLEMENTATION_KERNEL))
- continue;
-
- if (domCaps->virttype == VIR_DOMAIN_VIRT_QEMU &&
- !(cap->implementation & VIR_GIC_IMPLEMENTATION_EMULATED))
+ if (!virQEMUCapsGICSupported(domCaps->arch,
+ domCaps->virttype,
+ domCaps->machine,
+ cap))
continue;
gic->supported = true;