[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] hw/timer/armv7m_systick: assert that board code set system_clock
From: |
Peter Maydell |
Subject: |
[PATCH] hw/timer/armv7m_systick: assert that board code set system_clock_scale |
Date: |
Mon, 12 Oct 2020 16:33:41 +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>
---
In the longer term we should make this a clocktree input and
plumb it through the armv7m container and so on, but for the
moment this assert() improves the current situation.
---
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
- [PATCH] configure: Test that gio libs from pkg-config work, (continued)
- [PATCH] configure: Test that gio libs from pkg-config work, Peter Maydell, 2020/10/12
- [PATCH for-5.1] docs/system/arm/virt: Document mte machine option, Peter Maydell, 2020/10/12
- [PATCH for-5.1] hw/arm/armsse: Assert info->num_cpus is in-bounds in armsse_realize(), Peter Maydell, 2020/10/12
- [PATCH 01/10] decodetree: Fix codegen for non-overlapping group inside overlapping group, Peter Maydell, 2020/10/12
- [PATCH for-5.1] hw/arm/nrf51_soc: Set system_clock_scale, Peter Maydell, 2020/10/12
- [PATCH] hw/arm/mps2: New board model mps2-386, Peter Maydell, 2020/10/12
- [PATCH for-5.1] hw/arm/netduino2, netduinoplus2: Set system_clock_scale, Peter Maydell, 2020/10/12
- [PATCH] hw/input/virtio-input-hid.c: Don't undef CONFIG_CURSES, Peter Maydell, 2020/10/12
- [PATCH] hw/display/bcm2835_fb.c: Initialize all fields of struct, Peter Maydell, 2020/10/12
- [PATCH] hw/timer/armv7m_systick: assert that board code set system_clock_scale,
Peter Maydell <=
- [PATCH] hw/virtio/virtio-iommu-pci.c: Fix typo in error message, Peter Maydell, 2020/10/12
- [PATCH] hw/intc/arm_gicv3_cpuif: Don't copy CPU's maintenance interrupt, Peter Maydell, 2020/10/12
- [PATCH for-5.1] hw/timer/imx_epit: Avoid assertion when CR.SWR is written, Peter Maydell, 2020/10/12
- [PATCH] hw/intc/arm_gicv3_cpuif: Make GIC maintenance interrupts work, Peter Maydell, 2020/10/12
- [RFC PATCH v2] linux-user: Use FD_32BIT_MODE fd flag for 32-bit guests, Peter Maydell, 2020/10/12
- [PATCH] linux-user/arm/signal.c: Drop TARGET_CONFIG_CPU_32, Peter Maydell, 2020/10/12
- [PATCH] msf2-soc, stellaris: Don't wire up SYSRESETREQ, Peter Maydell, 2020/10/12
- [PATCH] meson.build: Don't look for libudev for static builds, Peter Maydell, 2020/10/12
- [PATCH] target/arm: Delete unused ARM_FEATURE_CRC, Peter Maydell, 2020/10/12
- [PATCH] net/tap-solaris.c: Include qemu-common.h for TFR macro, Peter Maydell, 2020/10/12