watchdog: qcom: Remove incorrect usage of QCOM_WDT_ENABLE_IRQ
Subsystems (3)
PATCH 1/1 watchdog: qcom: Remove incorrect usage of QCOM_WDT_ENABLE_IRQ
As per register documentation, QCOM_WDT_ENABLE_IRQ which is BIT(1) of watchdog control register is wakeup interrupt enable bit and not related to bark interrupt at all, BIT(0) is used for that. So remove incorrect usage of this bit when supporting bark irq for pre-timeout notification. Currently with this bit set and bark interrupt specified, pre-timeout notification and/or watchdog reset/bite does not occur.
---
Reading the conversations from when qcom pre-timeout support was added [1], Bjorn already had mentioned it was not right to touch this bit, not sure which SoC the pre-timeout was tested on at that time, but I have tested this on SDM845, SM8150, SC7180 and watchdog bark and bite does not occur with enabling this bit with the bark irq specified in DT.
[1] https://lore.kernel.org/linux-watchdog/20190906174009.GC11938@tuxbook-pro/
--- drivers/watchdog/qcom-wdt.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/watchdog/qcom-wdt.c +1 -12
@@ -22,7 +22,6 @@ enum wdt_reg { };#define QCOM_WDT_ENABLE BIT(0) -#define QCOM_WDT_ENABLE_IRQ BIT(1)static const u32 reg_offset_data_apcs_tmr[] = { [WDT_RST ] =0x38 ,
@@ -63,16 +62,6 @@ struct qcom_wdt *to_qcom_wdt(struct watchdog_device *wdd) return container_of(wdd, struct qcom_wdt, wdd); } -static inline int qcom_get_enable (struct watchdog_device *wdd) -{ -int enable =QCOM_WDT_ENABLE ; - -if (wdd->pretimeout) - enable |=QCOM_WDT_ENABLE_IRQ ; - -return enable; -} -static irqreturn_t qcom_wdt_isr (int irq,void *arg) {struct watchdog_device *wdd = arg;
@@ -91,7 +80,7 @@ static int qcom_wdt_start(struct watchdog_device *wdd)writel (1 ,wdt_addr (wdt,WDT_RST ));writel (bark * wdt->rate,wdt_addr (wdt,WDT_BARK_TIME ));writel (wdd->timeout * wdt->rate,wdt_addr (wdt,WDT_BITE_TIME )); -writel (qcom_get_enable (wdd),wdt_addr (wdt,WDT_EN )); +writel (QCOM_WDT_ENABLE ,wdt_addr (wdt,WDT_EN ));return 0 ; }
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoted 11 lines · Sai Prakash Ranjan
As per register documentation,
QCOM_WDT_ENABLE_IRQwhich is BIT(1) of watchdog control register is wakeup interrupt enable bit and not related to bark interrupt at all, BIT(0) is used for that. So remove incorrect usage of this bit when supporting bark irq for pre-timeout notification. Currently with this bit set and bark interrupt specified, pre-timeout notification and/or watchdog reset/bite does not occur.Fixes 36375491a439 ("watchdog: qcom: support pre-timeout when the bark irq is available")Signed-off-by Sai Prakash Ranjan <[email protected]>
Assuming that pretimeout _does_ work with this patch applied,
Quoted 54 lines
---
Reading the conversations from when qcom pre-timeout support was added [1], Bjorn already had mentioned it was not right to touch this bit, not sure which SoC the pre-timeout was tested on at that time, but I have tested this on SDM845, SM8150, SC7180 and watchdog bark and bite does not occur with enabling this bit with the bark irq specified in DT.
[1] https://lore.kernel.org/linux-watchdog/20190906174009.GC11938@tuxbook-pro/
--- drivers/watchdog/qcom-wdt.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)drivers/watchdog/qcom-wdt.c +1
-12@@ -22,7 +22,6 @@ enum wdt_reg { };#define QCOM_WDT_ENABLE BIT(0) -#define QCOM_WDT_ENABLE_IRQ BIT(1)static const u32 reg_offset_data_apcs_tmr[] = { [WDT_RST ] =0x38 ,@@ -63,16 +62,6 @@ struct qcom_wdt *to_qcom_wdt(struct watchdog_device *wdd) return container_of(wdd, struct qcom_wdt, wdd); } -static inline int qcom_get_enable (struct watchdog_device *wdd) -{ -int enable =QCOM_WDT_ENABLE ; - -if (wdd->pretimeout) - enable |=QCOM_WDT_ENABLE_IRQ ; - -return enable; -} -static irqreturn_t qcom_wdt_isr (int irq,void *arg) {struct watchdog_device *wdd = arg;@@ -91,7 +80,7 @@ static int qcom_wdt_start(struct watchdog_device *wdd)writel (1 ,wdt_addr (wdt,WDT_RST ));writel (bark * wdt->rate,wdt_addr (wdt,WDT_BARK_TIME ));writel (wdd->timeout * wdt->rate,wdt_addr (wdt,WDT_BITE_TIME )); -writel (qcom_get_enable (wdd),wdt_addr (wdt,WDT_EN )); +writel (QCOM_WDT_ENABLE ,wdt_addr (wdt,WDT_EN ));return 0 ; }
Quoted 9 lines · Guenter Roeck
Quoted 8 lines · Sai Prakash Ranjan
As per register documentation,
QCOM_WDT_ENABLE_IRQwhich is BIT(1) of watchdog control register is wakeup interrupt enable bit and not related to bark interrupt at all, BIT(0) is used for that. So remove incorrect usage of this bit when supporting bark irq for pre-timeout notification. Currently with this bit set and bark interrupt specified, pre-timeout notification and/or watchdog reset/bite does not occur.
Quoted 8 lines
Quoted 3 lines
Fixes 36375491a439 ("watchdog: qcom: support pre-timeout when the bark irq is available")Signed-off-by Sai Prakash Ranjan <[email protected]>Assuming that pretimeout _does_ work with this patch applied,
Reviewed-by Guenter Roeck <[email protected]>
Thanks Guenter. Yes I have patchset ready and tested [1] on 4 different SoCs on which pretimeout works with this patch and without this, watchdog functionality would be broken on all those platforms and possibly more(the ones I couldn't get access to) if we add bark irq to the watchdog DT node.
[1] https://lore.kernel.org/patchwork/cover/1371270/
Thanks,
Sai
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoting Sai Prakash Ranjan (2021-01-26 07:02:41)
Quoted 7 lines
As per register documentation,
QCOM_WDT_ENABLE_IRQwhich is BIT(1) of watchdog control register is wakeup interrupt enable bit and not related to bark interrupt at all, BIT(0) is used for that. So remove incorrect usage of this bit when supporting bark irq for pre-timeout notification. Currently with this bit set and bark interrupt specified, pre-timeout notification and/or watchdog reset/bite does not occur.
It looks like the QCOM_WDT_ENABLE_IRQ bit is to catch a problem where a pending irq is unmasked but the watchdog irq isn't handled in time? So some sort of irq storm?
Quoted 5 lines
Fixes 36375491a439 ("watchdog: qcom: support pre-timeout when the bark irq is available")Signed-off-by Sai Prakash Ranjan <[email protected]>---
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 9 lines · Stephen Boyd
Quoting Sai Prakash Ranjan (2021-01-26 07:02:41)
Quoted 7 lines
As per register documentation,
QCOM_WDT_ENABLE_IRQwhich is BIT(1) of watchdog control register is wakeup interrupt enable bit and not related to bark interrupt at all, BIT(0) is used for that. So remove incorrect usage of this bit when supporting bark irq for pre-timeout notification. Currently with this bit set and bark interrupt specified, pre-timeout notification and/or watchdog reset/bite does not occur.
Quoted 4 lines
It looks like the
QCOM_WDT_ENABLE_IRQbit is to catch a problem where a pending irq is unmasked but the watchdog irq isn't handled in time? So some sort of irq storm?
In sleep mode, this bit is used to enable unmasked irq to wakeup watchdog timer. The watchdog counter can be brought out of reset either by writing 1 to WDOG_RESET or setting this BIT(1) to 1.
Quoted 8 lines
Quoted 5 lines
Fixes 36375491a439 ("watchdog: qcom: support pre-timeout when the bark irq is available")Signed-off-by Sai Prakash Ranjan <[email protected]>---
Reviewed-by Stephen Boyd <[email protected]>
Thanks,
Sai
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoted 11 lines · Sai Prakash Ranjan
As per register documentation,
QCOM_WDT_ENABLE_IRQwhich is BIT(1) of watchdog control register is wakeup interrupt enable bit and not related to bark interrupt at all, BIT(0) is used for that. So remove incorrect usage of this bit when supporting bark irq for pre-timeout notification. Currently with this bit set and bark interrupt specified, pre-timeout notification and/or watchdog reset/bite does not occur.Fixes 36375491a439 ("watchdog: qcom: support pre-timeout when the bark irq is available")Signed-off-by Sai Prakash Ranjan <[email protected]>
Quoted 8 lines
---
Reading the conversations from when qcom pre-timeout support was added [1], Bjorn already had mentioned it was not right to touch this bit, not sure which SoC the pre-timeout was tested on at that time, but I have tested this on SDM845, SM8150, SC7180 and watchdog bark and bite does not occur with enabling this bit with the bark irq specified in DT.
this was tested on QCS404. have you validated there? unfortunately I no longer have access to that hardware or the documentation
Quoted 49 lines
[1] https://lore.kernel.org/linux-watchdog/20190906174009.GC11938@tuxbook-pro/
--- drivers/watchdog/qcom-wdt.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)drivers/watchdog/qcom-wdt.c +1
-12@@ -22,7 +22,6 @@ enum wdt_reg { };#define QCOM_WDT_ENABLE BIT(0) -#define QCOM_WDT_ENABLE_IRQ BIT(1)static const u32 reg_offset_data_apcs_tmr[] = { [WDT_RST ] =0x38 ,@@ -63,16 +62,6 @@ struct qcom_wdt *to_qcom_wdt(struct watchdog_device *wdd) return container_of(wdd, struct qcom_wdt, wdd); } -static inline int qcom_get_enable (struct watchdog_device *wdd) -{ -int enable =QCOM_WDT_ENABLE ; - -if (wdd->pretimeout) - enable |=QCOM_WDT_ENABLE_IRQ ; - -return enable; -} -static irqreturn_t qcom_wdt_isr (int irq,void *arg) {struct watchdog_device *wdd = arg;@@ -91,7 +80,7 @@ static int qcom_wdt_start(struct watchdog_device *wdd)writel (1 ,wdt_addr (wdt,WDT_RST ));writel (bark * wdt->rate,wdt_addr (wdt,WDT_BARK_TIME ));writel (wdd->timeout * wdt->rate,wdt_addr (wdt,WDT_BITE_TIME )); -writel (qcom_get_enable (wdd),wdt_addr (wdt,WDT_EN )); +writel (QCOM_WDT_ENABLE ,wdt_addr (wdt,WDT_EN ));return 0 ; }Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 21 lines · Foundries
Quoted 11 lines · Sai Prakash Ranjan
As per register documentation,
QCOM_WDT_ENABLE_IRQwhich is BIT(1) of watchdog control register is wakeup interrupt enable bit and not related to bark interrupt at all, BIT(0) is used for that. So remove incorrect usage of this bit when supporting bark irq for pre-timeout notification. Currently with this bit set and bark interrupt specified, pre-timeout notification and/or watchdog reset/bite does not occur.Fixes 36375491a439 ("watchdog: qcom: support pre-timeout when the bark irq is available")Signed-off-by Sai Prakash Ranjan <[email protected]>Quoted 8 lines
---
Reading the conversations from when qcom pre-timeout support was added [1], Bjorn already had mentioned it was not right to touch this bit, not sure which SoC the pre-timeout was tested on at that time, but I have tested this on SDM845, SM8150, SC7180 and watchdog bark and bite does not occur with enabling this bit with the bark irq specified in DT.
Quoted 3 lines
this was tested on QCS404. have you validated there? unfortunately I no longer have access to that hardware or the documentation
I didn't validate on qcs404 yet since I didn't have access to it. But now that you mention it, let me arrange for a setup and test it there as well. Note: I did not see bark irq entry in upstream qcs404 dtsi, so you must have had some local change when you tested?
Thanks,
Sai
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoted 23 lines · Sai Prakash Ranjan
Quoted 22 lines · Foundries
Quoted 20 lines · Sai Prakash Ranjan
As per register documentation,
QCOM_WDT_ENABLE_IRQwhich is BIT(1) of watchdog control register is wakeup interrupt enable bit and not related to bark interrupt at all, BIT(0) is used for that. So remove incorrect usage of this bit when supporting bark irq for pre-timeout notification. Currently with this bit set and bark interrupt specified, pre-timeout notification and/or watchdog reset/bite does not occur.Fixes 36375491a439 ("watchdog: qcom: support pre-timeout when thebark irq is available")
Signed-off-by Sai Prakash Ranjan <[email protected]>---
Reading the conversations from when qcom pre-timeout support was added [1], Bjorn already had mentioned it was not right to touch this bit, not sure which SoC the pre-timeout was tested on at that time, but I have tested this on SDM845, SM8150, SC7180 and watchdog bark and bite does not occur with enabling this bit with the bark irq specified in DT.
Quoted 8 lines
Quoted 3 lines
this was tested on QCS404. have you validated there? unfortunately I no longer have access to that hardware or the documentation
I didn't validate on qcs404 yet since I didn't have access to it. But now that you mention it, let me arrange for a setup and test it there as well. Note: I did not see bark irq entry in upstream qcs404 dtsi, so you must have had some local change when you tested?
TBH I dont quite remember. I suppose that if those with access to the documents and hardware are OK with this change then it shouldnt cause regressions (I just cant check from my end)
Quoted 7 lines
Thanks,
SaiSignature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
This patch was applied to qcom/linux.git (refs/heads/for-next):
Hello:
This patch was applied to qcom/linux.git (refs/heads/for-next):
Quoted 9 lines · On Tue, 26 Jan 2021 20:32:41 +0530 you wrote:
As per register documentation,
QCOM_WDT_ENABLE_IRQwhich is BIT(1) of watchdog control register is wakeup interrupt enable bit and not related to bark interrupt at all, BIT(0) is used for that. So remove incorrect usage of this bit when supporting bark irq for pre-timeout notification. Currently with this bit set and bark interrupt specified, pre-timeout notification and/or watchdog reset/bite does not occur.[...]
Here is the summary with links:
- watchdog: qcom: Remove incorrect usage of QCOM_WDT_ENABLE_IRQ
https://git.kernel.org/qcom/c/a4f3407c4160
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html