mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: simplify qemuDomainGetMemLockLimitBytes()
This function goes through a loop checking if each hostdev is a VFIO or mdev device, and then later it calls virDomainDefHasNVMEDisk(). The function qemuDomainNeedsVFIO() does exactly the same thing, so let's just call that instead. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
43d8d16161
commit
0789edc86a
@ -9258,8 +9258,6 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def,
|
|||||||
bool forceVFIO)
|
bool forceVFIO)
|
||||||
{
|
{
|
||||||
unsigned long long memKB = 0;
|
unsigned long long memKB = 0;
|
||||||
bool usesVFIO = false;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
/* prefer the hard limit */
|
/* prefer the hard limit */
|
||||||
if (virMemoryLimitIsSet(def->mem.hard_limit)) {
|
if (virMemoryLimitIsSet(def->mem.hard_limit)) {
|
||||||
@ -9296,20 +9294,7 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def,
|
|||||||
*
|
*
|
||||||
* Note that this may not be valid for all platforms.
|
* Note that this may not be valid for all platforms.
|
||||||
*/
|
*/
|
||||||
if (!forceVFIO) {
|
if (forceVFIO || qemuDomainNeedsVFIO(def))
|
||||||
for (i = 0; i < def->nhostdevs; i++) {
|
|
||||||
if (virHostdevIsVFIODevice(def->hostdevs[i]) ||
|
|
||||||
virHostdevIsMdevDevice(def->hostdevs[i])) {
|
|
||||||
usesVFIO = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (virDomainDefHasNVMeDisk(def))
|
|
||||||
usesVFIO = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (usesVFIO || forceVFIO)
|
|
||||||
memKB = virDomainDefGetMemoryTotal(def) + 1024 * 1024;
|
memKB = virDomainDefGetMemoryTotal(def) + 1024 * 1024;
|
||||||
|
|
||||||
return memKB << 10;
|
return memKB << 10;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user