Currently, virtio_pci_queue_mem_mult function always returns 4K
when VIRTIO_PCI_FLAG_PAGE_PER_VQ is set. But this won't
work for vhost vdpa when host has page size other than 4K.
This patch introduces a new property(host-page-per-vq) for vdpa
use case to fix the same.
Signed-off-by: Srujana Challa <schalla@marvell.com>
---
v2->v3:
- Modified property name, page-per-vdpa-vq to host-page-per-vq.
v1->v2:
- Introduced a new property to get virtqueue mem multiplier for
vdpa use case.
hw/virtio/virtio-pci.c | 10 ++++++++--
include/hw/virtio/virtio-pci.h | 5 +++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 1a7039fb0c..f29e60830b 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -320,8 +320,12 @@ static bool virtio_pci_ioeventfd_enabled(DeviceState *d)
static inline int virtio_pci_queue_mem_mult(struct VirtIOPCIProxy *proxy)
{
- return (proxy->flags & VIRTIO_PCI_FLAG_PAGE_PER_VQ) ?
- QEMU_VIRTIO_PCI_QUEUE_MEM_MULT : 4;
+ if (proxy->flags & VIRTIO_PCI_FLAG_PAGE_PER_VQ)
+ return QEMU_VIRTIO_PCI_QUEUE_MEM_MULT;
+ else if (proxy->flags & VIRTIO_PCI_FLAG_HOST_PAGE_PER_VQ)
+ return qemu_real_host_page_size();
+ else
+ return 4;