From: Marek Szyprowski <m.szyprowski@samsung.com>
To: 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>,
Saravana Kannan <saravanak@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Robin Murphy <robin.murphy@arm.com>
Subject: [PATCH v2 6/7] of: reserved_mem: clarify fdt_scan_reserved_mem*() functions
Date: Mon, 23 Mar 2026 11:09:00 +0100 [thread overview]
Message-ID: <20260323100901.4079171-7-m.szyprowski@samsung.com> (raw)
In-Reply-To: <20260323100901.4079171-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 dceaf19f31fb..801451d034fa 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
+ * "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
next prev parent reply other threads:[~2026-03-23 10:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260323100908eucas1p2f471760fe1b26181c9b0cb90dd0739a6@eucas1p2.samsung.com>
2026-03-23 10:08 ` [PATCH v2 0/7] Refactor reserved memory regions handling code Marek Szyprowski
[not found] ` <CGME20260323100908eucas1p1890b792406ac416bb4db0d78f3e71faf@eucas1p1.samsung.com>
2026-03-23 10:08 ` [PATCH v2 1/7] of: reserved_mem: remove fdt node from the structure Marek Szyprowski
[not found] ` <CGME20260323100909eucas1p20e3bae57f851ea402506f7dbee7ffe3f@eucas1p2.samsung.com>
2026-03-23 10:08 ` [PATCH v2 2/7] of: reserved_mem: use -ENODEV instead of -ENOENT Marek Szyprowski
[not found] ` <CGME20260323100910eucas1p2926c5ad3c6dbb3b4cbad1c53a55a6f63@eucas1p2.samsung.com>
2026-03-23 10:08 ` [PATCH v2 3/7] of: reserved_mem: switch to ops based OF_DECLARE() Marek Szyprowski
[not found] ` <CGME20260323100910eucas1p1efe6ee90c38f4261f6eae2a81a25717a@eucas1p1.samsung.com>
2026-03-23 10:08 ` [PATCH v2 4/7] of: reserved_mem: replace CMA quirks by generic methods Marek Szyprowski
[not found] ` <CGME20260323100911eucas1p173dd26efc96b0907995fda7d551d1db6@eucas1p1.samsung.com>
2026-03-23 10:08 ` [PATCH v2 5/7] of: reserved_mem: rearrange code a bit Marek Szyprowski
[not found] ` <CGME20260323100912eucas1p1f13cc5bfc49a119c7f1e0d6bd754d42c@eucas1p1.samsung.com>
2026-03-23 10:09 ` Marek Szyprowski [this message]
[not found] ` <CGME20260323100912eucas1p1aadb718d2c0eea3404aa5be379ae21c1@eucas1p1.samsung.com>
2026-03-23 10:09 ` [PATCH v2 7/7] of: reserved_mem: rework fdt_init_reserved_mem_node() Marek Szyprowski
2026-03-23 20:18 ` [PATCH v2 0/7] Refactor reserved memory regions handling code Andrew Morton
2026-03-25 1:49 ` Rob Herring
2026-03-25 3:00 ` Andrew Morton
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=20260323100901.4079171-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