linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/9] Intel Keem Bay WDT bug fixes
@ 2021-05-17 17:49 shruthi.sanil
  2021-05-17 17:49 ` [PATCH v2 1/9] watchdog: keembay: Update WDT pre-timeout during the initialization shruthi.sanil
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: shruthi.sanil @ 2021-05-17 17:49 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel
  Cc: andriy.shevchenko, kris.pan, mgross, srikanth.thokala,
	lakshmi.bai.raja.subramanian, mallikarjunappa.sangannavar,
	shruthi.sanil

From: Shruthi Sanil <shruthi.sanil@intel.com>

The series of patches include the below bug fixes
in the Intel Keem Bay watchdog timer driver:

Patch 1/9:
- Update WDT pre-timeout during the initialization
  The pretimeout register has a default reset value. Hence
  when a smaller WDT timeout is set which would be lesser than the
  default pretimeout, the system behaves abnormally, starts
  triggering the pretimeout interrupt even when the WDT is
  not enabled, most of the times leading to system crash.
  Hence an update in the pre-timeout is also required for the
  default timeout that is being configured.

Patch 2/9:
- Upadate WDT pretimeout for every update in timeout
  The pre-timeout value to be programmed to the register has to be
  calculated and updated for every change in the timeout value.
  Else the threshold time wouldn't be calculated to its
  corresponding timeout.

Patch 3/9:
- Update pretimeout to 0 in the TH ISR
  The pretimeout has to be updated to 0 during the ISR of the
  ThresHold interrupt. Else the TH interrupt would be triggerred for
  every tick until the timeout.

Patch 4/9:
- Clear either the TO or TH interrupt bit
  During the interrupt service routine of the TimeOut interrupt and
  the ThresHold interrupt, the respective interrupt clear bit
  have to be cleared and not both.

Patch 5/9:
- Remove timeout update in the WDT start function
  Removed set timeout from the start WDT function. There is a function
  defined to set the timeout. Hence no need to set the timeout again in
  start function as the timeout would have been already updated
  before calling the start/enable.

Patch 6/9:
- Removed timeout update in the TO ISR
  In the TO ISR removed updating the Timeout value because
  its not serving any purpose as the timer would have already expired
  and the system would be rebooting.

Patch 7/9:
- MACRO for WDT enable and disable values
  Introduced MACRO's for WDT enable and disable values for better readability

Patch 8/9:
- WDT SMC handler MACRO name update
  Updated the WDT SMC handler MACRO name to make it clear that its
  a ARM SMC handler that helps in clearing the WDT interrupt bit.

Patch 9/9:
- Typo corrections and other blank operations
  Corrected typos, aligned the tabs and added new lines
  wherever required for better readability

Changes since v1:
- Dropped a patch with the incorrect fix
  regarding the WDT suspend/resume function.

Shruthi Sanil (9):
  watchdog: keembay: Update WDT pre-timeout during the initialization
  watchdog: keembay: Upadate WDT pretimeout for every update in timeout
  watchdog: keembay: Update pretimeout to zero in the TH ISR
  watchdog: keembay: Clear either the TO or TH interrupt bit
  watchdog: keembay: Remove timeout update in the WDT start function
  watchdog: keembay: Removed timeout update in the TO ISR
  watchdog: keembay: MACRO for WDT enable and disable values
  watchdog: keembay: WDT SMC handler MACRO name update
  watchdog: keembay: Typo corrections and other blank operations

 drivers/watchdog/keembay_wdt.c | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)


base-commit: 88b06399c9c766c283e070b022b5ceafa4f63f19
-- 
2.17.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/9] watchdog: keembay: Update WDT pre-timeout during the initialization
  2021-05-17 17:49 [PATCH v2 0/9] Intel Keem Bay WDT bug fixes shruthi.sanil
@ 2021-05-17 17:49 ` shruthi.sanil
  2021-05-17 17:49 ` [PATCH v2 2/9] watchdog: keembay: Upadate WDT pretimeout for every update in timeout shruthi.sanil
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: shruthi.sanil @ 2021-05-17 17:49 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel
  Cc: andriy.shevchenko, kris.pan, mgross, srikanth.thokala,
	lakshmi.bai.raja.subramanian, mallikarjunappa.sangannavar,
	shruthi.sanil

From: Shruthi Sanil <shruthi.sanil@intel.com>

The pretimeout register has a default reset value. Hence
when a smaller WDT timeout is set which would be lesser than the
default pretimeout, the system behaves abnormally, starts
triggering the pretimeout interrupt even when the WDT is
not enabled, most of the times leading to system crash.
Hence an update in the pre-timeout is also required for the
default timeout that is being configured.

Fixes: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc")
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Kris Pan <kris.pan@intel.com>
Signed-off-by: Shruthi Sanil <shruthi.sanil@intel.com>
---
 drivers/watchdog/keembay_wdt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c
index 547d3fea33ff..f2f5c9fae29c 100644
--- a/drivers/watchdog/keembay_wdt.c
+++ b/drivers/watchdog/keembay_wdt.c
@@ -29,6 +29,7 @@
 #define WDT_LOAD_MAX		U32_MAX
 #define WDT_LOAD_MIN		1
 #define WDT_TIMEOUT		5
+#define WDT_PRETIMEOUT		4
 
 static unsigned int timeout = WDT_TIMEOUT;
 module_param(timeout, int, 0);
@@ -224,11 +225,13 @@ static int keembay_wdt_probe(struct platform_device *pdev)
 	wdt->wdd.min_timeout	= WDT_LOAD_MIN;
 	wdt->wdd.max_timeout	= WDT_LOAD_MAX / wdt->rate;
 	wdt->wdd.timeout	= WDT_TIMEOUT;
+	wdt->wdd.pretimeout	= WDT_PRETIMEOUT;
 
 	watchdog_set_drvdata(&wdt->wdd, wdt);
 	watchdog_set_nowayout(&wdt->wdd, nowayout);
 	watchdog_init_timeout(&wdt->wdd, timeout, dev);
 	keembay_wdt_set_timeout(&wdt->wdd, wdt->wdd.timeout);
+	keembay_wdt_set_pretimeout(&wdt->wdd, wdt->wdd.pretimeout);
 
 	ret = devm_watchdog_register_device(dev, &wdt->wdd);
 	if (ret)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/9] watchdog: keembay: Upadate WDT pretimeout for every update in timeout
  2021-05-17 17:49 [PATCH v2 0/9] Intel Keem Bay WDT bug fixes shruthi.sanil
  2021-05-17 17:49 ` [PATCH v2 1/9] watchdog: keembay: Update WDT pre-timeout during the initialization shruthi.sanil
