[PATCH v5 6/6] Revert "iommu/arm-smmu: Treat all device transactions as unprivileged"

2016-07-27 Thread Mitchel Humpherys
This reverts commit d346180e70b9 ("iommu/arm-smmu: Treat all device transactions as unprivileged") since some platforms actually make use of privileged transactions. Reviewed-by: Robin Murphy Tested-by: Robin Murphy Signed-off-by: Mitchel Humpherys --- Notes: v2..v3

[PATCH v5 3/6] common: DMA-mapping: add DMA_ATTR_PRIVILEGED attribute

2016-07-27 Thread Mitchel Humpherys
e to the DMA-mapping subsystem that the buffer is fully accessible at the elevated privilege level (and ideally inaccessible or at least read-only at the lesser-privileged levels). Cc: linux-...@vger.kernel.org Reviewed-by: Robin Murphy Tested-by: Robin Murphy Signed-off-by: Mitchel Humpherys --

[PATCH v5 4/6] arm64/dma-mapping: Implement DMA_ATTR_PRIVILEGED

2016-07-27 Thread Mitchel Humpherys
The newly added DMA_ATTR_PRIVILEGED is useful for creating mappings that are only accessible to privileged DMA engines. Implement it in dma-iommu.c so that the ARM64 DMA IOMMU mapper can make use of it. Reviewed-by: Robin Murphy Tested-by: Robin Murphy Signed-off-by: Mitchel Humpherys

[PATCH v5 5/6] dmaengine: pl330: Make sure microcode is privileged

2016-07-27 Thread Mitchel Humpherys
DMA_ATTR_PRIVILEGED attribute, which will ensure that the microcode IOMMU mapping is only accessible to the privileged level. Cc: Dan Williams Cc: Vinod Koul Reviewed-by: Robin Murphy Tested-by: Robin Murphy Signed-off-by: Mitchel Humpherys --- Notes: v3..v4 - Reworked against the new dma

[PATCH v5 2/6] iommu/io-pgtable-arm: add support for the IOMMU_PRIV flag

2016-07-27 Thread Mitchel Humpherys
From: Jeremy Gebben Allow the creation of privileged mode mappings, for stage 1 only. Reviewed-by: Robin Murphy Tested-by: Robin Murphy Signed-off-by: Jeremy Gebben --- Notes: v2..v3 - Use existing bit definitions. drivers/iommu/io-pgtable-arm.c | 5 - 1 file changed, 4

[PATCH v5 0/6] Add support for privileged mappings

2016-07-27 Thread Mitchel Humpherys
use that in the pl330 driver (suggested by Will). Jeremy Gebben (1): iommu/io-pgtable-arm: add support for the IOMMU_PRIV flag Mitchel Humpherys (5): iommu: add IOMMU_PRIV attribute common: DMA-mapping: add DMA_ATTR_PRIVILEGED attribute arm64/dma-mapping: Implement DMA_ATTR_PRIVILEGED dma

[PATCH v5 1/6] iommu: add IOMMU_PRIV attribute

2016-07-27 Thread Mitchel Humpherys
Add the IOMMU_PRIV attribute, which is used to indicate privileged mappings. Reviewed-by: Robin Murphy Tested-by: Robin Murphy Signed-off-by: Mitchel Humpherys --- Notes: v2..v3 - Added comment include/linux/iommu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include

Re: [PATCH v4 4/6] arm64/dma-mapping: Implement DMA_ATTR_PRIVILEGED

2016-07-27 Thread Mitchel Humpherys
On Tue, Jul 26 2016 at 04:05:17 PM, Robin Murphy wrote: > + if (attrs & DMA_ATTR_PRIVILEGED) > + prot |= IOMMU_PRIV; > + > > then drop the rest of the changes to the switch statement below. It's > taken me an embarrassingly long time to work out why things were blowing > up in __io

[PATCH v4 4/6] arm64/dma-mapping: Implement DMA_ATTR_PRIVILEGED

2016-07-25 Thread Mitchel Humpherys
The newly added DMA_ATTR_PRIVILEGED is useful for creating mappings that are only accessible to privileged DMA engines. Implement it in dma-iommu.c so that the ARM64 DMA IOMMU mapper can make use of it. Signed-off-by: Mitchel Humpherys --- Notes: v3..v4 - Reworked against the

[PATCH v4 0/6] Add support for privileged mappings

2016-07-25 Thread Mitchel Humpherys
s work, and use that in the pl330 driver (suggested by Will). Jeremy Gebben (1): iommu/io-pgtable-arm: add support for the IOMMU_PRIV flag Mitchel Humpherys (5): iommu: add IOMMU_PRIV attribute common: DMA-mapping: add DMA_ATTR_PRIVILEGED attribute arm64/dma-mapping: Implement DMA_A

[PATCH v4 5/6] dmaengine: pl330: Make sure microcode is privileged

2016-07-25 Thread Mitchel Humpherys
DMA_ATTR_PRIVILEGED attribute, which will ensure that the microcode IOMMU mapping is only accessible to the privileged level. Cc: Dan Williams Cc: Jassi Brar Signed-off-by: Mitchel Humpherys --- Notes: v3..v4 - Reworked against the new dma attrs format. drivers/dma/pl330.c | 6 -- 1

[PATCH v4 6/6] Revert "iommu/arm-smmu: Treat all device transactions as unprivileged"

