[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] xen/arm: Use REG_RANK_INDEX macro
From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx> Use REG_RANK_INDEX macro to compute index to access vgic ipriority[] and itargets[] for a given irq. Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx> --- xen/arch/arm/vgic-v2.c | 7 +++++-- xen/arch/arm/vgic-v3.c | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c index ad7e661..1369f78 100644 --- a/xen/arch/arm/vgic-v2.c +++ b/xen/arch/arm/vgic-v2.c @@ -510,7 +510,9 @@ static struct vcpu *vgic_v2_get_target_vcpu(struct vcpu *v, unsigned int irq) struct vgic_irq_rank *rank = vgic_rank_irq(v, irq); ASSERT(spin_is_locked(&rank->lock)); - target = vgic_byte_read(rank->v2.itargets[(irq%32)/4], 0, irq % 4); + target = vgic_byte_read(rank->v2.itargets[REG_RANK_INDEX(8, + irq, DABT_WORD)], 0, irq & 0x3); + /* 1-N SPI should be delivered as pending to all the vcpus in the * mask, but here we just return the first vcpu for simplicity and * because it would be too slow to do otherwise. */ @@ -526,7 +528,8 @@ static int vgic_v2_get_irq_priority(struct vcpu *v, unsigned int irq) struct vgic_irq_rank *rank = vgic_rank_irq(v, irq); ASSERT(spin_is_locked(&rank->lock)); - priority = vgic_byte_read(rank->ipriority[(irq%32)/4], 0, irq % 4); + priority = vgic_byte_read(rank->ipriority[REG_RANK_INDEX(8, + irq, DABT_WORD)], 0, irq & 0x3); return priority; } diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index c65a56a..ac8cf07 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -940,7 +940,8 @@ static int vgic_v3_get_irq_priority(struct vcpu *v, unsigned int irq) struct vgic_irq_rank *rank = vgic_rank_irq(v, irq); ASSERT(spin_is_locked(&rank->lock)); - priority = vgic_byte_read(rank->ipriority[(irq%32)/4], 0, irq % 4); + priority = vgic_byte_read(rank->ipriority[REG_RANK_INDEX(8, + irq, DABT_WORD)], 0, irq & 0x3); return priority; } -- 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 |