* [PATCH] MIPS: Loongson64: Fix up reserving kernel memory range
@ 2020-11-25 10:11 Jinyang He
2020-11-27 10:34 ` Thomas Bogendoerfer
2020-12-03 9:30 ` Jiaxun Yang
0 siblings, 2 replies; 3+ messages in thread
From: Jinyang He @ 2020-11-25 10:11 UTC (permalink / raw)
To: Thomas Bogendoerfer, Huacai Chen, Jiaxun Yang; +Cc: linux-mips, linux-kernel
Reserve memory from &_text to &_end. Otherwise if kernel address
was modified, the memory range of start_pfn to kernel_start_pfn
would be reserved. Then we could not use this range.
Signed-off-by: Jinyang He <hejinyang@loongson.cn>
---
arch/mips/loongson64/numa.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c
index 509b360..c6f0c48 100644
--- a/arch/mips/loongson64/numa.c
+++ b/arch/mips/loongson64/numa.c
@@ -151,6 +151,9 @@ static void __init node_mem_init(unsigned int node)
NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;
if (node == 0) {
+ /* kernel start address */
+ unsigned long kernel_start_pfn = PFN_DOWN(__pa_symbol(&_text));
+
/* kernel end address */
unsigned long kernel_end_pfn = PFN_UP(__pa_symbol(&_end));
@@ -158,8 +161,8 @@ static void __init node_mem_init(unsigned int node)
max_low_pfn = end_pfn;
/* Reserve the kernel text/data/bss */
- memblock_reserve(start_pfn << PAGE_SHIFT,
- ((kernel_end_pfn - start_pfn) << PAGE_SHIFT));
+ memblock_reserve(kernel_start_pfn << PAGE_SHIFT,
+ ((kernel_end_pfn - kernel_start_pfn) << PAGE_SHIFT));
/* Reserve 0xfe000000~0xffffffff for RS780E integrated GPU */
if (node_end_pfn(0) >= (0xffffffff >> PAGE_SHIFT))
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] MIPS: Loongson64: Fix up reserving kernel memory range
2020-11-25 10:11 [PATCH] MIPS: Loongson64: Fix up reserving kernel memory range Jinyang He
@ 2020-11-27 10:34 ` Thomas Bogendoerfer
2020-12-03 9:30 ` Jiaxun Yang
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2020-11-27 10:34 UTC (permalink / raw)
To: Jinyang He; +Cc: Huacai Chen, Jiaxun Yang, linux-mips, linux-kernel
On Wed, Nov 25, 2020 at 06:11:02PM +0800, Jinyang He wrote:
> Reserve memory from &_text to &_end. Otherwise if kernel address
> was modified, the memory range of start_pfn to kernel_start_pfn
> would be reserved. Then we could not use this range.
>
> Signed-off-by: Jinyang He <hejinyang@loongson.cn>
> ---
> arch/mips/loongson64/numa.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] MIPS: Loongson64: Fix up reserving kernel memory range
2020-11-25 10:11 [PATCH] MIPS: Loongson64: Fix up reserving kernel memory range Jinyang He
2020-11-27 10:34 ` Thomas Bogendoerfer
@ 2020-12-03 9:30 ` Jiaxun Yang
1 sibling, 0 replies; 3+ messages in thread
From: Jiaxun Yang @ 2020-12-03 9:30 UTC (permalink / raw)
To: Jinyang He, Thomas Bogendoerfer, Huacai Chen; +Cc: linux-mips, linux-kernel
于 2020年11月25日 GMT+08:00 下午6:11:02, Jinyang He <hejinyang@loongson.cn> 写到:
>Reserve memory from &_text to &_end. Otherwise if kernel address
>was modified, the memory range of start_pfn to kernel_start_pfn
>would be reserved. Then we could not use this range.
I suspect you meant to make use lower memory after relocation?
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Thanks.
- Jiaxun
>
>Signed-off-by: Jinyang He <hejinyang@loongson.cn>
>---
> arch/mips/loongson64/numa.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
>diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c
>index 509b360..c6f0c48 100644
>--- a/arch/mips/loongson64/numa.c
>+++ b/arch/mips/loongson64/numa.c
>@@ -151,6 +151,9 @@ static void __init node_mem_init(unsigned int node)
> NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;
>
> if (node == 0) {
>+ /* kernel start address */
>+ unsigned long kernel_start_pfn = PFN_DOWN(__pa_symbol(&_text));
>+
> /* kernel end address */
> unsigned long kernel_end_pfn = PFN_UP(__pa_symbol(&_end));
>
>@@ -158,8 +161,8 @@ static void __init node_mem_init(unsigned int node)
> max_low_pfn = end_pfn;
>
> /* Reserve the kernel text/data/bss */
>- memblock_reserve(start_pfn << PAGE_SHIFT,
>- ((kernel_end_pfn - start_pfn) << PAGE_SHIFT));
>+ memblock_reserve(kernel_start_pfn << PAGE_SHIFT,
>+ ((kernel_end_pfn - kernel_start_pfn) << PAGE_SHIFT));
>
> /* Reserve 0xfe000000~0xffffffff for RS780E integrated GPU */
> if (node_end_pfn(0) >= (0xffffffff >> PAGE_SHIFT))
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-03 9:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 10:11 [PATCH] MIPS: Loongson64: Fix up reserving kernel memory range Jinyang He
2020-11-27 10:34 ` Thomas Bogendoerfer
2020-12-03 9:30 ` Jiaxun Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).