Skip to contentSkip to conversation

arm: add dummy gic security registers

PATCH Superseded Mark Langsdorf 2 participants 4 messages Dec 20, 2011

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 4/9 arm: add dummy gic security registers

From: Rob Herring <[email protected]>

---
 hw/arm_gic.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
hw/arm_gic.c +8 -2
index 9b52119..5974c2f 100644
@@ -274,7 +274,7 @@ static uint32_t gic_dist_readb(void *opaque, target_phys_addr_t offset)
 
     cpu = gic_get_current_cpu();
     cm = 1 << cpu;
-    if (offset < 0x100) {
+    if (offset < 0x80) {
 #ifndef NVIC
         if (offset == 0)
             return s->enabled;
@@ -284,6 +284,9 @@ static uint32_t gic_dist_readb(void *opaque, target_phys_addr_t offset)
             return 0;
 #endif
         goto bad_reg;
+    } else if (offset < 0x100) {
+        /* Interrupt Security */
+        return 0;
     } else if (offset < 0x200) {
         /* Interrupt Set/Clear Enable.  */
         if (offset < 0x180)
@@ -404,7 +407,7 @@ static void gic_dist_writeb(void *opaque, target_phys_addr_t offset,
     int cpu;
 
     cpu = gic_get_current_cpu();
-    if (offset < 0x100) {
+    if (offset < 0x80) {
 #ifdef NVIC
         goto bad_reg;
 #else
@@ -417,6 +420,9 @@ static void gic_dist_writeb(void *opaque, target_phys_addr_t offset,
             goto bad_reg;
         }
 #endif
+    } else if (offset < 0x100) {
+        /* Interrupt Security Registers */
+        /* ignore */
     } else if (offset < 0x180) {
         /* Interrupt Set Enable.  */
         irq = (offset - 0x100) * 8 + GIC_BASE_IRQ;
Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 23 lines · Mark Langsdorf

From: Rob Herring <[email protected]>

---
 hw/arm_gic.c |   10 ++++++++--

 1 files changed, 8 insertions(+), 2 deletions(-)
hw/arm_gic.c +1 -1
index 9b52119..5974c2f 100644
@@ -274,7 +274,7 @@ static uint32_t gic_dist_readb(void *opaque,
 target_phys_addr_t offset)
 
     cpu = gic_get_current_cpu();
     cm = 1 << cpu;
-    if (offset < 0x100) {
+    if (offset < 0x80) {
  #ifndef NVIC
         if (offset == 0)

            return s->enabled;

hw/arm_gic.c static uint32_t gic_dist_readb(void *opaque, · line 290

Quoted 7 lines
hw/arm_gic.c +3 -0
@@ -284,6 +284,9 @@ static uint32_t gic_dist_readb(void *opaque,
 target_phys_addr_t offset)
             return 0;
  #endif
         goto bad_reg;
+    } else if (offset < 0x100) {
+        /* Interrupt Security */
+        return 0;

This won't actually break anything, but really the handling of 0x80..0xff would be inside the first if() clause, because of the way we piggyback the v7M NVIC off these functions. (We should clean that up, really). Anyway, the v7M NVIC doesn't own 0x0..0xff, which is what the first if () clause is marking off. Ditto in the write function.

It would also be nice to have the comment explicitly say that these registers are defined to RAZ/WI in GIC implementations that don't implement the security extensions.

(Strictly speaking, in the 11MPcore GIC these locations are reserved and probably don't RAZ/WI, but I don't think we need to worry about that wrinkle now.)

Quoted 23 lines
hw/arm_gic.c +0 -0
     } else if (offset < 0x200) {
         /* Interrupt Set/Clear Enable.  */

        if (offset < 0x180)

hw/arm_gic.c +1 -1
@@ -404,7 +407,7 @@ static void gic_dist_writeb(void *opaque,
 target_phys_addr_t offset,
     int cpu;
 
     cpu = gic_get_current_cpu();
-    if (offset < 0x100) {
+    if (offset < 0x80) {
  #ifdef NVIC
         goto bad_reg;

 #else

hw/arm_gic.c +3 -0
@@ -417,6 +420,9 @@ static void gic_dist_writeb(void *opaque,
 target_phys_addr_t offset,
             goto bad_reg;
         }
  #endif
+    } else if (offset < 0x100) {
+        /* Interrupt Security Registers */
+        /* ignore */
     } else if (offset < 0x180) {
         /* Interrupt Set Enable.  */
Quoted 4 lines

        irq = (offset - 0x100) * 8 + GIC_BASE_IRQ; --
1.7.5.4

-- PMM

#2 lore raw
Quoted 38 lines · Peter Maydell
Quoted 23 lines · Mark Langsdorf

From: Rob Herring<[email protected]>

---
  hw/arm_gic.c |   10 ++++++++--
  1 files changed, 8 insertions(+), 2 deletions(-)
hw/arm_gic.c +1 -1
index 9b52119..5974c2f 100644
@@ -274,7 +274,7 @@ static uint32_t gic_dist_readb(void *opaque,
 target_phys_addr_t offset)
 
     cpu = gic_get_current_cpu();
     cm = 1<<  cpu;
-    if (offset<  0x100) {
+    if (offset<  0x80) {
  #ifndef NVIC
         if (offset == 0)
             return s->enabled;

hw/arm_gic.c static uint32_t gic_dist_readb(void *opaque, · line 290

Quoted 7 lines
hw/arm_gic.c +3 -0
@@ -284,6 +284,9 @@ static uint32_t gic_dist_readb(void *opaque,
 target_phys_addr_t offset)
             return 0;
  #endif
         goto bad_reg;
+    } else if (offset<  0x100) {
+        /* Interrupt Security */
+        return 0;

This won't actually break anything, but really the handling of 0x80..0xff would be inside the first if() clause, because of the way we piggyback the v7M NVIC off these functions. (We should clean that up, really). Anyway, the v7M NVIC doesn't own 0x0..0xff, which is what the first if () clause is marking off. Ditto in the write function.

Quoted 4 lines

It would also be nice to have the comment explicitly say that these registers are defined to RAZ/WI in GIC implementations that don't implement the security extensions.

I'm not sure what changes you want made here. I can resubmit with the comment. But I don't know how qemu piggybacks the v7M NVIC so I don't understand what you want done.

--Mark Langsdorf
Calxeda, Inc.

#3 lore raw
Quoted 39 lines · Mark Langsdorf
Quoted 38 lines · Peter Maydell
Quoted 23 lines · Mark Langsdorf

From: Rob Herring<[email protected]>

---
  hw/arm_gic.c |   10 ++++++++--

  1 files changed, 8 insertions(+), 2 deletions(-)
hw/arm_gic.c +1 -1
index 9b52119..5974c2f 100644
@@ -274,7 +274,7 @@ static uint32_t gic_dist_readb(void *opaque,
 target_phys_addr_t offset)
 
      cpu = gic_get_current_cpu();
      cm = 1<<  cpu;
-    if (offset<  0x100) {
+    if (offset<  0x80) {
   #ifndef NVIC
          if (offset == 0)

             return s->enabled;

hw/arm_gic.c static uint32_t gic_dist_readb(void *opaque, · line 290

Quoted 7 lines
hw/arm_gic.c +3 -0
@@ -284,6 +284,9 @@ static uint32_t gic_dist_readb(void *opaque,
 target_phys_addr_t offset)
              return 0;
   #endif
          goto bad_reg;
+    } else if (offset<  0x100) {
+        /* Interrupt Security */
+        return 0;

This won't actually break anything, but really the handling of 0x80..0xff would be inside the first if() clause, because of the way we piggyback the v7M NVIC off these functions. (We should clean that up, really). Anyway, the v7M NVIC doesn't own 0x0..0xff, which is what the first if () clause is marking off. Ditto in the write function.

Quoted 7 lines
Quoted 4 lines

It would also be nice to have the comment explicitly say that these registers are defined to RAZ/WI in GIC implementations that don't implement the security extensions.

I'm not sure what changes you want made here. I can resubmit with the comment. But I don't know how qemu piggybacks the v7M NVIC so I don't understand what you want done.

I just mean that you want something like

    if (offset < 0x100) {
#ifndef NVIC
        if (offset == 0)
            return s->enabled;
        if (offset == 4)
            return ((GIC_NIRQ / 32) - 1) | ((NUM_CPU(s) - 1) << 5);
        if (offset < 0x08)
            return 0;
        if (offset >= 0x80 && offset < 0x100) {
            /* Interrupt security, RAZ/WI */
            return 0;
        }
#endif
        goto bad_reg;
    } else if (offset < 0x200) {

to keep this GIC-only register inside the not-NVIC ifdef.

(I really want to clean this up but I can't do that until we can properly have memory regions which don't start at a page boundary and which pass the right offset through.)

-- PMM