Re: [RFC PATCH 1/1] iommu/arm-smmu: Add support for multiple TBU child devices

2017-09-26 Thread Vivek Gautam
Hi Rob, On 09/19/2017 07:40 PM, Rob Herring wrote: Thanks for reviewing the patch. On Tue, Sep 12, 2017 at 05:31:07PM +0530, Vivek Gautam wrote: ARM MMU-500 implements a TBU (uTLB) for each connected master besides a single TCU which controls and manages the address translations. Each of the

[PATCH v3] dma-debug: fix incorrect pfn calculation

2017-09-26 Thread miles.chen
From: Miles Chen dma-debug reports the following warning: [name:panic&]WARNING: CPU: 3 PID: 298 at kernel-4.4/lib/dma-debug.c:604 debug _dma_assert_idle+0x1a8/0x230() DMA-API: cpu touching an active dma mapped cacheline [cln=0x0882300] CPU: 3 PID: 298 Comm: vold Tainted: GW O4.4

[PATCH v2] dma-debug: fix incorrect pfn calculation

2017-09-26 Thread miles.chen
From: Miles Chen dma-debug report the following warning: [name:panic&]WARNING: CPU: 3 PID: 298 at kernel-4.4/lib/dma-debug.c:604 debug _dma_assert_idle+0x1a8/0x230() DMA-API: cpu touching an active dma mapped cacheline [cln=0x0882300] CPU: 3 PID: 298 Comm: vold Tainted: GW O4.4.

Re: [PATCH] dma-debug: fix incorrect pfn calculation

2017-09-26 Thread Miles Chen
On Tue, 2017-09-26 at 15:53 +0100, Robin Murphy wrote: > On 26/09/17 14:24, miles.c...@mediatek.com wrote: > > From: Miles Chen > > > > dma-debug report the following warning: > > > > [name:panic&]WARNING: CPU: 3 PID: 298 at kernel-4.4/lib/dma-debug.c:604 > > debug _dma_assert_idle+0x1a8/0x230()

[RFC] iommu/arm-smmu: Add support for TTBR1

2017-09-26 Thread Jordan Crouse
(Reupping this from a few months back as requested for discussion) Allow a domain to opt into allocating and maintaining a TTBR1 pagetable. The size of the TTBR1 region will be the same as the TTBR0 size with the sign extension bit set on the highest bit in the region. By example, given a TTBR0/

Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU

2017-09-26 Thread Casey Leedom
So just to be 100% sure I understand the patch you're proposing, you got the first use of VTD_PAGE_SHIFT wrong; it should have been VTD_PAGE_MASK? I.e. diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 6784a05..d43b566 100644 --- a/drivers/iommu/intel-iommu.c +++ b/dr

[PATCH] iommu: Fix comment for iommu_ops.map_sg

2017-09-26 Thread Jean-Philippe Brucker
The definition of map_sg was split during a recent addition to iommu_ops. Put it back together. Fixes: add02cfdc9bc ("iommu: Introduce Interface for IOMMU TLB Flushing") Signed-off-by: Jean-Philippe Brucker --- include/linux/iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --g

Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU

2017-09-26 Thread Robin Murphy
On 26/09/17 15:34, Raj, Ashok wrote: > On Tue, Sep 26, 2017 at 03:22:47PM +0100, Robin Murphy wrote: >> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c >> index 6784a05dd6b2..d7f7def81613 100644 >> --- a/drivers/iommu/intel-iommu.c >> +++ b/drivers/iommu/intel-iommu.c >> @@ -

Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU

2017-09-26 Thread Casey Leedom
| From: Robin Murphy | Sent: Tuesday, September 26, 2017 7:22 AM | | On 26/09/17 13:21, Harsh Jain wrote: | > Find attached new set of log. After repeated tries it panics. | | Thanks, that makes things a bit clearer - looks like fixing the physical | address/pteval calculation to not be off by a p

Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU

2017-09-26 Thread Raj, Ashok
Oops..minor typo.. VTD_PAGE_SHIFT instead of VTD_PAGE_MASK On Tue, Sep 26, 2017 at 07:34:41AM -0700, Ashok Raj wrote: > On Tue, Sep 26, 2017 at 03:22:47PM +0100, Robin Murphy wrote: > > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > > index 6784a05dd6b2..d7f7def81613 100

Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU

