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(a)redhat.com>
---
src/qemu/qemu_domain.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 8f77e8fc58..2f6b32e394 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9564,7 +9564,7 @@ qemuDomainGetNumNVMeDisks(const virDomainDef *def)
static int
-qemuDomainGetNumVDPANetDevices(const virDomainDef *def)
+qemuDomainGetNumVDPADevices(const virDomainDef *def)
{
size_t i;
int n = 0;
@@ -9574,6 +9574,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;
}
@@ -9616,7 +9624,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.
*
--
2.40.1