Re: fully convert arm to use dma-direct

2022-05-09 Thread Russell King (Oracle)
On Fri, Apr 22, 2022 at 11:17:20PM +0200, Linus Walleij wrote: > On Thu, Apr 21, 2022 at 9:42 AM Christoph Hellwig wrote: > > > arm is the last platform not using the dma-direct code for directly > > mapped DMA. With the dmaboune removal from Arnd we can easily switch > > arm to always use dma-d

Re: [PATCH v1 00/16] .map_sg() error cleanup

2021-07-15 Thread Russell King (Oracle)
On Thu, Jul 15, 2021 at 10:45:28AM -0600, Logan Gunthorpe wrote: > Hi, > > This series is spun out and expanded from my work to add P2PDMA support > to DMA map operations[1]. > > The P2PDMA work requires distinguishing different error conditions in > a map_sg operation. dma_map_sgtable() already

Re: [bug report] iommu_dma_unmap_sg() is very slow then running IO from remote numa node

2021-07-09 Thread Russell King (Oracle)
On Fri, Jul 09, 2021 at 04:38:09PM +0800, Ming Lei wrote: > I observed that NVMe performance is very bad when running fio on one > CPU(aarch64) in remote numa node compared with the nvme pci numa node. Have you checked the effect of running a memory-heavy process using memory from node 1 while bei

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

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.

[PATCH] iommu: silence iommu group prints

2020-02-27 Thread Russell King
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. Signed-off-by: Russell King --- drivers/iommu/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers

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
ly aligned, and the mappings have to keep at least the basic > alignment. > > A git tree is also available here: > > git://git.infradead.org/users/hch/misc.git dma-mapping-error.3 Hi Chris, For patches 1, 3 and 23, Acked-by: Russell King Thanks. -- RMK's Patch syst

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
the coherent DMA mask > to 0x when creating a device from the device > tree, which is crude, but seems to be what kernel v4.18 > assumed. > > Cc: Russell King > Cc: Christoph Hellwig > Cc: Robin Murphy > Signed-off-by: Linus Walleij > --- > Russell, Chr

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
insertions(+), 6 deletions(-) > > Christoph, Russell, > > could either of you provide an Acked-by for this? I think it makes the > most sense for Ben to pick this up into the Nouveau tree along with > patch 2/2. Looks fine to me. Acked-by: Russell King Thanks. > >

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
This is for the I2S audio driver, and I suspect is wrong - I doubt that the I2S sub-device itself does any DMA what so ever. 8<=== From: Russell King Subject: drm: bridge: dw-hdmi: Negotiate dma mask with DMA API DMA drivers are supposed to negotiate the DMA mask with the DMA API, but this

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

[PATCH] iommu: convert DT component matching to component_match_add_release()

2016-10-19 Thread Russell King
Convert DT component matching to use component_match_add_release(). Signed-off-by: Russell King --- drivers/iommu/mtk_iommu.c| 8 +--- drivers/iommu/mtk_iommu.h| 5 + drivers/iommu/mtk_iommu_v1.c | 8 +--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a

[PATCH v2 3/3] iommu: convert DT component matching to component_match_add_release()

2016-06-03 Thread Russell King
Convert DT component matching to use component_match_add_release(). Signed-off-by: Russell King --- drivers/iommu/mtk_iommu.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index c3043d8754e3..71cf62af4e24

[PATCH] iommu: convert DT component matching to component_match_add_release()

2016-06-03 Thread Russell King
Convert DT component matching to use component_match_add_release(). Signed-off-by: Russell King --- drivers/iommu/mtk_iommu.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index c3043d8754e3..c036df1c49ca

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 P

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

[PATCH 14/18] iommu: tegra-smmu: remove PageReserved manipulation

2015-07-27 Thread Russell King
Remove the unnecessary manipulation of the PageReserved flags in the Tegra SMMU driver. None of this is required as the page(s) remain private to the SMMU driver. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/iommu

[PATCH 18/18] iommu: tegra-smmu: remove cacheflush.h

2015-07-27 Thread Russell King
Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index e5d6bc45c58f..4a8b66f05d8f 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -16,8 +16,6

[PATCH 04/18] iommu: tegra-smmu: fix unmap() method

