aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/mach-loongson64
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-03-19 06:38:24 -0400
committerIngo Molnar <mingo@kernel.org>2018-03-20 05:01:59 -0400
commitb6e05477c10c12e36141558fc14f04b00ea634d4 (patch)
tree10fa56168c0fdeb896a6c845fadac8bbd112f554 /arch/mips/include/asm/mach-loongson64
parente7de6c7cc207be78369d45fb833d7d53aeda47f8 (diff)
dma/direct: Handle the memory encryption bit in common code
Give the basic phys_to_dma() and dma_to_phys() helpers a __-prefix and add the memory encryption mask to the non-prefixed versions. Use the __-prefixed versions directly instead of clearing the mask again in various places. Tested-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Joerg Roedel <joro@8bytes.org> Cc: Jon Mason <jdmason@kudzu.us> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Muli Ben-Yehuda <mulix@mulix.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: iommu@lists.linux-foundation.org Link: http://lkml.kernel.org/r/20180319103826.12853-13-hch@lst.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/mips/include/asm/mach-loongson64')
-rw-r--r--arch/mips/include/asm/mach-loongson64/dma-coherence.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/mips/include/asm/mach-loongson64/dma-coherence.h b/arch/mips/include/asm/mach-loongson64/dma-coherence.h
index b1b575f5c6c1..64fc44dec0a8 100644
--- a/arch/mips/include/asm/mach-loongson64/dma-coherence.h
+++ b/arch/mips/include/asm/mach-loongson64/dma-coherence.h
@@ -25,13 +25,13 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
25 return addr + size - 1 <= *dev->dma_mask; 25 return addr + size - 1 <= *dev->dma_mask;
26} 26}
27 27
28extern dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr); 28extern dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr);
29extern phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr); 29extern phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t daddr);
30static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, 30static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
31 size_t size) 31 size_t size)
32{ 32{
33#ifdef CONFIG_CPU_LOONGSON3 33#ifdef CONFIG_CPU_LOONGSON3
34 return phys_to_dma(dev, virt_to_phys(addr)); 34 return __phys_to_dma(dev, virt_to_phys(addr));
35#else 35#else
36 return virt_to_phys(addr) | 0x80000000; 36 return virt_to_phys(addr) | 0x80000000;
37#endif 37#endif
@@ -41,7 +41,7 @@ static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
41 struct page *page) 41 struct page *page)
42{ 42{
43#ifdef CONFIG_CPU_LOONGSON3 43#ifdef CONFIG_CPU_LOONGSON3
44 return phys_to_dma(dev, page_to_phys(page)); 44 return __phys_to_dma(dev, page_to_phys(page));
45#else 45#else
46 return page_to_phys(page) | 0x80000000; 46 return page_to_phys(page) | 0x80000000;
47#endif 47#endif
@@ -51,7 +51,7 @@ static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
51 dma_addr_t dma_addr) 51 dma_addr_t dma_addr)
52{ 52{
53#if defined(CONFIG_CPU_LOONGSON3) && defined(CONFIG_64BIT) 53#if defined(CONFIG_CPU_LOONGSON3) && defined(CONFIG_64BIT)
54 return dma_to_phys(dev, dma_addr); 54 return __dma_to_phys(dev, dma_addr);
55#elif defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) 55#elif defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT)
56 return (dma_addr > 0x8fffffff) ? dma_addr : (dma_addr & 0x0fffffff); 56 return (dma_addr > 0x8fffffff) ? dma_addr : (dma_addr & 0x0fffffff);
57#else 57#else