X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts
Subsystems (2)
PATCH 1/1 X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts
--- arch/x86/include/asm/irq_vectors.h | 2 + arch/x86/include/asm/mshyperv.h | 4 +++ arch/x86/kernel/cpu/mshyperv.c | 39 ++++++++++++++++++++++++++++++++++++ arch/x86/kernel/entry_32.S | 7 ++++++ arch/x86/kernel/entry_64.S | 5 ++++ 5 files changed, 57 insertions(+), 0 deletions(-)
arch/x86/include/asm/irq_vectors.h +2 -0
@@ -112,6 +112,8 @@/* Xen vector callback to receive events in a HVM domain */ #define XEN_HVM_EVTCHN_CALLBACK 0xf3 +/* Hyper-V vector callback to receive vmbus interrupts*/ +#define HYPER_V_CALLBACK_VECTOR 0xf2/* * Local APIC timer IRQ vector is on a different priority level, * to work around the 'lost local interrupt if more than 2 IRQ
arch/x86/include/asm/mshyperv.h +4 -0
@@ -11,4 +11,8 @@ struct ms_hyperv_info {extern struct ms_hyperv_info ms_hyperv; +void hyperv_callback_vector (void ); +void hyperv_vector_handler (struct pt_regs *regs); +void hv_register_vmbus_handler (int irq,irq_handler_t handler); +#endif
arch/x86/kernel/cpu/mshyperv.c +39 -0
@@ -14,10 +14,15 @@#include <linux/time.h> #include <linux/clocksource.h> #include <linux/module.h> +#include <linux/hardirq.h> +#include <linux/interrupt.h> #include <asm/processor.h> #include <asm/hypervisor.h> #include <asm/hyperv.h> #include <asm/mshyperv.h> +#include <asm/desc.h> +#include <asm/idle.h> +#include <asm/irq_regs.h> struct ms_hyperv_info ms_hyperv;EXPORT_SYMBOL_GPL (ms_hyperv);
@@ -69,6 +74,11 @@ static void __init ms_hyperv_init_platform(void) ms_hyperv.features, ms_hyperv.hints);clocksource_register_hz (&hyperv_cs,NSEC_PER_SEC /100 ); + +/* +* Setup the IDT for hypervisor callback. +*/ +alloc_intr_gate (HYPER_V_CALLBACK_VECTOR , hyperv_callback_vector); }const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
@@ -77,3 +87,32 @@ const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { .init_platform = ms_hyperv_init_platform, };EXPORT_SYMBOL (x86_hyper_ms_hyperv); + +static int vmbus_irq; +static irq_handler_t vmbus_isr; + +void hv_register_vmbus_handler (int irq,irq_handler_t handler) +{ + vmbus_irq = irq; + vmbus_isr = handler; +} +EXPORT_SYMBOL_GPL (hv_register_vmbus_handler); + +void hyperv_vector_handler (struct pt_regs *regs) +{ +struct pt_regs *old_regs =set_irq_regs (regs); +struct irq_desc *desc; + +irq_enter (); +#ifdef CONFIG_X86 +exit_idle (); +#endif + + desc =irq_to_desc (vmbus_irq); + +if (desc) +generic_handle_irq_desc (vmbus_irq, desc); + +irq_exit (); +set_irq_regs (old_regs); +}
arch/x86/kernel/entry_32.S +7 -0
@@ -1052,6 +1052,13 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK, #endif /* CONFIG_XEN */ +#if IS_ENABLED(CONFIG_HYPERV) + +BUILD_INTERRUPT3(hyperv_callback_vector, HYPER_V_CALLBACK_VECTOR, + hyperv_vector_handler) + +#endif /* CONFIG_HYPERV */ + #ifdef CONFIG_FUNCTION_TRACER #ifdef CONFIG_DYNAMIC_FTRACE
arch/x86/kernel/entry_64.S +5 -0
@@ -1451,6 +1451,11 @@ apicinterrupt XEN_HVM_EVTCHN_CALLBACK \ #endif /* CONFIG_XEN */ +#if IS_ENABLED(CONFIG_HYPERV) +apicinterrupt HYPER_V_CALLBACK_VECTOR \ + hyperv_callback_vector hyperv_vector_handler +#endif /* CONFIG_HYPERV */ + /* * Some functions should be protected against kprobes */
Signature · 1 line
1.7.4.1
Quoted 2 lines · K. Y. Srinivasan
Signed-off-by K. Y. Srinivasan <[email protected]>
No changelog entry describing the patch?
Quoted 7 lines
--- arch/x86/include/asm/irq_vectors.h | 2 + arch/x86/include/asm/mshyperv.h | 4 +++ arch/x86/kernel/cpu/mshyperv.c | 39 ++++++++++++++++++++++++++++++++++++ arch/x86/kernel/entry_32.S | 7 ++++++ arch/x86/kernel/entry_64.S | 5 ++++ 5 files changed, 57 insertions(+), 0 deletions(-)
This patch needs to go through the x86 maintainers, which you didn't include all of on the To: line, any reason why?
greg k-h
Quoted 11 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, January 17, 2013 7:24 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts
Quoted 5 lines
Quoted 2 lines · K. Y. Srinivasan
Signed-off-by K. Y. Srinivasan <[email protected]>No changelog entry describing the patch?
I sent the wrong version of the patch by mistake. I will send the one with the changelog shortly.
Quoted 5 lines
Quoted 5 lines
--- arch/x86/include/asm/irq_vectors.h | 2 + arch/x86/include/asm/mshyperv.h | 4 +++ arch/x86/kernel/cpu/mshyperv.c | 39
Quoted 7 lines
++++++++++++++++++++++++++++++++++++
Quoted 3 lines
arch/x86/kernel/entry_32.S | 7 ++++++ arch/x86/kernel/entry_64.S | 5 ++++ 5 files changed, 57 insertions(+), 0 deletions(-)This patch needs to go through the x86 maintainers, which you didn't include all of on the To: line, any reason why?
I have included Thomas as this was an interrupt related patch. I will however include x86 maintainers when I resend with the change log.
Thank you,
K. Y
Borislav Petkov
maintainerQuoted 15 lines · K. Y. Srinivasan
Signed-off-by K. Y. Srinivasan <[email protected]>--- arch/x86/include/asm/irq_vectors.h | 2 + arch/x86/include/asm/mshyperv.h | 4 +++ arch/x86/kernel/cpu/mshyperv.c | 39 ++++++++++++++++++++++++++++++++++++ arch/x86/kernel/entry_32.S | 7 ++++++ arch/x86/kernel/entry_64.S | 5 ++++ 5 files changed, 57 insertions(+), 0 deletions(-)arch/x86/include/asm/irq_vectors.h +0
-0
arch/x86/include/asm/irq_vectors.h line 116
Quoted 5 lines
arch/x86/include/asm/irq_vectors.h +2
-0@@ -112,6 +112,8 @@/* Xen vector callback to receive events in a HVM domain */ #define XEN_HVM_EVTCHN_CALLBACK 0xf3 +/* Hyper-V vector callback to receive vmbus interrupts*/ +#define HYPER_V_CALLBACK_VECTOR 0xf2
Btw, could those hypervisor vectors be merged into one VIRT_INTR_VECTOR and be shared between the hypervisors? I mean, you can't have a xen and hyperv hypervisor running next to each other and fihgting over that vector, right?
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Quoted 33 lines
-----Original Message-----
From: Borislav Petkov [mailto:[email protected]]
Sent: Friday, January 18, 2013 8:11 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; H. Peter Anvin; Ingo Molnar
Subject: Re: [PATCH 1/1] X86: Handle Hyper-V vmbus interrupts as special hypervisor interruptsQuoted 6 lines · K. Y. Srinivasan
Signed-off-by K. Y. Srinivasan <[email protected]>--- arch/x86/include/asm/irq_vectors.h | 2 + arch/x86/include/asm/mshyperv.h | 4 +++ arch/x86/kernel/cpu/mshyperv.c | 39++++++++++++++++++++++++++++++++++++
Review
Quoted 5 lines
arch/x86/kernel/entry_32.S | 7 ++++++ arch/x86/kernel/entry_64.S | 5 ++++ 5 files changed, 57 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/arch/x86/include/asm/irq_vectors.hQuoted 7 lines
index 1508e51..c2ff239 100644
arch/x86/include/asm/irq_vectors.h +0
-0@@ -112,6 +112,8 @@/* Xen vector callback to receive events in a HVM domain */ #define XEN_HVM_EVTCHN_CALLBACK 0xf3
Quoted 7 lines
arch/x86/include/asm/irq_vectors.h line 116
Quoted 2 lines
arch/x86/include/asm/irq_vectors.h +2
-0+/* Hyper-V vector callback to receive vmbus interrupts*/ +#define HYPER_V_CALLBACK_VECTOR 0xf2Btw, could those hypervisor vectors be merged into one
VIRT_INTR_VECTORand be shared between the hypervisors? I mean, you can't have a xen and hyperv hypervisor running next to each other and fihgting over that vector, right?
You are right; we could just have one vector for this. Let me wait for other comments and input from Xen maintainers before I make this change.
Regards,
K. Y
Quoted 8 lines
--
Regards/Gruss,
Boris.Sent from a fat crate under my desk. Formatting is fine. --
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 41 lines · KY Srinivasan
Quoted 33 lines
-----Original Message-----
From: Borislav Petkov [mailto:[email protected]]
Sent: Friday, January 18, 2013 8:11 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; H. Peter Anvin; Ingo Molnar
Subject: Re: [PATCH 1/1] X86: Handle Hyper-V vmbus interrupts as special hypervisor interruptsQuoted 6 lines · K. Y. Srinivasan
Signed-off-by K. Y. Srinivasan <[email protected]>--- arch/x86/include/asm/irq_vectors.h | 2 + arch/x86/include/asm/mshyperv.h | 4 +++ arch/x86/kernel/cpu/mshyperv.c | 39++++++++++++++++++++++++++++++++++++
Review
Quoted 5 lines
arch/x86/kernel/entry_32.S | 7 ++++++ arch/x86/kernel/entry_64.S | 5 ++++ 5 files changed, 57 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/arch/x86/include/asm/irq_vectors.hQuoted 7 lines
index 1508e51..c2ff239 100644
arch/x86/include/asm/irq_vectors.h +0
-0@@ -112,6 +112,8 @@/* Xen vector callback to receive events in a HVM domain */ #define XEN_HVM_EVTCHN_CALLBACK 0xf3Quoted 7 lines
arch/x86/include/asm/irq_vectors.h line 116
Quoted 2 lines
arch/x86/include/asm/irq_vectors.h +2
-0+/* Hyper-V vector callback to receive vmbus interrupts*/ +#define HYPER_V_CALLBACK_VECTOR 0xf2Btw, could those hypervisor vectors be merged into one
VIRT_INTR_VECTORand be shared between the hypervisors? I mean, you can't have a xen and hyperv hypervisor running next to each other and fihgting over that vector, right?
Quoted 5 lines
You are right; we could just have one vector for this. Let me wait for other comments and input from Xen maintainers before I make this change.
Regards,
Looks OK to me.
Quoted 10 lines
K. Y
Quoted 8 lines
--
Regards/Gruss,
Boris.Sent from a fat crate under my desk. Formatting is fine. --
H. Peter Anvin
reviewerYes, how about we rename this the hypervisor vector...
Quoted 65 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · KY Srinivasan
Quoted 9 lines
-----Original Message-----
From: Borislav Petkov [mailto:[email protected]]
Sent: Friday, January 18, 2013 8:11 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; H. Peter Anvin; IngoMolnar
Quoted 1 line
Quoted 1 line
Subject: Re: [PATCH 1/1] X86: Handle Hyper-V vmbus interrupts as
special
Quoted 23 lines
Quoted 23 lines
hypervisor interrupts
Quoted 6 lines · K. Y. Srinivasan
Signed-off-by K. Y. Srinivasan <[email protected]>--- arch/x86/include/asm/irq_vectors.h | 2 + arch/x86/include/asm/mshyperv.h | 4 +++ arch/x86/kernel/cpu/mshyperv.c | 39++++++++++++++++++++++++++++++++++++
Review
Quoted 5 lines
arch/x86/kernel/entry_32.S | 7 ++++++ arch/x86/kernel/entry_64.S | 5 ++++ 5 files changed, 57 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/arch/x86/include/asm/irq_vectors.hQuoted 7 lines
index 1508e51..c2ff239 100644
arch/x86/include/asm/irq_vectors.h +0
-0@@ -112,6 +112,8 @@/* Xen vector callback to receive events in a HVM domain */ #define XEN_HVM_EVTCHN_CALLBACK 0xf3Quoted 4 lines
Quoted 4 lines
arch/x86/include/asm/irq_vectors.h line 116
Quoted 2 lines
arch/x86/include/asm/irq_vectors.h +2
-0+/* Hyper-V vector callback to receive vmbus interrupts*/ +#define HYPER_V_CALLBACK_VECTOR 0xf2Btw, could those hypervisor vectors be merged into one
VIRT_INTR_VECTORQuoted 1 line
Quoted 1 line
and be shared between the hypervisors? I mean, you can't have a xen
and
Quoted 4 lines
Quoted 2 lines
hyperv hypervisor running next to each other and fihgting over that vector, right?
You are right; we could just have one vector for this. Let me wait
for other comments and
Quoted 4 lines
input from Xen maintainers before I make this change.
Regards,
Looks OK to me.
Quoted 10 lines
K. Y
Quoted 8 lines
--
Regards/Gruss,
Boris.Sent from a fat crate under my desk. Formatting is fine. --
Signature · 1 line
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
Quoted 1 line · H. Peter Anvin
Yes, how about we rename this the hypervisor vector...
HYPERVISOR_CALLBACK_VECTOR ?
H. Peter Anvin
reviewerSounds good to me.
Quoted 4 lines · Konrad Rzeszutek Wilk
Quoted 1 line · H. Peter Anvin
Yes, how about we rename this the hypervisor vector...
HYPERVISOR_CALLBACK_VECTOR?
Signature · 1 line
Sent from my mobile phone. Please excuse brevity and lack of formatting.
Quoted 13 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: Wednesday, January 23, 2013 10:37 AM
To: H. Peter Anvin
Cc: KY Srinivasan; Borislav Petkov; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Ingo Molnar; [email protected]; Jan Beulich ([email protected])
Subject: Re: [PATCH 1/1] X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts
Quoted 4 lines
Quoted 1 line · H. Peter Anvin
Yes, how about we rename this the hypervisor vector...
HYPERVISOR_CALLBACK_VECTOR?
Thanks Konrad. I will update the patch and send it out shortly.
Regards,
K. Y
Quoted 1 line
Quoted 13 lines
-----Original Message-----
From: H. Peter Anvin [mailto:[email protected]]
Sent: Tuesday, January 22, 2013 6:20 PM
To: Konrad Rzeszutek Wilk; KY Srinivasan
Cc: Borislav Petkov; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Ingo Molnar; [email protected]; Jan Beulich ([email protected])
Subject: Re: [PATCH 1/1] X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts
Quoted 1 line
Yes, how about we rename this the hypervisor vector...
Will do.
K. Y
Quoted 64 lines
Quoted 61 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · KY Srinivasan
Quoted 9 lines
-----Original Message-----
From: Borislav Petkov [mailto:[email protected]]
Sent: Friday, January 18, 2013 8:11 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; H. Peter Anvin; IngoMolnar
Quoted 1 line
Quoted 1 line
Subject: Re: [PATCH 1/1] X86: Handle Hyper-V vmbus interrupts as
special
Quoted 23 lines
Quoted 23 lines
hypervisor interrupts
Quoted 6 lines · K. Y. Srinivasan
Signed-off-by K. Y. Srinivasan <[email protected]>--- arch/x86/include/asm/irq_vectors.h | 2 + arch/x86/include/asm/mshyperv.h | 4 +++ arch/x86/kernel/cpu/mshyperv.c | 39++++++++++++++++++++++++++++++++++++
Review
Quoted 5 lines
arch/x86/kernel/entry_32.S | 7 ++++++ arch/x86/kernel/entry_64.S | 5 ++++ 5 files changed, 57 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/arch/x86/include/asm/irq_vectors.hQuoted 7 lines
index 1508e51..c2ff239 100644
arch/x86/include/asm/irq_vectors.h +0
-0@@ -112,6 +112,8 @@/* Xen vector callback to receive events in a HVM domain */ #define XEN_HVM_EVTCHN_CALLBACK 0xf3Quoted 4 lines
Quoted 4 lines
arch/x86/include/asm/irq_vectors.h line 116
Quoted 2 lines
arch/x86/include/asm/irq_vectors.h +2
-0+/* Hyper-V vector callback to receive vmbus interrupts*/ +#define HYPER_V_CALLBACK_VECTOR 0xf2Btw, could those hypervisor vectors be merged into one
VIRT_INTR_VECTORQuoted 1 line
Quoted 1 line
and be shared between the hypervisors? I mean, you can't have a xen
and
Quoted 4 lines
Quoted 2 lines
hyperv hypervisor running next to each other and fihgting over that vector, right?
You are right; we could just have one vector for this. Let me wait
for other comments and
Quoted 4 lines
input from Xen maintainers before I make this change.
Regards,
Looks OK to me.
Quoted 6 lines
K. Y
Quoted 5 lines
--
Regards/Gruss,
Boris.
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Sent from a fat crate under my desk. Formatting is fine. --
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