From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] arm64: use fixmap region for permanent FDT mapping
Date: Mon, 2 Mar 2015 14:40:37 +0000 [thread overview]
Message-ID: <20150302144036.GE16779@leverpostej> (raw)
In-Reply-To: <1425048823-25206-1-git-send-email-ard.biesheuvel@linaro.org>
On Fri, Feb 27, 2015 at 02:53:43PM +0000, Ard Biesheuvel wrote:
> Currently, the FDT blob needs to be in the same naturally aligned
> 512 MB region as the kernel, so that it can be mapped into the
> kernel virtual memory space very early on using a minimal set of
> statically allocated translation tables.
>
> Now that we have early fixmap support, we can relax this restriction,
> by moving the permanent FDT mapping to the fixmap region instead.
> This way, the FDT blob may be anywhere in memory.
Neat! I was hoping we'd have the chance to do this at some point.
[...]
> + /*
> + * Reserve 2 MB of virtual space for the FDT at the top of the fixmap
> + * region. Keep this at the top so it remains 2 MB aligned.
> + */
> +#define FIX_FDT_SIZE SZ_2M
> + FIX_FDT_END,
> + FIX_FDT = FIX_FDT_END + FIX_FDT_SIZE / PAGE_SIZE - 1,
Doesn't the presence of the FIX_HOLE entry mean that this isn't 2MB
aligned?
[...]
> __create_page_tables:
> - pgtbl x25, x26, x28 // idmap_pg_dir and swapper_pg_dir addresses
> + pgtbl x25, x26, x28 // idmap_pg_dir and swapper_pg_dir addresses
> mov x27, lr
>
> /*
This comment should just stay where it was. It aligns with comments
later within __create_page_tables that are left alone by this patch, so
we don't gain anything by moving it.
[...]
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index e8420f635bd4..7ea087d904ad 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -309,12 +309,14 @@ static void __init setup_processor(void)
>
> static void __init setup_machine_fdt(phys_addr_t dt_phys)
> {
> - if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys))) {
> + void *dt_virt = fixmap_remap_fdt(dt_phys);
> +
> + if (!dt_phys || !early_init_dt_scan(dt_virt)) {
> early_print("\n"
> "Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n"
> - "The dtb must be 8-byte aligned and passed in the first 512MB of memory\n"
> + "The dtb must be 8-byte aligned\n"
> "\nPlease check your bootloader.\n",
> - dt_phys, phys_to_virt(dt_phys));
> + dt_phys, dt_virt);
We should also check that the reported size in the header doesn't cross
a 2MB PA boundary, or we won't be able to map the whole DTB and the
crc32 code will explode later.
Otherwise this looks good!
Thanks,
Mark.
next prev parent reply other threads:[~2015-03-02 14:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-27 14:53 [RFC PATCH] arm64: use fixmap region for permanent FDT mapping Ard Biesheuvel
2015-03-02 14:40 ` Mark Rutland [this message]
2015-03-02 14:47 ` Ard Biesheuvel
2015-03-02 15:09 ` Mark Rutland
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=20150302144036.GE16779@leverpostej \
--to=mark.rutland@arm.com \
--cc=linux-arm-kernel@lists.infradead.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