2016-07-25 Thread Mitchel Humpherys
This reverts commit d346180e70b9 ("iommu/arm-smmu: Treat all device transactions as unprivileged") since some platforms actually make use of privileged transactions. Signed-off-by: Mitchel Humpherys --- Notes: v2..v3 - Moved to the end of the series. drivers/iommu/

[PATCH v4 3/6] common: DMA-mapping: add DMA_ATTR_PRIVILEGED attribute

2016-07-25 Thread Mitchel Humpherys
e to the DMA-mapping subsystem that the buffer is fully accessible at the elevated privilege level (and ideally inaccessible or at least read-only at the lesser-privileged levels). Cc: linux-...@vger.kernel.org Signed-off-by: Mitchel Humpherys --- Notes: v3..v4 - Reworked against the

[PATCH v4 2/6] iommu/io-pgtable-arm: add support for the IOMMU_PRIV flag

2016-07-25 Thread Mitchel Humpherys
From: Jeremy Gebben Allow the creation of privileged mode mappings, for stage 1 only. Signed-off-by: Jeremy Gebben --- Notes: v2..v3 - Use existing bit definitions. drivers/iommu/io-pgtable-arm.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i

[PATCH v4 1/6] iommu: add IOMMU_PRIV attribute

2016-07-25 Thread Mitchel Humpherys
Add the IOMMU_PRIV attribute, which is used to indicate privileged mappings. Signed-off-by: Mitchel Humpherys --- Notes: v2..v3 - Added comment include/linux/iommu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index

Re: [PATCH v3 0/6] Add support for privileged mappings

2016-07-25 Thread Mitchel Humpherys
On Mon, Jul 25 2016 at 10:50:13 AM, Will Deacon wrote: > On Fri, Jul 22, 2016 at 01:39:45PM -0700, Mitchel Humpherys wrote: >> On Fri, Jul 22 2016 at 05:51:07 PM, Will Deacon wrote: >> > On Tue, Jul 19, 2016 at 01:36:49PM -0700, Mitchel Humpherys wrote: >> >> The f

Re: [PATCH v3 0/6] Add support for privileged mappings

2016-07-22 Thread Mitchel Humpherys
On Fri, Jul 22 2016 at 05:51:07 PM, Will Deacon wrote: > On Tue, Jul 19, 2016 at 01:36:49PM -0700, Mitchel Humpherys wrote: >> The following patch to the ARM SMMU driver: >> >> commit d346180e70b91b3d5a1ae7e5603e65593d4622bc >> Author: Robin Murphy >>

[PATCH v3 5/6] dmaengine: pl330: Make sure microcode is privileged

2016-07-19 Thread Mitchel Humpherys
DMA_ATTR_PRIVILEGED attribute, which will ensure that the microcode IOMMU mapping is only accessible to the privileged level. Cc: Dan Williams Cc: Jassi Brar Signed-off-by: Mitchel Humpherys --- drivers/dma/pl330.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/dma/pl330

[PATCH v3 0/6] Add support for privileged mappings

2016-07-19 Thread Mitchel Humpherys
* Don't worry about executability in new DMA attr. v1..v2 - Added a new DMA attribute to make executable privileged mappings work, and use that in the pl330 driver (suggested by Will). Jeremy Gebben (1): iommu/io-pgtable-arm: add support for the IOMMU_PRIV flag Mitchel Humpherys

[PATCH v3 3/6] common: DMA-mapping: add DMA_ATTR_PRIVILEGED attribute

2016-07-19 Thread Mitchel Humpherys
e to the DMA-mapping subsystem that the buffer is fully accessible at the elevated privilege level (and ideally inaccessible or at least read-only at the lesser-privileged levels). Cc: linux-...@vger.kernel.org Signed-off-by: Mitchel Humpherys --- Notes: v2..v3 - Not worrying

[PATCH v3 2/6] iommu/io-pgtable-arm: add support for the IOMMU_PRIV flag

2016-07-19 Thread Mitchel Humpherys
From: Jeremy Gebben Allow the creation of privileged mode mappings, for stage 1 only. Signed-off-by: Jeremy Gebben --- Notes: v2..v3 - Use existing bit definitions. drivers/iommu/io-pgtable-arm.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i

[PATCH v3 1/6] iommu: add IOMMU_PRIV attribute

2016-07-19 Thread Mitchel Humpherys
Add the IOMMU_PRIV attribute, which is used to indicate privileged mappings. Signed-off-by: Mitchel Humpherys --- Notes: v2..v3 - Added comment include/linux/iommu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index

[PATCH v3 4/6] arm64/dma-mapping: Implement DMA_ATTR_PRIVILEGED

2016-07-19 Thread Mitchel Humpherys
The newly added DMA_ATTR_PRIVILEGED is useful for creating mappings that are only accessible to privileged DMA engines. Implement it in dma-iommu.c so that the ARM64 DMA IOMMU mapper can make use of it. Signed-off-by: Mitchel Humpherys --- Notes: v2..v3 - Renamed and

[PATCH v3 6/6] Revert "iommu/arm-smmu: Treat all device transactions as unprivileged"

2016-07-19 Thread Mitchel Humpherys
This reverts commit d346180e70b9 ("iommu/arm-smmu: Treat all device transactions as unprivileged") since some platforms actually make use of privileged transactions. Signed-off-by: Mitchel Humpherys --- Notes: v2..v3 - Moved to the end of the series. drivers/iommu/

