linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Saravana Kannan <saravanak@kernel.org>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-mm@kvack.org, iommu@lists.linux.dev
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Oreoluwa Babatunde <oreoluwa.babatunde@oss.qualcomm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Robin Murphy <robin.murphy@arm.com>
Subject: [PATCH 6/7] of: reserved_mem: clarify fdt_scan_reserved_mem*() functions
Date: Fri, 13 Mar 2026 16:08:01 +0100	[thread overview]
Message-ID: <20260313150802.1121442-7-m.szyprowski@samsung.com> (raw)
In-Reply-To: <20260313150802.1121442-1-m.szyprowski@samsung.com>

Rename fdt_scan_reserved_mem_reg_nodes() to fdt_scan_reserved_mem_late()
to clearly show how it differs from fdt_scan_reserved_mem() and update
description of both functions.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/of/fdt.c             |  2 +-
 drivers/of/of_private.h      |  2 +-
 drivers/of/of_reserved_mem.c | 24 +++++++++++++++---------
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 331646d667b9..43a0944ca462 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1274,7 +1274,7 @@ void __init unflatten_device_tree(void)
 	void *fdt = initial_boot_params;
 
 	/* Save the statically-placed regions in the reserved_mem array */
-	fdt_scan_reserved_mem_reg_nodes();
+	fdt_scan_reserved_mem_late();
 
 	/* Populate an empty root node when bootloader doesn't provide one */
 	if (!fdt) {
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index df0bb00349e0..0ae16da066e2 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -186,7 +186,7 @@ static inline struct device_node *__of_get_dma_parent(const struct device_node *
 #endif
 
 int fdt_scan_reserved_mem(void);
-void __init fdt_scan_reserved_mem_reg_nodes(void);
+void __init fdt_scan_reserved_mem_late(void);
 
 bool of_fdt_device_is_available(const void *blob, unsigned long node);
 
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index b8d4fbcde3b1..229573d6dacb 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -265,16 +265,15 @@ static void __init __rmem_check_for_overlap(void)
 }
 
 /**
- * fdt_scan_reserved_mem_reg_nodes() - Store info for the "reg" defined
- * reserved memory regions.
+ * fdt_scan_reserved_mem_late() - Scan FDT and initialize remaining reserved
+ * memory regions.
  *
- * This function is used to scan through the DT and store the
- * information for the reserved memory regions that are defined using
- * the "reg" property. The region node number, name, base address, and
- * size are all stored in the reserved_mem array by calling the
- * fdt_reserved_mem_save_node() function.
+ * This function is used to scan again through the DT and initialize the
+ * the "static" reserved memory regions, that are defined using the "reg"
+ * property. Each such region is then initialized with its specific init
+ * function and stored in the global reserved_mem array.
  */
-void __init fdt_scan_reserved_mem_reg_nodes(void)
+void __init fdt_scan_reserved_mem_late(void)
 {
 	const void *fdt = initial_boot_params;
 	phys_addr_t base, size;
@@ -328,7 +327,14 @@ void __init fdt_scan_reserved_mem_reg_nodes(void)
 static int __init __reserved_mem_alloc_size(unsigned long node, const char *uname);
 
 /*
- * fdt_scan_reserved_mem() - scan a single FDT node for reserved memory
+ * fdt_scan_reserved_mem() - reserve and allocate memory occupied by
+ * reserved memory regions.
+ *
+ * This function is used to scan through the FDT and mark memory occupied
+ * by all static (defined by the "reg" property) reserved memory regions.
+ * Then memory for all dynamic regions (defined by size & alignment) is
+ * allocated, a region specific init function is called and region information
+ * is stored in the reserved_mem array.
  */
 int __init fdt_scan_reserved_mem(void)
 {
-- 
2.34.1



  parent reply	other threads:[~2026-03-13 15:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20260313150809eucas1p169ab0904a217a04e0601e2ef01854c73@eucas1p1.samsung.com>
2026-03-13 15:07 ` [PATCH 0/7] Refactor reserved memory regions handling code Marek Szyprowski
     [not found]   ` <CGME20260313150810eucas1p1ecbbe597c5df8aaa2effa3b65c07c6db@eucas1p1.samsung.com>
2026-03-13 15:07     ` [PATCH 1/7] of: reserved_mem: remove fdt node from the structure Marek Szyprowski
     [not found]   ` <CGME20260313150810eucas1p26191d7bb4791b75bb9f3cc9cf116b1a2@eucas1p2.samsung.com>
2026-03-13 15:07     ` [PATCH 2/7] of: reserved_mem: use -ENODEV instead of -ENOENT Marek Szyprowski
     [not found]   ` <CGME20260313150811eucas1p28cd933ea257af5dabaad214618214050@eucas1p2.samsung.com>
2026-03-13 15:07     ` [PATCH 3/7] of: reserved_mem: switch to ops based OF_DECLARE() Marek Szyprowski
2026-03-13 15:58       ` Marek Szyprowski
2026-03-14 15:20       ` kernel test robot
     [not found]   ` <CGME20260313150812eucas1p2f155af637fcaf4d7061a5c9b9a5a6233@eucas1p2.samsung.com>
2026-03-13 15:07     ` [PATCH 4/7] of: reserved_mem: replace CMA quirks by generic methods Marek Szyprowski
     [not found]   ` <CGME20260313150813eucas1p2486c45e5d13f297dac9db334caa258e3@eucas1p2.samsung.com>
2026-03-13 15:08     ` [PATCH 5/7] of: reserved_mem: rearrange code a bit Marek Szyprowski
     [not found]   ` <CGME20260313150813eucas1p275aa47663c75455fbec8f6a315c03f38@eucas1p2.samsung.com>
2026-03-13 15:08     ` Marek Szyprowski [this message]
     [not found]   ` <CGME20260313150814eucas1p14203b667c73825e16a3d5d6430e5e7b6@eucas1p1.samsung.com>
2026-03-13 15:08     ` [PATCH 7/7] of: reserved_mem: rework fdt_init_reserved_mem_node() Marek Szyprowski
2026-03-14  3:43       ` kernel test robot
2026-03-14  7:57       ` kernel test robot
2026-03-22 22:44   ` [PATCH 0/7] Refactor reserved memory regions handling code Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260313150802.1121442-7-m.szyprowski@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=devicetree@vger.kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oreoluwa.babatunde@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=saravanak@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox