[PATCH] x86/boot: Drop erroneous __init annotation from early_set_pages_state()

Ard Biesheuvel posted 1 patch 1 week ago
There is a newer version of this series
arch/x86/boot/startup/sev-startup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] x86/boot: Drop erroneous __init annotation from early_set_pages_state()
Posted by Ard Biesheuvel 1 week ago
From: Ard Biesheuvel <ardb@kernel.org>

The kexec code will call set_pages_state() after tearing down all the
GHCBs, which will therefore result in a call to early_set_pages_state().

This means the __init annotation is wrong, and must be dropped.

Fixes: faed658ce71d ("x86/boot: Move startup code out of __head section")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
Cc: Borislav Petkov <bp@alien8.de>
Cc: "Aithal, Srikanth" <sraithal@amd.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Ashish Kalra <Ashish.Kalra@amd.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>

 arch/x86/boot/startup/sev-startup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/boot/startup/sev-startup.c b/arch/x86/boot/startup/sev-startup.c
index 39465a0ff4e5..c4c389f7cd06 100644
--- a/arch/x86/boot/startup/sev-startup.c
+++ b/arch/x86/boot/startup/sev-startup.c
@@ -44,7 +44,7 @@
 /* Include code shared with pre-decompression boot stage */
 #include "sev-shared.c"
 
-void __init
+void
 early_set_pages_state(unsigned long vaddr, unsigned long paddr,
 		      unsigned long npages, const struct psc_desc *desc)
 {
-- 
2.51.0.534.gc79095c0ca-goog
Re: [PATCH] x86/boot: Drop erroneous __init annotation from early_set_pages_state()
Posted by Ard Biesheuvel 1 week ago
On Wed, 24 Sept 2025 at 17:53, Ard Biesheuvel <ardb+git@google.com> wrote:
>
> From: Ard Biesheuvel <ardb@kernel.org>
>
> The kexec code will call set_pages_state() after tearing down all the
> GHCBs, which will therefore result in a call to early_set_pages_state().
>
> This means the __init annotation is wrong, and must be dropped.
>
> Fixes: faed658ce71d ("x86/boot: Move startup code out of __head section")
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

Reported-by: Srikanth Aithal <Srikanth.Aithal@amd.com>
Tested-by: Srikanth Aithal <Srikanth.Aithal@amd.com>

> ---
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: "Aithal, Srikanth" <sraithal@amd.com>
> Cc: Sean Christopherson <seanjc@google.com>
> Cc: Ashish Kalra <Ashish.Kalra@amd.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
>
>  arch/x86/boot/startup/sev-startup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/boot/startup/sev-startup.c b/arch/x86/boot/startup/sev-startup.c
> index 39465a0ff4e5..c4c389f7cd06 100644
> --- a/arch/x86/boot/startup/sev-startup.c
> +++ b/arch/x86/boot/startup/sev-startup.c
> @@ -44,7 +44,7 @@
>  /* Include code shared with pre-decompression boot stage */
>  #include "sev-shared.c"
>
> -void __init
> +void
>  early_set_pages_state(unsigned long vaddr, unsigned long paddr,
>                       unsigned long npages, const struct psc_desc *desc)
>  {
> --
> 2.51.0.534.gc79095c0ca-goog
>
[tip: x86/apic] x86/boot: Drop erroneous __init annotation from early_set_pages_state()
Posted by tip-bot2 for Ard Biesheuvel 1 week ago
The following commit has been merged into the x86/apic branch of tip:

Commit-ID:     1f6113ae5ac4927fe80256154ebb0461e670fa85
Gitweb:        https://git.kernel.org/tip/1f6113ae5ac4927fe80256154ebb0461e670fa85
Author:        Ard Biesheuvel <ardb@kernel.org>
AuthorDate:    Wed, 24 Sep 2025 17:53:11 +02:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Wed, 24 Sep 2025 18:08:34 +02:00

x86/boot: Drop erroneous __init annotation from early_set_pages_state()

The kexec code will call set_pages_state() after tearing down all the GHCBs,
which will therefore result in a call to early_set_pages_state().

This means the __init annotation is wrong, and must be dropped.

Fixes: c5c30a373693 ("x86/boot: Move startup code out of __head section")
Reported-by: Srikanth Aithal <Srikanth.Aithal@amd.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Srikanth Aithal <Srikanth.Aithal@amd.com>
---
 arch/x86/boot/startup/sev-startup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/boot/startup/sev-startup.c b/arch/x86/boot/startup/sev-startup.c
index a9b0a9c..0972542 100644
--- a/arch/x86/boot/startup/sev-startup.c
+++ b/arch/x86/boot/startup/sev-startup.c
@@ -44,7 +44,7 @@
 /* Include code shared with pre-decompression boot stage */
 #include "sev-shared.c"
 
-void __init
+void
 early_set_pages_state(unsigned long vaddr, unsigned long paddr,
 		      unsigned long npages, const struct psc_desc *desc)
 {