[PATCH v2 6/6] dmaengine: pl330: Make sure microcode is privileged-executable

2016-07-08 Thread Mitchel Humpherys
DMA_ATTR_PRIVILEGED_EXECUTABLE attribute, which will ensure that the microcode IOMMU mapping is not writeable. Cc: Dan Williams Cc: Jassi Brar Signed-off-by: Mitchel Humpherys --- drivers/dma/pl330.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers

[PATCH v2 4/6] common: DMA-mapping: add DMA_ATTR_PRIVILEGED_EXECUTABLE attribute

2016-07-08 Thread Mitchel Humpherys
is necessary to ensure that the buffer is executable at an elevated privilege level (by making it read-only at the lesser-privileged levels, for example). Cc: linux-...@vger.kernel.org Signed-off-by: Mitchel Humpherys --- Documentation/DMA-attributes.txt | 9 + include/linux/dma-attrs.h

[PATCH v2 3/6] Revert "iommu/arm-smmu: Treat all device transactions as unprivileged"

2016-07-08 Thread Mitchel Humpherys
This reverts commit d346180e70b9 ("iommu/arm-smmu: Treat all device transactions as unprivileged") since some platforms actually make use of privileged transactions. Signed-off-by: Mitchel Humpherys --- drivers/iommu/arm-smmu.c | 5 + 1 file changed, 1 insertion(+), 4 deletion

[PATCH v2 5/6] arm64/dma-mapping: Implement DMA_ATTR_PRIVILEGED_EXECUTABLE

2016-07-08 Thread Mitchel Humpherys
The newly added DMA_ATTR_PRIVILEGED_EXECUTABLE is useful for creating mappings that are executable by privileged DMA engines. Implement it in dma-iommu.c so that the ARM64 DMA IOMMU mapper can make use of it. Signed-off-by: Mitchel Humpherys --- arch/arm64/mm/dma-mapping.c | 6 +++--- drivers

[PATCH v2 1/6] iommu: add IOMMU_PRIV attribute

2016-07-08 Thread Mitchel Humpherys
Add the IOMMU_PRIV attribute, which is used to indicate privileged mappings. Signed-off-by: Mitchel Humpherys --- include/linux/iommu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 664683aedcce..01c9f2667f2b 100644 --- a/include/linux

[PATCH v2 0/6] Add support for privileged mappings

2016-07-08 Thread Mitchel Humpherys
y Changelog: v1..v2 - Added a new DMA attribute to make executable privileged mappings work, and use that in the pl330 driver (suggested by Will). Jeremy Gebben (1): iommu/io-pgtable-arm: add support for the IOMMU_PRIV flag Mitchel Humpherys (5): iommu: add IOMMU_PRIV attribute

Re: [PATCH 0/3] Add support for privileged mappings

2016-07-08 Thread Mitchel Humpherys
On Thu, Jul 07 2016 at 02:58:21 PM, Jordan Crouse wrote: >> Whilst this series is a step in the right direction for fixing that, I >> don't think you can claim that only low-level users need this, given that >> we have in-tree code which would break without it. Perhaps you just need >> to extend

[PATCH v2 2/6] iommu/io-pgtable-arm: add support for the IOMMU_PRIV flag

2016-07-08 Thread Mitchel Humpherys
From: Jeremy Gebben Allow the creation of privileged mode mappings, for stage 1 only. Signed-off-by: Jeremy Gebben --- drivers/iommu/io-pgtable-arm.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-

[PATCH 3/3] Revert "iommu/arm-smmu: Treat all device transactions as unprivileged"

2016-07-06 Thread Mitchel Humpherys
This reverts commit (d346180e70b91b3d: "iommu/arm-smmu: Treat all device transactions as unprivileged") since some platforms actually make use of privileged transactions. Signed-off-by: Mitchel Humpherys --- drivers/iommu/arm-smmu.c | 5 + 1 file changed, 1 insertion(+), 4

[PATCH 2/3] iommu/io-pgtable-arm: add support for the IOMMU_PRIV flag

2016-07-06 Thread Mitchel Humpherys
From: Jeremy Gebben Allow the creation of privileged mode mappings, for stage 1 only. Signed-off-by: Jeremy Gebben --- drivers/iommu/io-pgtable-arm.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-

[PATCH 1/3] iommu: add IOMMU_PRIV attribute

2016-07-06 Thread Mitchel Humpherys
Add the IOMMU_PRIV attribute, which is used to indicate privileged mappings. Signed-off-by: Mitchel Humpherys --- include/linux/iommu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 664683aedcce..01c9f2667f2b 100644 --- a/include/linux

[PATCH 0/3] Add support for privileged mappings

2016-07-06 Thread Mitchel Humpherys
rm: add support for the IOMMU_PRIV flag Mitchel Humpherys (2): iommu: add IOMMU_PRIV attribute Revert "iommu/arm-smmu: Treat all device transactions as unprivileged" drivers/iommu/arm-smmu.c | 5 + drivers/iommu/io-pgtable-arm.c | 16 +++- include/linux

Re: How to keep PCI-e endpoints and RCs in distinct IOMMU groups?

2016-06-02 Thread Mitchel Humpherys
On Wed, May 25 2016 at 08:45:58 PM, Alex Williamson wrote: >> Why do we do that? If the devices have different BDFs can't we safely >> say that they're protected from peer-to-peer DMA (assuming no DMA >> aliasing quirks)? Even as I write that out it seems wrong though since >> the RC can probab

