vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive
authorYongji Xie <xyjxie@linux.vnet.ibm.com>
Thu, 30 Jun 2016 07:21:24 +0000 (15:21 +0800)
committerAlex Williamson <alex.williamson@redhat.com>
Fri, 8 Jul 2016 16:06:04 +0000 (10:06 -0600)
commit05f0c03fbac1819e86c9d5db4e208b68fc1b9b5e
tree9bd1c755a90f8f2cc6d34b7e191f3b6b92207a49
parent9698cbf0bea6b9f5c3190ce97bdf8963c0148671
vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

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: Yongji Xie <xyjxie@linux.vnet.ibm.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/vfio_pci.c
drivers/vfio/pci/vfio_pci_private.h
This page took 0.034302 seconds and 5 git commands to generate.