With this change virsh domcapabilites shows:
<mode name='host-passthrough' supported='yes'/>
Signed-off-by: Roman Bolshakov <r.bolshakov(a)yadro.com>
Reviewed-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 8a1fb2b5d9..4297a11b27 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -640,13 +640,15 @@ static const char *virQEMUCapsArchToString(virArch arch)
static bool
virQEMUCapsTypeIsAccelerated(virDomainVirtType type)
{
- return type == VIR_DOMAIN_VIRT_KVM;
+ return type == VIR_DOMAIN_VIRT_KVM ||
+ type == VIR_DOMAIN_VIRT_HVF;
}
static bool
virQEMUCapsHaveAccel(virQEMUCapsPtr qemuCaps)
{
- return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM);
+ return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF);
}
static virDomainVirtType
@@ -654,6 +656,8 @@ virQEMUCapsToVirtType(virQEMUCapsPtr qemuCaps)
{
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
return VIR_DOMAIN_VIRT_KVM;
+ else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF))
+ return VIR_DOMAIN_VIRT_HVF;
else
return VIR_DOMAIN_VIRT_QEMU;
}
@@ -663,6 +667,8 @@ virQEMUCapsAccelStr(virDomainVirtType type)
{
if (type == VIR_DOMAIN_VIRT_KVM) {
return "kvm";
+ } else if (type == VIR_DOMAIN_VIRT_HVF) {
+ return "hvf";
} else {
return "tcg";
}
@@ -3109,6 +3115,8 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
if (virtType == VIR_DOMAIN_VIRT_KVM)
hostCPUNode = virXPathNode("./hostCPU[@type='kvm']", ctxt);
+ else if (virtType == VIR_DOMAIN_VIRT_HVF)
+ hostCPUNode = virXPathNode("./hostCPU[@type='hvf']", ctxt);
else
hostCPUNode = virXPathNode("./hostCPU[@type='tcg']", ctxt);
@@ -3244,6 +3252,8 @@ virQEMUCapsLoadCPUModels(virQEMUCapsPtr qemuCaps,
if (type == VIR_DOMAIN_VIRT_KVM)
n = virXPathNodeSet("./cpu[@type='kvm']", ctxt, &nodes);
+ else if (type == VIR_DOMAIN_VIRT_HVF)
+ n = virXPathNodeSet("./cpu[@type='hvf']", ctxt, &nodes);
else
n = virXPathNodeSet("./cpu[@type='tcg']", ctxt, &nodes);
@@ -3542,11 +3552,15 @@ virQEMUCapsLoadCache(virArch hostArch,
if ((virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) &&
virQEMUCapsLoadHostCPUModelInfo(qemuCaps, ctxt, VIR_DOMAIN_VIRT_KVM) < 0) ||
+ (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF) &&
+ virQEMUCapsLoadHostCPUModelInfo(qemuCaps, ctxt, VIR_DOMAIN_VIRT_HVF) < 0) ||
virQEMUCapsLoadHostCPUModelInfo(qemuCaps, ctxt, VIR_DOMAIN_VIRT_QEMU) < 0)
goto cleanup;
if ((virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) &&
virQEMUCapsLoadCPUModels(qemuCaps, ctxt, VIR_DOMAIN_VIRT_KVM) < 0) ||
+ (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF) &&
+ virQEMUCapsLoadCPUModels(qemuCaps, ctxt, VIR_DOMAIN_VIRT_HVF) < 0) ||
virQEMUCapsLoadCPUModels(qemuCaps, ctxt, VIR_DOMAIN_VIRT_QEMU) < 0)
goto cleanup;
@@ -3661,6 +3675,8 @@ virQEMUCapsLoadCache(virArch hostArch,
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KVM);
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF))
+ virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_HVF);
virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_QEMU);
ret = 0;
@@ -3841,10 +3857,14 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps)
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
virQEMUCapsFormatHostCPUModelInfo(qemuCaps, &buf, VIR_DOMAIN_VIRT_KVM);
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF))
+ virQEMUCapsFormatHostCPUModelInfo(qemuCaps, &buf, VIR_DOMAIN_VIRT_HVF);
virQEMUCapsFormatHostCPUModelInfo(qemuCaps, &buf, VIR_DOMAIN_VIRT_QEMU);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
virQEMUCapsFormatCPUModels(qemuCaps, &buf, VIR_DOMAIN_VIRT_KVM);
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF))
+ virQEMUCapsFormatCPUModels(qemuCaps, &buf, VIR_DOMAIN_VIRT_HVF);
virQEMUCapsFormatCPUModels(qemuCaps, &buf, VIR_DOMAIN_VIRT_QEMU);
for (i = 0; i < qemuCaps->nmachineTypes; i++) {
@@ -4455,7 +4475,7 @@ virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd,
if (forceTCG)
machine = "none,accel=tcg";
else
- machine = "none,accel=kvm:tcg";
+ machine = "none,accel=kvm:hvf:tcg";
VIR_DEBUG("Try to probe capabilities of '%s' via QMP, machine %s",
cmd->binary, machine);
@@ -4646,6 +4666,8 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch,
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KVM);
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF))
+ virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_HVF);
virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_QEMU);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
--
2.19.1