linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org,
	kys@microsoft.com, tglx@linutronix.de, hpa@linux.intel.com
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/hyperv] X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts
Date: Tue, 12 Feb 2013 18:56:11 -0800	[thread overview]
Message-ID: <CAE9FiQXZRj84-fBwV4Hb0NQxcMxD1JTdsFXfyHMzaK-59TXjAg@mail.gmail.com> (raw)
In-Reply-To: <tip-bc2b0331e077f576369a2b6c75d15ed4de4ef91f@git.kernel.org>

On Tue, Feb 12, 2013 at 4:58 PM, tip-bot for K. Y. Srinivasan
<kys@microsoft.com> wrote:
> Commit-ID:  bc2b0331e077f576369a2b6c75d15ed4de4ef91f
> Gitweb:     http://git.kernel.org/tip/bc2b0331e077f576369a2b6c75d15ed4de4ef91f
> Author:     K. Y. Srinivasan <kys@microsoft.com>
> AuthorDate: Sun, 3 Feb 2013 17:22:39 -0800
> Committer:  H. Peter Anvin <hpa@linux.intel.com>
> CommitDate: Tue, 12 Feb 2013 16:27:15 -0800
>
> X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts
>
> Starting with win8, vmbus interrupts can be delivered on any VCPU in the guest
> and furthermore can be concurrently active on multiple VCPUs. Support this
> interrupt delivery model by setting up a separate IDT entry for Hyper-V vmbus.
> interrupts. I would like to thank Jan Beulich <JBeulich@suse.com> and
> Thomas Gleixner <tglx@linutronix.de>, for their help.
>
> In this version of the patch, based on the feedback, I have merged the IDT
> vector for Xen and Hyper-V and made the necessary adjustments. Furhermore,
> based on Jan's feedback I have added the necessary compilation switches.
>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Link: http://lkml.kernel.org/r/1359940959-32168-3-git-send-email-kys@microsoft.com
> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
> ---
>  arch/x86/include/asm/irq_vectors.h |  4 ++--
>  arch/x86/include/asm/mshyperv.h    |  4 ++++
>  arch/x86/kernel/cpu/mshyperv.c     | 44 ++++++++++++++++++++++++++++++++++++++
>  arch/x86/kernel/entry_32.S         |  9 +++++++-
>  arch/x86/kernel/entry_64.S         |  7 +++++-
>  drivers/xen/events.c               |  7 +++---
>  6 files changed, 68 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
> index 1508e51..aac5fa6 100644
> --- a/arch/x86/include/asm/irq_vectors.h
> +++ b/arch/x86/include/asm/irq_vectors.h
> @@ -109,8 +109,8 @@
>
>  #define UV_BAU_MESSAGE                 0xf5
>
> -/* Xen vector callback to receive events in a HVM domain */
> -#define XEN_HVM_EVTCHN_CALLBACK                0xf3
> +/* Vector on which hypervisor callbacks will be delivered */
> +#define HYPERVISOR_CALLBACK_VECTOR     0xf3
>
>  /*
>   * Local APIC timer IRQ vector is on a different priority level,
> diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
> index 79ce568..c2934be 100644
> --- a/arch/x86/include/asm/mshyperv.h
> +++ b/arch/x86/include/asm/mshyperv.h
> @@ -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
> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> index 4dab317..a7d26d8 100644
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -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);
> @@ -77,6 +82,12 @@ static void __init ms_hyperv_init_platform(void)
>
>         if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
>                 clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100);
> +#if IS_ENABLED(CONFIG_HYPERV)
> +       /*
> +        * Setup the IDT for hypervisor callback.
> +        */
> +       alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector);
> +#endif
>  }
>
>  const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
> @@ -85,3 +96,36 @@ const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
>         .init_platform          = ms_hyperv_init_platform,
>  };
>  EXPORT_SYMBOL(x86_hyper_ms_hyperv);
> +
> +#if IS_ENABLED(CONFIG_HYPERV)
> +static int vmbus_irq = -1;
> +static irq_handler_t vmbus_isr;
> +
> +void hv_register_vmbus_handler(int irq, irq_handler_t handler)
> +{
> +       vmbus_irq = irq;
> +       vmbus_isr = handler;
> +}
> +
> +void hyperv_vector_handler(struct pt_regs *regs)
> +{
> +       struct pt_regs *old_regs = set_irq_regs(regs);
> +       struct irq_desc *desc;
> +
> +       irq_enter();
> +       exit_idle();
> +
> +       desc = irq_to_desc(vmbus_irq);
> +
> +       if (desc)
> +               generic_handle_irq_desc(vmbus_irq, desc);
> +
> +       irq_exit();
> +       set_irq_regs(old_regs);
> +}
> +#else
> +void hv_register_vmbus_handler(int irq, irq_handler_t handler)
> +{
> +}
> +#endif
> +EXPORT_SYMBOL_GPL(hv_register_vmbus_handler);
> diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
> index 6ed91d9..8831176 100644
> --- a/arch/x86/kernel/entry_32.S
> +++ b/arch/x86/kernel/entry_32.S
> @@ -1091,11 +1091,18 @@ ENTRY(xen_failsafe_callback)
>         _ASM_EXTABLE(4b,9b)
>  ENDPROC(xen_failsafe_callback)
>
> -BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK,
> +BUILD_INTERRUPT3(xen_hvm_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
>                 xen_evtchn_do_upcall)
>
>  #endif /* CONFIG_XEN */
>
> +#if IS_ENABLED(CONFIG_HYPERV)
> +
> +BUILD_INTERRUPT3(hyperv_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
> +       hyperv_vector_handler)
> +
> +#endif /* CONFIG_HYPERV */
> +
>  #ifdef CONFIG_FUNCTION_TRACER
>  #ifdef CONFIG_DYNAMIC_FTRACE
>
> diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
> index cb3c591..048f224 100644
> --- a/arch/x86/kernel/entry_64.S
> +++ b/arch/x86/kernel/entry_64.S
> @@ -1454,11 +1454,16 @@ ENTRY(xen_failsafe_callback)
>         CFI_ENDPROC
>  END(xen_failsafe_callback)
>
> -apicinterrupt XEN_HVM_EVTCHN_CALLBACK \
> +apicinterrupt HYPERVISOR_CALLBACK_VECTOR \
>         xen_hvm_callback_vector xen_evtchn_do_upcall
>
>  #endif /* CONFIG_XEN */
>
> +#if IS_ENABLED(CONFIG_HYPERV)
> +apicinterrupt HYPERVISOR_CALLBACK_VECTOR \
> +       hyperv_callback_vector hyperv_vector_handler
> +#endif /* CONFIG_HYPERV */
> +

