Re: [PATCH 2/2] iommu/omap: Add support for configuring dsp iommus on DRA7xx

2015-07-27 Thread Tony Lindgren
* Suman Anna [150724 09:27]: > Hi Tony, > > On 07/23/2015 11:30 PM, Tony Lindgren wrote: > > * Suman Anna [150723 09:25]: > >> Hi Tony, > >> > >> On 07/23/2015 02:24 AM, Tony Lindgren wrote: > >>> * Suman Anna [150722 09:25]: > On 07/22/2015 12:26 AM, Tony Lindgren wrote: > > > > I

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-27 Thread Yong Wu
On Mon, 2015-07-27 at 15:11 +0100, Will Deacon wrote: > On Mon, Jul 27, 2015 at 03:05:38PM +0100, Robin Murphy wrote: > > On 27/07/15 05:21, Yong Wu wrote: > > > + } else {/* page or largepage */ > > > + if (quirk & IO_PGTABLE_QUIRK_SHORT_MTK) { > > > +

[PATCH v3 50/51] PCI: Introduce resource_disabled()

2015-07-27 Thread Yinghai Lu
so we can cover !flags and IORESOURCE_DISABLED both. Cc: linux-al...@vger.kernel.org Cc: linux-i...@vger.kernel.org Cc: linux-am33-l...@redhat.com Cc: linuxppc-...@lists.ozlabs.org Cc: linux-s...@vger.kernel.org Cc: sparcli...@vger.kernel.org Cc: linux-...@vger.kernel.org Cc: linux-xte...@linux-xt

Re: [PATCH v2 10/11] PCI: Stop caching ATS Invalidate Queue Depth

2015-07-27 Thread Don Dutile
On 07/27/2015 06:27 PM, Bjorn Helgaas wrote: Hi Don, On Mon, Jul 27, 2015 at 10:00:53AM -0400, Don Dutile wrote: On 07/20/2015 08:15 PM, Bjorn Helgaas wrote: Stop caching the Invalidate Queue Depth in struct pci_dev. pci_ats_queue_depth() is typically called only once per device, and it return

Re: [PATCH v2 01/11] iommu/vt-d: Cache PCI ATS state and Invalidate Queue Depth

2015-07-27 Thread Bjorn Helgaas
Hi Joerg, Thanks for all your help reviewing this! On Mon, Jul 27, 2015 at 03:08:10PM +0200, Joerg Roedel wrote: > On Mon, Jul 20, 2015 at 07:13:57PM -0500, Bjorn Helgaas wrote: > > We check the ATS state (enabled/disabled) and fetch the PCI ATS Invalidate > > Queue Depth in performance-sensitive

Re: [PATCH v2 10/11] PCI: Stop caching ATS Invalidate Queue Depth

2015-07-27 Thread Bjorn Helgaas
Hi Don, On Mon, Jul 27, 2015 at 10:00:53AM -0400, Don Dutile wrote: > On 07/20/2015 08:15 PM, Bjorn Helgaas wrote: > >Stop caching the Invalidate Queue Depth in struct pci_dev. > >pci_ats_queue_depth() is typically called only once per device, and it > >returns a fixed value per-device, so callers

[PATCH 3/5] iommu/arm-smmu: Clean up DMA API usage

2015-07-27 Thread Robin Murphy
With the correct DMA API calls now integrated into the io-pgtable code, let that handle the flushing of non-coherent page table updates. Signed-off-by: Robin Murphy --- drivers/iommu/arm-smmu.c | 23 +++ 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/i

[PATCH 2/5] iommu/arm-smmu: Sort out coherency

2015-07-27 Thread Robin Murphy
Currently we detect the whether the SMMU has coherent page table walk capability from the IDR0.CTTW field, and base our cache maintenance decisions on that. In preparation for fixing the bogus DMA API usage, however, we need to ensure that the DMA API agrees about this, which necessitates deferring

[PATCH 5/5] iommu/ipmmu-vmsa: Clean up DMA API usage

2015-07-27 Thread Robin Murphy
With the correct DMA API calls now integrated into the io-pgtable code, let that handle the flushing of non-coherent page table updates. Signed-off-by: Robin Murphy --- drivers/iommu/ipmmu-vmsa.c | 19 +-- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/iom

[PATCH 1/5] iommu/io-pgtable-arm: Allow appropriate DMA API use

2015-07-27 Thread Robin Murphy
Currently, users of the LPAE page table code are (ab)using dma_map_page() as a means to flush page table updates for non-coherent IOMMUs. Since from the CPU's point of view, creating IOMMU page tables *is* passing DMA buffers to a device (the IOMMU's page table walker), there's little reason not to

[PATCH 4/5] iommu/arm-smmu-v3: Clean up DMA API usage

2015-07-27 Thread Robin Murphy
With the correct DMA API calls now integrated into the io-pgtable code, let that handle the flushing of non-coherent page table updates. Signed-off-by: Robin Murphy --- drivers/iommu/arm-smmu-v3.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/io

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

2015-07-27 Thread Robin Murphy
On 27/07/15 16:31, Russell King - ARM Linux wrote: On Mon, Jul 27, 2015 at 02:23:26PM +0100, Robin Murphy wrote: On 16/07/15 10:04, Yong Wu wrote: This patch adds support for mediatek m4u (MultiMedia Memory Management Unit). Signed-off-by: Yong Wu [...] +static void mtk_iommu_flush_pgtable(

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

2015-07-27 Thread Will Deacon
On Mon, Jul 27, 2015 at 05:24:31AM +0100, Yong Wu wrote: > On Fri, 2015-07-24 at 17:55 +0100, Will Deacon wrote: > > On Fri, Jul 24, 2015 at 06:43:13AM +0100, Yong Wu wrote: > > > On Tue, 2015-07-21 at 15:59 +0100, Will Deacon wrote: > > > > On Thu, Jul 16, 2015 at 10:04:34AM +0100, Yong Wu wrote:

[PATCH 14/18] iommu: tegra-smmu: remove PageReserved manipulation

2015-07-27 Thread Russell King
Remove the unnecessary manipulation of the PageReserved flags in the Tegra SMMU driver. None of this is required as the page(s) remain private to the SMMU driver. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/iommu/teg

[PATCH 18/18] iommu: tegra-smmu: remove cacheflush.h

2015-07-27 Thread Russell King
Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index e5d6bc45c58f..4a8b66f05d8f 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -16,8 +16,6 @@ #inc

[PATCH 04/18] iommu: tegra-smmu: fix unmap() method

2015-07-27 Thread Russell King
The Tegra SMMU unmap path has several problems: 1. as_pte_put() can perform a write-after-free 2. tegra_smmu_unmap() can perform cache maintanence on a page we have just freed. 3. when a page table is unmapped, there is no CPU cache maintanence of the write clearing the page directory entry,

[PATCH 17/18] iommu: tegra-smmu: more cleanups

2015-07-27 Thread Russell King
Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 49 ++ 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 8bf38b95cdd5..e5d6bc45c58f 100644 --- a/drivers/iommu/tegra

[PATCH 01/18] ARM: reduce visibility of dmac_* functions

2015-07-27 Thread Russell King
The dmac_* functions are private to the ARM DMA API implementation, and should not be used by drivers. In order to discourage their use, remove their prototypes and macros from asm/*.h. We have to leave dmac_flush_range() behind as Exynos and MSM IOMMU code use these; once these sites are fixed,

[PATCH 12/18] iommu: tegra-smmu: smmu_flush_ptc() wants device address

2015-07-27 Thread Russell King
Pass smmu_flush_ptc() the device address rather than struct page poiner. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 89e7961f4848..c54b0afd

[PATCH 15/18] iommu: tegra-smmu: use __GFP_ZERO to allocate zeroed pages

2015-07-27 Thread Russell King
Rather than explicitly zeroing pages allocated via alloc_page(), add __GFP_ZERO to the gfp mask to ask the allocator for zeroed pages. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/

[PATCH 16/18] iommu: tegra-smmu: get_use

2015-07-27 Thread Russell King
Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index bc179c759805..8bf38b95cdd5 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/te

[PATCH 11/18] iommu: tegra-smmu: split smmu_flush_ptc()

2015-07-27 Thread Russell King
smmu_flush_ptc() is used in two modes: one is to flush an individual entry, the other is to flush all entries. We know at the call site which we require. Split the function into smmu_flush_ptc_all() and smmu_flush_ptc(). Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 26 +

[PATCH 07/18] iommu: tegra-smmu: fix page table lookup in unmap/iova_to_phys methods

2015-07-27 Thread Russell King
Fix the page table lookup in the unmap and iova_to_phys methods. Neither of these methods should allocate a page table; a missing page table should be treated the same as no mapping present. More importantly, using as_get_pte() for an IOVA corresponding with a non-present page table entry incremen

[PATCH 13/18] iommu: tegra-smmu: convert to use DMA API

2015-07-27 Thread Russell King
Use the DMA API instead of calling architecture internal functions in the Tegra SMMU driver. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 129 + 1 file changed, 84 insertions(+), 45 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c

[PATCH 05/18] iommu: tegra-smmu: factor out common pte setting

2015-07-27 Thread Russell King
Factor out the common pte setting code into a separate function. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 37 + 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index a7

[PATCH 10/18] iommu: tegra-smmu: move flush_dcache to tegra-smmu.c

2015-07-27 Thread Russell King
Drivers should not be using __cpuc_* functions nor outer_cache_flush() directly. This change partly cleans up tegra-smmu.c. The only difference between cache handling of the tegra variants is Denver, which omits the call to outer_cache_flush(). This is due to Denver being an ARM64 CPU, and the A

[PATCH 08/18] iommu: tegra-smmu: store struct page pointer for page tables

2015-07-27 Thread Russell King
Store the struct page pointer for the second level page tables, rather than working back from the page directory entry. This is necessary as we want to eliminate the use of physical addresses used with arch-private functions, switching instead to use the streaming DMA API. Signed-off-by: Russell

[PATCH 02/18] firmware: qcom_scm-32: replace open-coded call to __cpuc_flush_dcache_area()

2015-07-27 Thread Russell King
Signed-off-by: Russell King --- arch/arm/include/asm/cacheflush.h | 17 + drivers/firmware/qcom_scm-32.c| 4 +--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h index c5230a44eeca..d5525bf

[PATCH 09/18] iommu: tegra-smmu: use kcalloc() to allocate counter array

2015-07-27 Thread Russell King
Use kcalloc() to allocate the use-counter array for the page directory entries/page tables. Using kcalloc() allows us to be provided with zero-initialised memory from the allocators, rather than initialising it ourselves. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 21 ++---

[PATCH 06/18] iommu: tegra-smmu: add iova_pd_index() and iova_pt_index() helpers

2015-07-27 Thread Russell King
Add a pair of helpers to get the page directory and page table indexes. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 53d0f15dac6f..4c4

[PATCH 03/18] iommu: tegra-smmu: fix iova_to_phys() method

2015-07-27 Thread Russell King
iova_to_phys() has several problems: (a) iova_to_phys() is supposed to return 0 if there is no entry present for the iova. (b) if as_get_pte() fails, we oops the kernel by dereferencing a NULL pointer. Really, we should not even be trying to allocate a page table at all, but should onl

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

2015-07-27 Thread Russell King - ARM Linux
On Mon, Jul 27, 2015 at 02:23:26PM +0100, Robin Murphy wrote: > On 16/07/15 10:04, Yong Wu wrote: > >This patch adds support for mediatek m4u (MultiMedia Memory Management > >Unit). > > > >Signed-off-by: Yong Wu > [...] > >+static void mtk_iommu_flush_pgtable(void *ptr, size_t size, void *cookie)

Re: [PATCH 00/18] Clean up exposure of arch-internal code

2015-07-27 Thread Heiko Stübner
Am Montag, 27. Juli 2015, 15:13:13 schrieb Joerg Roedel: > [+ Heiko for comment on Rockchip IOMMU] adding also Daniel Kurtz and Tomasz Figa who did most of the iommu stuff if I remember correctly. While I'm not this versed in the iommu world I see the issue Russell pointed out, as especially t

Re: [PATCH 00/18] Clean up exposure of arch-internal code

2015-07-27 Thread Thierry Reding
On Mon, Jul 27, 2015 at 03:16:54PM +0100, Russell King - ARM Linux wrote: > On Mon, Jul 27, 2015 at 04:09:06PM +0200, Thierry Reding wrote: > > On Mon, Jul 27, 2015 at 01:28:24PM +0100, Russell King - ARM Linux wrote: > > > This series of patches attempts to clean up the use of architecture > > > i

Re: [PATCH 00/18] Clean up exposure of arch-internal code

2015-07-27 Thread Russell King - ARM Linux
On Mon, Jul 27, 2015 at 04:09:06PM +0200, Thierry Reding wrote: > On Mon, Jul 27, 2015 at 01:28:24PM +0100, Russell King - ARM Linux wrote: > > This series of patches attempts to clean up the use of architecture > > internal functions in drivers, and removes some functions from view > > in the asm/

Re: [PATCH 18/18] iommu: tegra-smmu: remove cacheflush.h

2015-07-27 Thread Thierry Reding
On Mon, Jul 27, 2015 at 01:30:17PM +0100, Russell King wrote: > Signed-off-by: Russell King > --- > drivers/iommu/tegra-smmu.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c > index e5d6bc45c58f..4a8b66f05d8f 100644 > --- a/drive

Re: [PATCH 17/18] iommu: tegra-smmu: more cleanups

2015-07-27 Thread Thierry Reding
On Mon, Jul 27, 2015 at 01:30:12PM +0100, Russell King wrote: > Signed-off-by: Russell King > --- > drivers/iommu/tegra-smmu.c | 49 > ++ > 1 file changed, 28 insertions(+), 21 deletions(-) Same here. Thierry signature.asc Description: PGP signatur

Re: [PATCH 16/18] iommu: tegra-smmu: get_use

2015-07-27 Thread Thierry Reding
On Mon, Jul 27, 2015 at 01:30:07PM +0100, Russell King wrote: > Signed-off-by: Russell King > --- > drivers/iommu/tegra-smmu.c | 17 +++-- > 1 file changed, 11 insertions(+), 6 deletions(-) Joerg may want to have a proper commit message here. If you're too busy I can probably come up

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-27 Thread Will Deacon
On Mon, Jul 27, 2015 at 03:05:38PM +0100, Robin Murphy wrote: > On 27/07/15 05:21, Yong Wu wrote: > > + } else {/* page or largepage */ > > + if (quirk & IO_PGTABLE_QUIRK_SHORT_MTK) { > > + if (large) { /* special Bit */ > > Th

Re: [PATCH 00/18] Clean up exposure of arch-internal code

2015-07-27 Thread Thierry Reding
On Mon, Jul 27, 2015 at 01:28:24PM +0100, Russell King - ARM Linux wrote: > This series of patches attempts to clean up the use of architecture > internal functions in drivers, and removes some functions from view > in the asm/ headers. I'm also considering whether we need to add > some linker mag

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-27 Thread Robin Murphy
On 27/07/15 05:21, Yong Wu wrote: [...] +static arm_short_iopte +__arm_short_pte_prot(struct arm_short_io_pgtable *data, int prot, bool large) +{ + arm_short_iopte pteprot; + + pteprot = ARM_SHORT_PTE_S | ARM_SHORT_PTE_nG; + pteprot |= large ? ARM_SHORT_PTE_TYPE_LARGE : +

Re: [PATCH v2 10/11] PCI: Stop caching ATS Invalidate Queue Depth

2015-07-27 Thread Don Dutile
On 07/20/2015 08:15 PM, Bjorn Helgaas wrote: Stop caching the Invalidate Queue Depth in struct pci_dev. pci_ats_queue_depth() is typically called only once per device, and it returns a fixed value per-device, so callers who need the value frequently can cache it themselves. Signed-off-by: Bjorn

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

2015-07-27 Thread Robin Murphy
On 16/07/15 10:04, Yong Wu wrote: This patch adds support for mediatek m4u (MultiMedia Memory Management Unit). Signed-off-by: Yong Wu [...] +static void mtk_iommu_flush_pgtable(void *ptr, size_t size, void *cookie) +{ + struct mtk_iommu_domain *domain = cookie; + unsigned long of

Re: [PATCH 00/18] Clean up exposure of arch-internal code

2015-07-27 Thread Joerg Roedel
[+ Heiko for comment on Rockchip IOMMU] On Mon, Jul 27, 2015 at 01:28:24PM +0100, Russell King - ARM Linux wrote: > This series of patches attempts to clean up the use of architecture > internal functions in drivers, and removes some functions from view > in the asm/ headers. I'm also considering

Re: [PATCH v2 01/11] iommu/vt-d: Cache PCI ATS state and Invalidate Queue Depth

2015-07-27 Thread Joerg Roedel
On Mon, Jul 20, 2015 at 07:13:57PM -0500, Bjorn Helgaas wrote: > We check the ATS state (enabled/disabled) and fetch the PCI ATS Invalidate > Queue Depth in performance-sensitive paths. It's easy to cache these, > which removes dependencies on PCI. > > Remember the ATS enabled state. When enabli

Re: [PATCH v2 11/11] PCI: Remove pci_ats_enabled()

2015-07-27 Thread Joerg Roedel
On Mon, Jul 20, 2015 at 07:15:19PM -0500, Bjorn Helgaas wrote: > Remove pci_ats_enabled(). There are no callers outside the ATS code > itself. We don't need to check ats_cap, because if we don't find an ATS > capability, we'll never set ats_enabled. > > Signed-off-by: Bjorn Helgaas > --- > dri

Re: [PATCH v2 10/11] PCI: Stop caching ATS Invalidate Queue Depth

2015-07-27 Thread Joerg Roedel
On Mon, Jul 20, 2015 at 07:15:11PM -0500, Bjorn Helgaas wrote: > Stop caching the Invalidate Queue Depth in struct pci_dev. > pci_ats_queue_depth() is typically called only once per device, and it > returns a fixed value per-device, so callers who need the value frequently > can cache it themselves

Re: [PATCH v2 08/11] PCI: Clean up ATS error handling

2015-07-27 Thread Joerg Roedel
On Mon, Jul 20, 2015 at 07:14:54PM -0500, Bjorn Helgaas wrote: > There's no need to BUG() if we enable ATS when it's already enabled. We > don't need to BUG() when disabling ATS on a device that doesn't support ATS > or if it's already disabled. If ATS is enabled, certainly we found an ATS > capa

Re: [PATCH v2 03/11] PCI: Embed ATS info directly into struct pci_dev

2015-07-27 Thread Joerg Roedel
On Mon, Jul 20, 2015 at 07:14:13PM -0500, Bjorn Helgaas wrote: > The pci_ats struct is small and will get smaller, so I don't think it's > worth allocating it separately from the pci_dev struct. > > Embed the ATS fields directly into struct pci_dev. > > Signed-off-by: Bjorn Helgaas > --- > driv

Re: [PATCH v2 02/11] PCI: Allocate ATS struct during enumeration

2015-07-27 Thread Joerg Roedel
On Mon, Jul 20, 2015 at 07:14:05PM -0500, Bjorn Helgaas wrote: > Previously, we allocated pci_ats structures when an IOMMU driver called > pci_enable_ats(). An SR-IOV VF shares the STU setting with its PF, so when > enabling ATS on the VF, we allocated a pci_ats struct for the PF if it > didn't al

[PATCH 00/18] Clean up exposure of arch-internal code

2015-07-27 Thread Russell King - ARM Linux
This series of patches attempts to clean up the use of architecture internal functions in drivers, and removes some functions from view in the asm/ headers. I'm also considering whether we need to add some linker magic to hide symbols when building the built-in.o files. This was triggered by 3rd

Re: [PATCH 1/3] Docs: dt: add generic MSI bindings

2015-07-27 Thread Mark Rutland
On Mon, Jul 27, 2015 at 09:02:46AM +0100, Marc Zyngier wrote: > Hi Mark, Hi, > On 23/07/15 17:52, Mark Rutland wrote: > > Currently msi-parent is used in a couple of drivers despite being fairly > > underspecified. This patch adds a generic binding for MSIs (including > > the existing msi-parent

Re: [PATCH 2/3] Docs: dt: Add PCI MSI map bindings

2015-07-27 Thread Mark Rutland
> > +Example (5) > > +=== > > + > > +/ { > > + #address-cells = <1>; > > + #size-cells = <1>; > > + > > + msi_a: msi-controller@a { > > + reg = <0xa 0x1>; > > + compatible = "vendor,some-controller"; > > + msi-controller; > > + #msi-cells = <1>;

Re: [PATCH 2/3] Docs: dt: Add PCI MSI map bindings

2015-07-27 Thread Marc Zyngier
On 23/07/15 17:52, Mark Rutland wrote: > Currently msi-parent is used by a few bindings to describe the > relationship between a PCI root complex and a single MSI controller, but > this property does not have a generic binding document. > > Additionally, msi-parent is insufficient to describe more

Re: [PATCH 1/3] Docs: dt: add generic MSI bindings

2015-07-27 Thread Marc Zyngier
Hi Mark, On 23/07/15 17:52, Mark Rutland wrote: > Currently msi-parent is used in a couple of drivers despite being fairly > underspecified. This patch adds a generic binding for MSIs (including > the existing msi-parent property) enabling the description of platform > devices capable of using MSI