All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Huang, Tao" <huangtao@rock-chips.com>
To: Doug Anderson <dianders@chromium.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Caesar Wang <wxt@rock-chips.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Brian Norris <briannorris@google.com>,
	Stephen Barber <smbarber@google.com>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Eddie Cai <cf@rock-chips.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Simon Glass <sjg@chromium.org>,
	Julius Werner <jwerner@chromium.org>
Subject: Re: [PATCH 2/5] clocksource: rockchip: remove unnecessary clear irq before request_irq
Date: Wed, 1 Jun 2016 10:30:36 +0800	[thread overview]
Message-ID: <574E48CC.1040004@rock-chips.com> (raw)
In-Reply-To: <CAD=FV=U5zqU0CMeg1dDTYHrRqWAxTQO_xk2T7p09GJuj-Fn9Gw@mail.gmail.com>

Hi Doug:
On 2016年06月01日 01:03, Doug Anderson wrote:
> Hi,
> 
> On Mon, May 30, 2016 at 4:09 PM, Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
>> On 05/25/2016 11:49 AM, Caesar Wang wrote:
>>>
>>> From: Huang Tao <huangtao@rock-chips.com>
>>>
>>> rk_timer_interrupt_clear and rk_timer_disable is unnecessary before
>>> request_irq. Timer should keep disabled before booting Linux.
>>
>>
>> That's true in the perfect world :/ Some version has u-boot letting the
>> timer with irq enabled, therefore as soon as request_irq is done, an irq
>> fires and leads to a kernel panic.
>>
>> On the other side, this timer is not used on the other rockchip version than
>> rk3399 because of no need of a broadcast timer, so removing these two lines
>> may be acceptable.
>>
>> Can try the changes with another board, eg rk3288 (and forcing to use this
>> timer). Can you do the test and confirm it does not break with different
>> version of u-boot ?
> 
> Actually, I'm not even sure that's true in a perfect world.  ;)  There
> are two main problems that might be lurking here:
> 
> 1. On exynos5 devices I've worked with, the private timer (MCT)
> actually shared the same physical counter with the ARM Architected
> Timer.  IIRC stopping or resetting the MCT had the effect of stopping
> / resetting the Arch Timer.  Is it the same for you?  As I understand
> it the Arch Timer isn't supposed to ever be stopped or reset.  If
> firmware left the timer stopped and the kernel happened to be compiled
> without support for the Rockchip timer (but had the Arch Timers) then
> things would be very broken.  Also the early kernel boot might be
> broken if the Arch Timer inits before the Rockchip timer.
> 
> NOTE: If your timer and the Arch Timer are totally separate then point
> #1 is not important.

We never use the timer which provide clock source of arch timer as
clockevent timer. If we do such stupid thing, when rk timer disabled,
the arch timer will stop too. Generally, we use this special timer as
clocksouce or never touch it again when it is running.

> 
> 
> 2. Historically in Chrome OS there's been an unofficial agreement that
> the firmware would start its high speed timer as soon as possible at
> bootup and that this could be used to (roughly) measure the time
> between the start of firmware and the start of the kernel.  That means
> that the kernel was expecting the timer to actually be running when it
> started up.  Yup, this is a bit of a hack and I'm not sure it's
> terribly well documented, but it does provide a reason that firmware
> might have left the timer running.

Why you chose the timer shared with Linux kernel, there are so many
timer? I think loader should do the right thing, uninit the resources
when it boot the kernel. I believe this code is lagacy from very old
chip such as rk2908 which is Cortex-A8. There are not arch timer, so the
loader may keep the timer running when enter kernel. Any way, if we
adopt the code suggested by Daniel, it is safe to keep the code.

WARNING: multiple messages have this Message-ID (diff)
From: huangtao@rock-chips.com (Huang, Tao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] clocksource: rockchip: remove unnecessary clear irq before request_irq
Date: Wed, 1 Jun 2016 10:30:36 +0800	[thread overview]
Message-ID: <574E48CC.1040004@rock-chips.com> (raw)
In-Reply-To: <CAD=FV=U5zqU0CMeg1dDTYHrRqWAxTQO_xk2T7p09GJuj-Fn9Gw@mail.gmail.com>

Hi Doug:
On 2016?06?01? 01:03, Doug Anderson wrote:
> Hi,
> 
> On Mon, May 30, 2016 at 4:09 PM, Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
>> On 05/25/2016 11:49 AM, Caesar Wang wrote:
>>>
>>> From: Huang Tao <huangtao@rock-chips.com>
>>>
>>> rk_timer_interrupt_clear and rk_timer_disable is unnecessary before
>>> request_irq. Timer should keep disabled before booting Linux.
>>
>>
>> That's true in the perfect world :/ Some version has u-boot letting the
>> timer with irq enabled, therefore as soon as request_irq is done, an irq
>> fires and leads to a kernel panic.
>>
>> On the other side, this timer is not used on the other rockchip version than
>> rk3399 because of no need of a broadcast timer, so removing these two lines
>> may be acceptable.
>>
>> Can try the changes with another board, eg rk3288 (and forcing to use this
>> timer). Can you do the test and confirm it does not break with different
>> version of u-boot ?
> 
> Actually, I'm not even sure that's true in a perfect world.  ;)  There
> are two main problems that might be lurking here:
> 
> 1. On exynos5 devices I've worked with, the private timer (MCT)
> actually shared the same physical counter with the ARM Architected
> Timer.  IIRC stopping or resetting the MCT had the effect of stopping
> / resetting the Arch Timer.  Is it the same for you?  As I understand
> it the Arch Timer isn't supposed to ever be stopped or reset.  If
> firmware left the timer stopped and the kernel happened to be compiled
> without support for the Rockchip timer (but had the Arch Timers) then
> things would be very broken.  Also the early kernel boot might be
> broken if the Arch Timer inits before the Rockchip timer.
> 
> NOTE: If your timer and the Arch Timer are totally separate then point
> #1 is not important.

