Re: [PATCH 16/19] dma-iommu: don't depend on CONFIG_DMA_DIRECT_REMAP

2019-02-11 Thread Christoph Hellwig
On Wed, Feb 06, 2019 at 11:55:49AM +, Robin Murphy wrote: > On 14/01/2019 09:41, Christoph Hellwig wrote: >> For entirely dma coherent architectures there is no good reason to ever >> remap dma coherent allocation. > > Yes there is, namely assembling large buffers without the need for massive

Re: [PATCH 1/2] dma-mapping: add a kconfig symbol for arch_setup_dma_ops availability

2019-02-11 Thread Vineet Gupta
+CC Eugeniy As resident ARC DMA expert can you please this a quick spin. -Vineet On 2/4/19 12:14 AM, Christoph Hellwig wrote: > Signed-off-by: Christoph Hellwig > --- > arch/arc/Kconfig | 1 + > arch/arc/include/asm/Kbuild | 1 + >

Re: [PATCH v1 1/2] PCI: ATS: Add function to check ATS page aligned request status.

2019-02-11 Thread Raj, Ashok
On Fri, Feb 08, 2019 at 11:49:55PM -0500, Sinan Kaya wrote: > On 2/8/2019 8:02 PM, sathyanarayanan kuppuswamy wrote: > >>This means that you should probably have some kind of version check > >>here. > > > >There is no version field in ATS v1.0 spec. Also, If I follow the history > >log in PCI

Re: [PATCH v1 1/2] PCI: ATS: Add function to check ATS page aligned request status.

2019-02-11 Thread sathyanarayanan kuppuswamy
On 2/11/19 11:15 AM, Raj, Ashok wrote: On Fri, Feb 08, 2019 at 11:49:55PM -0500, Sinan Kaya wrote: On 2/8/2019 8:02 PM, sathyanarayanan kuppuswamy wrote: This means that you should probably have some kind of version check here. There is no version field in ATS v1.0 spec. Also, If I follow

What is the meaning of PASID_MIN?

2019-02-11 Thread Matthew Wilcox
I'm looking at commit 562831747f6299abd481b5b00bd4fa19d5c8a259 which fails to adequately explain why we can't use PASID 0. Commit af39507305fb83a5d3c475c2851f4d59545d8a18 also doesn't explain why PASID 0 is no longer usable for the intel-svm driver. There are a load of simplifications that

Re: [PATCHv2 1/9] mm: Introduce new vm_insert_range and vm_insert_range_buggy API

2019-02-11 Thread Souptick Joarder
On Fri, Feb 8, 2019 at 10:52 AM Souptick Joarder wrote: > > On Thu, Feb 7, 2019 at 10:17 PM Matthew Wilcox wrote: > > > > On Thu, Feb 07, 2019 at 09:19:47PM +0530, Souptick Joarder wrote: > > > Just thought to take opinion for documentation before placing it in v3. > > > Does it looks fine ? > >

[PATCH v2 0/2] Add PGR response PASID requirement check in Intel IOMMU.

2019-02-11 Thread sathyanarayanan . kuppuswamy
From: Kuppuswamy Sathyanarayanan Intel IOMMU responds automatically when receiving page-requests from a PCIe endpoint and the page-request queue is full and it cannot accept any more page-requests. When it auto-responds to page-requests with a success to the endpoint, it automatically responds

[PATCH v2 1/2] PCI/ATS: Add pci_prg_resp_pasid_required() interface.

2019-02-11 Thread sathyanarayanan . kuppuswamy
From: Kuppuswamy Sathyanarayanan Return the PRG Response PASID Required bit in the Page Request Status Register. As per PCIe spec r4.0, sec 10.5.2.3, if this bit is Set then the device expects a PASID TLP Prefix on PRG Response Messages when the corresponding Page Requests had a PASID TLP

[PATCH v2 2/2] iommu/vt-d: Enable PASID only if device expects PASID in PRG Response.

2019-02-11 Thread sathyanarayanan . kuppuswamy
From: Kuppuswamy Sathyanarayanan In Intel IOMMU, if the Page Request Queue (PRQ) is full, it will automatically respond to the device with a success message as a keep alive. And when sending the success message, IOMMU will include PASID in the Response Message when the Page Request has a PASID

Re: [PATCH v2 0/2] Add page alignment check in Intel IOMMU.

2019-02-11 Thread sathyanarayanan kuppuswamy
On 2/11/19 1:43 PM, sathyanarayanan.kuppusw...@linux.intel.com wrote: From: Kuppuswamy Sathyanarayanan As per Intel vt-d specification, Rev 3.0 (section 7.5.1.1, title "Page Request Descriptor"), Intel IOMMU Page Request Descriptor only provides bits[63:12] of the page address. Hence its

