Message ID | 1426793399-6283-18-git-send-email-julien.grall@linaro.org |
---|---|
State | New |
Headers | show |
Hi Ian, On 31/03/15 11:55, Ian Campbell wrote: > On Thu, 2015-03-19 at 19:29 +0000, Julien Grall wrote: >> Introduce spi_to_pending in order retrieve the irq_pending structure for >> a specific SPI. >> >> It's not possible to re-use irq_to_pending because it's required a VCPU > > "it requires" > >> and some call of the new function may during domain destruction after >> the VCPUs are freed. >> >> Signed-off-by: Julien Grall <julien.grall@linaro.org> > > Acked-by: Ian Campbell <ian.campbell@citrix.com> Thanks. > Although given the name I would expect it to take an spi (i.e. -32) not > an irq. I can't think of a better name though and perhaps that just > makes things harder for the caller.. It depends if you think relative or absolute. In this case, the absolute value is easier to use. FWIW, we already have SPI-specific function using absolute value. Regards,
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 74751e0..fc283ec 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -371,6 +371,13 @@ struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq) return n; } +struct pending_irq *spi_to_pending(struct domain *d, unsigned int irq) +{ + ASSERT(irq >= NR_LOCAL_IRQS); + + return &d->arch.vgic.pending_irqs[irq - 32]; +} + void vgic_clear_pending_irqs(struct vcpu *v) { struct pending_irq *p, *t; diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index 647f2fe..8d22532 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -185,6 +185,7 @@ extern void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int virq); extern void vgic_vcpu_inject_spi(struct domain *d, unsigned int virq); extern void vgic_clear_pending_irqs(struct vcpu *v); extern struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq); +extern struct pending_irq *spi_to_pending(struct domain *d, unsigned int irq); extern struct vgic_irq_rank *vgic_rank_offset(struct vcpu *v, int b, int n, int s); extern struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq); extern int vgic_emulate(struct cpu_user_regs *regs, union hsr hsr);
Introduce spi_to_pending in order retrieve the irq_pending structure for a specific SPI. It's not possible to re-use irq_to_pending because it's required a VCPU and some call of the new function may during domain destruction after the VCPUs are freed. Signed-off-by: Julien Grall <julien.grall@linaro.org> --- Changes in v4: - Patch added --- xen/arch/arm/vgic.c | 7 +++++++ xen/include/asm-arm/vgic.h | 1 + 2 files changed, 8 insertions(+)