All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] MIPS: add hook for platforms to register CMA memory
@ 2015-10-06 16:23 Manuel Lauss
  2015-10-06 16:23 ` [PATCH 2/3] MIPS: Alchemy: devboards: register CMA memory for Au1200 framebuffer Manuel Lauss
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Manuel Lauss @ 2015-10-06 16:23 UTC (permalink / raw)
  To: Linux-MIPS; +Cc: Manuel Lauss

Add a hook which is called after MIPS CMA memory reservation
to allow platforms to register device-specific CMA areas.
I'm going to use this for the Au1200/Au1300 framebuffer initially.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
---
Tested on Db1200/Db1300 and Db1500.  I found that this is the only
place in the initcall-chain where allocating CMA memory for devices
is actually possible on MIPS/Alchemy.

 arch/mips/include/asm/bootinfo.h | 5 +++++
 arch/mips/kernel/setup.c         | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/arch/mips/include/asm/bootinfo.h b/arch/mips/include/asm/bootinfo.h
index b603804..1fc1f67 100644
--- a/arch/mips/include/asm/bootinfo.h
+++ b/arch/mips/include/asm/bootinfo.h
@@ -132,6 +132,11 @@ extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
  */
 extern void plat_mem_setup(void);
 
+/*
+ * optional hook to reserve CMA memory for devices
+ */
+extern void (*plat_reserve_mem)(void);
+
 #ifdef CONFIG_SWIOTLB
 /*
  * Optional platform hook to call swiotlb_setup().
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 35b8316..2b56885 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -71,6 +71,8 @@ char __initdata arcs_cmdline[COMMAND_LINE_SIZE];
 static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
 #endif
 
+void (*plat_reserve_mem)(void) __initdata = NULL;
+
 /*
  * mips_io_port_base is the begin of the address space to which x86 style
  * I/O ports are mapped.
@@ -678,7 +680,12 @@ static void __init arch_mem_init(char **cmdline_p)
 	plat_swiotlb_setup();
 	paging_init();
 
+	/* allocate default CMA area */
 	dma_contiguous_reserve(PFN_PHYS(max_low_pfn));
+	/* allow platforms to reserve CMA memory for devices */
+	if (plat_reserve_mem)
+		plat_reserve_mem();
+
 	/* Tell bootmem about cma reserved memblock section */
 	for_each_memblock(reserved, reg)
 		if (reg->size != 0)
-- 
2.5.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-02-10 23:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06 16:23 [PATCH 1/3] MIPS: add hook for platforms to register CMA memory Manuel Lauss
2015-10-06 16:23 ` [PATCH 2/3] MIPS: Alchemy: devboards: register CMA memory for Au1200 framebuffer Manuel Lauss
2015-10-06 16:23 ` [PATCH 3/3] video: fbdev: au1200fb: alloc mem from coherent pool/CMA Manuel Lauss
2015-10-06 16:23   ` Manuel Lauss
2016-02-10 23:09 ` [PATCH 1/3] MIPS: add hook for platforms to register CMA memory Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.