[PATCH v2 0/2] Add page alignment check in Intel IOMMU.

2019-02-11 Thread sathyanarayanan . kuppuswamy
From: Kuppuswamy Sathyanarayanan As per Intel vt-d specification, Rev 3.0 (section 7.5.1.1, title "Page Request Descriptor"), Intel IOMMU Page Request Descriptor only provides bits[63:12] of the page address. Hence its required to enforce that the device will only send page request with

Re: [PATCH v1 1/2] PCI: ATS: Add function to check ATS page aligned request status.

2019-02-11 Thread Sinan Kaya
On 2/11/2019 2:15 PM, Raj, Ashok wrote: It seems rather odd we have to check for ATS version. I always assumed unspecified bits (Reserved) must be 0. We only check this if ATS is enabled, and this particular bit wasn't given away for another feature. Is it really required to check for ATS

[PATCH v2 2/2] iommu/vt-d: Enable ATS only if the device uses page aligned address.

2019-02-11 Thread sathyanarayanan . kuppuswamy
From: Kuppuswamy Sathyanarayanan As per Intel vt-d specification, Rev 3.0 (section 7.5.1.1, title "Page Request Descriptor"), Intel IOMMU page request descriptor only uses bits[63:12] of the page address. Hence Intel IOMMU driver would only permit devices that advertise they would only send page

[PATCH v2 0/2] Add page alignment check in Intel IOMMU.

2019-02-11 Thread sathyanarayanan . kuppuswamy
From: Kuppuswamy Sathyanarayanan As per Intel vt-d specification, Rev 3.0 (section 7.5.1.1, title "Page Request Descriptor"), Intel IOMMU page request descriptor only uses bits[63:12] of the Page Address. Hence its required to enforce that the device will only send page request with page-aligned

[PATCH v2 1/2] PCI/ATS: Add pci_ats_page_aligned() interface

2019-02-11 Thread sathyanarayanan . kuppuswamy
From: Kuppuswamy Sathyanarayanan Return the Page Aligned Request bit in the ATS Capability Register. As per PCIe spec r4.0, sec 10.5.1.2, If Page Aligned Request bit is set, then it indicates the Untranslated Addresses generated by the device are alwayis always aligned to a 4096 byte boundary.

Re: What is the meaning of PASID_MIN?

2019-02-11 Thread Lu Baolu
On 2/12/19 11:02 AM, Peter Xu wrote: On Tue, Feb 12, 2019 at 10:44:23AM +0800, Lu Baolu wrote: Hi, On 2/12/19 3:28 AM, Matthew Wilcox wrote: I'm looking at commit 562831747f6299abd481b5b00bd4fa19d5c8a259 which fails to adequately explain why we can't use PASID 0. Commit

Re: [PATCH 1/2] dma-mapping: add a kconfig symbol for arch_setup_dma_ops availability

2019-02-11 Thread Paul Burton
Hi Christoph, On Mon, Feb 04, 2019 at 09:14:19AM +0100, Christoph Hellwig wrote: > Signed-off-by: Christoph Hellwig > --- > arch/arc/Kconfig | 1 + > arch/arc/include/asm/Kbuild | 1 + > arch/arc/include/asm/dma-mapping.h | 13 - > arch/arm/Kconfig

Re: What is the meaning of PASID_MIN?

2019-02-11 Thread Lu Baolu
Hi, On 2/12/19 3:28 AM, Matthew Wilcox wrote: I'm looking at commit 562831747f6299abd481b5b00bd4fa19d5c8a259 which fails to adequately explain why we can't use PASID 0. Commit af39507305fb83a5d3c475c2851f4d59545d8a18 also doesn't explain why PASID 0 is no longer usable for the intel-svm

Re: What is the meaning of PASID_MIN?

2019-02-11 Thread Peter Xu
On Tue, Feb 12, 2019 at 10:44:23AM +0800, Lu Baolu wrote: > Hi, > > On 2/12/19 3:28 AM, Matthew Wilcox wrote: > > > > I'm looking at commit 562831747f6299abd481b5b00bd4fa19d5c8a259 > > which fails to adequately explain why we can't use PASID 0. Commit > >

Re: [PATCH 06/12] dma-mapping: improve selection of dma_declare_coherent availability