@ 2021-05-17 17:49 ` shruthi.sanil
  2021-05-17 17:49 ` [PATCH v2 3/9] watchdog: keembay: Update pretimeout to zero in the TH ISR shruthi.sanil
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: shruthi.sanil @ 2021-05-17 17:49 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel
  Cc: andriy.shevchenko, kris.pan, mgross, srikanth.thokala,
	lakshmi.bai.raja.subramanian, mallikarjunappa.sangannavar,
	shruthi.sanil

From: Shruthi Sanil <shruthi.sanil@intel.com>

The pre-timeout value to be programmed to the register has to be
calculated and updated for every change in the timeout value.
Else the threshold time wouldn't be calculated to its
corresponding timeout.

Fixes: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc")
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Kris Pan <kris.pan@intel.com>
Signed-off-by: Shruthi Sanil <shruthi.sanil@intel.com>
---
 drivers/watchdog/keembay_wdt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c
index f2f5c9fae29c..b2afeb4a60e3 100644
--- a/drivers/watchdog/keembay_wdt.c
+++ b/drivers/watchdog/keembay_wdt.c
@@ -109,6 +109,7 @@ static int keembay_wdt_set_timeout(struct watchdog_device *wdog, u32 t)
 {
 	wdog->timeout = t;
 	keembay_wdt_set_timeout_reg(wdog);
+	keembay_wdt_set_pretimeout_reg(wdog);
 
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/9] watchdog: keembay: Update pretimeout to zero in the TH ISR
  2021-05-17 17:49 [PATCH v2 0/9] Intel Keem Bay WDT bug fixes shruthi.sanil
  2021-05-17 17:49 ` [PATCH v2 1/9] watchdog: keembay: Update WDT pre-timeout during the initialization shruthi.sanil
  2021-05-17 17:49 ` [PATCH v2 2/9] watchdog: keembay: Upadate WDT pretimeout for every update in timeout shruthi.sanil
@ 2021-05-17 17:49 ` shruthi.sanil
  2021-05-17 17:49 ` [PATCH v2 4/9] watchdog: keembay: Clear either the TO or TH interrupt bit shruthi.sanil
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: shruthi.sanil @ 2021-05-17 17:49 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel
  Cc: andriy.shevchenko, kris.pan, mgross, srikanth.thokala,
	lakshmi.bai.raja.subramanian, mallikarjunappa.sangannavar,
	shruthi.sanil

From: Shruthi Sanil <shruthi.sanil@intel.com>

The pretimeout has to be updated to zero during the ISR of the
ThresHold interrupt. Else the TH interrupt would be triggerred for
every tick until the timeout.

