The ARM GIC documentation (page 4-119) describes that bits
7 to 4 of the ICPIDR2 register should include the GIC architecture
version. This patche ORs the version into the existing return value.

Signed-off-by: Alistair Francis <alistair.fran...@xilinx.com>
Tested-by: Sören Brinkmann <soren.brinkm...@xilinx.com>
---

 hw/intc/arm_gic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
index 13e297d..f47d606 100644
--- a/hw/intc/arm_gic.c
+++ b/hw/intc/arm_gic.c
@@ -688,6 +688,10 @@ static uint32_t gic_dist_readb(void *opaque, hwaddr 
offset, MemTxAttrs attrs)
     } else /* offset >= 0xfe0 */ {
         if (offset & 3) {
             res = 0;
+        } else if (offset == 0xfe8 && s->revision != REV_11MPCORE &&
+                                      s->revision != REV_NVIC) {
+            /* ICPIDR2 includes the GICv1 or GICv2 version information */
+            res = gic_id[(offset - 0xfe0) >> 2] | (s->revision << 4);
         } else {
             res = gic_id[(offset - 0xfe0) >> 2];
         }
-- 
2.5.0


Reply via email to