Re: [Qemu-devel] [PATCH v14 2/3] hw/ptimer: Fix counter - 1 returned by ptimer_get_count for the active timer

2016-06-20 Thread Dmitry Osipenko
I started to port MPTimer tests to QTest that allows precise VM clock control. It helped to find out that the last period of the periodic timer is getting lost, i.e. when counter = 0 (before wrap around). So the counter should be loaded with limit + 1 after wrapping around. This worked before

[Qemu-devel] [PATCH v14 2/3] hw/ptimer: Fix counter - 1 returned by ptimer_get_count for the active timer

2016-06-17 Thread Dmitry Osipenko
Due to rounding down performed by ptimer_get_count, it returns counter - 1 for the active timer. That's incorrect because counter should decrement only after period been expired, not before. I.e. if running timer has been loaded with value X, then timer counter should stay with X until period