Re: [Qemu-devel] [RFC v1 0/2] ARM MPTimer fixes and refactoring

2015-10-03 Thread Dmitry Osipenko
20.09.2015 20:48, Peter Crosthwaite пишет: On Sun, Jul 5, 2015 at 1:58 PM, Peter Crosthwaite wrote: On Sun, Jul 5, 2015 at 1:47 PM, Dmitry Osipenko wrote: 05.07.2015 23:26, Peter Crosthwaite пишет: Hi Dmitry, Based on my comment earlier, this is what I came up with RE consolidation of

Re: [Qemu-devel] [RFC v1 0/2] ARM MPTimer fixes and refactoring

2015-10-05 Thread Dmitry Osipenko
03.10.2015 16:11, Dmitry Osipenko пишет: 20.09.2015 20:48, Peter Crosthwaite пишет: On Sun, Jul 5, 2015 at 1:58 PM, Peter Crosthwaite wrote: On Sun, Jul 5, 2015 at 1:47 PM, Dmitry Osipenko wrote: 05.07.2015 23:26, Peter Crosthwaite пишет: Hi Dmitry, Based on my comment earlier, this is

Re: [Qemu-devel] [RFC v1 0/2] ARM MPTimer fixes and refactoring

2015-10-05 Thread Dmitry Osipenko
05.10.2015 19:27, Peter Crosthwaite пишет: On Mon, Oct 5, 2015 at 9:07 AM, Dmitry Osipenko wrote: 03.10.2015 16:11, Dmitry Osipenko пишет: 20.09.2015 20:48, Peter Crosthwaite пишет: On Sun, Jul 5, 2015 at 1:58 PM, Peter Crosthwaite wrote: On Sun, Jul 5, 2015 at 1:47 PM, Dmitry Osipenko

[Qemu-devel] [PATCH] arm_mptimer: Convert to use ptimer

2015-10-06 Thread Dmitry Osipenko
ation - Fixes counter value preservation after stopping the timer - Code simplification and reduction Bump timerblock VMSD to version 3, since VMState is changed and is not compatible with the previuos implementation. Signed-off-by: Dmitry Osipenko --- hw/timer/arm_mptimer.c

Re: [Qemu-devel] [PATCH] arm_mptimer: Convert to use ptimer

2015-10-06 Thread Dmitry Osipenko
Here the tests I used to verify MPTimer emulation correctness: https://gist.github.com/digetx/dbd46109503b1a91941a -- Dmitry

[Qemu-devel] [PATCH v2] arm_mptimer: Convert to use ptimer

2015-10-06 Thread Dmitry Osipenko
ation - Fixes counter value preservation after stopping the timer - Code simplification and reduction Bump timerblock VMSD to version 3, since VMState is changed and is not compatible with the previuos implementation. Signed-off-by: Dmitry Osipenko --- Changelog: V2: Fixed cha

Re: [Qemu-devel] arm mptimer implementation - why prescaler is multiply by 10?

2015-10-27 Thread Dmitry Osipenko
27.10.2015 16:48, Krzeminski, Marcin (Nokia - PL/Wroclaw) пишет: Hello, I am playing with U-Boot on ARM under qemu. U-boot uses mptimer, and under qemu one second takes about 1 in real world. At the moment it seem that in u-boot is ok, so I have question about below function. Why prescaler value

Re: [Qemu-devel] arm mptimer implementation - why prescaler is multiply by 10?

2015-10-27 Thread Dmitry Osipenko
27.10.2015 21:01, Peter Crosthwaite пишет: On Tue, Oct 27, 2015 at 7:19 AM, Dmitry Osipenko mailto:dig...@gmail.com>> wrote: 27.10.2015 16:48, Krzeminski, Marcin (Nokia - PL/Wroclaw) пишет: Hello, I am playing with U-Boot on ARM under qemu. U-boot uses m

Re: [Qemu-devel] [PATCH v7 1/2] hw/ptimer: Fix issues caused by artificially limited timer timeout

2015-10-27 Thread Dmitry Osipenko
25.10.2015 20:39, Peter Crosthwaite пишет: On Sun, Oct 25, 2015 at 6:23 AM, Dmitry Osipenko wrote: 25.10.2015 02:55, Peter Crosthwaite пишет: On Sat, Oct 24, 2015 at 3:22 PM, Dmitry Osipenko wrote: 24.10.2015 22:45, Peter Crosthwaite пишет: This looks like a give-up without trying to

Re: [Qemu-devel] [PATCH v7 1/2] hw/ptimer: Fix issues caused by artificially limited timer timeout

2015-10-29 Thread Dmitry Osipenko
29.10.2015 04:39, Peter Crosthwaite пишет: On Tue, Oct 27, 2015 at 2:26 PM, Dmitry Osipenko mailto:dig...@gmail.com>> wrote: 25.10.2015 20:39, Peter Crosthwaite пишет: On Sun, Oct 25, 2015 at 6:23 AM, Dmitry Osipenko mailto:dig...@gmail.com>> wrote: 25.1

Re: [Qemu-devel] arm mptimer implementation - why prescaler is multiply by 10?

2015-10-29 Thread Dmitry Osipenko
29.10.2015 10:00, Krzeminski, Marcin (Nokia - PL/Wroclaw) пишет: *From:*EXT Peter Crosthwaite [mailto:crosthwaitepe...@gmail.com] *Sent:* Tuesday, October 27, 2015 7:23 PM *To:* Peter Maydell *Cc:* Dmitry Osipenko ; Krzeminski, Marcin (Nokia - PL/Wroclaw) ; qemu-devel@nongnu.org *Subject:* Re