2019-02-11 Thread Paul Burton
Hi Christoph, On Mon, Feb 11, 2019 at 02:35:48PM +0100, Christoph Hellwig wrote: > This API is primarily used through DT entries, but two architectures > and two drivers call it directly. So instead of selecting the config > symbol for random architectures pull it in implicitly for the actual >

[PATCH 07/14] mmc: omap: handle chained sglists

2019-02-11 Thread Christoph Hellwig
Use the proper sg_next() helper to move to the next scatterlist element to support chained scatterlists. Signed-off-by: Christoph Hellwig --- drivers/mmc/host/omap.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/host/omap.c

[PATCH 14/14] dma-mapping: remove dma_max_pfn

2019-02-11 Thread Christoph Hellwig
These days the DMA mapping code must bounce buffer for any not supported address, and if they driver needs to optimize for natively supported ranged it should use dma_get_required_mask. Signed-off-by: Christoph Hellwig --- arch/arm/include/asm/dma-mapping.h | 7 ---

[PATCH 11/14] mmc: sh_mmcif: handle highmem pages

2019-02-11 Thread Christoph Hellwig
Instead of setting up a kernel pointer to track the current PIO address, track the offset in the current page, and do an atomic kmap for the page while doing the actual PIO operations. Signed-off-by: Christoph Hellwig --- drivers/mmc/host/sh_mmcif.c | 59 +++-- 1

[PATCH 13/14] mmc: core: don't use block layer bounce buffers

2019-02-11 Thread Christoph Hellwig
All MMC and SD host drivers are highmem safe now, and bounce buffering for addressing limitations is handled in the DMA layer now. Signed-off-by: Christoph Hellwig --- drivers/mmc/core/queue.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/mmc/core/queue.c

[PATCH 08/14] mmc: s3cmci: handle highmem pages

2019-02-11 Thread Christoph Hellwig
Instead of setting up a kernel pointer to track the current PIO address, track the offset in the current page, and do an atomic kmap for the page while doing the actual PIO operations. Signed-off-by: Christoph Hellwig --- drivers/mmc/host/s3cmci.c | 107 +++---

Re: [PATCH 01/18] MIPS: lantiq: pass struct device to DMA API functions

2019-02-11 Thread Christoph Hellwig
On Thu, Feb 07, 2019 at 11:29:14PM +, Paul Burton wrote: > Would you like this to go through the MIPS tree or elsewhere? If the > latter: > > Acked-by: Paul Burton Please pick it up through the mips tree! ___ iommu mailing list

Re: [PATCH 09/12] dma-mapping: remove the DMA_MEMORY_EXCLUSIVE flag

2019-02-11 Thread Greg Kroah-Hartman
On Mon, Feb 11, 2019 at 02:35:51PM +0100, Christoph Hellwig wrote: > All users of dma_declare_coherent want their allocations to be > exclusive, so default to exclusive allocations. > > Signed-off-by: Christoph Hellwig > --- > Documentation/DMA-API.txt | 9 +-- >

Re: [PATCH 07/12] dma-mapping: move CONFIG_DMA_CMA to kernel/dma/Kconfig

2019-02-11 Thread Greg Kroah-Hartman
On Mon, Feb 11, 2019 at 02:35:49PM +0100, Christoph Hellwig wrote: > This is where all the related code already lives. > > Signed-off-by: Christoph Hellwig > --- > drivers/base/Kconfig | 77 > kernel/dma/Kconfig | 77

[PATCH 03/14] mmc: add a need_kmap flag to struct mmc_host

2019-02-11 Thread Christoph Hellwig
If we want to get rid of the block layer bounce buffering for highmem we need to ensure no segment spans multiple pages so that we can kmap it. Add a flag to struct mmc_host so that we can handle the block and DMA layer interactions in common code. Signed-off-by: Christoph Hellwig ---

remove block layer bounce buffering for MMC v2

2019-02-11 Thread Christoph Hellwig
Hi everyone, this series converts the remaining MMC host drivers to properly kmap the scatterlist entries it does PIO operations on, and then goes on to remove the usage of block layer bounce buffering (which I plan to remove eventually) from the MMC layer. As a bonus I've converted various

[PATCH 04/14] mmc: davinci: handle highmem pages

2019-02-11 Thread Christoph Hellwig
Instead of setting up a kernel pointer to track the current PIO address, track the offset in the current page, and do an atomic kmap for the page while doing the actual PIO operations. Signed-off-by: Christoph Hellwig --- drivers/mmc/host/davinci_mmc.c | 22 +- 1 file

[PATCH 06/14] mmc: omap: handle highmem pages

