[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

[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

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

[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

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 +++

[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

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

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

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

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.

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

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

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

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

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

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

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

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

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

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. > >

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

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

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

[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