1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-04-01 20:05:19 +00:00

qemu: Introduce virQEMUCapsHaveAccel

The function should be used to check if qemu capabilities include a
hardware acceleration, i.e. accel is not TCG.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Roman Bolshakov 2018-10-19 18:10:05 +03:00 committed by Andrea Bolognani
parent a8643c53fb
commit 6b94f4d1b1

View File

@ -846,6 +846,13 @@ virQEMUCapsTypeIsAccelerated(virDomainVirtType type)
}
static bool
virQEMUCapsHaveAccel(virQEMUCaps *qemuCaps)
{
return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM);
}
static const char *
virQEMUCapsAccelStr(virDomainVirtType type)
{
@ -5019,7 +5026,7 @@ virQEMUCapsIsValid(void *data,
return false;
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
if (virQEMUCapsHaveAccel(qemuCaps)) {
if (STRNEQ_NULLABLE(priv->hostCPUSignature, qemuCaps->hostCPUSignature)) {
VIR_DEBUG("Outdated capabilities for '%s': host CPU changed "
"('%s' vs '%s')",
@ -5053,7 +5060,9 @@ virQEMUCapsIsValid(void *data,
qemuCaps->binary);
return false;
}
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
kvmSupportsNesting = virQEMUCapsKVMSupportsNesting();
if (kvmSupportsNesting != qemuCaps->kvmSupportsNesting) {
VIR_DEBUG("Outdated capabilities for '%s': kvm kernel nested "
@ -5518,7 +5527,7 @@ virQEMUCapsInitQMP(virQEMUCaps *qemuCaps,
* for TCG capabilities by asking the same binary again and turning KVM
* off.
*/
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) &&
if (virQEMUCapsHaveAccel(qemuCaps) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_TCG) &&
virQEMUCapsInitQMPSingle(qemuCaps, libDir, runUid, runGid, true) < 0)
return -1;
@ -5582,13 +5591,15 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch,
virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KVM);
virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_QEMU);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
if (virQEMUCapsHaveAccel(qemuCaps)) {
qemuCaps->hostCPUSignature = g_strdup(hostCPUSignature);
qemuCaps->microcodeVersion = microcodeVersion;
qemuCaps->cpuData = virCPUDataNewCopy(cpuData);
qemuCaps->kernelVersion = g_strdup(kernelVersion);
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
qemuCaps->kvmSupportsNesting = virQEMUCapsKVMSupportsNesting();
qemuCaps->kvmSupportsSecureGuest = virQEMUCapsKVMSupportsSecureGuest();