Commit befa9363 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'dma-mapping-4.20-1' of git://git.infradead.org/users/hch/dma-mapping

Pull more dma-mapping updates from Christoph Hellwig:

 - various swiotlb cleanups

 - do not dip into the ѕwiotlb pool for dma coherent allocations

 - add support for not cache coherent DMA to swiotlb

 - switch ARM64 to use the generic swiotlb_dma_ops

* tag 'dma-mapping-4.20-1' of git://git.infradead.org/users/hch/dma-mapping:
  arm64: use the generic swiotlb_dma_ops
  swiotlb: add support for non-coherent DMA
  swiotlb: don't dip into swiotlb pool for coherent allocations
  swiotlb: refactor swiotlb_map_page
  swiotlb: use swiotlb_map_page in swiotlb_map_sg_attrs
  swiotlb: merge swiotlb_unmap_page and unmap_single
  swiotlb: remove the overflow buffer
  swiotlb: do not panic on mapping failures
  swiotlb: mark is_swiotlb_buffer static
  swiotlb: remove a pointless comment
parents d1f2b171 886643b7
...@@ -11,6 +11,8 @@ config ARM64 ...@@ -11,6 +11,8 @@ config ARM64
select ARCH_CLOCKSOURCE_DATA select ARCH_CLOCKSOURCE_DATA
select ARCH_HAS_DEBUG_VIRTUAL select ARCH_HAS_DEBUG_VIRTUAL
select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_DEVMEM_IS_ALLOWED
select ARCH_HAS_DMA_COHERENT_TO_PFN
select ARCH_HAS_DMA_MMAP_PGPROT
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_ELF_RANDOMIZE
select ARCH_HAS_FAST_MULTIPLIER select ARCH_HAS_FAST_MULTIPLIER
...@@ -24,6 +26,8 @@ config ARM64 ...@@ -24,6 +26,8 @@ config ARM64
select ARCH_HAS_SG_CHAIN select ARCH_HAS_SG_CHAIN
select ARCH_HAS_STRICT_KERNEL_RWX select ARCH_HAS_STRICT_KERNEL_RWX
select ARCH_HAS_STRICT_MODULE_RWX select ARCH_HAS_STRICT_MODULE_RWX
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
select ARCH_HAS_SYNC_DMA_FOR_CPU
select ARCH_HAS_SYSCALL_WRAPPER select ARCH_HAS_SYSCALL_WRAPPER
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_HAVE_NMI_SAFE_CMPXCHG
......
...@@ -23,7 +23,6 @@ struct dev_archdata { ...@@ -23,7 +23,6 @@ struct dev_archdata {
#ifdef CONFIG_XEN #ifdef CONFIG_XEN
const struct dma_map_ops *dev_dma_ops; const struct dma_map_ops *dev_dma_ops;
#endif #endif
bool dma_coherent;
}; };
struct pdev_archdata { struct pdev_archdata {
......
...@@ -44,10 +44,13 @@ void arch_teardown_dma_ops(struct device *dev); ...@@ -44,10 +44,13 @@ void arch_teardown_dma_ops(struct device *dev);
#define arch_teardown_dma_ops arch_teardown_dma_ops #define arch_teardown_dma_ops arch_teardown_dma_ops
#endif #endif
/* do not use this function in a driver */ /*
* Do not use this function in a driver, it is only provided for
* arch/arm/mm/xen.c, which is used by arm64 as well.
*/
static inline bool is_device_dma_coherent(struct device *dev) static inline bool is_device_dma_coherent(struct device *dev)
{ {
return dev->archdata.dma_coherent; return dev->dma_coherent;
} }
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
This diff is collapsed.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
*/ */
#include <linux/dma-mapping.h> #include <linux/dma-direct.h>
#include <linux/memblock.h> #include <linux/memblock.h>
#include <linux/pfn.h> #include <linux/pfn.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
...@@ -59,7 +59,7 @@ const struct dma_map_ops powerpc_swiotlb_dma_ops = { ...@@ -59,7 +59,7 @@ const struct dma_map_ops powerpc_swiotlb_dma_ops = {
.sync_single_for_device = swiotlb_sync_single_for_device, .sync_single_for_device = swiotlb_sync_single_for_device,
.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu, .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
.sync_sg_for_device = swiotlb_sync_sg_for_device, .sync_sg_for_device = swiotlb_sync_sg_for_device,
.mapping_error = swiotlb_dma_mapping_error, .mapping_error = dma_direct_mapping_error,
.get_required_mask = swiotlb_powerpc_get_required, .get_required_mask = swiotlb_powerpc_get_required,
}; };
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/mem_encrypt.h> #include <linux/mem_encrypt.h>
#define DIRECT_MAPPING_ERROR 0
#ifdef CONFIG_ARCH_HAS_PHYS_TO_DMA #ifdef CONFIG_ARCH_HAS_PHYS_TO_DMA
#include <asm/dma-direct.h> #include <asm/dma-direct.h>
#else #else
......
...@@ -67,11 +67,6 @@ extern void swiotlb_tbl_sync_single(struct device *hwdev, ...@@ -67,11 +67,6 @@ extern void swiotlb_tbl_sync_single(struct device *hwdev,
/* Accessory functions. */ /* Accessory functions. */
void *swiotlb_alloc(struct device *hwdev, size_t size, dma_addr_t *dma_handle,
gfp_t flags, unsigned long attrs);
void swiotlb_free(struct device *dev, size_t size, void *vaddr,
dma_addr_t dma_addr, unsigned long attrs);
extern dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, extern dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size, unsigned long offset, size_t size,
enum dma_data_direction dir, enum dma_data_direction dir,
...@@ -106,9 +101,6 @@ extern void ...@@ -106,9 +101,6 @@ extern void
swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
int nelems, enum dma_data_direction dir); int nelems, enum dma_data_direction dir);
extern int
swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
extern int extern int
swiotlb_dma_supported(struct device *hwdev, u64 mask); swiotlb_dma_supported(struct device *hwdev, u64 mask);
...@@ -121,7 +113,6 @@ static inline unsigned int swiotlb_max_segment(void) { return 0; } ...@@ -121,7 +113,6 @@ static inline unsigned int swiotlb_max_segment(void) { return 0; }
#endif #endif
extern void swiotlb_print_info(void); extern void swiotlb_print_info(void);
extern int is_swiotlb_buffer(phys_addr_t paddr);
extern void swiotlb_set_max_segment(unsigned int); extern void swiotlb_set_max_segment(unsigned int);
extern const struct dma_map_ops swiotlb_dma_ops; extern const struct dma_map_ops swiotlb_dma_ops;
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include <linux/pfn.h> #include <linux/pfn.h>
#include <linux/set_memory.h> #include <linux/set_memory.h>
#define DIRECT_MAPPING_ERROR 0
/* /*
* Most architectures use ZONE_DMA for the first 16 Megabytes, but * Most architectures use ZONE_DMA for the first 16 Megabytes, but
* some use it for entirely different regions: * some use it for entirely different regions:
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment