PCI: remove PCI_DMA_BUS_IS_PHYS
authorChristoph Hellwig <hch@lst.de>
Thu, 12 Apr 2018 07:33:30 +0000 (09:33 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 7 May 2018 05:15:41 +0000 (07:15 +0200)
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 Hellwig <hch@lst.de>
Acked-by: Palmer Dabbelt <palmer@sifive.com> (for riscv)
Reviewed-by: Jens Axboe <axboe@kernel.dk>
31 files changed:
arch/alpha/include/asm/pci.h
arch/arc/include/asm/pci.h
arch/arm/include/asm/pci.h
arch/arm64/include/asm/pci.h
arch/h8300/include/asm/pci.h
arch/hexagon/kernel/dma.c
arch/ia64/hp/common/sba_iommu.c
arch/ia64/include/asm/pci.h
arch/ia64/kernel/setup.c
arch/ia64/sn/kernel/io_common.c
arch/m68k/include/asm/pci.h
arch/microblaze/include/asm/pci.h
arch/mips/include/asm/pci.h
arch/parisc/include/asm/pci.h
arch/parisc/kernel/setup.c
arch/powerpc/include/asm/pci.h
arch/riscv/include/asm/pci.h
arch/s390/include/asm/pci.h
arch/s390/pci/pci_dma.c
arch/sh/include/asm/pci.h
arch/sh/kernel/dma-nommu.c
arch/sparc/include/asm/pci_32.h
arch/sparc/include/asm/pci_64.h
arch/x86/include/asm/pci.h
arch/xtensa/include/asm/pci.h
drivers/parisc/ccio-dma.c
drivers/parisc/sba_iommu.c
include/asm-generic/pci.h
include/linux/dma-mapping.h
lib/dma-direct.c
tools/virtio/linux/dma-mapping.h

index b9ec553519248ead670b69cd0a25b8f0882e8327..cf6bc1e64d66aa8939a70934c236ee81d2f7bfe3 100644 (file)
@@ -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)
 {
index ba56c23c1b20e58249ce3a5e7271c76fc047837e..4ff53c041c64e2ad839e6c290817d81c528a09bb 100644 (file)
 #define PCIBIOS_MIN_MEM 0x100000
 
 #define pcibios_assign_all_busses()    1
-/*
- * The PCI address space does 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    1
 
 #endif /* __KERNEL__ */
 
index 1f0de808d111e91beb3d9aaf2f07d5a32842f390..0abd389cf0ecaf034a535bbe4477c4d9b6fe274a 100644 (file)
@@ -19,13 +19,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
 }
 #endif /* CONFIG_PCI_DOMAINS */
 
-/*
- * The PCI address space does 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     (1)
-
 #define HAVE_PCI_MMAP
 #define ARCH_GENERIC_PCI_MMAP_RESOURCE
 
index 8747f7c5e0e75a88b509749f91744fb6f73725e6..9e690686e8aad3fac10fd838dc75d8b7e77a8cde 100644 (file)
 #define pcibios_assign_all_busses() \
        (pci_has_flag(PCI_REASSIGN_ALL_BUS))
 
-/*
- * PCI address space differs from physical memory address space
- */
-#define PCI_DMA_BUS_IS_PHYS    (0)
-
 #define ARCH_GENERIC_PCI_MMAP_RESOURCE 1
 
 extern int isa_dma_bridge_buggy;
index 7c9e55d622158ed778bf5ffd15bbd2b61024f50f..d4d345a5209216dd04d4e054c4798c1203279f86 100644 (file)
@@ -15,6 +15,4 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
        /* We don't do dynamic PCI IRQ allocation */
 }
 
-#define PCI_DMA_BUS_IS_PHYS    (1)
-
 #endif /* _ASM_H8300_PCI_H */
index ad8347c29dcfaa5b598cc182ab0bfa02dd2ae7f6..77459df34e2e7e18b29eb62e097641d7f3c1a6d9 100644 (file)
@@ -208,7 +208,6 @@ const struct dma_map_ops hexagon_dma_ops = {
        .sync_single_for_cpu = hexagon_sync_single_for_cpu,
        .sync_single_for_device = hexagon_sync_single_for_device,
        .mapping_error  = hexagon_mapping_error,
-       .is_phys        = 1,
 };
 
 void __init hexagon_dma_init(void)
