linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: fix memory reservation for non-usermem setups
@ 2021-03-07 19:40 Ilya Lipnitskiy
  2021-03-12 15:19 ` Thomas Bogendoerfer
  2021-04-04  2:11 ` [PATCH] MIPS: ralink: rt288x: select MIPS_AUTO_PFN_OFFSET Ilya Lipnitskiy
  0 siblings, 2 replies; 11+ messages in thread
From: Ilya Lipnitskiy @ 2021-03-07 19:40 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Tiezhu Yang, Jinyang He, Mike Rapoport,
	Youling Tang
  Cc: Tobias Wolf, Ilya Lipnitskiy, Marcin Nowakowski, linux-mips,
	linux-kernel, stable

From: Tobias Wolf <dev-NTEO@vplace.de>

Commit 67a3ba25aa95 ("MIPS: Fix incorrect mem=X@Y handling") introduced a new
issue for rt288x where "PHYS_OFFSET" is 0x0 but the calculated "ramstart" is
not. As the prerequisite of custom memory map has been removed, this results
in the full memory range of 0x0 - 0x8000000 to be marked as reserved for this
platform.

This patch adds the originally intended prerequisite again.

This patch has been present in OpenWrt tree for over 2 years:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=93bfafb8dc209f153022796d9e747149e66cc29e

Fixes: 67a3ba25aa95 ("MIPS: Fix incorrect mem=X@Y handling")
Signed-off-by: Tobias Wolf <dev-NTEO@vplace.de>
[Reword commit message]
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Cc: Marcin Nowakowski <marcin.nowakowski@mips.com>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
---
 arch/mips/kernel/setup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 279be0153f8b..97e3a0db651b 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -251,6 +251,8 @@ static unsigned long __init init_initrd(void)
  * Initialize the bootmem allocator. It also setup initrd related data
  * if needed.
  */
+static int usermem __initdata;
+
 #if defined(CONFIG_SGI_IP27) || (defined(CONFIG_CPU_LOONGSON64) && defined(CONFIG_NUMA))
 
 static void __init bootmem_init(void)
@@ -290,7 +292,7 @@ static void __init bootmem_init(void)
 	/*
 	 * Reserve any memory between the start of RAM and PHYS_OFFSET
 	 */
-	if (ramstart > PHYS_OFFSET)
+	if (usermem && ramstart > PHYS_OFFSET)
 		memblock_reserve(PHYS_OFFSET, ramstart - PHYS_OFFSET);
 
 	if (PFN_UP(ramstart) > ARCH_PFN_OFFSET) {
@@ -338,8 +340,6 @@ static void __init bootmem_init(void)
 
 #endif	/* CONFIG_SGI_IP27 */
 
-static int usermem __initdata;
-
 static int __init early_parse_mem(char *p)
 {
 	phys_addr_t start, size;
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-04-14 13:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-07 19:40 [PATCH] MIPS: fix memory reservation for non-usermem setups Ilya Lipnitskiy
2021-03-12 15:19 ` Thomas Bogendoerfer
2021-03-17  5:10   ` Ilya Lipnitskiy
2021-03-17  6:33     ` Mike Rapoport
2021-04-04  2:02       ` Ilya Lipnitskiy
2021-04-06 13:10         ` Thomas Bogendoerfer
2021-04-13  6:45           ` Ilya Lipnitskiy
2021-04-13  6:52             ` Ilya Lipnitskiy
2021-04-14 13:46             ` Mike Rapoport
2021-04-04  2:11 ` [PATCH] MIPS: ralink: rt288x: select MIPS_AUTO_PFN_OFFSET Ilya Lipnitskiy
2021-04-06 13:11   ` Thomas Bogendoerfer

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).