diff options
| author | Wei Hu <whu@FreeBSD.org> | 2024-03-08 10:00:25 +0000 |
|---|---|---|
| committer | Wei Hu <whu@FreeBSD.org> | 2024-03-08 10:16:10 +0000 |
| commit | 999174ba03642fa63c9654752993a62db461afc9 (patch) | |
| tree | d7905e3372eb11995f499c83c534cefdbcb82f7c /sys/dev/hyperv | |
| parent | 96ad640178ea0a8a9d1772687659dce5be18fbd9 (diff) | |
Diffstat (limited to 'sys/dev/hyperv')
| -rw-r--r-- | sys/dev/hyperv/pcib/vmbus_pcib.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/dev/hyperv/pcib/vmbus_pcib.c b/sys/dev/hyperv/pcib/vmbus_pcib.c index f7c825d1bcf9..3fa349b0c0c5 100644 --- a/sys/dev/hyperv/pcib/vmbus_pcib.c +++ b/sys/dev/hyperv/pcib/vmbus_pcib.c @@ -67,6 +67,7 @@ #if defined(__i386__) || defined(__amd64__) #include <machine/intr_machdep.h> #include <x86/apicreg.h> +#include <x86/apicvar.h> #endif #if defined(__aarch64__) #include <contrib/dev/acpica/include/acpi.h> @@ -1927,11 +1928,21 @@ vmbus_pcib_map_msi(device_t pcib, device_t child, int irq, vcpu_id = VMBUS_GET_VCPU_ID(device_get_parent(pcib), pcib, cpu); vector = v_data; #else - cpu = (v_addr & MSI_INTEL_ADDR_DEST) >> 12; + cpu = apic_cpuid((v_addr & MSI_INTEL_ADDR_DEST) >> 12); vcpu_id = VMBUS_GET_VCPU_ID(device_get_parent(pcib), pcib, cpu); vector = v_data & MSI_INTEL_DATA_INTVEC; #endif + if (hpdev->hbus->protocol_version < PCI_PROTOCOL_VERSION_1_4 && + vcpu_id > 63) { + /* We only support vcpu_id < 64 before vPCI version 1.4 */ + device_printf(pcib, + "Error: " + "vcpu_id %u overflowed on PCI VMBus version 0x%x\n", + vcpu_id, hpdev->hbus->protocol_version); + return (ENODEV); + } + init_completion(&comp.comp_pkt.host_event); memset(&ctxt, 0, sizeof(ctxt)); |
