On 5/27/26 2:55 PM, Igor Mammedov wrote:
> On Tue, 26 May 2026 16:24:59 +0200
> Eric Auger <[email protected]> wrote:
> 
>> On 3/3/26 10:25 AM, Igor Mammedov wrote:
>>> it will be used by arm/virt board, to pick WDAT compatible watchdog impl.
>>> and act as switch over to WDAT ACPI table vesus default GTDT ACPI table.
>>>
>>> Signed-off-by: Igor Mammedov <[email protected]>
>>> ---
>>>  include/hw/watchdog/sbsa_gwdt.h | 1 +
>>>  hw/watchdog/sbsa_gwdt.c         | 8 ++++++++
>>>  2 files changed, 9 insertions(+)
>>>
>>> diff --git a/include/hw/watchdog/sbsa_gwdt.h 
>>> b/include/hw/watchdog/sbsa_gwdt.h
>>> index 307a4f291a..dc77e6be60 100644
>>> --- a/include/hw/watchdog/sbsa_gwdt.h
>>> +++ b/include/hw/watchdog/sbsa_gwdt.h
>>> @@ -73,6 +73,7 @@ typedef struct SBSA_GWDTState {
>>>      uint32_t woru;
>>>      uint32_t wcvl;
>>>      uint32_t wcvu;
>>> +    bool wdat;
>>>  } SBSA_GWDTState;
>>>  
>>>  #endif /* WDT_SBSA_GWDT_H */
>>> diff --git a/hw/watchdog/sbsa_gwdt.c b/hw/watchdog/sbsa_gwdt.c
>>> index c4dd8005b7..40d80f7f2b 100644
>>> --- a/hw/watchdog/sbsa_gwdt.c
>>> +++ b/hw/watchdog/sbsa_gwdt.c
>>> @@ -265,6 +265,13 @@ static void wdt_sbsa_gwdt_realize(DeviceState *dev, 
>>> Error **errp)
>>>  
>>>      sysbus_init_irq(sbd, &s->irq);
>>>  
>>> +    /*
>>> +     * WDAT supports only upto 1KHz resolution,
>>> +     */
>>> +    if (s->wdat) {
>>> +        s->freq = 1000;  
>> where is it specified in the spec?
> 
> next patch has link to WDAT spec and
> comment around relevant field:
> 
> +    /*
> +     * WDAT spec suports only 1KHz or more coarse watchdog timer,
coarser?
By the way, in above comment, you can directly quote the spec:
"The clock interval that the WDT uses must be greater than or equal to 1
millisecond."

Besides:
Reviewed-by: Eric Auger <[email protected]>

Thanks

Eric
> +     * Set resolution to minimum supported 1ms.
> +     * Before starting watchdog Windows set countdown value to 5min.
> +     */
> +    g_assert(freq <= 1000);
> +    build_append_int_noprefix(table_data, 1, 4);/* Timer Period, ms */
> 
> it's the hack to make gwdt usable for wdat and is applied only when
> wdat is enabled, if not the gwdt is instantiated with native 1G and
> provides corresponding fdt.
> 
>>
>> Thanks
>>
>> Eric
>>
>>> +    }
>>> +
>>>      s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, 
>>> sbsa_gwdt_timer_sysinterrupt,
>>>                  dev);
>>>  }
>>> @@ -276,6 +283,7 @@ static const Property wdt_sbsa_gwdt_props[] = {
>>>       */
>>>      DEFINE_PROP_UINT64("clock-frequency", struct SBSA_GWDTState, freq,
>>>                         1000000000),
>>> +    DEFINE_PROP_BOOL("wdat", struct SBSA_GWDTState, wdat, false),
>>>  };
>>>  
>>>  static void wdt_sbsa_gwdt_class_init(ObjectClass *klass, const void *data) 
>>>  
>>
> 


Reply via email to