[PATCH] iommu/mediatek: fix leaked of_node references

2019-04-16 Thread Wen Yang
The call to of_parse_phandle returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. 581 static int mtk_iommu_probe(struct platform_device *pdev) 582 { ... 626 for (i = 0; i < larb_nr; i++) { 627 struct device_node

Re: [PATCH v5 1/6] iommu: add generic boot option iommu.dma_mode

2019-04-16 Thread Leizhen (ThunderTown)
On 2019/4/16 23:21, Will Deacon wrote: > On Fri, Apr 12, 2019 at 02:11:31PM +0100, Robin Murphy wrote: >> On 12/04/2019 11:26, John Garry wrote: >>> On 09/04/2019 13:53, Zhen Lei wrote: +static int __init iommu_dma_mode_setup(char *str) +{ +if (!str) +goto fail;

Re: [PATCH v2 0/2] iommu/arm-smmu-v3: make sure the kdump kernel can work well when smmu is enabled

2019-04-16 Thread Leizhen (ThunderTown)
On 2019/4/16 17:14, Will Deacon wrote: > On Mon, Apr 08, 2019 at 10:31:47AM +0800, Leizhen (ThunderTown) wrote: >> On 2019/4/4 23:30, Will Deacon wrote: >>> On Mon, Mar 18, 2019 at 09:12:41PM +0800, Zhen Lei wrote: v1 --> v2: 1. Drop part2. Now, we only use the SMMUv3 hardware feature

Re: [PATCH 2/9] iommu/dma-iommu: Add function to flush any cached not present IOTLB entries

2019-04-16 Thread Tom Murphy via iommu
>That said, I've now gone and looked and AFAICS both the Intel... Ah, I missed that, you're right. >...and AMD It doesn't look like it. On AMD the cache is flushed during iommu_ops::map only if the there are page table pages to free (if we're allocating a large page and freeing the sub pages),

Re: [PATCH v2 1/7] ACPI/IORT: Check ATS capability in root complex nodes

2019-04-16 Thread Jean-Philippe Brucker
On 15/04/2019 19:31, Robin Murphy wrote: > On 09/04/2019 17:52, Jean-Philippe Brucker wrote: >> Root complex node in IORT has a bit telling whether it supports ATS or >> not. Store this bit in the IOMMU fwspec when setting up a device, so it >> can be accessed later by an IOMMU driver. > > Hmm,

Re: [PATCH -next] xen-swiotlb: Make two functions static

2019-04-16 Thread Boris Ostrovsky
On 4/16/19 10:49 AM, Yue Haibing wrote: > From: YueHaibing > > Fix sparse warnings: > > drivers/xen/swiotlb-xen.c:489:1: warning: > symbol 'xen_swiotlb_sync_single_for_cpu' was not declared. Should it be > static? > drivers/xen/swiotlb-xen.c:496:1: warning: > symbol

Re: [PATCH 10/18] iommu/vt-d: Add custom allocator for IOASID

2019-04-16 Thread Jacob Pan
On Mon, 15 Apr 2019 14:37:11 -0600 Alex Williamson wrote: > On Mon, 8 Apr 2019 16:59:25 -0700 > Jacob Pan wrote: > > > When VT-d driver runs in the guest, PASID allocation must be > > performed via virtual command interface. This patch register a > > custom IOASID allocator which takes

Re: [PATCH v5 1/6] iommu: add generic boot option iommu.dma_mode

2019-04-16 Thread Will Deacon
On Fri, Apr 12, 2019 at 02:11:31PM +0100, Robin Murphy wrote: > On 12/04/2019 11:26, John Garry wrote: > > On 09/04/2019 13:53, Zhen Lei wrote: > > > +static int __init iommu_dma_mode_setup(char *str) > > > +{ > > > +    if (!str) > > > +    goto fail; > > > + > > > +    if (!strncmp(str,

[PATCH -next] xen-swiotlb: Make two functions static

2019-04-16 Thread Yue Haibing
From: YueHaibing Fix sparse warnings: drivers/xen/swiotlb-xen.c:489:1: warning: symbol 'xen_swiotlb_sync_single_for_cpu' was not declared. Should it be static? drivers/xen/swiotlb-xen.c:496:1: warning: symbol 'xen_swiotlb_sync_single_for_device' was not declared. Should it be static?

Re: [PATCH 6/9] iommu/amd: Implement map_atomic

2019-04-16 Thread Robin Murphy
On 11/04/2019 19:47, Tom Murphy wrote: Instead of using a spin lock I removed the mutex lock from both the amd_iommu_map and amd_iommu_unmap path as well. iommu_map doesn’t lock while mapping and so if iommu_map is called by two different threads on the same iova region it results in a race

Re: [PATCH 2/9] iommu/dma-iommu: Add function to flush any cached not present IOTLB entries

2019-04-16 Thread Robin Murphy
On 11/04/2019 19:47, Tom Murphy wrote: Both the AMD and Intel drivers can cache not present IOTLB entries. To convert these drivers to the dma-iommu api we need a generic way to flush the NP cache. IOMMU drivers which have a NP cache can implement the .flush_np_cache function in the iommu ops

Re: [PATCH 3/9] iommu/dma-iommu: Add iommu_dma_copy_reserved_iova, iommu_dma_apply_resv_region to the dma-iommu api

2019-04-16 Thread Robin Murphy
On 16/04/2019 14:22, Tom Murphy wrote: I hoped this could be an exception, it's easier to grok without the line break and isn't crazy long. Because you mentioned it I'll fix it. Frankly this patch is hard to justify anyway - iommu-dma already has its own reserved region handling, and there

Re: [PATCH 3/9] iommu/dma-iommu: Add iommu_dma_copy_reserved_iova, iommu_dma_apply_resv_region to the dma-iommu api

2019-04-16 Thread Tom Murphy via iommu
I hoped this could be an exception, it's easier to grok without the line break and isn't crazy long. Because you mentioned it I'll fix it. On Mon, Apr 15, 2019 at 7:31 AM Christoph Hellwig wrote: > > On Thu, Apr 11, 2019 at 07:47:32PM +0100, Tom Murphy via iommu wrote: > > + > > +

Re: [PATCH v4 0/3] PCIe Host request to reserve IOVA

2019-04-16 Thread Srinath Mannam via iommu
Hi Bjorn, Thanks for review. Please find my reply below. On Sat, Apr 13, 2019 at 4:04 AM Bjorn Helgaas wrote: > > On Fri, Apr 12, 2019 at 08:43:32AM +0530, Srinath Mannam wrote: > > Few SOCs have limitation that their PCIe host can't allow few inbound > > address ranges. Allowed inbound address

[REBASE PATCH v5 8/9] xen/gntdev.c: Convert to use vm_map_pages()

2019-04-16 Thread Souptick Joarder
Convert to use vm_map_pages() to map range of kernel memory to user vma. map->count is passed to vm_map_pages() and internal API verify map->count against count ( count = vma_pages(vma)) for page array boundary overrun condition. Signed-off-by: Souptick Joarder Reviewed-by: Boris Ostrovsky ---

[REBASE PATCH v5 9/9] xen/privcmd-buf.c: Convert to use vm_map_pages_zero()

2019-04-16 Thread Souptick Joarder
Convert to use vm_map_pages_zero() to map range of kernel memory to user vma. This driver has ignored vm_pgoff. We could later "fix" these drivers to behave according to the normal vm_pgoff offsetting simply by removing the _zero suffix on the function name and if that causes regressions, it

[REBASE PATCH v5 3/9] drivers/firewire/core-iso.c: Convert to use vm_map_pages_zero()

2019-04-16 Thread Souptick Joarder
Convert to use vm_map_pages_zero() to map range of kernel memory to user vma. This driver has ignored vm_pgoff and mapped the entire pages. We could later "fix" these drivers to behave according to the normal vm_pgoff offsetting simply by removing the _zero suffix on the function name and if that

[REBASE PATCH v5 5/9] drm/xen/xen_drm_front_gem.c: Convert to use vm_map_pages()

2019-04-16 Thread Souptick Joarder
Convert to use vm_map_pages() to map range of kernel memory to user vma. Signed-off-by: Souptick Joarder Reviewed-by: Oleksandr Andrushchenko --- drivers/gpu/drm/xen/xen_drm_front_gem.c | 18 +- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git

[REBASE PATCH v5 4/9] drm/rockchip/rockchip_drm_gem.c: Convert to use vm_map_pages()

2019-04-16 Thread Souptick Joarder
Convert to use vm_map_pages() to map range of kernel memory to user vma. Tested on Rockchip hardware and display is working, including talking to Lima via prime. Signed-off-by: Souptick Joarder Tested-by: Heiko Stuebner --- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 17 ++--- 1

[REBASE PATCH v5 7/9] videobuf2/videobuf2-dma-sg.c: Convert to use vm_map_pages()

2019-04-16 Thread Souptick Joarder
Convert to use vm_map_pages() to map range of kernel memory to user vma. vm_pgoff is treated in V4L2 API as a 'cookie' to select a buffer, not as a in-buffer offset by design and it always want to mmap a whole buffer from its beginning. Signed-off-by: Souptick Joarder Suggested-by: Marek

[REBASE PATCH v5 2/9] arm: mm: dma-mapping: Convert to use vm_map_pages()

2019-04-16 Thread Souptick Joarder
Convert to use vm_map_pages() to map range of kernel memory to user vma. Signed-off-by: Souptick Joarder --- arch/arm/mm/dma-mapping.c | 22 ++ 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index

Re: [PATCH v2 6/7] iommu/arm-smmu-v3: Add support for PCI ATS

2019-04-16 Thread Will Deacon
On Mon, Apr 15, 2019 at 07:00:27PM +0100, Jean-Philippe Brucker wrote: > On 15/04/2019 14:21, Will Deacon wrote: > > On Tue, Apr 09, 2019 at 05:52:44PM +0100, Jean-Philippe Brucker wrote: > >> PCIe devices can implement their own TLB, named Address Translation Cache > >> (ATC). Enable Address

Re: [PATCH v2 0/2] iommu/arm-smmu-v3: make sure the kdump kernel can work well when smmu is enabled

2019-04-16 Thread Will Deacon
On Mon, Apr 08, 2019 at 10:31:47AM +0800, Leizhen (ThunderTown) wrote: > On 2019/4/4 23:30, Will Deacon wrote: > > On Mon, Mar 18, 2019 at 09:12:41PM +0800, Zhen Lei wrote: > >> v1 --> v2: > >> 1. Drop part2. Now, we only use the SMMUv3 hardware feature > >> STE.config=0b000 > >> (Report abort to

Re: [PATCH v2 3/3] drm/panfrost: Add initial panfrost driver

2019-04-16 Thread Daniel Vetter
On Mon, Apr 15, 2019 at 10:30:14AM +0100, Steven Price wrote: > On 15/04/2019 10:18, Daniel Vetter wrote: > > On Fri, Apr 05, 2019 at 05:42:33PM +0100, Steven Price wrote: > >> On 05/04/2019 17:16, Alyssa Rosenzweig wrote: > >>> acronym once ever and have it as a "??"), I'm not sure how to respond