Fixes: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc")
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Kris Pan <kris.pan@intel.com>
Signed-off-by: Shruthi Sanil <shruthi.sanil@intel.com>
---
 drivers/watchdog/keembay_wdt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c
index b2afeb4a60e3..6053416b8d3d 100644
--- a/drivers/watchdog/keembay_wdt.c
+++ b/drivers/watchdog/keembay_wdt.c
@@ -154,6 +154,8 @@ static irqreturn_t keembay_wdt_th_isr(int irq, void *dev_id)
 	struct keembay_wdt *wdt = dev_id;
 	struct arm_smccc_res res;
 
+	keembay_wdt_set_pretimeout(&wdt->wdd, 0x0);
+
 	arm_smccc_smc(WDT_ISR_CLEAR, WDT_ISR_MASK, 0, 0, 0, 0, 0, 0, &res);
 	dev_crit(wdt->wdd.parent, "Intel Keem Bay non-sec wdt pre-timeout.\n");
 	watchdog_notify_pretimeout(&wdt->wdd);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/9] watchdog: keembay: Clear either the TO or TH interrupt bit
  2021-05-17 17:49 [PATCH v2 0/9] Intel Keem Bay WDT bug fixes shruthi.sanil
                   ` (2 preceding siblings ...)
  2021-05-17 17:49 ` [PATCH v2 3/9] watchdog: keembay: Update pretimeout to zero in the TH ISR shruthi.sanil
@ 2021-05-17 17:49 ` shruthi.sanil
  2021-05-17 17:49 ` [PATCH v2 5/9] watchdog: keembay: Remove timeout update in the WDT start function shruthi.sanil
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: shruthi.sanil @ 2021-05-17 17:49 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel
  Cc: andriy.shevchenko, kris.pan, mgross, srikanth.thokala,
	lakshmi.bai.raja.subramanian, mallikarjunappa.sangannavar,
	shruthi.sanil

From: Shruthi Sanil <shruthi.sanil@intel.com>

During the interrupt service routine of the TimeOut interrupt and
the ThresHold interrupt, the respective interrupt clear bit
have to be cleared and not both.

Fixes: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc")
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Kris Pan <kris.pan@intel.com>
Signed-off-by: Shruthi Sanil <shruthi.sanil@intel.com>
---
 drivers/watchdog/keembay_wdt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c
index 6053416b8d3d..f2a16c9933c3 100644
--- a/drivers/watchdog/keembay_wdt.c
+++ b/drivers/watchdog/keembay_wdt.c
@@ -23,7 +23,8 @@
 #define TIM_WDOG_EN		0x8
 #define TIM_SAFE		0xc
 
-#define WDT_ISR_MASK		GENMASK(9, 8)
+#define WDT_TH_INT_MASK		BIT(8)
+#define WDT_TO_INT_MASK		BIT(9)
 #define WDT_ISR_CLEAR		0x8200ff18
 #define WDT_UNLOCK		0xf1d0dead
 #define WDT_LOAD_MAX		U32_MAX
@@ -142,7 +143,7 @@ static irqreturn_t keembay_wdt_to_isr(int irq, void *dev_id)
 	struct arm_smccc_res res;
 
 	keembay_wdt_writel(wdt, TIM_WATCHDOG, 1);
-	arm_smccc_smc(WDT_ISR_CLEAR, WDT_ISR_MASK, 0, 0, 0, 0, 0, 0, &res);
+	arm_smccc_smc(WDT_ISR_CLEAR, WDT_TO_INT_MASK, 0, 0, 0, 0, 0, 0, &res);
 	dev_crit(wdt->wdd.parent, "Intel Keem Bay non-sec wdt timeout.\n");
 	emergency_restart();
 
@@ -156,7 +157,7 @@ static irqreturn_t keembay_wdt_th_isr(int irq, void *dev_id)
 
 	keembay_wdt_set_pretimeout(&wdt->wdd, 0x0);
 
-	arm_smccc_smc(WDT_ISR_CLEAR, WDT_ISR_MASK, 0, 0, 0, 0, 0, 0, &res);
+	arm_smccc_smc(WDT_ISR_CLEAR, WDT_TH_INT_MASK, 0, 0, 0, 0, 0, 0, &res);
 	dev_crit(wdt->wdd.parent, "Intel Keem Bay non-sec wdt pre-timeout.\n");
 	watchdog_notify_pretimeout(&wdt->wdd);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 5/9] watchdog: keembay: Remove timeout update in the WDT start function
  2021-05-17 17:49 [PATCH v2 0/9] Intel Keem Bay WDT bug fixes shruthi.sanil
                   ` (3 preceding siblings ...)
  2021-05-17 17:49 ` [PATCH v2 4/9] watchdog: keembay: Clear either the TO or TH interrupt bit shruthi.sanil
