Re: Consult on ARM SMMU debugfs

2021-01-15 Thread Russell King - ARM Linux admin
On Mon, Jan 11, 2021 at 08:01:48PM +, Robin Murphy wrote: > On 2021-01-07 02:45, chenxiang (M) wrote: > > Hi Will,  Robin or other guys, > > > > When debugging SMMU/SVA issue on huawei ARM64 board, we find that it > > lacks of enough debugfs for ARM SMMU driver (such as > > > > the value of S

Re: [PATCH 1/4] ARM/omap1: switch to use dma_direct_set_offset for lbus DMA offsets

2020-09-23 Thread Russell King - ARM Linux admin
On Mon, Sep 21, 2020 at 08:47:23AM +0200, Christoph Hellwig wrote: > On Mon, Sep 21, 2020 at 09:44:18AM +0300, Tony Lindgren wrote: > > * Janusz Krzysztofik [200919 22:29]: > > > Hi Tony, > > > > > > On Friday, September 18, 2020 7:49:33 A.M. CEST Tony Lindgren wrote: > > > > * Christoph Hellwig

Re: [PATCH 2/4] ARM/footbridge: switch to use dma_direct_set_offset for lbus DMA offsets

2020-09-17 Thread Russell King - ARM Linux admin
On Thu, Sep 17, 2020 at 07:32:27PM +0200, Christoph Hellwig wrote: > static int __init cats_pci_init(void) > { > - if (machine_is_cats()) > - pci_common_init(&cats_pci); > + if (!machine_is_cats()) > + return 0; > + bus_register_notifier(&pci_bus_type, &footbri

Re: [PATCH 3/4] ARM/dma-mapping: don't handle NULL devices in dma-direct.h

2020-09-17 Thread Russell King - ARM Linux admin
On Thu, Sep 17, 2020 at 07:32:28PM +0200, Christoph Hellwig wrote: > The DMA API removed support for not passing in a device a long time > ago, so remove the NULL checks. What happens with ISA devices? -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps dow

Re: [PATCH 2/3] ARM/keystone: move the DMA offset handling under ifdef CONFIG_ARM_LPAE

2020-09-11 Thread Russell King - ARM Linux admin
On Thu, Sep 10, 2020 at 07:40:37AM +0200, Christoph Hellwig wrote: > The DMA offset notifier can only be used if PHYS_OFFSET is at least > KEYSTONE_HIGH_PHYS_START, which can't be represented by a 32-bit > phys_addr_t. Currently the code compiles fine despite that, a pending > change to the DMA of

Re: decruft the vmalloc API

2020-04-08 Thread Russell King - ARM Linux admin
On Wed, Apr 08, 2020 at 01:58:58PM +0200, Christoph Hellwig wrote: > Hi all, > > Peter noticed that with some dumb luck you can toast the kernel address > space with exported vmalloc symbols. > > I used this as an opportunity to decruft the vmalloc.c API and make it > much more systematic. This

Re: [PATCH] iommu: silence iommu group prints

2020-03-04 Thread Russell King - ARM Linux admin
On Wed, Mar 04, 2020 at 12:33:14PM +0200, Laurentiu Tudor wrote: > > > On 04.03.2020 12:07, Russell King - ARM Linux admin wrote: > > On Wed, Mar 04, 2020 at 11:56:53AM +0200, Laurentiu Tudor wrote: > > > From 44ae46501b5379bd0890df87fd3827248626ed03 Mon Sep 17

Re: [PATCH] iommu: silence iommu group prints

2020-03-04 Thread Russell King - ARM Linux admin
On Wed, Mar 04, 2020 at 11:56:53AM +0200, Laurentiu Tudor wrote: > From 44ae46501b5379bd0890df87fd3827248626ed03 Mon Sep 17 00:00:00 2001 > From: Laurentiu Tudor > Date: Tue, 1 Oct 2019 16:22:48 +0300 > Subject: [PATCH 1/6] bus: fsl-mc: make mc work with smmu disable bypass on > Content-Type: text

Re: [PATCH] iommu: silence iommu group prints

2020-03-04 Thread Russell King - ARM Linux admin
On Wed, Mar 04, 2020 at 11:42:16AM +0200, Laurentiu Tudor wrote: > On 04.03.2020 11:33, Russell King - ARM Linux admin wrote: > > On Wed, Mar 04, 2020 at 10:56:06AM +0200, Laurentiu Tudor wrote: > > > > > > On 04.03.2020 00:17, Russell King - ARM Linux admin wrote: >

Re: [PATCH] iommu: silence iommu group prints

2020-03-04 Thread Russell King - ARM Linux admin
On Wed, Mar 04, 2020 at 10:56:06AM +0200, Laurentiu Tudor wrote: > > On 04.03.2020 00:17, Russell King - ARM Linux admin wrote: > > On Tue, Mar 03, 2020 at 05:55:05PM +0200, Laurentiu Tudor wrote: > > > From c98dc05cdd45ae923654f2427985bd28bcde4bb2 Mon Sep 17 00:00:00 2001

Re: [PATCH] iommu: silence iommu group prints

2020-03-03 Thread Russell King - ARM Linux admin
On Tue, Mar 03, 2020 at 05:55:05PM +0200, Laurentiu Tudor wrote: > From c98dc05cdd45ae923654f2427985bd28bcde4bb2 Mon Sep 17 00:00:00 2001 > From: Laurentiu Tudor > Date: Thu, 13 Feb 2020 11:59:12 +0200 > Subject: [PATCH 1/4] bus: fsl-mc: add custom .dma_configure implementation > Content-Type: tex

Re: [PATCH] iommu: silence iommu group prints

2020-03-03 Thread Russell King - ARM Linux admin
s at the end (for context). > > > > On 28/02/2020 10:06 am, Russell King - ARM Linux admin wrote: > > > On Fri, Feb 28, 2020 at 09:33:40AM +, John Garry wrote: > > > > On 28/02/2020 02:16, Lu Baolu wrote: > > > > > Hi, > > > > >

Re: [PATCH] iommu: silence iommu group prints

2020-02-28 Thread Russell King - ARM Linux admin
On Fri, Feb 28, 2020 at 09:33:40AM +, John Garry wrote: > On 28/02/2020 02:16, Lu Baolu wrote: > > Hi, > > > > On 2020/2/27 19:57, Russell King wrote: > > > On the LX2160A, there are lots (about 160) of IOMMU messages produced > > > during boot; this is excessive.  Reduce the severity of these

Re: [PATCH] iommu: silence iommu group prints

2020-02-27 Thread Russell King - ARM Linux admin
On Thu, Feb 27, 2020 at 06:19:10PM +, Robin Murphy wrote: > On 27/02/2020 1:48 pm, Russell King - ARM Linux admin wrote: > > On Thu, Feb 27, 2020 at 01:44:56PM +, Robin Murphy wrote: > > > On 27/02/2020 11:57 am, Russell King wrote: > > > > On the LX2160A,

Re: [PATCH] iommu: silence iommu group prints

2020-02-27 Thread Russell King - ARM Linux admin
On Thu, Feb 27, 2020 at 01:44:56PM +, Robin Murphy wrote: > On 27/02/2020 11:57 am, Russell King wrote: > > On the LX2160A, there are lots (about 160) of IOMMU messages produced > > during boot; this is excessive. Reduce the severity of these messages > > to debug level. > > That's... a lot.

Re: [PATCH] iommu/arm-smmu: fix the module name for disable_bypass parameter

2020-02-11 Thread Russell King - ARM Linux admin
On Tue, Feb 11, 2020 at 05:36:55PM -0600, Li Yang wrote: > Since commit cd221bd24ff5 ("iommu/arm-smmu: Allow building as a module"), > there is a side effect that the module name is changed from arm-smmu to > arm-smmu-mod. So the kernel parameter for disable_bypass need to be > changed too. Fix t

Re: [PATCH] iommu/arm-smmu: Report USF more clearly

2019-09-13 Thread Russell King - ARM Linux admin
On Fri, Sep 13, 2019 at 12:48:37PM +0100, Robin Murphy wrote: > Although CONFIG_ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT is a welcome tool > for smoking out inadequate firmware, the failure mode is non-obvious > and can be confusing for end users. Add some special-case reporting of > Unidentified Stream

Re: [PATCH 1/4] vmalloc: lift the arm flag for coherent mappings to common code

2019-08-30 Thread Russell King - ARM Linux admin
On Fri, Aug 30, 2019 at 08:29:21AM +0200, Christoph Hellwig wrote: > The arm architecture had a VM_ARM_DMA_CONSISTENT flag to mark DMA > coherent remapping for a while. Lift this flag to common code so > that we can use it generically. We also check it in the only place > VM_USERMAP is directly c

Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-06 Thread Russell King - ARM Linux admin
On Tue, Aug 06, 2019 at 05:45:03PM +0100, Russell King - ARM Linux admin wrote: > On Tue, Aug 06, 2019 at 05:08:54PM +0100, Will Deacon wrote: > > On Sat, Aug 03, 2019 at 08:48:12AM +0200, Christoph Hellwig wrote: > > > On Fri, Aug 02, 2019 at 11:38:03AM +0100,

Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-06 Thread Russell King - ARM Linux admin
On Tue, Aug 06, 2019 at 05:08:54PM +0100, Will Deacon wrote: > On Sat, Aug 03, 2019 at 08:48:12AM +0200, Christoph Hellwig wrote: > > On Fri, Aug 02, 2019 at 11:38:03AM +0100, Will Deacon wrote: > > > > > > So this boils down to a terminology mismatch. The Arm architecture > > > doesn't have > >

Re: SATA broken with LPAE

2019-06-27 Thread Russell King - ARM Linux admin
On Thu, Jun 27, 2019 at 11:15:30AM +0200, Christoph Hellwig wrote: > On Thu, Jun 27, 2019 at 10:07:53AM +0100, Russell King - ARM Linux admin > wrote: > > dmabounce has only ever been used with specific devices that have weird > > setups. Otherwise, we've never expected w

Re: SATA broken with LPAE

2019-06-27 Thread Russell King - ARM Linux admin
On Wed, Jun 26, 2019 at 02:53:25PM +0200, Christoph Hellwig wrote: > Hi Roger, > > it seems the arm dma direct mapping code isn't doing the right thing > here. On other platforms that have > 4G memory we always use swiotlb > for bounce buffering in case a device that can't DMA to all the memory.

Re: [PATCH 2/2] ARM: dma-mapping: allow larger DMA mask than supported

2019-05-21 Thread Russell King - ARM Linux admin
On Tue, May 21, 2019 at 02:47:29PM +0200, Christoph Hellwig wrote: > Since Linux 5.1 we allow drivers to just set the largest DMA mask they > support instead of falling back to smaller ones. This doesn't make sense. "they" is confusing - why would a driver set a DMA mask larger than the driver su

Re: [PATCH 1/2] dma-mapping: truncate dma masks to what dma_addr_t can hold

2019-05-21 Thread Russell King - ARM Linux admin
On Tue, May 21, 2019 at 02:47:28PM +0200, Christoph Hellwig wrote: > The dma masks in struct device are always 64-bits wide. But for builds > using a 32-bit dma_addr_t we need to ensure we don't store an > unsupportable value. Before Linux 5.0 this was handled at least by > the ARM dma mapping co

Re: remove NULL struct device support in the DMA API

2019-04-03 Thread Russell King - ARM Linux admin
On Thu, Mar 21, 2019 at 03:52:28PM -0700, Christoph Hellwig wrote: > We still have a few drivers which pass a NULL struct device pointer > to DMA API functions, which generally is a bad idea as the API > implementations rely on the device not only for ops selection, but > also the dma mask and vari

Re: [PATCH v5 0/9] Use vm_insert_range

2018-12-24 Thread Russell King - ARM Linux
Having discussed with Matthew offlist, I think we've come to the following conclusion - there's a number of drivers that buggily ignore vm_pgoff. So, what I proposed is: static int __vm_insert_range(struct vm_struct *vma, struct page *pages, size_t num, unsigned long

Re: [PATCH v5 6/9] iommu/dma-iommu.c: Convert to use vm_insert_range

2018-12-24 Thread Russell King - ARM Linux
On Mon, Dec 24, 2018 at 06:55:31PM +0530, Souptick Joarder wrote: > Convert to use vm_insert_range() to map range of kernel > memory to user vma. > > Signed-off-by: Souptick Joarder > Reviewed-by: Matthew Wilcox > --- > drivers/iommu/dma-iommu.c | 13 +++-- > 1 file changed, 3 insertion

Re: [PATCH 4/9] dma-mapping: move the arm64 ncoherent alloc/free support to common code

2018-12-04 Thread Russell King - ARM Linux
On Mon, Nov 05, 2018 at 01:19:26PM +0100, Christoph Hellwig wrote: > The arm64 codebase to implement coherent dma allocation for architectures > with non-coherent DMA is a good start for a generic implementation, given > that is uses the generic remap helpers, provides the atomic pool for > allocat

Re: remove the ->mapping_error method from dma_map_ops V3

2018-11-30 Thread Russell King - ARM Linux
On Fri, Nov 30, 2018 at 02:22:08PM +0100, Christoph Hellwig wrote: > Error reporting for the dma_map_single and dma_map_page operations is > currently a mess. Both APIs directly return the dma_addr_t to be used for > the DMA, with a magic error escape that is specific to the instance and > checked

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-28 Thread Russell King - ARM Linux
On Wed, Nov 28, 2018 at 11:27:17AM -0800, David Miller wrote: > From: Linus Torvalds > Date: Wed, 28 Nov 2018 10:00:06 -0800 > > > Not all memory is accessible even to the kernel. If you have memory > > that shows up in the last page of phys_addr_t, you just mark it > > reserved at boot-time. >

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-28 Thread Russell King - ARM Linux
On Wed, Nov 28, 2018 at 11:19:15AM -0800, Linus Torvalds wrote: > On Wed, Nov 28, 2018, 10:08 Russell King - ARM Linux wrote: > > > > > > > You already cannot do that kmalloc(), exactly because of ERR_PTR(). > > > > I'm very sorry, but I think you

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-28 Thread Russell King - ARM Linux
On Wed, Nov 28, 2018 at 06:08:41PM +, Russell King - ARM Linux wrote: > On Wed, Nov 28, 2018 at 10:00:06AM -0800, Linus Torvalds wrote: > > On Wed, Nov 28, 2018 at 9:45 AM Russell King - ARM Linux > > wrote: > > > > > > > I don't think this is a

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-28 Thread Russell King - ARM Linux
On Wed, Nov 28, 2018 at 10:00:06AM -0800, Linus Torvalds wrote: > On Wed, Nov 28, 2018 at 9:45 AM Russell King - ARM Linux > wrote: > > > > > I don't think this is a huge deal, but ERR_PTR() has been hugely > > > successful elsewhere. And I'm not hug

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-28 Thread Russell King - ARM Linux
On Wed, Nov 28, 2018 at 08:47:05AM -0800, Linus Torvalds wrote: > On Tue, Nov 27, 2018 at 11:41 PM Christoph Hellwig wrote: > > > > On Fri, Nov 23, 2018 at 07:55:11AM +0100, Christoph Hellwig wrote: > > > Well, I can tweak the last patch to return -EINVAL from dma_mapping_error > > > instead of th

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-23 Thread Russell King - ARM Linux
On Fri, Nov 23, 2018 at 02:03:13PM +0100, Joerg Roedel wrote: > On Fri, Nov 23, 2018 at 11:01:55AM +0000, Russell King - ARM Linux wrote: > > Yuck. So, if we have a 4GB non-PAE 32-bit system, or a PAE system > > where we have valid memory across the 4GB boundary and no IOMMU,

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-23 Thread Russell King - ARM Linux
On Fri, Nov 23, 2018 at 11:49:18AM +0100, Joerg Roedel wrote: > On Thu, Nov 22, 2018 at 05:52:15PM +, Robin Murphy wrote: > > Unfortunately, with things like the top-down IOVA allocator, and 32-bit > > systems in general, "the top 4095" values may well still be valid addresses > > - we're relyi

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-22 Thread Russell King - ARM Linux
On Thu, Nov 22, 2018 at 09:55:25AM -0800, Linus Torvalds wrote: > On Thu, Nov 22, 2018 at 9:52 AM Robin Murphy wrote: > > > > Unfortunately, with things like the top-down IOVA allocator, and 32-bit > > systems in general, "the top 4095" values may well still be valid > > addresses - > > Ugh. > >

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-22 Thread Russell King - ARM Linux
On Thu, Nov 22, 2018 at 08:50:47AM -0800, Linus Torvalds wrote: > On Thu, Nov 22, 2018 at 6:03 AM Christoph Hellwig wrote: > > > > The 0 return doesn't work for direct mappings that have ram at address > > zero and a lot of IOMMUs that start allocating bus space from address > > zero, so we can't

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-22 Thread Russell King - ARM Linux
On Thu, Nov 22, 2018 at 09:09:47AM -0800, Linus Torvalds wrote: > On Thu, Nov 22, 2018 at 9:07 AM Russell King - ARM Linux > wrote: > > > > I'm afraid that won't work very well - 32 bit platforms with 64-bit > > addresses (LPAE) would have dma_addr_t as a 64-bit

Re: [PATCH v2] of/platform: initialise AMBA default DMA masks

2018-08-31 Thread Russell King - ARM Linux
On Fri, Aug 31, 2018 at 10:26:14AM +0200, Linus Walleij wrote: > This addresses a v4.19-rc1 regression in the PL111 DRM driver > in drivers/gpu/pl111/* > > The driver uses the CMA KMS helpers and will thus at some > point call down to dma_alloc_attrs() to allocate a chunk > of contigous DMA memory

Re: [PATCH] of/platform: Initialise AMBA default DMA masks

2018-08-30 Thread Russell King - ARM Linux
On Thu, Aug 30, 2018 at 10:45:11AM +0200, Linus Walleij wrote: > On Thu, Aug 30, 2018 at 10:40 AM Russell King - ARM Linux > wrote: > > > Well, as I've no idea what the issue is here, I can't do anything or > > make any suggestions. I wasn't copied o

Re: [PATCH] of/platform: Initialise AMBA default DMA masks

2018-08-30 Thread Russell King - ARM Linux
On Wed, Aug 29, 2018 at 07:55:21AM +0200, Christoph Hellwig wrote: > On Tue, Aug 28, 2018 at 03:14:14PM +0100, Russell King - ARM Linux wrote: > > But yes, the fundamental fact is that AMBA devices don't have any > > care about the differences between coherent and

Re: [PATCH] of/platform: Initialise AMBA default DMA masks

2018-08-28 Thread Russell King - ARM Linux
On Tue, Aug 28, 2018 at 03:25:55PM +0200, Linus Walleij wrote: > On Tue, Aug 28, 2018 at 11:21 AM Christoph Hellwig wrote: > > > > + dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); > > > + if (!dev->dev.dma_mask) > > > + dev->dev.dma_mask = &dev->dev.coherent_dma_mask; > > > >

Re: [PATCH v2 7/7] OF: Don't set default coherent DMA mask

2018-07-27 Thread Russell King - ARM Linux
On Fri, Jul 27, 2018 at 12:36:00PM +0100, Robin Murphy wrote: > That is intentional. Consider a 32-bit device on a bus with an upstream DMA > range of 40 bits (which could easily happen with e.g. PCI). If the firmware > code gives that device 40-bit DMA masks and the driver doesn't change them, > t

Re: [PATCH v4 1/2] ARM: dma-mapping: Set proper DMA ops in arm_iommu_detach_device()

2018-07-02 Thread Russell King - ARM Linux
On Mon, Jul 02, 2018 at 01:53:17PM +0200, Thierry Reding wrote: > On Wed, May 30, 2018 at 04:06:24PM +0200, Thierry Reding wrote: > > From: Thierry Reding > > > > Instead of setting the DMA ops pointer to NULL, set the correct, > > non-IOMMU ops depending on the device's coherency setting. > > >

Re: dma_sync_*_for_cpu and direction=TO_DEVICE (was Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation)

2018-05-18 Thread Russell King - ARM Linux
On Fri, May 18, 2018 at 01:35:08PM -0700, Vineet Gupta wrote: > On 05/18/2018 10:50 AM, Russell King - ARM Linux wrote: > >On Fri, May 18, 2018 at 10:20:02AM -0700, Vineet Gupta wrote: > >>I never understood the need for this direction. And if memory serves me > >>right

Re: dma_sync_*_for_cpu and direction=TO_DEVICE (was Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation)

2018-05-18 Thread Russell King - ARM Linux
On Fri, May 18, 2018 at 07:57:34PM +, Alexey Brodkin wrote: > Hi Russel, That's Russell. > On Fri, 2018-05-18 at 18:50 +0100, Russell King - ARM Linux wrote: > > It's necessary. Take a moment to think carefully about this: > > >

Re: dma_sync_*_for_cpu and direction=TO_DEVICE (was Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation)

2018-05-18 Thread Russell King - ARM Linux
On Fri, May 18, 2018 at 10:20:02AM -0700, Vineet Gupta wrote: > I never understood the need for this direction. And if memory serves me > right, at that time I was seeing twice the amount of cache flushing ! It's necessary. Take a moment to think carefully about this: dma_map_single(, di

Re: Difference between IOVA and bus address when SMMU is enabled

2018-05-14 Thread Russell King - ARM Linux
On Sat, May 12, 2018 at 06:25:13PM +0530, valmiki wrote: > Hi All, > > What is the difference between IOVA address and bus address > when SMMU is enabled ? > > Is IOVA address term used only when hypervisor is present ? IOVA = IO virtual address. IOVA is the term normally used to describe the a

Re: [PATCH 04/20] arm-nommu: use generic dma_noncoherent_ops

2018-05-11 Thread Russell King - ARM Linux
On Fri, May 11, 2018 at 09:59:29AM +0200, Christoph Hellwig wrote: > Switch to the generic noncoherent direct mapping implementation for > the nommu dma map implementation. > > Signed-off-by: Christoph Hellwig > --- > arch/arc/Kconfig| 1 + > arch/arm/Kconfig|

Re: noveau vs arm dma ops

2018-04-26 Thread Russell King - ARM Linux
(While there's a rain shower...) On Thu, Apr 26, 2018 at 02:09:42AM -0700, Christoph Hellwig wrote: > synopsis: > > drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c:pdevinfo.dma_mask > = DMA_BIT_MASK(32); > drivers/gpu/drm/bridge/synopsys/dw-hdmi.c: pdevinfo.dma_mask =

Re: noveau vs arm dma ops

2018-04-25 Thread Russell King - ARM Linux
On Wed, Apr 25, 2018 at 11:35:13PM +0200, Daniel Vetter wrote: > On arm that doesn't work. The iommu api seems like a good fit, except > the dma-api tends to get in the way a bit (drm/msm apparently has > similar problems like tegra), and if you need contiguous memory > dma_alloc_coherent is the on

Re: noveau vs arm dma ops

2018-04-25 Thread Russell King - ARM Linux
On Wed, Apr 25, 2018 at 08:33:12AM -0700, Christoph Hellwig wrote: > On Wed, Apr 25, 2018 at 12:04:29PM +0200, Daniel Vetter wrote: > > - dma api hides the cache flushing requirements from us. GPUs love > > non-snooped access, and worse give userspace control over that. We want > > a strict sep

Re: [PATCH v2 5/5] ARM: Unconditionally enable ARM_DMA_USE_IOMMU

2018-04-25 Thread Russell King - ARM Linux
On Wed, Apr 25, 2018 at 12:10:51PM +0200, Thierry Reding wrote: > From: Thierry Reding > > The ARM_DMA_USE_IOMMU Kconfig option has side-effects that drivers can > not opt into but have to explicitly opt out of. This can lead to subtle > bugs that are difficult to track down and not immediately o

Re: noveau vs arm dma ops

2018-04-25 Thread Russell King - ARM Linux
On Wed, Apr 25, 2018 at 01:54:39AM -0700, Christoph Hellwig wrote: > [discussion about this patch, which should have been cced to the iommu > and linux-arm-kernel lists, but wasn't: > https://www.spinics.net/lists/dri-devel/msg173630.html] > > On Wed, Apr 25, 2018 at 09:41:51AM +0200, Thierry Re

Re: [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig

2018-04-24 Thread Russell King - ARM Linux
On Tue, Apr 24, 2018 at 08:55:49AM +0200, Christoph Hellwig wrote: > On Tue, Apr 24, 2018 at 12:52:05AM +0100, Russell King - ARM Linux wrote: > > On Mon, Apr 23, 2018 at 07:04:18PM +0200, Christoph Hellwig wrote: > > > This way we have one central definition of it, and use

Re: [PATCH 11/12] swiotlb: move the SWIOTLB config symbol to lib/Kconfig

2018-04-23 Thread Russell King - ARM Linux
On Mon, Apr 23, 2018 at 07:04:18PM +0200, Christoph Hellwig wrote: > This way we have one central definition of it, and user can select it as > needed. Note that we also add a second ARCH_HAS_SWIOTLB symbol to > indicate the architecture supports swiotlb at all, so that we can still > make the usa

Re: [PATCH 25/44] arm: implement ->mapping_error

2017-06-08 Thread Russell King - ARM Linux
BOn Thu, Jun 08, 2017 at 03:25:50PM +0200, Christoph Hellwig wrote: > +static int dmabounce_mapping_error(struct device *dev, dma_addr_t dma_addr) > +{ > + if (dev->archdata.dmabounce) > + return 0; I'm not convinced that we need this check here: dev->archdata.dmabounce =

Re: [PATCH V3 6/8] arm: dma-mapping: Reset the device's dma_ops

2017-05-25 Thread Russell King - ARM Linux
On Wed, May 24, 2017 at 02:26:13PM +0300, Laurent Pinchart wrote: > Again, the patch I propose is the simplest v4.12-rc fix I can think of, short > of reverting your complete IOMMU probe deferral patch series. Let's focus on > the v4.12-rc fix, and then discuss how to move forward in v4.13 and be

Re: [PATCH V3 6/8] arm: dma-mapping: Reset the device's dma_ops

2017-05-23 Thread Russell King - ARM Linux
On Wed, May 24, 2017 at 12:46:51AM +0300, Laurent Pinchart wrote: > Hi Russell, > > On Tuesday 23 May 2017 18:53:19 Russell King - ARM Linux wrote: > > On Tue, May 23, 2017 at 05:55:57PM +0100, Robin Murphy wrote: > > > On 23/05/17 17:25, Russell King - ARM Linux wrote:

Re: [PATCH V3 6/8] arm: dma-mapping: Reset the device's dma_ops

2017-05-23 Thread Russell King - ARM Linux
On Tue, May 23, 2017 at 05:55:57PM +0100, Robin Murphy wrote: > On 23/05/17 17:25, Russell King - ARM Linux wrote: > > So, I've come to apply this patch (since it's finally landed in the patch > > system), and I'm not convinced that the commit message is really u

Re: [PATCH V3 6/8] arm: dma-mapping: Reset the device's dma_ops

2017-05-23 Thread Russell King - ARM Linux
On Thu, Oct 27, 2016 at 09:07:23AM +0530, Sricharan wrote: > Hi Robin, > > >-Original Message- > >From: Robin Murphy [mailto:robin.mur...@arm.com] > >Sent: Wednesday, October 26, 2016 8:37 PM > >To: Sricharan R ; will.dea...@arm.com; > >j...@8bytes.org; iommu@lists.linux-foundation.org; l

Re: [PATCH v2] arm64/dma-mapping: fix DMA_ATTR_FORCE_CONTIGUOUS mmaping code

2017-03-31 Thread Russell King - ARM Linux
On Fri, Mar 31, 2017 at 01:02:51PM +0200, Andrzej Hajda wrote: > In this version of the patch I have replaced temporal pages and > iommu_dma_mmap with remap_pfn_range or rather its simplified version > vm_iomap_memory. > Unfortunately I have not find nice helper for sgtable creation, so I > left sg

Re: [PATCHv7 4/6] arm: dma-mapping: add {map, unmap}_resource for iommu ops

2016-06-01 Thread Russell King - ARM Linux
On Wed, Jun 01, 2016 at 05:22:27PM +0200, Niklas Söderlund wrote: > +static dma_addr_t arm_iommu_map_resource(struct device *dev, > + phys_addr_t phys_addr, size_t size, > + enum dma_data_direction dir, struct dma_attrs *attrs) > +{ > + struct dma_iommu_mapping *mapping

Re: [PATCH 2/4] ARM: dma-mapping: Constify attrs passed to internal functions

2016-05-24 Thread Russell King - ARM Linux
On Tue, May 24, 2016 at 08:28:08AM +0200, Krzysztof Kozlowski wrote: > Some of the non-exported functions do not modify passed dma_attrs so the > pointer can point to const data. > > Signed-off-by: Krzysztof Kozlowski Acked-by: Russell King Thanks. -- RMK's Patch system: http://www.armlinux.

Re: [PATCH 2/4] scatterlist: add sg_alloc_table_from_buf() helper

2016-03-31 Thread Russell King - ARM Linux
On Thu, Mar 31, 2016 at 04:45:57PM +0200, Boris Brezillon wrote: > Hi Russell, > > On Thu, 31 Mar 2016 15:14:13 +0100 > Russell King - ARM Linux wrote: > > > On Thu, Mar 31, 2016 at 02:29:42PM +0200, Boris Brezillon wrote: > > > sg_alloc_table_from_buf() provides

Re: [PATCH 2/4] scatterlist: add sg_alloc_table_from_buf() helper

2016-03-31 Thread Russell King - ARM Linux
On Thu, Mar 31, 2016 at 02:29:42PM +0200, Boris Brezillon wrote: > sg_alloc_table_from_buf() provides an easy solution to create an sg_table > from a virtual address pointer. This function takes care of dealing with > vmallocated buffers, buffer alignment, or DMA engine limitations (maximum > DMA t

Re: [PATCH v6 1/3] iommu: Implement common IOMMU ops for DMA mapping

2015-11-04 Thread Russell King - ARM Linux
On Wed, Nov 04, 2015 at 06:48:50PM +0900, Tomasz Figa wrote: > There is no requirement, but shouldn't it be desired for the mapping > code to map them as such? Otherwise, how could the IOMMU use case you > described above (address translator for devices which don't have the > capability to address

Re: [PATCH v6 1/3] iommu: Implement common IOMMU ops for DMA mapping

2015-11-04 Thread Russell King - ARM Linux
On Wed, Nov 04, 2015 at 02:12:03PM +0900, Tomasz Figa wrote: > My understanding of a scatterlist was that it represents a buffer as a > whole, by joining together its physically discontinuous segments. Correct, and it may also be scattered in CPU virtual space as well. > I don't see how single se

Re: [PATCH v6 1/3] iommu: Implement common IOMMU ops for DMA mapping

2015-11-04 Thread Russell King - ARM Linux
On Wed, Nov 04, 2015 at 02:15:41PM +0900, Tomasz Figa wrote: > On Wed, Nov 4, 2015 at 3:40 AM, Russell King - ARM Linux > wrote: > > On Tue, Nov 03, 2015 at 05:41:24PM +, Robin Murphy wrote: > >> Hi Tomasz, > >> > >> On 02/11/15 13:43, Tomasz Figa wrot

Re: [PATCH v6 1/3] iommu: Implement common IOMMU ops for DMA mapping

2015-11-03 Thread Russell King - ARM Linux
On Tue, Nov 03, 2015 at 05:41:24PM +, Robin Murphy wrote: > Hi Tomasz, > > On 02/11/15 13:43, Tomasz Figa wrote: > >Agreed. The dma_map_*() API is not guaranteed to return a single > >contiguous part of virtual address space for any given SG list. > >However it was understood to be able to map

Re: [RFC PATCH 0/3] iommu: Add range flush operation

2015-09-29 Thread Russell King - ARM Linux
On Tue, Sep 29, 2015 at 05:27:12PM +0100, Robin Murphy wrote: > Eh, swings and roundabouts. An argument denoting whether the flush is being > called on the map or unmap path would be fine, Sorry, that statement is wrong. It's not about whether you flush before or after the DMA operation. I'm afr

Re: [RFC PATCH 0/3] iommu: Add range flush operation

2015-09-29 Thread Russell King - ARM Linux
On Tue, Sep 29, 2015 at 03:20:38PM +0100, Robin Murphy wrote: > A single callback doesn't really generalise well enough: If we wanted to > implement this in the ARM SMMU drivers to optimise the unmap() case [ask > Will how long he spends waiting for a software model to tear down an entire > VFIO do

Re: [PATCH v2] iommu/io-pgtable-arm: Don't use dma_to_phys()

2015-09-18 Thread Russell King - ARM Linux
On Fri, Sep 18, 2015 at 12:04:26PM +0100, Robin Murphy wrote: > Specifically, the problem case for that is when phys_addr_t is 64-bit but > dma_addr_t is 32-bit. The cast in __arm_lpae_dma_addr is necessary to avoid > a truncation warning when we make the DMA API calls, but we actually need > the o

Re: [PATCH 05/13] iommu/io-pgtable-arm: Allow appropriate DMA API use

2015-08-04 Thread Russell King - ARM Linux
On Tue, Aug 04, 2015 at 03:47:13PM +0100, Robin Murphy wrote: > Hi Laurent, > > [ +RMK, as his patch is indirectly involved here ] > > On 04/08/15 14:16, Laurent Pinchart wrote: > >This is what I believe to be an API abuse. The dma_sync_single_for_device() > >API is meant to pass ownership of a b

Re: [PATCH] iommu/arm-smmu-v2: ThunderX(errata-23399) mis-extends 64bit registers

2015-07-31 Thread Russell King - ARM Linux
On Thu, Jul 30, 2015 at 08:54:04PM +, Chalamarla, Tirumalesh wrote: > is some thing like this looks good > > +#ifdef CONFIG_64BIT > +#define smmu_writeq(reg64, addr) writeq_relaxed((reg64), (addr)) > +#else > +#define smmu_writeq(reg64, addr) \ > + wri

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

[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: [RFC PATCH v2 2/3] arm64: add IOMMU dma_ops

2015-03-09 Thread Russell King - ARM Linux
On Thu, Mar 05, 2015 at 11:16:28AM +, Robin Murphy wrote: > Hi Laura, > > On 05/03/15 00:19, Laura Abbott wrote: > [...] > >>Consider that the IOMMU's page table walker is a DMA master in its own > >right, and that is the device you're mapping the page tables for. > >Therefore your IOMMU drive

Re: [PATCHv7 07/26] driver core: amba: add device binding path 'driver_override'

2014-09-26 Thread Russell King - ARM Linux
On Tue, Sep 23, 2014 at 04:46:06PM +0200, Antonios Motakis wrote: > As already demonstrated with PCI [1] and the platform bus [2], a > driver_override property in sysfs can be used to bypass the id matching > of a device to a AMBA driver. This can be used by VFIO to bind to any AMBA > device reques

Re: [PATCH] iommu/arm-smmu: avoid calling request_irq in atomic context

2014-07-26 Thread Russell King - ARM Linux
On Fri, Jul 25, 2014 at 04:26:59PM -0700, Mitchel Humpherys wrote: > - irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx]; > - ret = request_irq(irq, arm_smmu_context_fault, IRQF_SHARED, > - "arm-smmu-context-fault", domain); > - if (IS_ERR_VALUE(ret)) { > -

Re: [PATCH v3] iommu: shmobile: Enable the driver on all ARM platforms

2013-10-30 Thread Russell King - ARM Linux
On Wed, Oct 30, 2013 at 12:20:43PM +0100, Laurent Pinchart wrote: > Renesas ARM platforms are transitioning from single-platform to > multi-platform kernels using the new ARCH_SHMOBILE_MULTI. Make the > driver available on all ARM platforms to enable it on both ARCH_SHMOBILE > and ARCH_SHMOBILE_MUL

Re: [PATCHv7 9/9] ARM: dma-mapping: add support for IOMMU mapper

2012-03-06 Thread Russell King - ARM Linux
On Wed, Feb 29, 2012 at 04:04:22PM +0100, Marek Szyprowski wrote: > +static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct > *vma, > + void *cpu_addr, dma_addr_t dma_addr, size_t size, > + struct dma_attrs *attrs) > +{ > + struct arm_vmregion

Re: [PATCH 2/2] iommu/omap: fix NULL pointer dereference

2012-02-22 Thread Russell King - ARM Linux
On Wed, Feb 22, 2012 at 11:10:38AM +0200, Ohad Ben-Cohen wrote: > On Wed, Feb 22, 2012 at 10:56 AM, Russell King - ARM Linux > wrote: > > There's something else which needs fixing here - the return code.  If > > omap_find_iovm_area() returns an error code that needs propag

Re: [PATCH 2/2] iommu/omap: fix NULL pointer dereference

2012-02-22 Thread Russell King - ARM Linux
On Wed, Feb 22, 2012 at 10:52:52AM +0200, Ohad Ben-Cohen wrote: > @@ -274,7 +274,7 @@ static ssize_t debug_read_mem(struct file *file, char > __user *userbuf, > mutex_lock(&iommu_debug_lock); > > area = omap_find_iovm_area(dev, (u32)ppos); > - if (IS_ERR(area)) { > + if (IS_E

Re: [PATCH 8/8 RESEND] ARM: dma-mapping: add support for IOMMU mapper

2012-01-25 Thread Russell King - ARM Linux
On Mon, Jan 09, 2012 at 04:49:21PM +0100, Marek Szyprowski wrote: > This patch add a complete implementation of DMA-mapping API for > devices that have IOMMU support. All DMA-mapping calls are supported. > > This patch contains some of the code kindly provided by Krishna Reddy > and Andrzej Pietr