[PATCH 3/5] iommu/amd: Hold the domain lock when calling __unmap_single

2019-09-10 Thread Filippo Sironi via iommu
__unmap_single makes several calls to __domain_flush_pages, which traverses the device list that is protected by the domain lock. __attach_device and __detach_device). Also, this is in line with the comment on top of __unmap_single, which says that the domain lock should be held when calling.

[PATCH 2/5] iommu/amd: Hold the domain lock when calling __map_single

2019-09-10 Thread Filippo Sironi
__map_single makes several calls to __domain_flush_pages, which traverses the device list that is protected by the domain lock. Also, this is in line with the comment on top of __map_single, which says that the domain lock should be held when calling. Signed-off-by: Filippo Sironi ---

[PATCH 5/5] iommu/amd: Hold the domain lock when calling domain_flush_tlb[_pde]

2019-09-10 Thread Filippo Sironi
From: Wei Wang domain_flush_tlb[_pde] traverses the device list, which is protected by the domain lock. Signed-off-by: Wei Wang Signed-off-by: Filippo Sironi --- drivers/iommu/amd_iommu.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/amd_iommu.c

iommu/amd: Flushing and locking fixes

2019-09-10 Thread Filippo Sironi
This patch series introduce patches to take the domain lock whenever we call functions that end up calling __domain_flush_pages. Holding the domain lock is necessary since __domain_flush_pages traverses the device list, which is protected by the domain lock. The first patch in the series adds a

[PATCH 1/5] iommu/amd: Wait for completion of IOTLB flush in attach_device

2019-09-10 Thread Filippo Sironi via iommu
Signed-off-by: Filippo Sironi --- drivers/iommu/amd_iommu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 61de81965c44..f026a8c2b218 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -2169,6 +2169,8 @@

[PATCH 4/5] iommu/amd: Hold the domain lock when calling iommu_map_page

2019-09-10 Thread Filippo Sironi
iommu_map_page calls into __domain_flush_pages, which requires the domain lock since it traverses the device list, which the lock protects. Signed-off-by: Filippo Sironi --- drivers/iommu/amd_iommu.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/iommu/amd_iommu.c

Re: [PATCH] iommu/vt-d: Add Scalable Mode fault information

2019-09-10 Thread Mehta, Sohil
On Tue, 2019-09-10 at 10:08 +0200, Joerg Roedel wrote: > > + "Unknown", "Unknown", "Unknown", "Unknown", "Unknown", > "Unknown", "Unknown", /* 0x49-0x4F */ > > Maybe add the number (0x49-0x4f) to the respecting "Unknown" fields? > If > we can't give a reason we should give the number for

Re: [PATCH v3 0/2] iommu: handle drivers that manage iommu directly

2019-09-10 Thread Rob Clark
On Tue, Sep 10, 2019 at 9:34 AM Robin Murphy wrote: > > On 06/09/2019 22:44, Rob Clark wrote: > > From: Rob Clark > > > > One of the challenges we have to enable the aarch64 laptops upstream > > is dealing with the fact that the bootloader enables the display and > > takes the corresponding SMMU

Re: [PATCH v2 1/2] iommu: add support for drivers that manage iommu explicitly

2019-09-10 Thread Robin Murphy
On 10/09/2019 16:34, Rob Clark wrote: On Tue, Sep 10, 2019 at 1:14 AM Joerg Roedel wrote: On Fri, Sep 06, 2019 at 02:44:01PM -0700, Rob Clark wrote: @@ -674,7 +674,7 @@ int iommu_group_add_device(struct iommu_group *group, struct device *dev) mutex_lock(>mutex);

Re: [PATCH v3 0/2] iommu: handle drivers that manage iommu directly

2019-09-10 Thread Robin Murphy
On 06/09/2019 22:44, Rob Clark wrote: From: Rob Clark One of the challenges we have to enable the aarch64 laptops upstream is dealing with the fact that the bootloader enables the display and takes the corresponding SMMU context-bank out of BYPASS. Unfortunately, currently, the IOMMU

Re: [PATCH] iommu/arm-smmu: fix "hang" when games exit

2019-09-10 Thread Rob Clark
On Tue, Sep 10, 2019 at 8:01 AM Robin Murphy wrote: > > On 07/09/2019 18:50, Rob Clark wrote: > > From: Rob Clark > > > > When games, browser, or anything using a lot of GPU buffers exits, there > > can be many hundreds or thousands of buffers to unmap and free. If the > > GPU is otherwise

Re: [PATCH v2 1/2] iommu: add support for drivers that manage iommu explicitly

2019-09-10 Thread Rob Clark
On Tue, Sep 10, 2019 at 1:14 AM Joerg Roedel wrote: > > On Fri, Sep 06, 2019 at 02:44:01PM -0700, Rob Clark wrote: > > @@ -674,7 +674,7 @@ int iommu_group_add_device(struct iommu_group *group, > > struct device *dev) > > > > mutex_lock(>mutex); > > list_add_tail(>list, >devices); > >

Re: [PATCH v9 0/5] iommu: Bounce page for untrusted devices

2019-09-10 Thread Konrad Rzeszutek Wilk
On Tue, Sep 10, 2019 at 04:53:23PM +0200, Joerg Roedel wrote: > On Fri, Sep 06, 2019 at 02:14:47PM +0800, Lu Baolu wrote: > > Lu Baolu (5): > > swiotlb: Split size parameter to map/unmap APIs > > iommu/vt-d: Check whether device requires bounce buffer > > iommu/vt-d: Don't switch off swiotlb

