@@ -33,6 +33,7 @@ struct machine_desc {
#ifdef CONFIG_ZONE_DMA
phys_addr_t dma_zone_size; /* size of DMA-able area */
#endif
+ bool dma_direct;
unsigned int video_start; /* start of video RAM */
unsigned int video_end; /* end of video RAM */
@@ -19,6 +19,7 @@
#include <linux/gfp.h>
#include <linux/memblock.h>
#include <linux/dma-contiguous.h>
+#include <linux/dma-direct.h>
#include <linux/sizes.h>
#include <linux/stop_machine.h>
#include <linux/swiotlb.h>
@@ -119,6 +120,8 @@ void __init setup_dma_zone(const struct machine_desc *mdesc)
*/
if (IS_ENABLED(CONFIG_ARM_LPAE))
arm_dma_direct = true;
+ else
+ arm_dma_direct = mdesc->dma_direct;
#ifdef CONFIG_ZONE_DMA
if (mdesc->dma_zone_size) {
@@ -126,7 +129,10 @@ void __init setup_dma_zone(const struct machine_desc *mdesc)
arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1;
} else
arm_dma_limit = 0xffffffff;
+
arm_dma_pfn_limit = arm_dma_limit >> PAGE_SHIFT;
+
+ zone_dma_bits = ilog2(arm_dma_limit) + 1;
#endif
}
@@ -482,7 +488,7 @@ static void __init free_highpages(void)
*/
void __init mem_init(void)
{
-#ifdef CONFIG_ARM_LPAE
+#ifdef CONFIG_SWIOTLB
swiotlb_init(1);
#endif
A bounce buffering feature is already available in ARM, dmabounce.c, yet it doesn't support high memory which some devices need. Instead of fixing it, provide a means for devices to enable dma-direct, which is the preferred way of doing DMA now days. Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> --- arch/arm/include/asm/mach/arch.h | 1 + arch/arm/mm/init.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-)