Patch "iTCO_wdt: mask NMI_NOW bit for update_no_reboot_bit() call" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    iTCO_wdt: mask NMI_NOW bit for update_no_reboot_bit() call

to the 6.6-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:
     itco_wdt-mask-nmi_now-bit-for-update_no_reboot_bit-c.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 603e805f2b7d442fbe463e84b3683a9765d87cd1
Author: Oleksandr Ocheretnyi <oocheret@xxxxxxxxx>
Date:   Fri Sep 13 12:14:03 2024 -0700

    iTCO_wdt: mask NMI_NOW bit for update_no_reboot_bit() call
    
    [ Upstream commit daa814d784ac034c62ab3fb0ef83daeafef527e2 ]
    
    Commit da23b6faa8bf ("watchdog: iTCO: Add support for Cannon Lake
    PCH iTCO") does not mask NMI_NOW bit during TCO1_CNT register's
    value comparison for update_no_reboot_bit() call causing following
    failure:
    
       ...
       iTCO_vendor_support: vendor-support=0
       iTCO_wdt iTCO_wdt: unable to reset NO_REBOOT flag, device
                                        disabled by hardware/BIOS
       ...
    
    and this can lead to unexpected NMIs later during regular
    crashkernel's workflow because of watchdog probe call failures.
    
    This change masks NMI_NOW bit for TCO1_CNT register values to
    avoid unexpected NMI_NOW bit inversions.
    
    Fixes: da23b6faa8bf ("watchdog: iTCO: Add support for Cannon Lake PCH iTCO")
    Signed-off-by: Oleksandr Ocheretnyi <oocheret@xxxxxxxxx>
    Reviewed-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Reviewed-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240913191403.2560805-1-oocheret@xxxxxxxxx
    Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Signed-off-by: Wim Van Sebroeck <wim@xxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index 264857d314da8..dd297dcd524c9 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -82,6 +82,13 @@
 #define TCO2_CNT(p)	(TCOBASE(p) + 0x0a) /* TCO2 Control Register	*/
 #define TCOv2_TMR(p)	(TCOBASE(p) + 0x12) /* TCOv2 Timer Initial Value*/
 
+/*
+ * NMI_NOW is bit 8 of TCO1_CNT register
+ * Read/Write
+ * This bit is implemented as RW but has no effect on HW.
+ */
+#define NMI_NOW		BIT(8)
+
 /* internal variables */
 struct iTCO_wdt_private {
 	struct watchdog_device wddev;
@@ -219,13 +226,23 @@ static int update_no_reboot_bit_cnt(void *priv, bool set)
 	struct iTCO_wdt_private *p = priv;
 	u16 val, newval;
 
-	val = inw(TCO1_CNT(p));
+	/*
+	 * writing back 1b1 to NMI_NOW of TCO1_CNT register
+	 * causes NMI_NOW bit inversion what consequently does
+	 * not allow to perform the register's value comparison
+	 * properly.
+	 *
+	 * NMI_NOW bit masking for TCO1_CNT register values
+	 * helps to avoid possible NMI_NOW bit inversions on
+	 * following write operation.
+	 */
+	val = inw(TCO1_CNT(p)) & ~NMI_NOW;
 	if (set)
 		val |= BIT(0);
 	else
 		val &= ~BIT(0);
 	outw(val, TCO1_CNT(p));
-	newval = inw(TCO1_CNT(p));
+	newval = inw(TCO1_CNT(p)) & ~NMI_NOW;
 
 	/* make sure the update is successful */
 	return val != newval ? -EIO : 0;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux