Message ID | 20221220063658.19271-6-xin3.li@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86: enable FRED for x86-64 | expand |
> diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h > index 46f5e4e2a346..366b1675c033 100644 > --- a/arch/x86/include/asm/traps.h > +++ b/arch/x86/include/asm/traps.h > @@ -56,4 +56,6 @@ void __noreturn handle_stack_overflow(struct pt_regs > *regs, > void f (struct pt_regs *regs) > typedef DECLARE_SYSTEM_INTERRUPT_HANDLER((*system_interrupt_handler)); > > +int exc_raise_irq(struct pt_regs *regs, u32 vector); > + > #endif /* _ASM_X86_TRAPS_H */ > diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c > index c35dd2b4d146..99386836b02e 100644 > --- a/arch/x86/kernel/traps.c > +++ b/arch/x86/kernel/traps.c > @@ -1536,6 +1536,24 @@ int external_interrupt(struct pt_regs *regs, unsigned > int vector) > return 0; > } > > +#if IS_ENABLED(CONFIG_KVM_INTEL) > +/* > + * KVM VMX reinjects IRQ on its current stack, it's a sync call > + * thus the values in the pt_regs structure are not used in > + * executing IRQ handlers, except cs.RPL and flags.IF, which > + * are both always 0 in the VMX IRQ reinjection context. > + * > + * However, the pt_regs structure is sometimes used in stack > + * dump, e.g., show_regs(). So let the caller, i.e., KVM VMX > + * decide how to initialize the input pt_regs structure. > + */ > +int exc_raise_irq(struct pt_regs *regs, u32 vector) > +{ > + return external_interrupt(regs, vector); > +} > +EXPORT_SYMBOL_GPL(exc_raise_irq); > +#endif Maybe it's better to simply export external_interrupt() +EXPORT_SYMBOL_GPL(external_interrupt); Then I don't need to add exc_raise_irq(). > + > void __init trap_init(void) > { > /* Init cpu_entry_area before IST entries are set up */ > -- > 2.34.1
diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h index 46f5e4e2a346..366b1675c033 100644 --- a/arch/x86/include/asm/traps.h +++ b/arch/x86/include/asm/traps.h @@ -56,4 +56,6 @@ void __noreturn handle_stack_overflow(struct pt_regs *regs, void f (struct pt_regs *regs) typedef DECLARE_SYSTEM_INTERRUPT_HANDLER((*system_interrupt_handler)); +int exc_raise_irq(struct pt_regs *regs, u32 vector); + #endif /* _ASM_X86_TRAPS_H */ diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index c35dd2b4d146..99386836b02e 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c @@ -1536,6 +1536,24 @@ int external_interrupt(struct pt_regs *regs, unsigned int vector) return 0; } +#if IS_ENABLED(CONFIG_KVM_INTEL) +/* + * KVM VMX reinjects IRQ on its current stack, it's a sync call + * thus the values in the pt_regs structure are not used in + * executing IRQ handlers, except cs.RPL and flags.IF, which + * are both always 0 in the VMX IRQ reinjection context. + * + * However, the pt_regs structure is sometimes used in stack + * dump, e.g., show_regs(). So let the caller, i.e., KVM VMX + * decide how to initialize the input pt_regs structure. + */ +int exc_raise_irq(struct pt_regs *regs, u32 vector) +{ + return external_interrupt(regs, vector); +} +EXPORT_SYMBOL_GPL(exc_raise_irq); +#endif + void __init trap_init(void) { /* Init cpu_entry_area before IST entries are set up */
To eliminate dispatching IRQ through the IDT, add exc_raise_irq(), which calls external_interrupt() for IRQ reinjection. Signed-off-by: Xin Li <xin3.li@intel.com> --- arch/x86/include/asm/traps.h | 2 ++ arch/x86/kernel/traps.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+)