Re: [PATCH v9 1/5] swiotlb: Split size parameter to map/unmap APIs

2019-09-10 Thread Konrad Rzeszutek Wilk
On Fri, Sep 06, 2019 at 02:14:48PM +0800, Lu Baolu wrote: > This splits the size parameter to swiotlb_tbl_map_single() and > swiotlb_tbl_unmap_single() into an alloc_size and a mapping_size > parameter, where the latter one is rounded up to the iommu page > size. It does a bit more too. You have

Re: [PATCH] iommu/arm-smmu: fix "hang" when games exit

2019-09-10 Thread Robin Murphy
On 07/09/2019 18:50, Rob Clark wrote: From: Rob Clark When games, browser, or anything using a lot of GPU buffers exits, there can be many hundreds or thousands of buffers to unmap and free. If the GPU is otherwise suspended, this can cause arm-smmu to resume/suspend for each buffer,

Re: [PATCH v9 0/5] iommu: Bounce page for untrusted devices

2019-09-10 Thread Joerg Roedel
On Fri, Sep 06, 2019 at 02:14:47PM +0800, Lu Baolu wrote: > Lu Baolu (5): > swiotlb: Split size parameter to map/unmap APIs > iommu/vt-d: Check whether device requires bounce buffer > iommu/vt-d: Don't switch off swiotlb if bounce page is used > iommu/vt-d: Add trace events for device dma

Re: [PATCH] iommu/vt-d: Make function signatures static

2019-09-10 Thread Joerg Roedel
On Tue, Sep 10, 2019 at 09:06:56AM -0400, Qian Cai wrote: > On Tue, 2019-09-10 at 10:15 +0200, Joerg Roedel wrote: > > On Sat, Sep 07, 2019 at 04:49:33PM +1000, Adam Zerella wrote: > > > drivers/iommu/intel-iommu.c | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > >

Re: [PATCH v4 3/3] iommu: arm-smmu-impl: Add sdm845 implementation hook

2019-09-10 Thread Robin Murphy
On 23/08/2019 07:32, Vivek Gautam wrote: Add reset hook for sdm845 based platforms to turn off the wait-for-safe sequence. Understanding how wait-for-safe logic affects USB and UFS performance on MTP845 and DB845 boards: Qcom's implementation of arm,mmu-500 adds a WAIT-FOR-SAFE logic to

Re: [V1, 2/2] media: i2c: Add more sensor mode for ov8856 camera sensor

2019-09-10 Thread Tomasz Figa
Hi Dongchun, On Mon, Sep 9, 2019 at 6:27 PM Dongchun Zhu wrote: > > Hi Tomasz, > > On Fri, 2019-08-23 at 19:01 +0900, Tomasz Figa wrote: > > Hi Dongchun, > > > > On Thu, Aug 08, 2019 at 05:22:15PM +0800, dongchun@mediatek.com wrote: [snip] > > > + > > > /* vertical-timings from sensor */ >

Re: [PATCH] iommu/vt-d: Make function signatures static

2019-09-10 Thread Qian Cai
On Tue, 2019-09-10 at 10:15 +0200, Joerg Roedel wrote: > On Sat, Sep 07, 2019 at 04:49:33PM +1000, Adam Zerella wrote: > > drivers/iommu/intel-iommu.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > Applied, thanks. Joerg, not sure if you saw the reply from Lu,

Re: [PATCH] iommu/amd: Fix sparse warnings

2019-09-10 Thread Joerg Roedel
On Sat, Sep 07, 2019 at 04:58:12PM +1000, Adam Zerella wrote: > There was some simple Sparse warnings related to making some > signatures static. And unapplied both of your patches as they causes build failures: arch/x86/events/amd/iommu.o: In function `perf_iommu_read': iommu.c:(.text+0xba):

Re: [PATCH] iommu/amd: Fix sparse warnings

2019-09-10 Thread Joerg Roedel
On Sat, Sep 07, 2019 at 04:58:12PM +1000, Adam Zerella wrote: > drivers/iommu/amd_iommu.c | 4 ++-- > drivers/iommu/amd_iommu_init.c | 12 ++-- > 2 files changed, 8 insertions(+), 8 deletions(-) Applied, thanks. ___ iommu mailing list

Re: [PATCH] iommu/vt-d: Make function signatures static

2019-09-10 Thread Joerg Roedel
On Sat, Sep 07, 2019 at 04:49:33PM +1000, Adam Zerella wrote: > drivers/iommu/intel-iommu.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) Applied, thanks. ___ iommu mailing list iommu@lists.linux-foundation.org

Re: [PATCH v2 1/2] iommu: add support for drivers that manage iommu explicitly

2019-09-10 Thread Joerg Roedel
On Fri, Sep 06, 2019 at 02:44:01PM -0700, Rob Clark wrote: > @@ -674,7 +674,7 @@ int iommu_group_add_device(struct iommu_group *group, > struct device *dev) > > mutex_lock(>mutex); > list_add_tail(>list, >devices); > - if (group->domain) > + if (group->domain &&

Re: [PATCH] iommu/vt-d: Add Scalable Mode fault information

2019-09-10 Thread Joerg Roedel
On Fri, Sep 06, 2019 at 11:14:02AM -0700, Kyung Min Park wrote: > Intel VT-d specification revision 3 added support for Scalable Mode > Translation for DMA remapping. Add the Scalable Mode fault reasons to > show detailed fault reasons when the translation fault happens. > > Link: >