Re: [Qemu-devel] [PATCH v7 1/2] hw/ptimer: Fix issues caused by artificially limited timer timeout

2015-10-30 Thread Dmitry Osipenko
29.10.2015 17:28, Dmitry Osipenko пишет: - Disable limiting for that host machine? - Tune timer limit? These tho variants seem too farfetched, since we don't distinguish the guest software timer poll and some device internal ptimer_get_count() call. Just a note. -- Dmitry

Re: [Qemu-devel] [PATCH v7 0/2] PTimer fix and ARM MPTimer conversion

2015-10-30 Thread Dmitry Osipenko
31.10.2015 00:52, Peter Maydell пишет: On 24 October 2015 at 13:21, Dmitry Osipenko wrote: Changelog for ARM MPTimer QEMUTimer to ptimer conversion: V2: Fixed changing periodic timer counter value "on the fly". I added a test to the gist to cover that issue.

[Qemu-devel] [PATCH v11 4/7] hw/ptimer: Support "on the fly" timer mode switch

2016-01-21 Thread Dmitry Osipenko
Allow switching between periodic <-> oneshot modes while timer is running. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- hw/core/ptimer.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index 9

[Qemu-devel] [PATCH v11 3/7] hw/ptimer: Update .delta on period/freq change

2016-01-21 Thread Dmitry Osipenko
eliminate potential further mistakes. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- hw/core/ptimer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index cb50d30..904a77b 100644 --- a/hw/core/ptimer.c +++ b/hw/core/ptimer.c @@ -189,6 +189,7

[Qemu-devel] [PATCH v11 2/7] hw/ptimer: Perform counter wrap around if timer already expired

2016-01-21 Thread Dmitry Osipenko
certain hardware, don't perform wrap around when in icount mode and return counter = 0 in that case (that doesn't affect polled counter distribution). Signed-off-by: Dmitry Osipenko --- hw/core/ptimer.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git

[Qemu-devel] [PATCH v11 1/7] hw/ptimer: Fix issues caused by the adjusted timer limit value

2016-01-21 Thread Dmitry Osipenko
sion whether adjustment is required, as limit could be altered while timer is running, resulting in incorrect value returned by ptimer_get_count. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- hw/core/ptimer.c | 51 +++ 1 file changed, 3

[Qemu-devel] [PATCH v11 6/7] hw/ptimer: Legalize running with delta = load = 0 and abort on period = 0

2016-01-21 Thread Dmitry Osipenko
r and stop the timer. Signed-off-by: Dmitry Osipenko --- hw/core/ptimer.c | 27 --- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index 142cc64..cec59e1 100644 --- a/hw/core/ptimer.c +++ b/hw/core/ptimer.c @@ -39,11 +

[Qemu-devel] [PATCH v11 0/7] PTimer fixes/features and ARM MPTimer conversion

2016-01-21 Thread Dmitry Osipenko
timer already expired" patch since it would cause bogus tick after QEMU been reset if ptimer was stopped and it's QEMUtimer expired during reset. Patch "Legalize running with delta = load = 0" now explicitly forbids period = 0. Dmit

[Qemu-devel] [PATCH v11 5/7] hw/ptimer: Introduce ptimer_get_limit

2016-01-21 Thread Dmitry Osipenko
Currently ptimer users are used to store copy of the limit value, because ptimer doesn't provide facility to retrieve the limit. Let's provide it. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- hw/core/ptimer.c| 5 + include/hw/ptimer.h | 1 + 2 files

[Qemu-devel] [PATCH v11 7/7] arm_mptimer: Convert to use ptimer

2016-01-21 Thread Dmitry Osipenko
ation - Fixes counter value preservation after stopping the timer - Correctly handles prescaler != 0 cases - Code simplification and reduction Bump VMSD to version 3, since VMState is changed and is not compatible with the previous implementation. Signed-off-by: Dmitry Osi

Re: [Qemu-devel] [PATCH v11 7/7] arm_mptimer: Convert to use ptimer

