[PATCH] qemu: aspeed_timer: Use signed muldiv for timer resets
Christian Svensson
blue at cmd.nu
Tue Nov 13 19:58:08 AEDT 2018
On Tue, Nov 13, 2018 at 1:27 AM Andrew Jeffery <andrew at aj.id.au> wrote:
> By inspection the concept of the patch seems okay to me. However, the
issue
> that host-utils.h takes care of in addition to providing helpers is
support for
> those helpers on systems that don't support 128-bit integers. The patch
should
> be sent to the upstream lists, and I don't think we should be breaking
> qemu-arm-* generally for systems that we might not care about.
Ah, yes - I missed that there were two - one for systems with int128 and
one for them
without. Hm, that does complicate things.
Given that we only have one operand that is ever negative, how do you feel
about a patch
that goes along the lines of:
if (delta >= 0) {
t->start += muldiv64(delta, NANOSECONDS_PER_SECOND, rate);
} else {
t->start = (int64_t)t->start - muldiv64(-delta, NANOSECONDS_PER_SECOND,
rate);
}
That should avoid any issues I think, save us/me from implementing a signed
muldiv,
but cost a bit on the readable code side.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20181113/80d746c8/attachment-0001.html>
More information about the openbmc
mailing list