Re: [PATCH 05/67] dma-mapping: replace PCI_DMA_BUS_IS_PHYS with a flag in struct dma_map_ops

2018-01-02 Thread Geert Uytterhoeven
On Fri, Dec 29, 2017 at 9:18 AM, Christoph Hellwig  wrote:
> The current PCI_DMA_BUS_IS_PHYS decided if a dma implementation is bound
> by the dma mask in the device because it directly maps to a physical
> address range (modulo an offset in the device), or if it is virtualized
> by an iommu and can map any address (that includes virtual iommus like
> swiotlb).  The problem with this scheme is that it is per-architecture and
> not per dma_ops instance, and we are growing more and more setups that
> have multiple different dma operations in use on a single system, for
> which this scheme can't provide a correct answer.  Depending on the
> architecture that means we either get a false positive or false negative
> at the moment.
>
> This patch instead extents the is_phys flag in struct dma_map_ops that
> is currently only used by a few architectures to be used tree wide.
>
> Note that this means that we now need a struct device parent in the
> Scsi_Host or netdevice.  Every modern driver has these, but there might
> still be a few outdated legacy drivers out there, which now won't make
> an intelligent decision.
>
> Signed-off-by: Christoph Hellwig 

For m68k:
Acked-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/67] dma-mapping: replace PCI_DMA_BUS_IS_PHYS with a flag in struct dma_map_ops

2017-12-29 Thread Christoph Hellwig
The current PCI_DMA_BUS_IS_PHYS decided if a dma implementation is bound
by the dma mask in the device because it directly maps to a physical
address range (modulo an offset in the device), or if it is virtualized
by an iommu and can map any address (that includes virtual iommus like
swiotlb).  The problem with this scheme is that it is per-architecture and
not per dma_ops instance, and we are growing more and more setups that
have multiple different dma operations in use on a single system, for
which this scheme can't provide a correct answer.  Depending on the
architecture that means we either get a false positive or false negative
at the moment.

This patch instead extents the is_phys flag in struct dma_map_ops that
is currently only used by a few architectures to be used tree wide.

Note that this means that we now need a struct device parent in the
Scsi_Host or netdevice.  Every modern driver has these, but there might
still be a few outdated legacy drivers out there, which now won't make
an intelligent decision.

Signed-off-by: Christoph Hellwig 
---
 arch/alpha/include/asm/pci.h  |  5 -
 arch/alpha/kernel/pci-noop.c  |  1 +
 arch/arc/include/asm/pci.h|  6 --
 arch/arc/mm/dma.c |  1 +
 arch/arm/include/asm/pci.h|  7 ---
 arch/arm/mm/dma-mapping-nommu.c   |  1 +
 arch/arm/mm/dma-mapping.c |  2 ++
 arch/arm64/include/asm/pci.h  |  5 -
 arch/blackfin/kernel/dma-mapping.c|  2 ++
 arch/c6x/kernel/dma.c |  1 +
 arch/cris/arch-v32/drivers/pci/dma.c  |  1 +
 arch/cris/include/asm/pci.h   |  6 --
 arch/frv/mb93090-mb00/pci-dma-nommu.c |  1 +
 arch/frv/mb93090-mb00/pci-dma.c   |  1 +
 arch/h8300/include/asm/pci.h  |  2 --
 arch/h8300/kernel/dma.c   |  1 +
 arch/hexagon/kernel/dma.c |  2 +-
 arch/ia64/hp/common/sba_iommu.c   |  3 ---
 arch/ia64/include/asm/pci.h   | 17 -
 arch/ia64/kernel/setup.c  | 12 
 arch/ia64/sn/kernel/io_common.c   |  5 -
 arch/m68k/include/asm/pci.h   |  6 --
 arch/m68k/kernel/dma.c|  1 +
 arch/metag/kernel/dma.c   |  1 +
 arch/microblaze/include/asm/pci.h |  6 --
 arch/microblaze/kernel/dma.c  |  1 +
 arch/mips/include/asm/pci.h   |  7 ---
 arch/mips/mm/dma-default.c|  1 +
 arch/mn10300/include/asm/pci.h|  6 --
 arch/mn10300/mm/dma-alloc.c   |  1 +
 arch/nios2/mm/dma-mapping.c   |  1 +
 arch/openrisc/kernel/dma.c|  1 +
 arch/parisc/include/asm/pci.h | 23 ---
 arch/parisc/kernel/pci-dma.c  |  2 ++
 arch/parisc/kernel/setup.c|  5 -
 arch/powerpc/include/asm/pci.h| 18 --
 arch/powerpc/kernel/dma.c |  1 +
 arch/riscv/include/asm/pci.h  |  3 ---
 arch/s390/include/asm/pci.h   |  2 --
 arch/s390/pci/pci_dma.c   |  3 ---
 arch/sh/include/asm/pci.h |  6 --
 arch/sh/kernel/dma-nommu.c|  2 +-
 arch/sparc/include/asm/pci_32.h   |  4 
 arch/sparc/include/asm/pci_64.h   |  6 --
 arch/sparc/kernel/ioport.c|  1 +
 arch/tile/include/asm/pci.h   | 14 --
 arch/tile/kernel/pci-dma.c|  2 ++
 arch/x86/include/asm/pci.h|  2 --
 arch/x86/kernel/pci-nommu.c   |  2 +-
 arch/xtensa/include/asm/pci.h |  7 ---
 arch/xtensa/kernel/pci-dma.c  |  1 +
 drivers/ide/ide-lib.c |  5 ++---
 drivers/ide/ide-probe.c   |  2 +-
 drivers/parisc/ccio-dma.c |  2 --
 drivers/parisc/sba_iommu.c|  2 --
 drivers/pci/host/vmd.c|  1 +
 drivers/scsi/scsi_lib.c   | 14 ++
 include/asm-generic/pci.h |  8 
 include/linux/dma-mapping.h   | 23 ++-
 lib/dma-noop.c|  1 +
 net/core/dev.c| 18 --
 tools/virtio/linux/dma-mapping.h  |  2 --
 62 files changed, 70 insertions(+), 226 deletions(-)

diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index b9ec55351924..cf6bc1e64d66 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -56,11 +56,6 @@ struct pci_controller {
 
 /* IOMMU controls.  */
 
-/* The PCI address space does not equal the physical memory address space.
-   The networking and block device layers use this boolean for bounce buffer
-   decisions.  */
-#define PCI_DMA_BUS_IS_PHYS  0
-
 /* TODO: integrate with include/asm-generic/pci.h ? */
 static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 {
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c
index b995987b1557..d3208254b269 100644
--- a/arch/alpha/kernel/pci-noop.c
+++