diff options
author | Darren Hart <[email protected]> | 2023-09-21 02:02:36 -0700 |
---|---|---|
committer | Wim Van Sebroeck <[email protected]> | 2023-10-29 19:45:05 +0100 |
commit | 5d6aa89bba5bd6af2580f872b57f438dab883738 (patch) | |
tree | 37f19e63131d000e7e2a0159f019d40cee978dcb /scripts/generate_rust_analyzer.py | |
parent | b4075ecfe348a44209534c75ad72392c63a489a6 (diff) |
sbsa_gwdt: Calculate timeout with 64-bit math
Commit abd3ac7902fb ("watchdog: sbsa: Support architecture version 1")
introduced new timer math for watchdog revision 1 with the 48 bit offset
register.
The gwdt->clk and timeout are u32, but the argument being calculated is
u64. Without a cast, the compiler performs u32 operations, truncating
intermediate steps, resulting in incorrect values.
A watchdog revision 1 implementation with a gwdt->clk of 1GHz and a
timeout of 600s writes 3647256576 to the one shot watchdog instead of
300000000000, resulting in the watchdog firing in 3.6s instead of 600s.
Force u64 math by casting the first argument (gwdt->clk) as a u64. Make
the order of operations explicit with parenthesis.
Fixes: abd3ac7902fb ("watchdog: sbsa: Support architecture version 1")
Reported-by: Vanshidhar Konda <[email protected]>
Signed-off-by: Darren Hart <[email protected]>
Cc: Wim Van Sebroeck <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: <[email protected]> # 5.14.x
Reviewed-by: Guenter Roeck <[email protected]>
Link: https://lore.kernel.org/r/7d1713c5ffab19b0f3de796d82df19e8b1f340de.1695286124.git.darren@os.amperecomputing.com
Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Wim Van Sebroeck <[email protected]>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions