qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christoffer Dall <christoffer.dall@linaro.org>
To: qemu-devel@nongnu.org
Cc: kvmarm@lists.cs.columbia.edu,
	Christoffer Dall <christoffer.dall@linaro.org>,
	patches@linaro.org
Subject: [Qemu-devel] [PATCH v5 1/8] arm_gic: Introduce define for GIC_NR_SGIS
Date: Tue, 28 Jan 2014 12:32:38 -0800	[thread overview]
Message-ID: <1390941165-2079-2-git-send-email-christoffer.dall@linaro.org> (raw)
In-Reply-To: <1390941165-2079-1-git-send-email-christoffer.dall@linaro.org>

Instead of hardcoding 16 various places in the code, use a define to
make it more clear what is going on.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
Changes [v1 -> v5]:
 - New patch in series

 hw/intc/arm_gic.c                | 17 +++++++++++------
 include/hw/intc/arm_gic_common.h |  1 +
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
index 9409684..98c6ff5 100644
--- a/hw/intc/arm_gic.c
+++ b/hw/intc/arm_gic.c
@@ -380,8 +380,10 @@ static void gic_dist_writeb(void *opaque, hwaddr offset,
         irq = (offset - 0x100) * 8 + GIC_BASE_IRQ;
         if (irq >= s->num_irq)
             goto bad_reg;
-        if (irq < 16)
-          value = 0xff;
+        if (irq < GIC_NR_SGIS) {
+            value = 0xff;
+        }
+
         for (i = 0; i < 8; i++) {
             if (value & (1 << i)) {
                 int mask =
@@ -406,8 +408,10 @@ static void gic_dist_writeb(void *opaque, hwaddr offset,
         irq = (offset - 0x180) * 8 + GIC_BASE_IRQ;
         if (irq >= s->num_irq)
             goto bad_reg;
-        if (irq < 16)
-          value = 0;
+        if (irq < GIC_NR_SGIS) {
+            value = 0;
+        }
+
         for (i = 0; i < 8; i++) {
             if (value & (1 << i)) {
                 int cm = (irq < GIC_INTERNAL) ? (1 << cpu) : ALL_CPU_MASK;
@@ -423,8 +427,9 @@ static void gic_dist_writeb(void *opaque, hwaddr offset,
         irq = (offset - 0x200) * 8 + GIC_BASE_IRQ;
         if (irq >= s->num_irq)
             goto bad_reg;
-        if (irq < 16)
-          irq = 0;
+        if (irq < GIC_NR_SGIS) {
+            irq = 0;
+        }
 
         for (i = 0; i < 8; i++) {
             if (value & (1 << i)) {
diff --git a/include/hw/intc/arm_gic_common.h b/include/hw/intc/arm_gic_common.h
index 40cd3d6..dbf8787 100644
--- a/include/hw/intc/arm_gic_common.h
+++ b/include/hw/intc/arm_gic_common.h
@@ -27,6 +27,7 @@
 #define GIC_MAXIRQ 1020
 /* First 32 are private to each CPU (SGIs and PPIs). */
 #define GIC_INTERNAL 32
+#define GIC_NR_SGIS 16
 /* Maximum number of possible CPU interfaces, determined by GIC architecture */
 #define GIC_NCPU 8
 
-- 
1.8.5.2

  reply	other threads:[~2014-01-28 20:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-28 20:32 [Qemu-devel] [PATCH v5 0/8] Support arm-gic-kvm save/restore Christoffer Dall
2014-01-28 20:32 ` Christoffer Dall [this message]
2014-01-29 12:02   ` [Qemu-devel] [PATCH v5 1/8] arm_gic: Introduce define for GIC_NR_SGIS Peter Maydell
2014-01-28 20:32 ` [Qemu-devel] [PATCH v5 2/8] arm_gic: Fix GICD_ICPENDR and GICD_ISPENDR writes Christoffer Dall
2014-01-29 12:03   ` Peter Maydell
2014-01-28 20:32 ` [Qemu-devel] [PATCH v5 3/8] arm_gic: Fix GIC pending behavior Christoffer Dall
2014-01-31 18:09   ` Peter Maydell
2014-02-02 22:53     ` Christoffer Dall
2014-01-28 20:32 ` [Qemu-devel] [PATCH v5 4/8] hw: arm_gic: Keep track of SGI sources Christoffer Dall
2014-01-31 18:33   ` Peter Maydell
2014-02-02 22:53     ` Christoffer Dall
2014-01-28 20:32 ` [Qemu-devel] [PATCH v5 5/8] arm_gic: Support setting/getting binary point reg Christoffer Dall
2014-01-28 20:32 ` [Qemu-devel] [PATCH v5 6/8] vmstate: Add uint32 2D-array support Christoffer Dall
2014-01-28 20:32 ` [Qemu-devel] [PATCH v5 7/8] arm_gic: Add GICC_APRn state to the GICState Christoffer Dall
2014-01-28 20:32 ` [Qemu-devel] [PATCH v5 8/8] hw: arm_gic_kvm: Add KVM VGIC save/restore logic Christoffer Dall
2014-01-29 13:23 ` [Qemu-devel] [PATCH v5 0/8] Support arm-gic-kvm save/restore Peter Maydell

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=1390941165-2079-2-git-send-email-christoffer.dall@linaro.org \
    --to=christoffer.dall@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=patches@linaro.org \
    --cc=qemu-devel@nongnu.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).