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: julien.grall@citrix.com, Ian.Campbell@citrix.com,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH v4 6/6] xen/arm: disable a physical IRQ when the guest disables the corresponding IRQ
Date: Wed, 11 Dec 2013 19:07:21 +0000	[thread overview]
Message-ID: <1386788841-32471-6-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1312111904590.7093@kaball.uk.xensource.com>

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>

---
Changes in v2:
- disable IRQs that were previously disabled.
---
 xen/arch/arm/vgic.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index ad17d1d..9022658 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -360,6 +360,22 @@ read_as_zero:
     return 1;
 }
 
+static void vgic_disable_irqs(struct vcpu *v, uint32_t r, int n)
+{
+    struct pending_irq *p;
+    unsigned int irq;
+    int i = 0;
+
+    while ( (i = find_next_bit((const long unsigned int *) &r, 32, i)) < 32 ) {
+        irq = i + (32 * n);
+        p = irq_to_pending(v, irq);
+        clear_bit(GIC_IRQ_GUEST_ENABLED, &p->status);
+        if ( p->desc != NULL )
+            p->desc->handler->disable(p->desc);
+        i++;
+    }
+}
+
 static void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n)
 {
     struct pending_irq *p;
@@ -490,8 +506,10 @@ static int vgic_distr_mmio_write(struct vcpu *v, mmio_info_t *info)
         rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ICENABLER);
         if ( rank == NULL) goto write_ignore;
         vgic_lock_rank(v, rank);
+        tr = rank->ienable;
         rank->ienable &= ~*r;
         vgic_unlock_rank(v, rank);
+        vgic_disable_irqs(v, (*r) & tr, gicd_reg - GICD_ICENABLER);
         return 1;
 
     case GICD_ISPENDR ... GICD_ISPENDRN:
-- 
1.7.10.4

  parent reply	other threads:[~2013-12-11 19:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11 19:06 [PATCH v4 0/6] interrupt handling fixes Stefano Stabellini
2013-12-11 19:07 ` [PATCH v4 1/6] xen/arm: Physical IRQ is not always equal to virtual IRQ Stefano Stabellini
2013-12-11 19:07 ` [PATCH v4 2/6] xen/arm: track the state of guest IRQs Stefano Stabellini
2013-12-12 12:03   ` Ian Campbell
2013-12-12 15:09     ` Stefano Stabellini
2013-12-12 12:18   ` Ian Campbell
2013-12-12 15:17     ` Stefano Stabellini
2013-12-12 15:23       ` Ian Campbell
2013-12-12 15:25         ` Stefano Stabellini
2013-12-12 15:45           ` Ian Campbell
2013-12-12 15:46             ` Ian Campbell
2013-12-12 15:50               ` Stefano Stabellini
2013-12-12 15:48             ` Stefano Stabellini
2013-12-12 15:56   ` Ian Campbell
2013-12-12 16:06     ` Stefano Stabellini
2013-12-11 19:07 ` [PATCH v4 3/6] xen/arm: do not add a second irq to the LRs if one is already present Stefano Stabellini
2013-12-11 19:07 ` [PATCH v4 4/6] xen/arm: implement gic_irq_enable and gic_irq_disable Stefano Stabellini
2013-12-11 19:07 ` [PATCH v4 5/6] xen/arm: Only enable physical IRQs when the guest asks Stefano Stabellini
2013-12-11 19:07 ` Stefano Stabellini [this message]
2013-12-12 16:06   ` [PATCH v4 6/6] xen/arm: disable a physical IRQ when the guest disables the corresponding IRQ Ian Campbell
2013-12-12 16:34     ` 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=1386788841-32471-6-git-send-email-stefano.stabellini@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=julien.grall@citrix.com \
    --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).