Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp1427592rwl; Fri, 4 Nov 2022 13:56:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5PJPx1TcU3TDCtNdLls4ThYeL3BUsLZZ8EXq4VQ7nHoYyWkZDY9DJonzfBMGBDcDCT2uDR X-Received: by 2002:a17:90b:38c:b0:212:fe14:4ba0 with SMTP id ga12-20020a17090b038c00b00212fe144ba0mr56070910pjb.138.1667595392885; Fri, 04 Nov 2022 13:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667595392; cv=none; d=google.com; s=arc-20160816; b=Iw7vf/Goahd0o/Xy3xHeHpf8IEvS23wYBrj/ujgNO4PT3XTXGskxUeSa++78G6ZxwP 9OXx16EqkRStRBeioQ4voVSJJMvzF8wfHBRIRuQW/NWjeBO2ZLT1fMgAOJHRC+doru1J 2FmbelyGk3Gu2PJnNn/kVHTTH3ruXCG1RVyQIr91BcXJk9J3zKuvSleBALDgbZ9GYR/X Ot66ZgdP/12CvaW7q8czOMVCce7N5H1MqS5uaWV4HE3TmSuUNdBdZXG1khq5wULpt95t y5bleinYGhAF2b8FKveE1boUQp12tsoekS19grNoyLK+5MfYPHnFGWCI9HaEJh8So3bi Zd5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=/ntc2/D9mT7L0/DAoc2JoKaev1YiM8U6WZGz5MRuYtg=; b=qO/IDWwpTl/O5OcASuOl72zJAOkENGd5FO+uCqj7LHNxlusLK2I+ImZrj8nEMRMdaa ZjD8g3iqBGdJxMb/WJV5TDqDFzCpJxI6spkxnX37zEFOezf8wgXwisMwpbrLhzQ2icrN IYmPy8653RVdgsvTBWf3z/z9fF5gjXuux41lsDrf6AUL4OXyOWkME4iB0IdgAEG6d4pu 5jg0HzToT8VxRZMXYqHlaDOBwv3lfpLvAftOwgRdicK435nC6T2xJA/JCPBE+QESjfaG KOdJfQ6PYo2caBl0u/UrDaYqqI8VAkh/ZDgFSwHwQxlzYwwQKZChbJlTx25eis107jvL +fGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=DzQtORUG; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=mfH+gcgK; 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 v5-20020a170902b7c500b001868a25da0dsi502008plz.40.2022.11.04.13.56.20; Fri, 04 Nov 2022 13:56:32 -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=@arndb.de header.s=fm3 header.b=DzQtORUG; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=mfH+gcgK; 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 S230003AbiKDUQu (ORCPT + 97 others); Fri, 4 Nov 2022 16:16:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229926AbiKDUQm (ORCPT ); Fri, 4 Nov 2022 16:16:42 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D83E45EF1 for ; Fri, 4 Nov 2022 13:16:39 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id C4C78320090B; Fri, 4 Nov 2022 16:16:36 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 16:16:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1667592996; x=1667679396; bh=/ntc2/D9mT 7L0/DAoc2JoKaev1YiM8U6WZGz5MRuYtg=; b=DzQtORUGtQknQZyEk1Y4fbKGyE t5cjp7vjvCno5MZRnXnUOAyolM8e3XR/Zpl/BFCK0Ffirg1/JulBHsUkvCiy7q7T EGejNCiROLdTNs4NIvQdfX5A5Z4gWEgQWD89wJxZgqZrtCq3a4CC4Qh1VuViAZe7 AEl9VMiswe4sMzRFvhljZtGH4LWrJTCUikuWBDR4skb61V+9TXPh5f4w76BEu+AR CukgAdvc25zXcjqwlQ4O63vLLxWuXGGefqX0YuHaKk7EUzYn7yVJnHxR1RFK1avN DEk2WplzM59wcymj3vb0mzJr+ww72Ze4g4K8nXwmnEx0PIXKAzRLJQo0rmEQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1667592996; x=1667679396; bh=/ntc2/D9mT7L0/DAoc2JoKaev1Yi M8U6WZGz5MRuYtg=; b=mfH+gcgK4+Tob++4rzl5oZNIQF14Xj/8TisWrwqZjLTP B5PsCxl8sfcPUx+/Wtm4mJiX5QSk70XBkWE4SNKCx1IB9C3pNlkoT5j8eequFsH5 GiK0UArW/DbPc6YvYwdrjU5fknboE+NzeGZzz6koamtLC4F+cM8w1/glsQ+NIWgY vS4kAAavWavooKcZQqbi6oIFgfuIVi+WUERtIUWlUEnUPXe5OT5sMQBFsRCG19om qNUQF4wkc2kKglTAKzmNbZclQgvPXYAJUpAn7ipvTLfvgSFZt/JKZY4ZMKt+UL4I /J2tGqs5CE7pxINXEK3idpcyVyhImH04lQgniChqRw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugddufedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepvefhffeltdegheeffffhtdegvdehjedtgfekueevgfduffettedtkeekueef hedunecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id ADECCB603ED; Fri, 4 Nov 2022 16:16:35 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1087-g968661d8e1-fm-20221021.001-g968661d8 Mime-Version: 1.0 Message-Id: In-Reply-To: <20221018222503.90118-1-giulio.benetti@benettiengineering.com> References: <20221018222503.90118-1-giulio.benetti@benettiengineering.com> Date: Fri, 04 Nov 2022 21:16:19 +0100 From: "Arnd Bergmann" To: "Giulio Benetti" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: "Russell King" , "Anshuman Khandual" , "Andrew Morton" , "Kefeng Wang" , "Russell King" , "Will Deacon" Subject: Re: [PATCH v2 1/2] ARM: mm: fix no-MMU ZERO_PAGE() implementation Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 On Wed, Oct 19, 2022, at 00:25, Giulio Benetti wrote: > 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