From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Mon, 19 Sep 2016 06:29:32 +0000 (+0530)
Subject: ppc/xics: An ICS with offset 0 is assumed to be uninitialized
X-Git-Tag: v2.8.0-rc0~120^2~4
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=15ed653fa49a;p=users%2Fdwmw2%2Fqemu.git

ppc/xics: An ICS with offset 0 is assumed to be uninitialized

This will make life easier for dealing with dynamically configured
ICSes such as PHB3

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---

diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index 2db9f938d3..5aac67ad89 100644
--- a/include/hw/ppc/xics.h
+++ b/include/hw/ppc/xics.h
@@ -149,7 +149,7 @@ struct ICSState {
 
 static inline bool ics_valid_irq(ICSState *ics, uint32_t nr)
 {
-    return (nr >= ics->offset)
+    return (ics->offset != 0) && (nr >= ics->offset)
         && (nr < (ics->offset + ics->nr_irqs));
 }