[PATCH RESEND 25/62] init: rename phys_initrd_{start,size} to phys_external_initramfs_{start,size}

Askar Safin
2025-09-13T01:07:21Z

Rename phys_initrd_start to phys_external_initramfs_start and
phys_initrd_size to phys_external_initramfs_size.

They refer to initramfs, not to initrd

Signed-off-by: Askar Safin <safinaskar@gmail.com>
---
arch/arc/mm/init.c | 8 ++++----
arch/arm/mm/init.c | 8 ++++----
arch/arm64/mm/init.c | 15 ++++++++-------
arch/x86/kernel/setup.c | 4 ++--
drivers/firmware/efi/efi.c | 6 +++---
drivers/of/fdt.c | 8 ++++----
include/linux/initrd.h | 4 ++--
init/do_mounts_initrd.c | 8 ++++----
init/initramfs.c | 10 +++++-----
9 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index a73cc94f806e..eb8a616a63c6 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -110,10 +110,10 @@ void __init setup_arch_memory(void)
__pa(_end) - CONFIG_LINUX_LINK_BASE);

#ifdef CONFIG_BLK_DEV_INITRD
- if (phys_initrd_size) {
- memblock_reserve(phys_initrd_start, phys_initrd_size);
- initrd_start = (unsigned long)__va(phys_initrd_start);
- initrd_end = initrd_start + phys_initrd_size;
+ if (phys_external_initramfs_size) {
+ memblock_reserve(phys_external_initramfs_start, phys_external_initramfs_size);
+ initrd_start = (unsigned long)__va(phys_external_initramfs_start);
+ initrd_end = initrd_start + phys_external_initramfs_size;
}
#endif

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 54bdca025c9f..93f8010b9115 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -55,8 +55,8 @@ static int __init parse_tag_initrd(const struct tag *tag)
{
pr_warn("ATAG_INITRD is deprecated; "
"please update your bootloader.\n");
- phys_initrd_start = __virt_to_phys(tag->u.initrd.start);
- phys_initrd_size = tag->u.initrd.size;
+ phys_external_initramfs_start = __virt_to_phys(tag->u.initrd.start);
+ phys_external_initramfs_size = tag->u.initrd.size;
return 0;
}

@@ -64,8 +64,8 @@ __tagtable(ATAG_INITRD, parse_tag_initrd);

static int __init parse_tag_initrd2(const struct tag *tag)
{
- phys_initrd_start = tag->u.initrd.start;
- phys_initrd_size = tag->u.initrd.size;
+ phys_external_initramfs_start = tag->u.initrd.start;
+ phys_external_initramfs_size = tag->u.initrd.size;
return 0;
}

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index ea84a61ed508..da517edcf824 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -246,14 +246,15 @@ void __init arm64_memblock_init(void)
memblock_add(__pa_symbol(_text), (u64)(_end - _text));
}

- if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && phys_initrd_size) {
+ if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && phys_external_initramfs_size) {
/*
* Add back the memory we just removed if it results in the
* initrd to become inaccessible via the linear mapping.
* Otherwise, this is a no-op
*/
- u64 base = phys_initrd_start & PAGE_MASK;
- u64 size = PAGE_ALIGN(phys_initrd_start + phys_initrd_size) - base;
+ u64 base = phys_external_initramfs_start & PAGE_MASK;
+ u64 size = PAGE_ALIGN(phys_external_initramfs_start +
+ phys_external_initramfs_size) - base;

/*
* We can only add back the initrd memory if we don't end up
@@ -267,7 +268,7 @@ void __init arm64_memblock_init(void)
base + size > memblock_start_of_DRAM() +
linear_region_size,
"initrd not fully accessible via the linear mapping -- please check your bootloader ...\n")) {
- phys_initrd_size = 0;
+ phys_external_initramfs_size = 0;
} else {
memblock_add(base, size);
memblock_clear_nomap(base, size);
@@ -280,10 +281,10 @@ void __init arm64_memblock_init(void)
* pagetables with memblock.
*/
memblock_reserve(__pa_symbol(_stext), _end - _stext);
- if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && phys_initrd_size) {
+ if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && phys_external_initramfs_size) {
/* the generic initrd code expects virtual addresses */
- initrd_start = __phys_to_virt(phys_initrd_start);
- initrd_end = initrd_start + phys_initrd_size;
+ initrd_start = __phys_to_virt(phys_external_initramfs_start);
+ initrd_end = initrd_start + phys_external_initramfs_size;
}

early_init_fdt_scan_reserved_mem();
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 797c3c9fc75e..e727c7a7f648 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -297,7 +297,7 @@ static u64 __init get_ramdisk_image(void)
ramdisk_image |= (u64)boot_params.ext_ramdisk_image << 32;

if (ramdisk_image == 0)
- ramdisk_image = phys_initrd_start;
+ ramdisk_image = phys_external_initramfs_start;

return ramdisk_image;
}
@@ -308,7 +308,7 @@ static u64 __init get_ramdisk_size(void)
ramdisk_size |= (u64)boot_params.ext_ramdisk_size << 32;

