diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-25 12:24:40 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-25 12:24:40 -0500 |
| commit | d6d460b89378b1bc6715574cdafd748ba59d5a27 (patch) | |
| tree | b43a2f09bf1fa86264cc01c42f0650832c6619f0 | |
| parent | 17c2f540863a6c0faa3f0ede3c785d9427bcaf80 (diff) | |
| parent | cb216b84d6ea24fa10f1e7aac35de77246841041 (diff) | |
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
| -rw-r--r-- | include/linux/dma-direct.h | 2 | ||||
| -rw-r--r-- | kernel/dma/swiotlb.c | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h index bd73e7a91410..9e66bfe369aa 100644 --- a/include/linux/dma-direct.h +++ b/include/linux/dma-direct.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #include <linux/dma-mapping.h> | 5 | #include <linux/dma-mapping.h> |
| 6 | #include <linux/mem_encrypt.h> | 6 | #include <linux/mem_encrypt.h> |
| 7 | 7 | ||
| 8 | #define DIRECT_MAPPING_ERROR 0 | 8 | #define DIRECT_MAPPING_ERROR (~(dma_addr_t)0) |
| 9 | 9 | ||
| 10 | #ifdef CONFIG_ARCH_HAS_PHYS_TO_DMA | 10 | #ifdef CONFIG_ARCH_HAS_PHYS_TO_DMA |
| 11 | #include <asm/dma-direct.h> | 11 | #include <asm/dma-direct.h> |
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 5731daa09a32..045930e32c0e 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c | |||
| @@ -679,7 +679,8 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, | |||
| 679 | } | 679 | } |
| 680 | 680 | ||
| 681 | if (!dev_is_dma_coherent(dev) && | 681 | 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) | ||
| 683 | arch_sync_dma_for_device(dev, phys, size, dir); | 684 | arch_sync_dma_for_device(dev, phys, size, dir); |
| 684 | 685 | ||
| 685 | return dev_addr; | 686 | return dev_addr; |
