[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [SPARC] question on LEON IRQMP interrupt controller.

From: Jean-Christophe DUBOIS
Subject: [Qemu-devel] [SPARC] question on LEON IRQMP interrupt controller.
Date: Tue, 2 Jan 2018 12:13:06 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

Hi Mark, Artyom,

I am wondering if the IRQMP code in hw/intc/grlib_irqmp.c is correct when it comes to acknowledging interrupts.

With the actual code an interrupt can be lowered/acked only by an "ack" from the processor which means that the trap handler related to this external interrupt needs to be run for the ack to happen.

In particular this means that the interrupt cannot be acked only by software. Even if the software clears the "pending" interrupts (by writing to the CLEAR_OFFSET register before the interrupt handler is run) this does not clear the interrupt to the processor (which is kept asserted until the handler is run and the interrupt acked by the processor). Do you know if this is indeed the intended behavior (I understand that for most operating system the interrupt handler will be run at last and this does not make a difference)?

I would expect that clearing interrupt through software (by writing to the CLEAR_OFFSET register) would have the same effect as the processor acknowledgment (and could avoid to run the interrupt handler if things have already been taken care of by software).

Unfortunately the documentation I got (on the web) on the IRQMP is not very clear on the topic.

Anyway you can find below the patch I'd like to provide for IRQMP.



diff --git a/hw/intc/grlib_irqmp.c b/hw/intc/grlib_irqmp.c
index 94659ee256..d6f9cb3692 100644
--- a/hw/intc/grlib_irqmp.c
+++ b/hw/intc/grlib_irqmp.c
@@ -106,6 +106,15 @@ static void grlib_irqmp_check_irqs(IRQMPState *state)

+static void grlib_irqmp_ack_mask(IRQMPState *state, uint32_t mask)
+    /* Clear registers */
+    state->pending  &= ~mask;
+    state->force[0] &= ~mask; /* Only CPU 0 (No SMP support) */
+    grlib_irqmp_check_irqs(state);
 void grlib_irqmp_ack(DeviceState *dev, int intno)
     IRQMP        *irqmp = GRLIB_IRQMP(dev);
@@ -120,11 +129,7 @@ void grlib_irqmp_ack(DeviceState *dev, int intno)


-    /* Clear registers */
-    state->pending  &= ~mask;
-    state->force[0] &= ~mask; /* Only CPU 0 (No SMP support) */
-    grlib_irqmp_check_irqs(state);
+    grlib_irqmp_ack_mask(state, mask);

 void grlib_irqmp_set_irq(void *opaque, int irq, int level)
@@ -251,7 +256,7 @@ static void grlib_irqmp_write(void *opaque, hwaddr addr,

     case CLEAR_OFFSET:
         value &= ~1; /* clean up the value */
-        state->pending &= ~value;
+        grlib_irqmp_ack_mask(state, value);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]