Skip to contentSkip to conversation

MPS/v8M bug fixes

PATCH In review Peter Maydell 3 participants 5 messages Jul 27, 2018 – Jul 28, 2018

lore
Share & tools
lore
#0 lore raw

cover MPS/v8M bug fixes

This patchset fixes a couple of bugs I found in the v8M and MPS board code:
* migration wasn't working because of an incorrect subsection name in the NVIC vmstate
* the timer1 IRQ line was miswired in the iotkit

Neither of these are strictly speaking regressions from 2.12, but because they're so simple they seem worth getting into 3.0 (especially the first one, which means migration of any v8M system won't work at all.)

thanks
-- PMM

Peter Maydell (2):
armv7m_nvic: Fix m-security subsection name hw/arm/iotkit: Fix IRQ number for timer1

 hw/arm/iotkit.c       | 2 +-
 hw/intc/armv7m_nvic.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 armv7m_nvic: Fix m-security subsection name

The vmstate save/load code insists that subsections of a VMState must have names which include their parent VMState's name as a leading substring. Unfortunately it neither documents this nor checks it on device init or state save, but instead fails state load with a confusing error message ("Missing section footer for armv7m_nvic").

Fix the name of the m-security subsection of the NVIC, so that state save/load works correctly for the security-enabled NVIC.

---
 hw/intc/armv7m_nvic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/armv7m_nvic.c +1 -1
index 6be7fc5266d..cd1e7f17299 100644
@@ -2064,7 +2064,7 @@ static int nvic_security_post_load(void *opaque, int version_id)
 }
 
 static const VMStateDescription vmstate_nvic_security = {
-    .name = "nvic/m-security",
+    .name = "armv7m_nvic/m-security",
     .version_id = 1,
     .minimum_version_id = 1,
     .needed = nvic_security_needed,
Signature · 1 line
2.17.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [Qemu-devel] [PATCH for-3.0 1/2] armv7m_nvic: Fix m-security subsection name

Quoted 6 lines · Peter Maydell

The vmstate save/load code insists that subsections of a VMState must have names which include their parent VMState's name as a leading substring. Unfortunately it neither documents this nor checks it on device init or state save, but instead fails state load with a confusing error message ("Missing section footer for armv7m_nvic").

Quoted 7 lines

Fix the name of the m-security subsection of the NVIC, so that state save/load works correctly for the security-enabled NVIC.

---
 hw/intc/armv7m_nvic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

r~

#3 lore raw

PATCH 2/2 hw/arm/iotkit: Fix IRQ number for timer1

In reply to Peter Maydell

A cut-and-paste error meant we were incorrectly wiring up the timer1 IRQ to IRQ3. IRQ3 is the interrupt for timer0 -- move timer0 to IRQ4 where it belongs.

---
 hw/arm/iotkit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/iotkit.c +1 -1
index c76d3ed7435..8cadc8b1608 100644
@@ -382,7 +382,7 @@ static void iotkit_realize(DeviceState *dev, Error **errp)
         return;
     }
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->timer1), 0,
-                       qdev_get_gpio_in(DEVICE(&s->armv7m), 3));
+                       qdev_get_gpio_in(DEVICE(&s->armv7m), 4));
     mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->timer1), 0);
     object_property_set_link(OBJECT(&s->apb_ppc0), OBJECT(mr), "port[1]", &err);
     if (err) {
Signature · 1 line
2.17.1
Reviewed-by on v1 2/2
#4 lore raw

Re: [Qemu-arm] [PATCH for-3.0 2/2] hw/arm/iotkit: Fix IRQ number for timer1

Quoted 5 lines · Peter Maydell

A cut-and-paste error meant we were incorrectly wiring up the timer1 IRQ to IRQ3. IRQ3 is the interrupt for timer0 -- move timer0 to IRQ4 where it belongs.

(ARM-ECM-0601256 Table 66 Interrupt Map)

Quoted 18 lines
---
 hw/arm/iotkit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/iotkit.c +1 -1
index c76d3ed7435..8cadc8b1608 100644
@@ -382,7 +382,7 @@ static void iotkit_realize(DeviceState *dev, Error **errp)
         return;
     }
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->timer1), 0,
-                       qdev_get_gpio_in(DEVICE(&s->armv7m), 3));
+                       qdev_get_gpio_in(DEVICE(&s->armv7m), 4));
     mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->timer1), 0);
     object_property_set_link(OBJECT(&s->apb_ppc0), OBJECT(mr), "port[1]", &err);
     if (err) {