diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-03-30 09:18:43 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2016-04-14 11:20:45 -0400 |
commit | 8923a16686569375bfa25b877769f9a3093e9f22 (patch) | |
tree | 1f363907b2da9572a6434ead5b100feb5f13bab9 /arch/arm64/kernel/setup.c | |
parent | 177e15f0c1444cd392374ec7175c4787fd911369 (diff) |
arm64: remove the now unneeded relocate_initrd()
This removes the relocate_initrd() implementation and invocation, which are
no longer needed now that the placement of the initrd is guaranteed to be
covered by the linear mapping.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kernel/setup.c')
-rw-r--r-- | arch/arm64/kernel/setup.c | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 9dc67769b6a4..7b85b1d6a6fb 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c | |||
@@ -224,69 +224,6 @@ static void __init request_standard_resources(void) | |||
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | #ifdef CONFIG_BLK_DEV_INITRD | ||
228 | /* | ||
229 | * Relocate initrd if it is not completely within the linear mapping. | ||
230 | * This would be the case if mem= cuts out all or part of it. | ||
231 | */ | ||
232 | static void __init relocate_initrd(void) | ||
233 | { | ||
234 | phys_addr_t orig_start = __virt_to_phys(initrd_start); | ||
235 | phys_addr_t orig_end = __virt_to_phys(initrd_end); | ||
236 | phys_addr_t ram_end = memblock_end_of_DRAM(); | ||
237 | phys_addr_t new_start; | ||
238 | unsigned long size, to_free = 0; | ||
239 | void *dest; | ||
240 | |||
241 | if (orig_end <= ram_end) | ||
242 | return; | ||
243 | |||
244 | /* | ||
245 | * Any of the original initrd which overlaps the linear map should | ||
246 | * be freed after relocating. | ||
247 | */ | ||
248 | if (orig_start < ram_end) | ||
249 | to_free = ram_end - orig_start; | ||
250 | |||
251 | size = orig_end - orig_start; | ||
252 | if (!size) | ||
253 | return; | ||
254 | |||
255 | /* initrd needs to be relocated completely inside linear mapping */ | ||
256 | new_start = memblock_find_in_range(0, PFN_PHYS(max_pfn), | ||
257 | size, PAGE_SIZE); | ||
258 | if (!new_start) | ||
259 | panic("Cannot relocate initrd of size %ld\n", size); | ||
260 | memblock_reserve(new_start, size); | ||
261 | |||
262 | initrd_start = __phys_to_virt(new_start); | ||
263 | initrd_end = initrd_start + size; | ||
264 | |||
265 | pr_info("Moving initrd from [%llx-%llx] to [%llx-%llx]\n", | ||
266 | orig_start, orig_start + size - 1, | ||
267 | new_start, new_start + size - 1); | ||
268 | |||
269 | dest = (void *)initrd_start; | ||
270 | |||
271 | if (to_free) { | ||
272 | memcpy(dest, (void *)__phys_to_virt(orig_start), to_free); | ||
273 | dest += to_free; | ||
274 | } | ||
275 | |||
276 | copy_from_early_mem(dest, orig_start + to_free, size - to_free); | ||
277 | |||
278 | if (to_free) { | ||
279 | pr_info("Freeing original RAMDISK from [%llx-%llx]\n", | ||
280 | orig_start, orig_start + to_free - 1); | ||
281 | memblock_free(orig_start, to_free); | ||
282 | } | ||
283 | } | ||
284 | #else | ||
285 | static inline void __init relocate_initrd(void) | ||
286 | { | ||
287 | } | ||
288 | #endif | ||
289 | |||
290 | u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID }; | 227 | u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID }; |
291 | 228 | ||
292 | void __init setup_arch(char **cmdline_p) | 229 | void __init setup_arch(char **cmdline_p) |
@@ -327,7 +264,6 @@ void __init setup_arch(char **cmdline_p) | |||
327 | acpi_boot_table_init(); | 264 | acpi_boot_table_init(); |
328 | 265 | ||
329 | paging_init(); | 266 | paging_init(); |
330 | relocate_initrd(); | ||
331 | 267 | ||
332 | kasan_init(); | 268 | kasan_init(); |
333 | 269 | ||