[RFC PATCH 5/8] watchdog: Get rid of ASSEMBLY hacks

Stefan Roese sr at denx.de
Mon Aug 29 10:31:07 CEST 2022


On 29.08.22 09:50, Rasmus Villemoes wrote:
> On 29/08/2022 08.23, Stefan Roese wrote:
>> Only one occurance of WATCHDOG_RESET is left in one assembler file.
>> This patch changes this occurance to a direct call to watchdog_reset
> 
> Well...
> 
>> and then removes all the ASSEMBLY ifdef'ery in watchdog.h, as it's not
>> needed any more to clean this mess a bit up.
>>
>> Signed-off-by: Stefan Roese <sr at denx.de>
>> ---
>>   arch/powerpc/lib/ticks.S |  5 ++--
>>   include/watchdog.h       | 50 +++++++++++++---------------------------
>>   2 files changed, 19 insertions(+), 36 deletions(-)
>>
>> diff --git a/arch/powerpc/lib/ticks.S b/arch/powerpc/lib/ticks.S
>> index c487f938fa8d..8647d77cc9ad 100644
>> --- a/arch/powerpc/lib/ticks.S
>> +++ b/arch/powerpc/lib/ticks.S
>> @@ -9,7 +9,6 @@
>>   #include <ppc_asm.tmpl>
>>   #include <ppc_defs.h>
>>   #include <config.h>
>> -#include <watchdog.h>
>>   
>>   /*
>>    * unsigned long long get_ticks(void);
>> @@ -42,7 +41,9 @@ wait_ticks:
>>   	addc    r14, r4, r14	/* Compute end time lower */
>>   	addze	r15, r3		/*     and end time upper */
>>   
>> -	WATCHDOG_RESET		/* Trigger watchdog, if needed */
>> +#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
>> +	bl	schedule	/* Trigger watchdog, if needed */
> 
> ...you actually change it to a call to schedule(), which AFAICT doesn't
> always exist (at least as a function with external linkage). Or does it
> if either one of those conditions are met?

It has passed the CI world build at least, so I assume all is fine
with this change.

> Side note: Oh gosh do I hope this can put an end to the CONFIG_WATCHDOG
> v CONFIG_HW_WATCHDOG silliness; what is a watchdog if not a piece of HW.

Right. I was not brave enough to remove CONFIG_HW_WATCHDOG with this
patchset yet. But it's definitely on my list, to remove non DM watchdog
support and the HW_WATCHDOG stuff as well. Meaning to get this stuff
re-worked to support DM WDT as well or dropped if it's not maintained
any more.

>>   	#if defined(CONFIG_WATCHDOG)
>> -		#if defined(__ASSEMBLY__)
>> -			/* Don't require the watchdog to be enabled in SPL */
>> -			#if defined(CONFIG_SPL_BUILD) &&		\
>> -				!defined(CONFIG_SPL_WATCHDOG)
>> -				#define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
> 
> Yes please. I strongly suspect that comment is some ancient leftover
> from some none-complying preprocessor or whatnot.

Frankly, this definitely needs intensive and especially board testing.
So that all permutations of SPL and non-SPL watchdog support will still
be working with this patchset / migration.

Thanks,
Stefan



More information about the U-Boot mailing list