[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1678081915-12599-2-git-send-email-js07.lee@samsung.com>
Date: Mon, 6 Mar 2023 14:51:55 +0900
From: Jungseung Lee <js07.lee@...sung.com>
To: rmk+kernel@...linux.org.uk, linus.walleij@...aro.org,
amit.kachhap@....com, ardb@...nel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
keescook@...omium.org, js07.lee@...sung.com, js07.lee@...il.com
Subject: [PATCH 2/2] arm/mm : Report actual image regions in /proc/iomem
The resource reservations in /proc/iomem made for the kernel image did
not reflect the gaps between text, rodata, and data.
Add the "rodata" resource and update the start/end calculations.
Before :
04000000-2f7fffff : System RAM
04100000-04cfffff : Kernel code
04e00000-05369a27 : Kernel data
After :
04000000-2f7fffff : System RAM
04100000-049fffff : Kernel code
04a00000-04cb2fff : Kernel rodata
04e00000-05369a27 : Kernel data
Signed-off-by: Jungseung Lee <js07.lee@...sung.com>
---
arch/arm/kernel/setup.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 3059860..85af967 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -181,6 +181,12 @@ static struct resource mem_res[] = {
.flags = IORESOURCE_SYSTEM_RAM
},
{
+ .name = "Kernel rodata",
+ .start = 0,
+ .end = 0,
+ .flags = IORESOURCE_SYSTEM_RAM
+ },
+ {
.name = "Kernel data",
.start = 0,
.end = 0,
@@ -188,9 +194,10 @@ static struct resource mem_res[] = {
}
};
-#define video_ram mem_res[0]
-#define kernel_code mem_res[1]
-#define kernel_data mem_res[2]
+#define video_ram mem_res[0]
+#define kernel_code mem_res[1]
+#define kernel_rodata mem_res[2]
+#define kernel_data mem_res[3]
static struct resource io_res[] = {
{
@@ -866,7 +873,9 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
u64 i;
kernel_code.start = virt_to_phys(_stext);
- kernel_code.end = virt_to_phys(__init_begin - 1);
+ kernel_code.end = virt_to_phys(_etext - 1);
+ kernel_rodata.start = virt_to_phys(__start_rodata);
+ kernel_rodata.end = virt_to_phys(__end_rodata - 1);
kernel_data.start = virt_to_phys(_sdata);
kernel_data.end = virt_to_phys(_end - 1);
@@ -912,6 +921,9 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
if (kernel_code.start >= res->start &&
kernel_code.end <= res->end)
request_resource(res, &kernel_code);
+ if (kernel_rodata.start >= res->start &&
+ kernel_rodata.end <= res->end)
+ request_resource(res, &kernel_rodata);
if (kernel_data.start >= res->start &&
kernel_data.end <= res->end)
request_resource(res, &kernel_data);
--
2.7.4
Powered by blists - more mailing lists