Skip to contentSkip to conversation

riscv: mm: fix wrong phys_ram_base value for RV64

PATCH In review Jisheng Zhang 4 participants 4 messages Dec 2, 2021 – Jan 11, 2022 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: mm: fix wrong phys_ram_base value for RV64

Currently, if 64BIT and !XIP_KERNEL, the phys_ram_base is always 0, no matter the real start of dram reported by memblock is. The original patch[1] is correct, I believe it's not corrected merged due to lots of #ifdef in arch/riscv/mm/init.c, I plan to send a clean up series soon.

[1] http://lists.infradead.org/pipermail/linux-riscv/2021-July/007650.html

Fixes 6d7f91d914bc ("riscv: Get rid of CONFIG_PHYS_RAM_BASE in kernel physical address conversion")
---
 arch/riscv/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/init.c +1 -1
index 24b2b8044602..3c0649dba4ff 100644
@@ -187,10 +187,10 @@ static void __init setup_bootmem(void)
 
 
 	phys_ram_end = memblock_end_of_DRAM();
-#ifndef CONFIG_64BIT
 #ifndef CONFIG_XIP_KERNEL
 	phys_ram_base = memblock_start_of_DRAM();
 #endif
+#ifndef CONFIG_64BIT
 	/*
 	 * memblock allocator is not aware of the fact that last 4K bytes of
 	 * the addressable memory can not be mapped because of IS_ERR_VALUE
Signature · 1 line
2.34.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Jisheng Zhang

Currently, if 64BIT and !XIP_KERNEL, the phys_ram_base is always 0, no matter the real start of dram reported by memblock is. The original patch[1] is correct, I believe it's not corrected merged due to lots of #ifdef in arch/riscv/mm/init.c, I plan to send a clean up series soon.

[1] http://lists.infradead.org/pipermail/linux-riscv/2021-July/007650.html

Fixes 6d7f91d914bc ("riscv: Get rid of CONFIG_PHYS_RAM_BASE in kernel physical address conversion")
---
  arch/riscv/mm/init.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/init.c +0 -0
index 24b2b8044602..3c0649dba4ff 100644
@@ -187,10 +187,10 @@ static void __init setup_bootmem(void)
 

arch/riscv/mm/init.c static void __init setup_bootmem(void) · line 196

Quoted 10 lines
arch/riscv/mm/init.c +1 -1
 
  	phys_ram_end = memblock_end_of_DRAM();
-#ifndef CONFIG_64BIT
  #ifndef CONFIG_XIP_KERNEL
  	phys_ram_base = memblock_start_of_DRAM();
  #endif
+#ifndef CONFIG_64BIT
  	/*
  	 * memblock allocator is not aware of the fact that last 4K bytes of
  	 * the addressable memory can not be mapped because of IS_ERR_VALUE

Good catch, you can add:

And looking forward to your cleanup patch ;)

Thanks,

Alex

#2 lore raw
Quoted 35 lines · On Thu, 2 Dec 2021 16:52:08 +0100 Alexandre ghiti <[email protected]> wrote:
Quoted 20 lines · Jisheng Zhang

Currently, if 64BIT and !XIP_KERNEL, the phys_ram_base is always 0, no matter the real start of dram reported by memblock is. The original patch[1] is correct, I believe it's not corrected merged due to lots of #ifdef in arch/riscv/mm/init.c, I plan to send a clean up series soon.

[1] http://lists.infradead.org/pipermail/linux-riscv/2021-July/007650.html

Fixes 6d7f91d914bc ("riscv: Get rid of CONFIG_PHYS_RAM_BASE in kernel physical address conversion")
---
  arch/riscv/mm/init.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/init.c +0 -0
index 24b2b8044602..3c0649dba4ff 100644
@@ -187,10 +187,10 @@ static void __init setup_bootmem(void)
 

arch/riscv/mm/init.c static void __init setup_bootmem(void) · line 196

Quoted 10 lines
arch/riscv/mm/init.c +1 -1
 
  	phys_ram_end = memblock_end_of_DRAM();
-#ifndef CONFIG_64BIT
  #ifndef CONFIG_XIP_KERNEL
  	phys_ram_base = memblock_start_of_DRAM();
  #endif
+#ifndef CONFIG_64BIT
  	/*
  	 * memblock allocator is not aware of the fact that last 4K bytes of
  	 * the addressable memory can not be mapped because of IS_ERR_VALUE  

Good catch, you can add:

Quoted 2 lines

Hi Palmer,

I noticed this patch is missing in recent riscv fixes pull.

Thanks

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

maintainer
#3 lore raw
In reply to Jisheng Zhang
Quoted 10 lines · On Thu, 02 Dec 2021 07:36:41 PST (-0800), [email protected] wrote:

Currently, if 64BIT and !XIP_KERNEL, the phys_ram_base is always 0, no matter the real start of dram reported by memblock is. The original patch[1] is correct, I believe it's not corrected merged due to lots of #ifdef in arch/riscv/mm/init.c, I plan to send a clean up series soon.

[1] http://lists.infradead.org/pipermail/linux-riscv/2021-July/007650.html

Fixes 6d7f91d914bc ("riscv: Get rid of CONFIG_PHYS_RAM_BASE in kernel physical address conversion")

Thanks, this is on for-next.

Quoted 10 lines
---
 arch/riscv/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/init.c +0 -0
index 24b2b8044602..3c0649dba4ff 100644
@@ -187,10 +187,10 @@ static void __init setup_bootmem(void)
 

arch/riscv/mm/init.c static void __init setup_bootmem(void) · line 196

Quoted 10 lines
arch/riscv/mm/init.c +1 -1
 
 	phys_ram_end = memblock_end_of_DRAM();
-#ifndef CONFIG_64BIT
 #ifndef CONFIG_XIP_KERNEL
 	phys_ram_base = memblock_start_of_DRAM();
 #endif
+#ifndef CONFIG_64BIT
 	/*
 	 * memblock allocator is not aware of the fact that last 4K bytes of
 	 * the addressable memory can not be mapped because of IS_ERR_VALUE

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv