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: Add mshv_handler() irq handler and setup function

Add mshv_handler() to process messages related to managing guest
partitions such as intercepts, doorbells, and scheduling messages.

In a (non-nested) root partition, the same interrupt vector is shared
between the vmbus and mshv_root drivers.

Introduce a stub for mshv_handler() and call it in
sysvec_hyperv_callback alongside vmbus_handler().

Even though both handlers will be called for every Hyper-V interrupt,
the messages for each driver are delivered to different offsets
within the SYNIC message page, so they won't step on each other.

Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
Reviewed-by: Wei Liu <wei.liu@kernel.org>
Reviewed-by: Tianyu Lan <tiala@microsoft.com>
Reviewed-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Link: https://lore.kernel.org/r/1741980536-3865-9-git-send-email-nunodasneves@linux.microsoft.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <1741980536-3865-9-git-send-email-nunodasneves@linux.microsoft.com>

authored by

Nuno Das Neves and committed by
Wei Liu
e2575ffe 04df7ac3

+15
+9
arch/x86/kernel/cpu/mshyperv.c
··· 107 107 } 108 108 EXPORT_SYMBOL_GPL(hv_set_msr); 109 109 110 + static void (*mshv_handler)(void); 110 111 static void (*vmbus_handler)(void); 111 112 static void (*hv_stimer0_handler)(void); 112 113 static void (*hv_kexec_handler)(void); ··· 118 117 struct pt_regs *old_regs = set_irq_regs(regs); 119 118 120 119 inc_irq_stat(irq_hv_callback_count); 120 + if (mshv_handler) 121 + mshv_handler(); 122 + 121 123 if (vmbus_handler) 122 124 vmbus_handler(); 123 125 ··· 128 124 apic_eoi(); 129 125 130 126 set_irq_regs(old_regs); 127 + } 128 + 129 + void hv_setup_mshv_handler(void (*handler)(void)) 130 + { 131 + mshv_handler = handler; 131 132 } 132 133 133 134 void hv_setup_vmbus_handler(void (*handler)(void))
+5
drivers/hv/hv_common.c
··· 680 680 } 681 681 EXPORT_SYMBOL_GPL(hv_remove_vmbus_handler); 682 682 683 + void __weak hv_setup_mshv_handler(void (*handler)(void)) 684 + { 685 + } 686 + EXPORT_SYMBOL_GPL(hv_setup_mshv_handler); 687 + 683 688 void __weak hv_setup_kexec_handler(void (*handler)(void)) 684 689 { 685 690 }
+1
include/asm-generic/mshyperv.h
··· 208 208 void hv_remove_kexec_handler(void); 209 209 void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs)); 210 210 void hv_remove_crash_handler(void); 211 + void hv_setup_mshv_handler(void (*handler)(void)); 211 212 212 213 extern int vmbus_interrupt; 213 214 extern int vmbus_irq;