Re: [RFC PATCH v3 6/7] arm: call iommu_init before of_platform_populate

2014-09-23 Thread Thierry Reding
On Tue, Sep 23, 2014 at 09:44:25AM +0200, Arnd Bergmann wrote: On Tuesday 23 September 2014 09:02:39 Thierry Reding wrote: I see two problems with using deferred probing here: - we don't actually need to defer the probing but the binding to the driver when no dma ops are

[PATCHv7 01/26] iommu/arm-smmu: change IOMMU_EXEC to IOMMU_NOEXEC

2014-09-23 Thread Antonios Motakis
Exposing the XN flag of the SMMU driver as IOMMU_NOEXEC instead of IOMMU_EXEC makes it enforceable, since for IOMMUs that don't support the XN flag pages will always be executable. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/iommu/arm-smmu.c | 9 +

[PATCHv7 02/26] iommu: add capability IOMMU_CAP_NOEXEC

2014-09-23 Thread Antonios Motakis
Some IOMMUs accept an IOMMU_NOEXEC protection flag in addition to IOMMU_READ and IOMMU_WRITE. Expose this as an IOMMU capability. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- include/linux/iommu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/iommu.h

[PATCHv7 06/26] vfio/iommu_type1: implement the VFIO_DMA_MAP_FLAG_NOEXEC flag

2014-09-23 Thread Antonios Motakis
Some IOMMU drivers, such as the ARM SMMU driver, make available the IOMMU_NOEXEC flag, to set the page tables for a device as XN (execute never). This affects devices such as the ARM PL330 DMA Controller, which respects this flag and will refuse to fetch DMA instructions from memory where the XN

[PATCHv7 05/26] vfio: introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag

2014-09-23 Thread Antonios Motakis
We introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag to the VFIO dma map call, and expose its availability via the capability VFIO_IOMMU_PROT_NOEXEC. This way the user can control whether the XN flag will be set on the requested mappings. The IOMMU_NOEXEC flag needs to be available for all the IOMMUs of

[PATCHv7 07/26] driver core: amba: add device binding path 'driver_override'

2014-09-23 Thread Antonios Motakis
As already demonstrated with PCI [1] and the platform bus [2], a driver_override property in sysfs can be used to bypass the id matching of a device to a AMBA driver. This can be used by VFIO to bind to any AMBA device requested by the user. [1]

[PATCHv7 08/26] driver core: amba: add documentation for binding path 'driver_override'

2014-09-23 Thread Antonios Motakis
Add documentation for alternative binding path 'driver_override' for AMBA devices. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- Documentation/ABI/testing/sysfs-bus-amba | 20 1 file changed, 20 insertions(+) create mode 100644

[PATCHv7 04/26] vfio/iommu_type1: support for platform bus devices on ARM

2014-09-23 Thread Antonios Motakis
This allows to make use of the VFIO_IOMMU_TYPE1 driver with platform devices on ARM. The driver can then be used with an Exynos SMMU, or ARM SMMU driver. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1

[PATCHv7 10/26] vfio: platform: probe to devices on the platform bus

2014-09-23 Thread Antonios Motakis
Driver to bind to Linux platform devices, and callbacks to discover their resources to be used by the main VFIO PLATFORM code. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/platform/vfio_platform.c | 96 +++

[PATCHv7 12/26] vfio: amba: VFIO support for AMBA devices

2014-09-23 Thread Antonios Motakis
Add support for discovering AMBA devices with VFIO and handle them similarly to Linux platform devices. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/platform/vfio_amba.c | 108 ++ include/uapi/linux/vfio.h | 1 +

[PATCHv7 09/26] vfio/platform: initial skeleton of VFIO support for platform devices

2014-09-23 Thread Antonios Motakis
This patch forms the common skeleton code for platform devices support with VFIO. This will include the core functionality of VFIO_PLATFORM, however binding to the device and discovering the device resources will be done with the help of a separate file where any Linux platform bus specific code

[PATCHv7 11/26] vfio: platform: add the VFIO PLATFORM module to Kconfig

2014-09-23 Thread Antonios Motakis
Enable building the VFIO PLATFORM driver that allows to use Linux platform devices with VFIO. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/Kconfig | 1 + drivers/vfio/Makefile | 1 + drivers/vfio/platform/Kconfig | 9 +

[PATCHv7 15/26] vfio/platform: return info for device memory mapped IO regions

2014-09-23 Thread Antonios Motakis
This patch enables the IOCTLs VFIO_DEVICE_GET_REGION_INFO ioctl call, which allows the user to learn about the available MMIO resources of a device. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/platform/vfio_platform_common.c | 84 +--