@ 2021-05-17 17:49 ` shruthi.sanil
  2021-05-17 17:49 ` [PATCH v2 6/9] watchdog: keembay: Removed timeout update in the TO ISR shruthi.sanil
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: shruthi.sanil @ 2021-05-17 17:49 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel
  Cc: andriy.shevchenko, kris.pan, mgross, srikanth.thokala,
	lakshmi.bai.raja.subramanian, mallikarjunappa.sangannavar,
	shruthi.sanil

From: Shruthi Sanil <shruthi.sanil@intel.com>

Removed set timeout from the start WDT function. There is a function
defined to set the timeout. Hence no need to set the timeout again in
start function as the timeout would have been already updated
before calling the start/enable.

Fixes: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc")
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Kris Pan <kris.pan@intel.com>
Signed-off-by: Shruthi Sanil <shruthi.sanil@intel.com>
---
 drivers/watchdog/keembay_wdt.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c
index f2a16c9933c3..039753b9932b 100644
--- a/drivers/watchdog/keembay_wdt.c
+++ b/drivers/watchdog/keembay_wdt.c
@@ -84,7 +84,6 @@ static int keembay_wdt_start(struct watchdog_device *wdog)
 {
 	struct keembay_wdt *wdt = watchdog_get_drvdata(wdog);
 
-	keembay_wdt_set_timeout_reg(wdog);
 	keembay_wdt_writel(wdt, TIM_WDOG_EN, 1);
 
 	return 0;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 6/9] watchdog: keembay: Removed timeout update in the TO ISR
  2021-05-17 17:49 [PATCH v2 0/9] Intel Keem Bay WDT bug fixes shruthi.sanil
                   ` (4 preceding siblings ...)
  2021-05-17 17:49 ` [PATCH v2 5/9] watchdog: keembay: Remove timeout update in the WDT start function shruthi.sanil
@ 2021-05-17 17:49 ` shruthi.sanil
  2021-05-17 17:49 ` [PATCH v2 7/9] watchdog: keembay: MACRO for WDT enable and disable values shruthi.sanil
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: shruthi.sanil @ 2021-05-17 17:49 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel
  Cc: andriy.shevchenko, kris.pan, mgross, srikanth.thokala,
	lakshmi.bai.raja.subramanian, mallikarjunappa.sangannavar,
	shruthi.sanil

From: Shruthi Sanil <shruthi.sanil@intel.com>

In the TO ISR removed updating the Timeout value because
its not serving any purpose as the timer would have already expired
and the system would be rebooting.

Fixes: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc")
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Kris Pan <kris.pan@intel.com>
Signed-off-by: Shruthi Sanil <shruthi.sanil@intel.com>
---
 drivers/watchdog/keembay_wdt.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c
index 039753b9932b..dd192b8dff55 100644
--- a/drivers/watchdog/keembay_wdt.c
+++ b/drivers/watchdog/keembay_wdt.c
@@ -141,7 +141,6 @@ static irqreturn_t keembay_wdt_to_isr(int irq, void *dev_id)
 	struct keembay_wdt *wdt = dev_id;
 	struct arm_smccc_res res;
 
-	keembay_wdt_writel(wdt, TIM_WATCHDOG, 1);
 	arm_smccc_smc(WDT_ISR_CLEAR, WDT_TO_INT_MASK, 0, 0, 0, 0, 0, 0, &res);
 	dev_crit(wdt->wdd.parent, "Intel Keem Bay non-sec wdt timeout.\n");
 	emergency_restart();
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 7/9] watchdog: keembay: MACRO for WDT enable and disable values
  2021-05-17 17:49 [PATCH v2 0/9] Intel Keem Bay WDT bug fixes shruthi.sanil
                   ` (5 preceding siblings ...)
  2021-05-17 17:49 ` [PATCH v2 6/9] watchdog: keembay: Removed timeout update in the TO ISR shruthi.sanil
@ 2021-05-17 17:49 ` shruthi.sanil
  2021-05-17 17:49 ` [PATCH v2 8/9] watchdog: keembay: WDT SMC handler MACRO name update shruthi.sanil
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: shruthi.sanil @ 2021-05-17 17:49 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel
  Cc: andriy.shevchenko, kris.pan, mgross, srikanth.thokala,
	lakshmi.bai.raja.subramanian, mallikarjunappa.sangannavar,
	shruthi.sanil

From: Shruthi Sanil <shruthi.sanil@intel.com>

