All of lore.kernel.org
 help / color / mirror / Atom feed
From: guohanjun@huawei.com (Hanjun Guo)
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 15:56:20 +0800	[thread overview]
Message-ID: <57737F24.5050906@huawei.com> (raw)
In-Reply-To: <1463114260-8724-1-git-send-email-oss@buserror.net>

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).

> +		timeout--;
> +	} while (cval_old != cval_new && timeout);
> +
> +	WARN_ON_ONCE(!timeout);

Then trigger the warning here, correct me if I miss something else.

Thanks
Hanjun

WARNING: multiple messages have this Message-ID (diff)
From: Hanjun Guo <guohanjun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: 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,
	Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>,
	dingtinahong
	<dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v2 1/2] ARM64: arch_timer: Work around QorIQ Erratum A-008585
Date: Wed, 29 Jun 2016 15:56:20 +0800	[thread overview]
Message-ID: <57737F24.5050906@huawei.com> (raw)
In-Reply-To: <1463114260-8724-1-git-send-email-oss-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>

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).

> +		timeout--;
> +	} while (cval_old != cval_new && timeout);
> +
> +	WARN_ON_ONCE(!timeout);

Then trigger the warning here, correct me if I miss something else.

Thanks
Hanjun

--
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

  parent reply	other threads:[~2016-06-29  7:56 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 [this message]
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
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=57737F24.5050906@huawei.com \
    --to=guohanjun@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.