From e4b8828947b1135fba411f58cac123c85bb24093 Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Mon, 11 Mar 2024 10:15:09 +0000 Subject: [PATCH] Hyper-V: vPCI: limit 64 cpus for msi/msix interrupt handling On older Hyper-V vPCI protocol version 1.1, only the first 64 cpus are able to handle msi/msix. This is true on FreeBSD 13.x and earlier releases. If MSI IRQ is assigned to cpu id greater than 63, it would lead to missing interrupts. Add check in set_interrupt_apic_ids() to only add first 64 cpus into the interrupt cpu set. Reported by: NetApp Tested by: NetApp Reviewed by: kib Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D44297 --- sys/x86/x86/mp_x86.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 1f4caf07f979..56cf7e426076 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -1184,6 +1184,13 @@ set_interrupt_apic_ids(void) !hyperthreading_intr_allowed) continue; + /* + * Currently Hyper-V only supports intr on first + * 64 cpus. + */ + if (vm_guest == VM_GUEST_HV && i > 63) + continue; + intr_add_cpu(i); } }