We never use the timer which provide clock source of arch timer as
clockevent timer. If we do such stupid thing, when rk timer disabled,
the arch timer will stop too. Generally, we use this special timer as
clocksouce or never touch it again when it is running.

> 
> 
> 2. Historically in Chrome OS there's been an unofficial agreement that
> the firmware would start its high speed timer as soon as possible at
> bootup and that this could be used to (roughly) measure the time
> between the start of firmware and the start of the kernel.  That means
> that the kernel was expecting the timer to actually be running when it
> started up.  Yup, this is a bit of a hack and I'm not sure it's
> terribly well documented, but it does provide a reason that firmware
> might have left the timer running.

Why you chose the timer shared with Linux kernel, there are so many
timer? I think loader should do the right thing, uninit the resources
when it boot the kernel. I believe this code is lagacy from very old
chip such as rk2908 which is Cortex-A8. There are not arch timer, so the
loader may keep the timer running when enter kernel. Any way, if we
adopt the code suggested by Daniel, it is safe to keep the code.

  reply	other threads:[~2016-06-01  2:31 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25  9:49 [PATCH 0/5] clocksource: rockchip/timer: Support rktimer for rk3399 Caesar Wang
2016-05-25  9:49 ` Caesar Wang
2016-05-25  9:49 ` [PATCH 1/5] dt-bindings: document rk3399 rk-timer bindings Caesar Wang
2016-05-25  9:49   ` Caesar Wang
2016-05-25 19:11   ` Rob Herring
2016-05-25 19:11     ` Rob Herring
2016-05-25 19:11     ` Rob Herring
2016-05-25  9:49 ` [PATCH 2/5] clocksource: rockchip: remove unnecessary clear irq before request_irq Caesar Wang
2016-05-25  9:49   ` Caesar Wang
2016-05-30 23:09   ` Daniel Lezcano
2016-05-30 23:09     ` Daniel Lezcano
2016-05-31 17:03     ` Doug Anderson
2016-05-31 17:03       ` Doug Anderson
2016-05-31 17:03       ` Doug Anderson
2016-06-01  2:30       ` Huang, Tao [this message]
2016-06-01  2:30         ` Huang, Tao
2016-06-01  2:30         ` Huang, Tao
2016-06-01  2:36         ` Doug Anderson
2016-06-01  2:36           ` Doug Anderson
2016-06-01  2:36           ` Doug Anderson
2016-05-25  9:50 ` [PATCH 3/5] clocksource: rockchip: add dynamic irq flag to the timer Caesar Wang
2016-05-25  9:50   ` Caesar Wang
2016-05-30 23:16   ` Daniel Lezcano
2016-05-30 23:16     ` Daniel Lezcano
2016-05-31 13:45     ` Huang, Tao
2016-05-31 13:45       ` Huang, Tao
2016-05-31 13:45       ` Huang, Tao
2016-05-25  9:50 ` [PATCH 4/5] clocksource: rockchip: add support for rk3399 SoC Caesar Wang
2016-05-25  9:50   ` Caesar Wang
2016-05-30 23:28   ` Daniel Lezcano
2016-05-30 23:28     ` Daniel Lezcano
2016-05-31 13:46     ` Huang, Tao
2016-05-31 13:46       ` Huang, Tao
2016-05-31 13:46       ` Huang, Tao
2016-05-31 14:06       ` Daniel Lezcano
2016-05-31 14:06         ` Daniel Lezcano
2016-06-01  1:58         ` Huang, Tao
2016-06-01  1:58           ` Huang, Tao
2016-06-01  6:16           ` Daniel Lezcano
2016-06-01  6:16             ` Daniel Lezcano
2016-05-25  9:50 ` [PATCH 5/5] ARM64: dts: rockchip: add rktimer device node for rk3399 Caesar Wang
2016-05-25  9:50   ` Caesar Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=574E48CC.1040004@rock-chips.com \
    --to=huangtao@rock-chips.com \
    --cc=briannorris@google.com \
    --cc=cf@rock-chips.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=dianders@chromium.org \
    --cc=heiko@sntech.de \
    --cc=jwerner@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=sjg@chromium.org \
    --cc=smbarber@google.com \
    --cc=tglx@linutronix.de \
    --cc=wxt@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.