Introduced MACRO's for WDT enable and disable values for better readability

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Kris Pan <kris.pan@intel.com>
Signed-off-by: Shruthi Sanil <shruthi.sanil@intel.com>
---
 drivers/watchdog/keembay_wdt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c
index dd192b8dff55..d8c50b6291cd 100644
--- a/drivers/watchdog/keembay_wdt.c
+++ b/drivers/watchdog/keembay_wdt.c
@@ -27,6 +27,8 @@
 #define WDT_TO_INT_MASK		BIT(9)
 #define WDT_ISR_CLEAR		0x8200ff18
 #define WDT_UNLOCK		0xf1d0dead
+#define WDT_DISABLE		0x0
+#define WDT_ENABLE		0x1
 #define WDT_LOAD_MAX		U32_MAX
 #define WDT_LOAD_MIN		1
 #define WDT_TIMEOUT		5
@@ -84,7 +86,7 @@ static int keembay_wdt_start(struct watchdog_device *wdog)
 {
 	struct keembay_wdt *wdt = watchdog_get_drvdata(wdog);
 
-	keembay_wdt_writel(wdt, TIM_WDOG_EN, 1);
+	keembay_wdt_writel(wdt, TIM_WDOG_EN, WDT_ENABLE);
 
 	return 0;
 }
@@ -93,7 +95,7 @@ static int keembay_wdt_stop(struct watchdog_device *wdog)
 {
 	struct keembay_wdt *wdt = watchdog_get_drvdata(wdog);
 
-	keembay_wdt_writel(wdt, TIM_WDOG_EN, 0);
+	keembay_wdt_writel(wdt, TIM_WDOG_EN, WDT_DISABLE);
 
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 8/9] watchdog: keembay: WDT SMC handler MACRO name update
  2021-05-17 17:49 [PATCH v2 0/9] Intel Keem Bay WDT bug fixes shruthi.sanil
                   ` (6 preceding siblings ...)
  2021-05-17 17:49 ` [PATCH v2 7/9] watchdog: keembay: MACRO for WDT enable and disable values shruthi.sanil