2017-09-26 Thread Raj, Ashok
On Tue, Sep 26, 2017 at 03:22:47PM +0100, Robin Murphy wrote: > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > index 6784a05dd6b2..d7f7def81613 100644 > --- a/drivers/iommu/intel-iommu.c > +++ b/drivers/iommu/intel-iommu.c > @@ -2254,10 +2254,12 @@ static int __domain_mapp

Re: [PATCH v1 2/4] iommu/tegra: gart: Check whether page is already mapped

2017-09-26 Thread Dmitry Osipenko
On 26.09.2017 19:07, Thierry Reding wrote: > On Tue, Sep 26, 2017 at 04:49:52PM +0300, Dmitry Osipenko wrote: >> On 26.09.2017 14:06, Thierry Reding wrote: >>> On Wed, Jul 05, 2017 at 07:29:46PM +0300, Dmitry Osipenko wrote: Due to a bug, multiple devices may try to map the same IOVA region. W

Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU

2017-09-26 Thread Dan Williams
On Tue, Sep 26, 2017 at 9:06 AM, Casey Leedom wrote: > | From: Robin Murphy > | Sent: Tuesday, September 26, 2017 7:22 AM > > | > | On 26/09/17 13:21, Harsh Jain wrote: > | > Find attached new set of log. After repeated tries it panics. > | > | Thanks, that makes things a bit clearer - looks like

Re: [PATCH v1 2/4] iommu/tegra: gart: Check whether page is already mapped

2017-09-26 Thread Thierry Reding
On Tue, Sep 26, 2017 at 04:49:52PM +0300, Dmitry Osipenko wrote: > On 26.09.2017 14:06, Thierry Reding wrote: > > On Wed, Jul 05, 2017 at 07:29:46PM +0300, Dmitry Osipenko wrote: > >> Due to a bug, multiple devices may try to map the same IOVA region. We can > >> catch that case by checking that 'V

Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU

2017-09-26 Thread Casey Leedom
| From: Robin Murphy | Sent: Tuesday, September 26, 2017 7:22 AM | | On 26/09/17 13:21, Harsh Jain wrote: | > Find attached new set of log. After repeated tries it panics. | | Thanks, that makes things a bit clearer - looks like fixing the physical | address/pteval calculation to not be off by a p

Re: [PATCH] dma-debug: fix incorrect pfn calculation

