All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Kevin Hao <haokexin@gmail.com>
Cc: linuxppc <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH v2 6/8] powerpc: introduce early_get_first_memblock_info
Date: Fri, 26 Jul 2013 19:18:01 -0500	[thread overview]
Message-ID: <1374884281.30721.40@snotra> (raw)
In-Reply-To: <1372942454-25191-7-git-send-email-haokexin@gmail.com> (from haokexin@gmail.com on Thu Jul  4 07:54:12 2013)

On 07/04/2013 07:54:12 AM, Kevin Hao wrote:
> For a relocatable kernel since it can be loaded at any place, there
> is no any relation between the kernel start addr and the =20
> memstart_addr.
> So we can't calculate the memstart_addr from kernel start addr. And
> also we can't wait to do the relocation after we get the real
> memstart_addr from device tree because it is so late. So introduce
> a new function we can use to get the first memblock address and size
> in a very early stage (before machine_init).
>=20
> Signed-off-by: Kevin Hao <haokexin@gmail.com>
> ---
> A new patch in v2.
>=20
>  arch/powerpc/kernel/prom.c | 24 ++++++++++++++++++++++++
>  include/linux/of_fdt.h     |  1 +
>  2 files changed, 25 insertions(+)
>=20
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index eb23ac9..9a69d2d 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -753,6 +753,30 @@ void __init early_init_devtree(void *params)
>  	DBG(" <- early_init_devtree()\n");
>  }
>=20
> +#ifdef CONFIG_RELOCATABLE
> +/*
> + * This function run before early_init_devtree, so we have to init
> + * initial_boot_params. Since early_init_dt_scan_memory_ppc will be
> + * executed again in early_init_devtree, we have to reinitialize the
> + * memblock data before return.
> + */
> +void __init early_get_first_memblock_info(void *params, phys_addr_t =20
> *size)
> +{
> +	/* Setup flat device-tree pointer */
> +	initial_boot_params =3D params;
> +
> +	/* Scan memory nodes and rebuild MEMBLOCKs */
> +	of_scan_flat_dt(early_init_dt_scan_root, NULL);
> +	of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);
> +
> +	if (size)
> +		*size =3D first_memblock_size;
> +
> +	/* Undo what early_init_dt_scan_memory_ppc does to memblock */
> +	memblock_reinit();
> +}
> +#endif

Wouldn't it be simpler to set a flag so that =20
early_init_dt_add_memory_arch() doesn't mess with memblocks on the =20
first pass?

-Scott=

  reply	other threads:[~2013-07-27  0:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-04 12:54 [PATCH v2 0/8] powerpc: enable the relocatable support for fsl booke 32bit kernel Kevin Hao
2013-07-04 12:54 ` [PATCH v2 1/8] powerpc/fsl_booke: protect the access to MAS7 with MMU_FTR_BIG_PHYS Kevin Hao
2013-07-26 23:14   ` Scott Wood
2013-08-04  0:30     ` Kevin Hao
2013-07-04 12:54 ` [PATCH v2 2/8] powerpc/fsl_booke: introduce get_phys_addr function Kevin Hao
2013-07-04 12:54 ` [PATCH v2 3/8] powerpc: enable the relocatable support for the fsl booke 32bit kernel Kevin Hao
2013-07-26 23:28   ` Scott Wood
2013-08-04  0:38     ` Kevin Hao
2013-07-04 12:54 ` [PATCH v2 4/8] powerpc/fsl_booke: set the tlb entry for the kernel address in AS1 Kevin Hao
2013-07-26 23:37   ` Scott Wood
2013-08-04  0:42     ` Kevin Hao
2013-07-04 12:54 ` [PATCH v2 5/8] memblock: introduce the memblock_reinit function Kevin Hao
2013-07-04 12:54   ` Kevin Hao
2013-07-04 12:54 ` [PATCH v2 6/8] powerpc: introduce early_get_first_memblock_info Kevin Hao
2013-07-27  0:18   ` Scott Wood [this message]
2013-08-04  0:45     ` Kevin Hao
2013-08-05 23:59       ` Scott Wood
2013-08-06  1:21         ` Kevin Hao
2013-07-04 12:54 ` [PATCH v2 7/8] powerpc/fsl_booke: make sure PAGE_OFFSET map to memstart_addr for relocatable kernel Kevin Hao
2013-07-27  0:17   ` Scott Wood
2013-08-04  0:50     ` Kevin Hao
2013-08-06  0:10       ` Scott Wood
2013-08-06  1:23         ` Kevin Hao
2013-08-06  0:14   ` Scott Wood
2013-08-06  1:45     ` Kevin Hao
2013-07-04 12:54 ` [PATCH v2 8/8] powerpc/fsl_booke: enable the relocatable for the kdump kernel Kevin Hao

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=1374884281.30721.40@snotra \
    --to=scottwood@freescale.com \
    --cc=haokexin@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /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.