Skip to content

Commit 2d1435b

Browse files
sean-jcPeter Zijlstra
authored andcommitted
x86/fred: Install system vector handlers even if FRED isn't fully enabled
Install the system vector IRQ handlers for FRED even if FRED isn't fully enabled in hardware. This will allow KVM to use the FRED IRQ path even on non-FRED hardware, which in turn will eliminate a non-CFI indirect CALL (KVM currently invokes the IRQ handler via an IDT lookup on the vector). [sean: extract from diff, drop stub, write changelog] Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20250714103441.121251108@infradead.org
1 parent c8ed081 commit 2d1435b

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

arch/x86/include/asm/idtentry.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,17 +460,12 @@ __visible noinstr void func(struct pt_regs *regs, \
460460
#endif
461461

462462
void idt_install_sysvec(unsigned int n, const void *function);
463-
464-
#ifdef CONFIG_X86_FRED
465463
void fred_install_sysvec(unsigned int vector, const idtentry_t function);
466-
#else
467-
static inline void fred_install_sysvec(unsigned int vector, const idtentry_t function) { }
468-
#endif
469464

470465
#define sysvec_install(vector, function) { \
471-
if (cpu_feature_enabled(X86_FEATURE_FRED)) \
466+
if (IS_ENABLED(CONFIG_X86_FRED)) \
472467
fred_install_sysvec(vector, function); \
473-
else \
468+
if (!cpu_feature_enabled(X86_FEATURE_FRED)) \
474469
idt_install_sysvec(vector, asm_##function); \
475470
}
476471

arch/x86/kernel/irqinit.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ void __init native_init_IRQ(void)
9797
/* Execute any quirks before the call gates are initialised: */
9898
x86_init.irqs.pre_vector_init();
9999

100-
if (cpu_feature_enabled(X86_FEATURE_FRED))
100+
/* FRED's IRQ path may be used even if FRED isn't fully enabled. */
101+
if (IS_ENABLED(CONFIG_X86_FRED))
101102
fred_complete_exception_setup();
102-
else
103+
104+
if (!cpu_feature_enabled(X86_FEATURE_FRED))
103105
idt_setup_apic_and_irq_gates();
104106

105107
lapic_assign_system_vectors();

0 commit comments

Comments
 (0)