Skip to content

Commit e2575ff

Browse files
NunoDasNevesliuw
authored andcommitted
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>
1 parent 04df7ac commit e2575ff

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

arch/x86/kernel/cpu/mshyperv.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ void hv_set_msr(unsigned int reg, u64 value)
107107
}
108108
EXPORT_SYMBOL_GPL(hv_set_msr);
109109

110+
static void (*mshv_handler)(void);
110111
static void (*vmbus_handler)(void);
111112
static void (*hv_stimer0_handler)(void);
112113
static void (*hv_kexec_handler)(void);
@@ -117,6 +118,9 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_hyperv_callback)
117118
struct pt_regs *old_regs = set_irq_regs(regs);
118119

119120
inc_irq_stat(irq_hv_callback_count);
121+
if (mshv_handler)
122+
mshv_handler();
123+
120124
if (vmbus_handler)
121125
vmbus_handler();
122126

@@ -126,6 +130,11 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_hyperv_callback)
126130
set_irq_regs(old_regs);
127131
}
128132

133+
void hv_setup_mshv_handler(void (*handler)(void))
134+
{
135+
mshv_handler = handler;
136+
}
137+
129138
void hv_setup_vmbus_handler(void (*handler)(void))
130139
{
131140
vmbus_handler = handler;

drivers/hv/hv_common.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,11 @@ void __weak hv_remove_vmbus_handler(void)
680680
}
681681
EXPORT_SYMBOL_GPL(hv_remove_vmbus_handler);
682682

683+
void __weak hv_setup_mshv_handler(void (*handler)(void))
684+
{
685+
}
686+
EXPORT_SYMBOL_GPL(hv_setup_mshv_handler);
687+
683688
void __weak hv_setup_kexec_handler(void (*handler)(void))
684689
{
685690
}

include/asm-generic/mshyperv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ void hv_setup_kexec_handler(void (*handler)(void));
208208
void hv_remove_kexec_handler(void);
209209
void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs));
210210
void hv_remove_crash_handler(void);
211+
void hv_setup_mshv_handler(void (*handler)(void));
211212

212213
extern int vmbus_interrupt;
213214
extern int vmbus_irq;

0 commit comments

Comments
 (0)