Skip to content

Commit

Permalink
Merge tag 'dma-mapping-4.20-3' 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:
 "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
  • Loading branch information
torvalds committed Nov 25, 2018
2 parents 17c2f54 + cb216b8 commit d6d460b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/linux/dma-direct.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <linux/dma-mapping.h>
#include <linux/mem_encrypt.h>

#define DIRECT_MAPPING_ERROR 0
#define DIRECT_MAPPING_ERROR (~(dma_addr_t)0)

#ifdef CONFIG_ARCH_HAS_PHYS_TO_DMA
#include <asm/dma-direct.h>
Expand Down
3 changes: 2 additions & 1 deletion kernel/dma/swiotlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,8 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
}

if (!dev_is_dma_coherent(dev) &&
(attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
(attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0 &&
dev_addr != DIRECT_MAPPING_ERROR)
arch_sync_dma_for_device(dev, phys, size, dir);

return dev_addr;
Expand Down

0 comments on commit d6d460b

Please sign in to comment.