2019-02-11 Thread Christoph Hellwig
Instead of setting up a kernel pointer to track the current PIO address, track the offset in the current page, and do an atomic kmap for the page while doing the actual PIO operations. Signed-off-by: Christoph Hellwig --- drivers/mmc/host/omap.c | 15 ++- 1 file changed, 10

[PATCH 01/14] scatterlist: add sg_kmap_atomic / sg_kunmap_atomic helpers

2019-02-11 Thread Christoph Hellwig
This avoids bug prone open coding of the sg offset handling and also helps to document the limitations of mapping scatterlist entries. Signed-off-by: Christoph Hellwig --- include/linux/scatterlist.h | 26 ++ 1 file changed, 26 insertions(+) diff --git

[PATCH 10/14] mmc: mvsdio: handle highmem pages

2019-02-11 Thread Christoph Hellwig
Instead of setting up a kernel pointer to track the current PIO address, track the offset in the current page, and do an atomic kmap for the page while doing the actual PIO operations. Signed-off-by: Christoph Hellwig --- drivers/mmc/host/mvsdio.c | 33 + 1 file

[PATCH 12/14] mmc: sh_mmcif: handle chained sglists

2019-02-11 Thread Christoph Hellwig
Use the proper sg_next() helper to move to the next scatterlist element to support chained scatterlists. Signed-off-by: Christoph Hellwig --- drivers/mmc/host/sh_mmcif.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/sh_mmcif.c

[PATCH 09/14] mmc: s3cmci: handle chained sglists

2019-02-11 Thread Christoph Hellwig
Use the proper sg_next() helper to move to the next scatterlist element to support chained scatterlists. Signed-off-by: Christoph Hellwig --- drivers/mmc/host/s3cmci.c | 19 +-- drivers/mmc/host/s3cmci.h | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git

[PATCH 05/14] mmc: moxart: handle highmem pages

2019-02-11 Thread Christoph Hellwig
Instead of setting up a kernel pointer to track the current PIO address, track the offset in the current page, and do a kmap for the page while doing the actual PIO operations. Signed-off-by: Christoph Hellwig --- drivers/mmc/host/moxart-mmc.c | 20 1 file changed, 12

[PATCH 02/14] mmc: remove the unused use_blk_mq field from struct mmc_host

2019-02-11 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- include/linux/mmc/host.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 4d35ff36ceff..4eadf01b4a93 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -397,7 +397,6 @@ struct

Re: [PATCH 02/12] device.h: dma_mem is only needed for HAVE_GENERIC_DMA_COHERENT

2019-02-11 Thread Greg Kroah-Hartman
On Mon, Feb 11, 2019 at 02:35:44PM +0100, Christoph Hellwig wrote: > No need to carry an unused field around. > > Signed-off-by: Christoph Hellwig > --- > include/linux/device.h | 2 ++ > 1 file changed, 2 insertions(+) Reviewed-by: Greg Kroah-Hartman

Re: [PATCH V3 2/3] HYPERV/IOMMU: Add Hyper-V stub IOMMU driver

2019-02-11 Thread Tianyu Lan
Hi Alex: Thanks for your review. On Fri, Feb 8, 2019 at 2:15 AM Alex Williamson wrote: > > On Thu, 7 Feb 2019 23:33:48 +0800 > lantianyu1...@gmail.com wrote: > > > From: Lan Tianyu > > > > On the bare metal, enabling X2APIC mode requires interrupt remapping > > function which helps

Re: [PATCH V3 2/3] HYPERV/IOMMU: Add Hyper-V stub IOMMU driver

2019-02-11 Thread Tianyu Lan
Hi Olaf: Thanks for your review. On Fri, Feb 8, 2019 at 10:52 PM Olaf Hering wrote: > > On Thu, Feb 07, lantianyu1...@gmail.com wrote: > > > +++ b/drivers/iommu/Kconfig > > +config HYPERV_IOMMU > > + bool "Hyper-V x2APIC IRQ Handling" > > + depends on HYPERV > > + select

Re: [PATCH V3 2/3] HYPERV/IOMMU: Add Hyper-V stub IOMMU driver

2019-02-11 Thread Tianyu Lan
On Fri, Feb 8, 2019 at 1:15 AM Vitaly Kuznetsov wrote: > > lantianyu1...@gmail.com writes: > > > From: Lan Tianyu > > > > On the bare metal, enabling X2APIC mode requires interrupt remapping > > function which helps to deliver irq to cpu with 32-bit APIC ID. > > Hyper-V doesn't provide interrupt

