All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Manuel Lauss <manuel.lauss@gmail.com>,
	Linux-MIPS <linux-mips@linux-mips.org>
Subject: Re: [PATCH 1/3] MIPS: add hook for platforms to register CMA memory
Date: Wed, 10 Feb 2016 15:09:19 -0800	[thread overview]
Message-ID: <56BBC31F.10301@gmail.com> (raw)
In-Reply-To: <1444148603-45454-1-git-send-email-manuel.lauss@gmail.com>

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@gmail.com>

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

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

      parent reply	other threads:[~2016-02-10 23:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Florian Fainelli [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56BBC31F.10301@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=manuel.lauss@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.