Re: [PATCH] dma-debug: Check scatterlist segments

2018-04-24 Thread Christoph Hellwig
This looks interesting. I suspect it is going to blow up in quite a few places, so maybe at least for now it might make sense to have a separate config option? On Tue, Apr 24, 2018 at 05:12:19PM +0100, Robin Murphy wrote: > Drivers/subsystems creating scatterlists for DMA should be taking care >

[GIT PULL] dma mapping fixes for 4.17-rc3

2018-04-24 Thread Christoph Hellwig
The following changes since commit 6d08b06e67cd117f6992c46611dfb4ce267cd71e: Linux 4.17-rc2 (2018-04-22 19:20:09 -0700) are available in the Git repository at: git://git.infradead.org/users/hch/dma-mapping.git tags/dma-mapping-4.17-3 for you to fetch changes up to 60695be2bb6b0623f8e53bd994

[PATCH 11/13] mips,unicore32: swiotlb doesn't need sg->dma_length

2018-04-24 Thread Christoph Hellwig
Only mips and unicore32 select CONFIG_NEED_SG_DMA_LENGTH when building swiotlb. swiotlb itself never merges segements and doesn't accesses the dma_length field directly, so drop the dependency. Signed-off-by: Christoph Hellwig --- arch/mips/cavium-octeon/Kconfig | 1 - arch/mips/loongson64/Kcon

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

2018-04-24 Thread Christoph Hellwig
This way we have one central definition of it, and user can select it as needed. The new option is not user visible, which is the behavior it had in most architectures, with a few notable exceptions: - On x86_64 and mips/loongson3 it used to be user selectable, but defaulted to y. It now is

[PATCH 05/13] scatterlist: move the NEED_SG_DMA_LENGTH config symbol to lib/Kconfig

2018-04-24 Thread Christoph Hellwig
This way we have one central definition of it, and user can select it as needed. Signed-off-by: Christoph Hellwig Reviewed-by: Anshuman Khandual --- arch/alpha/Kconfig | 4 +--- arch/arm/Kconfig| 3 --- arch/arm64/Kconfig | 4 +--- arch/hexagon/Kconfig

[PATCH 07/13] arch: remove the ARCH_PHYS_ADDR_T_64BIT config symbol

2018-04-24 Thread Christoph Hellwig
Instead select the PHYS_ADDR_T_64BIT for 32-bit architectures that need a 64-bit phys_addr_t type directly. Signed-off-by: Christoph Hellwig --- arch/arc/Kconfig | 4 +--- arch/arm/kernel/setup.c| 2 +- arch/arm/mm/Kconfig| 4 +--- arc

[PATCH 08/13] arch: define the ARCH_DMA_ADDR_T_64BIT config symbol in lib/Kconfig

2018-04-24 Thread Christoph Hellwig
Define this symbol if the architecture either uses 64-bit pointers or the PHYS_ADDR_T_64BIT is set. This covers 95% of the old arch magic. We only need an additional select for Xen on ARM (why anyway?), and we now always set ARCH_DMA_ADDR_T_64BIT on mips boards with 64-bit physical addressing ins

[PATCH 13/13] swiotlb: remove the CONFIG_DMA_DIRECT_OPS ifdefs

2018-04-24 Thread Christoph Hellwig
swiotlb now selects the DMA_DIRECT_OPS config symbol, so this will always be true. Signed-off-by: Christoph Hellwig --- lib/swiotlb.c | 4 1 file changed, 4 deletions(-) diff --git a/lib/swiotlb.c b/lib/swiotlb.c index fece57566d45..6954f7ad200a 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb

[PATCH 09/13] PCI: remove CONFIG_PCI_BUS_ADDR_T_64BIT

2018-04-24 Thread Christoph Hellwig
This symbol is now always identical to CONFIG_ARCH_DMA_ADDR_T_64BIT, so remove it. Signed-off-by: Christoph Hellwig Acked-by: Bjorn Helgaas --- drivers/pci/Kconfig | 4 drivers/pci/bus.c | 4 ++-- include/linux/pci.h | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/

[PATCH 10/13] arm: don't build swiotlb by default

2018-04-24 Thread Christoph Hellwig
swiotlb is only used as a library of helper for xen-swiotlb if Xen support is enabled on arm, so don't build it by default. Signed-off-by: Christoph Hellwig --- arch/arm/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index aa1c18

[PATCH 06/13] dma-mapping: move the NEED_DMA_MAP_STATE config symbol to lib/Kconfig

2018-04-24 Thread Christoph Hellwig
This way we have one central definition of it, and user can select it as needed. Note that we now also always select it when CONFIG_DMA_API_DEBUG is select, which fixes some incorrect checks in a few network drivers. Signed-off-by: Christoph Hellwig Reviewed-by: Anshuman Khandual --- arch/alph

[PATCH 01/13] iommu-common: move to arch/sparc

2018-04-24 Thread Christoph Hellwig
This code is only used by sparc, and all new iommu drivers should use the drivers/iommu/ framework. Also remove the unused exports. Signed-off-by: Christoph Hellwig Reviewed-by: Anshuman Khandual --- {include/linux => arch/sparc/include/asm}/iommu-common.h | 0 arch/sparc/include/asm/iommu_64.

centralize SWIOTLB config symbol and misc other cleanups V3

2018-04-24 Thread Christoph Hellwig
Hi all, this seris aims for a single defintion of the Kconfig symbol. To get there various cleanups, mostly about config symbols are included as well. Changes since V2: - swiotlb doesn't need the dma_length field by itself, so don't select it - don't offer a user visible SWIOTLB choice Chages

[PATCH 04/13] iommu-helper: move the IOMMU_HELPER config symbol to lib/

2018-04-24 Thread Christoph Hellwig
This way we have one central definition of it, and user can select it as needed. Signed-off-by: Christoph Hellwig Reviewed-by: Anshuman Khandual --- arch/powerpc/Kconfig | 4 +--- arch/s390/Kconfig| 5 ++--- arch/sparc/Kconfig | 5 + arch/x86/Kconfig | 6 ++ lib/Kconfig

[PATCH 03/13] iommu-helper: mark iommu_is_span_boundary as inline

2018-04-24 Thread Christoph Hellwig
This avoids selecting IOMMU_HELPER just for this function. And we only use it once or twice in normal builds so this often even is a size reduction. Signed-off-by: Christoph Hellwig --- arch/alpha/Kconfig | 3 --- arch/arm/Kconfig| 3 --- arch/arm64/Kconfig

[PATCH 02/13] iommu-helper: unexport iommu_area_alloc

2018-04-24 Thread Christoph Hellwig
This function is only used by built-in code. Signed-off-by: Christoph Hellwig Reviewed-by: Anshuman Khandual --- lib/iommu-helper.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c index 23633c0fda4a..ded1703e7e64 100644 --- a/lib/iommu-helper.c +++ b

Re: [PATCH] dma-debug: Check scatterlist segments

2018-04-24 Thread kbuild test robot
Hi Robin, I love your patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v4.17-rc2 next-20180424] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux

Re: [PATCH 5/5] PCI: remove PCI_DMA_BUS_IS_PHYS

2018-04-24 Thread Palmer Dabbelt
On Tue, 24 Apr 2018 11:16:25 PDT (-0700), Christoph Hellwig wrote: This was used by the ide, scsi and networking code in the past to determine if they should bounce payloads. Now that the dma mapping always have to support dma to all physical memory (thanks to swiotlb for non-iommu systems) ther

Re: [PATCH 03/37] iommu/sva: Manage process address spaces

2018-04-24 Thread Jean-Philippe Brucker via iommu
On 24/04/18 18:17, Sinan Kaya wrote: > On 4/24/2018 5:33 AM, Jean-Philippe Brucker wrote: >>> Please return pasid when you find an io_mm that is already bound. Something >>> like >>> *pasid = io_mm->pasid should do the work here when bond is true. >> Right. I think we should also keep returning 0,

Re: [PATCH v4 12/22] iommu: introduce device fault report API