Re: [PATCH] iommu: Allow io-pgtable to be used outside of drivers/iommu/

2019-02-11 Thread Joerg Roedel
On Tue, Feb 05, 2019 at 11:20:30AM -0600, Rob Herring wrote: > On Tue, Feb 5, 2019 at 10:55 AM Christoph Hellwig wrote: > > > > On Tue, Feb 05, 2019 at 10:37:31AM -0600, Rob Herring wrote: > > > Move io-pgtable.h to include/linux/ and export alloc_io_pgtable_ops > > > and free_io_pgtable_ops.

Re: add config symbols for arch_{setup,teardown}_dma_ops

2019-02-11 Thread Catalin Marinas
On Mon, Feb 11, 2019 at 02:21:56PM +0100, Christoph Hellwig wrote: > Any chance to get a quick review on this small series? For arm64: Acked-by: Catalin Marinas ___ iommu mailing list iommu@lists.linux-foundation.org

[PATCH V4 2/3] HYPERV/IOMMU: Add Hyper-V stub IOMMU driver

2019-02-11 Thread lantianyu1986
From: Lan Tianyu On the bare metal, enabling X2APIC mode requires interrupt remapping function which helps to deliver irq to cpu with 32-bit APIC ID. Hyper-V doesn't provide interrupt remapping function so far and Hyper-V MSI protocol already supports to deliver interrupt to the CPU whose

[PATCH V4 1/3] x86/Hyper-V: Set x2apic destination mode to physical when x2apic is available

2019-02-11 Thread lantianyu1986
From: Lan Tianyu Hyper-V doesn't provide irq remapping for IO-APIC. To enable x2apic, set x2apic destination mode to physcial mode when x2apic is available and Hyper-V IOMMU driver makes sure cpus assigned with IO-APIC irqs have 8-bit APIC id. Reviewed-by: Thomas Gleixner Signed-off-by: Lan

[PATCH V4 0/3] x86/Hyper-V/IOMMU: Add Hyper-V IOMMU driver to support x2apic mode

2019-02-11 Thread lantianyu1986
From: Lan Tianyu On the bare metal, enabling X2APIC mode requires interrupt remapping function which helps to deliver irq to cpu with 32-bit APIC ID. Hyper-V doesn't provide interrupt remapping function so far and Hyper-V MSI protocol already supports to deliver interrupt to the CPU whose

Re: [PATCH 12/18] fotg210-udc: remove a bogus dma_sync_single_for_device call

2019-02-11 Thread Christoph Hellwig
On Fri, Feb 01, 2019 at 05:10:26PM +0100, Christoph Hellwig wrote: > On Fri, Feb 01, 2019 at 03:19:41PM +0200, Felipe Balbi wrote: > > Christoph Hellwig writes: > > > > > dma_map_single already transfers ownership to the device. > > > > > > Signed-off-by: Christoph Hellwig > > > > Do you want

[PATCH 3/8] macb_main: pass struct device to DMA API functions

2019-02-11 Thread Christoph Hellwig
The DMA API generally relies on a struct device to work properly, and only barely works without one for legacy reasons. Pass the easily available struct device from the platform_device to remedy this. Signed-off-by: Christoph Hellwig Acked-by: Nicolas Ferre ---

[PATCH 2/8] au1000_eth: pass struct device to DMA API functions

2019-02-11 Thread Christoph Hellwig
The DMA API generally relies on a struct device to work properly, and only barely works without one for legacy reasons. Pass the easily available struct device from the platform_device to remedy this. Signed-off-by: Christoph Hellwig --- drivers/net/ethernet/amd/au1000_eth.c | 6 +++--- 1 file

[PATCH 5/8] pxa168_eth: pass struct device to DMA API functions

2019-02-11 Thread Christoph Hellwig
The DMA API generally relies on a struct device to work properly, and only barely works without one for legacy reasons. Pass the easily available struct device from the platform_device to remedy this. Note that this driver seems to entirely lack dma_map_single error handling, but that is left

[PATCH 7/8] meth: pass struct device to DMA API functions

2019-02-11 Thread Christoph Hellwig
The DMA API generally relies on a struct device to work properly, and only barely works without one for legacy reasons. Pass the easily available struct device from the platform_device to remedy this. Also use GFP_KERNEL instead of GFP_ATOMIC as the gfp_t for the memory allocation, as we aren't

[PATCH 6/8] moxart_ether: pass struct device to DMA API functions

2019-02-11 Thread Christoph Hellwig
The DMA API generally relies on a struct device to work properly, and only barely works without one for legacy reasons. Pass the easily available struct device from the platform_device to remedy this. Signed-off-by: Christoph Hellwig --- drivers/net/ethernet/moxa/moxart_ether.c | 11