2015-07-27 Thread Russell King
, nor is there any maintanence of the IOMMU to ensure that it sees the page table has gone. Fix this by getting rid of as_pte_put(), and instead coding the PTE unmap separately from the PDE unmap, placing the PDE unmap after the PTE unmap has been completed. Signed-off-by: Russell King

[PATCH 17/18] iommu: tegra-smmu: more cleanups

2015-07-27 Thread Russell King
Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 49 ++ 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 8bf38b95cdd5..e5d6bc45c58f 100644 --- a/drivers/iommu

[PATCH 01/18] ARM: reduce visibility of dmac_* functions

2015-07-27 Thread Russell King
, this can be moved also. Signed-off-by: Russell King --- arch/arm/include/asm/cacheflush.h | 4 arch/arm/include/asm/glue-cache.h | 2 -- arch/arm/mm/dma-mapping.c | 1 + arch/arm/mm/dma.h | 32 4 files changed, 33 insertions(+), 6

[PATCH 12/18] iommu: tegra-smmu: smmu_flush_ptc() wants device address

2015-07-27 Thread Russell King
Pass smmu_flush_ptc() the device address rather than struct page poiner. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 89e7961f4848

[PATCH 15/18] iommu: tegra-smmu: use __GFP_ZERO to allocate zeroed pages

2015-07-27 Thread Russell King
Rather than explicitly zeroing pages allocated via alloc_page(), add __GFP_ZERO to the gfp mask to ask the allocator for zeroed pages. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/drivers/iommu

[PATCH 16/18] iommu: tegra-smmu: get_use

2015-07-27 Thread Russell King
Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index bc179c759805..8bf38b95cdd5 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu

[PATCH 11/18] iommu: tegra-smmu: split smmu_flush_ptc()

2015-07-27 Thread Russell King
smmu_flush_ptc() is used in two modes: one is to flush an individual entry, the other is to flush all entries. We know at the call site which we require. Split the function into smmu_flush_ptc_all() and smmu_flush_ptc(). Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 26

[PATCH 07/18] iommu: tegra-smmu: fix page table lookup in unmap/iova_to_phys methods

2015-07-27 Thread Russell King
CPU page tables. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 43 ++- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 4c4bc7966046..bbff5b647183 100644 --- a

[PATCH 13/18] iommu: tegra-smmu: convert to use DMA API

2015-07-27 Thread Russell King
Use the DMA API instead of calling architecture internal functions in the Tegra SMMU driver. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 129 + 1 file changed, 84 insertions(+), 45 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c

[PATCH 05/18] iommu: tegra-smmu: factor out common pte setting

2015-07-27 Thread Russell King
Factor out the common pte setting code into a separate function. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 37 + 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index

[PATCH 10/18] iommu: tegra-smmu: move flush_dcache to tegra-smmu.c

2015-07-27 Thread Russell King
ARM64 architecture does not provide this function. (This, in itself, is a good reason why these should not be used.) Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 24 +++- drivers/memory/tegra/tegra114.c | 17 - drivers/memory/tegra

[PATCH 08/18] iommu: tegra-smmu: store struct page pointer for page tables

2015-07-27 Thread Russell King
Store the struct page pointer for the second level page tables, rather than working back from the page directory entry. This is necessary as we want to eliminate the use of physical addresses used with arch-private functions, switching instead to use the streaming DMA API. Signed-off-by: Russell

[PATCH 02/18] firmware: qcom_scm-32: replace open-coded call to __cpuc_flush_dcache_area()

2015-07-27 Thread Russell King
Signed-off-by: Russell King --- arch/arm/include/asm/cacheflush.h | 17 + drivers/firmware/qcom_scm-32.c| 4 +--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h index c5230a44eeca

[PATCH 09/18] iommu: tegra-smmu: use kcalloc() to allocate counter array

2015-07-27 Thread Russell King
Use kcalloc() to allocate the use-counter array for the page directory entries/page tables. Using kcalloc() allows us to be provided with zero-initialised memory from the allocators, rather than initialising it ourselves. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 21

[PATCH 06/18] iommu: tegra-smmu: add iova_pd_index() and iova_pt_index() helpers

2015-07-27 Thread Russell King
Add a pair of helpers to get the page directory and page table indexes. Signed-off-by: Russell King --- drivers/iommu/tegra-smmu.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 53d0f15dac6f

  1   2   >