summaryrefslogtreecommitdiffstats
path: root/hw/net/lan9118.c
diff options
context:
space:
mode:
authorPeter Maydell2019-10-08 19:17:20 +0200
committerPeter Maydell2019-10-15 19:09:02 +0200
commitb01422622b7c7293196fdaf1dbb4f495af44ecf9 (patch)
treeff3006230f811b3009b3d70ec3c93c118a790372 /hw/net/lan9118.c
parentARM: KVM: Check KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 for smp_cpus > 256 (diff)
downloadqemu-b01422622b7c7293196fdaf1dbb4f495af44ecf9.tar.gz
qemu-b01422622b7c7293196fdaf1dbb4f495af44ecf9.tar.xz
qemu-b01422622b7c7293196fdaf1dbb4f495af44ecf9.zip
ptimer: Rename ptimer_init() to ptimer_init_with_bh()
Currently the ptimer design uses a QEMU bottom-half as its mechanism for calling back into the device model using the ptimer when the timer has expired. Unfortunately this design is fatally flawed, because it means that there is a lag between the ptimer updating its own state and the device callback function updating device state, and guest accesses to device registers between the two can return inconsistent device state. We want to replace the bottom-half design with one where the guest device's callback is called either immediately (when the ptimer triggers by timeout) or when the device model code closes a transaction-begin/end section (when the ptimer triggers because the device model changed the ptimer's count value or other state). As the first step, rename ptimer_init() to ptimer_init_with_bh(), to free up the ptimer_init() name for the new API. We can then convert all the ptimer users away from ptimer_init_with_bh() before removing it entirely. (Commit created with git grep -l ptimer_init | xargs sed -i -e 's/ptimer_init/ptimer_init_with_bh/' and three overlong lines folded by hand.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20191008171740.9679-2-peter.maydell@linaro.org
Diffstat (limited to 'hw/net/lan9118.c')
-rw-r--r--hw/net/lan9118.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
index 8bba2a8056..0ea51433dc 100644
--- a/hw/net/lan9118.c
+++ b/hw/net/lan9118.c
@@ -1350,7 +1350,7 @@ static void lan9118_realize(DeviceState *dev, Error **errp)
s->txp = &s->tx_packet;
bh = qemu_bh_new(lan9118_tick, s);
- s->timer = ptimer_init(bh, PTIMER_POLICY_DEFAULT);
+ s->timer = ptimer_init_with_bh(bh, PTIMER_POLICY_DEFAULT);
ptimer_set_freq(s->timer, 10000);
ptimer_set_limit(s->timer, 0xffff, 1);
}