Re: [PATCH 1/3] MIPS: add hook for platforms to register CMA memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/10/15 09:23, Manuel Lauss wrote:
> 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@xxxxxxxxx>

Acked-by: Florian Fainelli <f.fainelli@xxxxxxxxx>

This is also useful for BMIPS_GENERIC platforms where we may need to do
custom memory reservations.

Thanks!

> ---
> 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)
> 


-- 
Florian




[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux