summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-09-08 17:56:22 +0200
committerChristoph Hellwig <hch@lst.de>2020-09-11 09:14:25 +0200
commit7bc5c428a660d4d1bc95ba54bf4cb6bccf8c3029 (patch)
tree306eb3d7befdec2da08f45e88e2dd2aaf6e5a5a1 /include
parent96eb89caf753fd0c26d239d8483d92632fb5be15 (diff)
downloadlinux-7bc5c428a660d4d1bc95ba54bf4cb6bccf8c3029.tar.bz2
dma-direct: remove __dma_to_phys
There is no harm in just always clearing the SME encryption bit, while significantly simplifying the interface. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/dma-direct.h14
1 files changed, 5 insertions, 9 deletions
diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h
index 20eceb2e4f91..f00e262ab6b1 100644
--- a/include/linux/dma-direct.h
+++ b/include/linux/dma-direct.h
@@ -24,11 +24,12 @@ static inline dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr)
return dev_addr - ((dma_addr_t)dev->dma_pfn_offset << PAGE_SHIFT);
}
-static inline phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dev_addr)
+static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr)
{
- phys_addr_t paddr = (phys_addr_t)dev_addr;
+ phys_addr_t paddr = (phys_addr_t)dev_addr +
+ ((phys_addr_t)dev->dma_pfn_offset << PAGE_SHIFT);
- return paddr + ((phys_addr_t)dev->dma_pfn_offset << PAGE_SHIFT);
+ return __sme_clr(paddr);
}
#endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */
@@ -44,7 +45,7 @@ static inline bool force_dma_unencrypted(struct device *dev)
/*
* If memory encryption is supported, phys_to_dma will set the memory encryption
* bit in the DMA address, and dma_to_phys will clear it. The raw __phys_to_dma
- * and __dma_to_phys versions should only be used on non-encrypted memory for
+ * version should only be used on non-encrypted memory for
* special occasions like DMA coherent buffers.
*/
static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
@@ -52,11 +53,6 @@ static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
return __sme_set(__phys_to_dma(dev, paddr));
}
-static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
-{
- return __sme_clr(__dma_to_phys(dev, daddr));
-}
-
static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size,
bool is_ram)
{