[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 33/51] hw/m68k/mcf5206.c: Switch to transaction-based ptimer API
From: |
Peter Maydell |
Subject: |
[PULL 33/51] hw/m68k/mcf5206.c: Switch to transaction-based ptimer API |
Date: |
Thu, 24 Oct 2019 17:27:06 +0100 |
Switch the mcf5206 code away from bottom-half based ptimers to
the new transaction-based ptimer API. This just requires adding
begin/commit calls around the various places that modify the ptimer
state, and using the new ptimer_init() function to create the timer.
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Message-id: address@hidden
---
hw/m68k/mcf5206.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c
index a49096367cb..b155dd81705 100644
--- a/hw/m68k/mcf5206.c
+++ b/hw/m68k/mcf5206.c
@@ -8,7 +8,6 @@
#include "qemu/osdep.h"
#include "qemu/error-report.h"
-#include "qemu/main-loop.h"
#include "cpu.h"
#include "hw/hw.h"
#include "hw/irq.h"
@@ -57,10 +56,12 @@ static void m5206_timer_recalibrate(m5206_timer_state *s)
int prescale;
int mode;
+ ptimer_transaction_begin(s->timer);
ptimer_stop(s->timer);
- if ((s->tmr & TMR_RST) == 0)
- return;
+ if ((s->tmr & TMR_RST) == 0) {
+ goto exit;
+ }
prescale = (s->tmr >> 8) + 1;
mode = (s->tmr >> 1) & 3;
@@ -78,6 +79,8 @@ static void m5206_timer_recalibrate(m5206_timer_state *s)
ptimer_set_limit(s->timer, s->trr, 0);
ptimer_run(s->timer, 0);
+exit:
+ ptimer_transaction_commit(s->timer);
}
static void m5206_timer_trigger(void *opaque)
@@ -123,7 +126,9 @@ static void m5206_timer_write(m5206_timer_state *s,
uint32_t addr, uint32_t val)
s->tcr = val;
break;
case 0xc:
+ ptimer_transaction_begin(s->timer);
ptimer_set_count(s->timer, val);
+ ptimer_transaction_commit(s->timer);
break;
case 0x11:
s->ter &= ~val;
@@ -137,11 +142,9 @@ static void m5206_timer_write(m5206_timer_state *s,
uint32_t addr, uint32_t val)
static m5206_timer_state *m5206_timer_init(qemu_irq irq)
{
m5206_timer_state *s;
- QEMUBH *bh;
s = g_new0(m5206_timer_state, 1);
- bh = qemu_bh_new(m5206_timer_trigger, s);
- s->timer = ptimer_init_with_bh(bh, PTIMER_POLICY_DEFAULT);
+ s->timer = ptimer_init(m5206_timer_trigger, s, PTIMER_POLICY_DEFAULT);
s->irq = irq;
m5206_timer_reset(s);
return s;
--
2.20.1
- [PULL 24/51] linux-user/aarch64: Rebuild hflags for TARGET_WORDS_BIGENDIAN, (continued)
- [PULL 24/51] linux-user/aarch64: Rebuild hflags for TARGET_WORDS_BIGENDIAN, Peter Maydell, 2019/10/24
- [PULL 25/51] linux-user/arm: Rebuild hflags for TARGET_WORDS_BIGENDIAN, Peter Maydell, 2019/10/24
- [PULL 26/51] target/arm: Rely on hflags correct in cpu_get_tb_cpu_state, Peter Maydell, 2019/10/24
- [PULL 27/51] hw/net/fsl_etsec/etsec.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/24
- [PULL 28/51] hw/timer/xilinx_timer.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/24
- [PULL 29/51] hw/dma/xilinx_axidma.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/24
- [PULL 30/51] hw/timer/slavio_timer: Remove useless check for NULL t->timer, Peter Maydell, 2019/10/24
- [PULL 32/51] hw/timer/grlib_gptimer.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/24
- [PULL 34/51] hw/watchdog/milkymist-sysctl.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/24
- [PULL 31/51] hw/timer/slavio_timer.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/24
- [PULL 33/51] hw/m68k/mcf5206.c: Switch to transaction-based ptimer API,
Peter Maydell <=
- [PULL 35/51] target/arm/monitor: Introduce qmp_query_cpu_model_expansion, Peter Maydell, 2019/10/24
- [PULL 36/51] tests: arm: Introduce cpu feature tests, Peter Maydell, 2019/10/24
- [PULL 37/51] target/arm: Allow SVE to be disabled via a CPU property, Peter Maydell, 2019/10/24
- [PULL 40/51] target/arm/kvm64: max cpu: Enable SVE when available, Peter Maydell, 2019/10/24
- [PULL 41/51] target/arm/kvm: scratch vcpu: Preserve input kvm_vcpu_init features, Peter Maydell, 2019/10/24
- [PULL 39/51] target/arm/kvm64: Add kvm_arch_get/put_sve, Peter Maydell, 2019/10/24
- [PULL 38/51] target/arm/cpu64: max cpu: Introduce sve<N> properties, Peter Maydell, 2019/10/24
- [PULL 44/51] hw/misc/bcm2835_thermal: Add a dummy BCM2835 thermal sensor, Peter Maydell, 2019/10/24
- [PULL 45/51] hw/arm/bcm2835_peripherals: Use the thermal sensor block, Peter Maydell, 2019/10/24
- [PULL 43/51] target/arm/kvm: host cpu: Add support for sve<N> properties, Peter Maydell, 2019/10/24