summaryrefslogtreecommitdiffstats
path: root/hw/vfio/common.c
diff options
context:
space:
mode:
authorYongji Xie2016-10-31 16:53:04 +0100
committerAlex Williamson2016-10-31 16:53:04 +0100
commit95251725e335af2b885e2ab33dd29c86f8084663 (patch)
tree03cc9d5501f66c63cb3c9ddf31cc2ee18a6c4baa /hw/vfio/common.c
parentvfio/pci: fix out-of-sync BAR information on reset (diff)
downloadqemu-95251725e335af2b885e2ab33dd29c86f8084663.tar.gz
qemu-95251725e335af2b885e2ab33dd29c86f8084663.tar.xz
qemu-95251725e335af2b885e2ab33dd29c86f8084663.zip
vfio: Add support for mmapping sub-page MMIO BARs
Now the kernel commit 05f0c03fbac1 ("vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive") allows VFIO to mmap sub-page BARs. This is the corresponding QEMU patch. With those patches applied, we could passthrough sub-page BARs to guest, which can help to improve IO performance for some devices. In this patch, we expand MemoryRegions of these sub-page MMIO BARs to PAGE_SIZE in vfio_pci_write_config(), so that the BARs could be passed to KVM ioctl KVM_SET_USER_MEMORY_REGION with a valid size. The expanding size will be recovered when the base address of sub-page BAR is changed and not page aligned any more in guest. And we also set the priority of these BARs' memory regions to zero in case of overlap with BARs which share the same page with sub-page BARs in guest. Signed-off-by: Yongji Xie <xyjxie@linux.vnet.ibm.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'hw/vfio/common.c')
-rw-r--r--hw/vfio/common.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index f528309b81..801578b4b9 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -670,8 +670,7 @@ int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *region,
region, name, region->size);
if (!vbasedev->no_mmap &&
- region->flags & VFIO_REGION_INFO_FLAG_MMAP &&
- !(region->size & ~qemu_real_host_page_mask)) {
+ region->flags & VFIO_REGION_INFO_FLAG_MMAP) {
ret = vfio_setup_region_sparse_mmaps(region, info);