[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH 2/5] aspeed/timer: Status register contains reload for
From: |
Cédric Le Goater |
Subject: |
[Qemu-arm] [PATCH 2/5] aspeed/timer: Status register contains reload for stopped timer |
Date: |
Thu, 14 Mar 2019 09:42:32 +0100 |
From: Andrew Jeffery <address@hidden>
>From the datasheet:
This register stores the current status of counter #N. When timer
enable bit TMC30[N * b] is disabled, the reload register will be
loaded into this counter. When timer bit TMC30[N * b] is set, the
counter will start to decrement. CPU can update this register value
when enable bit is set.
Signed-off-by: Andrew Jeffery <address@hidden>
Signed-off-by: Cédric Le Goater <address@hidden>
---
hw/timer/aspeed_timer.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c
index 9ffd8e09f670..2f8522a597d3 100644
--- a/hw/timer/aspeed_timer.c
+++ b/hw/timer/aspeed_timer.c
@@ -187,7 +187,11 @@ static uint64_t aspeed_timer_get_value(AspeedTimer *t, int
reg)
switch (reg) {
case TIMER_REG_STATUS:
- value = calculate_ticks(t, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
+ if (timer_enabled(t)) {
+ value = calculate_ticks(t, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
+ } else {
+ value = t->reload;
+ }
break;
case TIMER_REG_RELOAD:
value = t->reload;
--
2.20.1
- [Qemu-arm] [PATCH 0/5] aspeed/timer: Fix slowdowns in recent Linux, Cédric Le Goater, 2019/03/14
- [Qemu-arm] [PATCH 1/5] aspeed/timer: Fix behaviour running Linux, Cédric Le Goater, 2019/03/14
- [Qemu-arm] [PATCH 2/5] aspeed/timer: Status register contains reload for stopped timer,
Cédric Le Goater <=
- [Qemu-arm] [PATCH 3/5] aspeed/timer: Fix match calculations, Cédric Le Goater, 2019/03/14
- [Qemu-arm] [PATCH 4/5] aspeed/timer: Provide back-pressure information for short periods, Cédric Le Goater, 2019/03/14
- [Qemu-arm] [PATCH 5/5] aspeed/timer: Use signed muldiv for timer resets, Cédric Le Goater, 2019/03/14
- Re: [Qemu-arm] [PATCH 5/5] aspeed/timer: Use signed muldiv for timer resets, Peter Maydell, 2019/03/14
- Re: [Qemu-arm] [Qemu-devel] [PATCH 0/5] aspeed/timer: Fix slowdowns in recent Linux, no-reply, 2019/03/14