[PATCH 3/4] iommu: add self-consistency tests to ARM LPAE IO page table allocator

2014-11-27 Thread Will Deacon
This patch adds a series of basic self-consistency tests to the ARM LPAE IO page table allocator that exercise corner cases in map/unmap, as well as testing all valid configurations of pagesize, ias and stage. Signed-off-by: Will Deacon will.dea...@arm.com --- drivers/iommu/Kconfig |

[PATCH 4/4] iommu/arm-smmu: make use of generic LPAE allocator

2014-11-27 Thread Will Deacon
The ARM SMMU can walk LPAE page tables, so make use of the generic allocator. Signed-off-by: Will Deacon will.dea...@arm.com --- arch/arm64/Kconfig | 1 - drivers/iommu/Kconfig| 6 +- drivers/iommu/arm-smmu.c | 872 ++- 3 files changed,

[PATCH 0/4] Generic IOMMU page table framework

2014-11-27 Thread Will Deacon
Hi all, This series introduces a generic IOMMU page table allocation framework, implements support for ARM long-descriptors and then ports the arm-smmu driver over to the new code. There are a few reasons for doing this: - Page table code is hard, and I don't enjoy shopping - A number of

[PATCH 2/4] iommu: add ARM LPAE page table allocator

2014-11-27 Thread Will Deacon
A number of IOMMUs found in ARM SoCs can walk architecture-compatible page tables. This patch adds a generic allocator for Stage-1 and Stage-2 v7/v8 long-descriptor page tables. 4k, 16k and 64k pages are supported, with up to 4-levels of walk to cover a 48-bit address space. Signed-off-by: Will

Re: [RFC PATCH 0/4] Genericise the IOVA allocator

2014-11-27 Thread Sakari Ailus
Hi Robin, Robin Murphy wrote: Hi all, I've been implementing IOMMU DMA mapping for arm64, based on tidied-up parts of the existing arch/arm/mm/dma-mapping.c with a clear divide between the arch-specific parts and the general DMA-API to IOMMU-API layer so that that can be shared; similar to

[PATCH v3 1/6] vfio: implement iommu driver capabilities with an enum

2014-11-27 Thread Antonios Motakis
Currently a VFIO driver's IOMMU capabilities are encoded as a series of numerical defines. Replace this with an enum for future maintainability. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- include/uapi/linux/vfio.h | 24 +++- 1 file changed, 11

[PATCH v3 6/6] vfio: type1: implement the VFIO_DMA_MAP_FLAG_NOEXEC flag

2014-11-27 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 v3 4/6] vfio: type1: replace domain wide protection flags with supported capabilities

2014-11-27 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 v3 2/6] vfio: type1: support for ARM SMMUs

2014-11-27 Thread Antonios Motakis
This allows to make use of the VFIO_IOMMU_TYPE1 driver with devices behind an IOMMU on ARM platforms. 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

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

2014-11-27 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 v10 02/20] vfio: platform: probe to devices on the platform bus

2014-11-27 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 | 103 ++

[PATCH v10 04/20] vfio: amba: VFIO support for AMBA devices

2014-11-27 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 | 110 ++ include/uapi/linux/vfio.h | 1 +

[PATCH v10 03/20] vfio: platform: add the VFIO PLATFORM module to Kconfig

2014-11-27 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 v10 05/20] vfio: amba: add the VFIO for AMBA devices module to Kconfig

2014-11-27 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 v10 01/20] vfio/platform: initial skeleton of VFIO support for platform devices

2014-11-27 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

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

2014-11-27 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 | 106 +-

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

2014-11-27 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 v10 11/20] vfio/platform: initial interrupts support code

2014-11-27 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 v10 09/20] vfio/platform: support MMAP of MMIO regions

2014-11-27 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 | 65 1 file

[PATCH v10 13/20] vfio/platform: support for level sensitive interrupts

2014-11-27 Thread Antonios Motakis
Level sensitive interrupts are exposed as maskable and automasked interrupts and are masked and disabled automatically when they fire. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/platform/vfio_platform_irq.c | 99 ++-

[PATCH v10 14/20] vfio: add a vfio_ prefix to virqfd_enable and virqfd_disable and export

2014-11-27 Thread Antonios Motakis
We want to reuse virqfd functionality in multiple VFIO drivers; before moving these functions to core VFIO, add the vfio_ prefix to the virqfd_enable and virqfd_disable functions, and export them so they can be used from other modules. Signed-off-by: Antonios Motakis

[PATCH v10 17/20] vfio: pass an opaque pointer on virqfd initialization

2014-11-27 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

[PATCH v10 16/20] vfio: add local lock for virqfd instead of depending on VFIO PCI

2014-11-27 Thread Antonios Motakis
The Virqfd code 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 v10 15/20] vfio: virqfd: rename vfio_pci_virqfd_init and vfio_pci_virqfd_exit

2014-11-27 Thread Antonios Motakis
The functions vfio_pci_virqfd_init and vfio_pci_virqfd_exit are not really PCI specific, since we plan to reuse the virqfd code with more VFIO drivers in addition to VFIO_PCI. Signed-off-by: Antonios Motakis a.mota...@virtualopensystems.com --- drivers/vfio/pci/vfio_pci.c | 6 +++---

[PATCH v10 12/20] vfio/platform: trigger an interrupt via eventfd

2014-11-27 Thread Antonios Motakis
This patch allows to set an eventfd for a platform device's interrupt, and also to trigger the interrupt eventfd from userspace for testing. Level sensitive interrupts are marked as maskable and are handled in a later patch. Edge triggered interrupts are not advertised as maskable and are

[PATCH v10 19/20] vfio: initialize the virqfd workqueue in VFIO generic code

2014-11-27 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/Makefile | 4 +++-

[PATCH v10 20/20] vfio/platform: implement IRQ masking/unmasking via an eventfd

2014-11-27 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 | 47 ---

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

2014-11-27 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. Signed-off-by: Antonios Motakis

RE: [PATCH RESEND v8] iopoll: Introduce memory-mapped IO polling macros

2014-11-27 Thread Elliott, Robert (Server Storage)
-Original Message- From: Mitchel Humpherys [mailto:mitch...@codeaurora.org] Sent: Monday, November 24, 2014 7:21 PM To: Elliott, Robert (Server Storage) ... The hpsa SCSI driver used to use usleep_range in a loop like that, but we found that it caused scheduler problems during