From: vijay.kilari@gmail.com
To: Ian.Campbell@citrix.com, julien.grall@linaro.org,
stefano.stabellini@eu.citrix.com, stefano.stabellini@citrix.com,
tim@xen.org, xen-devel@lists.xen.org
Cc: Prasun.Kapoor@caviumnetworks.com,
Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>,
manish.jaggi@caviumnetworks.com, vijay.kilari@gmail.com
Subject: [PATCH] xen/arm: Use REG_RANK_INDEX macro
Date: Thu, 18 Sep 2014 17:43:46 +0530 [thread overview]
Message-ID: <1411042429-17108-1-git-send-email-vijay.kilari@gmail.com> (raw)
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
next reply other threads:[~2014-09-18 12:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-18 12:13 vijay.kilari [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1411042429-17108-1-git-send-email-vijay.kilari@gmail.com \
--to=vijay.kilari@gmail.com \
--cc=Ian.Campbell@citrix.com \
--cc=Prasun.Kapoor@caviumnetworks.com \
--cc=Vijaya.Kumar@caviumnetworks.com \
--cc=julien.grall@linaro.org \
--cc=manish.jaggi@caviumnetworks.com \
--cc=stefano.stabellini@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).