hw/arm/bcm2836: Wire up CPU timer interrupts correctly
Subsystems (2)
PATCH 1/1 hw/arm/bcm2836: Wire up CPU timer interrupts correctly
Wire up the CPU timer interrupts in the right order, with the nonsecure physical timer on cntpnsirq, the hyp timer on cnthpirq, and the secure physical timer on cntpsirq. (We did get the virt timer right, at least.)
--- hw/arm/bcm2836.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
hw/arm/bcm2836.c +5 -1
@@ -136,9 +136,13 @@ static void bcm2836_realize(DeviceState *dev, Error **errp)/* Connect timers from the CPU to the interrupt controller */ qdev_connect_gpio_out (DEVICE (&s->cpus[n]),GTIMER_PHYS , -qdev_get_gpio_in_named (DEVICE (&s->control),"cntpsirq" , n)); +qdev_get_gpio_in_named (DEVICE (&s->control),"cntpnsirq" , n));qdev_connect_gpio_out (DEVICE (&s->cpus[n]),GTIMER_VIRT ,qdev_get_gpio_in_named (DEVICE (&s->control),"cntvirq" , n)); +qdev_connect_gpio_out (DEVICE (&s->cpus[n]),GTIMER_HYP , +qdev_get_gpio_in_named (DEVICE (&s->control),"cnthpirq" , n)); +qdev_connect_gpio_out (DEVICE (&s->cpus[n]),GTIMER_SEC , +qdev_get_gpio_in_named (DEVICE (&s->control),"cntpsirq" , n)); } }
Signature · 1 line
1.9.1
hw/arm/bcm2836.c static void bcm2836_realize(DeviceState *dev, Error
Quoted 17 lines · Peter Maydell
Wire up the CPU timer interrupts in the right order, with the nonsecure physical timer on cntpnsirq, the hyp timer on cnthpirq, and the secure physical timer on cntpsirq. (We did get the virt timer right, at least.)
Reported-by Antonio Huete Jiménez <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- hw/arm/bcm2836.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)hw/arm/bcm2836.c +0
-0@@ -136,9 +136,13 @@ static void bcm2836_realize(DeviceState *dev, Error
**errp)
hw/arm/bcm2836.c static void bcm2836_realize(DeviceState *dev, Error **errp)
Quoted 4 lines
hw/arm/bcm2836.c +0
-1/* Connect timers from the CPU to the interrupt controller */ qdev_connect_gpio_out(DEVICE(&s->cpus[n]), GTIMER_PHYS, - qdev_get_gpio_in_named(DEVICE(&s->control), "cntpsirq",
n));
hw/arm/bcm2836.c static void bcm2836_realize(DeviceState *dev, Error · line 138
Quoted 1 line
hw/arm/bcm2836.c +1
-0+ qdev_get_gpio_in_named(DEVICE(&s->control), "cntpnsirq",
n));
hw/arm/bcm2836.c static void bcm2836_realize(DeviceState *dev, Error · line 140
Quoted 2 lines
hw/arm/bcm2836.c +0
-0qdev_connect_gpio_out(DEVICE(&s->cpus[n]), GTIMER_VIRT, qdev_get_gpio_in_named(DEVICE(&s->control), "cntvirq",
n));
hw/arm/bcm2836.c static void bcm2836_realize(DeviceState *dev, Error · line 142
Quoted 2 lines
hw/arm/bcm2836.c +2
-0+ qdev_connect_gpio_out(DEVICE(&s->cpus[n]), GTIMER_HYP, + qdev_get_gpio_in_named(DEVICE(&s->control), "cnthpirq",
n));
hw/arm/bcm2836.c static void bcm2836_realize(DeviceState *dev, Error · line 144
Quoted 2 lines
hw/arm/bcm2836.c +2
-0+ qdev_connect_gpio_out(DEVICE(&s->cpus[n]), GTIMER_SEC, + qdev_get_gpio_in_named(DEVICE(&s->control), "cntpsirq",
n));
Quoted 7 lines
hw/arm/bcm2836.c +0
-1} } --1.9.1
What drives the order?
Quoted 9 lines · Thomas Hanson
Quoted 5 lines · Peter Maydell
Wire up the CPU timer interrupts in the right order, with the nonsecure physical timer on cntpnsirq, the hyp timer on cnthpirq, and the secure physical timer on cntpsirq. (We did get the virt timer right, at least.)
What drives the order?
This is modelling the hardware:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836/README.md
The interrupt controller has 4 lines named CNTPSIRQ, CNTPNSIRQ, etc, and we need to hook the lines from the CPU up to the interrupt controller appropriately. The names we ended up with in QEMU's CPU model (GTIMER_PHYS, etc) don't match the signal names that a hardware A7 uses, which is slightly irritating, but not a big deal.
The A7 TRM lists which timer is which signal:
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0464f/BABBABDJ.html
(though you can pretty much guess from the signal names).
thanks
-- PMM
Quoted 20 lines · Peter Maydell
Quoted 9 lines · Thomas Hanson
Quoted 5 lines · Peter Maydell
Wire up the CPU timer interrupts in the right order, with the nonsecure physical timer on cntpnsirq, the hyp timer on cnthpirq, and the secure physical timer on cntpsirq. (We did get the virt timer right, at least.)
What drives the order?
This is modelling the hardware:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836/README.mdThe interrupt controller has 4 lines named CNTPSIRQ, CNTPNSIRQ, etc, and we need to hook the lines from the CPU up to the interrupt controller appropriately. The names we ended up with in QEMU's CPU model (
GTIMER_PHYS, etc) don't match the signal names that a hardware A7 uses, which is slightly irritating, but not a big deal.
Quoted 6 lines
The A7 TRM lists which timer is which signal:
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0464f/BABBABDJ.html
(though you can pretty much guess from the signal names).thanks
-- PMM
Ah, thanks. I was thinking time-order. It's still early...
Quoted 10 lines
From: Peter Maydell [mailto:[email protected]]
Sent: Thursday, 17 March 2016 3:33 AMWire up the CPU timer interrupts in the right order, with the nonsecure physical timer on cntpnsirq, the hyp timer on cnthpirq, and the secure physical timer on cntpsirq. (We did get the virt timer right, at least.)
Reported-by Antonio Huete Jiménez <[email protected]>Signed-off-by Peter Maydell <[email protected]>
Thanks Peter!
Andrew