From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2252CC636CD for ; Mon, 19 Jul 2021 06:59:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6C80A61186 for ; Mon, 19 Jul 2021 06:59:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C80A61186 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A6B8F8D00F5; Mon, 19 Jul 2021 02:59:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A1BAF8D00EC; Mon, 19 Jul 2021 02:59:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8BC368D00F5; Mon, 19 Jul 2021 02:59:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0185.hostedemail.com [216.40.44.185]) by kanga.kvack.org (Postfix) with ESMTP id 6A7C78D00EC for ; Mon, 19 Jul 2021 02:59:17 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0CAEC23E6B for ; Mon, 19 Jul 2021 06:59:16 +0000 (UTC) X-FDA: 78378435912.01.A82B80E Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com [209.85.217.42]) by imf07.hostedemail.com (Postfix) with ESMTP id ACAB4100A7C3 for ; Mon, 19 Jul 2021 06:59:15 +0000 (UTC) Received: by mail-vs1-f42.google.com with SMTP id e9so8781430vsk.13 for ; Sun, 18 Jul 2021 23:59:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5NCNcBqTO22l3X4al8acu9AJJxnhiYKAu5aMxQckPxk=; b=MqFGTzrNsxiCxS0M+h71bR6uAGcUAiI5t5stb3bq2bKYnrlVA4/VLEugiAo647Grex YqSEEu8TEsGdcMn1s06y/4iTIpN7RB5mTtEpAkHUg+IeFDUDG5PX5p6v6eSZfnCfEyvm YuycZ98z8TeMVlXR1yur3LrLgAm3qpq/t96CqP8f7EYG0EwTRHEqP0UwDoppPDBEJU5k J9IebbUMuN9Jjj9eWijnp6PzSDVGKuFH2jJzZBo6uFsOAhdgR7l0l6/v/GKu/1DrKpI5 /Z/TMzldire7dhzbKY0bOtO5gQVUDrqgIs4ivSQTnbe7Qg+dRSQaC2dlSXYAUxUFWIq8 Xqgw== X-Gm-Message-State: AOAM533Jd67eMPMP1ltN77fNKKgqQLyFE0Oi89E4HKBJU19C7raZBC/n dTgiVyOjkEiY5PzdnVIlA5CsGCJaETIlgLZYedQ= X-Google-Smtp-Source: ABdhPJy9IdyG2rKF5NzGOGN5xKqJm9bCibQ2pE0G8Vx99QZGQQJXSZ4tsUqw9Paisv+zNMq8pJZfaQ8xGb9dpSkzbrs= X-Received: by 2002:a67:1542:: with SMTP id 63mr23590649vsv.40.1626677954982; Sun, 18 Jul 2021 23:59:14 -0700 (PDT) MIME-Version: 1.0 References: <04c4d231fb03a3810d72a45c8a5bc2272c5975f3.1626266516.git.geert+renesas@glider.be> <20210714135101.GB2441138@robh.at.kernel.org> In-Reply-To: From: Geert Uytterhoeven Date: Mon, 19 Jul 2021 08:59:03 +0200 Message-ID: Subject: Re: [PATCH v4 02/10] memblock: Add variables for usable memory limitation To: Mike Rapoport Cc: Rob Herring , Russell King , Nicolas Pitre , Ard Biesheuvel , Linus Walleij , Catalin Marinas , Will Deacon , Nick Kossifidis , Paul Walmsley , Palmer Dabbelt , Albert Ou , Frank Rowand , Dave Young , Baoquan He , Vivek Goyal , Andrew Morton , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux ARM , linux-riscv , kexec@lists.infradead.org, Linux MM , Linux-Renesas , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf07.hostedemail.com: domain of geertuytterhoeven@gmail.com designates 209.85.217.42 as permitted sender) smtp.mailfrom=geertuytterhoeven@gmail.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: ACAB4100A7C3 X-Stat-Signature: 3pa8q1g7p68144hx6ge535os9mp3axwo X-HE-Tag: 1626677955-665083 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Mike, On Sun, Jul 18, 2021 at 11:31 AM Mike Rapoport wrote: > On Wed, Jul 14, 2021 at 07:51:01AM -0600, Rob Herring wrote: > > On Wed, Jul 14, 2021 at 02:50:12PM +0200, Geert Uytterhoeven wrote: > > > Add two global variables (cap_mem_addr and cap_mem_size) for storing a > > > base address and size, describing a limited region in which memory may > > > be considered available for use by the kernel. If enabled, memory > > > outside of this range is not available for use. > > > > > > These variables can by filled by firmware-specific code, and used in > > > calls to memblock_cap_memory_range() by architecture-specific code. > > > An example user is the parser of the "linux,usable-memory-range" > > > property in the DT "/chosen" node. > > > > > > Signed-off-by: Geert Uytterhoeven > > > --- > > > This is similar to how the initial ramdisk (phys_initrd_{start,size}) > > > and ELF core headers (elfcorehdr_{addr,size})) are handled. > > > > > > Does there exist a suitable place in the common memblock code to call > > > "memblock_cap_memory_range(cap_mem_addr, cap_mem_size)", or does this > > > have to be done in architecture-specific code? > > > > Can't you just call it from early_init_dt_scan_usablemem? If the > > property is present, you want to call it. If the property is not > > present, nothing happens. I will have a look... > For memblock_cap_memory_range() to work properly it should be called after > memory is detected and added to memblock with memblock_add[_node]() > > I'm not huge fan of adding more globals to memblock so if such ordering can > be implemented on the DT side it would be great. Me neither ;-) > I don't see a way to actually enforce this ordering, so maybe we'd want to > add warning in memblock_cap_memory_range() if memblock.memory is empty. "linux,usable-memory-range" is optional, and typically used only in crashdump kernels, so it would be a bad idea to add such a warning. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds