From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <ian.campbell@citrix.com>
Cc: stefano.stabellini@eu.citrix.com, tim@xen.org,
andre.przywara@linaro.org, xen-devel@lists.xen.org
Subject: Re: [PATCH v2 3/9] xen/arm: Reserve FDT via early module mechanism
Date: Fri, 13 Sep 2013 14:04:05 +0100 [thread overview]
Message-ID: <52330D45.6000000@linaro.org> (raw)
In-Reply-To: <1379072437-28099-3-git-send-email-ian.campbell@citrix.com>
On 09/13/2013 12:40 PM, Ian Campbell wrote:
> This will stop us putting any heaps or relocating Xen itself over the FDT.
>
> The devicetree will be copied to allocated memory in setup_mm and the original
> copy will be freed by discard_initial_modules.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
> xen/arch/arm/setup.c | 3 ++-
> xen/common/device_tree.c | 9 ++++++++-
> xen/include/xen/device_tree.h | 11 ++++++-----
> 3 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index 1ba2eb3..ab3d9aa 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -510,9 +510,10 @@ void __init start_xen(unsigned long boot_phys_offset,
>
> smp_clear_cpu_maps();
>
> + /* This is mapped by head.S */
> device_tree_flattened = (void *)BOOT_MISC_VIRT_START
> + (fdt_paddr & ((1 << SECOND_SHIFT) - 1));
> - fdt_size = device_tree_early_init(device_tree_flattened);
> + fdt_size = device_tree_early_init(device_tree_flattened, fdt_paddr);
>
> cpus = smp_get_max_cpus();
> cmdline_parse(device_tree_bootargs(device_tree_flattened));
> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> index c4f0f2c..9e0c224 100644
> --- a/xen/common/device_tree.c
> +++ b/xen/common/device_tree.c
> @@ -510,14 +510,21 @@ static void __init early_print_info(void)
> *
> * Returns the size of the DTB.
> */
> -size_t __init device_tree_early_init(const void *fdt)
> +size_t __init device_tree_early_init(const void *fdt, paddr_t paddr)
> {
> + struct dt_mb_module *mod;
> int ret;
>
> ret = fdt_check_header(fdt);
> if ( ret < 0 )
> early_panic("No valid device tree\n");
>
> + mod = &early_info.modules.module[MOD_FDT];
> + mod->start = paddr & PAGE_MASK;
Why do we need to align the flat device tree and not the other modules
(ie: initramfs, kernel,...)?
I looked at the memory code and it seems to handle non-aligned module.
> + mod->size = (fdt_totalsize(fdt) + ~PAGE_MASK) & PAGE_MASK;
You can use PAGE_ALIGN(fdt_totalsize(fdt)).
> +
> + early_info.modules.nr_mods = max(MOD_FDT, early_info.modules.nr_mods);
> +
> device_tree_for_each_node((void *)fdt, early_scan_node, NULL);
> early_print_info();
>
> diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
> index 5cc1905..3e50383 100644
> --- a/xen/include/xen/device_tree.h
> +++ b/xen/include/xen/device_tree.h
> @@ -21,11 +21,12 @@
> #define NR_MEM_BANKS 8
>
> #define MOD_XEN 0
> -#define MOD_KERNEL 1
> -#define MOD_INITRD 2
> -#define NR_MODULES 3
> +#define MOD_FDT 1
> +#define MOD_KERNEL 2
> +#define MOD_INITRD 3
> +#define NR_MODULES 4
>
> -#define MOD_DISCARD_FIRST MOD_KERNEL
> +#define MOD_DISCARD_FIRST MOD_FDT
>
> struct membank {
> paddr_t start;
> @@ -166,7 +167,7 @@ typedef int (*device_tree_node_func)(const void *fdt,
> extern struct dt_early_info early_info;
> extern void *device_tree_flattened;
>
> -size_t __init device_tree_early_init(const void *fdt);
> +size_t __init device_tree_early_init(const void *fdt, paddr_t paddr);
>
> void __init device_tree_get_reg(const u32 **cell, u32 address_cells,
> u32 size_cells,
>
--
Julien Grall
next prev parent reply other threads:[~2013-09-13 13:04 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-13 11:40 [PATCH v2 0/9] xen: arm: memory mangement fixes / improvements Ian Campbell
2013-09-13 11:40 ` [PATCH v2 1/9] xen/arm: ensure the xenheap is 32MB aligned Ian Campbell
2013-09-13 11:40 ` [PATCH v2 2/9] xen/arm: DOMHEAP_SECOND_PAGES is arm32 specific Ian Campbell
2013-09-13 12:55 ` Julien Grall
2013-09-13 11:40 ` [PATCH v2 3/9] xen/arm: Reserve FDT via early module mechanism Ian Campbell
2013-09-13 13:04 ` Julien Grall [this message]
2013-09-13 13:08 ` Ian Campbell
2013-09-13 11:40 ` [PATCH v2 4/9] xen/arm: do not relocate Xen outside of visible RAM Ian Campbell
2013-09-13 13:06 ` Julien Grall
2013-09-13 11:40 ` [PATCH v2 5/9] xen/arm: cope with modules outside of "visible" RAM Ian Campbell
2013-09-13 13:08 ` Julien Grall
2013-09-13 11:40 ` [PATCH v2 6/9] xen/arm: Support dtb /memreserve/ regions Ian Campbell
2013-09-13 11:40 ` [PATCH v2 7/9] xen/arm: rename boot misc region to boot reloc now it has a single purpose Ian Campbell
2013-09-13 13:17 ` Julien Grall
2013-09-13 11:40 ` [PATCH v2 8/9] xen/arm: print the location of the Xen heap on 32 bit Ian Campbell
2013-09-13 13:20 ` Julien Grall
2013-09-13 11:40 ` [PATCH v2 9/9] xen: support RAM at addresses 0 and 4096 Ian Campbell
2013-09-13 11:48 ` Keir Fraser
2013-09-13 11:57 ` Jan Beulich
2013-09-13 12:23 ` Ian Campbell
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=52330D45.6000000@linaro.org \
--to=julien.grall@linaro.org \
--cc=andre.przywara@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).