2016-01-24 Thread Dmitry Osipenko
Hello Peter, 24.01.2016 08:25, Peter Crosthwaite пишет: [snip] +timerblock_run(tb->timer, control, (value != 0) && (control & 1)); break; case 8: /* Control. */ -old = tb->control; -tb->control = value; -if (value & 1) { -if ((old &

Re: [Qemu-devel] [PATCH v11 6/7] hw/ptimer: Legalize running with delta = load = 0 and abort on period = 0

2016-01-24 Thread Dmitry Osipenko
24.01.2016 07:28, Peter Crosthwaite пишет: [snip] /* Set counter frequency in Hz. */ void ptimer_set_freq(ptimer_state *s, uint32_t freq) { +g_assert(freq != 0); s->delta = ptimer_get_count(s); s->period = 10ll / freq; s->period_frac = (10ll << 32) /

Re: [Qemu-devel] [PATCH v11 2/7] hw/ptimer: Perform counter wrap around if timer already expired

2016-01-25 Thread Dmitry Osipenko
Hello Peter, 24.01.2016 08:29, Peter Crosthwaite пишет: [snip] +if (expired && (counter != 0)) { +/* Wrap around periodic counter. */ +counter = s->limit - counter % s->limit; +} Noticed another nit here. This should be: counter = s->

Re: [Qemu-devel] [PATCH v11 7/7] arm_mptimer: Convert to use ptimer

2016-01-26 Thread Dmitry Osipenko
24.01.2016 17:59, Dmitry Osipenko пишет: Hello Peter, 24.01.2016 08:25, Peter Crosthwaite пишет: [snip] +timerblock_run(tb->timer, control, (value != 0) && (control & 1)); break; case 8: /* Control. */ -old = tb->control; -t

[Qemu-devel] [PATCH v12 3/9] hw/ptimer: Update .delta on period/freq change

2016-01-30 Thread Dmitry Osipenko
eliminate potential further mistakes. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- hw/core/ptimer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index d4452d3..f58790a 100644 --- a/hw/core/ptimer.c +++ b/hw/core/ptimer.c @@ -189,6 +189,7

[Qemu-devel] [PATCH v12 1/9] hw/ptimer: Fix issues caused by the adjusted timer limit value

2016-01-30 Thread Dmitry Osipenko
sion whether adjustment is required, as limit could be altered while timer is running, resulting in incorrect value returned by ptimer_get_count. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- hw/core/ptimer.c | 51 +++ 1 file changed, 3

[Qemu-devel] [PATCH v12 0/9] PTimer fixes/features and ARM MPTimer conversion

2016-01-30 Thread Dmitry Osipenko
"Fix counter - 1 returned by ptimer_get_count for the active timer" "Perform delayed tick instead of immediate if delta = 0" Dmitry Osipenko (9): hw/ptimer: Fix issues caused by the adjusted timer limit value hw/ptimer: Perform counter wrap around if t

[Qemu-devel] [PATCH v12 4/9] hw/ptimer: Support "on the fly" timer mode switch

2016-01-30 Thread Dmitry Osipenko
Allow switching between periodic <-> oneshot modes while timer is running. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- hw/core/ptimer.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index f

[Qemu-devel] [PATCH v12 2/9] hw/ptimer: Perform counter wrap around if timer already expired

2016-01-30 Thread Dmitry Osipenko
certain hardware, don't perform wrap around when in icount mode and return counter = 0 in that case (that doesn't affect polled counter distribution). Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- hw/core/ptimer.c | 19 +-- 1 file changed, 13 insert

[Qemu-devel] [PATCH v12 5/9] hw/ptimer: Introduce ptimer_get_limit

2016-01-30 Thread Dmitry Osipenko
Currently ptimer users are used to store copy of the limit value, because ptimer doesn't provide facility to retrieve the limit. Let's provide it. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- hw/core/ptimer.c| 5 + include/hw/ptimer.h | 1 + 2 files

[Qemu-devel] [PATCH v12 9/9] arm_mptimer: Convert to use ptimer

2016-01-30 Thread Dmitry Osipenko
ff-by: Dmitry Osipenko --- hw/timer/arm_mptimer.c | 133 + include/hw/timer/arm_mptimer.h | 5 +- 2 files changed, 70 insertions(+), 68 deletions(-) diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c index 5dfab66..f002458 100644 ---

[Qemu-devel] [PATCH v12 8/9] hw/ptimer: Perform delayed tick instead of immediate if delta = 0

2016-01-30 Thread Dmitry Osipenko
It might be necessary by some emulated HW to perform the tick after one period if delta = 0. Given that it is much less churny to implement immediate tick by the ptimer user itself, let's make ptimer do the delayed tick. Signed-off-by: Dmitry Osipenko --- hw/core/ptimer.c

[Qemu-devel] [PATCH v12 6/9] hw/ptimer: Legalize running with delta = load = 0 and abort on period = 0

2016-01-30 Thread Dmitry Osipenko
r and stop the timer. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- hw/core/ptimer.c | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index bf62fdd..62f8cb1 100644 --- a/hw/core/ptimer.c +++

[Qemu-devel] [PATCH v12 7/9] hw/ptimer: Fix counter - 1 returned by ptimer_get_count for the active timer

2016-01-30 Thread Dmitry Osipenko
eriod expired and decrement after. Fix this by adding 1 to the counter value for the active and unexpired timer. Signed-off-by: Dmitry Osipenko --- hw/core/ptimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index 62f8cb1..b2044fb 100644 ---

Re: [Qemu-devel] [PATCH v12 7/9] hw/ptimer: Fix counter - 1 returned by ptimer_get_count for the active timer

2016-02-02 Thread Dmitry Osipenko
30.01.2016 19:43, 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

Re: [Qemu-devel] [PATCH v12 7/9] hw/ptimer: Fix counter - 1 returned by ptimer_get_count for the active timer

2016-02-02 Thread Dmitry Osipenko
02.02.2016 18:19, Dmitry Osipenko пишет: There is possibility to return timer counter = limit + 1, if the following ptimer calls execute in less than 1ns. s/limit/delta/ -- Dmitry

[Qemu-devel] [PATCH v10 5/7] hw/ptimer: Legalize running with delta = load = 0

2016-01-09 Thread Dmitry Osipenko
period = 0. In addition, don't load one-shot timer when delta = 0 and actually stop the timer by timer_del(). Signed-off-by: Dmitry Osipenko --- hw/core/ptimer.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c

[Qemu-devel] [PATCH v10 3/7] hw/ptimer: Update .delta on period/freq change

2016-01-09 Thread Dmitry Osipenko
eliminate potential further mistakes. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- hw/core/ptimer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index cf329eb..0a54212 100644 --- a/hw/core/ptimer.c +++ b/hw/core/ptimer.c @@ -194,6 +194,7

[Qemu-devel] [PATCH v10 1/7] hw/ptimer: Fix issues caused by the adjusted timer limit value

2016-01-09 Thread Dmitry Osipenko
sion whether adjustment is required, as limit could be altered while timer is running, resulting in incorrect value returned by ptimer_get_count. Signed-off-by: Dmitry Osipenko --- hw/core/ptimer.c | 51 +++ 1 file changed, 31 insertions(+), 20 deletions(-)

[Qemu-devel] [PATCH v10 2/7] hw/ptimer: Perform tick and counter wrap around if timer already expired

2016-01-09 Thread Dmitry Osipenko
certain hardware, don't perform wrap around when in icount mode and return counter = 0 in that case (that doesn't affect polled counter distribution). In addition, there is no reason to keep expired timer tick deferred, so just perform the tick from ptimer_get_count(). Signed-off-by: Dmitr

[Qemu-devel] [PATCH v10 0/7] PTimer fixes/features and ARM MPTimer conversion

2016-01-09 Thread Dmitry Osipenko
; mode switch, silence error msg when delta = load = 0, introduce ptimer_get_limit. Dmitry Osipenko (7): hw/ptimer: Fix issues caused by the adjusted timer limit value hw/ptimer: Perform tick and counter wrap around if timer already expired hw/ptimer: Update .delta o

[Qemu-devel] [PATCH v10 4/7] hw/ptimer: Support "on the fly" timer mode switch

2016-01-09 Thread Dmitry Osipenko
Allow to switch between periodic <-> oneshot modes while timer is running. Signed-off-by: Dmitry Osipenko --- hw/core/ptimer.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index 0a54212..6960738 100644 --- a/h

[Qemu-devel] [PATCH v10 7/7] arm_mptimer: Convert to use ptimer

2016-01-09 Thread Dmitry Osipenko
ation - Fixes counter value preservation after stopping the timer - Correctly handles prescaler != 0 cases - Code simplification and reduction Bump VMSD to version 3, since VMState is changed and is not compatible with the previous implementation. Signed-off-by: Dmitry Osi

[Qemu-devel] [PATCH v10 6/7] hw/ptimer: Introduce ptimer_get_limit

2016-01-09 Thread Dmitry Osipenko
Currently ptimer users are used to store copy of the limit value, because ptimer doesn't provide facility to retrieve the limit. Let's provide it. Signed-off-by: Dmitry Osipenko --- hw/core/ptimer.c| 5 + include/hw/ptimer.h | 1 + 2 files changed, 6 insertions(+) diff --git

Re: [Qemu-devel] [PATCH v10 2/7] hw/ptimer: Perform tick and counter wrap around if timer already expired

2016-01-10 Thread Dmitry Osipenko
10.01.2016 03:44, Peter Crosthwaite пишет: On Sat, Jan 9, 2016 at 9:39 AM, Dmitry Osipenko wrote: ptimer_get_count() might be called while QEMU timer already been expired. In that case ptimer would return counter = 0, which might be undesirable in case of polled timer. Do counter wrap around

Re: [Qemu-devel] [PATCH v10 7/7] arm_mptimer: Convert to use ptimer

2016-01-10 Thread Dmitry Osipenko
I missed case where periodic timer should stop in the following case: load = 0, counter != 0 -> run -> set counter = 0 -> should stop Test added. Will fix it in V11. -- Dmitry

Re: [Qemu-devel] [PATCH v10 7/7] arm_mptimer: Convert to use ptimer

2016-01-10 Thread Dmitry Osipenko
10.01.2016 21:05, Dmitry Osipenko пишет: I missed case where periodic timer should stop in the following case: load = 0, counter != 0 -> run -> set counter = 0 -> should stop Test added. Will fix it in V11. Forgot to mention that prescaler must be 0 in that case. Prescaler !

Re: [Qemu-devel] [PATCH v10 5/7] hw/ptimer: Legalize running with delta = load = 0

2016-01-12 Thread Dmitry Osipenko
12.01.2016 06:58, Peter Crosthwaite пишет: On Sat, Jan 09, 2016 at 08:39:53PM +0300, Dmitry Osipenko wrote: Currently ptimer would print error message and clear enable flag for an arming timer that has delta = load = 0. That actually could be a valid case for some hardware, like instant IRQ

Re: [Qemu-devel] [PATCH v10 5/7] hw/ptimer: Legalize running with delta = load = 0

2016-01-15 Thread Dmitry Osipenko
12.01.2016 21:12, Dmitry Osipenko пишет: 12.01.2016 06:58, Peter Crosthwaite пишет: On Sat, Jan 09, 2016 at 08:39:53PM +0300, Dmitry Osipenko wrote: Currently ptimer would print error message and clear enable flag for an arming timer that has delta = load = 0. That actually could be a valid

Re: [Qemu-devel] [PATCH v10 5/7] hw/ptimer: Legalize running with delta = load = 0

2016-01-19 Thread Dmitry Osipenko
12.01.2016 21:12, Dmitry Osipenko пишет: 12.01.2016 06:58, Peter Crosthwaite пишет: On Sat, Jan 09, 2016 at 08:39:53PM +0300, Dmitry Osipenko wrote: Currently ptimer would print error message and clear enable flag for an arming timer that has delta = load = 0. That actually could be a valid

Re: [Qemu-devel] [PATCH v10 2/7] hw/ptimer: Perform tick and counter wrap around if timer already expired

2016-01-20 Thread Dmitry Osipenko
Hi Peter, 10.01.2016 03:44, Peter Crosthwaite пишет: On Sat, Jan 9, 2016 at 9:39 AM, Dmitry Osipenko wrote: [cut] In addition, there is no reason to keep expired timer tick deferred, so just perform the tick from ptimer_get_count(). [cut] I noticed an issue here... The problem is that

Re: [Qemu-devel] [PATCH v10 2/7] hw/ptimer: Perform tick and counter wrap around if timer already expired

2016-01-20 Thread Dmitry Osipenko
20.01.2016 20:03, Dmitry Osipenko пишет: Hi Peter, 10.01.2016 03:44, Peter Crosthwaite пишет: On Sat, Jan 9, 2016 at 9:39 AM, Dmitry Osipenko wrote: [cut] In addition, there is no reason to keep expired timer tick deferred, so just perform the tick from ptimer_get_count(). [cut] I

[Qemu-devel] [PATCH v8 0/4] PTimer fixes and ARM MPTimer conversion

2016-01-04 Thread Dmitry Osipenko
k. Added missed "else" statement. V8: Adjust period instead of the limit and do it for periodic timer only (.limit adjusting bug). Added patch/fix for freq/period change and ptimer_get_count() improvement. Dmitry Osipenko (4): hw/ptimer: Fix issues caused by t

[Qemu-devel] [PATCH v8 1/4] hw/ptimer: Fix issues caused by the adjusted timer limit value

2016-01-04 Thread Dmitry Osipenko
_period(t, 1) 2) ptimer_set_limit(t, 1, 0) 3) ptimer_set_period(t, 1) <-- bypass limit correction Fix all of the above issues by adjusting timer period instead of the limit. Do the adjust for periodic timer only. Signed-off-by: Dmitry Osipenko --- hw/core/p

