History

Merge tag 'dma-mapping-5.3-1' of git://git.infradead.org/users/hch/dma-mapping

Pull dma-mapping fixes from Christoph Hellwig: "Fix various regressions: - force unencrypted dma-coherent buffers if encryption bit can't fit into the dma coherent mask (Tom Lendacky) - avoid limiting request size if swiotlb is not used (me) - fix swiotlb handling in dma_direct_sync_sg_for_cpu/device (Fugang Duan)" * tag 'dma-mapping-5.3-1' of git://git.infradead.org/users/hch/dma-mapping: dma-direct: correct the physical addr in dma_direct_sync_sg_for_cpu/device dma-direct: only limit the mapping size if swiotlb could be used dma-mapping: add a dma_addressing_limited helper dma-direct: Force unencrypted DMA under SME for certain DMA masks

Linus Torvalds committed 7 years ago

Commit ac606022 parents c6dd78f 449fa548 files · +83 −26Browse files

Showing the changes to include/linux (2 of 8 files). Show all

Unified · Split

2 files
  1. include/linux/dma-direct.h +9 −0
  2. include/linux/dma-mapping.h +14 −0
include/linux/dma-direct.h+9−0
@@ -32,6 +32,15 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) · 31 unmodified lines
32}32}
33#endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */33#endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */
34 34
35#ifdef CONFIG_ARCH_HAS_FORCE_DMA_UNENCRYPTED
36bool force_dma_unencrypted(struct device *dev);
37#else
38static inline bool force_dma_unencrypted(struct device *dev)
39{
40 return false;
41}
42#endif /* CONFIG_ARCH_HAS_FORCE_DMA_UNENCRYPTED */
43
35/*44/*
36 * If memory encryption is supported, phys_to_dma will set the memory encryption45 * If memory encryption is supported, phys_to_dma will set the memory encryption
37 * bit in the DMA address, and dma_to_phys will clear it. The raw __phys_to_dma46 * bit in the DMA address, and dma_to_phys will clear it. The raw __phys_to_dma
include/linux/dma-mapping.h+14−0
@@ -679,6 +679,20 @@ static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask) · 678 unmodified lines
679 return dma_set_mask_and_coherent(dev, mask);679 return dma_set_mask_and_coherent(dev, mask);
680}680}
681 681
682/**
683 * dma_addressing_limited - return if the device is addressing limited
684 * @dev: device to check
685 *
686 * Return %true if the devices DMA mask is too small to address all memory in
687 * the system, else %false. Lack of addressing bits is the prime reason for
688 * bounce buffering, but might not be the only one.
689 */
690static inline bool dma_addressing_limited(struct device *dev)
691{
692 return min_not_zero(*dev->dma_mask, dev->bus_dma_mask) <
693 dma_get_required_mask(dev);
694}
695
682#ifdef CONFIG_ARCH_HAS_SETUP_DMA_OPS696#ifdef CONFIG_ARCH_HAS_SETUP_DMA_OPS
683void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,697void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
684 const struct iommu_ops *iommu, bool coherent);698 const struct iommu_ops *iommu, bool coherent);