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 v3 6/7] of: reserved_mem: clarify fdt_scan_reserved_mem*() functions
Date: Wed, 25 Mar 2026 10:00:22 +0100 [thread overview]
Message-ID: <20260325090023.3175348-7-m.szyprowski@samsung.com> (raw)
In-Reply-To: <20260325090023.3175348-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 2967e4aff807..104e697bee7b 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1295,7 +1295,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 f9b6d3ebcc20..037e3d74dde1 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-25 9:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260325090029eucas1p1932917cc4839c3349932aeda37a7125d@eucas1p1.samsung.com>
2026-03-25 9:00 ` [PATCH v3 0/7] Refactor reserved memory regions handling code Marek Szyprowski
[not found] ` <CGME20260325090030eucas1p1a01261214ddb330f8590c7106f2980e5@eucas1p1.samsung.com>
2026-03-25 9:00 ` [PATCH v3 1/7] of: reserved_mem: remove fdt node from the structure Marek Szyprowski
[not found] ` <CGME20260325090031eucas1p185465a9f6f2a06a4b1d0cb2b13a92aef@eucas1p1.samsung.com>
2026-03-25 9:00 ` [PATCH v3 2/7] of: reserved_mem: use -ENODEV instead of -ENOENT Marek Szyprowski
[not found] ` <CGME20260325090032eucas1p1bf0dfc6d73868e576d829d9d2208672b@eucas1p1.samsung.com>
2026-03-25 9:00 ` [PATCH v3 3/7] of: reserved_mem: switch to ops based OF_DECLARE() Marek Szyprowski
[not found] ` <CGME20260325090032eucas1p27b9ce5fce5014a7d9d9ef2163f0bffd0@eucas1p2.samsung.com>
2026-03-25 9:00 ` [PATCH v3 4/7] of: reserved_mem: replace CMA quirks by generic methods Marek Szyprowski
[not found] ` <CGME20260325090033eucas1p1715349936f9737a7bc7968351fcab7f5@eucas1p1.samsung.com>
2026-03-25 9:00 ` [PATCH v3 5/7] of: reserved_mem: rearrange code a bit Marek Szyprowski
[not found] ` <CGME20260325090034eucas1p17e2eefa714bbc8cd4828a7e88c2dbfd3@eucas1p1.samsung.com>
2026-03-25 9:00 ` Marek Szyprowski [this message]
[not found] ` <CGME20260325090034eucas1p2fb10744edcc6cf8550e9855973492a00@eucas1p2.samsung.com>
2026-03-25 9:00 ` [PATCH v3 7/7] of: reserved_mem: rework fdt_init_reserved_mem_node() Marek Szyprowski
2026-03-25 14:16 ` [PATCH v3 0/7] Refactor reserved memory regions handling code Rob Herring
2026-03-26 9:58 ` Marek Szyprowski
2026-03-26 19:17 ` 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=20260325090023.3175348-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