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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 770CEC3DA64 for ; Thu, 1 Aug 2024 07:54:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HjAkVSjLQjGGaIZkM43J45/C4EZEazVzONnSs4Jflak=; b=MqzQcK4hdGjuXrlYHSVtVSKMoW Ozso7e6a4tHixCpmH5A2+y6ZKishiXzqsBzv36+/VddCl7Gq4xJGKC2/H66Xx/GPlLx3ZoC9oTTL1 0KC++AKvIXLPnQ3q8qjtGDL1cKW9voWgtv7uaAMai4T9207txVwlV410I/P6JIT3jhGVbfWyg3U33 7Hav78LwVtNovseECCu2l9GEQmosIEA+IRAwRqtyL8Hh+vq6Koj6QR2vblgz9MPGuayvCGVHP6iG2 ypi/uJ/Y7d9oiyWUDutbTktZ6B2UWG2Ol4iz01jmNbdvlBaJtWf83hyVY8Bbw0tcysUoI5qvzYZ2n 3w2y3v1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZQdC-00000004F0t-0SX5; Thu, 01 Aug 2024 07:53:50 +0000 Received: from zg8tmja5ljk3lje4ms43mwaa.icoremail.net ([209.97.181.73]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZQch-00000004Euy-3Cb8 for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2024 07:53:21 +0000 Received: from prodtpl.icoremail.net (unknown [10.12.1.20]) by hzbj-icmmx-7 (Coremail) with SMTP id AQAAfwDn71vpPqtmq1SlAw--.54156S2; Thu, 01 Aug 2024 15:53:13 +0800 (CST) Received: from localhost (unknown [123.150.8.50]) by mail (Coremail) with SMTP id AQAAfwB3pbXnPqtmNC8KAA--.18047S2; Thu, 01 Aug 2024 15:53:12 +0800 (CST) Date: Thu, 1 Aug 2024 15:53:11 +0800 From: Yuquan Wang To: Jonathan Cameron Cc: dan.j.williams@intel.com, linux-cxl@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chenbaozi@phytium.com.cn Subject: Re: [RFC PATCH 3/8] mm: memblock: Add a means to add to memblock.reserved Message-ID: References: <20240529171236.32002-1-Jonathan.Cameron@huawei.com> <20240529171236.32002-4-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240529171236.32002-4-Jonathan.Cameron@huawei.com> X-CM-TRANSID: AQAAfwB3pbXnPqtmNC8KAA--.18047S2 X-CM-SenderInfo: 5zdqw5pxtxt0arstlqxsk13x1xpou0fpof0/1tbiAQAEAWaqm98E1AAFsZ Authentication-Results: hzbj-icmmx-7; spf=neutral smtp.mail=wangyuquan 1236@phytium.com.cn; X-Coremail-Antispam: 1Uk129KBjvJXoW7WF47WrWfur4xZF1fWF17ZFb_yoW8ZFy8pr 93Ga1fCF4UGF18Xa93J3WYgry7Zwn5GF1ruFWjkFy7Aa4kXr1xJw4kG3yYgFyqqr47Kr4v qF1xAFWDCw4DW37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj DUYxn0WfASr-VFAU7a7-sFnT9fnUUIcSsGvfJ3UbIYCTnIWIevJa73UjIFyTuYvj4RJUUU UUUUU X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240801_005320_189445_3CDA2286 X-CRM114-Status: GOOD ( 16.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, May 29, 2024 at 06:12:31PM +0100, Jonathan Cameron wrote: > For CXL CFMWS regions, need to add memblocks that may not be > in the system memory map so that their nid can be queried later. > Add a function to make this easy to do. > > Signed-off-by: Jonathan Cameron > --- > include/linux/memblock.h | 2 ++ > mm/memblock.c | 11 +++++++++++ > 2 files changed, 13 insertions(+) > > diff --git a/include/linux/memblock.h b/include/linux/memblock.h > index c7d518a54359..9ac1ed8c3293 100644 > --- a/include/linux/memblock.h > +++ b/include/linux/memblock.h > @@ -113,6 +113,8 @@ static inline void memblock_discard(void) {} > void memblock_allow_resize(void); > int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid, > enum memblock_flags flags); > +int memblock_add_reserved_node(phys_addr_t base, phys_addr_t size, int nid, > + enum memblock_flags flags); > int memblock_add(phys_addr_t base, phys_addr_t size); > int memblock_remove(phys_addr_t base, phys_addr_t size); > int memblock_phys_free(phys_addr_t base, phys_addr_t size); > diff --git a/mm/memblock.c b/mm/memblock.c > index 5498d5ea70b4..8d02f75ec186 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -714,6 +714,17 @@ int __init_memblock memblock_add_node(phys_addr_t base, phys_addr_t size, > return memblock_add_range(&memblock.memory, base, size, nid, flags); > } > > +int __init_memblock memblock_add_reserved_node(phys_addr_t base, phys_addr_t size, > + int nid, enum memblock_flags flags) > +{ > + phys_addr_t end = base + size - 1; > + > + memblock_dbg("%s: [%pa-%pa] nid=%d flags=%x %pS\n", __func__, > + &base, &end, nid, flags, (void *)_RET_IP_); > + > + return memblock_add_range(&memblock.reserved, base, size, nid, flags); > +} > + > /** > * memblock_add - add new memblock region > * @base: base address of the new region > -- > 2.39.2 > Tested-off-by: Yuquan Wang