Skip to content

Commit e2b745f

Browse files
committed
Merge tag 'dma-mapping-4.21-1' of git://git.infradead.org/users/hch/dma-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
2 parents 1213325 + 8270f3a commit e2b745f

File tree

8 files changed

+215
-275
lines changed

8 files changed

+215
-275
lines changed

Documentation/driver-model/devres.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ DMA
250250
dmaenginem_async_device_register()
251251
dmam_alloc_coherent()
252252
dmam_alloc_attrs()
253-
dmam_declare_coherent_memory()
254253
dmam_free_coherent()
255254
dmam_pool_create()
256255
dmam_pool_destroy()

arch/x86/kernel/amd_gart_64.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,15 @@ static void gart_unmap_page(struct device *dev, dma_addr_t dma_addr,
256256
int npages;
257257
int i;
258258

259-
if (dma_addr == DMA_MAPPING_ERROR ||
259+
if (WARN_ON_ONCE(dma_addr == DMA_MAPPING_ERROR))
260+
return;
261+
262+
/*
263+
* This driver will not always use a GART mapping, but might have
264+
* created a direct mapping instead. If that is the case there is
265+
* nothing to unmap here.
266+
*/
267+
if (dma_addr < iommu_bus_base ||
260268
dma_addr >= iommu_bus_base + iommu_size)
261269
return;
262270

include/linux/dma-debug.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@ extern void debug_dma_map_single(struct device *dev, const void *addr,
3535

3636
extern void debug_dma_map_page(struct device *dev, struct page *page,
3737
size_t offset, size_t size,
38-
int direction, dma_addr_t dma_addr,
39-
bool map_single);
38+
int direction, dma_addr_t dma_addr);
4039

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

4342
extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
44-
size_t size, int direction, bool map_single);
43+
size_t size, int direction);
4544

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

9695
static inline void debug_dma_map_page(struct device *dev, struct page *page,
9796
size_t offset, size_t size,
98-
int direction, dma_addr_t dma_addr,
99-
bool map_single)
97+
int direction, dma_addr_t dma_addr)
10098
{
10199
}
102100

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

108106
static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
109-
size_t size, int direction,
110-
bool map_single)
107+
size_t size, int direction)
111108
{
112109
}
113110

0 commit comments

Comments
 (0)