Skip to content
  • Yongji Xie's avatar
    vfio: Add support for mmapping sub-page MMIO BARs · 95251725
    Yongji Xie authored
    
    
    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: default avatarYongji Xie <xyjxie@linux.vnet.ibm.com>
    Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
    95251725