[PATCH 8/8] smc911x: pass struct device to DMA API functions

2019-02-11 Thread Christoph Hellwig
The DMA API generally relies on a struct device to work properly, and only barely works without one for legacy reasons. Pass the easily available struct device from the platform_device to remedy this. Note that smc911x apparently is a PIO chip with an external DMA handshake, and we probably use

[PATCH 4/8] lantiq_etop: pass struct device to DMA API functions

2019-02-11 Thread Christoph Hellwig
The DMA API generally relies on a struct device to work properly, and only barely works without one for legacy reasons. Pass the easily available struct device from the platform_device to remedy this. Note this driver seems to lack dma_unmap_* calls entirely, but fixing that is left for another

net: don't pass a NULL struct device to DMA API functions v2

2019-02-11 Thread Christoph Hellwig
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 various other attributes. This series contains all easy conversions to pass a

[PATCH 1/8] net: caif: pass struct device to DMA API functions

2019-02-11 Thread Christoph Hellwig
The DMA API generally relies on a struct device to work properly, and only barely works without one for legacy reasons. Pass the easily available struct device from the platform_device to remedy this. Also use the proper Kconfig symbol to check for DMA API availability. Signed-off-by: Christoph

[PATCH 1/3] da8xx-fb: pass struct device to DMA API functions

2019-02-11 Thread Christoph Hellwig
The DMA API generally relies on a struct device to work properly, and only barely works without one for legacy reasons. Pass the easily available struct device from the platform_device to remedy this. Signed-off-by: Christoph Hellwig --- drivers/video/fbdev/da8xx-fb.c | 13 +++-- 1

fbdev: don't pass a NULL struct device to DMA API functions v2

2019-02-11 Thread Christoph Hellwig
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 various other attributes. This series contains all easy conversions to pass a

[PATCH 10/12] dma-mapping: simplify allocations from per-device coherent memory

2019-02-11 Thread Christoph Hellwig
All users of per-device coherent memory are exclusive, that is if we can't allocate from the per-device pool we can't use the system memory either. Unfold the current dma_{alloc,free}_from_dev_coherent implementation and always use the per-device pool if it exists. Signed-off-by: Christoph

[PATCH 12/12] dma-mapping: remove dma_assign_coherent_memory

2019-02-11 Thread Christoph Hellwig
The only useful bit in this function was the already assigned check. Once that is moved to dma_init_coherent_memory thee rest can easily be handled in the two callers. Signed-off-by: Christoph Hellwig --- kernel/dma/coherent.c | 47 +-- 1 file changed, 14

[PATCH 09/12] dma-mapping: remove the DMA_MEMORY_EXCLUSIVE flag

2019-02-11 Thread Christoph Hellwig
All users of dma_declare_coherent want their allocations to be exclusive, so default to exclusive allocations. Signed-off-by: Christoph Hellwig --- Documentation/DMA-API.txt | 9 +-- arch/arm/mach-imx/mach-imx27_visstrim_m10.c | 12 +++--

[PATCH 04/12] of: select OF_RESERVED_MEM automatically

2019-02-11 Thread Christoph Hellwig
The OF_RESERVED_MEM can be used if we have either CMA or the generic declare coherent code built and we support the early flattened DT. So don't bother making it a user visible options that is selected by most configs that fit the above category, but just select it when the requirements are met.

[PATCH 08/12] dma-mapping: remove dma_mark_declared_memory_occupied

2019-02-11 Thread Christoph Hellwig
This API is not used anywhere, so remove it. Signed-off-by: Christoph Hellwig --- Documentation/DMA-API.txt | 17 - include/linux/dma-mapping.h | 9 - kernel/dma/coherent.c | 23 --- 3 files changed, 49 deletions(-) diff --git

[PATCH 06/12] dma-mapping: improve selection of dma_declare_coherent availability

2019-02-11 Thread Christoph Hellwig
This API is primarily used through DT entries, but two architectures and two drivers call it directly. So instead of selecting the config symbol for random architectures pull it in implicitly for the actual users. Also rename the Kconfig option to describe the feature better. Signed-off-by:

[PATCH 03/12] of: mark early_init_dt_alloc_reserved_memory_arch static

2019-02-11 Thread Christoph Hellwig
This function is only used in of_reserved_mem.c, and never overridden despite the __weak marker. Signed-off-by: Christoph Hellwig --- drivers/of/of_reserved_mem.c| 2 +- include/linux/of_reserved_mem.h | 7 --- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git

