On Mon, Mar 24, 2025, Mingwei Zhang wrote:
> diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h
> index ad5c68f0509d..b0cb3220e1bb 100644
> --- a/arch/x86/include/asm/idtentry.h
> +++ b/arch/x86/include/asm/idtentry.h
> @@ -745,6 +745,7 @@ DECLARE_IDTENTRY_SYSVEC(IRQ_WORK_VECTOR,
> sysvec_irq_work);
> DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_VECTOR,
> sysvec_kvm_posted_intr_ipi);
> DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_WAKEUP_VECTOR,
> sysvec_kvm_posted_intr_wakeup_ipi);
> DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_NESTED_VECTOR,
> sysvec_kvm_posted_intr_nested_ipi);
> +DECLARE_IDTENTRY_SYSVEC(KVM_GUEST_PMI_VECTOR,
> sysvec_kvm_guest_pmi_handler);
I would prefer to keep KVM out of the name, and as mentioned in the previous
patch,
route this through perf.
> #else
> # define fred_sysvec_kvm_posted_intr_ipi NULL
> # define fred_sysvec_kvm_posted_intr_wakeup_ipi NULL
Y'all forgot to wire up the FRED handling. I.e. the mediated PMI IRQs would get
treated as spurious when running with FRED.
> diff --git a/arch/x86/include/asm/irq_vectors.h
> b/arch/x86/include/asm/irq_vectors.h
> index 47051871b436..250cdab11306 100644
> --- a/arch/x86/include/asm/irq_vectors.h
> +++ b/arch/x86/include/asm/irq_vectors.h
> @@ -77,7 +77,10 @@
> */
> #define IRQ_WORK_VECTOR 0xf6
>
> -/* 0xf5 - unused, was UV_BAU_MESSAGE */
> +#if IS_ENABLED(CONFIG_KVM)
> +#define KVM_GUEST_PMI_VECTOR 0xf5
> +#endif
Conditionally defining the vector sounds good on paper, but its problematic,
e.g.
for connecting the handler to FRED's array, and doesn't really add much value.
> #define DEFERRED_ERROR_VECTOR 0xf4
>
> /* Vector on which hypervisor callbacks will be delivered */
> diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c
> index f445bec516a0..0bec4c7e2308 100644
> --- a/arch/x86/kernel/idt.c
> +++ b/arch/x86/kernel/idt.c
> @@ -157,6 +157,7 @@ static const __initconst struct idt_data apic_idts[] = {
> INTG(POSTED_INTR_VECTOR, asm_sysvec_kvm_posted_intr_ipi),
> INTG(POSTED_INTR_WAKEUP_VECTOR,
> asm_sysvec_kvm_posted_intr_wakeup_ipi),
> INTG(POSTED_INTR_NESTED_VECTOR,
> asm_sysvec_kvm_posted_intr_nested_ipi),