[PATCHv7 13/26] vfio: amba: add the VFIO for AMBA devices module to Kconfig

2014-09-23 Thread Antonios Motakis
Enable building the VFIO AMBA driver. VFIO_AMBA depends on VFIO_PLATFORM, since it is sharing a portion of the code, and it is essentially implemented as a platform device whose resources are discovered via AMBA specific APIs in the kernel. Signed-off-by: Antonios Motakis

[PATCHv7 14/26] vfio/platform: return info for bound device

2014-09-23 Thread Antonios Motakis
A VFIO userspace driver will start by opening the VFIO device that corresponds to an IOMMU group, and will use the ioctl interface to get the basic device info, such as number of memory regions and interrupts, and their properties. This patch enables the VFIO_DEVICE_GET_INFO ioctl call.

[PATCHv7 17/26] vfio/platform: support MMAP of MMIO regions

2014-09-23 Thread Antonios Motakis
Allow to memory map the MMIO regions of the device so userspace can directly access them. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/platform/vfio_platform_common.c | 40 +++- 1 file changed, 39 insertions(+), 1 deletion(-) diff

[PATCHv7 18/26] vfio/platform: return IRQ info

2014-09-23 Thread Antonios Motakis
Return information for the interrupts exposed by the device. This patch extends VFIO_DEVICE_GET_INFO with the number of IRQs and enables VFIO_DEVICE_GET_IRQ_INFO. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/platform/Makefile| 2 +-

[PATCHv7 22/26] vfio: move eventfd support code for VFIO_PCI to a separate file

2014-09-23 Thread Antonios Motakis
The virqfd functionality that is used by VFIO_PCI to implement interrupt masking and unmasking via an eventfd, is generic enough and can be reused by another driver. Move it to a separate file in order to allow the code to be shared. Also properly export virqfd_enable and virqfd_disable in the

[PATCHv7 19/26] vfio/platform: initial interrupts support code

2014-09-23 Thread Antonios Motakis
This patch is a skeleton for the VFIO_DEVICE_SET_IRQS IOCTL, around which most IRQ functionality is implemented in VFIO. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/platform/vfio_platform_common.c | 41 ++--

[PATCHv7 21/26] vfio/platform: support for maskable and automasked interrupts

2014-09-23 Thread Antonios Motakis
Adds support to mask interrupts, and also for automasked interrupts. Level sensitive interrupts are exposed as automasked interrupts and are masked and disabled automatically when they fire. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com ---

[PATCHv7 25/26] vfio: initialize the virqfd workqueue in VFIO generic code

2014-09-23 Thread Antonios Motakis
Now we have finally completely decoupled virqfd from VFIO_PCI. We can initialize it from the VFIO generic code, in order to safely use it from multiple independent VFIO bus drivers. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/pci/vfio_pci.c | 8

[PATCHv7 24/26] vfio: pass an opaque pointer on virqfd initialization

2014-09-23 Thread Antonios Motakis
VFIO_PCI passes the VFIO device structure *vdev via eventfd to the handler that implements masking/unmasking of IRQs via an eventfd. We can replace it in the virqfd infrastructure with an opaque type so we can make use of the mechanism from other VFIO bus drivers. Signed-off-by: Antonios Motakis

[PATCHv7 26/26] vfio/platform: implement IRQ masking/unmasking via an eventfd

2014-09-23 Thread Antonios Motakis
With this patch the VFIO user will be able to set an eventfd that can be used in order to mask and unmask IRQs of platform devices. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/platform/vfio_platform_irq.c | 48 +--

Re: [PATCHv7 01/26] iommu/arm-smmu: change IOMMU_EXEC to IOMMU_NOEXEC

2014-09-23 Thread Will Deacon
Hi Antonios, On Tue, Sep 23, 2014 at 03:46:00PM +0100, Antonios Motakis wrote: Exposing the XN flag of the SMMU driver as IOMMU_NOEXEC instead of IOMMU_EXEC makes it enforceable, since for IOMMUs that don't support the XN flag pages will always be executable. Signed-off-by: Antonios Motakis

Re: [PATCH 1/2] iommu/omap: Reverse dependency between omap-iommu and omap-iommu2

2014-09-23 Thread Suman Anna
Hi Laurent, On Tuesday 09 September 2014 17:31:44 Suman Anna wrote: On Tuesday 09 September 2014 16:33:11 Suman Anna wrote: On 09/09/2014 10:45 AM, Laurent Pinchart wrote: The OMAP IOMMU driver supports both the OMAP1 and OMAP2+ IOMMU variants by splitting the driver into a core module and

