linux-toolchains.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/sev: Mark snp_abort() noreturn
@ 2022-08-24 15:24 Borislav Petkov
  2022-08-24 15:38 ` Peter Zijlstra
  2022-08-24 17:29 ` [PATCH] " Segher Boessenkool
  0 siblings, 2 replies; 17+ messages in thread
From: Borislav Petkov @ 2022-08-24 15:24 UTC (permalink / raw)
  To: X86 ML; +Cc: Michael Matz, linux-toolchains, LKML

From: Borislav Petkov <bp@suse.de>

Mark both the function prototype and definition as noreturn in order to
prevent the compiler from doing transformations which confuse objtool
like so:

  vmlinux.o: warning: objtool: sme_enable+0x71: unreachable instruction

This triggers with gcc-12.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/include/asm/sev.h | 2 +-
 arch/x86/kernel/sev.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/sev.h b/arch/x86/include/asm/sev.h
index 4a23e52fe0ee..ebc271bb6d8e 100644
--- a/arch/x86/include/asm/sev.h
+++ b/arch/x86/include/asm/sev.h
@@ -195,7 +195,7 @@ void snp_set_memory_shared(unsigned long vaddr, unsigned int npages);
 void snp_set_memory_private(unsigned long vaddr, unsigned int npages);
 void snp_set_wakeup_secondary_cpu(void);
 bool snp_init(struct boot_params *bp);
-void snp_abort(void);
+void __init __noreturn snp_abort(void);
 int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, unsigned long *fw_err);
 #else
 static inline void sev_es_ist_enter(struct pt_regs *regs) { }
diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
index 4f84c3f11af5..a428c62330d3 100644
--- a/arch/x86/kernel/sev.c
+++ b/arch/x86/kernel/sev.c
@@ -2112,7 +2112,7 @@ bool __init snp_init(struct boot_params *bp)
 	return true;
 }
 
-void __init snp_abort(void)
+void __init __noreturn snp_abort(void)
 {
 	sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SNP_UNSUPPORTED);
 }
-- 
2.35.1


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

end of thread, other threads:[~2022-08-30  4:48 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-24 15:24 [PATCH] x86/sev: Mark snp_abort() noreturn Borislav Petkov
2022-08-24 15:38 ` Peter Zijlstra
2022-08-24 15:48   ` Borislav Petkov
2022-08-24 16:16     ` Peter Zijlstra
2022-08-24 16:43       ` [PATCH v2] " Borislav Petkov
2022-08-24 17:29 ` [PATCH] " Segher Boessenkool
2022-08-24 18:23   ` Borislav Petkov
2022-08-24 18:44   ` Nick Desaulniers
2022-08-24 19:43     ` Segher Boessenkool
2022-08-24 20:45   ` Peter Zijlstra
2022-08-24 22:41     ` Segher Boessenkool
2022-08-25  6:41       ` Peter Zijlstra
2022-08-25 12:29         ` Michael Matz
2022-08-25 12:58         ` Segher Boessenkool
2022-08-25 13:12         ` David Laight
2022-08-30  4:48           ` Josh Poimboeuf
2022-08-30  4:46     ` Josh Poimboeuf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).