@ 2021-05-17 17:49 ` shruthi.sanil
  2021-05-17 17:49 ` [PATCH v2 9/9] watchdog: keembay: Typo corrections and other blank operations shruthi.sanil
  2021-05-24  6:06 ` [PATCH v2 0/9] Intel Keem Bay WDT bug fixes Sanil, Shruthi
  9 siblings, 0 replies; 13+ messages in thread
From: shruthi.sanil @ 2021-05-17 17:49 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel
  Cc: andriy.shevchenko, kris.pan, mgross, srikanth.thokala,
	lakshmi.bai.raja.subramanian, mallikarjunappa.sangannavar,
	shruthi.sanil

From: Shruthi Sanil <shruthi.sanil@intel.com>

Updated the WDT SMC handler MACRO name to make it clear that its
a ARM SMC handler that helps in clearing the WDT interrupt bit.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Kris Pan <kris.pan@intel.com>
Signed-off-by: Shruthi Sanil <shruthi.sanil@intel.com>
---
 drivers/watchdog/keembay_wdt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c
index d8c50b6291cd..5ac823487b70 100644
--- a/drivers/watchdog/keembay_wdt.c
+++ b/drivers/watchdog/keembay_wdt.c
@@ -25,7 +25,7 @@
 
 #define WDT_TH_INT_MASK		BIT(8)
 #define WDT_TO_INT_MASK		BIT(9)
-#define WDT_ISR_CLEAR		0x8200ff18
+#define WDT_INT_CLEAR_SMC	0x8200ff18
 #define WDT_UNLOCK		0xf1d0dead
 #define WDT_DISABLE		0x0
 #define WDT_ENABLE		0x1
@@ -143,7 +143,7 @@ static irqreturn_t keembay_wdt_to_isr(int irq, void *dev_id)
 	struct keembay_wdt *wdt = dev_id;
 	struct arm_smccc_res res;
 
-	arm_smccc_smc(WDT_ISR_CLEAR, WDT_TO_INT_MASK, 0, 0, 0, 0, 0, 0, &res);
+	arm_smccc_smc(WDT_INT_CLEAR_SMC, WDT_TO_INT_MASK, 0, 0, 0, 0, 0, 0, &res);
 	dev_crit(wdt->wdd.parent, "Intel Keem Bay non-sec wdt timeout.\n");
 	emergency_restart();
 
@@ -157,7 +157,7 @@ static irqreturn_t keembay_wdt_th_isr(int irq, void *dev_id)
 
 	keembay_wdt_set_pretimeout(&wdt->wdd, 0x0);
 
-	arm_smccc_smc(WDT_ISR_CLEAR, WDT_TH_INT_MASK, 0, 0, 0, 0, 0, 0, &res);
+	arm_smccc_smc(WDT_INT_CLEAR_SMC, WDT_TH_INT_MASK, 0, 0, 0, 0, 0, 0, &res);
 	dev_crit(wdt->wdd.parent, "Intel Keem Bay non-sec wdt pre-timeout.\n");
 	watchdog_notify_pretimeout(&wdt->wdd);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 9/9] watchdog: keembay: Typo corrections and other blank operations
  2021-05-17 17:49 [PATCH v2 0/9] Intel Keem Bay WDT bug fixes shruthi.sanil
                   ` (7 preceding siblings ...)
  2021-05-17 17:49 ` [PATCH v2 8/9] watchdog: keembay: WDT SMC handler MACRO name update shruthi.sanil
@ 2021-05-17 17:49 ` shruthi.sanil
  2021-05-24  6:06 ` [PATCH v2 0/9] Intel Keem Bay WDT bug fixes Sanil, Shruthi
  9 siblings, 0 replies; 13+ messages in thread
From: shruthi.sanil @ 2021-05-17 17:49 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel
  Cc: andriy.shevchenko, kris.pan, mgross, srikanth.thokala,
	lakshmi.bai.raja.subramanian, mallikarjunappa.sangannavar,
	shruthi.sanil

From: Shruthi Sanil <shruthi.sanil@intel.com>

Corrected typos, aligned the tabs and added new lines
wherever required for better readability

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Kris Pan <kris.pan@intel.com>
Signed-off-by: Shruthi Sanil <shruthi.sanil@intel.com>
---
 drivers/watchdog/keembay_wdt.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c
index 5ac823487b70..2a39114dbc64 100644
--- a/drivers/watchdog/keembay_wdt.c
+++ b/drivers/watchdog/keembay_wdt.c
@@ -26,11 +26,14 @@
 #define WDT_TH_INT_MASK		BIT(8)
 #define WDT_TO_INT_MASK		BIT(9)
 #define WDT_INT_CLEAR_SMC	0x8200ff18
+
 #define WDT_UNLOCK		0xf1d0dead
 #define WDT_DISABLE		0x0
 #define WDT_ENABLE		0x1
+
 #define WDT_LOAD_MAX		U32_MAX
 #define WDT_LOAD_MIN		1
+
 #define WDT_TIMEOUT		5
 #define WDT_PRETIMEOUT		4
 
@@ -144,7 +147,7 @@ static irqreturn_t keembay_wdt_to_isr(int irq, void *dev_id)
 	struct arm_smccc_res res;
 
 	arm_smccc_smc(WDT_INT_CLEAR_SMC, WDT_TO_INT_MASK, 0, 0, 0, 0, 0, 0, &res);
-	dev_crit(wdt->wdd.parent, "Intel Keem Bay non-sec wdt timeout.\n");
+	dev_crit(wdt->wdd.parent, "Intel Keem Bay non-secure wdt timeout.\n");
 	emergency_restart();
 
 	return IRQ_HANDLED;
@@ -158,7 +161,7 @@ static irqreturn_t keembay_wdt_th_isr(int irq, void *dev_id)
 	keembay_wdt_set_pretimeout(&wdt->wdd, 0x0);
 
 	arm_smccc_smc(WDT_INT_CLEAR_SMC, WDT_TH_INT_MASK, 0, 0, 0, 0, 0, 0, &res);
-	dev_crit(wdt->wdd.parent, "Intel Keem Bay non-sec wdt pre-timeout.\n");
+	dev_crit(wdt->wdd.parent, "Intel Keem Bay non-secure wdt pre-timeout.\n");
 	watchdog_notify_pretimeout(&wdt->wdd);
 
 	return IRQ_HANDLED;
@@ -278,8 +281,8 @@ static const struct of_device_id keembay_wdt_match[] = {
 MODULE_DEVICE_TABLE(of, keembay_wdt_match);
 
 static struct platform_driver keembay_wdt_driver = {
-	.probe		= keembay_wdt_probe,
-	.driver		= {
+	.probe	= keembay_wdt_probe,
+	.driver	= {
 		.name		= "keembay_wdt",
 		.of_match_table	= keembay_wdt_match,
 		.pm		= &keembay_wdt_pm_ops,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* RE: [PATCH v2 0/9] Intel Keem Bay WDT bug fixes
  2021-05-17 17:49 [PATCH v2 0/9] Intel Keem Bay WDT bug fixes shruthi.sanil
                   ` (8 preceding siblings ...)
  2021-05-17 17:49 ` [PATCH v2 9/9] watchdog: keembay: Typo corrections and other blank operations shruthi.sanil
@ 2021-05-24  6:06 ` Sanil, Shruthi
  2021-05-24 10:36   ` andriy.shevchenko
  9 siblings, 1 reply; 13+ messages in thread
From: Sanil, Shruthi @ 2021-05-24  6:06 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel
  Cc: andriy.shevchenko, kris.pan, mgross, Thokala, Srikanth,
	Raja Subramanian, Lakshmi Bai, Sangannavar, Mallikarjunappa

Hi Roeck,

I have addressed your review comments in the v2 version of this patch series.
Could you please review?

If no comments, can I get an Acked-by tag?
Thanks!

Regards,
Shruthi

> -----Original Message-----
> From: Sanil, Shruthi <shruthi.sanil@intel.com>
> Sent: Monday, May 17, 2021 11:20 PM
> To: wim@linux-watchdog.org; linux@roeck-us.net; linux-
> watchdog@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: andriy.shevchenko@linux.intel.com; kris.pan@linux.intel.com;
> mgross@linux.intel.com; Thokala, Srikanth <srikanth.thokala@intel.com>;
> Raja Subramanian, Lakshmi Bai <lakshmi.bai.raja.subramanian@intel.com>;
> Sangannavar, Mallikarjunappa <mallikarjunappa.sangannavar@intel.com>;
> Sanil, Shruthi <shruthi.sanil@intel.com>
> Subject: [PATCH v2 0/9] Intel Keem Bay WDT bug fixes
> 
> From: Shruthi Sanil <shruthi.sanil@intel.com>
> 
> The series of patches include the below bug fixes in the Intel Keem Bay
> watchdog timer driver:
> 
> Patch 1/9:
> - Update WDT pre-timeout during the initialization
>   The pretimeout register has a default reset value. Hence
>   when a smaller WDT timeout is set which would be lesser than the
>   default pretimeout, the system behaves abnormally, starts
>   triggering the pretimeout interrupt even when the WDT is
>   not enabled, most of the times leading to system crash.
>   Hence an update in the pre-timeout is also required for the
>   default timeout that is being configured.
> 
> Patch 2/9:
> - Upadate WDT pretimeout for every update in timeout
>   The pre-timeout value to be programmed to the register has to be
>   calculated and updated for every change in the timeout value.
>   Else the threshold time wouldn't be calculated to its
>   corresponding timeout.
> 
> Patch 3/9:
> - Update pretimeout to 0 in the TH ISR
>   The pretimeout has to be updated to 0 during the ISR of the
>   ThresHold interrupt. Else the TH interrupt would be triggerred for
>   every tick until the timeout.
> 
> Patch 4/9:
> - Clear either the TO or TH interrupt bit
>   During the interrupt service routine of the TimeOut interrupt and
>   the ThresHold interrupt, the respective interrupt clear bit
>   have to be cleared and not both.
> 
> Patch 5/9:
> - Remove timeout update in the WDT start function
>   Removed set timeout from the start WDT function. There is a function
>   defined to set the timeout. Hence no need to set the timeout again in
>   start function as the timeout would have been already updated
>   before calling the start/enable.
> 
> Patch 6/9:
> - Removed timeout update in the TO ISR
>   In the TO ISR removed updating the Timeout value because
>   its not serving any purpose as the timer would have already expired
>   and the system would be rebooting.
> 
> Patch 7/9:
> - MACRO for WDT enable and disable values
>   Introduced MACRO's for WDT enable and disable values for better
> readability
> 
> Patch 8/9:
> - WDT SMC handler MACRO name update
>   Updated the WDT SMC handler MACRO name to make it clear that its
>   a ARM SMC handler that helps in clearing the WDT interrupt bit.
> 
> Patch 9/9:
> - Typo corrections and other blank operations
>   Corrected typos, aligned the tabs and added new lines
>   wherever required for better readability
> 
> Changes since v1:
> - Dropped a patch with the incorrect fix
>   regarding the WDT suspend/resume function.
> 
> Shruthi Sanil (9):
>   watchdog: keembay: Update WDT pre-timeout during the initialization
>   watchdog: keembay: Upadate WDT pretimeout for every update in timeout
>   watchdog: keembay: Update pretimeout to zero in the TH ISR
>   watchdog: keembay: Clear either the TO or TH interrupt bit
>   watchdog: keembay: Remove timeout update in the WDT start function
>   watchdog: keembay: Removed timeout update in the TO ISR
>   watchdog: keembay: MACRO for WDT enable and disable values
>   watchdog: keembay: WDT SMC handler MACRO name update
>   watchdog: keembay: Typo corrections and other blank operations
> 
>  drivers/watchdog/keembay_wdt.c | 34 ++++++++++++++++++++++------------
>  1 file changed, 22 insertions(+), 12 deletions(-)
> 
> 
> base-commit: 88b06399c9c766c283e070b022b5ceafa4f63f19
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/9] Intel Keem Bay WDT bug fixes
  2021-05-24  6:06 ` [PATCH v2 0/9] Intel Keem Bay WDT bug fixes Sanil, Shruthi
