mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 09:55:19 +02:00
LoongArch: Use correct API to map cmdline in relocate_kernel()
[ Upstream commit 0124fbb4c6
]
fw_arg1 is in memory space rather than I/O space, so we should use
early_memremap_ro() instead of early_ioremap() to map the cmdline.
Moreover, we should unmap it after using.
Suggested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
938acd8e3a
commit
fd8e141223
|
@ -13,6 +13,7 @@
|
||||||
#include <asm/bootinfo.h>
|
#include <asm/bootinfo.h>
|
||||||
#include <asm/early_ioremap.h>
|
#include <asm/early_ioremap.h>
|
||||||
#include <asm/inst.h>
|
#include <asm/inst.h>
|
||||||
|
#include <asm/io.h>
|
||||||
#include <asm/sections.h>
|
#include <asm/sections.h>
|
||||||
#include <asm/setup.h>
|
#include <asm/setup.h>
|
||||||
|
|
||||||
|
@ -170,7 +171,7 @@ unsigned long __init relocate_kernel(void)
|
||||||
unsigned long kernel_length;
|
unsigned long kernel_length;
|
||||||
unsigned long random_offset = 0;
|
unsigned long random_offset = 0;
|
||||||
void *location_new = _text; /* Default to original kernel start */
|
void *location_new = _text; /* Default to original kernel start */
|
||||||
char *cmdline = early_ioremap(fw_arg1, COMMAND_LINE_SIZE); /* Boot command line is passed in fw_arg1 */
|
char *cmdline = early_memremap_ro(fw_arg1, COMMAND_LINE_SIZE); /* Boot command line is passed in fw_arg1 */
|
||||||
|
|
||||||
strscpy(boot_command_line, cmdline, COMMAND_LINE_SIZE);
|
strscpy(boot_command_line, cmdline, COMMAND_LINE_SIZE);
|
||||||
|
|
||||||
|
@ -182,6 +183,7 @@ unsigned long __init relocate_kernel(void)
|
||||||
random_offset = (unsigned long)location_new - (unsigned long)(_text);
|
random_offset = (unsigned long)location_new - (unsigned long)(_text);
|
||||||
#endif
|
#endif
|
||||||
reloc_offset = (unsigned long)_text - VMLINUX_LOAD_ADDRESS;
|
reloc_offset = (unsigned long)_text - VMLINUX_LOAD_ADDRESS;
|
||||||
|
early_memunmap(cmdline, COMMAND_LINE_SIZE);
|
||||||
|
|
||||||
if (random_offset) {
|
if (random_offset) {
|
||||||
kernel_length = (long)(_end) - (long)(_text);
|
kernel_length = (long)(_end) - (long)(_text);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user