Skip to contentSkip to conversation

x86/setup: Make relocated_ramdisk a local variable of relocate_initrd()

PATCH Applied Yuntao Wang 3 participants 3 messages Nov 13, 2023 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/setup: Make relocated_ramdisk a local variable of relocate_initrd()

After commit 0b62f6cb0773 ("x86/microcode/32: Move early loading after paging enable"), the global variable relocated_ramdisk is no longer used anywhere except for the relocate_initrd() function. Make it a local variable of that function.

---
 arch/x86/include/asm/setup.h | 2 --
 arch/x86/kernel/setup.c      | 4 +---
 2 files changed, 1 insertion(+), 5 deletions(-)
arch/x86/include/asm/setup.h +0 -2
index bf483fcb4e57..5c83729c8e71 100644
@@ -31,8 +31,6 @@
 #include <asm/bootparam.h>
 #include <asm/x86_init.h>
 
-extern u64 relocated_ramdisk;
-
 /* Interrupt control for vSMPowered x86_64 systems */
 #ifdef CONFIG_X86_64
 void vsmp_init(void);
arch/x86/kernel/setup.c +1 -3
index 1526747bedf2..ec2c21a1844e 100644
@@ -226,8 +226,6 @@ static void __init reserve_brk(void)
 	_brk_start = 0;
 }
 
-u64 relocated_ramdisk;
-
 #ifdef CONFIG_BLK_DEV_INITRD
 
 static u64 __init get_ramdisk_image(void)
@@ -261,7 +259,7 @@ static void __init relocate_initrd(void)
 	u64 area_size     = PAGE_ALIGN(ramdisk_size);
 
 	/* We need to move the initrd down into directly mapped mem */
-	relocated_ramdisk = memblock_phys_alloc_range(area_size, PAGE_SIZE, 0,
+	u64 relocated_ramdisk = memblock_phys_alloc_range(area_size, PAGE_SIZE, 0,
 						      PFN_PHYS(max_pfn_mapped));
 	if (!relocated_ramdisk)
 		panic("Cannot find place for new RAMDISK of size %lld\n",
Signature · 1 line
2.42.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Yuntao Wang

After commit 0b62f6cb0773 ("x86/microcode/32: Move early loading after paging enable"), the global variable relocated_ramdisk is no longer used anywhere except for the relocate_initrd() function. Make it a local variable of that function.

It's true.

Quoted 43 lines
---
 arch/x86/include/asm/setup.h | 2 --
 arch/x86/kernel/setup.c      | 4 +---
 2 files changed, 1 insertion(+), 5 deletions(-)
arch/x86/include/asm/setup.h +0 -2
index bf483fcb4e57..5c83729c8e71 100644
@@ -31,8 +31,6 @@
 #include <asm/bootparam.h>
 #include <asm/x86_init.h>
 
-extern u64 relocated_ramdisk;
-
 /* Interrupt control for vSMPowered x86_64 systems */
 #ifdef CONFIG_X86_64
 void vsmp_init(void);
arch/x86/kernel/setup.c +1 -3
index 1526747bedf2..ec2c21a1844e 100644
@@ -226,8 +226,6 @@ static void __init reserve_brk(void)
 	_brk_start = 0;
 }
 
-u64 relocated_ramdisk;
-
 #ifdef CONFIG_BLK_DEV_INITRD
 
 static u64 __init get_ramdisk_image(void)
@@ -261,7 +259,7 @@ static void __init relocate_initrd(void)
 	u64 area_size     = PAGE_ALIGN(ramdisk_size);
 
 	/* We need to move the initrd down into directly mapped mem */
-	relocated_ramdisk = memblock_phys_alloc_range(area_size, PAGE_SIZE, 0,
+	u64 relocated_ramdisk = memblock_phys_alloc_range(area_size, PAGE_SIZE, 0,
 						      PFN_PHYS(max_pfn_mapped));
 	if (!relocated_ramdisk)
 		panic("Cannot find place for new RAMDISK of size %lld\n",
Signature · 1 line
2.42.1
merge bot Applied
#2 lore raw
In reply to Yuntao Wang
The following commit has been merged into the x86/cleanups branch of tip:

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     f7a25cf1d4707da39b80df96a3be8a8abd07c35b
Gitweb:        https://git.kernel.org/tip/f7a25cf1d4707da39b80df96a3be8a8abd07c35b
Author:        Yuntao Wang <[email protected]>
AuthorDate:    Mon, 13 Nov 2023 11:40:26 +08:00
Committer:     Borislav Petkov (AMD) <[email protected]>
CommitterDate: Mon, 13 Nov 2023 09:09:37 +01:00

x86/setup: Make relocated_ramdisk a local variable of relocate_initrd()

After

0b62f6cb0773 ("x86/microcode/32: Move early loading after paging enable"),

the global variable relocated_ramdisk is no longer used anywhere except for the relocate_initrd() function. Make it a local variable of that function.

---
 arch/x86/include/asm/setup.h | 2 --
 arch/x86/kernel/setup.c      | 4 +---
 2 files changed, 1 insertion(+), 5 deletions(-)
arch/x86/include/asm/setup.h +0 -2
index bf483fc..5c83729 100644
@@ -31,8 +31,6 @@
 #include <asm/bootparam.h>
 #include <asm/x86_init.h>
 
-extern u64 relocated_ramdisk;
-
 /* Interrupt control for vSMPowered x86_64 systems */
 #ifdef CONFIG_X86_64
 void vsmp_init(void);
arch/x86/kernel/setup.c +1 -3
index 1526747..ec2c21a 100644
@@ -226,8 +226,6 @@ static void __init reserve_brk(void)
 	_brk_start = 0;
 }
 
-u64 relocated_ramdisk;
-
 #ifdef CONFIG_BLK_DEV_INITRD
 
 static u64 __init get_ramdisk_image(void)
@@ -261,7 +259,7 @@ static void __init relocate_initrd(void)
 	u64 area_size     = PAGE_ALIGN(ramdisk_size);
 
 	/* We need to move the initrd down into directly mapped mem */
-	relocated_ramdisk = memblock_phys_alloc_range(area_size, PAGE_SIZE, 0,
+	u64 relocated_ramdisk = memblock_phys_alloc_range(area_size, PAGE_SIZE, 0,
 						      PFN_PHYS(max_pfn_mapped));
 	if (!relocated_ramdisk)
 		panic("Cannot find place for new RAMDISK of size %lld\n",