linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/paravirt: Fix build PARAVIRT_XXL=y without XEN_PV
@ 2021-11-17 18:14 Kirill A. Shutemov
  2021-11-17 18:35 ` Peter Zijlstra
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Kirill A. Shutemov @ 2021-11-17 18:14 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov
  Cc: Kuppuswamy Sathyanarayanan, Andi Kleen, Dave Hansen,
	Peter Zijlstra, x86, linux-kernel, Kirill A. Shutemov,
	Juergen Gross, Deep Shah, VMware, Inc.

TDX is going to use CONFIG_PARAVIRT_XXL, but kernel fails to compile if
XEN_PV is not enabled:

	ld.lld: error: undefined symbol: xen_iret

It happens because INTERRUPT_RETURN defined to use xen_iret if
CONFIG_PARAVIRT_XXL enabled regardless of CONFIG_XEN_PV.

The issue is not visible in the current kernel because CONFIG_XEN_PV is
the only user of CONFIG_PARAVIRT_XXL and there's no way to enable them
separately.

Rework code to define INTERRUPT_RETURN based on CONFIG_XEN_PV, not
CONFIG_PARAVIRT_XXL.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Deep Shah <sdeep@vmware.com>
Cc: "VMware, Inc." <pv-drivers@vmware.com>
---
 arch/x86/include/asm/irqflags.h | 7 +++++--
 arch/x86/include/asm/paravirt.h | 5 -----
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index b794b6da3214..3b8ddcb7be76 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -118,8 +118,6 @@ static __always_inline unsigned long arch_local_irq_save(void)
 #define SAVE_FLAGS		pushfq; popq %rax
 #endif
 
-#define INTERRUPT_RETURN	jmp native_iret
-
 #endif
 
 #endif /* __ASSEMBLY__ */
@@ -147,8 +145,13 @@ static __always_inline void arch_local_irq_restore(unsigned long flags)
 #ifdef CONFIG_X86_64
 #ifdef CONFIG_XEN_PV
 #define SWAPGS	ALTERNATIVE "swapgs", "", X86_FEATURE_XENPV
+#define INTERRUPT_RETURN						\
+	ANNOTATE_RETPOLINE_SAFE;					\
+	ALTERNATIVE_TERNARY("jmp *paravirt_iret(%rip);",		\
+		X86_FEATURE_XENPV, "jmp xen_iret;", "jmp native_iret;")
 #else
 #define SWAPGS	swapgs
+#define INTERRUPT_RETURN	jmp native_iret
 #endif
 #endif
 #endif /* !__ASSEMBLY__ */
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index 8e04268d7c10..865f78635af1 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -745,11 +745,6 @@ extern void default_banner(void);
 #define PARA_SITE(ptype, ops)	_PVSITE(ptype, ops, .quad, 8)
 #define PARA_INDIRECT(addr)	*addr(%rip)
 
-#define INTERRUPT_RETURN						\
-	ANNOTATE_RETPOLINE_SAFE;					\
-	ALTERNATIVE_TERNARY("jmp *paravirt_iret(%rip);",		\
-		X86_FEATURE_XENPV, "jmp xen_iret;", "jmp native_iret;")
-
 #ifdef CONFIG_DEBUG_ENTRY
 .macro PARA_IRQ_save_fl
 	PARA_SITE(PARA_PATCH(PV_IRQ_save_fl),
-- 
2.32.0


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

end of thread, other threads:[~2021-11-22 12:55 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17 18:14 [PATCH] x86/paravirt: Fix build PARAVIRT_XXL=y without XEN_PV Kirill A. Shutemov
2021-11-17 18:35 ` Peter Zijlstra
2021-11-17 18:42   ` Kirill A. Shutemov
2021-11-17 18:46     ` Sathyanarayanan Kuppuswamy
2021-11-17 18:48       ` Borislav Petkov
2021-11-17 19:11         ` Dave Hansen
2021-11-17 19:13         ` Sathyanarayanan Kuppuswamy
2021-11-17 19:57           ` Dave Hansen
2021-11-17 20:54             ` Sathyanarayanan Kuppuswamy
2021-11-17 21:09               ` Borislav Petkov
2021-11-17 23:04                 ` Sathyanarayanan Kuppuswamy
2021-11-17 23:23                   ` Peter Zijlstra
2021-11-17 23:57                     ` Sathyanarayanan Kuppuswamy
2021-11-17 23:33                   ` Dave Hansen
2021-11-18  1:26                     ` Sathyanarayanan Kuppuswamy
2021-11-18  9:13                       ` Borislav Petkov
2021-11-17 19:02       ` Peter Zijlstra
2021-11-18  6:23 ` Juergen Gross
2021-11-19 10:21   ` Kirill A. Shutemov
2021-11-19  7:51 ` Lai Jiangshan
2021-11-19 10:20   ` Kirill A. Shutemov
2021-11-19 10:27     ` Juergen Gross
2021-11-20  1:23     ` Lai Jiangshan
2021-11-22 12:55       ` Juergen Gross

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).