Re: [PATCH v1 00/21] Use MSI chip to configure MSI/MSI-X in all platforms

2014-09-23 Thread Bjorn Helgaas
On Fri, Sep 05, 2014 at 06:09:45PM +0800, Yijing Wang wrote: This series is based Bjorn's pci-next branch + Alexander Gordeev's two patches Remove arch_msi_check_device() link: https://lkml.org/lkml/2014/7/12/41 Currently, there are a lot of weak arch functions in MSI code. Thierry Reding

Re: [PATCHv7 01/26] iommu/arm-smmu: change IOMMU_EXEC to IOMMU_NOEXEC

2014-09-23 Thread Alex Williamson
On Tue, 2014-09-23 at 15:58 +0100, Will Deacon wrote: Hi Antonios, On Tue, Sep 23, 2014 at 03:46:00PM +0100, Antonios Motakis wrote: Exposing the XN flag of the SMMU driver as IOMMU_NOEXEC instead of IOMMU_EXEC makes it enforceable, since for IOMMUs that don't support the XN flag pages

Re: [PATCHv7 05/26] vfio: introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag

2014-09-23 Thread Alex Williamson
On Tue, 2014-09-23 at 16:46 +0200, Antonios Motakis wrote: We introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag to the VFIO dma map call, and expose its availability via the capability VFIO_IOMMU_PROT_NOEXEC. This way the user can control whether the XN flag will be set on the requested mappings.

Re: [PATCHv7 05/26] vfio: introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag

2014-09-23 Thread Alex Williamson
On Tue, 2014-09-23 at 16:21 -0600, Alex Williamson wrote: On Tue, 2014-09-23 at 16:46 +0200, Antonios Motakis wrote: We introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag to the VFIO dma map call, and expose its availability via the capability VFIO_IOMMU_PROT_NOEXEC. This way the user can control

Re: [PATCHv7 06/26] vfio/iommu_type1: implement the VFIO_DMA_MAP_FLAG_NOEXEC flag

2014-09-23 Thread Alex Williamson
On Tue, 2014-09-23 at 16:46 +0200, Antonios Motakis wrote: Some IOMMU drivers, such as the ARM SMMU driver, make available the IOMMU_NOEXEC flag, to set the page tables for a device as XN (execute never). This affects devices such as the ARM PL330 DMA Controller, which respects this flag and

Re: [PATCHv7 07/26] driver core: amba: add device binding path 'driver_override'

2014-09-23 Thread Alex Williamson
On Tue, 2014-09-23 at 16:46 +0200, Antonios Motakis wrote: As already demonstrated with PCI [1] and the platform bus [2], a driver_override property in sysfs can be used to bypass the id matching of a device to a AMBA driver. This can be used by VFIO to bind to any AMBA device requested by the

Re: [PATCHv7 10/26] vfio: platform: probe to devices on the platform bus

2014-09-23 Thread Alex Williamson
On Tue, 2014-09-23 at 16:46 +0200, Antonios Motakis wrote: Driver to bind to Linux platform devices, and callbacks to discover their resources to be used by the main VFIO PLATFORM code. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com ---

Re: [PATCHv7 13/26] vfio: amba: add the VFIO for AMBA devices module to Kconfig

2014-09-23 Thread Alex Williamson
On Tue, 2014-09-23 at 16:46 +0200, Antonios Motakis wrote: Enable building the VFIO AMBA driver. VFIO_AMBA depends on VFIO_PLATFORM, since it is sharing a portion of the code, and it is essentially implemented as a platform device whose resources are discovered via AMBA specific APIs in the

Re: [PATCH 2/2] iommu/arm-smmu: add support for iova_to_phys through ATS1PR

2014-09-23 Thread Mitchel Humpherys
On Mon, Sep 22 2014 at 08:26:14 AM, Will Deacon will.dea...@arm.com wrote: Hi Mitch, On Thu, Sep 11, 2014 at 07:30:44PM +0100, Mitchel Humpherys wrote: Currently, we provide the iommu_ops.iova_to_phys service by doing a table walk in software to translate IO virtual addresses to physical

Re: [PATCH v1 00/21] Use MSI chip to configure MSI/MSI-X in all platforms

2014-09-23 Thread Yijing Wang
On 2014/9/24 5:09, Bjorn Helgaas wrote: On Fri, Sep 05, 2014 at 06:09:45PM +0800, Yijing Wang wrote: This series is based Bjorn's pci-next branch + Alexander Gordeev's two patches Remove arch_msi_check_device() link: https://lkml.org/lkml/2014/7/12/41 Currently, there are a lot of weak arch