From patchwork Mon Oct 9 04:40:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 731897 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60D22E95A99 for ; Mon, 9 Oct 2023 04:41:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345068AbjJIElE (ORCPT ); Mon, 9 Oct 2023 00:41:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229599AbjJIElC (ORCPT ); Mon, 9 Oct 2023 00:41:02 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AAEDA6; Sun, 8 Oct 2023 21:41:01 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 398Nn9vR001402; Sun, 8 Oct 2023 21:40:44 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=uuIo5XIor/wjVh0dvrOlKs3utXBrgZ7EaOP9tSaS5x8=; b=VCzAjk2kTFWnsK10/pF6EgAnpvTI3dqpLuB50W+kNpH8p5E1QXj87iFupsejXhLihahw 1YNEchwtJazPGjQRpCBa2c81yhwFmVqsjmk7yvS0lvq8QcSpI51caWOaEGYAKx9XFwqG 0WXFDcFKlBWHpv3HsDep1b5p1ugCYqTQBtjixzDVg0ckjlBbO3lRPZqyrnlV72hPP92U J9n3Xx8LaDShRbxk+bQxT/gZSB8BSQdaY+pXNwwPszM5maaWX4cNY7gF0xXVi2NDdXDD Z2DsSmBUgrwvGRIyyp5lkhTqSwaGx0/qUGOBXMIUoD6jIQxtRg3RtfYdoxnZ58v/JOz+ JQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3tkh7caxpd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 08 Oct 2023 21:40:44 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 8 Oct 2023 21:40:42 -0700 Received: from bharat-OptiPlex-3070.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sun, 8 Oct 2023 21:40:40 -0700 From: Bharat Bhushan To: , , , CC: Bharat Bhushan Subject: [PATCH 1/2] drivers: watchdog: marvell_gti: fix zero pretimeout handling Date: Mon, 9 Oct 2023 10:10:36 +0530 Message-ID: <20231009044037.514570-1-bbhushan2@marvell.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Proofpoint-GUID: q5ADRS9OT7OBc5vrGjQku54tNrjeuH8z X-Proofpoint-ORIG-GUID: q5ADRS9OT7OBc5vrGjQku54tNrjeuH8z X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-09_03,2023-10-06_01,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org When pretimeout is set to 0 then do not reprogram timer with zero timeout, this will reset device immediately. Also disable interrupt to stop pretimeout notification. Signed-off-by: Bharat Bhushan Reviewed-by: Guenter Roeck --- drivers/watchdog/marvell_gti_wdt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/watchdog/marvell_gti_wdt.c b/drivers/watchdog/marvell_gti_wdt.c index d7eb8286e11e..25b7ce0f0738 100644 --- a/drivers/watchdog/marvell_gti_wdt.c +++ b/drivers/watchdog/marvell_gti_wdt.c @@ -190,6 +190,13 @@ static int gti_wdt_set_pretimeout(struct watchdog_device *wdev, struct gti_wdt_priv *priv = watchdog_get_drvdata(wdev); struct watchdog_device *wdog_dev = &priv->wdev; + if (!timeout) { + /* Disable Interrupt */ + writeq(GTI_CWD_INT_ENA_CLR_VAL(priv->wdt_timer_idx), + priv->base + GTI_CWD_INT_ENA_CLR); + return 0; + } + /* pretimeout should 1/3 of max_timeout */ if (timeout * 3 <= wdog_dev->max_timeout) return gti_wdt_settimeout(wdev, timeout * 3); From patchwork Mon Oct 9 04:40:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 731398 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21896E95A9A for ; Mon, 9 Oct 2023 04:41:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbjJIElD (ORCPT ); Mon, 9 Oct 2023 00:41:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjJIElC (ORCPT ); Mon, 9 Oct 2023 00:41:02 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED0BAA4; Sun, 8 Oct 2023 21:41:00 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3991owPD016392; Sun, 8 Oct 2023 21:40:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=e1E4yBbuRVcGbbzNG/kLtyea/YcE+LVDiDlx6i6u478=; b=AlPKvwJ7PUEjT3IinleEIg6ZYrJVKMaxC3X5Hfau6Vx0SxTviufzcP3+A+V3JMhWwMK8 AWGIkJpPx+N9Jz5lKHIkknpb+XFerEyoAoNJHCVK07TQ4TR0BHADoCa0IJAcjzTj+gSk xLx6YT/SNS/4bHb0La2pEKBIR7H2XOMWK2zSgCIhfiQLCpVk08w2GUH2H9bTv3cMqieN OTmKVUDlenp8MmzXjhsOX9NADaYWYykTGJJd7W/3Xnouvre1H7UUQR9L0FBGeNgm5lU5 y1WLEE8WnfEntMTtxn6wvwRCA6iRnA8bIJuxrjPK8QUAw7FYEqg3mHNw9pfvhK2yxOdy vQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tkh9sjvqc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 08 Oct 2023 21:40:47 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 8 Oct 2023 21:40:45 -0700 Received: from bharat-OptiPlex-3070.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sun, 8 Oct 2023 21:40:43 -0700 From: Bharat Bhushan To: , , , CC: George Cherian , Bharat Bhushan Subject: [PATCH 2/2] drivers: watchdog: marvell_gti: Program the max_hw_heartbeat_ms Date: Mon, 9 Oct 2023 10:10:37 +0530 Message-ID: <20231009044037.514570-2-bbhushan2@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231009044037.514570-1-bbhushan2@marvell.com> References: <20231009044037.514570-1-bbhushan2@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: rwdaYs0aa5hyAwzRWiuQo8KHa-EKl7bv X-Proofpoint-ORIG-GUID: rwdaYs0aa5hyAwzRWiuQo8KHa-EKl7bv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-09_02,2023-10-06_01,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org From: George Cherian Program the max_hw_heartbeat_ms value so that the watchdog_pretimeout worker is activated. This kernel worker thread makes sure to ping the watchdog in case the userspace is unable to do so. This kernel worker ping will be done only till the full watchdog timeout there by maintaining the watchdog functionality in case of a real hang. Signed-off-by: George Cherian Signed-off-by: Bharat Bhushan --- drivers/watchdog/marvell_gti_wdt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/marvell_gti_wdt.c b/drivers/watchdog/marvell_gti_wdt.c index 25b7ce0f0738..bfe0c819248c 100644 --- a/drivers/watchdog/marvell_gti_wdt.c +++ b/drivers/watchdog/marvell_gti_wdt.c @@ -299,6 +299,7 @@ static int gti_wdt_probe(struct platform_device *pdev) /* Maximum timeout is 3 times the pretimeout */ wdog_dev->max_timeout = max_pretimeout * 3; + wdog_dev->max_hw_heartbeat_ms = max_pretimeout * 1000; /* Minimum first timeout (pretimeout) is 1, so min_timeout as 3 */ wdog_dev->min_timeout = 3; wdog_dev->timeout = wdog_dev->pretimeout;