From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E346C61D97 for ; Fri, 24 Nov 2023 13:21:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:From:Cc:To :Subject:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=hAD7+ysFgTovbD8DtNe6dxI+7VeReFGHoCE1SynBYzQ=; b=xvGopC+lyplPrl zeuvZtRoY+3tPI9gQcOb0xdiGxvBoPhw7Jdf805qM9coF68myJ8FdUNYu6HfPduDhtAVkPGKrugqd nUmZYY6o38iVaDXxdWLZUi9oHIsWha/ws5eV68C2miq1hcWgIczO0UYd/F0TBW03bTP2RaymkSycv +u40ldkzYti6oe+/6HIjJa3vv2Lc36K45NgkAiK8x61Ox96VTkDzCm6wFi8SPED/iiAbA7Eky8eon Sbpivo1LsU1x6Wdrdofbo9UJ78hYbUHEz6c5nqukNQzPW1bOmDXV+oQdcEBHGNiOIw8q3IQC3c898 hAT21SttB5gH/gEfoB0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r6W76-007IOd-1H; Fri, 24 Nov 2023 13:20:56 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r6W73-007INB-09 for linux-arm-kernel@lists.infradead.org; Fri, 24 Nov 2023 13:20:54 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id BE157B830A0; Fri, 24 Nov 2023 13:20:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7891C433D9; Fri, 24 Nov 2023 13:20:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700832051; bh=YZjq/WdquFfraXPlhuJnSVHfR2laYkWBm6jM9aJOmhI=; h=Subject:To:Cc:From:Date:From; b=bqbM11d+6mDVBuXtrrWChYYoZUSoW90UAlq42AMJtKX7qF5pwodTX19S3t9Xbc3V+ CnSnE3o3KYpOLl/bGNyMLuLeavWixCE1CXVik3bEzdGXBv/HGr7bUDM01JaCCgRPVH PWGjGz4hhNLKc+mD0FCwl52Jl2+ww4fCO9NZYLns= Subject: Patch "sbsa_gwdt: Calculate timeout with 64-bit math" has been added to the 6.5-stable tree To: darren@os.amperecomputing.com,gregkh@linuxfoundation.org,linux-arm-kernel@lists.infradead.org,linux@roeck-us.net,vanshikonda@os.amperecomputing.com,wim@linux-watchdog.org Cc: From: Date: Fri, 24 Nov 2023 13:18:48 +0000 Message-ID: <2023112448-tingly-flip-4e0f@gregkh> MIME-Version: 1.0 X-stable: commit X-Patchwork-Hint: ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231124_052053_354329_2533C4ED X-CRM114-Status: GOOD ( 16.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This is a note to let you know that I've just added the patch titled sbsa_gwdt: Calculate timeout with 64-bit math to the 6.5-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: sbsa_gwdt-calculate-timeout-with-64-bit-math.patch and it can be found in the queue-6.5 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From 5d6aa89bba5bd6af2580f872b57f438dab883738 Mon Sep 17 00:00:00 2001 From: Darren Hart Date: Thu, 21 Sep 2023 02:02:36 -0700 Subject: sbsa_gwdt: Calculate timeout with 64-bit math From: Darren Hart commit 5d6aa89bba5bd6af2580f872b57f438dab883738 upstream. 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 Signed-off-by: Darren Hart Cc: Wim Van Sebroeck Cc: Guenter Roeck Cc: linux-watchdog@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: # 5.14.x Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/7d1713c5ffab19b0f3de796d82df19e8b1f340de.1695286124.git.darren@os.amperecomputing.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Greg Kroah-Hartman --- drivers/watchdog/sbsa_gwdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/watchdog/sbsa_gwdt.c +++ b/drivers/watchdog/sbsa_gwdt.c @@ -153,14 +153,14 @@ static int sbsa_gwdt_set_timeout(struct timeout = clamp_t(unsigned int, timeout, 1, wdd->max_hw_heartbeat_ms / 1000); if (action) - sbsa_gwdt_reg_write(gwdt->clk * timeout, gwdt); + sbsa_gwdt_reg_write((u64)gwdt->clk * timeout, gwdt); else /* * In the single stage mode, The first signal (WS0) is ignored, * the timeout is (WOR * 2), so the WOR should be configured * to half value of timeout. */ - sbsa_gwdt_reg_write(gwdt->clk / 2 * timeout, gwdt); + sbsa_gwdt_reg_write(((u64)gwdt->clk / 2) * timeout, gwdt); return 0; } Patches currently in stable-queue which might be from darren@os.amperecomputing.com are queue-6.5/sbsa_gwdt-calculate-timeout-with-64-bit-math.patch _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel