xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: tim@xen.org, Ian.Campbell@citrix.com,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH 2/5] xen/arm: gic and vgic fixes
Date: Fri, 22 Jun 2012 17:09:30 +0100	[thread overview]
Message-ID: <1340381373-22177-2-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <1340381373-22177-1-git-send-email-stefano.stabellini@eu.citrix.com>

- the last argument of find_next_bit is the maximum number of bits, not
the maximum number of bytes;

- use list_for_each_entry_safe instead of list_for_each_entry in
gic_restore_pending_irqs because we are actually deleting entries in the
loop.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen/arch/arm/gic.c  |    8 ++++----
 xen/arch/arm/vgic.c |    3 +--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 87713c1..8190f84 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -480,13 +480,13 @@ out:
 static void gic_restore_pending_irqs(struct vcpu *v)
 {
     int i;
-    struct pending_irq *p;
+    struct pending_irq *p, *t;
 
     /* check for new pending irqs */
     if ( list_empty(&v->arch.vgic.lr_pending) )
         return;
 
-    list_for_each_entry ( p, &v->arch.vgic.lr_pending, lr_queue )
+    list_for_each_entry_safe ( p, t, &v->arch.vgic.lr_pending, lr_queue )
     {
         i = find_first_zero_bit(&gic.lr_mask, nr_lrs);
         if ( i >= nr_lrs ) return;
@@ -593,7 +593,7 @@ static void events_maintenance(struct vcpu *v)
     if (!already_pending && gic.event_mask != 0) {
         spin_lock_irq(&gic.lock);
         while ((i = find_next_bit((const long unsigned int *) &gic.event_mask,
-                        sizeof(uint64_t), i)) < sizeof(uint64_t)) {
+                        64, i)) < 64) {
 
             GICH[GICH_LR + i] = 0;
             clear_bit(i, &gic.lr_mask);
@@ -615,7 +615,7 @@ static void maintenance_interrupt(int irq, void *dev_id, struct cpu_user_regs *r
     events_maintenance(v);
 
     while ((i = find_next_bit((const long unsigned int *) &eisr,
-                              sizeof(eisr), i)) < sizeof(eisr)) {
+                              64, i)) < 64) {
         struct pending_irq *p;
 
         spin_lock_irq(&gic.lock);
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 653e8e5..b383e01 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -355,8 +355,7 @@ static void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n)
     unsigned int irq;
     int i = 0;
 
-    while ( (i = find_next_bit((const long unsigned int *) &r,
-                        sizeof(uint32_t), i)) < sizeof(uint32_t) ) {
+    while ( (i = find_next_bit((const long unsigned int *) &r, 32, i)) < 32 ) {
         irq = i + (32 * n);
         p = irq_to_pending(v, irq);
         if ( !list_empty(&p->inflight) )
-- 
1.7.2.5

  reply	other threads:[~2012-06-22 16:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-22 16:08 [PATCH 0/5] xen/arm: dom1 PV console up and running Stefano Stabellini
2012-06-22 16:09 ` [PATCH 1/5] xen/arm: implement do_hvm_op for ARM Stefano Stabellini
2012-06-22 16:09   ` Stefano Stabellini [this message]
2012-06-26 14:28     ` [PATCH 2/5] xen/arm: gic and vgic fixes Ian Campbell
2012-06-26 17:23       ` Stefano Stabellini
2012-06-22 16:09   ` [PATCH 3/5] xen/arm: disable the event optimization in the gic Stefano Stabellini
2012-06-26 14:29     ` Ian Campbell
2012-06-22 16:09   ` [PATCH 4/5] libxc/arm: allocate xenstore and console pages Stefano Stabellini
2012-06-26 14:34     ` Ian Campbell
2012-06-26 18:05       ` Stefano Stabellini
2012-06-27  8:59         ` Ian Campbell
2012-06-27 12:42           ` Stefano Stabellini
2012-06-22 16:09   ` [PATCH 5/5] xcbuild: add console and xenstore support Stefano Stabellini
2012-06-26 13:50     ` Ian Campbell
2012-06-26 17:58       ` Stefano Stabellini
2012-06-27  8:55         ` Ian Campbell
2012-06-27 11:02           ` Stefano Stabellini
2012-06-26 14:27   ` [PATCH 1/5] xen/arm: implement do_hvm_op for ARM Ian Campbell
2012-06-26 18:29     ` Stefano Stabellini
2012-06-27  9:02       ` Ian Campbell
2012-06-27 11:04         ` Stefano Stabellini

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=1340381373-22177-2-git-send-email-stefano.stabellini@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xensource.com \
    /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).