[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/36] hw/timer/armv7m_systick: assert that board code set system_
From: |
Peter Maydell |
Subject: |
[PULL 05/36] hw/timer/armv7m_systick: assert that board code set system_clock_scale |
Date: |
Mon, 14 Sep 2020 15:06:10 +0100 |
It is the responsibility of board code for an armv7m system to set
system_clock_scale appropriately for the CPU speed of the core.
If it forgets to do this, then QEMU will hang if the guest tries
to use the systick timer in the "tick at the CPU clock frequency" mode.
We forgot that in a couple of our boards (see commits ce4f70e81ed23c93f,
e7e5a9595ab1136). Add an assertion in the systick reset method so
we don't let any new boards in with the same bug.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20200825160847.18091-1-peter.maydell@linaro.org
---
hw/timer/armv7m_systick.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/timer/armv7m_systick.c b/hw/timer/armv7m_systick.c
index 74c58bcf245..a8cec7eb56b 100644
--- a/hw/timer/armv7m_systick.c
+++ b/hw/timer/armv7m_systick.c
@@ -202,6 +202,14 @@ static void systick_reset(DeviceState *dev)
{
SysTickState *s = SYSTICK(dev);
+ /*
+ * Forgetting to set system_clock_scale is always a board code
+ * bug. We can't check this earlier because for some boards
+ * (like stellaris) it is not yet configured at the point where
+ * the systick device is realized.
+ */
+ assert(system_clock_scale != 0);
+
s->control = 0;
s->reload = 0;
s->tick = 0;
--
2.20.1
- [PULL 00/36] target-arm queue, Peter Maydell, 2020/09/14
- [PULL 01/36] hw/misc/a9scu: Do not allow invalid CPU count, Peter Maydell, 2020/09/14
- [PULL 02/36] hw/misc/a9scu: Simplify setting MemoryRegionOps::valid fields, Peter Maydell, 2020/09/14
- [PULL 03/36] hw/misc/a9scu: Simplify setting MemoryRegionOps::impl fields, Peter Maydell, 2020/09/14
- [PULL 04/36] hw/misc/a9scu: Report unimplemented accesses with qemu_log_mask(UNIMP), Peter Maydell, 2020/09/14
- [PULL 05/36] hw/timer/armv7m_systick: assert that board code set system_clock_scale,
Peter Maydell <=
- [PULL 06/36] decodetree: Improve identifier matching, Peter Maydell, 2020/09/14
- [PULL 07/36] target/arm: Convert Neon 3-same-fp size field to MO_* in decode, Peter Maydell, 2020/09/14
- [PULL 08/36] target/arm: Convert Neon VCVT fp size field to MO_* in decode, Peter Maydell, 2020/09/14
- [PULL 09/36] target/arm: Convert VCMLA, VCADD size field to MO_* in decode, Peter Maydell, 2020/09/14
- [PULL 11/36] target/arm: Remove no-longer-reachable 32-bit KVM code, Peter Maydell, 2020/09/14
- [PULL 10/36] target/arm: Remove KVM support for 32-bit Arm hosts, Peter Maydell, 2020/09/14
- [PULL 12/36] hw/arm/mps2: New board model mps2-an386, Peter Maydell, 2020/09/14
- [PULL 13/36] hw/arm/mps2: New board model mps2-an500, Peter Maydell, 2020/09/14
- [PULL 14/36] docs/system/arm/mps2.rst: Make board list consistent, Peter Maydell, 2020/09/14
- [PULL 15/36] Deprecate Unicore32 port, Peter Maydell, 2020/09/14