]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: Add pcibios_default_alignment() for arch-specific alignment control
authorYongji Xie <elohimes@gmail.com>
Mon, 10 Apr 2017 11:58:12 +0000 (19:58 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 19 Apr 2017 17:51:25 +0000 (12:51 -0500)
commit32e2b3ee206c2466cfa386782403c04b46bceb66
tree333c248bd0b7d7abbd8b249cd63e0f5753f3c267
parenteb302a1b27aeda7f746e5072e820f56baf1498b0
PCI: Add pcibios_default_alignment() for arch-specific alignment control

When VFIO passes through a PCI device to a guest, it does not allow the
guest to mmap BARs that are smaller than PAGE_SIZE unless it can reserve
the rest of the page (see vfio_pci_probe_mmaps()). This is because a page
might contain several small BARs for unrelated devices and a guest should
not be able to access all of them.

VFIO emulates guest accesses to non-mappable BARs, which is functional but
slow. On systems with large page sizes, e.g., PowerNV with 64K pages, BARs
are more likely to share a page and performance is more likely to be a
problem.

Add a weak function to set default alignment for all PCI devices.  An arch
can override it to force the PCI core to place memory BARs on their own
pages.

Signed-off-by: Yongji Xie <elohimes@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci.c