[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/68] hw/arm/musicpal.c: Switch to transaction-based ptimer API
From: |
Peter Maydell |
Subject: |
[PULL 08/68] hw/arm/musicpal.c: Switch to transaction-based ptimer API |
Date: |
Mon, 14 Oct 2019 17:03:04 +0100 |
Switch the musicpal 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: Richard Henderson <address@hidden>
Message-id: address@hidden
---
hw/arm/musicpal.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index b3624d5e280..f68a399a984 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -843,13 +843,10 @@ static void mv88w8618_timer_tick(void *opaque)
static void mv88w8618_timer_init(SysBusDevice *dev, mv88w8618_timer_state *s,
uint32_t freq)
{
- QEMUBH *bh;
-
sysbus_init_irq(dev, &s->irq);
s->freq = freq;
- bh = qemu_bh_new(mv88w8618_timer_tick, s);
- s->ptimer = ptimer_init_with_bh(bh, PTIMER_POLICY_DEFAULT);
+ s->ptimer = ptimer_init(mv88w8618_timer_tick, s, PTIMER_POLICY_DEFAULT);
}
static uint64_t mv88w8618_pit_read(void *opaque, hwaddr offset,
@@ -879,16 +876,19 @@ static void mv88w8618_pit_write(void *opaque, hwaddr
offset,
case MP_PIT_TIMER1_LENGTH ... MP_PIT_TIMER4_LENGTH:
t = &s->timer[offset >> 2];
t->limit = value;
+ ptimer_transaction_begin(t->ptimer);
if (t->limit > 0) {
ptimer_set_limit(t->ptimer, t->limit, 1);
} else {
ptimer_stop(t->ptimer);
}
+ ptimer_transaction_commit(t->ptimer);
break;
case MP_PIT_CONTROL:
for (i = 0; i < 4; i++) {
t = &s->timer[i];
+ ptimer_transaction_begin(t->ptimer);
if (value & 0xf && t->limit > 0) {
ptimer_set_limit(t->ptimer, t->limit, 0);
ptimer_set_freq(t->ptimer, t->freq);
@@ -896,6 +896,7 @@ static void mv88w8618_pit_write(void *opaque, hwaddr offset,
} else {
ptimer_stop(t->ptimer);
}
+ ptimer_transaction_commit(t->ptimer);
value >>= 4;
}
break;
@@ -914,8 +915,11 @@ static void mv88w8618_pit_reset(DeviceState *d)
int i;
for (i = 0; i < 4; i++) {
- ptimer_stop(s->timer[i].ptimer);
- s->timer[i].limit = 0;
+ mv88w8618_timer_state *t = &s->timer[i];
+ ptimer_transaction_begin(t->ptimer);
+ ptimer_stop(t->ptimer);
+ ptimer_transaction_commit(t->ptimer);
+ t->limit = 0;
}
}
--
2.20.1
- [PULL 00/68] target-arm queue, Peter Maydell, 2019/10/14
- [PULL 02/68] intc/arm_gic: Support IRQ injection for more than 256 vpus, Peter Maydell, 2019/10/14
- [PULL 03/68] ARM: KVM: Check KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 for smp_cpus > 256, Peter Maydell, 2019/10/14
- [PULL 01/68] linux headers: update against v5.4-rc1, Peter Maydell, 2019/10/14
- [PULL 04/68] ptimer: Rename ptimer_init() to ptimer_init_with_bh(), Peter Maydell, 2019/10/14
- [PULL 05/68] ptimer: Provide new transaction-based API, Peter Maydell, 2019/10/14
- [PULL 07/68] hw/timer/arm_timer.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/14
- [PULL 06/68] tests/ptimer-test: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/14
- [PULL 08/68] hw/arm/musicpal.c: Switch to transaction-based ptimer API,
Peter Maydell <=
- [PULL 09/68] hw/timer/allwinner-a10-pit.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/14
- [PULL 10/68] hw/timer/arm_mptimer.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/14
- [PULL 11/68] hw/timer/cmsdk-apb-dualtimer.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/14
- [PULL 12/68] hw/timer/cmsdk-apb-timer.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/14
- [PULL 13/68] hw/timer/digic-timer.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/14
- [PULL 15/68] hw/timer/exynos4210_mct.c: Switch LFRC to transaction-based ptimer API, Peter Maydell, 2019/10/14
- [PULL 16/68] hw/timer/exynos4210_mct.c: Switch ltick to transaction-based ptimer API, Peter Maydell, 2019/10/14
- [PULL 14/68] hw/timer/exynos4210_mct.c: Switch GFRC to transaction-based ptimer API, Peter Maydell, 2019/10/14
- [PULL 17/68] hw/timer/exynos4210_pwm.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/14
- [PULL 18/68] hw/timer/exynos4210_rtc.c: Switch 1Hz ptimer to transaction-based API, Peter Maydell, 2019/10/14