Skip to contentSkip to conversation

mtd: Add flag to indicate panic_write

PATCH Superseded Kamal Dasu 2 participants 3 messages May 16, 2019

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Kamal Dasu

author
#0 lore raw

PATCH v2 1/2 mtd: Add flag to indicate panic_write

Added a flag to indicate a panic_write so that low level drivers can use it to take required action where applicable, to ensure oops data gets written to assigned mtd device.

---
 drivers/mtd/mtdcore.c                    |  3 ++
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 49 ++++++++++++++++++++++++++++++--
 include/linux/mtd/mtd.h                  |  6 ++++
 3 files changed, 55 insertions(+), 3 deletions(-)
drivers/mtd/mtdcore.c +3 -0
index 76b4264..a83decd 100644
@@ -1138,6 +1138,9 @@ int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
 		return -EROFS;
 	if (!len)
 		return 0;
+	if (!mtd->oops_panic_write)
+		mtd->oops_panic_write = true;
+
 	return mtd->_panic_write(mtd, to, len, retlen, buf);
 }
 EXPORT_SYMBOL_GPL(mtd_panic_write);
drivers/mtd/nand/raw/brcmnand/brcmnand.c +46 -3

73 lines not on this page · raw message

include/linux/mtd/mtd.h +6 -0
index 677768b..791c34d 100644
@@ -330,6 +330,12 @@ struct mtd_info {
 	int (*_get_device) (struct mtd_info *mtd);
 	void (*_put_device) (struct mtd_info *mtd);
 
+	/*
+	 * flag indicates a panic write, low level drivers can take appropriate
+	 * action if required to ensure writes go through
+	 */
+	bool oops_panic_write;
+
 	struct notifier_block reboot_notifier;  /* default mode before reboot */
 
 	/* ECC status information */
Signature · 6 lines
1.9.0.138.g2de3478


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
author
#1 lore raw

PATCH v2 2/2 mtd: nand: raw: brcmnand: When oops in progress use pio and interrupt polling

If mtd_oops is in progress switch to polling for nand command completion interrupts and use PIO mode wihtout DMA so that the mtd_oops buffer can be completely written in the assinged nand partition.

---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 1 -
 1 file changed, 1 deletion(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +0 -1
index a30a7f0..dca8eb8 100644
@@ -835,7 +835,6 @@ static inline void disable_ctrl_irqs(struct brcmnand_controller *ctrl)
 	}
 
 	disable_irq(ctrl->irq);
-
 	ctrl->pio_poll_mode = true;
 }
 
Signature · 1 line
1.9.0.138.g2de3478
maintainer
#2 lore raw

Re: [PATCH v2 2/2] mtd: nand: raw: brcmnand: When oops in progress use pio and interrupt polling

Please ignore v2 patch 1/2 and 2/2. The commit ordering is not right. v3 patch on the way

Kamal

Quoted 25 lines · Kamal Dasu

If mtd_oops is in progress switch to polling for nand command completion interrupts and use PIO mode wihtout DMA so that the mtd_oops buffer can be completely written in the assinged nand partition.

---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 1 -
 1 file changed, 1 deletion(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +0 -2
index a30a7f0..dca8eb8 100644
@@ -835,7 +835,6 @@ static inline void disable_ctrl_irqs(struct brcmnand_controller *ctrl)
        }
 
        disable_irq(ctrl->irq);
-
        ctrl->pio_poll_mode = true;
 }
 
--

1.9.0.138.g2de3478