xen/arm: introduce gic callbacks
PATCH 6/7 xen/arm: introduce gic callbacks
Introduce callbacks to receive notifications from the GIC when a specific IRQ has been EOI'd by the guest.
--- 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(-)
xen/arch/arm/gic.c +12 -0
@@ -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 *rlist_del_init (&p->inflight);spin_unlock_irq (&v->arch.vgic.lock); +if ( gic_callbacks[virq] !=NULL ) + { + gic_callbacks[virq](v, virq); + } + i++; } }
xen/arch/arm/setup.c +1 -0
@@ -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 ) {
xen/include/asm-arm/gic.h +5 -0
@@ -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);
Signature · 1 line
1.7.2.5
Quoted 15 lines · Stefano Stabellini
Introduce callbacks to receive notifications from the GIC when a specific IRQ has been EOI'd by the guest.
Signed-off-by Stefano Stabellini <[email protected]>--- 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(-)xen/arch/arm/gic.c +0
-0
xen/arch/arm/gic.c static struct { · line 55
Quoted 4 lines
xen/arch/arm/gic.c +1
-0@@ -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.
Quoted 11 lines · Ian Campbell
Quoted 10 lines · Stefano Stabellini
Introduce callbacks to receive notifications from the GIC when a specific IRQ has been EOI'd by the guest.
Signed-off-by Stefano Stabellini <[email protected]>--- 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(-)
Quoted 11 lines
xen/arch/arm/gic.c static struct { · line 55
Quoted 9 lines
xen/arch/arm/gic.c +1
-0@@ -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.
Quoted 24 lines · Ian Campbell
Quoted 11 lines · Ian Campbell
Quoted 10 lines · Stefano Stabellini
Introduce callbacks to receive notifications from the GIC when a specific IRQ has been EOI'd by the guest.
Signed-off-by Stefano Stabellini <[email protected]>--- 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(-)Quoted 11 lines
xen/arch/arm/gic.c static struct { · line 55
Quoted 9 lines
xen/arch/arm/gic.c +1
-0@@ -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.
Quoted 5 lines
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.
Quoted 25 lines · Ian Campbell
Quoted 24 lines · Ian Campbell
Quoted 22 lines · Ian Campbell
Quoted 15 lines · Stefano Stabellini
Introduce callbacks to receive notifications from the GIC when a specific IRQ has been EOI'd by the guest.
Signed-off-by Stefano Stabellini <[email protected]>--- 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(-)xen/arch/arm/gic.c +0
-0xen/arch/arm/gic.c static struct { · line 55
Quoted 4 lines
xen/arch/arm/gic.c +1
-0@@ -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.
Quoted 7 lines
Quoted 5 lines
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