Introduce callbacks to receive notifications from the GIC when a specific IRQ has been EOI''d by the guest. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- xen/arch/arm/gic.c | 12 ++++++++++++ xen/arch/arm/setup.c | 1 + xen/include/asm-arm/gic.h | 5 +++++ 3 files changed, 18 insertions(+), 0 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 1c8219d..0ecc0f1 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -52,6 +52,7 @@ static struct { static irq_desc_t irq_desc[NR_IRQS]; static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc); static DEFINE_PER_CPU(uint64_t, lr_mask); +static gic_callback_fn_t gic_callbacks[NR_IRQS]; unsigned nr_lrs; @@ -619,6 +620,12 @@ int gicv_setup(struct domain *d) gic.vbase); } +void register_gic_callback(int irq, gic_callback_fn_t fn) +{ + ASSERT(irq < NR_IRQS); + gic_callbacks[irq] = fn; +} + static void maintenance_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs) { int i = 0, virq; @@ -655,6 +662,11 @@ static void maintenance_interrupt(int irq, void *dev_id, struct cpu_user_regs *r list_del_init(&p->inflight); spin_unlock_irq(&v->arch.vgic.lock); + if ( gic_callbacks[virq] != NULL ) + { + gic_callbacks[virq](v, virq); + } + i++; } } diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index e1ab7f6..5680c73 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -40,6 +40,7 @@ #include <asm/vfp.h> #include <asm/early_printk.h> #include <asm/gic.h> +#include "vtimer.h" static __used void init_done(void) { diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index bf30fbd..f4b0324 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -153,6 +153,11 @@ extern void gic_disable_cpu(void); /* setup the gic virtual interface for a guest */ extern int gicv_setup(struct domain *d); +typedef void (*gic_callback_fn_t)(struct vcpu *v, int irq); +/* register a per-irq callback: the gic driver is going to call the + * callback when the guest EOIs that particular irq. */ +void register_gic_callback(int irq, gic_callback_fn_t fn); + /* Context switch */ extern void gic_save_state(struct vcpu *v); extern void gic_restore_state(struct vcpu *v); -- 1.7.2.5
On Thu, 2013-02-14 at 16:37 +0000, Stefano Stabellini wrote:> Introduce callbacks to receive notifications from the GIC when a > specific IRQ has been EOI''d by the guest. > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > --- > xen/arch/arm/gic.c | 12 ++++++++++++ > xen/arch/arm/setup.c | 1 + > xen/include/asm-arm/gic.h | 5 +++++ > 3 files changed, 18 insertions(+), 0 deletions(-) > > diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c > index 1c8219d..0ecc0f1 100644 > --- a/xen/arch/arm/gic.c > +++ b/xen/arch/arm/gic.c > @@ -52,6 +52,7 @@ static struct { > static irq_desc_t irq_desc[NR_IRQS]; > static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc); > static DEFINE_PER_CPU(uint64_t, lr_mask); > +static gic_callback_fn_t gic_callbacks[NR_IRQS];I think this should rather go in struct arch_irq_desc. Ian.
On Fri, 2013-02-15 at 12:57 +0000, Ian Campbell wrote:> On Thu, 2013-02-14 at 16:37 +0000, Stefano Stabellini wrote: > > Introduce callbacks to receive notifications from the GIC when a > > specific IRQ has been EOI''d by the guest. > > > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > > --- > > xen/arch/arm/gic.c | 12 ++++++++++++ > > xen/arch/arm/setup.c | 1 + > > xen/include/asm-arm/gic.h | 5 +++++ > > 3 files changed, 18 insertions(+), 0 deletions(-) > > > > diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c > > index 1c8219d..0ecc0f1 100644 > > --- a/xen/arch/arm/gic.c > > +++ b/xen/arch/arm/gic.c > > @@ -52,6 +52,7 @@ static struct { > > static irq_desc_t irq_desc[NR_IRQS]; > > static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc); > > static DEFINE_PER_CPU(uint64_t, lr_mask); > > +static gic_callback_fn_t gic_callbacks[NR_IRQS]; > > I think this should rather go in struct arch_irq_desc.Actually, aren''t these *virtual* interrupt callbacks? It is possible that IRQ30 for one guest might not have the same use as IRQ30 in another, which suggests that this belongs in some domain specific location, like struct pending_irq. Ian.
On Fri, 2013-02-15 at 13:04 +0000, Ian Campbell wrote:> On Fri, 2013-02-15 at 12:57 +0000, Ian Campbell wrote: > > On Thu, 2013-02-14 at 16:37 +0000, Stefano Stabellini wrote: > > > Introduce callbacks to receive notifications from the GIC when a > > > specific IRQ has been EOI''d by the guest. > > > > > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > > > --- > > > xen/arch/arm/gic.c | 12 ++++++++++++ > > > xen/arch/arm/setup.c | 1 + > > > xen/include/asm-arm/gic.h | 5 +++++ > > > 3 files changed, 18 insertions(+), 0 deletions(-) > > > > > > diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c > > > index 1c8219d..0ecc0f1 100644 > > > --- a/xen/arch/arm/gic.c > > > +++ b/xen/arch/arm/gic.c > > > @@ -52,6 +52,7 @@ static struct { > > > static irq_desc_t irq_desc[NR_IRQS]; > > > static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc); > > > static DEFINE_PER_CPU(uint64_t, lr_mask); > > > +static gic_callback_fn_t gic_callbacks[NR_IRQS]; > > > > I think this should rather go in struct arch_irq_desc. > > Actually, aren''t these *virtual* interrupt callbacks? > > It is possible that IRQ30 for one guest might not have the same use as > IRQ30 in another, which suggests that this belongs in some domain > specific location, like struct pending_irq.Did we end up not needing this patch? Ian.
On Thu, 11 Apr 2013, Ian Campbell wrote:> On Fri, 2013-02-15 at 13:04 +0000, Ian Campbell wrote: > > On Fri, 2013-02-15 at 12:57 +0000, Ian Campbell wrote: > > > On Thu, 2013-02-14 at 16:37 +0000, Stefano Stabellini wrote: > > > > Introduce callbacks to receive notifications from the GIC when a > > > > specific IRQ has been EOI''d by the guest. > > > > > > > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > > > > --- > > > > xen/arch/arm/gic.c | 12 ++++++++++++ > > > > xen/arch/arm/setup.c | 1 + > > > > xen/include/asm-arm/gic.h | 5 +++++ > > > > 3 files changed, 18 insertions(+), 0 deletions(-) > > > > > > > > diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c > > > > index 1c8219d..0ecc0f1 100644 > > > > --- a/xen/arch/arm/gic.c > > > > +++ b/xen/arch/arm/gic.c > > > > @@ -52,6 +52,7 @@ static struct { > > > > static irq_desc_t irq_desc[NR_IRQS]; > > > > static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc); > > > > static DEFINE_PER_CPU(uint64_t, lr_mask); > > > > +static gic_callback_fn_t gic_callbacks[NR_IRQS]; > > > > > > I think this should rather go in struct arch_irq_desc. > > > > Actually, aren''t these *virtual* interrupt callbacks? > > > > It is possible that IRQ30 for one guest might not have the same use as > > IRQ30 in another, which suggests that this belongs in some domain > > specific location, like struct pending_irq. > > Did we end up not needing this patch?Correct