xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen/arm: Use REG_RANK_INDEX macro
@ 2014-09-18 12:13 vijay.kilari
  2014-09-18 12:13 ` [RFC PATCH] xen/arm: check on domain type against hardware support vijay.kilari
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: vijay.kilari @ 2014-09-18 12:13 UTC (permalink / raw)
  To: Ian.Campbell, julien.grall, stefano.stabellini,
	stefano.stabellini, tim, xen-devel
  Cc: Prasun.Kapoor, Vijaya Kumar K, manish.jaggi, vijay.kilari

From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>

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@caviumnetworks.com>
---
 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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-09-29 12:42 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-18 12:13 [PATCH] xen/arm: Use REG_RANK_INDEX macro vijay.kilari
2014-09-18 12:13 ` [RFC PATCH] xen/arm: check on domain type against hardware support vijay.kilari
2014-09-23 16:31   ` Ian Campbell
2014-09-25  8:31     ` Vijay Kilari
2014-09-25 11:08       ` Ian Campbell
2014-09-29 12:18         ` Julien Grall
2014-09-29 12:35           ` Ian Campbell
2014-09-29 12:42             ` Julien Grall
2014-09-18 12:13 ` [RFC PATCH] xen/arm: Restricted access to IFSR32_EL2 and FPEXC32_EL2 vijay.kilari
2014-09-23 16:32   ` Ian Campbell
2014-09-24  9:00     ` Ian Campbell
2014-09-18 12:13 ` [RFC PATCH] xen/arm: remove check for generic timer support for arm64 vijay.kilari
2014-09-23 16:33   ` Ian Campbell
2014-09-24  9:00     ` Ian Campbell
2014-09-23 16:19 ` [PATCH] xen/arm: Use REG_RANK_INDEX macro Ian Campbell
2014-09-23 16:45 ` Stefano Stabellini
2014-09-24  8:59   ` Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).