Skip to content

Commit

Permalink
Merge tag 'dma-mapping-4.21-1' of git://git.infradead.org/users/hch/d…
Browse files Browse the repository at this point in the history
…ma-mapping

Pull dma-mapping fixes from Christoph Hellwig:
 "Fix various regressions introduced in this cycles:

   - fix dma-debug tracking for the map_page / map_single
     consolidatation

   - properly stub out DMA mapping symbols for !HAS_DMA builds to avoid
     link failures

   - fix AMD Gart direct mappings

   - setup the dma address for no kernel mappings using the remap
     allocator"

* tag 'dma-mapping-4.21-1' of git://git.infradead.org/users/hch/dma-mapping:
  dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING for remapped allocations
  x86/amd_gart: fix unmapping of non-GART mappings
  dma-mapping: remove a few unused exports
  dma-mapping: properly stub out the DMA API for !CONFIG_HAS_DMA
  dma-mapping: remove dmam_{declare,release}_coherent_memory
  dma-mapping: implement dmam_alloc_coherent using dmam_alloc_attrs
  dma-mapping: implement dma_map_single_attrs using dma_map_page_attrs
  • Loading branch information
torvalds committed Jan 6, 2019
2 parents 1213325 + 8270f3a commit e2b745f
Show file tree
Hide file tree
Showing 8 changed files with 215 additions and 275 deletions.
1 change: 0 additions & 1 deletion Documentation/driver-model/devres.txt
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ DMA
dmaenginem_async_device_register()
dmam_alloc_coherent()
dmam_alloc_attrs()
dmam_declare_coherent_memory()
dmam_free_coherent()
dmam_pool_create()
dmam_pool_destroy()
Expand Down
10 changes: 9 additions & 1 deletion arch/x86/kernel/amd_gart_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,15 @@ static void gart_unmap_page(struct device *dev, dma_addr_t dma_addr,
int npages;
int i;

if (dma_addr == DMA_MAPPING_ERROR ||
if (WARN_ON_ONCE(dma_addr == DMA_MAPPING_ERROR))
return;

/*
* This driver will not always use a GART mapping, but might have
* created a direct mapping instead. If that is the case there is
* nothing to unmap here.
*/
if (dma_addr < iommu_bus_base ||
dma_addr >= iommu_bus_base + iommu_size)
return;

Expand Down
11 changes: 4 additions & 7 deletions include/linux/dma-debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ extern void debug_dma_map_single(struct device *dev, const void *addr,

extern void debug_dma_map_page(struct device *dev, struct page *page,
size_t offset, size_t size,
int direction, dma_addr_t dma_addr,
bool map_single);
int direction, dma_addr_t dma_addr);

extern void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr);

extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
size_t size, int direction, bool map_single);
size_t size, int direction);

extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
int nents, int mapped_ents, int direction);
Expand Down Expand Up @@ -95,8 +94,7 @@ static inline void debug_dma_map_single(struct device *dev, const void *addr,

static inline void debug_dma_map_page(struct device *dev, struct page *page,
size_t offset, size_t size,
int direction, dma_addr_t dma_addr,
bool map_single)
int direction, dma_addr_t dma_addr)
{
}

Expand All @@ -106,8 +104,7 @@ static inline void debug_dma_mapping_error(struct device *dev,
}

static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
size_t size, int direction,
bool map_single)
size_t size, int direction)
{
}

Expand Down
Loading

0 comments on commit e2b745f

Please sign in to comment.