Skip to content
  • Yongji Xie's avatar
    vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive · 05f0c03f
    Yongji Xie authored
    
    
    Current vfio-pci implementation disallows to mmap
    sub-page(size < PAGE_SIZE) MMIO BARs because these BARs' mmio
    page may be shared with other BARs. This will cause some
    performance issues when we passthrough a PCI device with
    this kind of BARs. Guest will be not able to handle the mmio
    accesses to the BARs which leads to mmio emulations in host.
    
    However, not all sub-page BARs will share page with other BARs.
    We should allow to mmap the sub-page MMIO BARs which we can
    make sure will not share page with other BARs.
    
    This patch adds support for this case. And we try to add a
    dummy resource to reserve the remainder of the page which
    hot-add device's BAR might be assigned into. But it's not
    necessary to handle the case when the BAR is not page aligned.
    Because we can't expect the BAR will be assigned into the same
    location in a page in guest when we passthrough the BAR. And
    it's hard to access this BAR in userspace because we have
    no way to get the BAR's location in a page.
    
    Signed-off-by: default avatarYongji Xie <xyjxie@linux.vnet.ibm.com>
    Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
    05f0c03f