[Qemu-devel] [PATCH v8 2/4] hw/ptimer: Perform tick and counter wrap around if timer already expired

2016-01-04 Thread Dmitry Osipenko
deferred, so just perform the tick from ptimer_get_count(). Signed-off-by: Dmitry Osipenko --- hw/core/ptimer.c | 35 +-- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index 035af97..96a6c7a 100644 --- a/hw/core

[Qemu-devel] [PATCH v8 3/4] hw/ptimer: Update .delta on period/freq change

2016-01-04 Thread Dmitry Osipenko
eliminate potential further mistakes. Signed-off-by: Dmitry Osipenko --- hw/core/ptimer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index 96a6c7a..8c2dd9f 100644 --- a/hw/core/ptimer.c +++ b/hw/core/ptimer.c @@ -207,6 +207,7 @@ void ptimer_stop(ptimer_state

[Qemu-devel] [PATCH v8 4/4] arm_mptimer: Convert to use ptimer

2016-01-04 Thread Dmitry Osipenko
ation - Fixes counter value preservation after stopping the timer - Code simplification and reduction Bump VMSD to version 3, since VMState is changed and is not compatible with the previous implementation. Signed-off-by: Dmitry Osipenko --- hw/timer/arm_mptimer.c

[Qemu-devel] [PATCH v9 2/4] hw/ptimer: Perform tick and counter wrap around if timer already expired

2016-01-05 Thread Dmitry Osipenko
deferred, so just perform the tick from ptimer_get_count(). Signed-off-by: Dmitry Osipenko --- hw/core/ptimer.c | 35 +-- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index 035af97..ff0586b 100644 --- a/hw/core

[Qemu-devel] [PATCH v9 1/4] hw/ptimer: Fix issues caused by the adjusted timer limit value

2016-01-05 Thread Dmitry Osipenko
_period(t, 1) 2) ptimer_set_limit(t, 1, 0) 3) ptimer_set_period(t, 1) <-- bypass limit correction Fix all of the above issues by adjusting timer period instead of the limit. Do the adjust for periodic timer only. Signed-off-by: Dmitry Osipenko --- hw/core/p