index aec4a3354abe2c0b7b96b373e7f1c6d6da7c740b..6f05aba9012f102a83847e9a11f42ab36b95011b 100644 (file)
@@ -1845,9 +1845,6 @@ static void ioc_init(unsigned long hpa, struct ioc *ioc)
        ioc_resource_init(ioc);
        ioc_sac_init(ioc);
 
-       if ((long) ~iovp_mask > (long) ia64_max_iommu_merge_mask)
-               ia64_max_iommu_merge_mask = ~iovp_mask;
-
        printk(KERN_INFO PFX
                "%s %d.%d HPA 0x%lx IOVA space %dMb at 0x%lx\n",
                ioc->name, (ioc->rev >> 4) & 0xF, ioc->rev & 0xF,
index b1d04e8bafc86816324b8c6c3eb08bdd607c89c9..780e8744ba85dce10e70d6506ee98c7092a5a565 100644 (file)
@@ -30,23 +30,6 @@ struct pci_vector_struct {
 #define PCIBIOS_MIN_IO         0x1000
 #define PCIBIOS_MIN_MEM                0x10000000
 
-/*
- * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct
- * correspondence between device bus addresses and CPU physical addresses.
- * Platforms with a hardware I/O MMU _must_ turn this off to suppress the
- * bounce buffer handling code in the block and network device layers.
- * Platforms with separate bus address spaces _must_ turn this off and provide
- * a device DMA mapping implementation that takes care of the necessary
- * address translation.
- *
- * For now, the ia64 platforms which may have separate/multiple bus address
- * spaces all have I/O MMUs which support the merging of physically
- * discontiguous buffers, so we can use that as the sole factor to determine
- * the setting of PCI_DMA_BUS_IS_PHYS.
- */
-extern unsigned long ia64_max_iommu_merge_mask;
-#define PCI_DMA_BUS_IS_PHYS    (ia64_max_iommu_merge_mask == ~0UL)
-
 #define HAVE_PCI_MMAP
 #define ARCH_GENERIC_PCI_MMAP_RESOURCE
 #define arch_can_pci_mmap_wc() 1
index dee56bcb993dcd5f5b06424fa70ffd430c3fe4e3..ad43cbf70628c8db191631e7d5bef443b0b36dc0 100644 (file)
@@ -123,18 +123,6 @@ unsigned long ia64_i_cache_stride_shift = ~0;
 #define        CACHE_STRIDE_SHIFT      5
 unsigned long ia64_cache_stride_shift = ~0;
 
-/*
- * The merge_mask variable needs to be set to (max(iommu_page_size(iommu)) - 1).  This
- * mask specifies a mask of address bits that must be 0 in order for two buffers to be
- * mergeable by the I/O MMU (i.e., the end address of the first buffer and the start
- * address of the second buffer must be aligned to (merge_mask+1) in order to be
- * mergeable).  By default, we assume there is no I/O MMU which can merge physically
- * discontiguous buffers, so we set the merge_mask to ~0UL, which corresponds to a iommu
- * page-size of 2^64.
- */
-unsigned long ia64_max_iommu_merge_mask = ~0UL;
-EXPORT_SYMBOL(ia64_max_iommu_merge_mask);
-
 /*
  * We use a special marker for the end of memory and it uses the extra (+1) slot
  */
index 11f2275570fb552f14443d8a8ece3281f0b65874..8479e9a7ce163f1a670a3c15710384f449d0a364 100644 (file)
@@ -480,11 +480,6 @@ sn_io_early_init(void)
        tioca_init_provider();
        tioce_init_provider();
 
-       /*
-        * This is needed to avoid bounce limit checks in the blk layer
-        */
-       ia64_max_iommu_merge_mask = ~PAGE_MASK;
-
        sn_irq_lh_init();
        INIT_LIST_HEAD(&sn_sysdata_list);
        sn_init_cpei_timer();
index ef26fae8cf0bd68f2b7255e80a0b8c6c248f992a..5a4bc223743b6554213dac768662e045961f3005 100644 (file)
@@ -4,12 +4,6 @@
 
 #include <asm-generic/pci.h>
 
-/* The PCI address space does 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    (1)
-
 #define        pcibios_assign_all_busses()     1
 
 #define        PCIBIOS_MIN_IO          0x00000100
index 5de871eb4a59176773d1c9fac3b53433a258396a..00337861472ef8771be262acf36da9be5cc5de87 100644 (file)
@@ -62,12 +62,6 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
 
 #define HAVE_PCI_LEGACY        1
 
-/* The PCI address space does equal the physical memory
- * address space (no IOMMU).  The IDE and SCSI device layers use
- * this boolean for bounce buffer decisions.
- */
-#define PCI_DMA_BUS_IS_PHYS     (1)
-
 extern void pcibios_claim_one_bus(struct pci_bus *b);
 
 extern void pcibios_finish_adding_to_bus(struct pci_bus *bus);
index 2339f42f047ac38097682dc9c82acd4da7c17f6f..436099883022127f1bc882903f4b5df956cfe9b1 100644 (file)
@@ -121,13 +121,6 @@ extern unsigned long PCIBIOS_MIN_MEM;
 #include <linux/string.h>
 #include <asm/io.h>
 
-/*
- * The PCI address space does 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     (1)
-
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
index 96b7deec512d3c26f340bb5ceb16f553330fe299..3328fd17c19db7b1d81cdf7a8e9dee22657ea1b3 100644 (file)
@@ -87,29 +87,6 @@ struct pci_hba_data {
 #define PCI_F_EXTEND           0UL
 #endif /* !CONFIG_64BIT */
 
-/*
- * If the PCI device's view of memory is the same as the CPU's view of memory,
- * PCI_DMA_BUS_IS_PHYS is true.  The networking and block device layers use
- * this boolean for bounce buffer decisions.
- */
-#ifdef CONFIG_PA20
-/* All PA-2.0 machines have an IOMMU. */
-#define PCI_DMA_BUS_IS_PHYS    0
-#define parisc_has_iommu()     do { } while (0)
-#else
-
-#if defined(CONFIG_IOMMU_CCIO) || defined(CONFIG_IOMMU_SBA)
-extern int parisc_bus_is_phys;         /* in arch/parisc/kernel/setup.c */
-#define PCI_DMA_BUS_IS_PHYS    parisc_bus_is_phys
-#define parisc_has_iommu()     do { parisc_bus_is_phys = 0; } while (0)
-#else
-#define PCI_DMA_BUS_IS_PHYS    1
-#define parisc_has_iommu()     do { } while (0)
-#endif
-
-#endif /* !CONFIG_PA20 */
-
-
 /*
 ** Most PCI devices (eg Tulip, NCR720) also export the same registers
 ** to both MMIO and I/O port space.  Due to poor performance of I/O Port
index 0e9675f857a5ca910769b8de1335cd318d0e2c9d..8d3a7b80ac4286c209563051d4e6cf09bebad08d 100644 (file)
@@ -58,11 +58,6 @@ struct proc_dir_entry * proc_runway_root __read_mostly = NULL;
 struct proc_dir_entry * proc_gsc_root __read_mostly = NULL;
 struct proc_dir_entry * proc_mckinley_root __read_mostly = NULL;
 
-#if !defined(CONFIG_PA20) && (defined(CONFIG_IOMMU_CCIO) || defined(CONFIG_IOMMU_SBA))
-int parisc_bus_is_phys __read_mostly = 1;      /* Assume no IOMMU is present */
-EXPORT_SYMBOL(parisc_bus_is_phys);
-#endif
-
 void __init setup_cmdline(char **cmdline_p)
 {
        extern unsigned int boot_args[];
index 401c62aad5e4ee6d8924cccd277d8e67914cd07f..2af9ded805406250f390dadf9dd75e15ff8c3684 100644 (file)
@@ -92,24 +92,6 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
 
 #define HAVE_PCI_LEGACY        1
 
-#ifdef CONFIG_PPC64
-
-/* The PCI address space does not equal the physical memory address
- * space (we have an IOMMU).  The IDE and SCSI device layers use
- * this boolean for bounce buffer decisions.
- */
-#define PCI_DMA_BUS_IS_PHYS    (0)
-
-#else /* 32-bit */
-
-/* The PCI address space does equal the physical memory
- * address space (no IOMMU).  The IDE and SCSI device layers use
- * this boolean for bounce buffer decisions.
- */
-#define PCI_DMA_BUS_IS_PHYS     (1)
-
-#endif /* CONFIG_PPC64 */
-
 extern void pcibios_claim_one_bus(struct pci_bus *b);
 
 extern void pcibios_finish_adding_to_bus(struct pci_bus *bus);
index 0f2fc9ef20fcce18b3d105149846448c1f646870..b3638c50572819605a80e2ad6b57022150e2aaf5 100644 (file)
@@ -26,9 +26,6 @@
 /* RISC-V shim does not initialize PCI bus */
 #define pcibios_assign_all_busses() 1
 
-/* We do not have an IOMMU */
-#define PCI_DMA_BUS_IS_PHYS 1
-
 extern int isa_dma_bridge_buggy;
 
 #ifdef CONFIG_PCI
index 12fe3591034fe8fa73c7a3601ab8959d42250cb8..94f8db468c9b46c2cae33251e7e73fa49260c4f4 100644 (file)
@@ -2,8 +2,6 @@
 #ifndef __ASM_S390_PCI_H
 #define __ASM_S390_PCI_H
 
-/* must be set before including asm-generic/pci.h */
-#define PCI_DMA_BUS_IS_PHYS (0)
 /* must be set before including pci_clp.h */
 #define PCI_BAR_COUNT  6
 
index 2d15d84c20ede64297e0c906a55e3de166f53e3d..10abf5ed618722c9b152127de3703ba31aef134e 100644 (file)
@@ -685,8 +685,6 @@ const struct dma_map_ops s390_pci_dma_ops = {
        .map_page       = s390_dma_map_pages,
        .unmap_page     = s390_dma_unmap_pages,
        .mapping_error  = s390_mapping_error,
-       /* if we support direct DMA this must be conditional */
-       .is_phys        = 0,
        /* dma_supported is unconditionally true without a callback */
 };
 EXPORT_SYMBOL_GPL(s390_pci_dma_ops);
index 0033f0df2b3b239454312a1fc791c2f73655b486..10a36b1cf2eab152e9b84db6f8b2dac602408423 100644 (file)
@@ -71,12 +71,6 @@ extern unsigned long PCIBIOS_MIN_IO, PCIBIOS_MIN_MEM;
  * SuperH has everything mapped statically like x86.
  */
 
-/* The PCI address space does 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    (dma_ops->is_phys)
-
 #ifdef CONFIG_PCI
 /*
  * None of the SH PCI controllers support MWI, it is always treated as a
index 178457d7620c3b9f55fe47b2b90736f4d83a2d2d..3e3a32fc676e4ebaae14d658f7a998df4356ad7b 100644 (file)
@@ -78,7 +78,6 @@ const struct dma_map_ops nommu_dma_ops = {
        .sync_single_for_device = nommu_sync_single_for_device,
        .sync_sg_for_device     = nommu_sync_sg_for_device,
 #endif
-       .is_phys                = 1,
 };
 
 void __init no_iommu_init(void)
index 98917e48727d245cc55a74bd32122a9f2f71d5fd..cfc0ee9476c6d2b6d4a5d354d411a9dc193dc3e0 100644 (file)
 
 #define PCI_IRQ_NONE           0xffffffff
 
-/* Dynamic DMA mapping stuff.
- */
-#define PCI_DMA_BUS_IS_PHYS    (0)
-
 #endif /* __KERNEL__ */
 
 #ifndef CONFIG_LEON_PCI
index 671274e36cfad050c3b10cfabaa02ddbcf962235..fac77813402c66b4fe0ff15a756b85fef4f55af6 100644 (file)
 
 #define PCI_IRQ_NONE           0xffffffff
 
-/* 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)
-
 /* PCI IOMMU mapping bypass support. */
 
 /* PCI 64-bit addressing works for all slots on all controller
index d32175e302593f62be02481505b0db4c1edf5ab9..662963681ea6c3f7d9235c246734844592579755 100644 (file)
@@ -117,9 +117,6 @@ void native_restore_msi_irqs(struct pci_dev *dev);
 #define native_setup_msi_irqs          NULL
 #define native_teardown_msi_irq                NULL
 #endif
-
-#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
-
 #endif  /* __KERNEL__ */
 
 #ifdef CONFIG_X86_64
index d5a82153a7c5d87b4ad6e02085956eb486393e39..6ddf0a30c60d14e02c0b79b22132c82479821d13 100644 (file)
@@ -42,8 +42,6 @@ extern struct pci_controller* pcibios_alloc_controller(void);
  * decisions.
  */
 
-#define PCI_DMA_BUS_IS_PHYS    (1)
-
 /* Tell PCI code what kind of PCI resource mappings we support */
 #define HAVE_PCI_MMAP                  1
 #define ARCH_GENERIC_PCI_MMAP_RESOURCE 1
index acba1f56af3e439647f6c3884a37ab78b233e1b3..2b129d8525d5990cc4f37b029fc1a92fc4587e54 100644 (file)
@@ -1596,8 +1596,6 @@ static int __init ccio_probe(struct parisc_device *dev)
        }
 #endif
        ioc_count++;
-
-       parisc_has_iommu();
        return 0;
 }
 
index 0a9c762a70fae5dae2187effec931df5bfd77550..a58c586ebd81e5e0a4b73f3893c2d2603962f624 100644 (file)
@@ -2017,8 +2017,6 @@ static int __init sba_driver_callback(struct parisc_device *dev)
        proc_create("sba_iommu", 0, root, &sba_proc_fops);
        proc_create("sba_iommu-bitmap", 0, root, &sba_proc_bitmap_fops);
 #endif
-
-       parisc_has_iommu();
        return 0;
 }
 
