Thread (4 messages) flat view 4 messages, 2 authors, 2015-03-02
DORMANTno replies

[RFC PATCH] arm64: use fixmap region for permanent FDT mapping

From: mark.rutland@arm.com (Mark Rutland)
Date: 2015-03-02 15:09:28

On Mon, Mar 02, 2015 at 02:47:41PM +0000, Ard Biesheuvel wrote:
On 2 March 2015 at 14:40, Mark Rutland [off-list ref] wrote:
quoted
On Fri, Feb 27, 2015 at 02:53:43PM +0000, Ard Biesheuvel wrote:
quoted
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.

[...]
quoted
+     /*
+      * 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?
Well, the fixmap is a bit odd in this respect: FIXADDR_TOP is
exclusive, so FIX_HOLE is only there as a placeholder.
Ah, I see.

Given that, shouldn't the test in __set_fixmap be something like:

BUG_ON(idx <= FIX_HOLE || idx >= __end_of_fixed_addresses);

[...]
quoted
Otherwise this looks good!
Actually, there is a bit of a snag:
early_init_fdt_scan_reserved_mem() reserves the FDT region, but does
so by using __pa() to retrieve the physical offset, which doesn't work
now the FDT is not accessed through the linear mapping.
Ouch.
I will try and figure out what the best way is to work around this.
Any and all suggestions appreciated.
We can do the reservation in the arm64 code and move the core part
behind a config option, but that's somewhat ugly. Passing the PA into
early_init_fdt_scan_reserved_mem also feels weird.

I'll have a think too.

Mark.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help