qemu: consider vdpa block devices for memlock limits

vDPA block devices will also need the same consideration for memlock
limits as other vdpa devices, so consider these devices when calculating
memlock limits.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Jonathon Jongsma 2023-05-30 15:53:38 -05:00
parent 0ebb416d7e
commit 2efa9ba66a

View File

@ -9652,7 +9652,7 @@ qemuDomainGetNumNVMeDisks(const virDomainDef *def)
static int
qemuDomainGetNumVDPANetDevices(const virDomainDef *def)
qemuDomainGetNumVDPADevices(const virDomainDef *def)
{
size_t i;
int n = 0;
@ -9662,6 +9662,14 @@ qemuDomainGetNumVDPANetDevices(const virDomainDef *def)
n++;
}
for (i = 0; i < def->ndisks; i++) {
virStorageSource *src;
for (src = def->disks[i]->src; src; src = src->backingStore) {
if (src->type == VIR_STORAGE_TYPE_VHOST_VDPA)
n++;
}
}
return n;
}
@ -9704,7 +9712,7 @@ qemuDomainGetMemLockLimitBytes(virDomainDef *def)
nvfio = qemuDomainGetNumVFIOHostdevs(def);
nnvme = qemuDomainGetNumNVMeDisks(def);
nvdpa = qemuDomainGetNumVDPANetDevices(def);
nvdpa = qemuDomainGetNumVDPADevices(def);
/* For device passthrough using VFIO the guest memory and MMIO memory
* regions need to be locked persistent in order to allow DMA.
*