Re: How to keep PCI-e endpoints and RCs in distinct IOMMU groups?

2016-06-02 Thread Mitchel Humpherys
On Thu, May 26 2016 at 11:58:53 AM, Robin Murphy wrote: > Hey Mitch, > > On 26/05/16 01:26, Mitchel Humpherys wrote: >> Hey there, >> >> We're experiencing an issue with IOMMU groups and PCI-e devices. The >> system in question has a WLAN DMA master behin

How to keep PCI-e endpoints and RCs in distinct IOMMU groups?

2016-05-25 Thread Mitchel Humpherys
Hey there, We're experiencing an issue with IOMMU groups and PCI-e devices. The system in question has a WLAN DMA master behind a PCI-e root complex which is, in turn, behind an IOMMU. There are no there devices behind the RC. This is on an ARM platform using the arm-smmu and pci-msm drivers (p

Re: [PATCH 1/2] iommu: Support dynamic pgsize_bitmap

2016-04-07 Thread Mitchel Humpherys
On Thu, Apr 07 2016 at 12:29:59 PM, Mitchel Humpherys wrote: >> I'll clean up what I have and try to get it posted this afternoon so >> we can compare. > > Cool, I have some comments that I'll leave over there. Never mind, my comments weren't relevant. I&#x

Re: [PATCH 1/2] iommu: Support dynamic pgsize_bitmap

2016-04-07 Thread Mitchel Humpherys
On Wed, Apr 06 2016 at 11:47:19 AM, Robin Murphy wrote: > How would you handle said restriction of page sizes under this scheme? I have a custom io-pgtable implementation that gets wired up based on an IOMMU domain attribute, which is set by yet another custom DMA mapper. My main goal is to give

[PATCH 1/2] iommu: Support dynamic pgsize_bitmap

2016-04-05 Thread Mitchel Humpherys
to the iommu_ops which can optionally be used by the driver to return a domain-specific pgsize_bitmap. Signed-off-by: Mitchel Humpherys --- drivers/iommu/iommu.c | 28 +++- include/linux/iommu.h | 3 +++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a

[PATCH 2/2] iommu/arm-smmu: Implement .get_pgsize_bitmap for domain

2016-04-05 Thread Mitchel Humpherys
. Signed-off-by: Mitchel Humpherys --- drivers/iommu/arm-smmu.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 2409e3bd3df2..a1b0f542d5ca 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu

Re: [PATCH] iommu/arm-smmu: Only return IRQ_NONE if FSR is not set

2015-10-06 Thread Mitchel Humpherys
On Mon, Oct 05 2015 at 03:24:03 PM, Will Deacon wrote: > Hi Mitch, > > On Sat, Sep 26, 2015 at 01:12:05AM +0100, Mitchel Humpherys wrote: >> Currently we return IRQ_NONE from the context fault handler if the FSR >> doesn't actually have the fault bit set (some sort of

[PATCH] iommu/arm-smmu: Only return IRQ_NONE if FSR is not set

2015-09-25 Thread Mitchel Humpherys
framework that the interrupt wasn't for this device if the client doesn't register a handler isn't exactly accurate. Fix this by returning IRQ_HANDLED even if the client doesn't register a handler. Signed-off-by: Mitchel Humpherys --- drivers/iommu/arm-smmu.c | 2 +- 1 f

Re: [PATCH 2/5] iommu/mediatek: Add mt8173 IOMMU driver

2015-03-09 Thread Mitchel Humpherys
On Mon, Mar 09 2015 at 05:16:26 AM, Yong Wu wrote: > Dear Mitchel, > Thanks very much for your review. > > On Fri, 2015-03-06 at 09:15 -0800, Mitchel Humpherys wrote: >> On Fri, Mar 06 2015 at 02:48:17 AM, wrote: >> > From: Yong Wu >> > >>

Re: [PATCH 2/5] iommu/mediatek: Add mt8173 IOMMU driver

