int usbcontroller = 0;
int actualSerials = 0;
bool usblegacy = false;
- bool mlock = false;
int contOrder[] = {
/*
* List of controller types that we add commandline args for,
virCommandAddArgFormat(cmd, "mlock=%s",
def->mem.locked ? "on" : "off");
}
- mlock = def->mem.locked;
virCommandAddArg(cmd, "-smp");
if (!(smp = qemuBuildSmpArgStr(def, qemuCaps)))
"supported by this version of qemu"));
goto error;
}
- /* VFIO requires all of the guest's memory to be locked
- * resident */
- mlock = true;
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
goto error;
}
- if (mlock)
+ /* In some situations, eg. VFIO passthrough, QEMU might need to lock a
+ * significant amount of memory, so we need to set the limit accordingly */
+ if (qemuDomainRequiresMlock(def))
virCommandSetMaxMemLock(cmd, qemuDomainGetMlockLimitBytes(def));
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MSG_TIMESTAMP) &&