[PATCH 05/12] dma-mapping: remove an incorrect __iommem annotation

2019-02-11 Thread Christoph Hellwig
memmap return a regular void pointer, not and __iomem one. Signed-off-by: Christoph Hellwig --- kernel/dma/coherent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c index 66f0fb7e9a3a..4b76aba574c2 100644 ---

[PATCH 11/12] dma-mapping: handle per-device coherent memory mmap in common code

2019-02-11 Thread Christoph Hellwig
We handle allocation and freeing in common code, so we should handle mmap the same way. Also all users of per-device coherent memory are exclusive, that is if we can't allocate from the per-device pool we can't use the system memory either. Unfold the current dma_mmap_from_dev_coherent

Re: add config symbols for arch_{setup,teardown}_dma_ops

2019-02-11 Thread Christoph Hellwig
Any chance to get a quick review on this small series? On Mon, Feb 04, 2019 at 09:14:18AM +0100, Christoph Hellwig wrote: > Hi all, > > this series adds kconfig symbols to indicate that the architecture > provides the arch_setup_dma_ops and arch_teardown_dma_ops hooks. > > This avoids polluting

[PATCH 3/3] pxa3xx-gcu: pass struct device to dma_mmap_coherent

2019-02-11 Thread Christoph Hellwig
Just like we do for all other DMA operations. Signed-off-by: Christoph Hellwig --- drivers/video/fbdev/pxa3xx-gcu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c index 69cfb337c857..047a2fa4b87e 100644

[PATCH 2/3] gbefb: switch to managed version of the DMA allocator

2019-02-11 Thread Christoph Hellwig
gbefb uses managed resources, so it should do the same for DMA allocations. Signed-off-by: Christoph Hellwig --- drivers/video/fbdev/gbefb.c | 24 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c

Re: [PATCH 12/18] fotg210-udc: remove a bogus dma_sync_single_for_device call

2019-02-11 Thread Felipe Balbi
Hi, Christoph Hellwig writes: > On Fri, Feb 01, 2019 at 05:10:26PM +0100, Christoph Hellwig wrote: >> On Fri, Feb 01, 2019 at 03:19:41PM +0200, Felipe Balbi wrote: >> > Christoph Hellwig writes: >> > >> > > dma_map_single already transfers ownership to the device. >> > > >> > > Signed-off-by:

[PATCH 01/12] mfd/sm501: depend on HAS_DMA

2019-02-11 Thread Christoph Hellwig
Currently the sm501 mfd driver can be compiled without any dependencies, but through the use of dma_declare_coherent it really depends on having DMA and iomem support. Normally we don't explicitly require DMA support as we have stubs for it if on UML, but in this case the driver selects support

[PATCH 07/12] dma-mapping: move CONFIG_DMA_CMA to kernel/dma/Kconfig

2019-02-11 Thread Christoph Hellwig
This is where all the related code already lives. Signed-off-by: Christoph Hellwig --- drivers/base/Kconfig | 77 kernel/dma/Kconfig | 77 2 files changed, 77 insertions(+), 77 deletions(-) diff --git

dma_declare_coherent spring cleaning

2019-02-11 Thread Christoph Hellwig
Hi all, this series removes various bits of dead code and refactors the remaining functionality around dma_declare_coherent to be a somewhat more coherent code base. ___ iommu mailing list iommu@lists.linux-foundation.org

[PATCH 02/12] device.h: dma_mem is only needed for HAVE_GENERIC_DMA_COHERENT

2019-02-11 Thread Christoph Hellwig
No need to carry an unused field around. Signed-off-by: Christoph Hellwig --- include/linux/device.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index 6cb4640b6160..be544400acdd 100644 --- a/include/linux/device.h +++

Re: [PATCH/RFC] driver core: Postpone DMA tear-down until after devres release

2019-02-11 Thread Robin Murphy
On 08/02/2019 18:55, Geert Uytterhoeven wrote: Hi Robin, On Fri, Feb 8, 2019 at 6:55 PM Robin Murphy wrote: On 08/02/2019 16:40, Joerg Roedel wrote: On Thu, Feb 07, 2019 at 08:36:53PM +0100, Geert Uytterhoeven wrote: diff --git a/drivers/base/dd.c b/drivers/base/dd.c index

Re: [PATCH] iommu/ipmmu-vmsa: fix device reference leaks

