From: dingtianhong@huawei.com (Ding Tianhong)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] ARM64: arch_timer: Work around QorIQ Erratum A-008585
Date: Wed, 29 Jun 2016 16:31:51 +0800 [thread overview]
Message-ID: <57738777.9030406@huawei.com> (raw)
In-Reply-To: <57738485.4010602@arm.com>
On 2016/6/29 16:19, Marc Zyngier wrote:
> On 29/06/16 08:56, Hanjun Guo wrote:
>> Hello Scott,
>>
>> On 2016/5/13 12:37, Scott Wood wrote:
>> [...]
>>>
>>> +#ifdef CONFIG_ARM64
>>> +static __always_inline void rewrite_tval(const int access,
>>> + unsigned long evt, struct clock_event_device *clk)
>>> +{
>>> + u64 cval_old, cval_new;
>>> + int timeout = 200;
>>> +
>>> + do {
>>> + cval_old = __arch_counter_get_cntvct();
>>> + arch_timer_reg_write(access, ARCH_TIMER_REG_TVAL, evt, clk);
>>
>> For not memory mapped timer, it will call arch_timer_reg_write_cp15() which has
>> isb() at the end of arch_timer_reg_write_cp15()...
>>
>>> + cval_new = __arch_counter_get_cntvct();
>>
>> So there is isb() between counter retry read, I think it's likely cval_new will
>> not be equal with cval_old when the cntvct is correct (time lapse is more than
>> one arch timer cycle).
>
> Are you saying that the isb will delay the execution of the read so much
> that your timer will always change? Well, if your timer is in the GHz
> range, maybe. But that also implies that it is out of spec (it should be
> in the 1-50MHz range).
>
I have test this patch on the D02 board, the arch timer is 50Mhz and the cpu is 2.1Ghz,
if I don't remove the isb from the arch_timer_reg_write(xxx) function, the cval_new is always
bigger than the cval_old, and the timeout is always running to 0, so I don't think the
rewrite_tval is a correct solution for this problem. So I think the other board will met
the same problem.
Thanks.
Ding
> Thanks,
>
> M.
>
WARNING: multiple messages have this Message-ID (diff)
From: Ding Tianhong <dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>,
Hanjun Guo <guohanjun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
Scott Wood <oss-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>,
Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>,
Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
stuart.yoder-3arQi8VN3Tc@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v2 1/2] ARM64: arch_timer: Work around QorIQ Erratum A-008585
Date: Wed, 29 Jun 2016 16:31:51 +0800 [thread overview]
Message-ID: <57738777.9030406@huawei.com> (raw)
In-Reply-To: <57738485.4010602-5wv7dgnIgG8@public.gmane.org>
On 2016/6/29 16:19, Marc Zyngier wrote:
> On 29/06/16 08:56, Hanjun Guo wrote:
>> Hello Scott,
>>
>> On 2016/5/13 12:37, Scott Wood wrote:
>> [...]
>>>
>>> +#ifdef CONFIG_ARM64
>>> +static __always_inline void rewrite_tval(const int access,
>>> + unsigned long evt, struct clock_event_device *clk)
>>> +{
>>> + u64 cval_old, cval_new;
>>> + int timeout = 200;
>>> +
>>> + do {
>>> + cval_old = __arch_counter_get_cntvct();
>>> + arch_timer_reg_write(access, ARCH_TIMER_REG_TVAL, evt, clk);
>>
>> For not memory mapped timer, it will call arch_timer_reg_write_cp15() which has
>> isb() at the end of arch_timer_reg_write_cp15()...
>>
>>> + cval_new = __arch_counter_get_cntvct();
>>
>> So there is isb() between counter retry read, I think it's likely cval_new will
>> not be equal with cval_old when the cntvct is correct (time lapse is more than
>> one arch timer cycle).
>
> Are you saying that the isb will delay the execution of the read so much
> that your timer will always change? Well, if your timer is in the GHz
> range, maybe. But that also implies that it is out of spec (it should be
> in the 1-50MHz range).
>
I have test this patch on the D02 board, the arch timer is 50Mhz and the cpu is 2.1Ghz,
if I don't remove the isb from the arch_timer_reg_write(xxx) function, the cval_new is always
bigger than the cval_old, and the timeout is always running to 0, so I don't think the
rewrite_tval is a correct solution for this problem. So I think the other board will met
the same problem.
Thanks.
Ding
> Thanks,
>
> M.
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-06-29 8:31 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-13 4:37 [PATCH v2 1/2] ARM64: arch_timer: Work around QorIQ Erratum A-008585 Scott Wood
2016-05-13 4:37 ` Scott Wood
2016-05-13 4:37 ` [PATCH v2 2/2] arm64: dts: Add timer erratum property for LS2080A and LS1043A Scott Wood
2016-05-13 4:37 ` Scott Wood
2016-05-13 10:24 ` [PATCH v2 1/2] ARM64: arch_timer: Work around QorIQ Erratum A-008585 Marc Zyngier
2016-05-13 10:24 ` Marc Zyngier
2016-06-22 1:45 ` Scott Wood
2016-06-22 1:45 ` Scott Wood
2016-06-25 7:16 ` Ding Tianhong
2016-06-25 7:16 ` Ding Tianhong
2016-06-27 13:13 ` Marc Zyngier
2016-06-27 13:13 ` Marc Zyngier
2016-06-29 2:05 ` Scott Wood
2016-06-29 2:05 ` Scott Wood
2016-07-01 6:51 ` Scott Wood
2016-07-01 6:51 ` Scott Wood
2016-06-29 8:11 ` Hanjun Guo
2016-06-29 8:11 ` Hanjun Guo
2016-06-29 8:24 ` Marc Zyngier
2016-06-29 8:24 ` Marc Zyngier
2016-06-29 9:19 ` Hanjun Guo
2016-06-29 9:19 ` Hanjun Guo
2016-05-16 16:14 ` Rob Herring
2016-05-16 16:14 ` Rob Herring
2016-06-29 7:56 ` Hanjun Guo
2016-06-29 7:56 ` Hanjun Guo
2016-06-29 8:19 ` Marc Zyngier
2016-06-29 8:19 ` Marc Zyngier
2016-06-29 8:31 ` Ding Tianhong [this message]
2016-06-29 8:31 ` Ding Tianhong
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=57738777.9030406@huawei.com \
--to=dingtianhong@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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.