if (ramdisk_size == 0)
- ramdisk_size = phys_initrd_size;
+ ramdisk_size = phys_external_initramfs_size;

return ramdisk_size;
}
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 1ce428e2ac8a..7cab72da2ea9 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -808,13 +808,13 @@ int __init efi_config_parse_tables(const efi_config_table_t *config_tables,
}

if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) &&
- initrd != EFI_INVALID_TABLE_ADDR && phys_initrd_size == 0) {
+ initrd != EFI_INVALID_TABLE_ADDR && phys_external_initramfs_size == 0) {
struct linux_efi_initrd *tbl;

tbl = early_memremap(initrd, sizeof(*tbl));
if (tbl) {
- phys_initrd_start = tbl->base;
- phys_initrd_size = tbl->size;
+ phys_external_initramfs_start = tbl->base;
+ phys_external_initramfs_size = tbl->size;
early_memunmap(tbl, sizeof(*tbl));
}
}
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 0edd639898a6..9c4c9be948c5 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -760,8 +760,8 @@ static void __early_init_dt_declare_initrd(unsigned long start,
{
/*
* __va() is not yet available this early on some platforms. In that
- * case, the platform uses phys_initrd_start/phys_initrd_size instead
- * and does the VA conversion itself.
+ * case, the platform uses phys_external_initramfs_start/phys_external_initramfs_size
+ * instead and does the VA conversion itself.
*/
if (!IS_ENABLED(CONFIG_ARM64) &&
!(IS_ENABLED(CONFIG_RISCV) && IS_ENABLED(CONFIG_64BIT))) {
@@ -799,8 +799,8 @@ static void __init early_init_dt_check_for_initrd(unsigned long node)
return;

__early_init_dt_declare_initrd(start, end);
- phys_initrd_start = start;
- phys_initrd_size = end - start;
+ phys_external_initramfs_start = start;
+ phys_external_initramfs_size = end - start;

pr_debug("initrd_start=0x%llx initrd_end=0x%llx\n", start, end);
}
diff --git a/include/linux/initrd.h b/include/linux/initrd.h
index 4080ba82d4c9..23c08e88234c 100644
--- a/include/linux/initrd.h
+++ b/include/linux/initrd.h
@@ -17,8 +17,8 @@ static inline void __init reserve_initrd_mem(void) {}
static inline void wait_for_initramfs(void) {}
#endif

-extern phys_addr_t phys_initrd_start;
-extern unsigned long phys_initrd_size;
+extern phys_addr_t phys_external_initramfs_start;
+extern unsigned long phys_external_initramfs_size;

extern char __builtin_initramfs_start[];
extern unsigned long __builtin_initramfs_size;
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index d5264e9a52e0..444182a76999 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -15,8 +15,8 @@
unsigned long initrd_start, initrd_end;
int initrd_below_start_ok;

-phys_addr_t phys_initrd_start __initdata;
-unsigned long phys_initrd_size __initdata;
+phys_addr_t phys_external_initramfs_start __initdata;
+unsigned long phys_external_initramfs_size __initdata;

static int __init early_initrdmem(char *p)
{
@@ -28,8 +28,8 @@ static int __init early_initrdmem(char *p)
if (*endp == ',') {
size = memparse(endp + 1, NULL);

- phys_initrd_start = start;
- phys_initrd_size = size;
+ phys_external_initramfs_start = start;
+ phys_external_initramfs_size = size;
}
return 0;
}
diff --git a/init/initramfs.c b/init/initramfs.c
index 2866d7a0afd7..6abe0a3ca4ce 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -610,7 +610,7 @@ void __init reserve_initrd_mem(void)
/* Ignore the virtul address computed during device tree parsing */
initrd_start = initrd_end = 0;

- if (!phys_initrd_size)
+ if (!phys_external_initramfs_size)
return;
/*
* Round the memory region to page boundaries as per free_initrd_mem()
@@ -618,8 +618,8 @@ void __init reserve_initrd_mem(void)
* are in use, but more importantly, reserves the entire set of pages
* as we don't want these pages allocated for other purposes.
*/
- start = round_down(phys_initrd_start, PAGE_SIZE);
- size = phys_initrd_size + (phys_initrd_start - start);
+ start = round_down(phys_external_initramfs_start, PAGE_SIZE);
+ size = phys_external_initramfs_size + (phys_external_initramfs_start - start);
size = round_up(size, PAGE_SIZE);

if (!memblock_is_region_memory(start, size)) {
@@ -636,8 +636,8 @@ void __init reserve_initrd_mem(void)

memblock_reserve(start, size);
/* Now convert initrd to virtual addresses */
- initrd_start = (unsigned long)__va(phys_initrd_start);
- initrd_end = initrd_start + phys_initrd_size;
+ initrd_start = (unsigned long)__va(phys_external_initramfs_start);
+ initrd_end = initrd_start + phys_external_initramfs_size;
initrd_below_start_ok = 1;

return;
--
2.47.2