[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH for-4.5 v11 1/7] xen/arm: Calculate irq rank from irq number
From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx> irq rank calculated is not generic and assumes hardware register size value which does not work for future GIC versions like V3. Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx> Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> --- xen/arch/arm/vgic.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 1372ffc..c6e9479 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -31,6 +31,16 @@ #include <asm/gic.h> #include <asm/vgic.h> +static inline struct vgic_irq_rank *vgic_get_rank(struct vcpu *v, int rank) +{ + if ( rank == 0 ) + return v->arch.vgic.private_irqs; + else if ( rank <= DOMAIN_NR_RANKS(v->domain) ) + return &v->domain->arch.vgic.shared_irqs[rank - 1]; + else + return NULL; +} + /* * Returns rank corresponding to a GICD_<FOO><n> register for * GICD_<FOO> with <b>-bits-per-interrupt. @@ -40,17 +50,14 @@ struct vgic_irq_rank *vgic_rank_offset(struct vcpu *v, int b, int n, { int rank = REG_RANK_NR(b, (n >> s)); - if ( rank == 0 ) - return v->arch.vgic.private_irqs; - else if ( rank <= DOMAIN_NR_RANKS(v->domain) ) - return &v->domain->arch.vgic.shared_irqs[rank - 1]; - else - return NULL; + return vgic_get_rank(v, rank); } struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq) { - return vgic_rank_offset(v, 8, irq, DABT_WORD); + int rank = irq/32; + + return vgic_get_rank(v, rank); } int domain_vgic_init(struct domain *d) -- 1.7.9.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |