Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / x86 / include / asm / dma-direct.h
blob1295bc622ebe5602a6e5c2681538977eabf51541
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef ASM_X86_DMA_DIRECT_H
3 #define ASM_X86_DMA_DIRECT_H 1
5 #include <linux/mem_encrypt.h>
7 #ifdef CONFIG_X86_DMA_REMAP /* Platform code defines bridge-specific code */
8 bool dma_capable(struct device *dev, dma_addr_t addr, size_t size);
9 dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
10 phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr);
11 #else
12 static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
14 if (!dev->dma_mask)
15 return 0;
17 return addr + size - 1 <= *dev->dma_mask;
20 static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
22 return __sme_set(paddr);
25 static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
27 return __sme_clr(daddr);
29 #endif /* CONFIG_X86_DMA_REMAP */
30 #endif /* ASM_X86_DMA_DIRECT_H */