2015-03-06 Thread Mitchel Humpherys
On Fri, Mar 06 2015 at 02:48:17 AM, wrote: > From: Yong Wu > > This patch adds support for mediatek m4u (MultiMedia Memory Management Unit). > Currently this only supports m4u gen 2 with 2 levels of page table on mt8173. [...] > +static int mtk_iommu_invalidate_tlb(const struct mtk_iommu_info *

Re: [PATCH] iommu: arm-smmu: set a more appropriate DMA mask

2015-03-05 Thread Mitchel Humpherys
buffers and flushing those instead, if said page tables > happen to lie outside the default 32-bit mask. > > Signed-off-by: Robin Murphy Tested-by: Mitchel Humpherys Thanks Robin! -Mitch -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the

Re: [PATCH] iommu/arm-smmu: fix leak in arm_smmu_flush_pgtable

2015-03-05 Thread Mitchel Humpherys
On Thu, Mar 05 2015 at 02:38:45 AM, Robin Murphy wrote: > Hi Mitch, > > On 05/03/15 00:18, Mitchel Humpherys wrote: >> We're currently mapping a page in arm_smmu_flush_pgtable without ever >> unmapping it. Fix this by calling dma_unmap_page on the returned dma >>

[PATCH] iommu/arm-smmu: fix leak in arm_smmu_flush_pgtable

2015-03-04 Thread Mitchel Humpherys
mmediately following the map. Without this, eventually swiotlb runs out of memory and starts printing things like: [ 35.545076] arm-smmu d0.arm,smmu: swiotlb buffer is full (sz: 128 bytes) Signed-off-by: Mitchel Humpherys --- drivers/iommu/arm-smmu.c | 9 +++-- 1 file changed, 7

Re: [PATCH] iommu/arm-smmu: use a threaded handler for context interrupts

2015-02-04 Thread Mitchel Humpherys
On Wed, Feb 04 2015 at 03:33:05 AM, Will Deacon wrote: > On Mon, Feb 02, 2015 at 08:10:02PM +0000, Mitchel Humpherys wrote: >> On Wed, Jan 28 2015 at 04:07:39 AM, Will Deacon wrote: >> > With a shared handler (e.g. a bunch of context banks have the same IRQ) >> > then

Re: [PATCH] iommu/arm-smmu: use a threaded handler for context interrupts

2015-02-02 Thread Mitchel Humpherys
On Wed, Jan 28 2015 at 04:07:39 AM, Will Deacon wrote: > On Fri, Jan 23, 2015 at 10:33:20PM +0000, Mitchel Humpherys wrote: >> On Fri, Jan 23 2015 at 03:24:15 AM, Will Deacon wrote: >> > On Thu, Jan 22, 2015 at 11:48:02PM +, Mitchel Humpherys wrote: >> >> Cont

Re: [PATCH] iommu/arm-smmu: use a threaded handler for context interrupts

2015-01-23 Thread Mitchel Humpherys
On Fri, Jan 23 2015 at 03:24:15 AM, Will Deacon wrote: > Hi Mitch, > > On Thu, Jan 22, 2015 at 11:48:02PM +, Mitchel Humpherys wrote: >> Context interrupts can call domain-specific handlers which might sleep. >> Currently we register our handler with request_irq, so our

[PATCH] iommu/arm-smmu: use a threaded handler for context interrupts

2015-01-22 Thread Mitchel Humpherys
way for doing things like enabling clocks within our interrupt handler. Signed-off-by: Mitchel Humpherys --- drivers/iommu/arm-smmu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 6cd47b75286f..81f6b54d94b1 100644

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

2015-01-20 Thread Mitchel Humpherys
On Tue, Jan 20 2015 at 06:16:43 AM, Will Deacon wrote: > Hey Mitch, > > On Wed, Oct 29, 2014 at 09:13:40PM +, 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

Re: [PATCH v10] iopoll: Introduce memory-mapped IO polling macros

2015-01-14 Thread Mitchel Humpherys
On Tue, Dec 16 2014 at 01:45:27 AM, Will Deacon wrote: > On Mon, Dec 15, 2014 at 11:47:23PM +0000, Mitchel Humpherys wrote: >> From: Matt Wagantall >> >> It is sometimes necessary to poll a memory-mapped register until its value >> satisfies some condition. Introd

Re: [PATCH] iommu/arm-smmu: don't touch the secure STLBIALL register

2015-01-07 Thread Mitchel Humpherys
On Wed, Jan 07 2015 at 10:04:20 AM, Will Deacon wrote: > On Wed, Jan 07, 2015 at 05:52:46PM +0000, Mitchel Humpherys wrote: >> On Wed, Jan 07 2015 at 02:13:00 AM, Will Deacon wrote: >> > On Tue, Jan 06, 2015 at 11:30:49PM +, Mitchel Humpherys wrote: >> >> On T

Re: [PATCH] iommu/arm-smmu: don't touch the secure STLBIALL register

2015-01-07 Thread Mitchel Humpherys
On Wed, Jan 07 2015 at 02:13:00 AM, Will Deacon wrote: > On Tue, Jan 06, 2015 at 11:30:49PM +0000, Mitchel Humpherys wrote: >> On Tue, Jan 06 2015 at 02:35:28 PM, Rob Herring >> wrote: >> > On Tue, Jan 6, 2015 at 2:16 PM, Mitchel Humpherys >> > wrote: >>

Re: [PATCH] iommu/arm-smmu: don't touch the secure STLBIALL register

2015-01-06 Thread Mitchel Humpherys
On Tue, Jan 06 2015 at 02:35:28 PM, Rob Herring wrote: > On Tue, Jan 6, 2015 at 2:16 PM, Mitchel Humpherys > wrote: >> On Tue, Jan 06 2015 at 06:15:07 AM, Will Deacon wrote: >>>> /* Invalidate the TLB, just in case */ >>>> -writel_relaxed

Re: [PATCH] iommu/arm-smmu: don't touch the secure STLBIALL register

2015-01-06 Thread Mitchel Humpherys
On Tue, Jan 06 2015 at 06:15:07 AM, Will Deacon wrote: >> /* Invalidate the TLB, just in case */ >> -writel_relaxed(0, gr0_base + ARM_SMMU_GR0_STLBIALL); >> writel_relaxed(0, gr0_base + ARM_SMMU_GR0_TLBIALLH); >> writel_relaxed(0, gr0_base + ARM_SMMU_GR0_TLBIALLNSNH); > > I was

[PATCH] iommu/arm-smmu: don't touch the secure STLBIALL register

2014-12-23 Thread Mitchel Humpherys
Currently we do a STLBIALL when we initialize the SMMU. However, in some configurations that register is not supposed to be touched and is marked as "Secure only" in the spec. Rip it out. Signed-off-by: Mitchel Humpherys --- drivers/iommu/arm-smmu.c | 2 -- 1 file changed, 2

[PATCH v10] iopoll: Introduce memory-mapped IO polling macros

2014-12-15 Thread Mitchel Humpherys
Deacon Cc: Arnd Bergmann Cc: Andrew Morton Cc: Robert Elliott Signed-off-by: Matt Wagantall Signed-off-by: Mitchel Humpherys --- v9..10: - Actually added the comments mentioned in v8..v9 (doh!) v8..v9: - Added note in comments about max sleep time (Rob Elliott) v7..v8: - sorted helper

Re: [PATCH v9] iopoll: Introduce memory-mapped IO polling macros

2014-12-15 Thread Mitchel Humpherys
On Mon, Dec 15 2014 at 03:31:20 PM, Mitchel Humpherys wrote: > From: Matt Wagantall > > It is sometimes necessary to poll a memory-mapped register until its value > satisfies some condition. Introduce a family of convenience macros that do > this. Tight-looping, sleeping, and tim

[PATCH v9] iopoll: Introduce memory-mapped IO polling macros

2014-12-15 Thread Mitchel Humpherys
Deacon Cc: Arnd Bergmann Cc: Andrew Morton Cc: Robert Elliott Signed-off-by: Matt Wagantall Signed-off-by: Mitchel Humpherys --- v8..v9: - Added note in comments about max sleep time (Rob Elliott) v7..v8: - sorted helper macros by size (b, w, l, q) - removed some of the more esoteric (or

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

2014-12-02 Thread Mitchel Humpherys
On Thu, Nov 27 2014 at 03:51:16 AM, Will Deacon wrote: > 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-lev

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

2014-11-24 Thread Mitchel Humpherys
On Mon, Nov 24 2014 at 04:53:19 PM, "Elliott, Robert (Server Storage)" wrote: >> -Original Message- >> From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- >> ow...@vger.kernel.org] On Behalf Of Mitchel Humpherys >> Sent: Monday, 24 November

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

2014-11-24 Thread Mitchel Humpherys
Deacon Cc: Arnd Bergmann Cc: Andrew Morton Signed-off-by: Matt Wagantall Signed-off-by: Mitchel Humpherys --- This patch was originally part of a series [1] for adding support for IOMMU address translations through an ARM SMMU hardware register. The other patch in the series (the one that actually

Re: [RFC] add a struct page* parameter to dma_map_ops.unmap_page

2014-11-21 Thread Mitchel Humpherys
On Fri, Nov 21 2014 at 03:48:33 AM, Stefano Stabellini wrote: > On Mon, 17 Nov 2014, Stefano Stabellini wrote: >> Hi all, >> I am writing this email to ask for your advice. >> >> On architectures where dma addresses are different from physical >> addresses, it can be difficult to retrieve the ph

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

2014-11-17 Thread Mitchel Humpherys
Deacon Cc: Arnd Bergmann Signed-off-by: Matt Wagantall Signed-off-by: Mitchel Humpherys --- Sorry for any confusion regarding the genesis of this patch. Let me try to clarify the history here. This patch was originally part of a series [1] for adding support for IOMMU address translations through

Re: [PATCH 5/6] iommu/arm-smmu: support buggy implementations with invalidate-on-map

2014-11-14 Thread Mitchel Humpherys
On Thu, Nov 13 2014 at 01:48:26 AM, Will Deacon wrote: > Ha, damn, then I don't have a user of the shiny new quirks field I added! > I don't think I'll go as far as removing it altogether though... I'm sure we'll be making liberal use of that field soon enough ;) -Mitch -- Qualcomm Innovatio

Re: [PATCH 5/6] iommu/arm-smmu: support buggy implementations with invalidate-on-map

2014-11-12 Thread Mitchel Humpherys
On Wed, Nov 12 2014 at 10:26:43 AM, Will Deacon wrote: > Hi Mitch, > > On Wed, Aug 13, 2014 at 01:51:38AM +0100, Mitchel Humpherys wrote: >> Add a workaround for some buggy hardware that requires a TLB invalidate >> operation to occur at map time. Activate the feature

Re: [PATCH v7 1/2] iopoll: Introduce memory-mapped IO polling macros

2014-10-30 Thread Mitchel Humpherys
On Thu, Oct 30 2014 at 05:00:23 AM, Arnd Bergmann wrote: > On Thursday 30 October 2014 11:41:00 Will Deacon wrote: >> > + >> > +#define readl_poll_timeout(addr, val, cond, delay_us, timeout_us) \ >> > + readx_poll_timeout(readl, addr, val, cond, delay_us, timeout_us) >> > + >> > +#define readl_po

[PATCH v7 0/2] iommu/arm-smmu: hard iova_to_phys

2014-10-29 Thread Mitchel Humpherys
ame's v1..v2: - Renamed one of the iopoll macros to use the more standard `_atomic' suffix - Removed some convenience iopoll wrappers to encourage explicitness Matt Wagantall (1): iopoll: Introduce memory-mapped IO polling macros Mitchel Humpherys (1): iommu/arm-smmu:

[PATCH v7 1/2] iopoll: Introduce memory-mapped IO polling macros

2014-10-29 Thread Mitchel Humpherys
Deacon Signed-off-by: Matt Wagantall Signed-off-by: Mitchel Humpherys --- Changes since v6: - No changes. Resending due to changes in the the next patch in the series. --- include/linux/iopoll.h | 213 + 1 file changed, 213 insertions(+) create mode

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

2014-10-29 Thread Mitchel Humpherys
useful for testing and hardware validation. Since the address translation registers are optional on SMMUv2, only enable hardware translations when using SMMUv1 or when SMMU_IDR0.S1TS=1 and SMMU_IDR0.ATOSNS=0, as described in the ARM SMMU v1-v2 spec. Signed-off-by: Mitchel Humpherys --- Changes

Re: [PATCH v6 1/2] iopoll: Introduce memory-mapped IO polling macros

2014-10-21 Thread Mitchel Humpherys
On Tue, Oct 14 2014 at 02:53:29 PM, Mitchel Humpherys wrote: > From: Matt Wagantall > > It is sometimes necessary to poll a memory-mapped register until its value > satisfies some condition. Introduce a family of convenience macros that do > this. Tight-looping, sleeping, and tim

[PATCH v6 1/2] iopoll: Introduce memory-mapped IO polling macros

2014-10-14 Thread Mitchel Humpherys
Deacon Signed-off-by: Matt Wagantall Signed-off-by: Mitchel Humpherys --- Changes since v5: - Use a shift instead of a divide in the poll loop. --- include/linux/iopoll.h | 213 + 1 file changed, 213 insertions(+) create mode 100644 include/linux

[PATCH v6 0/2] iommu/arm-smmu: hard iova_to_phys

2014-10-14 Thread Mitchel Humpherys
oll wrappers to encourage explicitness Matt Wagantall (1): iopoll: Introduce memory-mapped IO polling macros Mitchel Humpherys (1): iommu/arm-smmu: add support for iova_to_phys through ATS1PR drivers/iommu/arm-smmu.c | 79 +- include/linux/i

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

2014-10-14 Thread Mitchel Humpherys
useful for testing and hardware validation. Since the address translation registers are optional on SMMUv2, only enable hardware translations when using SMMUv1 or when SMMU_IDR0.S1TS=1 and SMMU_IDR0.ATOSNS=0, as described in the ARM SMMU v1-v2 spec. Signed-off-by: Mitchel Humpherys --- Changes

Re: [PATCH v4 1/2] iopoll: Introduce memory-mapped IO polling macros

2014-10-10 Thread Mitchel Humpherys
On Fri, Oct 10 2014 at 12:50:23 PM, Arnd Bergmann wrote: > On Friday 10 October 2014 12:44:45 Mitchel Humpherys wrote: >> >> Regarding the division, for the overwhelmingly common case where the >> >> user of the API passes in a constant for sleep_us the compil

Re: [PATCH v4 1/2] iopoll: Introduce memory-mapped IO polling macros

2014-10-10 Thread Mitchel Humpherys
On Wed, Oct 08 2014 at 06:40:46 AM, Arnd Bergmann wrote: > On Tuesday 07 October 2014 18:47:59 Mitchel Humpherys wrote: >> On Wed, Oct 01 2014 at 01:25:33 AM, Arnd Bergmann wrote: >> > On Tuesday 30 September 2014 18:28:12 Mitchel Humpherys wrote: >> >> + */ >

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

2014-10-10 Thread Mitchel Humpherys
useful for testing and hardware validation. Since the address translation registers are optional on SMMUv2, only enable hardware translations when using SMMUv1 or when SMMU_IDR0.S1TS=1 and SMMU_IDR0.ATOSNS=0, as described in the ARM SMMU v1-v2 spec. Signed-off-by: Mitchel Humpherys --- Changes

[PATCH v5 1/2] iopoll: Introduce memory-mapped IO polling macros

2014-10-10 Thread Mitchel Humpherys
Deacon Signed-off-by: Matt Wagantall Signed-off-by: Mitchel Humpherys --- Changes since v4: - Added support for other accessor functions - Unified atomic and non-atomic interfaces - Fixed erroneous `might_sleep' (we were might_sleep()'ing on the wrong variable) --- include/linu

[PATCH v5 0/2] iommu/arm-smmu: hard iova_to_phys

2014-10-10 Thread Mitchel Humpherys
ilure v2..v3: - Removed unnecessary `dev_name's v1..v2: - Renamed one of the iopoll macros to use the more standard `_atomic' suffix - Removed some convenience iopoll wrappers to encourage explicitness Matt Wagantall (1): iopoll: Introduce memory-mapped IO polling macros Mi

Re: [PATCH v4 1/2] iopoll: Introduce memory-mapped IO polling macros

2014-10-09 Thread Mitchel Humpherys
On Tue, Oct 07 2014 at 06:47:59 PM, Mitchel Humpherys wrote: >>> +#define readl_poll_timeout_atomic(addr, val, cond, max_reads, >>> time_between_us) \ >>> +({ \ >>> + int count; \ >>> + for (count = (max_reads); count > 0; cou

Re: [PATCH v4 1/2] iopoll: Introduce memory-mapped IO polling macros

2014-10-07 Thread Mitchel Humpherys
On Wed, Oct 01 2014 at 01:25:33 AM, Arnd Bergmann wrote: > On Tuesday 30 September 2014 18:28:12 Mitchel Humpherys wrote: >> + */ >> +#define readl_poll_timeout(addr, val, cond, sleep_us, timeout_us) \ >> +({ \ >> + ktime_t timeout = ktime_add

Re: [RFC][PATCH 2/2] Add support of the IOMMU_DEVICE flag.

2014-10-06 Thread Mitchel Humpherys
On Mon, Oct 06 2014 at 03:28:16 AM, Varun Sethi wrote: > This flag is used for specifying access to device memory. SMMU would apply > device memory attributes for a DMA transaction. This is required for setting > access to GIC registers, for generating message interrupts. This would ensure > tha

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

2014-10-01 Thread Mitchel Humpherys
On Wed, Oct 01 2014 at 01:27:27 AM, Arnd Bergmann wrote: > On Tuesday 30 September 2014 18:28:13 Mitchel Humpherys wrote: >> + if (readl_poll_timeout_atomic(cb_base + ARM_SMMU_CB_ATSR, tmp, >> + !(tmp & ATSR_ACTIVE), 50, 100)) { >>

[PATCH v4 1/2] iopoll: Introduce memory-mapped IO polling macros

2014-09-30 Thread Mitchel Humpherys
Deacon Signed-off-by: Matt Wagantall Signed-off-by: Mitchel Humpherys --- Changes since v3: - Updated commit message to better reflect the patch content --- include/linux/iopoll.h | 77 ++ 1 file changed, 77 insertions(+) create mode 100644 include

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

2014-09-30 Thread Mitchel Humpherys
On Tue, Sep 30 2014 at 03:23:34 AM, Will Deacon wrote: > Hi Mitch, > > On Sun, Sep 28, 2014 at 04:27:29AM +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 phys

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

2014-09-30 Thread Mitchel Humpherys
useful for testing and hardware validation. Since the address translation registers are optional on SMMUv2, only enable hardware translations when using SMMUv1 or when SMMU_IDR0.S1TS=1 and SMMU_IDR0.ATOSNS=0, as described in the ARM SMMU v1-v2 spec. Signed-off-by: Mitchel Humpherys --- Changes

[PATCH v4 0/2] iommu/arm-smmu: hard iova_to_phys

2014-09-30 Thread Mitchel Humpherys
gantall (1): iopoll: Introduce memory-mapped IO polling macros Mitchel Humpherys (1): iommu/arm-smmu: add support for iova_to_phys through ATS1PR drivers/iommu/arm-smmu.c | 79 +++- include/linux/iopoll.h | 77 +++

Re: [PATCH v3 1/2] iopoll: Introduce memory-mapped IO polling macros

2014-09-29 Thread Mitchel Humpherys
On Mon, Sep 29 2014 at 01:31:37 AM, Thierry Reding wrote: > On Sat, Sep 27, 2014 at 08:27:28PM -0700, Mitchel Humpherys wrote: >> From: Matt Wagantall >> >> It is sometimes necessary to poll a memory-mapped register until its >> value satisfies some condition. Introd

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

2014-09-27 Thread Mitchel Humpherys
useful for testing and hardware validation. Since the address translation registers are optional on SMMUv2, only enable hardware translations when using SMMUv1 or when SMMU_IDR0.S1TS=1 and SMMU_IDR0.ATOSNS=0, as described in the ARM SMMU v1-v2 spec. Signed-off-by: Mitchel Humpherys --- drivers

[PATCH v3 0/2] iommu/arm-smmu: hard iova_to_phys

2014-09-27 Thread Mitchel Humpherys
uffix - Removed some convenience iopoll wrappers to encourage explicitness v2..v3: - Remomved unnecessary `dev_name's Matt Wagantall (1): iopoll: Introduce memory-mapped IO polling macros Mitchel Humpherys (1): iommu/arm-smmu: add support for iova_to_phys through ATS1PR drivers

[PATCH v3 1/2] iopoll: Introduce memory-mapped IO polling macros

2014-09-27 Thread Mitchel Humpherys
-off-by: Matt Wagantall Signed-off-by: Mitchel Humpherys --- include/linux/iopoll.h | 77 ++ 1 file changed, 77 insertions(+) create mode 100644 include/linux/iopoll.h diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h new file mode 100644

Re: [PATCH v2 0/2] iommu/arm-smmu: hard iova_to_phys

2014-09-27 Thread Mitchel Humpherys
On Sat, Sep 27 2014 at 02:31:51 PM, Mitchel Humpherys wrote: > This series introduces support for performing iova-to-phys translations via > the ARM SMMU hardware on supported implementations. We also make use of > some new generic macros for polling hardware registers. > > C

[PATCH v2 0/2] iommu/arm-smmu: hard iova_to_phys

2014-09-27 Thread Mitchel Humpherys
' suffix - Removed some convenience iopoll wrappers to encourage explicitness Matt Wagantall (1): iopoll: Introduce memory-mapped IO polling macros Mitchel Humpherys (1): iommu/arm-smmu: add support for iova_to_phys through ATS1PR drivers/iommu/arm-smmu.c

[PATCH v2 1/2] iopoll: Introduce memory-mapped IO polling macros

2014-09-27 Thread Mitchel Humpherys
-off-by: Matt Wagantall Signed-off-by: Mitchel Humpherys --- include/linux/iopoll.h | 77 ++ 1 file changed, 77 insertions(+) create mode 100644 include/linux/iopoll.h diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h new file mode 100644

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

2014-09-27 Thread Mitchel Humpherys
useful for testing and hardware validation. Since the address translation registers are optional on SMMUv2, only enable hardware translations when using SMMUv1 or when SMMU_IDR0.S1TS=1 and SMMU_IDR0.ATOSNS=0, as described in the ARM SMMU v1-v2 spec. Signed-off-by: Mitchel Humpherys --- drivers

  1   2   >