@ 2021-05-24 10:36   ` andriy.shevchenko
  2021-05-24 13:42     ` Guenter Roeck
  0 siblings, 1 reply; 13+ messages in thread
From: andriy.shevchenko @ 2021-05-24 10:36 UTC (permalink / raw)
  To: Sanil, Shruthi
  Cc: wim, linux, linux-watchdog, linux-kernel, kris.pan, mgross,
	Thokala, Srikanth, Raja Subramanian, Lakshmi Bai, Sangannavar,
	Mallikarjunappa

On Mon, May 24, 2021 at 06:06:35AM +0000, Sanil, Shruthi wrote:
> Hi Roeck,
> 
> I have addressed your review comments in the v2 version of this patch series.
> Could you please review?
> 
> If no comments, can I get an Acked-by tag?
> Thanks!

First of all, do not top post!

> > From: Sanil, Shruthi <shruthi.sanil@intel.com>
> > Sent: Monday, May 17, 2021 11:20 PM

AFAICS Guenter had reviewed (as you put his tags into commits). It means that
maintainer will pickup patches when they feel it's a good time.

> > The series of patches include the below bug fixes in the Intel Keem Bay
> > watchdog timer driver:

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/9] Intel Keem Bay WDT bug fixes
  2021-05-24 10:36   ` andriy.shevchenko
@ 2021-05-24 13:42     ` Guenter Roeck
  0 siblings, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2021-05-24 13:42 UTC (permalink / raw)
  To: andriy.shevchenko, Sanil, Shruthi
  Cc: wim, linux-watchdog, linux-kernel, kris.pan, mgross, Thokala,
	Srikanth, Raja Subramanian, Lakshmi Bai, Sangannavar,
	Mallikarjunappa

