[PATCH v3 01/12] clk: tegra: Implement memory-controller clock

2014-10-13 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com The memory controller clock runs either at half or the same frequency as the EMC clock. Signed-off-by: Thierry Reding tred...@nvidia.com --- Changes in v3: - split registration into a separate function that can be reused for all SoC generations, but pass

[PATCH v4 03/12] ARM: tegra: Move AHB Kconfig to drivers/amba

2014-10-13 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com This will allow the Kconfig option to be shared among 32-bit and 64-bit ARM. Signed-off-by: Thierry Reding tred...@nvidia.com --- Changes in v4: - add precursory patch introducing drivers/amba/Kconfig, rebase on top Changes in v3: - select ARM_AMBA from

[PATCH 07/12] ARM: tegra: Add memory controller support for Tegra30

2014-10-13 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com Collapses the old memory-controller and IOMMU device tree nodes into a single node to more accurately describe the hardware. While this is an incompatible change there are no users of the IOMMU on Tegra, even though a driver has existed for some time.

[PATCH 02/12] amba: Add Kconfig file

2014-10-13 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com Rather than duplicate the ARM_AMBA Kconfig symbol in both 32-bit and 64-bit ARM architectures, move the common definition to drivers/amba where dependent drivers will be located. Signed-off-by: Thierry Reding tred...@nvidia.com --- arch/arm/Kconfig |

[PATCH 06/12] ARM: tegra: Add memory controller support for Tegra20

2014-10-13 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com Collapses the old memory-controller and IOMMU device tree nodes into a single node to more accurately describe the hardware. Note that this is an incompatible change, but while a GART driver has existed for a few years it has never been used to do any

[PATCH 10/12] ARM: tegra: Enable IOMMU for display controllers on Tegra30

2014-10-13 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com Add iommus properties to the device tree nodes for the two display controllers found on Tegra30. This will allow the display controllers to map physically non-contiguous buffers to I/O virtual contiguous address spaces so that they can be used for scan-out.

[PATCH 04/12] of: Add NVIDIA Tegra memory controller binding

2014-10-13 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com The memory controller on NVIDIA Tegra exposes various knobs that can be used to tune the behaviour of the clients attached to it. In addition, the memory controller implements an SMMU (IOMMU) which can translate I/O virtual addresses to physical addresses

[PATCH 09/12] ARM: tegra: Add memory controller support for Tegra124

2014-10-13 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com Add the memory controller and wire up the interrupt that is used to report errors. Provide a reference to the memory controller clock and mark the device as being an IOMMU by adding an #iommu-cells property. Signed-off-by: Thierry Reding tred...@nvidia.com

[PATCH v4 05/12] memory: Add NVIDIA Tegra memory controller support

2014-10-13 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com The memory controller on NVIDIA Tegra exposes various knobs that can be used to tune the behaviour of the clients attached to it. Currently this driver sets up the latency allowance registers to the HW defaults. Eventually an API should be exported by this

[PATCH 08/12] ARM: tegra: Add memory controller support for Tegra114

2014-10-13 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com Add the device tree node for the memory controller found on Tegra114 SoCs. The memory controller integrates an IOMMU (called SMMU) as well as various knobs to tweak memory accesses by the various clients. The old IOMMU device tree node is collapsed into

[PATCH 12/12] ARM: tegra: Enable IOMMU for display controllers on Tegra124

2014-10-13 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com Add iommus properties to the device tree nodes for the two display controllers found on Tegra124. This will allow the display controllers to map physically non-contiguous buffers to I/O virtual contiguous address spaces so that they can be used for

[PATCH 0/3] iommu: replace IOMMU_EXEC with IOMMU_EXEC and update ARM SMMU driver

2014-10-13 Thread Antonios Motakis
This patch series applies to Joerg Roedel's iommu/next branch, commit 09b5269a. It replaces the IOMMU_EXEC flag used by the ARM SMMU driver to IOMMU_NOEXEC. This is more enforceable, since the lack of the flag on hardware that doesn't support it implies that the target memory will be executable.

[PATCH 3/3] iommu/arm-smmu: add IOMMU_CAP_NOEXEC to the ARM SMMU driver

2014-10-13 Thread Antonios Motakis
The ARM SMMU supports the IOMMU_NOEXEC protection flag. Add the corresponding IOMMU capability. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/iommu/arm-smmu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c

[PATCH 2/3] iommu: add capability IOMMU_CAP_NOEXEC

2014-10-13 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 Acked-by: Joerg Roedel jroe...@suse.de --- include/linux/iommu.h | 1 + 1 file changed, 1