[Qemu-devel] [PATCH v9 3/4] hw/ptimer: Update .delta on period/freq change

2016-01-05 Thread Dmitry Osipenko
eliminate potential further mistakes. Signed-off-by: Dmitry Osipenko --- hw/core/ptimer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index ff0586b..eb4eb4b 100644 --- a/hw/core/ptimer.c +++ b/hw/core/ptimer.c @@ -207,6 +207,7 @@ void ptimer_stop(ptimer_state

[Qemu-devel] [PATCH v9 0/4] PTimer fixes and ARM MPTimer conversion

2016-01-05 Thread Dmitry Osipenko
f counter == 0, otherwise polled periodic timer won't ever return counter = 0. Dmitry Osipenko (4): hw/ptimer: Fix issues caused by the adjusted timer limit value hw/ptimer: Perform tick and counter wrap around if timer already expired hw/ptimer: Update .delta on period/freq ch

[Qemu-devel] [PATCH v9 4/4] arm_mptimer: Convert to use ptimer

2016-01-05 Thread Dmitry Osipenko
ation - Fixes counter value preservation after stopping the timer - Code simplification and reduction Bump VMSD to version 3, since VMState is changed and is not compatible with the previous implementation. Signed-off-by: Dmitry Osipenko --- hw/timer/arm_mptimer.c

Re: [Qemu-devel] [PATCH v8 2/4] hw/ptimer: Perform tick and counter wrap around if timer already expired

2016-01-06 Thread Dmitry Osipenko
06.01.2016 15:17, Peter Crosthwaite пишет: On Tue, Jan 05, 2016 at 05:33:27AM +0300, Dmitry Osipenko wrote: ptimer_get_count() might be called while QEMU timer already been expired. In that case ptimer would return counter = 0, which might be undesirable in case of polled timer. Do counter wrap

Re: [Qemu-devel] [PATCH v8 1/4] hw/ptimer: Fix issues caused by the adjusted timer limit value

2016-01-06 Thread Dmitry Osipenko
06.01.2016 15:15, Peter Crosthwaite пишет: diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index edf077c..035af97 100644 --- a/hw/core/ptimer.c +++ b/hw/core/ptimer.c @@ -34,20 +34,39 @@ static void ptimer_trigger(ptimer_state *s) static void ptimer_reload(ptimer_state *s) { -if (s->del

Re: [Qemu-devel] [PATCH v8 2/4] hw/ptimer: Perform tick and counter wrap around if timer already expired

2016-01-06 Thread Dmitry Osipenko
06.01.2016 16:59, Peter Crosthwaite пишет: + +if (expired) { +/* Wrap around periodic counter. */ +counter = s->delta = s->limit - counter % s->limit; Why do you update the delta here? Because we would want to schedule next tick based on current

Re: [Qemu-devel] [PATCH v8 4/4] arm_mptimer: Convert to use ptimer

2016-01-07 Thread Dmitry Osipenko
06.01.2016 16:17, Peter Crosthwaite пишет: On Tue, Jan 05, 2016 at 05:33:29AM +0300, Dmitry Osipenko wrote: Current ARM MPTimer implementation uses QEMUTimer for the actual timer, this implementation isn't complete and mostly tries to duplicate of what generic ptimer is already doing

Re: [Qemu-devel] [PATCH v8 4/4] arm_mptimer: Convert to use ptimer

2016-01-07 Thread Dmitry Osipenko
06.01.2016 16:17, Peter Crosthwaite пишет: +if ((old & 3) != (tb->control & 3)) { +ptimer_stop(tb->timer); +} +if (!(tb->control & 1)) { +break; +} +ptimer_set_period(tb->timer, timerblock_scale(tb)); +if ((old & 3) != (tb->c

[Qemu-devel] [PATCH] arm_mptimer: Fix timer shutdown

2015-07-01 Thread Dmitry Osipenko
Timer, running in periodic mode, can't be stopped or coming one-shot tick won't be canceled because timer control code just doesn't handle timer disabling. Fix it by checking enable bit and deleting timer if bit isn't set. Signed-off-by: Dmitry Osipenko --- hw/timer/arm_

Re: [Qemu-devel] [PATCH] arm_mptimer: Fix timer shutdown

2015-07-02 Thread Dmitry Osipenko
Hello Peter, thanks a lot for comment. 02.07.2015 12:27, Peter Maydell пишет: Thanks; this does look like a bug. This change will mean we call timer_del() even if the timer was already disabled, though, so I think it would be slightly better to rearrange the existing logic something like this:

[Qemu-devel] [PATCH v2] arm_mptimer: Fix timer shutdown

2015-07-02 Thread Dmitry Osipenko
Timer, running in periodic mode, can't be stopped or coming one-shot tick won't be canceled because timer control code just doesn't handle timer disabling. Fix it by deleting timer if enable bit isn't set. Signed-off-by: Dmitry Osipenko --- v2: Avoid calling timer_del() if t

Re: [Qemu-devel] [PATCH v2] arm_mptimer: Fix timer shutdown

2015-07-02 Thread Dmitry Osipenko
02.07.2015 20:34, Peter Maydell пишет: On 2 July 2015 at 18:20, Dmitry Osipenko wrote: Timer, running in periodic mode, can't be stopped or coming one-shot tick won't be canceled because timer control code just doesn't handle timer disabling. Fix it by deleting timer if enabl

Re: [Qemu-devel] [PATCH v2] arm_mptimer: Fix timer shutdown

2015-07-02 Thread Dmitry Osipenko
02.07.2015 20:34, Peter Maydell пишет: This will now cause us to do the "reload the timer" logic if you write a 1 to the control bit when it was already 1, which we didn't do before. The logic I suggested in my previous review comment gets this right... -- PMM The problem with code you sugg

Re: [Qemu-devel] [PATCH v2] arm_mptimer: Fix timer shutdown

2015-07-02 Thread Dmitry Osipenko
02.07.2015 21:09, Peter Maydell пишет: On 2 July 2015 at 18:52, Dmitry Osipenko wrote: 02.07.2015 20:34, Peter Maydell пишет: This will now cause us to do the "reload the timer" logic if you write a 1 to the control bit when it was already 1, which we didn't do befor

Re: [Qemu-devel] [PATCH v2] arm_mptimer: Fix timer shutdown

2015-07-02 Thread Dmitry Osipenko
02.07.2015 21:43, Dmitry Osipenko пишет: 02.07.2015 21:09, Peter Maydell пишет: TIMER_CONTROL_IT_ENABLE) to TIMER_CONTROL < it won't start, bug s/it won't start/it won't start periodic/ -- Dmitry

[Qemu-devel] arm_mptimer fixes

2015-07-02 Thread Dmitry Osipenko
Hello, this series fixes 3 arm_mptimer issues. All 3 patches were successfully tested on ARM Cortex-A9 QEMU machine booting Linux kernel and behavior was compared to real hw by running couple handcrafted mptimer tests. arm_mptimer: Fix timer shutdown arm_mptimer: Fix ONE-SHOT -> PERIODIC mode chan

[Qemu-devel] [PATCH 1/3 v3] arm_mptimer: Fix timer shutdown

2015-07-02 Thread Dmitry Osipenko
Timer, running in periodic mode, can't be stopped or coming one-shot tick won't be canceled because timer control code just doesn't handle timer disabling. Fix it by deleting timer if enable bit isn't set. Signed-off-by: Dmitry Osipenko --- v2: Avoid calling timer_del() if t

[Qemu-devel] [PATCH 3/3] arm_mptimer: Respect IT bit state

2015-07-02 Thread Dmitry Osipenko
Timer fires interrupt regardless of current IT(interrupt enable) bit state. Fix it by making timer to respect IT state. Signed-off-by: Dmitry Osipenko --- hw/timer/arm_mptimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c

[Qemu-devel] [PATCH 2/3] arm_mptimer: Fix ONE-SHOT -> PERIODIC mode change

2015-07-02 Thread Dmitry Osipenko
Timer won't start periodic ticking if ONE-SHOT -> PERIODIC mode change happened after one-shot tick was completed. Fix it by starting ticking only if timer was disabled previously and isn't ticking right now. Signed-off-by: Dmitry Osipenko --- hw/timer/arm_mptimer.c | 9

Re: [Qemu-devel] [PATCH v2] arm_mptimer: Fix timer shutdown

2015-07-03 Thread Dmitry Osipenko
02.07.2015 21:43, Dmitry Osipenko пишет: 4) re-load TIMER_LOAD And 4-th step can be omitted. Anyway, I already sent patches fixing this and IT issues. -- Dmitry

Re: [Qemu-devel] [PATCH 3/3] arm_mptimer: Respect IT bit state

2015-07-04 Thread Dmitry Osipenko
Hello Peter, 04.07.2015 22:39, Peter Crosthwaite пишет: You also need to trigger timerblock_update_irq on change of state for the control bit itself. "case 8: /* Control. */" in the _write handler needs to call this fn. Right, as it will mask/unmask interrupt line. Good catch, thanks. -- D

Re: [Qemu-devel] [PATCH 2/3] arm_mptimer: Fix ONE-SHOT -> PERIODIC mode change

2015-07-04 Thread Dmitry Osipenko
04.07.2015 22:36, Peter Crosthwaite пишет: Your do-nothing code paths are now inconsistent between the 0 and 1 cases. I think this if can be consolidated with: if (value & 1) { if ((old & 1) && (tb->count != 0)) { break; } if (tb->control & 2) { ... }

[Qemu-devel] [v2] arm_mptimer fixes

2015-07-05 Thread Dmitry Osipenko
Hello, this is V2 of arm_mptimer patch series. Comments and suggestion from V1 has been addressed and the series was re-tested, including new test for IT bit masking/unmasking. [PATCH 1/2] arm_mptimer: Fix timer shutdown and mode change [PATCH v2 2/2] arm_mptimer: Respect IT bit state

[Qemu-devel] [PATCH 1/2] arm_mptimer: Fix timer shutdown and mode change

2015-07-05 Thread Dmitry Osipenko
C mode change happened after one-shot tick was completed. Fix it by starting ticking only if the timer isn't ticking right now. To avoid code churning, these two fixes are squashed in one commit. Signed-off-by: Dmitry Osipenko --- Commits are squashed as per Peter Crosthwaite suggesti

[Qemu-devel] [PATCH v2 2/2] arm_mptimer: Respect IT bit state

2015-07-05 Thread Dmitry Osipenko
Timer should fire interrupt only if IT(interrupt enable) bit state of control register is enabled and timer should update IRQ status on IT bit change as it would mask/unmask the interrupt line. Signed-off-by: Dmitry Osipenko --- v2: Added missed IRQ status update on control register write as

Re: [Qemu-devel] [PATCH 1/2] arm_mptimer: Fix timer shutdown and mode change

2015-07-05 Thread Dmitry Osipenko
05.07.2015 22:07, Peter Crosthwaite пишет: -if (((old & 1) == 0) && (value & 1)) { -if (tb->count == 0 && (tb->control & 2)) { +if (value & 1) { +if ((old & 1) && (tb->count != 0)) { +/* Do nothing if timer is ticking right now. */ +

Re: [Qemu-devel] [v2] arm_mptimer fixes

2015-07-05 Thread Dmitry Osipenko
05.07.2015 22:52, Peter Crosthwaite пишет: On Sun, Jul 5, 2015 at 8:39 AM, Dmitry Osipenko wrote: Hello, this is V2 of arm_mptimer patch series. Comments and suggestion from V1 has been addressed and the series was re-tested, including new test for IT bit masking/unmasking. [PATCH 1/2

Re: [Qemu-devel] [v2] arm_mptimer fixes

2015-07-05 Thread Dmitry Osipenko
05.07.2015 22:52, Peter Crosthwaite пишет: This series doesn't show up in the patch tracking system due to irregular cover. BTW, doesn't QEMU use patchwork for tracking? I see both patches there. -- Dmitry

Re: [Qemu-devel] [RFC v1 0/2] ARM MPTimer fixes and refactoring

2015-07-05 Thread Dmitry Osipenko
05.07.2015 23:26, Peter Crosthwaite пишет: Hi Dmitry, Based on my comment earlier, this is what I came up with RE consolidation of those arm_mptimer code paths that were giving you problems. I have not done the interrupt mask fix, as that one from your series is reasonably independent. Regards,

Re: [Qemu-devel] [RFC v1 0/2] ARM MPTimer fixes and refactoring

2015-07-05 Thread Dmitry Osipenko
06.07.2015 00:06, Peter Maydell пишет: On 5 July 2015 at 22:01, Peter Crosthwaite wrote: On Sun, Jul 5, 2015 at 1:58 PM, Peter Crosthwaite wrote: On Sun, Jul 5, 2015 at 1:47 PM, Dmitry Osipenko wrote: Hi Peter, thanks a lot! Generally, I don't have any trouble with currently m

Re: [Qemu-devel] [PATCH 1/2] arm_mptimer: Fix timer shutdown and mode change

2015-07-05 Thread Dmitry Osipenko
06.07.2015 00:19, Peter Crosthwaite пишет: On Sun, Jul 5, 2015 at 8:39 AM, Dmitry Osipenko wrote: Timer, running in periodic mode, can't be stopped or coming one-shot tick won't be canceled because timer control code just doesn't handle timer disabling. Fix it by deleting the

[Qemu-devel] [PATCH v2 1/2] arm_mptimer: Fix timer shutdown and mode change

2015-07-05 Thread Dmitry Osipenko
eted. Fix it by re-starting ticking if the timer isn't ticking right now. To avoid code churning, these two fixes are squashed in one commit. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- v1: Commits are squashed as per Peter Crosthwaite suggestion. v2: Grammar fixes o

[Qemu-devel] [PATCH v3 2/2] arm_mptimer: Respect IT bit state

2015-07-05 Thread Dmitry Osipenko
The timer should fire interrupt only if IT(interrupt enable) bit state of control register is enabled and the timer should update IRQ status on IT bit change as it would mask/unmask the interrupt line. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- v2: Added missed IRQ

[Qemu-devel] [PATCH v3 0/2] arm_mptimer fixes

2015-07-05 Thread Dmitry Osipenko
Hello, this is V3 of arm_mptimer patch series. No code changes here, just grammar fixes for "shutdown and mode change" patch and general re-send, as V2 was screwed for patchtracker. Dmitry Osipenko (2): arm_mptimer: Fix timer shutdown and mode change arm_mptimer: Respect IT bit

Re: [Qemu-devel] [PATCH v3 2/2] arm_mptimer: Respect IT bit state

2015-07-05 Thread Dmitry Osipenko
v2: Added missed IRQ status update on control register write as per Peter Crosthwaite comment. Oh, no! Turned out, that is wrong. I wasn't testing that case properly on HW, V1 is correct. Quote from ARM doc "If the timer interrupt is enabled, Interrupt ID 29 is set as Pending in the Inter

[Qemu-devel] [PATCH v4] arm_mptimer: Respect IT bit state

2015-07-05 Thread Dmitry Osipenko
The timer should fire the interrupt only if the IT (interrupt enable) bit state of the control register is enabled. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite --- v2: Added missed IRQ status update on control register write as per Peter Crosthwaite comment. v3: No code

Re: [Qemu-devel] [PATCH v4] arm_mptimer: Respect IT bit state

2015-07-06 Thread Dmitry Osipenko
06.07.2015 12:23, Peter Maydell пишет: If you need to update a patch, please resend the whole series, not just one patch from it. (This is one of the things we talk about on http://wiki.qemu.org/Contribute/SubmitAPatch -- the v2/3/4 etc version number applies to a series, not a single I made a

Re: [Qemu-devel] [PATCH v4] arm_mptimer: Respect IT bit state

2015-07-06 Thread Dmitry Osipenko
06.07.2015 16:16, Peter Maydell пишет: Probably, I should go and try those tools myself to have better sense of what I should and shouldn't be doing. The particular one I find useful is Anthony Liguori's "patches" tool: https://github.com/aliguori/patches Thanks! I'll take a look at it. But

Re: [Qemu-devel] [PATCH v4] arm_mptimer: Respect IT bit state

2015-07-06 Thread Dmitry Osipenko
06.07.2015 19:45, Peter Crosthwaite пишет: As someone who doesn't send PULLs, I still find patches very useful. It sanity checks your email sends. A while back, I drafted a paragraph on how to use patches to verify receipt of your series if we want to add it to "submit a patch". Sounds useful.

[Qemu-devel] [PATCH v3] arm_mptimer: Convert to use ptimer

2015-10-12 Thread Dmitry Osipenko
ation - Fixes counter value preservation after stopping the timer - Code simplification and reduction - Fixes starting the timer with load = 0 Bump VMSD to version 3, since VMState is changed and is not compatible with the previuos implementation. Signed-off-by: Dmitry Osi

  1   2   3   4   5   6   7   >