index 830d7659289b917b002207ff9d701db10a70ec65..6bb3cd3d695a698d6612f4fcea7476c2ea72c3d0 100644 (file)
@@ -14,12 +14,4 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 }
 #endif /* HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ */
 
-/*
- * By default, assume that no iommu is in use and that the PCI
- * space is mapped to address physical 0.
- */
-#ifndef PCI_DMA_BUS_IS_PHYS
-#define PCI_DMA_BUS_IS_PHYS    (1)
-#endif
-
 #endif /* _ASM_GENERIC_PCI_H */
index f8ab1c0f589ea5c9530b24c5995c2086ca2b5de8..a6d4ac8b81e46a6276bc160cf126f43fb846b560 100644 (file)
@@ -133,7 +133,6 @@ struct dma_map_ops {
 #ifdef ARCH_HAS_DMA_GET_REQUIRED_MASK
        u64 (*get_required_mask)(struct device *dev);
 #endif
-       int is_phys;
 };
 
 extern const struct dma_map_ops dma_direct_ops;
index 970d39155618de1bb4dd1bc7d06a241e8fd28102..df9e726e071265be931d87395285753eefdaf05e 100644 (file)
@@ -187,6 +187,5 @@ const struct dma_map_ops dma_direct_ops = {
        .map_sg                 = dma_direct_map_sg,
        .dma_supported          = dma_direct_supported,
        .mapping_error          = dma_direct_mapping_error,
-       .is_phys                = 1,
 };
 EXPORT_SYMBOL(dma_direct_ops);
index 1571e24e94942ba92da68e995f1c5e008c42acfc..f91aeb5fe57162f1fba03d93d26903fe14200a8f 100644 (file)
@@ -6,8 +6,6 @@
 # error Virtio userspace code does not support CONFIG_HAS_DMA
 #endif
 
-#define PCI_DMA_BUS_IS_PHYS 1
-
 enum dma_data_direction {
        DMA_BIDIRECTIONAL = 0,
        DMA_TO_DEVICE = 1,