On 03/21/2016 01:28 PM, Andrea Bolognani wrote:
Take the GIC capabilities stored in a virQEMUCaps instance and
update a virDomainCaps instance appropriately.
---
src/qemu/qemu_capabilities.c | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
I think domaincapstest.c should be modified to add a (new) 2.6 version
of the *.caps file. One that has the supported='yes' set.
and this is probably where the docs get modified to add the new elements...
diff --git a/src/qemu/qemu_capabilities.c
b/src/qemu/qemu_capabilities.c
index e54208a..64007f0 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4065,6 +4065,41 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
}
+static int
+virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qemuCaps,
+ virDomainCapsPtr domCaps)
+{
+ 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))
+ continue;
For these, patch 6 would need to be already in place I think if
circumstances were "just right" (so to speak).
+
+ gic->supported = true;
+ VIR_DOMAIN_CAPS_ENUM_SET(gic->version,
+ cap->version);
Can there be more than one? How is that handled!
IOW: Once we print, do we just break;?
John
+ }
+
+ return 0;
+}
+
+
int
virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
virQEMUCapsPtr qemuCaps,
@@ -4081,7 +4116,8 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
if (virQEMUCapsFillDomainOSCaps(qemuCaps, os,
loader, nloader) < 0 ||
virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, domCaps->machine, disk) < 0
||
- virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0)
+ virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0 ||
+ virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) < 0)
return -1;
return 0;
}