diff options
author | Yongji Xie <xyjxie@linux.vnet.ibm.com> | 2016-10-31 09:53:04 -0600 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2016-10-31 09:53:04 -0600 |
commit | 95251725e335af2b885e2ab33dd29c86f8084663 (patch) | |
tree | 03cc9d5501f66c63cb3c9ddf31cc2ee18a6c4baa /hw/vfio/common.c | |
parent | a52a4c471703e995ceb06f6157d70747823e8a0d (diff) | |
download | 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.c | 3 |
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); |