Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp183039pxb; Tue, 29 Mar 2022 02:16:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIpz0Nqy+OppdxyBLrewsJQgBI+ump/D/zfD3QtJ06fcmEj/fm6FSvzEycomeR8zpE88SE X-Received: by 2002:a17:906:9c82:b0:6df:baa2:9f75 with SMTP id fj2-20020a1709069c8200b006dfbaa29f75mr32592284ejc.762.1648545379196; Tue, 29 Mar 2022 02:16:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648545379; cv=none; d=google.com; s=arc-20160816; b=ofYXagDpVy3nYHfLbP5lcldBIRamArQnzoqzPxUFoOkjLjaW7sMw2dTCu1l30gRyzr TbAXuOxGvBxLbzQwezsKH9DuAAacgeT6J59r6JQG/EXr6BWc0BNIehpm8uuJZXUusDwJ JtG20tZ+9HJTs92Nd5d2QFRFEulp6iP5HxQ1fAeXS/fztRvNG4BC5gAVD7znrVUm4U2N 2Dm0a8o8mILjKYwUcOhZTMQ+0Sv47/x7DCr7Eu1ZUlu/SeH/DzgS5NSC/L7LHaRzmVL1 5XnUsheGqEAx0B8RYA8f9ebTerJSY9MLpL3L1m7ObQ+3ZWZTGoBby47XaAebXdAaQW8B d72Q== 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=5dyNIqhaZZImWLsS6Q17qyxAwLsAs3PiWC9LDaF9Tfo=; b=MAfskhTzOztVMH7uxPYZ6O15uA45ym+VuqXdq/xWRNvey1kiLso6TrfDrKwFP0IWMy DiToSC/DyY0YPZTPRa6QYJ7qC51ip08N8FlHpylFKXHcT8gW5sTJkYBD8gviCJgu/AFa 0PfOiYKDBZcYdsBGurGm5x/IqO3yPu5USbvhIFl3orlel1iJQW4ngoMudguUY8XT0Ayd 9Nn1Ti+EnX0ParCmJ9oWNxHY3NIuY6fJ1RZDX7la3w0NLU+fdZxi80FwSfVWHjozNmN2 0xq9/BHcMxJSH2sYXN3DkYQBRcqEWv2qfAJAWn0WMez5sHLQwOd3RRA9cNcEUWHdXY5S Sd1g== 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:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay19-20020a170906d29300b006df76385dfbsi16820878ejb.667.2022.03.29.02.15.52; Tue, 29 Mar 2022 02:16:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233382AbiC2H3k (ORCPT + 99 others); Tue, 29 Mar 2022 03:29:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbiC2H3j (ORCPT ); Tue, 29 Mar 2022 03:29:39 -0400 Received: from out29-77.mail.aliyun.com (out29-77.mail.aliyun.com [115.124.29.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0153724783F for ; Tue, 29 Mar 2022 00:27:56 -0700 (PDT) X-Alimail-AntiSpam: AC=CONTINUE;BC=0.18044|-1;BR=01201311R171S78rulernew998_84748_2000303;CH=blue;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.0509118-0.00316166-0.945926;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047190;MF=victor@allwinnertech.com;NM=1;PH=DS;RN=12;RT=12;SR=0;TI=SMTPD_---.NFCJAsm_1648538872; Received: from sunxibot.allwinnertech.com(mailfrom:victor@allwinnertech.com fp:SMTPD_---.NFCJAsm_1648538872) by smtp.aliyun-inc.com(33.13.255.226); Tue, 29 Mar 2022 15:27:54 +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, weidonghui@allwinnertech.com, rdunlap@infradead.org, arnd@arndb.de, mirq-linux@rere.qmqm.pl Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, allwinner-opensource-support@allwinnertech.com Subject: [RESEND] ARM: mmu: fix access to illegal address when using earlycon & memblock=debug Date: Tue, 29 Mar 2022 15:27:57 +0800 Message-Id: <20220329072757.64092-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,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham 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 5e2be37a198e..9b8baa222034 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -1697,6 +1698,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; @@ -1715,6 +1719,9 @@ static void __init early_fixmap_shutdown(void) create_mapping(&map); } +#ifdef CONFIG_FIX_EARLYCON_MEM + console_start(console_drivers); +#endif } /* -- 2.29.0