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@xxxxxxxxxx> Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- 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 c7d64e1b5c..52ea8f649d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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. * -- 2.41.0