so #ifdef CONFIG_HYPERV does not work here?

Yinghai

  parent reply	other threads:[~2013-02-13  2:56 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04  1:21 [PATCH 0/3] X86: Deliver Hyper-V interrupts on a seperate IDT vector K. Y. Srinivasan
2013-02-04  1:22 ` [PATCH 1/3] x86: Hyper-V: register clocksource only if its advertised K. Y. Srinivasan
2013-02-04  1:22   ` [PATCH 2/3] X86: Add a check to catch Xen emulation of Hyper-V K. Y. Srinivasan
2013-02-13  0:57     ` [tip:x86/hyperv] " tip-bot for K. Y. Srinivasan
2013-04-17  7:06     ` [PATCH 2/3] " Michael S. Tsirkin
2013-04-17  9:10       ` KVM "Hyper-V emulation" -- this can be related "Linux on Hyper-V" ? Or "KVM emulates Hyper-V" as "Hyper-V emulates Hyper-V" ? " Victor Miasnikov
2013-04-17 10:16         ` Michael S. Tsirkin
2013-04-17 12:12           ` Jan Beulich
2013-04-17 12:15             ` Michael S. Tsirkin
     [not found]             ` <CAP2xkNqGgbYz1gdS85xjA8gwROGY89fAsiaRiGSE90xnzjJ4Xw@mail.gmail.com>
2013-04-17 12:43               ` Michael S. Tsirkin
2013-04-17 14:08                 ` Victor Miasnikov
2013-04-17 13:20       ` KY Srinivasan
2013-04-17 12:48         ` Michael S. Tsirkin
2013-04-17 14:12           ` KY Srinivasan
2013-04-17 13:25             ` Michael S. Tsirkin
2013-04-17 14:34               ` KY Srinivasan
2013-04-17 13:48                 ` Michael S. Tsirkin
2013-04-17 15:31                   ` KY Srinivasan
2013-04-17 15:50                     ` Jan Beulich
2013-04-17 16:28                       ` KY Srinivasan
2013-04-18  7:48                         ` Michael S. Tsirkin
2013-04-18 13:23                           ` KY Srinivasan
2013-04-18 13:30                             ` KY Srinivasan
2013-04-17 13:52         ` Jan Beulich
2013-04-17 13:01           ` Michael S. Tsirkin
2013-04-17 13:11             ` Michael S. Tsirkin
2013-04-17 14:09             ` Jan Beulich
2013-04-17 15:17               ` H. Peter Anvin
2013-02-04  1:22   ` [PATCH 3/3] X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts K. Y. Srinivasan
2013-02-13  0:58     ` [tip:x86/hyperv] " tip-bot for K. Y. Srinivasan
2013-02-13  1:58       ` [tip:x86/hyperv] x86, hyperv: HYPERV depends on X86_LOCAL_APIC tip-bot for H. Peter Anvin
2013-02-13  2:05         ` KY Srinivasan
2013-02-13  2:56       ` Yinghai Lu [this message]
2013-02-13  3:32         ` [tip:x86/hyperv] X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts KY Srinivasan
2013-02-13  3:46           ` H. Peter Anvin
2013-02-13  3:49             ` KY Srinivasan
2013-02-13  3:54               ` H. Peter Anvin
2013-02-13  3:58                 ` KY Srinivasan
2013-02-13  4:42                   ` Yinghai Lu
2013-02-13 12:47                     ` KY Srinivasan
2013-02-13  0:56   ` [tip:x86/hyperv] x86: Hyper-V: register clocksource only if its advertised tip-bot for Olaf Hering
2013-02-05 11:16 ` [PATCH 0/3] X86: Deliver Hyper-V interrupts on a seperate IDT vector KY Srinivasan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAE9FiQXZRj84-fBwV4Hb0NQxcMxD1JTdsFXfyHMzaK-59TXjAg@mail.gmail.com \
    --to=yinghai@kernel.org \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).