All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/setup: Make relocated_ramdisk a local variable of relocate_initrd()
@ 2023-11-13  3:40 Yuntao Wang
  2023-11-13  5:00 ` Baoquan He
  2023-11-13  8:32 ` [tip: x86/cleanups] " tip-bot2 for Yuntao Wang
  0 siblings, 2 replies; 3+ messages in thread
From: Yuntao Wang @ 2023-11-13  3:40 UTC (permalink / raw)
  To: x86, linux-kernel
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Peter Zijlstra (Intel), Josh Poimboeuf,
	Juergen Gross, Baoquan He, Alexander Shishkin, Saurabh Sengar,
	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.

Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
 arch/x86/include/asm/setup.h | 2 --
 arch/x86/kernel/setup.c      | 4 +---
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index bf483fcb4e57..5c83729c8e71 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -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);
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 1526747bedf2..ec2c21a1844e 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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",
-- 
2.42.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/setup: Make relocated_ramdisk a local variable of relocate_initrd()
  2023-11-13  3:40 [PATCH] x86/setup: Make relocated_ramdisk a local variable of relocate_initrd() Yuntao Wang
@ 2023-11-13  5:00 ` Baoquan He
  2023-11-13  8:32 ` [tip: x86/cleanups] " tip-bot2 for Yuntao Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Baoquan He @ 2023-11-13  5:00 UTC (permalink / raw)
  To: Yuntao Wang
  Cc: x86, linux-kernel, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Peter Zijlstra (Intel),
	Josh Poimboeuf, Juergen Gross, Alexander Shishkin, Saurabh Sengar

On 11/13/23 at 11:40am, Yuntao Wang wrote:
> 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.

Reviewed-by: Baoquan He <bhe@redhat.com>

> ---
>  arch/x86/include/asm/setup.h | 2 --
>  arch/x86/kernel/setup.c      | 4 +---
>  2 files changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
> index bf483fcb4e57..5c83729c8e71 100644
> --- a/arch/x86/include/asm/setup.h
> +++ b/arch/x86/include/asm/setup.h
> @@ -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);
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 1526747bedf2..ec2c21a1844e 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -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",
> -- 
> 2.42.1
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: x86/cleanups] x86/setup: Make relocated_ramdisk a local variable of relocate_initrd()
  2023-11-13  3:40 [PATCH] x86/setup: Make relocated_ramdisk a local variable of relocate_initrd() Yuntao Wang
  2023-11-13  5:00 ` Baoquan He
@ 2023-11-13  8:32 ` tip-bot2 for Yuntao Wang
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Yuntao Wang @ 2023-11-13  8:32 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Yuntao Wang, Borislav Petkov (AMD), Baoquan He, x86, linux-kernel

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 <ytcoode@gmail.com>
AuthorDate:    Mon, 13 Nov 2023 11:40:26 +08:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
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.

Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Baoquan He <bhe@redhat.com>
Link: https://lore.kernel.org/r/20231113034026.130679-1-ytcoode@gmail.com
---
 arch/x86/include/asm/setup.h | 2 --
 arch/x86/kernel/setup.c      | 4 +---
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index bf483fc..5c83729 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -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);
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 1526747..ec2c21a 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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",

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-13  8:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-13  3:40 [PATCH] x86/setup: Make relocated_ramdisk a local variable of relocate_initrd() Yuntao Wang
2023-11-13  5:00 ` Baoquan He
2023-11-13  8:32 ` [tip: x86/cleanups] " tip-bot2 for Yuntao Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.