Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp956786pxp; Wed, 16 Mar 2022 22:35:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPY5ET/aIzwCIFzwqQvhhkHuaG7LOjqDhQF4UWq4hhkHdAoIIBEY0eGlfDtel5oKeZH62v X-Received: by 2002:a63:ec43:0:b0:382:11ef:b94a with SMTP id r3-20020a63ec43000000b0038211efb94amr94799pgj.409.1647495353261; Wed, 16 Mar 2022 22:35:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647495353; cv=none; d=google.com; s=arc-20160816; b=tqjFbTV42wVt6auOd0+lB/6osQwlvst/B9fNMHoUelDFM3p27gTzElu9IOq9qca3IS JvpXJCdONr6ZcBRq/GtkKPRRXgUJ5t/VO6X69LIBv1T3hcwYA2bWl46uxTOMfOcp9A75 QKz3yuyxCrVIrMuAX0dcDI5q92BTmkV3J6pCpVHeaPFsWiUevodIHL0V3jgV14tn6ITt YuI1gPPY1wifkSfEGy57a8Xw6e83wrNgPNQqnuhHpUL9ehnoLkVsPWfFtv6rKo8vg7D3 5BUHrv2HDGRzHzPX8smRTRNUgBIntwVD3X5KhQhDYiOPwOUNdtsVR8As1b7C2d4W/Uji hNeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=mBCtWGXriTpi+7U/G5V9txxcpIQuRzv2nJ+lrYXc9zs=; b=NG+mvmd4EwdMVGeb4awvTWcU8JIDWO2Fpdj+QViY1Ls5ypOpMcP7eUnI/fKT2k1rlI 4aXv3j/wDV9qhEvnGgItiyXGdqzn95oD/sN9UguyhT8NkerumzyaoMLwHhlDIwFDXzuN UDgUxxdy6u+W208j0SA9qPlb6ek3JU1sgpBkssnSqJnXzhw9mGX3X4HYQKlCCDL8VHk3 2C/SaSKHue9+FOSrjVMMwNfhgRCvUEsfTL/QEL/KIyjtv0j1Cre4U/kYRM8GiPWQ4u3z QJT1Vd06JhYqB+cQZQowlLe2GHG/v9m97o0fUO0LRC2up6umtCN0ogIlw17XcMc+04wm xX2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k11-20020a170902ce0b00b0015181e7ef98si3987525plg.69.2022.03.16.22.35.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 22:35:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EEEB31427CE; Wed, 16 Mar 2022 21:38:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346753AbiCPCfQ (ORCPT + 99 others); Tue, 15 Mar 2022 22:35:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343497AbiCPCfO (ORCPT ); Tue, 15 Mar 2022 22:35:14 -0400 Received: from out29-195.mail.aliyun.com (out29-195.mail.aliyun.com [115.124.29.195]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15D5AF2C for ; Tue, 15 Mar 2022 19:33:59 -0700 (PDT) X-Alimail-AntiSpam: AC=CONTINUE;BC=0.2041822|-1;BR=01201311R111S35rulernew998_84748_2000303;CH=blue;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.0423659-0.00231199-0.955322;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047193;MF=victor@allwinnertech.com;NM=1;PH=DS;RN=12;RT=12;SR=0;TI=SMTPD_---.N5VpE7V_1647398035; Received: from sunxibot.allwinnertech.com(mailfrom:victor@allwinnertech.com fp:SMTPD_---.N5VpE7V_1647398035) by smtp.aliyun-inc.com(33.37.2.29); Wed, 16 Mar 2022 10:33:56 +0800 From: Victor Hassan 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 Subject: [PATCH] ARM: mmu: fix access to illegal address when using earlycon & memblock=debug Date: Wed, 16 Mar 2022 10:33:56 +0800 Message-Id: <20220316023356.120595-1-victor@allwinnertech.com> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 #include #include +#include #include #include @@ -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