Skip to contentSkip to conversation

hw/armv7m_nvic: Correctly register GIC region when setting up NVIC

PATCH In review Meador Inge 3 participants 5 messages Aug 27, 2012 – Sep 1, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/armv7m_nvic: Correctly register GIC region when setting up NVIC

When setting up the NVIC memory regions the memory range 0x100..0xcff is aliased to an IO memory region that belongs to the ARM GIC. This aliased region should be added to the NVIC memory container, but the actual GIC IO memory region was being added instead. This mixup was causing the wrong IO memory access functions to be called when accessing parts of the NVIC memory.

---
 hw/armv7m_nvic.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
hw/armv7m_nvic.c +2 -1
index 6a0832e..5c09116 100644
@@ -489,7 +489,8 @@ static int armv7m_nvic_init(SysBusDevice *dev)
      */
     memory_region_init_alias(&s->gic_iomem_alias, "nvic-gic", &s->gic.iomem,
                              0x100, 0xc00);
-    memory_region_add_subregion_overlap(&s->container, 0x100, &s->gic.iomem, 1);
+    memory_region_add_subregion_overlap(&s->container, 0x100,
+                                        &s->gic_iomem_alias, 1);
     /* Map the whole thing into system memory at the location required
      * by the v7M architecture.
      */
Signature · 1 line
1.7.7.6
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Meador Inge

When setting up the NVIC memory regions the memory range 0x100..0xcff is aliased to an IO memory region that belongs to the ARM GIC. This aliased region should be added to the NVIC memory container, but the actual GIC IO memory region was being added instead. This mixup was causing the wrong IO memory access functions to be called when accessing parts of the NVIC memory.

Whoops.

-- PMM

#2 lore raw
In reply to Meador Inge

Hi Anthony; I realised somewhat belatedly that this bugfix should probably go into 1.2 if possible. Can we still squeeze it in or is it too late?

Patchwork url: http://patchwork.ozlabs.org/patch/180315/

thanks
-- PMM

Quoted 30 lines · Meador Inge

When setting up the NVIC memory regions the memory range 0x100..0xcff is aliased to an IO memory region that belongs to the ARM GIC. This aliased region should be added to the NVIC memory container, but the actual GIC IO memory region was being added instead. This mixup was causing the wrong IO memory access functions to be called when accessing parts of the NVIC memory.

---
 hw/armv7m_nvic.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
hw/armv7m_nvic.c +2 -2
index 6a0832e..5c09116 100644
@@ -489,7 +489,8 @@ static int armv7m_nvic_init(SysBusDevice *dev)
      */
     memory_region_init_alias(&s->gic_iomem_alias, "nvic-gic", &s->gic.iomem,
                              0x100, 0xc00);
-    memory_region_add_subregion_overlap(&s->container, 0x100, &s->gic.iomem, 1);
+    memory_region_add_subregion_overlap(&s->container, 0x100,
+                                        &s->gic_iomem_alias, 1);
     /* Map the whole thing into system memory at the location required
      * by the v7M architecture.
      */
--

1.7.7.6

#3 lore raw
Quoted 5 lines · Peter Maydell

Hi Anthony; I realised somewhat belatedly that this bugfix should probably go into 1.2 if possible. Can we still squeeze it in or is it too late?

Patchwork url: http://patchwork.ozlabs.org/patch/180315/

It's too late for GA. Can go in via stable though.

Regards,

Anthony Liguori

Quoted 35 lines

thanks
-- PMM

Quoted 30 lines · Meador Inge

When setting up the NVIC memory regions the memory range 0x100..0xcff is aliased to an IO memory region that belongs to the ARM GIC. This aliased region should be added to the NVIC memory container, but the actual GIC IO memory region was being added instead. This mixup was causing the wrong IO memory access functions to be called when accessing parts of the NVIC memory.

---
 hw/armv7m_nvic.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
hw/armv7m_nvic.c +2 -2
index 6a0832e..5c09116 100644
@@ -489,7 +489,8 @@ static int armv7m_nvic_init(SysBusDevice *dev)
      */
     memory_region_init_alias(&s->gic_iomem_alias, "nvic-gic", &s->gic.iomem,
                              0x100, 0xc00);
-    memory_region_add_subregion_overlap(&s->container, 0x100, &s->gic.iomem, 1);
+    memory_region_add_subregion_overlap(&s->container, 0x100,
+                                        &s->gic_iomem_alias, 1);
     /* Map the whole thing into system memory at the location required
      * by the v7M architecture.
      */
--

1.7.7.6

#4 lore raw
Quoted 8 lines · Anthony Liguori
Quoted 5 lines · Peter Maydell

Hi Anthony; I realised somewhat belatedly that this bugfix should probably go into 1.2 if possible. Can we still squeeze it in or is it too late?

Patchwork url: http://patchwork.ozlabs.org/patch/180315/

It's too late for GA. Can go in via stable though.

Oh well, never mind. (I don't generally bother to feed ARM patches to stable; I figure people can wait til the next mainline release.)

-- PMM