linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Shaokun Zhang <zhangshaokun@hisilicon.com>,
	linux-watchdog@vger.kernel.org
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>,
	Al Stone <al.stone@linaro.org>,
	Jianchao Hu <hujianchao@hisilicon.com>,
	Huiqiang Wang <wanghuiqiang@huawei.com>
Subject: Re: [PATCH] watchdog: sbsa: Support architecture version 1
Date: Mon, 10 May 2021 20:52:29 -0700	[thread overview]
Message-ID: <65876276-ddd5-7e1c-c0e3-d94c316f2d93@roeck-us.net> (raw)
In-Reply-To: <fb880396-4c30-78ff-2c1f-62ad4fef935f@hisilicon.com>

On 5/10/21 7:49 PM, Shaokun Zhang wrote:
> Hi Guenter,
> 
> On 2021/5/10 21:16, Guenter Roeck wrote:
>> On 5/10/21 1:25 AM, Shaokun Zhang wrote:
>>> Hi Guenter,
>>>
>>> On 2021/5/10 12:25, Guenter Roeck wrote:
>>>> On 5/9/21 8:41 PM, Shaokun Zhang wrote:
>>>>> Arm Base System Architecture 1.0[1] has introduced watchdog
>>>>> revision 1 that increases the length the watchdog offset
>>>>
>>>> Is that how they call the watchdog count register ?
>>>>
>>>
>>> I think yes.
>>>
>>>> Also, doesn't that mean that the maximum timeout supported
>>>> by the hardware is now larger ?
>>>
>>> No, maximum timeout is the same. But the clock can be higher than
>>> before. For Armv8.6, The frequency of CNTFRQ_EL0 is standardized to
>>> a frequency of 1GHz which will set gwdt->clk. If the timeout is
>>> greater than 4(second), the 32-bit counter(WOR) is not enough.
>>>
>>
>> The maximuma timeout is limited with
>>
>> wdd->max_hw_heartbeat_ms = U32_MAX / gwdt->clk * 1000;
>>> You did not update that calculation. That means that the maximuma
>> timeout is still U32_MAX / gwdt->clk * 1000, which still fits
>> into 32 bit.
> 
> Correct, I will fix this in next version.
> 
>>
>> Please correct me if I am missing something.
>>
> 
> My bad, you are right. The maximum timeout shall be
> 0xFFFF.FFFF.FFFF / 1000.000.000(1GHz) which is larger than before
> 0xFFFF.FFFF / 100.000.000(100MHz) by the hardware.
> 
> Can I do like this, after the version is got and check the version?
>          sbsa_gwdt_set_timeout(wdd, wdd->timeout);
> +       sbsa_gwdt_get_version(wdd);
> +       if (wdd->version > 0)
> +               wdd->max_hw_heartbeat_ms = GENMASK_ULL(47, 0) / gwdt->clk * 1000;
> 

I would suggest to set max_hw_heartbeat_ms in one place
to avoid confusion. Either check the version earlier,
or move setting both max_hw_heartbeat_ms values
after the call to sbsa_gwdt_get_version().

Thanks,
Guenter


  reply	other threads:[~2021-05-11  3:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10  3:41 [PATCH] watchdog: sbsa: Support architecture version 1 Shaokun Zhang
2021-05-10  4:25 ` Guenter Roeck
2021-05-10  8:25   ` Shaokun Zhang
2021-05-10  8:44     ` Shaokun Zhang
2021-05-10 15:23       ` Guenter Roeck
2021-05-10 13:16     ` Guenter Roeck
2021-05-11  2:49       ` Shaokun Zhang
2021-05-11  3:52         ` Guenter Roeck [this message]
2021-05-11  6:03           ` Shaokun Zhang

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=65876276-ddd5-7e1c-c0e3-d94c316f2d93@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=Suravee.Suthikulpanit@amd.com \
    --cc=al.stone@linaro.org \
    --cc=hujianchao@hisilicon.com \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=wanghuiqiang@huawei.com \
    --cc=wim@linux-watchdog.org \
    --cc=zhangshaokun@hisilicon.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 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).