Blob Blame History Raw
From 3091ffb7c5d3d3cc7b68b82ce78078f3937603d8 Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann <tzimmermann@suse.de>
Date: Fri, 15 Feb 2019 10:15:20 +0100
Subject: Reserve 64MiB of CMA for RPi3's VC4
Patch-mainline: Never, requried for SUSE installer on RPI3
References: bsc#1123536

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 kernel/dma/contiguous.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/kernel/dma/contiguous.c
+++ b/kernel/dma/contiguous.c
@@ -23,6 +23,7 @@
 #include <linux/sizes.h>
 #include <linux/dma-contiguous.h>
 #include <linux/cma.h>
+#include <linux/of_fdt.h>
 
 #ifdef CONFIG_CMA_SIZE_MBYTES
 #define CMA_SIZE_MBYTES CONFIG_CMA_SIZE_MBYTES
@@ -113,6 +114,15 @@ void __init dma_contiguous_reserve(phys_
 
 	pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit);
 
+#ifdef CONFIG_OF_EARLY_FLATTREE
+	if (size_cmdline == -1) {
+		/* bsc#1123536: Reserve 64 MiB of CMA for RPi3's VC4. */
+		static const char model_name[] = "Raspberry Pi 3";
+		const char* model = of_flat_dt_get_machine_name();
+		if (model && !strncmp(model, model_name, strlen(model_name)))
+			size_cmdline = 64 << 20;
+	}
+#endif
 	if (size_cmdline != -1) {
 		selected_size = size_cmdline;
 		selected_base = base_cmdline;