2019-02-11 Thread j...@8bytes.org
Adding a few more people to Cc. On Sun, Feb 03, 2019 at 10:27:09AM +, wen yang wrote: > Make sure to drop the reference to the device taken by > of_find_device_by_node() on driver unbind. > > Signed-off-by: Wen Yang > Cc: Joerg Roedel > Cc: iommu@lists.linux-foundation.org > Cc:

Re: [PATCH] fix flush_tlb_all typo

2019-02-11 Thread Joerg Roedel
On Fri, Feb 08, 2019 at 02:20:44PM +, Tom Murphy wrote: > --- > include/linux/iommu.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) The patch has no Signed-off-by, please add it and a proper commit-message and re-send. ___ iommu mailing

Re: [PATCH v1 0/7] iommu: Minor cleanups and dev_printk() usage

2019-02-11 Thread Joerg Roedel
On Fri, Feb 08, 2019 at 04:05:33PM -0600, Bjorn Helgaas wrote: > I've had these minor iommu cleanups lying around for a while, but the ugly > dmesg logs from [1] prompted me to finally post them. Take what you like, > ignore the rest, and tell me so I can clear out my queue of old stuff. > >

[PATCH] fix flush_tlb_all typo

2019-02-11 Thread Tom Murphy
Fix typo, flush_tlb_all should be flush_iotlb_all Signed-off-by: Tom Murphy --- include/linux/iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index a1d28f42cb77..bb4bf1269e5d 100644 --- a/include/linux/iommu.h +++

[PATCH v1] dma-mapping: Move debug configuration options to kernel/dma

2019-02-11 Thread Andy Shevchenko
This is a follow up to the commit cf65a0f6f6ff ("dma-mapping: move all DMA mapping code to kernel/dma") which moved source code of DMA API to kernel/dma folder. Since there is no file left in the lib that require DMA API debugging options move the latter to kernel/dma as well. Cc: Christoph

Re: [PATCH v1] dma-mapping: Move debug configuration options to kernel/dma

2019-02-11 Thread Christoph Hellwig
On Mon, Feb 11, 2019 at 05:54:09PM +0200, Andy Shevchenko wrote: > This is a follow up to the commit cf65a0f6f6ff > > ("dma-mapping: move all DMA mapping code to kernel/dma") > > which moved source code of DMA API to kernel/dma folder. Since there is > no file left in the lib that require DMA

Re: [PATCH 02/19] dma-iommu: cleanup dma-iommu.h

2019-02-11 Thread Christoph Hellwig
On Wed, Feb 06, 2019 at 03:08:26PM +, Robin Murphy wrote: > Other than dma-iommu.c itself, none of them *require* it - only arch/arm64 > selects it (the one from MTK_IOMMU is just bogus), and a lot of the drivers > also build for at least one other architecture (and/or arm64 with >

Re: [PATCH 03/19] dma-iommu: don't use a scatterlist in iommu_dma_alloc

2019-02-11 Thread Christoph Hellwig
On Wed, Feb 06, 2019 at 03:28:28PM +, Robin Murphy wrote: > Because if iommu_map() only gets called at PAGE_SIZE granularity, then the > IOMMU PTEs will be created at PAGE_SIZE (or smaller) granularity, so any > effort to get higher-order allocations matching larger IOMMU block sizes is >

Re: [PATCH 06/19] dma-iommu: fix and refactor iommu_dma_mmap

2019-02-11 Thread Christoph Hellwig
On Tue, Feb 05, 2019 at 03:02:23PM +, Robin Murphy wrote: > On 14/01/2019 09:41, Christoph Hellwig wrote: >> The current iommu_dma_mmap code does not properly handle memory from the >> page allocator that hasn't been remapped, which can happen in the rare >> case of allocations for a coherent

Re: [PATCH v1] dma-mapping: Move debug configuration options to kernel/dma

2019-02-11 Thread Andy Shevchenko
On Mon, Feb 11, 2019 at 04:54:50PM +0100, Christoph Hellwig wrote: > On Mon, Feb 11, 2019 at 05:54:09PM +0200, Andy Shevchenko wrote: > > This is a follow up to the commit cf65a0f6f6ff > > > > ("dma-mapping: move all DMA mapping code to kernel/dma") > > > > which moved source code of DMA API

[PATCH v2] dma-mapping: Move debug configuration options to kernel/dma

2019-02-11 Thread Andy Shevchenko
This is a follow up to the commit cf65a0f6f6ff ("dma-mapping: move all DMA mapping code to kernel/dma") which moved source code of DMA API to kernel/dma folder. Since there is no file left in the lib that require DMA API debugging options move the latter to kernel/dma as well. Cc: Christoph