[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PULL 03/26] i6300esb: fix timer overflow
From: |
Michael Tokarev |
Subject: |
[Qemu-trivial] [PULL 03/26] i6300esb: fix timer overflow |
Date: |
Fri, 11 Sep 2015 14:03:27 +0300 |
From: Laurent Vivier <address@hidden>
We use muldiv64() to compute the time to wait:
timeout = muldiv64(get_ticks_per_sec(), timeout, 33000000);
but get_ticks_per_sec() is 10^9 (30 bit value) and timeout
is a 35 bit value.
Whereas muldiv64 is:
uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c)
So we loose 3 bits of timeout.
Swapping get_ticks_per_sec() and timeout fixes it.
We can also replace it by a multiplication by 30 ns,
but this changes PCI clock frequency from 33MHz to 33.333333MHz
and we need to do this on all the QEMU PCI devices (later...)
Signed-off-by: Laurent Vivier <address@hidden>
Reviewed-by: David Gibson <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
hw/watchdog/wdt_i6300esb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
index cfa2b1b..3e07d44 100644
--- a/hw/watchdog/wdt_i6300esb.c
+++ b/hw/watchdog/wdt_i6300esb.c
@@ -136,7 +136,7 @@ static void i6300esb_restart_timer(I6300State *d, int stage)
* multiply here can exceed 64-bits, before we divide by 33MHz, so
* we use a higher-precision intermediate result.
*/
- timeout = muldiv64(get_ticks_per_sec(), timeout, 33000000);
+ timeout = muldiv64(timeout, get_ticks_per_sec(), 33000000);
i6300esb_debug("stage %d, timeout %" PRIi64 "\n", d->stage, timeout);
--
2.1.4
- [Qemu-trivial] [PULL 00/26] Trivial patches for 2015-09-11, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 13/26] docs: fix a qga/qapi-schema.json comment, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 09/26] maint: remove unused include for strings.h, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 06/26] maint: remove unused include for assert.h, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 15/26] linux-user: Fix warnings caused by missing 'static' attribute, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 01/26] Update language files for QEMU 2.4.0, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 25/26] hw/arm/spitz: Remove meaningless blank Property, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 17/26] Target-ppc: Remove unnecessary variable, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 10/26] maint: avoid useless "if (foo) free(foo)" pattern, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 05/26] maint: remove / fix many doubled words, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 03/26] i6300esb: fix timer overflow,
Michael Tokarev <=
- [Qemu-trivial] [PULL 24/26] hw/gpio/zaurus: Remove meaningless blank Property, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 04/26] maint: remove double semicolons in many files, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 20/26] qapi-schema: remove legacy<> from doc, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 26/26] virtio-vga: enable for i386, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 21/26] typofixes - v4, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 18/26] help: dd missing newline, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 11/26] maint: avoid useless "if (foo) free(foo)" pattern, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 12/26] trivial: remove trailing newline from error_report, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 07/26] maint: remove unused include for dirent.h, Michael Tokarev, 2015/09/11
- [Qemu-trivial] [PULL 23/26] hw/virtio/virtio-pci: Remove meaningless blank Property, Michael Tokarev, 2015/09/11