summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGaurav Batra <gbatra@linux.ibm.com>2025-11-07 19:11:05 +0300
committerMadhavan Srinivasan <maddy@linux.ibm.com>2026-01-07 07:03:55 +0300
commit1471c517cf7dae1a6342fb821d8ed501af956dd0 (patch)
tree8adae503ae559b9eb3fe6e6f5ffd86854621fe24 /include
parent20ab1d11265350a9ea3d315d6c70170b8198f329 (diff)
downloadlinux-1471c517cf7dae1a6342fb821d8ed501af956dd0.tar.xz
powerpc/iommu: bypass DMA APIs for coherent allocations for pre-mapped memory
Leverage ARCH_HAS_DMA_MAP_DIRECT config option for coherent allocations as well. This will bypass DMA ops for memory allocations that have been pre-mapped. Always set device bus_dma_limit when memory is pre-mapped. In some architectures, like PowerPC, pmemory can be converted to regular memory via daxctl command. This will gate the coherent allocations to pre-mapped RAM only, by dma_coherent_ok(). Signed-off-by: Gaurav Batra <gbatra@linux.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20251107161105.85999-1-gbatra@linux.ibm.com
Diffstat (limited to 'include')
-rw-r--r--include/linux/dma-map-ops.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h
index 4809204c674c..8eff2f53fd86 100644
--- a/include/linux/dma-map-ops.h
+++ b/include/linux/dma-map-ops.h
@@ -395,11 +395,15 @@ bool arch_dma_map_sg_direct(struct device *dev, struct scatterlist *sg,
int nents);
bool arch_dma_unmap_sg_direct(struct device *dev, struct scatterlist *sg,
int nents);
+bool arch_dma_alloc_direct(struct device *dev);
+bool arch_dma_free_direct(struct device *dev, dma_addr_t dma_handle);
#else
#define arch_dma_map_phys_direct(d, a) (false)
#define arch_dma_unmap_phys_direct(d, a) (false)
#define arch_dma_map_sg_direct(d, s, n) (false)
#define arch_dma_unmap_sg_direct(d, s, n) (false)
+#define arch_dma_alloc_direct(d) (false)
+#define arch_dma_free_direct(d, a) (false)
#endif
#ifdef CONFIG_ARCH_HAS_SETUP_DMA_OPS