mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Tiezhu Yang <yangtiezhu@loongson.cn>,
	Jinyang He <hejinyang@loongson.cn>,
	Mike Rapoport <rppt@kernel.org>,
	Youling Tang <tangyouling@loongson.cn>
Cc: Tobias Wolf <dev-NTEO@vplace.de>,
	Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>,
	Marcin Nowakowski <marcin.nowakowski@mips.com>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: [PATCH] MIPS: fix memory reservation for non-usermem setups
Date: Sun,  7 Mar 2021 11:40:30 -0800	[thread overview]
Message-ID: <20210307194030.8007-1-ilya.lipnitskiy@gmail.com> (raw)

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


             reply	other threads:[~2021-03-07 19:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07 19:40 Ilya Lipnitskiy [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210307194030.8007-1-ilya.lipnitskiy@gmail.com \
    --to=ilya.lipnitskiy@gmail.com \
    --cc=dev-NTEO@vplace.de \
    --cc=hejinyang@loongson.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=marcin.nowakowski@mips.com \
    --cc=rppt@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tangyouling@loongson.cn \
    --cc=tsbogend@alpha.franken.de \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®