* [Qemu-devel] [PATCH 1/2] arm_timer: reload timer when enabled
@ 2010-05-02 9:50 Rabin Vincent
2010-05-02 9:50 ` [Qemu-devel] [PATCH 2/2] arm_timer: fix oneshot mode Rabin Vincent
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Rabin Vincent @ 2010-05-02 9:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Rabin Vincent
Reload the timer when TimerControl is written, if the timer is to be
enabled. Otherwise, if an earlier write to TimerLoad was done while
periodic mode was not set, s->delta may incorrectly still have the value
of the maximum limit instead of the value written to TimerLoad.
This problem is evident on versatileap on current linux-next, which
enables TIMER_CTRL_32BIT before writing to TimerLoad and then enabling
periodic mode and starting the timer. This causes the first periodic
tick to be scheduled to occur after 0xffffffff periods, leading to a
perceived hang while the kernel waits for the first timer tick.
Signed-off-by: Rabin Vincent <rabin@rab.in>
---
hw/arm_timer.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/arm_timer.c b/hw/arm_timer.c
index 9fef191..5b6947a 100644
--- a/hw/arm_timer.c
+++ b/hw/arm_timer.c
@@ -113,7 +113,7 @@ static void arm_timer_write(void *opaque, target_phys_addr_t offset,
case 1: freq >>= 4; break;
case 2: freq >>= 8; break;
}
- arm_timer_recalibrate(s, 0);
+ arm_timer_recalibrate(s, s->control & TIMER_CTRL_ENABLE);
ptimer_set_freq(s->timer, freq);
if (s->control & TIMER_CTRL_ENABLE) {
/* Restart the timer if still enabled. */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/2] arm_timer: fix oneshot mode
2010-05-02 9:50 [Qemu-devel] [PATCH 1/2] arm_timer: reload timer when enabled Rabin Vincent
@ 2010-05-02 9:50 ` Rabin Vincent
2010-05-21 10:00 ` Aurelien Jarno
2010-05-20 17:27 ` [Qemu-devel] Re: [PATCH 1/2] arm_timer: reload timer when enabled Rabin Vincent
2010-05-21 10:00 ` [Qemu-devel] " Aurelien Jarno
2 siblings, 1 reply; 5+ messages in thread
From: Rabin Vincent @ 2010-05-02 9:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Rabin Vincent
In oneshot mode, the delta needs to come from the TimerLoad register,
not the maximum limit.
Signed-off-by: Rabin Vincent <rabin@rab.in>
---
hw/arm_timer.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/arm_timer.c b/hw/arm_timer.c
index 5b6947a..9073ffc 100644
--- a/hw/arm_timer.c
+++ b/hw/arm_timer.c
@@ -71,7 +71,7 @@ static void arm_timer_recalibrate(arm_timer_state *s, int reload)
{
uint32_t limit;
- if ((s->control & TIMER_CTRL_PERIODIC) == 0) {
+ if ((s->control & (TIMER_CTRL_PERIODIC | TIMER_CTRL_ONESHOT)) == 0) {
/* Free running. */
if (s->control & TIMER_CTRL_32BIT)
limit = 0xffffffff;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: [PATCH 1/2] arm_timer: reload timer when enabled
2010-05-02 9:50 [Qemu-devel] [PATCH 1/2] arm_timer: reload timer when enabled Rabin Vincent
2010-05-02 9:50 ` [Qemu-devel] [PATCH 2/2] arm_timer: fix oneshot mode Rabin Vincent
@ 2010-05-20 17:27 ` Rabin Vincent
2010-05-21 10:00 ` [Qemu-devel] " Aurelien Jarno
2 siblings, 0 replies; 5+ messages in thread
From: Rabin Vincent @ 2010-05-20 17:27 UTC (permalink / raw)
To: qemu-devel; +Cc: paul
On Sun, May 02, 2010 at 03:20:51PM +0530, Rabin Vincent wrote:
> Reload the timer when TimerControl is written, if the timer is to be
> enabled. Otherwise, if an earlier write to TimerLoad was done while
> periodic mode was not set, s->delta may incorrectly still have the value
> of the maximum limit instead of the value written to TimerLoad.
>
> This problem is evident on versatileap on current linux-next, which
> enables TIMER_CTRL_32BIT before writing to TimerLoad and then enabling
> periodic mode and starting the timer. This causes the first periodic
> tick to be scheduled to occur after 0xffffffff periods, leading to a
> perceived hang while the kernel waits for the first timer tick.
>
> Signed-off-by: Rabin Vincent <rabin@rab.in>
Could these patches please be applied? What was then linux-next is now
current Linux mainline, and it doesn't boot without this patch.
Rabin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] arm_timer: reload timer when enabled
2010-05-02 9:50 [Qemu-devel] [PATCH 1/2] arm_timer: reload timer when enabled Rabin Vincent
2010-05-02 9:50 ` [Qemu-devel] [PATCH 2/2] arm_timer: fix oneshot mode Rabin Vincent
2010-05-20 17:27 ` [Qemu-devel] Re: [PATCH 1/2] arm_timer: reload timer when enabled Rabin Vincent
@ 2010-05-21 10:00 ` Aurelien Jarno
2 siblings, 0 replies; 5+ messages in thread
From: Aurelien Jarno @ 2010-05-21 10:00 UTC (permalink / raw)
To: Rabin Vincent; +Cc: qemu-devel
On Sun, May 02, 2010 at 03:20:51PM +0530, Rabin Vincent wrote:
> Reload the timer when TimerControl is written, if the timer is to be
> enabled. Otherwise, if an earlier write to TimerLoad was done while
> periodic mode was not set, s->delta may incorrectly still have the value
> of the maximum limit instead of the value written to TimerLoad.
>
> This problem is evident on versatileap on current linux-next, which
> enables TIMER_CTRL_32BIT before writing to TimerLoad and then enabling
> periodic mode and starting the timer. This causes the first periodic
> tick to be scheduled to occur after 0xffffffff periods, leading to a
> perceived hang while the kernel waits for the first timer tick.
>
> Signed-off-by: Rabin Vincent <rabin@rab.in>
Thanks, applied.
> ---
> hw/arm_timer.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/hw/arm_timer.c b/hw/arm_timer.c
> index 9fef191..5b6947a 100644
> --- a/hw/arm_timer.c
> +++ b/hw/arm_timer.c
> @@ -113,7 +113,7 @@ static void arm_timer_write(void *opaque, target_phys_addr_t offset,
> case 1: freq >>= 4; break;
> case 2: freq >>= 8; break;
> }
> - arm_timer_recalibrate(s, 0);
> + arm_timer_recalibrate(s, s->control & TIMER_CTRL_ENABLE);
> ptimer_set_freq(s->timer, freq);
> if (s->control & TIMER_CTRL_ENABLE) {
> /* Restart the timer if still enabled. */
> --
> 1.7.0.4
>
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] arm_timer: fix oneshot mode
2010-05-02 9:50 ` [Qemu-devel] [PATCH 2/2] arm_timer: fix oneshot mode Rabin Vincent
@ 2010-05-21 10:00 ` Aurelien Jarno
0 siblings, 0 replies; 5+ messages in thread
From: Aurelien Jarno @ 2010-05-21 10:00 UTC (permalink / raw)
To: Rabin Vincent; +Cc: qemu-devel
On Sun, May 02, 2010 at 03:20:52PM +0530, Rabin Vincent wrote:
> In oneshot mode, the delta needs to come from the TimerLoad register,
> not the maximum limit.
>
> Signed-off-by: Rabin Vincent <rabin@rab.in>
Thanks, applied.
> ---
> hw/arm_timer.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/hw/arm_timer.c b/hw/arm_timer.c
> index 5b6947a..9073ffc 100644
> --- a/hw/arm_timer.c
> +++ b/hw/arm_timer.c
> @@ -71,7 +71,7 @@ static void arm_timer_recalibrate(arm_timer_state *s, int reload)
> {
> uint32_t limit;
>
> - if ((s->control & TIMER_CTRL_PERIODIC) == 0) {
> + if ((s->control & (TIMER_CTRL_PERIODIC | TIMER_CTRL_ONESHOT)) == 0) {
> /* Free running. */
> if (s->control & TIMER_CTRL_32BIT)
> limit = 0xffffffff;
> --
> 1.7.0.4
>
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-05-21 10:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-02 9:50 [Qemu-devel] [PATCH 1/2] arm_timer: reload timer when enabled Rabin Vincent
2010-05-02 9:50 ` [Qemu-devel] [PATCH 2/2] arm_timer: fix oneshot mode Rabin Vincent
2010-05-21 10:00 ` Aurelien Jarno
2010-05-20 17:27 ` [Qemu-devel] Re: [PATCH 1/2] arm_timer: reload timer when enabled Rabin Vincent
2010-05-21 10:00 ` [Qemu-devel] " Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).