[RESEND PATCH v2 3/6] PCI: Set PCI_BUS_FLAGS_MSI_REMAP if IOMMU have capability of IRQ remapping

2016-06-01 Thread Yongji Xie
The capability of IRQ remapping is abstracted on IOMMU side on some archs. There is a existing flag IOMMU_CAP_INTR_REMAP for this. To have a universal flag to test this capability for different archs on PCI side, we set PCI_BUS_FLAGS_MSI_REMAP for PCI buses when IOMMU_CAP_INTR_REMAP is set. Signe

[RESEND PATCH v2 4/6] iommu: Set PCI_BUS_FLAGS_MSI_REMAP on iommu driver initialization

2016-06-01 Thread Yongji Xie
Some iommu drivers would be initialized after PCI device enumeration. So PCI_BUS_FLAGS_MSI_REMAP would not be set when probing PCI devices although IOMMU enables capability of IRQ remapping. This patch tests this capability and set the flag when iommu driver is initialized. Signed-off-by: Yongji X

[RESEND PATCH v2 5/6] pci-ioda: Set PCI_BUS_FLAGS_MSI_REMAP for IODA host bridge

2016-06-01 Thread Yongji Xie
Any IODA host bridge have the capability of IRQ remapping. So we set PCI_BUS_FLAGS_MSI_REMAP when this kind of host birdge is detected. Signed-off-by: Yongji Xie Reviewed-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c |8 1 file changed, 8 insertions(+) dif

[RESEND PATCH v2 2/6] PCI: Set PCI_BUS_FLAGS_MSI_REMAP if MSI controller enables IRQ remapping

2016-06-01 Thread Yongji Xie
On ARM HW the capability of IRQ remapping is abstracted on MSI controller side. MSI_FLAG_IRQ_REMAPPING is used to advertise this [1]. To have a universal flag to test this capability for different archs on PCI side, we set PCI_BUS_FLAGS_MSI_REMAP for PCI buses when MSI_FLAG_IRQ_REMAPPING is set.

[RESEND PATCH v2 6/6] vfio-pci: Allow to expose MSI-X table to userspace if interrupt remapping is enabled

2016-06-01 Thread Yongji Xie
This patch tries to expose MSI-X tables to userspace if hardware enables interrupt remapping. This capability can ensure that a given PCI device can only shoot the MSIs assigned for it. That means a userspace driver could never hurt other devices or system by writing to the exposed MSI-X table dire

[RESEND PATCH v2 1/6] PCI: Add a new PCI_BUS_FLAGS_MSI_REMAP flag

2016-06-01 Thread Yongji Xie
We introduce a new pci_bus_flags, PCI_BUS_FLAGS_MSI_REMAP which indicates interrupts of all devices on the bus are managed by the hardware enabling IRQ remapping(intel naming). When the capability is enabled, a given PCI device can only shoot the MSIs assigned for it. In other words, the hardware c

[RESEND PATCH v2 0/6] vfio-pci: Add support for mmapping MSI-X table

2016-06-01 Thread Yongji Xie
Current vfio-pci implementation disallows to mmap the page containing MSI-X table in case that users can write directly to MSI-X table and generate an incorrect MSIs. However, this will cause some performance issue when there are some critical device registers in the same page as the MSI-X table.

Re: [PATCH 2/4] soc: fsl: add GUTS driver for QorIQ platforms