[PATCH] driver core: amba: add device binding path 'driver_override'

2014-10-13 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]

[PATCH 0/5] vfio: type1: support for ARM SMMUS with VFIO_IOMMU_TYPE1

2014-10-13 Thread Antonios Motakis
This patch series makes the VFIO_IOMMU_TYPE1 driver buildable on ARM, so it may be used with ARM SMMUs. It also adds support for the IOMMU_NOEXEC flag supported by SMMUs adhering to the ARM SMMU specification so the VFIO user can specify whether the target memory can be executed by the device

[PATCH 3/5] vfio: type1: replace domain wide protection flags with supported capabilities

2014-10-13 Thread Antonios Motakis
VFIO_IOMMU_TYPE1 keeps track for each domain it knows a list of protection flags it always applies to all mappings in the domain. This is used for domains that support IOMMU_CAP_CACHE_COHERENCY. Refactor this slightly, by keeping track instead that a given domain supports the capability, and

[PATCH 4/5] vfio: type1: replace vfio_domains_have_iommu_cache with generic function

2014-10-13 Thread Antonios Motakis
Replace the function vfio_domains_have_iommu_cache() with a more generic function vfio_domains_have_iommu_cap() which allows to check all domains of an vfio_iommu structure for a given cached capability. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com ---

[PATCH 2/5] vfio: introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag

2014-10-13 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_DMA_NOEXEC_IOMMU. 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

[PATCH 5/5] vfio/iommu_type1: implement the VFIO_DMA_MAP_FLAG_NOEXEC flag

2014-10-13 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

[PATCH v8 00/18] VFIO support for platform and AMBA devices on ARM

2014-10-13 Thread Antonios Motakis
This patch series aims to implement VFIO support for platform devices that reside behind an IOMMU. Examples of such devices are devices behind an ARM SMMU, or behind a Samsung Exynos System MMU. The API used is based on the existing VFIO API that is also used with PCI devices. Only devices that

[PATCH v8 03/18] vfio: platform: add the VFIO PLATFORM module to Kconfig

2014-10-13 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 +

[PATCH v8 04/18] vfio: amba: VFIO support for AMBA devices

2014-10-13 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 +

[PATCH v8 02/18] vfio: platform: probe to devices on the platform bus

2014-10-13 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 | 107 ++

[PATCH v8 06/18] vfio/platform: return info for bound device

2014-10-13 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.

[PATCH v8 07/18] vfio/platform: return info for device memory mapped IO regions

2014-10-13 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 | 93 +--

[PATCH v8 08/18] vfio/platform: read and write support for the device fd

2014-10-13 Thread Antonios Motakis
VFIO returns a file descriptor which we can use to manipulate the memory regions of the device. Usually, the user will mmap memory regions that are addressable on page boundaries, however for memory regions where this is not the case we cannot provide mmap functionality due to security concerns.

[PATCH v8 09/18] vfio/platform: support MMAP of MMIO regions

2014-10-13 Thread Antonios Motakis
Allow to memory map the MMIO regions of the device so userspace can directly access them. PIO regions are not being handled at this point. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/platform/vfio_platform_common.c | 57 1 file

[PATCH v8 05/18] vfio: amba: add the VFIO for AMBA devices module to Kconfig

2014-10-13 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

[PATCH v8 14/18] vfio: move eventfd support code for VFIO_PCI to a separate file

2014-10-13 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

[PATCH v8 15/18] vfio: add local lock in virqfd instead of depending on VFIO PCI

2014-10-13 Thread Antonios Motakis
Virqfd just needs to keep accesses to any struct *virqfd safe, but this comes into play only when creating or destroying eventfds, so sharing the same spinlock with the VFIO bus driver is not necessary. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com ---

[PATCH v8 12/18] vfio/platform: trigger an interrupt via eventfd

2014-10-13 Thread Antonios Motakis
This patch allows to set an eventfd for a patform device's interrupt, and also to trigger the interrupt eventfd from userspace for testing. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/platform/vfio_platform_irq.c | 83 ++-

[PATCH v8 13/18] vfio/platform: support for maskable and automasked interrupts

2014-10-13 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 ---

[PATCH v8 11/18] vfio/platform: initial interrupts support code

2014-10-13 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 | 52 +++--

[PATCH v8 18/18] vfio/platform: implement IRQ masking/unmasking via an eventfd

2014-10-13 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 | 46 ---

Re: [PATCH] driver core: amba: add device binding path 'driver_override'

2014-10-13 Thread Kim Phillips
On Mon, 13 Oct 2014 15:07:34 +0200 Antonios Motakis a.mota...@virtualopensystems.com 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