Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/hyperv: Reserve 3 interrupt vectors used exclusively by MSHV

MSVC compiler, used to compile the Microsoft Hypervisor, currently
has an assert intrinsic that uses interrupt vector 0x29 to create an
exception. This will cause hypervisor to then crash and collect core. As
such, if this interrupt number is assigned to a device by Linux and the
device generates it, hypervisor will crash. There are two other such
vectors hard coded in the hypervisor, 0x2C and 0x2D for debug purposes.

Fortunately, the three vectors are part of the kernel driver space and
that makes it feasible to reserve them early so they are not assigned
later.

Signed-off-by: Mukesh Rathor <mrathor@linux.microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>

authored by

Mukesh Rathor and committed by
Wei Liu
fe9f1598 f8e6343b

+25
+25
arch/x86/kernel/cpu/mshyperv.c
··· 478 478 } 479 479 EXPORT_SYMBOL_GPL(hv_get_hypervisor_version); 480 480 481 + /* 482 + * Reserved vectors hard coded in the hypervisor. If used outside, the hypervisor 483 + * will either crash or hang or attempt to break into debugger. 484 + */ 485 + static void hv_reserve_irq_vectors(void) 486 + { 487 + #define HYPERV_DBG_FASTFAIL_VECTOR 0x29 488 + #define HYPERV_DBG_ASSERT_VECTOR 0x2C 489 + #define HYPERV_DBG_SERVICE_VECTOR 0x2D 490 + 491 + if (cpu_feature_enabled(X86_FEATURE_FRED)) 492 + return; 493 + 494 + if (test_and_set_bit(HYPERV_DBG_ASSERT_VECTOR, system_vectors) || 495 + test_and_set_bit(HYPERV_DBG_SERVICE_VECTOR, system_vectors) || 496 + test_and_set_bit(HYPERV_DBG_FASTFAIL_VECTOR, system_vectors)) 497 + BUG(); 498 + 499 + pr_info("Hyper-V: reserve vectors: %d %d %d\n", HYPERV_DBG_ASSERT_VECTOR, 500 + HYPERV_DBG_SERVICE_VECTOR, HYPERV_DBG_FASTFAIL_VECTOR); 501 + } 502 + 481 503 static void __init ms_hyperv_init_platform(void) 482 504 { 483 505 int hv_max_functions_eax, eax; ··· 531 509 ms_hyperv.max_vp_index, ms_hyperv.max_lp_index); 532 510 533 511 hv_identify_partition_type(); 512 + 513 + if (hv_root_partition()) 514 + hv_reserve_irq_vectors(); 534 515 535 516 if (cc_platform_has(CC_ATTR_SNP_SECURE_AVIC)) 536 517 ms_hyperv.hints |= HV_DEPRECATING_AEOI_RECOMMENDED;