From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Sheng Yang <sheng@linux.intel.com>
Cc: Keir Fraser <keir.fraser@eu.citrix.com>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
xen-devel <xen-devel@lists.xensource.com>,
Eddie Dong <eddie.dong@intel.com>,
linux-kernel@vger.kernel.org,
Jun Nakajima <jun.nakajima@intel.com>
Subject: Re: [Xen-devel] [RFC][PATCH 09/10] xen/hybrid: Make event channel work with QEmu emulated devices
Date: Wed, 16 Sep 2009 13:35:06 -0700 [thread overview]
Message-ID: <4AB14BFA.4010509@goop.org> (raw)
In-Reply-To: <1253090551-7969-10-git-send-email-sheng@linux.intel.com>
On 09/16/09 01:42, Sheng Yang wrote:
> We mapped each IOAPIC pin to a VIRQ, so that we can deliver interrupt through
> these VIRQs.
>
> We also use GENERIC_INTERRUPT_VECTOR as the noficiation vector for hypervisor
> to notify guest about the event.
>
> Then we don't need IOAPIC/LAPIC now...
>
I commented a bit more below, but this patch is pretty unpleasant. It
certainly can't be used in this form.
> Signed-off-by: Sheng Yang <sheng@linux.intel.com>
> ---
> arch/x86/kernel/smpboot.c | 14 ++++++++++++
> arch/x86/xen/enlighten.c | 49 +++++++++++++++++++++++++++++++++++++++++++
> arch/x86/xen/irq.c | 15 +++++++++++-
> drivers/xen/events.c | 47 +++++++++++++++++++++++++++++++++++++++++
> include/xen/events.h | 1 +
> include/xen/hvm.h | 5 ++++
> include/xen/interface/xen.h | 6 ++++-
> 7 files changed, 134 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index 58d24ef..39c1890 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -67,6 +67,10 @@
>
> #include <asm/smpboot_hooks.h>
>
> +#ifdef CONFIG_XEN
> +#include <asm/xen/hypervisor.h>
> +#endif
> +
> #ifdef CONFIG_X86_32
> u8 apicid_2_node[MAX_APICID];
> static int low_mappings;
> @@ -1062,6 +1066,11 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
> }
> set_cpu_sibling_map(0);
>
> +#ifdef CONFIG_XEN
> + if (xen_hybrid_evtchn_enabled())
> + goto out;
> +#endif
> +
> enable_IR_x2apic();
> #ifdef CONFIG_X86_64
> default_setup_apic_routing();
> @@ -1131,6 +1140,11 @@ void __init native_smp_cpus_done(unsigned int max_cpus)
> {
> pr_debug("Boot done.\n");
>
> +#ifdef CONFIG_XEN
> + if (xen_hybrid_evtchn_enabled())
> + return;
> +#endif
>
These changes will never fly. I'm aggressively moving away from making
any Xen-specific changes in core files for dom0; I don't want to add any
more for a hybrid mode. (I'd really prefer not to have a hybrid mode at
all.)
> +
> impress_friends();
> #ifdef CONFIG_X86_IO_APIC
> setup_ioapic_dest();
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index 18aba22..f515584 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -54,6 +54,10 @@
> #include <asm/reboot.h>
>
> #include <xen/hvm.h>
> +#include <xen/events.h>
> +#include <asm/acpi.h>
> +#include <asm/irq_vectors.h>
> +#include <asm/irq.h>
>
> #include "xen-ops.h"
> #include "mmu.h"
> @@ -1055,6 +1059,8 @@ static void __init xen_hybrid_banner(void)
>
> if (xen_hybrid_timer_enabled())
> printk(KERN_INFO "Hybrid feature: PV Timer enabled\n");
> + if (xen_hybrid_evtchn_enabled())
> + printk(KERN_INFO "Hybrid feature: Event channel enabled\n");
> }
>
> static int xen_para_available(void)
> @@ -1102,6 +1108,10 @@ static int init_hybrid_info(void)
> xen_hybrid_status |= XEN_HYBRID_TIMER_ENABLED;
> flags |= HVM_HYBRID_TIMER;
> }
> + if (edx & XEN_CPUID_FEAT2_HYBRID_EVTCHN) {
> + xen_hybrid_status |= XEN_HYBRID_EVTCHN_ENABLED;
> + flags |= HVM_HYBRID_EVTCHN;
> + }
>
> /* We only support 1 page of hypercall for now */
> if (pages != 1)
> @@ -1144,9 +1154,27 @@ static int __init init_shared_info(void)
> return 0;
> }
>
> +static int set_callback_via(uint64_t via)
> +{
> + struct xen_hvm_param a;
> +
> + a.domid = DOMID_SELF;
> + a.index = HVM_PARAM_CALLBACK_IRQ;
> + a.value = via;
> + return HYPERVISOR_hvm_op(HVMOP_set_param, &a);
> +}
> +
> +void do_hybrid_intr(void)
> +{
> + per_cpu(irq_count, smp_processor_id())++;
> + xen_evtchn_do_upcall(get_irq_regs());
> + per_cpu(irq_count, smp_processor_id())--;
> +}
> +
> void __init xen_start_hybrid(void)
> {
> int r;
> + uint64_t callback_via;
>
> if (!xen_para_available())
> return;
> @@ -1163,5 +1191,26 @@ void __init xen_start_hybrid(void)
> pv_time_ops = xen_time_ops;
> pv_apic_ops = xen_apic_ops;
> }
> +
> + if (xen_hybrid_evtchn_enabled()) {
> + pv_apic_ops = xen_apic_ops;
> +#ifdef CONFIG_X86_LOCAL_APIC
> + /*
> + * set up the basic apic ops.
> + */
> + set_xen_basic_apic_ops();
> +#endif
> +
> + callback_via = HVM_CALLBACK_VECTOR(GENERIC_INTERRUPT_VECTOR);
> + set_callback_via(callback_via);
> +
> + generic_interrupt_extension = do_hybrid_intr;
> +
> + disable_acpi();
> + disable_apic = 1;
> +
> + machine_ops = xen_machine_ops;
> + smp_ops.smp_send_stop = paravirt_nop;
> + }
> }
>
> diff --git a/arch/x86/xen/irq.c b/arch/x86/xen/irq.c
> index 52885c1..edca1c4 100644
> --- a/arch/x86/xen/irq.c
> +++ b/arch/x86/xen/irq.c
> @@ -66,6 +66,9 @@ PV_CALLEE_SAVE_REGS_THUNK(xen_restore_fl);
>
> static void xen_irq_disable(void)
> {
> + if (xen_hybrid_evtchn_enabled())
> + asm volatile("cli" : : : "memory");
>
!!! We have pvops for a reason. If you want to override irq_disable,
define a new pvop function.
J
next prev parent reply other threads:[~2009-09-16 20:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-16 8:42 [RFC][PATCH 0/10] Xen Hybrid extension support Sheng Yang
2009-09-16 8:42 ` [RFC][PATCH 01/10] xen/pvhvm: add support for hvm_op Sheng Yang
2009-09-16 8:42 ` [RFC][PATCH 02/10] xen/hybrid: Import cpuid.h from Xen Sheng Yang
2009-09-16 8:42 ` [RFC][PATCH 03/10] xen/hybrid: Xen Hybrid Extension initialization Sheng Yang
2009-09-16 20:24 ` [Xen-devel] " Jeremy Fitzhardinge
2009-09-17 6:22 ` Keir Fraser
2009-09-17 16:46 ` Jeremy Fitzhardinge
2009-09-16 8:42 ` [RFC][PATCH 04/10] xen/hybrid: Modify pv_init_ops and xen_info Sheng Yang
2009-09-16 8:42 ` [RFC][PATCH 05/10] xen/hybrid: Add PV halt support Sheng Yang
2009-09-16 8:42 ` [RFC][PATCH 06/10] xen/hybrid: Add shared_info page for xen Sheng Yang
2009-09-16 8:42 ` [RFC][PATCH 07/10] xen/hybrid: Add PV timer support Sheng Yang
2009-09-16 20:25 ` [Xen-devel] " Jeremy Fitzhardinge
2009-09-17 5:54 ` Sheng Yang
2009-09-16 8:42 ` [RFC][PATCH 08/10] x86: Don't ack_APIC_irq() if lapic is disabled in GENERIC_INTERRUPT_VECTOR handler Sheng Yang
2009-09-16 8:58 ` Cyrill Gorcunov
2009-09-16 9:03 ` Cyrill Gorcunov
2009-09-16 9:37 ` Cyrill Gorcunov
2009-09-17 3:54 ` Sheng Yang
2009-09-16 8:42 ` [RFC][PATCH 09/10] xen/hybrid: Make event channel work with QEmu emulated devices Sheng Yang
2009-09-16 20:35 ` Jeremy Fitzhardinge [this message]
2009-09-17 5:58 ` [Xen-devel] " Sheng Yang
2009-09-16 8:42 ` [RFC][PATCH 10/10] xen/hybrid: Enable grant table and xenbus Sheng Yang
2009-09-16 13:31 ` [Xen-devel] [RFC][PATCH 0/10] Xen Hybrid extension support Konrad Rzeszutek Wilk
2009-09-17 8:59 ` Sheng Yang
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=4AB14BFA.4010509@goop.org \
--to=jeremy@goop.org \
--cc=eddie.dong@intel.com \
--cc=jeremy.fitzhardinge@citrix.com \
--cc=jun.nakajima@intel.com \
--cc=keir.fraser@eu.citrix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sheng@linux.intel.com \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.