2016-06-01 Thread Scott Wood
On Mon, 2016-05-30 at 15:15 +0200, Arnd Bergmann wrote: > diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c > new file mode 100644 > index ..2f30698f5bcf > --- /dev/null > +++ b/drivers/soc/fsl/guts.c > @@ -0,0 +1,130 @@ > +/* > + * Freescale QorIQ Platforms GUTS Driver > + *

Re: [PATCH 4/4] Revert "powerpc/fsl: Move fsl_guts.h out of arch/powerpc"

2016-06-01 Thread Scott Wood
On Mon, 2016-05-30 at 15:18 +0200, Arnd Bergmann wrote: > All users of this driver are PowerPC specific and the header file > has no business in the global include/linux/ hierarchy, so move > it back before anyone starts using it on ARM. > > This reverts commit 948486544713492f00ac8a9572909101ea89

Re: [PATCH 3/4] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0

2016-06-01 Thread Scott Wood
On Mon, 2016-05-30 at 15:16 +0200, Arnd Bergmann wrote: > This is a rewrite of an earlier patch from Yangbo Lu, adding a quirk > for the NXP QorIQ T4240 in the detection of the host device version. > > Unfortunately, this device cannot be detected using the compatible > string, as we have to suppo

Re: [RFT v3] drm: use late_initcall() for amdkfd and radeon

2016-06-01 Thread Luis R. Rodriguez
On Tue, May 31, 2016 at 09:04:53PM +0200, Daniel Vetter wrote: > On Tue, May 31, 2016 at 06:58:34PM +0200, Luis R. Rodriguez wrote: > > On Sun, May 29, 2016 at 08:27:07PM +0200, Daniel Vetter wrote: > > > On Fri, May 27, 2016 at 3:18 AM, Luis R. Rodriguez > > > wrote: > > > > To get KFD support i

Re: [PATCHv7 0/6] dmaengine: rcar-dmac: add iommu support for slave transfers

2016-06-01 Thread Vinod Koul
On Wed, Jun 01, 2016 at 05:22:23PM +0200, Niklas Söderlund wrote: > Hi, > > [In this v7 series I have tried to address the questions raised by Christoph > Hellwig and I hope it can awnser your concernes regarding dma-debug.] > > This series tries to solve the problem with DMA with device registe

Re: [PATCHv7 4/6] arm: dma-mapping: add {map, unmap}_resource for iommu ops

2016-06-01 Thread Russell King - ARM Linux
On Wed, Jun 01, 2016 at 05:22:27PM +0200, Niklas Söderlund wrote: > +static dma_addr_t arm_iommu_map_resource(struct device *dev, > + phys_addr_t phys_addr, size_t size, > + enum dma_data_direction dir, struct dma_attrs *attrs) > +{ > + struct dma_iommu_mapping *mapping

[RESEND PATCH] iommu/rockchip: fix zap cache during device attach

2016-06-01 Thread John Keeping
rk_iommu_command() takes a struct rk_iommu and iterates over the slave MMUs, so this is doubly wrong in that we're passing in the wrong pointer and talking to MMUs that we shouldn't be. Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi slaves") Cc: sta...@vger.kernel.org Signed-of

[PATCHv7 3/6] dma-mapping: add dma_{map,unmap}_resource

2016-06-01 Thread Niklas Söderlund
Map/Unmap a device MMIO resource from a physical address. If no dma_map_ops method is available the operation is a no-op. Signed-off-by: Niklas Söderlund --- Documentation/DMA-API.txt | 22 +- include/linux/dma-mapping.h | 36 2 files ch

[PATCHv7 6/6] dmaengine: rcar-dmac: add iommu support for slave transfers

2016-06-01 Thread Niklas Söderlund
Enable slave transfers to a device behind a IPMMU by mapping the slave addresses using the dma-mapping API. Signed-off-by: Niklas Söderlund --- drivers/dma/sh/rcar-dmac.c | 82 +- 1 file changed, 74 insertions(+), 8 deletions(-) diff --git a/drivers/d

[PATCHv7 4/6] arm: dma-mapping: add {map, unmap}_resource for iommu ops

2016-06-01 Thread Niklas Söderlund
Add methods to map/unmap device resources addresses for dma_map_ops that are IOMMU aware. This is needed to map a device MMIO register from a physical address. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- arch/arm/mm/dma-mapping.c | 63 ++

[PATCHv7 5/6] dmaengine: rcar-dmac: group slave configuration

2016-06-01 Thread Niklas Söderlund
Group slave address and transfer size in own structs for source and destination. This is in preparation for hooking up the dma-mapping API to the slave addresses. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- drivers/dma/sh/rcar-dmac.c | 38 ++

[PATCHv7 1/6] dma-mapping: add {map,unmap}_resource to dma_map_ops

2016-06-01 Thread Niklas Söderlund
Add methods to handle mapping of device resources from a physical address. This is needed for example to be able to map MMIO FIFO registers to a IOMMU. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/linux/dma-mapping.h | 6 ++ 1 file changed, 6 insertions(+) diff

[PATCHv7 2/6] dma-debug: add support for resource mappings

2016-06-01 Thread Niklas Söderlund
A MMIO mapped resource can not be represented by a struct page so a new debug type is needed to handle this. This patch add such type and functionality to add/remove entries and how to translate them to a physical address. Signed-off-by: Niklas Söderlund --- include/linux/dma-debug.h | 19 ++

[PATCHv7 0/6] dmaengine: rcar-dmac: add iommu support for slave transfers

2016-06-01 Thread Niklas Söderlund
Hi, [In this v7 series I have tried to address the questions raised by Christoph Hellwig and I hope it can awnser your concernes regarding dma-debug.] This series tries to solve the problem with DMA with device registers (MMIO registers) that are behind an IOMMU for the rcar-dmac driver. A recen

Re: [PATCH v3 2/2] iommu: Remove cpu-local spinlock

2016-06-01 Thread Joonas Lahtinen
On ke, 2016-06-01 at 12:10 +0100, Chris Wilson wrote: > By avoiding cross-CPU usage of the per-cpu iova cache, we can forgo > having a spinlock inside the per-cpu struct. The only place where we > actually may touch another CPU's data is when performing a cache flush > after running out of memory.

Re: [PATCH v3 1/2] iommu: Disable preemption around use of this_cpu_ptr()

2016-06-01 Thread Joonas Lahtinen
On ke, 2016-06-01 at 12:10 +0100, Chris Wilson wrote: > Between acquiring the this_cpu_ptr() and using it, ideally we don't want > to be preempted and work on another CPU's private data. this_cpu_ptr() > checks whether or not preemption is disable, and get_cpu_ptr() provides > a convenient wrapper

Re: [RFC v2] dma-mapping: Use unsigned long for dma_attrs

2016-06-01 Thread Christoph Hellwig
On Wed, Jun 01, 2016 at 07:36:42AM +0200, Krzysztof Kozlowski wrote: > > No really for this patch, but I would much prefer to document them next > > to the code in the long run. Also I really think these BIT() macros > > are a distraction compared to the (1 << N) notation. > > Not much difference