qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

hw/timer/mss-timerc: Switch to transaction-based ptimer API

Switch the mss-timer 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 <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20191008171740.9679-20-peter.maydell@linaro.org

+8 -4
+8 -3
hw/timer/mss-timer.c
··· 24 24 */ 25 25 26 26 #include "qemu/osdep.h" 27 - #include "qemu/main-loop.h" 28 27 #include "qemu/module.h" 29 28 #include "qemu/log.h" 30 29 #include "hw/irq.h" ··· 67 66 qemu_set_irq(st->irq, (ier && isr)); 68 67 } 69 68 69 + /* Must be called from within a ptimer_transaction_begin/commit block */ 70 70 static void timer_update(struct Msf2Timer *st) 71 71 { 72 72 uint64_t count; ··· 159 159 switch (addr) { 160 160 case R_TIM_CTRL: 161 161 st->regs[R_TIM_CTRL] = value; 162 + ptimer_transaction_begin(st->ptimer); 162 163 timer_update(st); 164 + ptimer_transaction_commit(st->ptimer); 163 165 break; 164 166 165 167 case R_TIM_RIS: ··· 171 173 case R_TIM_LOADVAL: 172 174 st->regs[R_TIM_LOADVAL] = value; 173 175 if (st->regs[R_TIM_CTRL] & TIMER_CTRL_ENBL) { 176 + ptimer_transaction_begin(st->ptimer); 174 177 timer_update(st); 178 + ptimer_transaction_commit(st->ptimer); 175 179 } 176 180 break; 177 181 ··· 228 232 for (i = 0; i < NUM_TIMERS; i++) { 229 233 struct Msf2Timer *st = &t->timers[i]; 230 234 231 - st->bh = qemu_bh_new(timer_hit, st); 232 - st->ptimer = ptimer_init_with_bh(st->bh, PTIMER_POLICY_DEFAULT); 235 + st->ptimer = ptimer_init(timer_hit, st, PTIMER_POLICY_DEFAULT); 236 + ptimer_transaction_begin(st->ptimer); 233 237 ptimer_set_freq(st->ptimer, t->freq_hz); 238 + ptimer_transaction_commit(st->ptimer); 234 239 sysbus_init_irq(SYS_BUS_DEVICE(obj), &st->irq); 235 240 } 236 241
-1
include/hw/timer/mss-timer.h
··· 46 46 #define R_TIM1_MAX 6 47 47 48 48 struct Msf2Timer { 49 - QEMUBH *bh; 50 49 ptimer_state *ptimer; 51 50 52 51 uint32_t regs[R_TIM1_MAX];