public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Victor Hassan <victor@allwinnertech.com>
To: linux@armlinux.org.uk, rmk+kernel@armlinux.org.uk,
	linus.walleij@linaro.org, yanfei.xu@windriver.com,
	ardb@kernel.org, tglx@linutronix.de, mirq-linux@rere.qmqm.pl,
	arnd@arndb.de
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	allwinner-opensource-support@allwinnertech.com,
	Victor Hassan <victor@allwinnertech.com>
Subject: [PATCH] ARM: mmu: fix access to illegal address when using earlycon & memblock=debug
Date: Wed, 16 Mar 2022 10:33:56 +0800	[thread overview]
Message-ID: <20220316023356.120595-1-victor@allwinnertech.com> (raw)

earlycon uses fixmap to create a memory map,
So we need to close earlycon before closing fixmap,
otherwise printk will access illegal addresses.
After creating a new memory map, we open earlycon again.

Signed-off-by: Victor Hassan <victor@allwinnertech.com>
---
 arch/arm/mm/mmu.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 274e4f73fd33..f3511f07a7d0 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -14,6 +14,7 @@
 #include <linux/fs.h>
 #include <linux/vmalloc.h>
 #include <linux/sizes.h>
+#include <linux/console.h>
 
 #include <asm/cp15.h>
 #include <asm/cputype.h>
@@ -1695,6 +1696,9 @@ static void __init early_fixmap_shutdown(void)
 	pmd_clear(fixmap_pmd(va));
 	local_flush_tlb_kernel_page(va);
 
+#ifdef CONFIG_FIX_EARLYCON_MEM
+	console_stop(console_drivers);
+#endif
 	for (i = 0; i < __end_of_permanent_fixed_addresses; i++) {
 		pte_t *pte;
 		struct map_desc map;
@@ -1713,6 +1717,9 @@ static void __init early_fixmap_shutdown(void)
 
 		create_mapping(&map);
 	}
+#ifdef CONFIG_FIX_EARLYCON_MEM
+	console_start(console_drivers);
+#endif
 }
 
 /*
-- 
2.29.0


             reply	other threads:[~2022-03-16  2:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20220831115257eucas1p20d37a01c51e42767860920a936255bd7@eucas1p2.samsung.com>
2022-03-16  2:33 ` Victor Hassan [this message]
2022-04-17 23:21   ` [PATCH] ARM: mmu: fix access to illegal address when using earlycon & memblock=debug Linus Walleij
2022-04-18 15:08     ` Victor Hassan
2022-06-17 13:30       ` Victor Hassan
2022-06-28  8:34         ` Linus Walleij
2022-08-31 11:52   ` Marek Szyprowski
2022-08-31 12:37     ` Victor Hassan
2022-09-01 12:53       ` Victor Hassan
2022-09-01 13:21         ` Rob Herring
2022-09-01 13:49           ` Rob Herring
2022-09-03  8:54           ` Victor Hassan
2022-08-31 13:51     ` Russell King (Oracle)

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=20220316023356.120595-1-victor@allwinnertech.com \
    --to=victor@allwinnertech.com \
    --cc=allwinner-opensource-support@allwinnertech.com \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=tglx@linutronix.de \
    --cc=yanfei.xu@windriver.com \
    /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