From patchwork Tue Oct 18 22:25:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giulio Benetti X-Patchwork-Id: 4347 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp13052wrs; Tue, 18 Oct 2022 15:26:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61wyK7QSPo9gOZpHEuTH93zF5HBaPFlH4ChSeplmIiWJJsfvLdUmwHKDjh1BIWSinhf5Zt X-Received: by 2002:a62:e911:0:b0:555:8c06:c9eb with SMTP id j17-20020a62e911000000b005558c06c9ebmr5379213pfh.52.1666131989548; Tue, 18 Oct 2022 15:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666131989; cv=none; d=google.com; s=arc-20160816; b=qSl+PAmYf9i6jv0PxS4OBUehUzpY44y8Q9zLjq7CtSXgGAJfvTDToi0mfwPrDlyxvz Esnfpooh6M+59X4qrfrFxd0l0VoAK41Z5EzS3abguNp7fsp0hD2JaeAYCbr176b4Fn0/ MJZO38wbJWzw74hGXqELDaZsEF6LtnqgoM5xvA1ldBNAbXsSrz3fEjFQ89n/1ejzh2bR YriisnMB74+l+7diq3rN0dEVhg/lzYMavNaCCv9jooTUU9mDHMaoxDz/ek9L9ixVgGfq nlA0qRpJCO4xPNj7nJuELBzY9m/5RIXvJyPz3Gdvxz4CsWRmpQ282Ha9n0lRRUmCyGyt 9/0w== 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:dkim-signature; bh=rfzTFaQ8hOgdfIkAGUipQqaqsSS9dLtPmwD7F/rBJuI=; b=dp31J++cvspLJIlWI0AcxW7Cvn0CB7RSfFka0PaDLah/6G3AxniE+Y08mIeGJcWTUC ON+9B5OxuWeN3FzaZQH2ksfgngEd1eiOBTEH7BYoI0PP2l4jdl0uWNvDukDnb3C/zGkQ PXW9yxBEDn/pAK/puk6JZa6JM/AQBDaVdd/cgmxkLC0KOYaq7ssTesWc0U+6G0FBv+3r xEsLR7LzQmqZ7khHOiG38GD345rlIilNQsCkBqB46MxWVTDHPH2OipuFGuxvlJL3Y3w5 CqDtsZ43IRScRKlHRFb3MFXULoRqP08vTykXJNGWPbtszEHN6Bs09nDTwgw1duSKrXmS IeDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aruba.it header.s=a1 header.b=KWN5bUrb; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pb12-20020a17090b3c0c00b002000867929fsi14487143pjb.183.2022.10.18.15.26.16; Tue, 18 Oct 2022 15:26:29 -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; dkim=pass header.i=@aruba.it header.s=a1 header.b=KWN5bUrb; 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 S229808AbiJRWZV (ORCPT + 99 others); Tue, 18 Oct 2022 18:25:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbiJRWZM (ORCPT ); Tue, 18 Oct 2022 18:25:12 -0400 Received: from smtpcmd0987.aruba.it (smtpcmd0987.aruba.it [62.149.156.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C7E7D42E72 for ; Tue, 18 Oct 2022 15:25:07 -0700 (PDT) Received: from localhost.localdomain ([146.241.87.206]) by Aruba Outgoing Smtp with ESMTPSA id kv1EovliYaWj1kv1EoELA7; Wed, 19 Oct 2022 00:25:07 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aruba.it; s=a1; t=1666131907; bh=ecGKETr6tHYjYHpQVgivf0BPNu10d7Tim6n0Zf2+ae8=; h=From:To:Subject:Date:MIME-Version; b=KWN5bUrbvitA1vzV0g/ooksAWbSRhEteGWEaaNfZEEHepIiJTOltLHJd2aLmSWFf/ XoFgJDEGfA9mGzs7tZ0gReRjcV9sxYGwkMbHix1Lc3h9QuheSfAn/ZSJAlvu9RS1IV jzsg5qyKUg/fThoYyWIgmnC8b1+3oAH/RZR8DFL40jxcXASD9TF7NBWdBY2teOgVb2 8nkIEUuIsumtjGcypPxOCtZz+vHUhG8m6THC0pD+Q40OpXVdzRLdidW2Bq5IV8gsoj TUVsOb8BbMHlOpA2fcCNDWHdxXmQD+gTi2VTeqYprohSGDacFkW5+gxXDwIntqxiDa SlNl2pKycC0Bg== From: Giulio Benetti To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Russell King , Giulio Benetti , Anshuman Khandual , Andrew Morton , Kefeng Wang , Russell King , Arnd Bergmann , Will Deacon Subject: [PATCH v2 1/2] ARM: mm: fix no-MMU ZERO_PAGE() implementation Date: Wed, 19 Oct 2022 00:25:02 +0200 Message-Id: <20221018222503.90118-1-giulio.benetti@benettiengineering.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CMAE-Envelope: MS4xfPZlKIhA9QmVEJg8TyQBw3iOkBHZPOM6fAPP7UVSbA59v5ex4MI480bxgNdmo8uHnNiksDWqvpGUvjzux5YgGrteQPR5O48noLtBaTn1TidfdU+mLXi/ FFtW/XkJQDDRzYNqBcP6279UyKprwgLo3h5hGUB2sfHoYxuhC8MpaLZy9WTMmtwSsSBHv/Wa19QXWDMy9MWX7lGH862VbgubxMzq55a3PtL4HadLBBpjxxPf MzfXXUphB7jB5T7JVxZf9Nl6/ch6X3KpE3T00QtMyr1EJm9ATRYwfOYkkmMhx3Dha4DBBMJlVD7ClieCQKKu5XfjYGeLYjfl0mFtha9uUEM6KtvVaP4d/JZ+ LxiNlwaXaEeQ017keBant8uTh5J4txIvAB/z4TrTLyC18pEZfkAu3ubfDF6iL24AIdyF/LrA8FatnhlM+m6MpMezt0V9n1U0lOAcCBep2+a7US/j/iQZFlBu G1V7fNAJTLTe2e8Cb87lLxqv+3TCOnUYs5NaKR9GsYQ1T7a1ZgR5r7FGMAIA9TyC8LNCvSvzohoUY3KTmTbA5Vvmz7gJYU9dnnhVKhfUrRihsYgNRMgSg6D0 38s= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747066017418649199?= X-GMAIL-MSGID: =?utf-8?q?1747066017418649199?= Actually in no-MMU SoCs(i.e. i.MXRT) ZERO_PAGE(vaddr) expands to ``` virt_to_page(0) ``` that in order expands to: ``` pfn_to_page(virt_to_pfn(0)) ``` and then virt_to_pfn(0) to: ``` #define virt_to_pfn(0) \ ((((unsigned long)(0) - PAGE_OFFSET) >> PAGE_SHIFT) + \ PHYS_PFN_OFFSET) ``` where PAGE_OFFSET and PHYS_PFN_OFFSET are the DRAM offset(0x80000000) and PAGE_SHIFT is 12. This way we obtain 16MB(0x01000000) summed to the base of DRAM(0x80000000). When ZERO_PAGE(0) is then used, for example in bio_add_page(), the page gets an address that is out of DRAM bounds. So instead of using fake virtual page 0 let's allocate a dedicated zero_page during paging_init() and assign it to a global 'struct page * empty_zero_page' the same way mmu.c does and it's the same approach used in m68k with commit dc068f462179 as discussed here[0]. Then let's move ZERO_PAGE() definition to the top of pgtable.h to be in common between mmu.c and nommu.c. [0]: https://lore.kernel.org/linux-m68k/2a462b23-5b8e-bbf4-ec7d-778434a3b9d7@google.com/T/#m1266ceb63ad140743174d6b3070364d3c9a5179b Signed-off-by: Giulio Benetti Reviewed-by: Arnd Bergmann --- V1->V2: * improve commit log as suggested by Arnd Bergmann --- arch/arm/include/asm/pgtable-nommu.h | 6 ------ arch/arm/include/asm/pgtable.h | 16 +++++++++------- arch/arm/mm/nommu.c | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/arch/arm/include/asm/pgtable-nommu.h b/arch/arm/include/asm/pgtable-nommu.h index d16aba48fa0a..090011394477 100644 --- a/arch/arm/include/asm/pgtable-nommu.h +++ b/arch/arm/include/asm/pgtable-nommu.h @@ -44,12 +44,6 @@ typedef pte_t *pte_addr_t; -/* - * ZERO_PAGE is a global shared page that is always zero: used - * for zero-mapped memory areas etc.. - */ -#define ZERO_PAGE(vaddr) (virt_to_page(0)) - /* * Mark the prot value as uncacheable and unbufferable. */ diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index 78a532068fec..ef48a55e9af8 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -10,6 +10,15 @@ #include #include +#ifndef __ASSEMBLY__ +/* + * ZERO_PAGE is a global shared page that is always zero: used + * for zero-mapped memory areas etc.. + */ +extern struct page *empty_zero_page; +#define ZERO_PAGE(vaddr) (empty_zero_page) +#endif + #ifndef CONFIG_MMU #include @@ -139,13 +148,6 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, */ #ifndef __ASSEMBLY__ -/* - * ZERO_PAGE is a global shared page that is always zero: used - * for zero-mapped memory areas etc.. - */ -extern struct page *empty_zero_page; -#define ZERO_PAGE(vaddr) (empty_zero_page) - extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c index c42debaded95..c1494a4dee25 100644 --- a/arch/arm/mm/nommu.c +++ b/arch/arm/mm/nommu.c @@ -26,6 +26,13 @@ unsigned long vectors_base; +/* + * empty_zero_page is a special page that is used for + * zero-initialized data and COW. + */ +struct page *empty_zero_page; +EXPORT_SYMBOL(empty_zero_page); + #ifdef CONFIG_ARM_MPU struct mpu_rgn_info mpu_rgn_info; #endif @@ -148,9 +155,21 @@ void __init adjust_lowmem_bounds(void) */ void __init paging_init(const struct machine_desc *mdesc) { + void *zero_page; + early_trap_init((void *)vectors_base); mpu_setup(); + + /* allocate the zero page. */ + zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE); + if (!zero_page) + panic("%s: Failed to allocate %lu bytes align=0x%lx\n", + __func__, PAGE_SIZE, PAGE_SIZE); + bootmem_init(); + + empty_zero_page = virt_to_page(zero_page); + flush_dcache_page(empty_zero_page); } /* From patchwork Tue Oct 18 22:25:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giulio Benetti X-Patchwork-Id: 4348 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp13430wrs; Tue, 18 Oct 2022 15:27:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM44ZVhNLJZDFRgHH50Zr/DA6EzOY8y/hdOGLD5zHO51XvgX3XySydTmtMoxGoaeZYvx5Sba X-Received: by 2002:a17:906:ee81:b0:77e:829a:76e9 with SMTP id wt1-20020a170906ee8100b0077e829a76e9mr4455289ejb.207.1666132061340; Tue, 18 Oct 2022 15:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666132061; cv=none; d=google.com; s=arc-20160816; b=CY9ofkGNuOiEn5SEjTnUW1VppR+E55spPpwgmKDtk5rfPd8UE/GbqHvEjQI5K/KeS9 5y36fjrLIoTUys9i2p24UR1MoxdNlRqKvk2rirFHTCvZg4q4qd0vN20ikRMfSYjzJ9nC y90FrJw1GxOn2/X0iNoOIAKL6JSTFby2Kg/WgtXIBc4IG8cd3TblsOcKeuU0pIkWq7Lz 9VJ3K2hogtofRAndF47cJYB43NR7ceMLHI/OhUG8RSUI3sFOhPnTTjqEhonz99cZRWam qNJCb1Rtulfly2o0w3ro0vv5di9kXpQ1O04oi8LT+pLqxBdgF1BWo2lVZu5+VXwO+uls Pd7Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YYCYL+xhswx1j5PQYBQO66vrNS6Fdt5zXqgAgZhDftk=; b=jxYO+H4jf68nrtLt6CcEnT7hGJOACNuwSnY84uQogMIkEFrcUDJxi5BYO381wKNMa7 Wh571/2zY4IpCH9FIsPBuEnTeLV9vL9uIsr4vTg2WT5F3OR90c/jD+7IUxnlSwwoIUa4 kb7Fgu+Xu+fuKOKZzF6cdcKc+DT6liYPZ3LKfa7TSpwXtsiwMW9Z6wpVKXxJbfiL5DAL SfBI0UU6iEQKs20ASB9+a0hZ5I2ilfopT9qz/R4dESU2aPMe3z/Epd90izBHKHRfMfAu QblUIU4yqp4Vyhc1p9OvL6L9RGkz0oDGGdco8Z5p3AbKsniX3lRyOraLGyYdgoaptlqy Ebcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aruba.it header.s=a1 header.b=Ud6pBCkO; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b14-20020a17090630ce00b00782da4ff18dsi11318338ejb.668.2022.10.18.15.27.06; Tue, 18 Oct 2022 15:27:41 -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; dkim=pass header.i=@aruba.it header.s=a1 header.b=Ud6pBCkO; 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 S229929AbiJRWZZ (ORCPT + 99 others); Tue, 18 Oct 2022 18:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbiJRWZM (ORCPT ); Tue, 18 Oct 2022 18:25:12 -0400 Received: from smtpcmd0987.aruba.it (smtpcmd0987.aruba.it [62.149.156.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 605F84AD4F for ; Tue, 18 Oct 2022 15:25:08 -0700 (PDT) Received: from localhost.localdomain ([146.241.87.206]) by Aruba Outgoing Smtp with ESMTPSA id kv1EovliYaWj1kv1HoELBg; Wed, 19 Oct 2022 00:25:07 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aruba.it; s=a1; t=1666131907; bh=G21UWZTIRbOHhkWY/cfvy0aqZyPYcJqojzWjie6A3oY=; h=From:To:Subject:Date:MIME-Version; b=Ud6pBCkOhW9bvos1H1dj4qs8CCcCVVIt69Nxys7taT6ylik0WXRGxKFSJxG8sYeUf JbJMIBUYCt1jkpq3lcR57QYVfTl5gTurPUNuelLPh6ymK5jj35Mb9d3JMLGZn55sOY 3XwP95JCvof1pl5GjeXqt204+FvRC3Xwre65boVIoMMF2NnWbTdwjnbwDd7HejtON4 bXM0GF57lBL3PIjwRtKUIqJRu9u8SUQ/R3McRIvSt/tLNAROw3TIS3g4W0+H7hFz0f E8GGWftaxRtwmbrGvtPZeCYvhUfjaz7EBNJdswcgwuMxmjYPQ3k8N49qdL4J8JdMnq YcYCx1oBvw2KA== From: Giulio Benetti To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Russell King , Giulio Benetti , Anshuman Khandual , Andrew Morton , Kefeng Wang , Russell King , Arnd Bergmann , Will Deacon Subject: [PATCH v2 2/2] ARM: mm: convert empty_zero_page to array for consistency Date: Wed, 19 Oct 2022 00:25:03 +0200 Message-Id: <20221018222503.90118-2-giulio.benetti@benettiengineering.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221018222503.90118-1-giulio.benetti@benettiengineering.com> References: <20221018222503.90118-1-giulio.benetti@benettiengineering.com> MIME-Version: 1.0 X-CMAE-Envelope: MS4xfPZlKIhA9QmVEJg8TyQBw3iOkBHZPOM6fAPP7UVSbA59v5ex4MI480bxgNdmo8uHnNiksDWqvpGUvjzux5YgGrteQPR5O48noLtBaTn1TidfdU+mLXi/ FFtW/XkJQDDRzYNqBcP6279UyKprwgLo3h5hGUB2sfHoYxuhC8MpaLZy9WTMmtwSsSBHv/Wa19QXWDMy9MWX7lGH862VbgubxMzq55a3PtL4HadLBBpjxxPf MzfXXUphB7jB5T7JVxZf9Nl6/ch6X3KpE3T00QtMyr1EJm9ATRYwfOYkkmMhx3Dha4DBBMJlVD7ClieCQKKu5XfjYGeLYjfl0mFtha9uUEM6KtvVaP4d/JZ+ LxiNlwaXaEeQ017keBant8uTh5J4txIvAB/z4TrTLyC18pEZfkAu3ubfDF6iL24AIdyF/LrA8FatnhlM+m6MpMezt0V9n1U0lOAcCBep2+a7US/j/iQZFlBu G1V7fNAJTLTe2e8Cb87lLxqv+3TCOnUYs5NaKR9GsYQ1T7a1ZgR5r7FGMAIA9TyC8LNCvSvzohoUY3KTmTbA5Vvmz7gJYU9dnnhVKhfUrRihsYgNRMgSg6D0 38s= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747066092218217101?= X-GMAIL-MSGID: =?utf-8?q?1747066092218217101?= ARM architecture is the only one to have empty_zero_page to be a struct page pointer, while in all other implementations empty_zero_page is a data pointer or directly an array(the zero page itself). So let's convert empty_zero_page to an array for consistency and to avoid an early allocation+dcache flush. Being the array in .bss it will be cleared earlier in a more linear way(and a bit faster) way. Suggested-by: Arnd Bergmann Signed-off-by: Giulio Benetti --- V1->V2: * create patch suggested by Arnd Bergmann --- arch/arm/include/asm/pgtable.h | 4 ++-- arch/arm/mm/mmu.c | 10 +--------- arch/arm/mm/nommu.c | 14 +------------- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index ef48a55e9af8..de402b345f55 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -15,8 +15,8 @@ * ZERO_PAGE is a global shared page that is always zero: used * for zero-mapped memory areas etc.. */ -extern struct page *empty_zero_page; -#define ZERO_PAGE(vaddr) (empty_zero_page) +extern unsigned long empty_zero_page[]; +#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) #endif #ifndef CONFIG_MMU diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 463fc2a8448f..f05a5471a45a 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -45,7 +45,7 @@ extern unsigned long __atags_pointer; * empty_zero_page is a special page that is used for * zero-initialized data and COW. */ -struct page *empty_zero_page; +unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)] __page_aligned_bss; EXPORT_SYMBOL(empty_zero_page); /* @@ -1760,8 +1760,6 @@ static void __init early_fixmap_shutdown(void) */ void __init paging_init(const struct machine_desc *mdesc) { - void *zero_page; - pr_debug("physical kernel sections: 0x%08llx-0x%08llx\n", kernel_sec_start, kernel_sec_end); @@ -1782,13 +1780,7 @@ void __init paging_init(const struct machine_desc *mdesc) top_pmd = pmd_off_k(0xffff0000); - /* allocate the zero page. */ - zero_page = early_alloc(PAGE_SIZE); - bootmem_init(); - - empty_zero_page = virt_to_page(zero_page); - __flush_dcache_page(NULL, empty_zero_page); } void __init early_mm_init(const struct machine_desc *mdesc) diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c index c1494a4dee25..e0c3f59d1c5a 100644 --- a/arch/arm/mm/nommu.c +++ b/arch/arm/mm/nommu.c @@ -30,7 +30,7 @@ unsigned long vectors_base; * empty_zero_page is a special page that is used for * zero-initialized data and COW. */ -struct page *empty_zero_page; +unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)] __page_aligned_bss; EXPORT_SYMBOL(empty_zero_page); #ifdef CONFIG_ARM_MPU @@ -155,21 +155,9 @@ void __init adjust_lowmem_bounds(void) */ void __init paging_init(const struct machine_desc *mdesc) { - void *zero_page; - early_trap_init((void *)vectors_base); mpu_setup(); - - /* allocate the zero page. */ - zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE); - if (!zero_page) - panic("%s: Failed to allocate %lu bytes align=0x%lx\n", - __func__, PAGE_SIZE, PAGE_SIZE); - bootmem_init(); - - empty_zero_page = virt_to_page(zero_page); - flush_dcache_page(empty_zero_page); } /*