hw/ppc: Round up the decrementer interval when converting to ns
commiteab0888418ab44344864965193cf6cd194ab6858
authorNicholas Piggin <npiggin@gmail.com>
Tue, 8 Aug 2023 04:19:48 +0000 (8 14:19 +1000)
committerCédric Le Goater <clg@kaod.org>
Wed, 6 Sep 2023 09:19:33 +0000 (6 11:19 +0200)
treea517aca9e3cc6b66cb1073f51227b1566801a9ae
parent47de6c4c287079744ceb96f606b3c0457addf380
hw/ppc: Round up the decrementer interval when converting to ns

The rule of timers is typically that they should never expire before the
timeout, but some time afterward. Rounding timer intervals up when doing
conversion is the right thing to do.

Under most circumstances it is impossible observe the decrementer
interrupt before the dec register has triggered. However with icount
timing, problems can arise. For example setting DEC to 0 can schedule
the timer for now, causing it to fire before any more instructions
have been executed and DEC is still 0.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
hw/ppc/ppc.c