Re: [RFC PATCH 3/3] vfio-pci: Allow to mmap MSI-X table if EEH is supported

2015-12-17 Thread yongji xie
On 2015/12/17 4:14, Alex Williamson wrote: On Fri, 2015-12-11 at 16:53 +0800, Yongji Xie wrote: Current vfio-pci implementation disallows to mmap MSI-X table in case that user get to touch this directly. However, EEH mechanism could ensure that a given pci device can only shoot the MSIs

Re: [RFC PATCH 2/3] vfio-pci: Allow to mmap sub-page MMIO BARs if all MMIO BARs are page aligned

2015-12-17 Thread yongji xie
On 2015/12/17 4:04, Alex Williamson wrote: On Fri, 2015-12-11 at 16:53 +0800, Yongji Xie wrote: 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. But we should allow to mmap these sub-page M

[RFC PATCH 2/3] vfio-pci: Allow to mmap sub-page MMIO BARs if all MMIO BARs are page aligned

2015-12-11 Thread Yongji Xie
her BARs. This patch adds support for this case and we also add a VFIO_DEVICE_FLAGS_PCI_PAGE_ALIGNED flag to notify userspace that platform supports all MMIO BARs to be page aligned. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/vfio/pci/vfio_pci.c

[RFC PATCH 1/3] powerpc/pci: Enforce all MMIO BARs to be page aligned

2015-12-11 Thread Yongji Xie
-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- arch/powerpc/kernel/pci-common.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 0f7a60f..6989e0f 100644 --- a/arch/powerpc/kernel/pci-common.c

Re: [RFC PATCH 2/3] vfio-pci: Allow to mmap sub-page MMIO BARs if all MMIO BARs are page aligned

2015-12-18 Thread yongji xie
On 2015/12/18 5:46, Alex Williamson wrote: On Thu, 2015-12-17 at 18:26 +0800, yongji xie wrote: On 2015/12/17 4:04, Alex Williamson wrote: On Fri, 2015-12-11 at 16:53 +0800, Yongji Xie wrote: Current vfio-pci implementation disallows to mmap sub-page(size < PAGE_SIZE) MMIO BARs beca

[RFC PATCH 0/3] vfio-pci: Allow to mmap sub-page MMIO BARs and MSI-X table on PPC64 platform

2015-12-11 Thread Yongji Xie
orm 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 p

[RFC PATCH 3/3] vfio-pci: Allow to mmap MSI-X table if EEH is supported

2015-12-11 Thread Yongji Xie
userspace that it's safe to mmap MSI-X table. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/vfio/pci/vfio_pci.c |5 - drivers/vfio/pci/vfio_pci_private.h |5 + include/uapi/linux/vfio.h |2 ++ 3 files changed, 11 insertions(+), 1 de

[RFC PATCH v2 0/3] vfio-pci: Allow to mmap sub-page MMIO BARs and MSI-X table on PPC64 platform

2015-12-31 Thread Yongji Xie
ags: VFIO_DEVICE_FLAGS_PCI_PAGE_ALIGNED VFIO_DEVICE_FLAGS_PCI_MSIX_MMAP - Add a Kconfig option to support for mmapping MSI-X table. [1] https://lkml.org/lkml/2015/11/23/748 Yongji Xie (3): PCI: Add support for enforcing all MMIO BARs to be page aligned vfio-pci: Allow to mmap sub-page MMIO BARs if all MMIO B

[RFC PATCH v2 2/3] vfio-pci: Allow to mmap sub-page MMIO BARs if all MMIO BARs are page aligned

2015-12-31 Thread Yongji Xie
IZE. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/vfio/pci/vfio_pci.c |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 7e9f497..09b3805 100644 --- a/drivers/vfio/pci/vfio_pci.c +++

[RFC PATCH v2 3/3] vfio-pci: Allow to mmap MSI-X table if EEH is supported

2015-12-31 Thread Yongji Xie
for mmapping MSI-X table. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/vfio/pci/Kconfig|4 drivers/vfio/pci/vfio_pci.c |6 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig index 0

[RFC PATCH v2 1/3] PCI: Add support for enforcing all MMIO BARs to be page aligned

2015-12-31 Thread Yongji Xie
ts PAGE_SIZE is 64KB. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- Documentation/kernel-parameters.txt |4 arch/powerpc/include/asm/pci.h | 11 +++ drivers/pci/pci.c | 17 + drivers/pci/pci.h |7 ++

Re: [RFC PATCH v2 3/3] vfio-pci: Allow to mmap MSI-X table if EEH is supported

2016-01-06 Thread Yongji Xie
On 2016/1/5 5:42, Benjamin Herrenschmidt wrote: On Mon, 2016-01-04 at 14:07 -0700, Alex Williamson wrote: On Thu, 2015-12-31 at 16:50 +0800, Yongji Xie wrote: Current vfio-pci implementation disallows to mmap MSI-X table in case that user get to touch this directly. However, EEH mechanism can

Re: [RFC PATCH v2 1/3] PCI: Add support for enforcing all MMIO BARs to be page aligned

2016-01-05 Thread Yongji Xie
On 2016/1/5 4:47, Alex Williamson wrote: On Thu, 2015-12-31 at 16:50 +0800, Yongji Xie wrote: When vfio passthrough a PCI device of which MMIO BARs are smaller than PAGE_SIZE, guest will not handle the mmio accesses to the BARs which leads to mmio emulations in host. This is because vfio