2017-09-26 Thread Robin Murphy
On 26/09/17 14:24, miles.c...@mediatek.com wrote: > From: Miles Chen > > dma-debug report the following warning: > > [name:panic&]WARNING: CPU: 3 PID: 298 at kernel-4.4/lib/dma-debug.c:604 > debug _dma_assert_idle+0x1a8/0x230() > DMA-API: cpu touching an active dma mapped cacheline [cln=0x08

Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU

2017-09-26 Thread Robin Murphy
On 26/09/17 13:21, Harsh Jain wrote: > Find attached new set of log. After repeated tries it panics. Thanks, that makes things a bit clearer - looks like fixing the physical address/pteval calculation to not be off by a page in one direction wasn't helping much because the returned DMA address is

Re: [PATCH v1 1/4] iommu/tegra: gart: Don't unnecessarily allocate registers context

2017-09-26 Thread Dmitry Osipenko
On 26.09.2017 14:19, Thierry Reding wrote: > On Wed, Jul 05, 2017 at 07:29:45PM +0300, Dmitry Osipenko wrote: >> GART looses it's state only in case of a deepest suspend level. Let's not >> waste memory if machine doesn't support that suspend level. >> >> Signed-off-by: Dmitry Osipenko >> --- >>

[PATCH] dma-debug: fix incorrect pfn calculation

2017-09-26 Thread miles.chen
From: Miles Chen dma-debug report the following warning: [name:panic&]WARNING: CPU: 3 PID: 298 at kernel-4.4/lib/dma-debug.c:604 debug _dma_assert_idle+0x1a8/0x230() DMA-API: cpu touching an active dma mapped cacheline [cln=0x0882300] CPU: 3 PID: 298 Comm: vold Tainted: GW O4.4.

Re: [PATCH v1 2/4] iommu/tegra: gart: Check whether page is already mapped

2017-09-26 Thread Dmitry Osipenko
On 26.09.2017 14:06, Thierry Reding wrote: > On Wed, Jul 05, 2017 at 07:29:46PM +0300, Dmitry Osipenko wrote: >> Due to a bug, multiple devices may try to map the same IOVA region. We can >> catch that case by checking that 'VALID' bit of the GART's page entry is >> unset prior to mapping of the pa

Re: [PATCH 1/4] mm: move function alloc_pages_exact_nid out of __meminit

2017-09-26 Thread Michal Hocko
On Thu 21-09-17 14:29:19, Ganapatrao Kulkarni wrote: > This function can be used on NUMA systems in place of alloc_pages_exact > Adding code to export and to remove __meminit section tagging. It is usually better to fold such a change into a patch which adds a new user. Other than that I do not ha

Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU

2017-09-26 Thread Harsh Jain
On 26-09-2017 01:41, Dan Williams wrote: > On Mon, Sep 25, 2017 at 1:05 PM, Casey Leedom wrote: >> | From: Dan Williams >> | Sent: Monday, September 25, 2017 12:31 PM >> | ... >> | IIUC it looks like this has been broken ever since commit e1605495c716 >> | "intel-iommu: Introduce domain_sg_mapp

Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU

2017-09-26 Thread Harsh Jain
Find attached new set of log. After repeated tries it panics. On 26-09-2017 09:16, Harsh Jain wrote: > On 26-09-2017 00:16, Casey Leedom wrote: >> | From: Raj, Ashok >> | Sent: Monday, September 25, 2017 8:54 AM >> | >> | Not sure how the page->offset would end up being greater than page-size? >

Re: [PATCH v1 1/4] iommu/tegra: gart: Don't unnecessarily allocate registers context

2017-09-26 Thread Thierry Reding
On Wed, Jul 05, 2017 at 07:29:45PM +0300, Dmitry Osipenko wrote: > GART looses it's state only in case of a deepest suspend level. Let's not > waste memory if machine doesn't support that suspend level. > > Signed-off-by: Dmitry Osipenko > --- > drivers/iommu/tegra-gart.c | 36 ++

Re: DMA error when sg->offset value is greater than PAGE_SIZE in Intel IOMMU

2017-09-26 Thread Harsh Jain
On 26-09-2017 00:15, David Woodhouse wrote: > On Wed, 2017-09-20 at 16:01 +0800, Herbert Xu wrote: >> Harsh Jain wrote: >>>   >>> While debugging DMA mapping error in chelsio crypto driver we >> observed that when scatter/gather list received by driver has some >> entry with page->offset > 4096

Re: [PATCH v1 4/4] iommu/tegra: gart: Correct number of unmapped bytes

2017-09-26 Thread Thierry Reding
On Wed, Jul 05, 2017 at 07:29:48PM +0300, Dmitry Osipenko wrote: > The iommu_unmap() treats zero bytes number returned by an IOMMU driver as > an indicator that unmapping should be stopped. As a result, GART driver > unmaps only the first page entry of the whole range, which is incorrect. > > Sign

Re: [PATCH v1 3/4] iommu/tegra: gart: Move PFN validation out of spinlock

2017-09-26 Thread Thierry Reding
On Wed, Jul 05, 2017 at 07:29:47PM +0300, Dmitry Osipenko wrote: > Validation of page frame number doesn't require protection with a spinlock, > let's move it out of spinlock for consistency. > > Signed-off-by: Dmitry Osipenko > --- > drivers/iommu/tegra-gart.c | 4 ++-- > 1 file changed, 2 inse

Re: [PATCH v1 2/4] iommu/tegra: gart: Check whether page is already mapped

2017-09-26 Thread Thierry Reding
On Wed, Jul 05, 2017 at 07:29:46PM +0300, Dmitry Osipenko wrote: > Due to a bug, multiple devices may try to map the same IOVA region. We can > catch that case by checking that 'VALID' bit of the GART's page entry is > unset prior to mapping of the page. Due to what bug? Sounds to me like access t

Re: bind pasid table API

2017-09-26 Thread Jean-Philippe Brucker
On 25/09/17 16:14, Raj, Ashok wrote: > On Mon, Sep 25, 2017 at 12:45:00PM +0100, Jean-Philippe Brucker wrote: > [snip] > >> This format tells how the guest organizes its PASID tables. Depending on >> 'format', the PASID table can be: >> * A flat array of descriptors >> * One array of 1st-level des

[PATCH] iommu/amd: pr_err() strings should end with newlines

2017-09-26 Thread Arvind Yadav
pr_err() messages should end with a new-line to avoid other messages being concatenated. So replace '/n' with '\n'. Signed-off-by: Arvind Yadav --- drivers/iommu/amd_iommu_init.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/