[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230221124613.2859-5-jiaxun.yang@flygoat.com>
Date: Tue, 21 Feb 2023 12:46:10 +0000
From: Jiaxun Yang <jiaxun.yang@...goat.com>
To: linux-mips@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
tsbogend@...ha.franken.de, mpe@...erman.id.au,
paul.walmsley@...ive.com, palmer@...belt.com, robh+dt@...nel.org,
hch@....de, m.szyprowski@...sung.com, robin.murphy@....com,
Jiaxun Yang <jiaxun.yang@...goat.com>
Subject: [PATCH 4/7] dma-mapping: Always provide dma_default_coherent
dma_default_coherent can be useful for determine default coherency
even on arches without noncoherent support.
Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
---
include/linux/dma-map-ops.h | 1 +
kernel/dma/mapping.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h
index d678afeb8a13..3c6cd17f87c3 100644
--- a/include/linux/dma-map-ops.h
+++ b/include/linux/dma-map-ops.h
@@ -269,6 +269,7 @@ static inline bool dev_is_dma_coherent(struct device *dev)
return dev->dma_coherent;
}
#else
+#define dma_default_coherent true
static inline bool dev_is_dma_coherent(struct device *dev)
{
return true;
diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
index c026a5a5e046..e0b005c8ffce 100644
--- a/kernel/dma/mapping.c
+++ b/kernel/dma/mapping.c
@@ -17,7 +17,11 @@
#include "debug.h"
#include "direct.h"
+#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \
+ defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \
+ defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)
bool dma_default_coherent;
+#endif
/*
* Managed DMA API
--
2.37.1 (Apple Git-137.1)
Powered by blists - more mailing lists