On 5/24/21 3:36 AM, andriy.shevchenko@linux.intel.com wrote:
> On Mon, May 24, 2021 at 06:06:35AM +0000, Sanil, Shruthi wrote:
>> Hi Roeck,
>>
>> I have addressed your review comments in the v2 version of this patch series.
>> Could you please review?
>>
>> If no comments, can I get an Acked-by tag?
>> Thanks!
> 
> First of all, do not top post!
> 
>>> From: Sanil, Shruthi <shruthi.sanil@intel.com>
>>> Sent: Monday, May 17, 2021 11:20 PM
> 
> AFAICS Guenter had reviewed (as you put his tags into commits). It means that
> maintainer will pickup patches when they feel it's a good time.
> 

Yes, and the patches are queued in my own watchdog-next branch.
At this point we'll have to wait for the Wim to pick up the series.

Guenter

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-05-24 13:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 17:49 [PATCH v2 0/9] Intel Keem Bay WDT bug fixes shruthi.sanil
2021-05-17 17:49 ` [PATCH v2 1/9] watchdog: keembay: Update WDT pre-timeout during the initialization shruthi.sanil
2021-05-17 17:49 ` [PATCH v2 2/9] watchdog: keembay: Upadate WDT pretimeout for every update in timeout shruthi.sanil
2021-05-17 17:49 ` [PATCH v2 3/9] watchdog: keembay: Update pretimeout to zero in the TH ISR shruthi.sanil
2021-05-17 17:49 ` [PATCH v2 4/9] watchdog: keembay: Clear either the TO or TH interrupt bit shruthi.sanil
2021-05-17 17:49 ` [PATCH v2 5/9] watchdog: keembay: Remove timeout update in the WDT start function shruthi.sanil
2021-05-17 17:49 ` [PATCH v2 6/9] watchdog: keembay: Removed timeout update in the TO ISR shruthi.sanil
2021-05-17 17:49 ` [PATCH v2 7/9] watchdog: keembay: MACRO for WDT enable and disable values shruthi.sanil
2021-05-17 17:49 ` [PATCH v2 8/9] watchdog: keembay: WDT SMC handler MACRO name update shruthi.sanil
2021-05-17 17:49 ` [PATCH v2 9/9] watchdog: keembay: Typo corrections and other blank operations shruthi.sanil
2021-05-24  6:06 ` [PATCH v2 0/9] Intel Keem Bay WDT bug fixes Sanil, Shruthi
2021-05-24 10:36   ` andriy.shevchenko
2021-05-24 13:42     ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).