diff mbox

[v4,1/9] ppc/xics: account correct irq status

Message ID 1474266577-11704-2-git-send-email-nikunj@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Nikunj A. Dadhania Sept. 19, 2016, 6:29 a.m. UTC
Fix inconsistent irq status, because of this in the trace logs, for e.g.
LSI status was 0x7, i.e. XICS_STATUS_ASSERTED, XICS_STATUS_SENT and
XICS_STATUS_REJECTED all set, which did not make sense. So the REJECTED
would have been set in earlier interrupt cycle, and then asserted and
sent in this current one.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
---
 hw/intc/xics.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

David Gibson Sept. 21, 2016, 6:39 a.m. UTC | #1
On Mon, Sep 19, 2016 at 11:59:29AM +0530, Nikunj A Dadhania wrote:
> Fix inconsistent irq status, because of this in the trace logs, for e.g.
> LSI status was 0x7, i.e. XICS_STATUS_ASSERTED, XICS_STATUS_SENT and
> XICS_STATUS_REJECTED all set, which did not make sense. So the REJECTED
> would have been set in earlier interrupt cycle, and then asserted and
> sent in this current one.
> 
> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>

It looks like this patch stands on its own, so I've applied it to ppc-for-2.8.

> ---
>  hw/intc/xics.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/intc/xics.c b/hw/intc/xics.c
> index cd48f42..69162f0 100644
> --- a/hw/intc/xics.c
> +++ b/hw/intc/xics.c
> @@ -505,8 +505,11 @@ static void ics_reject(ICSState *ics, int nr)
>      ICSIRQState *irq = ics->irqs + nr - ics->offset;
>  
>      trace_xics_ics_reject(nr, nr - ics->offset);
> -    irq->status |= XICS_STATUS_REJECTED; /* Irrelevant but harmless for LSI */
> -    irq->status &= ~XICS_STATUS_SENT; /* Irrelevant but harmless for MSI */
> +    if (irq->flags & XICS_FLAGS_IRQ_MSI) {
> +        irq->status |= XICS_STATUS_REJECTED;
> +    } else if (irq->flags & XICS_FLAGS_IRQ_LSI) {
> +        irq->status &= ~XICS_STATUS_SENT;
> +    }
>  }
>  
>  static void ics_resend(ICSState *ics)
diff mbox

Patch

diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index cd48f42..69162f0 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -505,8 +505,11 @@  static void ics_reject(ICSState *ics, int nr)
     ICSIRQState *irq = ics->irqs + nr - ics->offset;
 
     trace_xics_ics_reject(nr, nr - ics->offset);
-    irq->status |= XICS_STATUS_REJECTED; /* Irrelevant but harmless for LSI */
-    irq->status &= ~XICS_STATUS_SENT; /* Irrelevant but harmless for MSI */
+    if (irq->flags & XICS_FLAGS_IRQ_MSI) {
+        irq->status |= XICS_STATUS_REJECTED;
+    } else if (irq->flags & XICS_FLAGS_IRQ_LSI) {
+        irq->status &= ~XICS_STATUS_SENT;
+    }
 }
 
 static void ics_resend(ICSState *ics)