Commit 4d1f3f25 authored by Jimi Xenidis's avatar Jimi Xenidis Committed by Paul Mackerras

[PATCH] powerpc: Auto reserve of device tree blob

A devtree compiler (dtc) generated devtree blob is "relocatable" and so
does not contain a reserved_map entry for the blob itself.  This means
that if passed to Linux, Linux will not get lmb_reserve() the blob and
it could be over.  The following patch will explicitly reserve the
"blob" as it was given to us and stops prom_init.c from creating a
reserved mapping for the blob.

NOTE: that the dtc/kexec should not generate the blob reservation entry.
Although if they do, LMB reserver handles overlaps.
Signed-off-by: default avatar  <jimix@watson.ibm.com>
Acked-by: default avatarMichael Neuling <mikey@neuling.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 1dc461f0
...@@ -1267,6 +1267,11 @@ static void __init early_reserve_mem(void) ...@@ -1267,6 +1267,11 @@ static void __init early_reserve_mem(void)
reserve_map = (u64 *)(((unsigned long)initial_boot_params) + reserve_map = (u64 *)(((unsigned long)initial_boot_params) +
initial_boot_params->off_mem_rsvmap); initial_boot_params->off_mem_rsvmap);
/* before we do anything, lets reserve the dt blob */
lmb_reserve(__pa((unsigned long)initial_boot_params),
initial_boot_params->totalsize);
#ifdef CONFIG_PPC32 #ifdef CONFIG_PPC32
/* /*
* Handle the case where we might be booting from an old kexec * Handle the case where we might be booting from an old kexec
......
...@@ -1950,11 +1950,7 @@ static void __init flatten_device_tree(void) ...@@ -1950,11 +1950,7 @@ static void __init flatten_device_tree(void)
/* Version 16 is not backward compatible */ /* Version 16 is not backward compatible */
hdr->last_comp_version = 0x10; hdr->last_comp_version = 0x10;
/* Reserve the whole thing and copy the reserve map in, we /* Copy the reserve map in */
* also bump mem_reserve_cnt to cause further reservations to
* fail since it's too late.
*/
reserve_mem(RELOC(dt_header_start), hdr->totalsize);
memcpy(rsvmap, RELOC(mem_reserve_map), sizeof(mem_reserve_map)); memcpy(rsvmap, RELOC(mem_reserve_map), sizeof(mem_reserve_map));
#ifdef DEBUG_PROM #ifdef DEBUG_PROM
...@@ -1967,6 +1963,9 @@ static void __init flatten_device_tree(void) ...@@ -1967,6 +1963,9 @@ static void __init flatten_device_tree(void)
RELOC(mem_reserve_map)[i].size); RELOC(mem_reserve_map)[i].size);
} }
#endif #endif
/* Bump mem_reserve_cnt to cause further reservations to fail
* since it's too late.
*/
RELOC(mem_reserve_cnt) = MEM_RESERVE_MAP_SIZE; RELOC(mem_reserve_cnt) = MEM_RESERVE_MAP_SIZE;
prom_printf("Device tree strings 0x%x -> 0x%x\n", prom_printf("Device tree strings 0x%x -> 0x%x\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment