Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 295496
b: refs/heads/master
c: 9846ff1
h: refs/heads/master
v: v3
  • Loading branch information
Stefano Stabellini authored and Konrad Rzeszutek Wilk committed Mar 20, 2012
1 parent 6e070c0 commit c707df4
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 102b208e6b3b16d3611b67a7af9a93d30b92c006
refs/heads/master: 9846ff10af12f9e7caac696737db6c990592a74a
26 changes: 23 additions & 3 deletions trunk/drivers/xen/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <asm/idle.h>
#include <asm/io_apic.h>
#include <asm/sync_bitops.h>
#include <asm/xen/page.h>
#include <asm/xen/pci.h>
#include <asm/xen/hypercall.h>
#include <asm/xen/hypervisor.h>
Expand Down Expand Up @@ -109,6 +110,8 @@ struct irq_info {
#define PIRQ_SHAREABLE (1 << 1)

static int *evtchn_to_irq;
static unsigned long *pirq_eoi_map;
static bool (*pirq_needs_eoi)(unsigned irq);

static DEFINE_PER_CPU(unsigned long [NR_EVENT_CHANNELS/BITS_PER_LONG],
cpu_evtchn_mask);
Expand Down Expand Up @@ -269,10 +272,14 @@ static unsigned int cpu_from_evtchn(unsigned int evtchn)
return ret;
}

static bool pirq_needs_eoi(unsigned irq)
static bool pirq_check_eoi_map(unsigned irq)
{
struct irq_info *info = info_for_irq(irq);
return test_bit(irq, pirq_eoi_map);
}

static bool pirq_needs_eoi_flag(unsigned irq)
{
struct irq_info *info = info_for_irq(irq);
BUG_ON(info->type != IRQT_PIRQ);

return info->u.pirq.flags & PIRQ_NEEDS_EOI;
Expand Down Expand Up @@ -1768,7 +1775,7 @@ void xen_callback_vector(void) {}

void __init xen_init_IRQ(void)
{
int i;
int i, rc;

evtchn_to_irq = kcalloc(NR_EVENT_CHANNELS, sizeof(*evtchn_to_irq),
GFP_KERNEL);
Expand All @@ -1782,15 +1789,28 @@ void __init xen_init_IRQ(void)
for (i = 0; i < NR_EVENT_CHANNELS; i++)
mask_evtchn(i);

pirq_needs_eoi = pirq_needs_eoi_flag;

if (xen_hvm_domain()) {
xen_callback_vector();
native_init_IRQ();
/* pci_xen_hvm_init must be called after native_init_IRQ so that
* __acpi_register_gsi can point at the right function */
pci_xen_hvm_init();
} else {
struct physdev_pirq_eoi_gmfn eoi_gmfn;

irq_ctx_init(smp_processor_id());
if (xen_initial_domain())
pci_xen_initial_domain();

pirq_eoi_map = (void *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
eoi_gmfn.gmfn = virt_to_mfn(pirq_eoi_map);
rc = HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_gmfn_v2, &eoi_gmfn);
if (rc != 0) {
free_page((unsigned long) pirq_eoi_map);
pirq_eoi_map = NULL;
} else
pirq_needs_eoi = pirq_check_eoi_map;
}
}
21 changes: 21 additions & 0 deletions trunk/include/xen/interface/physdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,27 @@ struct physdev_eoi {
uint32_t irq;
};

/*
* 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_v1 17
/*
* Register a shared page for the hypervisor to indicate whether the
* guest must issue PHYSDEVOP_eoi. This hypercall is very similar to
* PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't change the semantics of
* PHYSDEVOP_eoi. The page registered is used as a bit array indexed by
* Xen's PIRQ value.
*/
#define PHYSDEVOP_pirq_eoi_gmfn_v2 28
struct physdev_pirq_eoi_gmfn {
/* IN */
unsigned long gmfn;
};

/*
* Query the status of an IRQ line.
* @arg == pointer to physdev_irq_status_query structure.
Expand Down

0 comments on commit c707df4

Please sign in to comment.