qemu-e2k/hw/timer
Guenter Roeck 1a391e20c3 hw/timer/exynos4210_mct: Initialize ptimer before starting it
When booting a recent Linux kernel, the qemu message "Timer with delta
zero, disabling" is seen, apparently because a ptimer is started before
being initialized.  Fix the problem by initializing the offending ptimer
before starting it.

The bug is effectively harmless in the old QEMUBH setup
because the sequence of events is:
 * the delta zero means the timer expires immediately
 * ptimer_reload() arranges for exynos4210_gfrc_event() to be called
 * ptimer_reload() notices the zero delta and disables the timer
 * later, the QEMUBH runs, and exynos4210_gfrc_event() correctly
   configures the timer and restarts it

In the new transaction based API the bug is still harmless,
but differences of when the callback function runs mean the
message is not printed any more:
 * ptimer_run() does nothing as it's inside a transaction block
 * ptimer_transaction_commit() sees it has work to do and
   calls ptimer_reload()
 * the zero delta means the timer expires immediately
 * ptimer_reload() calls exynos4210_gfrc_event() directly
 * exynos4210_gfrc_event() configures the timer
 * the delta is no longer zero so ptimer_reload() doesn't complain
   (the zero-delta test is after the trigger-callback in
   the ptimer_reload() function)

Regardless, the behaviour here was not intentional, and we should
just program the ptimer correctly to start with.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20191018143149.9216-1-peter.maydell@linaro.org
[PMM: Expansion/clarification of the commit message:
 the message is about a zero delta, not a zero period;
 added detail to the commit message of the analysis of what
 is happening and why the kernel boots even with the message;
 added note that the message goes away with the new ptimer API]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-10-22 17:44:00 +01:00
..
Kconfig hw/Kconfig: Move the generic XLNX_ZYNQMP to the root hw/Kconfig 2019-08-19 21:28:25 +02:00
Makefile.objs hw: timer: Add ASPEED RTC device 2019-07-01 17:28:59 +01:00
a9gtimer.c hw/core: Move cpu.c, cpu.h from qom/ to hw/core/ 2019-08-21 13:24:01 +02:00
allwinner-a10-pit.c hw/timer/allwinner-a10-pit.c: Switch to transaction-based ptimer API 2019-10-15 18:09:02 +01:00
altera_timer.c ptimer: Rename ptimer_init() to ptimer_init_with_bh() 2019-10-15 18:09:02 +01:00
arm_mptimer.c hw/timer/arm_mptimer.c: Switch to transaction-based ptimer API 2019-10-15 18:09:02 +01:00
arm_timer.c hw/timer/arm_timer.c: Switch to transaction-based ptimer API 2019-10-15 18:09:02 +01:00
armv7m_systick.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
aspeed_rtc.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
aspeed_timer.c aspeed/timer: Add support for IRQ status register on the AST2600 2019-10-15 18:09:04 +01:00
cadence_ttc.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
cmsdk-apb-dualtimer.c hw/timer/cmsdk-apb-dualtimer.c: Switch to transaction-based ptimer API 2019-10-15 18:09:02 +01:00
cmsdk-apb-timer.c hw/timer/cmsdk-apb-timer.c: Switch to transaction-based ptimer API 2019-10-15 18:09:02 +01:00
digic-timer.c hw/timer/digic-timer.c: Switch to transaction-based ptimer API 2019-10-15 18:09:02 +01:00
ds1338.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
etraxfs_timer.c ptimer: Rename ptimer_init() to ptimer_init_with_bh() 2019-10-15 18:09:02 +01:00
exynos4210_mct.c hw/timer/exynos4210_mct: Initialize ptimer before starting it 2019-10-22 17:44:00 +01:00
exynos4210_pwm.c hw/timer/exynos4210_pwm.c: Switch to transaction-based ptimer API 2019-10-15 18:09:02 +01:00
exynos4210_rtc.c hw/timer/exynos4210_rtc.c: Switch main ptimer to transaction-based API 2019-10-15 18:09:03 +01:00
grlib_gptimer.c ptimer: Rename ptimer_init() to ptimer_init_with_bh() 2019-10-15 18:09:02 +01:00
hpet.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
i8254.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
i8254_common.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
imx_epit.c hw/timer/imx_epit.c: Switch to transaction-based ptimer API 2019-10-15 18:09:03 +01:00
imx_gpt.c hw/timer/imx_gpt.c: Switch to transaction-based ptimer API 2019-10-15 18:09:03 +01:00
lm32_timer.c ptimer: Rename ptimer_init() to ptimer_init_with_bh() 2019-10-15 18:09:02 +01:00
m41t80.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
m48t59-internal.h Normalize header guard symbol definition. 2019-05-13 08:58:55 +02:00
m48t59-isa.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
m48t59.c sysemu: Split sysemu/runstate.h off sysemu/sysemu.h 2019-08-16 13:37:36 +02:00
mc146818rtc.c mc146818rtc: Remove reset notifiers 2019-08-20 17:26:20 +02:00
milkymist-sysctl.c ptimer: Rename ptimer_init() to ptimer_init_with_bh() 2019-10-15 18:09:02 +01:00
mips_gictimer.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
mss-timer.c hw/timer/mss-timerc: Switch to transaction-based ptimer API 2019-10-15 18:09:03 +01:00
nrf51_timer.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
omap_gptimer.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
omap_synctimer.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
pl031.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
puv3_ost.c ptimer: Rename ptimer_init() to ptimer_init_with_bh() 2019-10-15 18:09:02 +01:00
pxa2xx_timer.c sysemu: Split sysemu/runstate.h off sysemu/sysemu.h 2019-08-16 13:37:36 +02:00
sh_timer.c ptimer: Rename ptimer_init() to ptimer_init_with_bh() 2019-10-15 18:09:02 +01:00
slavio_timer.c ptimer: Rename ptimer_init() to ptimer_init_with_bh() 2019-10-15 18:09:02 +01:00
stm32f2xx_timer.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
sun4v-rtc.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
trace-events hw: timer: Add ASPEED RTC device 2019-07-01 17:28:59 +01:00
twl92230.c Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
xilinx_timer.c ptimer: Rename ptimer_init() to ptimer_init_with_bh() 2019-10-15 18:09:02 +01:00
xlnx-zynqmp-rtc.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00