Skip to content

Commit d6d460b

Browse files
committed
Merge tag 'dma-mapping-4.20-3' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping fixes from Christoph Hellwig: "Two dma-direct / swiotlb regressions fixes: - zero is a valid physical address on some arm boards, we can't use it as the error value - don't try to cache flush the error return value (no matter what it is)" * tag 'dma-mapping-4.20-3' of git://git.infradead.org/users/hch/dma-mapping: swiotlb: Skip cache maintenance on map error dma-direct: Make DIRECT_MAPPING_ERROR viable for SWIOTLB
2 parents 17c2f54 + cb216b8 commit d6d460b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

include/linux/dma-direct.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <linux/dma-mapping.h>
66
#include <linux/mem_encrypt.h>
77

8-
#define DIRECT_MAPPING_ERROR 0
8+
#define DIRECT_MAPPING_ERROR (~(dma_addr_t)0)
99

1010
#ifdef CONFIG_ARCH_HAS_PHYS_TO_DMA
1111
#include <asm/dma-direct.h>

kernel/dma/swiotlb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,8 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
679679
}
680680

681681
if (!dev_is_dma_coherent(dev) &&
682-
(attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
682+
(attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0 &&
683+
dev_addr != DIRECT_MAPPING_ERROR)
683684
arch_sync_dma_for_device(dev, phys, size, dir);
684685

685686
return dev_addr;

0 commit comments

Comments
 (0)