[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 47/48] hw/core/ptimer: Support ptimer being disabled by timer call
From: |
Peter Maydell |
Subject: |
[PULL 47/48] hw/core/ptimer: Support ptimer being disabled by timer callback |
Date: |
Tue, 27 Oct 2020 11:44:37 +0000 |
In ptimer_reload(), we call the callback function provided by the
timer device that is using the ptimer. This callback might disable
the ptimer. The code mostly handles this correctly, except that
we'll still print the warning about "Timer with delta zero,
disabling" if the now-disabled timer happened to be set such that it
would fire again immediately if it were enabled (eg because the
limit/reload value is zero).
Suppress the spurious warning message and the unnecessary
repeat-deletion of the underlying timer in this case.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20201015151829.14656-2-peter.maydell@linaro.org
---
hw/core/ptimer.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
index c6d2beb1dac..2aa97cb665c 100644
--- a/hw/core/ptimer.c
+++ b/hw/core/ptimer.c
@@ -117,6 +117,10 @@ static void ptimer_reload(ptimer_state *s, int
delta_adjust)
}
if (delta == 0) {
+ if (s->enabled == 0) {
+ /* trigger callback disabled the timer already */
+ return;
+ }
if (!qtest_enabled()) {
fprintf(stderr, "Timer with delta zero, disabling\n");
}
--
2.20.1
- [PULL 38/48] hw/misc/bcm2835_cprman: implement PLL channels behaviour, (continued)
- [PULL 38/48] hw/misc/bcm2835_cprman: implement PLL channels behaviour, Peter Maydell, 2020/10/27
- [PULL 39/48] hw/misc/bcm2835_cprman: add a clock mux skeleton implementation, Peter Maydell, 2020/10/27
- [PULL 42/48] hw/misc/bcm2835_cprman: add sane reset values to the registers, Peter Maydell, 2020/10/27
- [PULL 40/48] hw/misc/bcm2835_cprman: implement clock mux behaviour, Peter Maydell, 2020/10/27
- [PULL 41/48] hw/misc/bcm2835_cprman: add the DSI0HSCK multiplexer, Peter Maydell, 2020/10/27
- [PULL 44/48] hw/arm/bcm2835_peripherals: connect the UART clock, Peter Maydell, 2020/10/27
- [PULL 43/48] hw/char/pl011: add a clock input, Peter Maydell, 2020/10/27
- [PULL 46/48] hw/arm/sbsa-ref: add SBSA watchdog device, Peter Maydell, 2020/10/27
- [PULL 45/48] hw/watchdog: Implement SBSA watchdog device, Peter Maydell, 2020/10/27
- [PULL 48/48] hw/timer/armv7m_systick: Rewrite to use ptimers, Peter Maydell, 2020/10/27
- [PULL 47/48] hw/core/ptimer: Support ptimer being disabled by timer callback,
Peter Maydell <=
- Re: [PULL 00/48] target-arm queue, no-reply, 2020/10/27
- Re: [PULL 00/48] target-arm queue, Peter Maydell, 2020/10/29