All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shaokun Zhang <zhangshaokun@hisilicon.com>
To: Guenter Roeck <linux@roeck-us.net>, <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: Tue, 11 May 2021 14:03:00 +0800	[thread overview]
Message-ID: <ef4ae3e7-21bf-4f47-57a4-7da681fe6a40@hisilicon.com> (raw)
In-Reply-To: <65876276-ddd5-7e1c-c0e3-d94c316f2d93@roeck-us.net>

Hi Guenter,

On 2021/5/11 11:52, Guenter Roeck wrote:
> 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().
> 

Got it, I will follow the former that many members in @wdd are
initialized closely.

Thanks again,
Shaokun

> Thanks,
> Guenter
> 
> .

      reply	other threads:[~2021-05-11  6:03 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
2021-05-11  6:03           ` Shaokun Zhang [this message]

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=ef4ae3e7-21bf-4f47-57a4-7da681fe6a40@hisilicon.com \
    --to=zhangshaokun@hisilicon.com \
    --cc=Suravee.Suthikulpanit@amd.com \
    --cc=al.stone@linaro.org \
    --cc=hujianchao@hisilicon.com \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wanghuiqiang@huawei.com \
    --cc=wim@linux-watchdog.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.