Current vfio-pci implementation disallows to mmap sub-page(size < PAGE_SIZE) MMIO BARs and MSI-X table. This is because sub-page BARs' mmio page may be shared with other BARs and MSI-X table should not be accessed directly from the guest for security reasons. But these would cause some performance issues for mmio accesses in guest when vfio passthrough sub-page BARs or BARs containing MSI-X table on PPC64 platform. This is because PAGE_SIZE is 64KB by default on PPC64 platform and the big page may easily hit the sub-page MMIO BARs' unmmapping and cause the unmmaping of the mmio page which MSI-X table locate in, which lead to mmio emulation in host. For sub-page MMIO BARs' unmmapping, this patch set enforces all MMIO BARs to be page aligned on PPC64 platform so that sub-page BAR's mmio page would not be shared with other BARs. Then we can mmap sub-page MMIO BARs in vfio-pci driver if all MMIO BARs are page aligned. For MSI-X table's unmmapping, we think MSI-X table is safe to access directly from the guest with EEH mechanism enabled which can ensure that a given pci device can only shoot the MSIs assigned for its PE. So we add support for mmapping MSI-X table in vfio-pci driver if EEH is supported. With this patch set applied, we can get almost 100% improvement on performance for mmio accesses when we passthrough sub-page BARs in our test. The last two patches in the patch set can be used by qemu to: - Add support for a VFIO-PCI ioctl to indicate that platform support all PCI BARs are page aligned. - Add support for a VFIO-PCI ioctl to indicate that platform support mmapping MSI-X table. Yongji Xie (3): powerpc/pci: Enforce all MMIO BARs to be page aligned vfio-pci: Allow to mmap sub-page MMIO BARs if all MMIO BARs are page aligned vfio-pci: Allow to mmap MSI-X table if EEH is supported arch/powerpc/kernel/pci-common.c | 10 +++++++++- drivers/vfio/pci/vfio_pci.c | 15 +++++++++++++-- drivers/vfio/pci/vfio_pci_private.h | 10 ++++++++++ include/uapi/linux/vfio.h | 4 ++++ 4 files changed, 36 insertions(+), 3 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html