From 6c79718e811fdecff9f7b1271df7395357054fc2 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Mon, 18 Oct 2010 13:30:25 +0100 Subject: [PATCH 1/2] Revert "xen/events: use PHYSDEVOP_pirq_eoi_gmfn to get pirq need-EOI info" This reverts commit 2390c371ecd32d9f06e22871636185382bf70ab7. Signed-off-by: Stefano Stabellini --- drivers/xen/events.c | 45 ++++++-------------------------------- include/xen/interface/physdev.h | 13 ----------- 2 files changed, 7 insertions(+), 51 deletions(-) diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 175e931..5db8e98 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c @@ -103,12 +103,9 @@ struct irq_info } pirq; } u; }; +#define PIRQ_NEEDS_EOI (1 << 0) #define PIRQ_SHAREABLE (1 << 1) -/* Bitmap indicating which PIRQs require Xen to be notified on unmask. */ -static bool pirq_eoi_does_unmask; -static unsigned long *pirq_needs_eoi_bits; - static struct irq_info *irq_info; static int *evtchn_to_irq; @@ -251,7 +248,7 @@ static bool pirq_needs_eoi(unsigned irq) BUG_ON(info->type != IRQT_PIRQ); - return test_bit(info->u.pirq.gsi, pirq_needs_eoi_bits); + return info->u.pirq.flags & PIRQ_NEEDS_EOI; } static inline unsigned long active_evtchns(unsigned int cpu, @@ -438,19 +435,13 @@ static bool identity_mapped_irq(unsigned irq) static void pirq_eoi(unsigned int irq) { - struct irq_info *info = info_for_irq(irq); - struct physdev_eoi eoi = { .irq = info->u.pirq.gsi }; - bool need_eoi; - - need_eoi = pirq_needs_eoi(irq); + struct physdev_eoi eoi = { .irq = irq }; - if (!need_eoi || !pirq_eoi_does_unmask) - unmask_evtchn(info->evtchn); - - if (need_eoi) { + if (pirq_needs_eoi(irq)) { int rc = HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi); WARN_ON(rc); } + unmask_irq(irq); } static void pirq_query_unmask(int irq) @@ -458,18 +449,15 @@ static void pirq_query_unmask(int irq) struct physdev_irq_status_query irq_status; struct irq_info *info = info_for_irq(irq); - if (pirq_eoi_does_unmask) - return; - BUG_ON(info->type != IRQT_PIRQ); irq_status.irq = info->u.pirq.gsi; if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) irq_status.flags = 0; - clear_bit(info->u.pirq.gsi, pirq_needs_eoi_bits); + info->u.pirq.flags &= ~PIRQ_NEEDS_EOI; if (irq_status.flags & XENIRQSTAT_needs_eoi) - set_bit(info->u.pirq.gsi, pirq_needs_eoi_bits); + info->u.pirq.flags |= PIRQ_NEEDS_EOI; } static bool probing_irq(int irq) @@ -1369,16 +1357,6 @@ void xen_irq_resume(void) restore_cpu_virqs(cpu); restore_cpu_ipis(cpu); } - - if (pirq_eoi_does_unmask) { - struct physdev_pirq_eoi_gmfn eoi_gmfn; - - eoi_gmfn.gmfn = virt_to_mfn(pirq_needs_eoi_bits); - if (HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_gmfn, &eoi_gmfn) != 0) { - /* Could recover by reverting to old method...? */ - BUG(); - } - } } static struct irq_chip xen_dynamic_chip __read_mostly = { @@ -1462,8 +1440,6 @@ void xen_callback_vector(void) {} void __init xen_init_IRQ(void) { int i; - struct physdev_pirq_eoi_gmfn eoi_gmfn; - int nr_pirqs = NR_IRQS; cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s), GFP_KERNEL); @@ -1474,13 +1450,6 @@ void __init xen_init_IRQ(void) for(i = 0; i < NR_EVENT_CHANNELS; i++) evtchn_to_irq[i] = -1; - i = get_order(sizeof(unsigned long) * BITS_TO_LONGS(nr_pirqs)); - pirq_needs_eoi_bits = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, i); - - eoi_gmfn.gmfn = virt_to_mfn(pirq_needs_eoi_bits); - if (HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_gmfn, &eoi_gmfn) == 0) - pirq_eoi_does_unmask = true; - init_evtchn_cpu_bindings(); /* No event channels are 'live' right now. */ diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h index 0703ef6..66122aa 100644 --- a/include/xen/interface/physdev.h +++ b/include/xen/interface/physdev.h @@ -39,19 +39,6 @@ struct physdev_eoi { }; /* - * Register a shared page for the hypervisor to indicate whether the guest - * must issue PHYSDEVOP_eoi. The semantics of PHYSDEVOP_eoi change slightly - * once the guest used this function in that the associated event channel - * will automatically get unmasked. The page registered is used as a bit - * array indexed by Xen's PIRQ value. - */ -#define PHYSDEVOP_pirq_eoi_gmfn 17 -struct physdev_pirq_eoi_gmfn { - /* IN */ - unsigned long gmfn; -}; - -/* * Query the status of an IRQ line. * @arg == pointer to physdev_irq_status_query structure. */ -- 1.5.6.5