2018-04-24 Thread Jacob Pan
On Mon, 23 Apr 2018 12:30:13 +0100 Jean-Philippe Brucker wrote: > On Mon, Apr 16, 2018 at 10:49:01PM +0100, Jacob Pan wrote: > [...] > > +int iommu_register_device_fault_handler(struct device *dev, > > + iommu_dev_fault_handler_t > > handler, > > +

[PATCH 4/5] net: remove the PCI_DMA_BUS_IS_PHYS check in illegal_highdma

2018-04-24 Thread Christoph Hellwig
These days the dma mapping routines must be able to handle any address supported by the device, be that using an iommu, or swiotlb if none is supported. With that the PCI_DMA_BUS_IS_PHYS check in illegal_highdma is not needed and can be removed. Signed-off-by: Christoph Hellwig --- net/core/dev

[PATCH 3/5] ide: remove the PCI_DMA_BUS_IS_PHYS check

2018-04-24 Thread Christoph Hellwig
We now have ways to deal with drainage in the block layer, and libata has been using it for ages. We also want to get rid of PCI_DMA_BUS_IS_PHYS now, so just reduce the PCI transfer size for ide - anyone who cares for performance on PCI controllers should have switched to libata long ago. Signed-

[PATCH 2/5] ide: kill ide_toggle_bounce

2018-04-24 Thread Christoph Hellwig
ide_toggle_bounce did select various strange block bounce limits, including not bouncing at all as soon as an iommu is present in the system. Given that the dma_map routines now handle any required bounce buffering except for ISA DMA, and the ide code already must handle either ISA DMA or highmem

[PATCH 5/5] PCI: remove PCI_DMA_BUS_IS_PHYS

2018-04-24 Thread Christoph Hellwig
This was used by the ide, scsi and networking code in the past to determine if they should bounce payloads. Now that the dma mapping always have to support dma to all physical memory (thanks to swiotlb for non-iommu systems) there is no need to this crude hack any more. Signed-off-by: Christoph H

remove PCI_DMA_BUS_IS_PHYS V2

2018-04-24 Thread Christoph Hellwig
Hi all, this series tries to get rid of the global and PCI_DMA_BUS_IS_PHYS flag, which causes the block layer and networking code to bounce buffer memory above the dma mask in some cases. It is a leftover from i386 + highmem days and is obsolete now that we have swiotlb or iommus so that the dma

[PATCH 1/5] scsi: reduce use of block bounce buffers

2018-04-24 Thread Christoph Hellwig
We can rely on the dma-mapping code to handle any DMA limits that is bigger than the ISA DMA mask for us (either using an iommu or swiotlb), so remove setting the block layer bounce limit for anything but the unchecked_isa_dma case, or the bouncing for highmem pages. Signed-off-by: Christoph Hellw

Re: [PATCH 03/37] iommu/sva: Manage process address spaces

2018-04-24 Thread Sinan Kaya
On 4/24/2018 5:33 AM, Jean-Philippe Brucker wrote: >> Please return pasid when you find an io_mm that is already bound. Something >> like >> *pasid = io_mm->pasid should do the work here when bond is true. > Right. I think we should also keep returning 0, not switch to -EEXIST or > similar. So in

[PATCH] dma-debug: Check scatterlist segments

2018-04-24 Thread Robin Murphy via iommu
Drivers/subsystems creating scatterlists for DMA should be taking care to respect the scatter-gather limitations of the appropriate device, as described by dma_parms. A DMA API implementation cannot feasibly split a scatterlist into *more* entries than originally passed, so it is not well defined w

[PATCH 3/3] dma-debug: unexport dma_debug_resize_entries and debug_dma_dump_mappings

2018-04-24 Thread Christoph Hellwig
Only used by the AMD GART driver, which must be built in. Signed-off-by: Christoph Hellwig --- lib/dma-debug.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 075253cb613b..6a1ebaa83623 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c @@ -444,7 +444

[PATCH 1/3] dma-debug: move initialization to common code

2018-04-24 Thread Christoph Hellwig
Most mainstream architectures are using 65536 entries, so lets stick to that. If someone is really desperate to override it that can still be done through , but I'd rather see a really good rationale for that. dma_debug_init is now called as a core_initcall, which for many architectures means muc

[PATCH 2/3] dma-debug: simplify counting of preallocated requests

2018-04-24 Thread Christoph Hellwig
Just keep a single variable with a descriptive name instead of two with confusing names. Signed-off-by: Christoph Hellwig --- lib/dma-debug.c | 20 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 712a897174e4..075253cb61

dma-debug cleanups, including removing the arch hook

2018-04-24 Thread Christoph Hellwig
Hi all, this series has a few dma-debug cleanups, most notably removing the need for architectures to explicitly initialize dma-debug. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

RE: [PATCH v6 4/7] iommu/dma: Move PCI window region reservation back into dma specific path.

2018-04-24 Thread Shameerali Kolothum Thodi
Hi Joerg, Could you please take a look at this patch and let me know. I have rebased this to 4.17-rc1 and added Robin's R-by. This series[1] is now pending on this patch as without this it will break few ARM platforms[2]. Please take a look and let me know. Thanks, Shameer [1] https://lkml.

Re: [RFC 1/2] iommu/arm-smmu-v3: Remove bypass in arm_smmu_reset_device

2018-04-24 Thread Yisheng Xie
Hi Robin, Thanks for your comment! On 2018/4/24 0:07, Robin Murphy wrote: > On 23/04/18 12:45, Yisheng Xie wrote: >> Add a bypass parameter in arm_smmu_device to keep whether smmu device >> should pypass or not, so parameter bypass in arm_smmu_reset_device can >> be removed. > > Given that the GB

Re: [RFC 2/2] iommu/arm-smmu-v3: Support software retention for pm_resume

2018-04-24 Thread Yisheng Xie
Hi Robin, Thanks for your comment. On 2018/4/24 0:14, Robin Murphy wrote: > On 23/04/18 12:45, Yisheng Xie wrote: >> When system suspend, hisilicon's smmu will do power gating for smmu, >> this time smmu's reg will be set to default value for not having >> hardware retention, which means need soft

Re: [PATCH 03/37] iommu/sva: Manage process address spaces

2018-04-24 Thread Jean-Philippe Brucker
On 24/04/18 02:32, Sinan Kaya wrote: > On 2/12/2018 1:33 PM, Jean-Philippe Brucker wrote: >> /** >> * iommu_sva_device_init() - Initialize Shared Virtual Addressing for a >> device >> * @dev: the device >> @@ -129,7 +439,10 @@ EXPORT_SYMBOL_GPL(iommu_sva_device_shutdown); >> int iommu_sva_bin

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

2018-04-24 Thread Christoph Hellwig
On Tue, Apr 24, 2018 at 08:47:27AM +0100, Russell King - ARM Linux wrote: > Therefore, the default state for SWIOTLB and hence NEED_SG_DMA_LENGTH > becomes 'y' on ARM, and any defconfig file that does not mention SWIOTLB > explicitly ends up with both these enabled. Indeed, sorry. > It does look

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 user can select it as > > >