[PATCH v1 3/9] Revert "irqchip/sifive-plic: Improve locking safety by using irqsave/irqrestore"

Emil Renner Berthing emil.renner.berthing at canonical.com
Wed Aug 14 07:56:35 PDT 2024


This reverts commit abb7205794900503d6358ef1fb645373753a794d.

This is a prerequisite to reverting the patch converting the PLIC into a
platform driver. Unfortunately this breaks booting the Allwinner D1 SoC.

Fixes: 8ec99b033147 ("irqchip/sifive-plic: Convert PLIC driver into a platform driver")
Signed-off-by: Emil Renner Berthing <emil.renner.berthing at canonical.com>
---
 drivers/irqchip/irq-sifive-plic.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index f3d4cb9e34f7..cbccd1da3ea1 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -103,11 +103,9 @@ static void __plic_toggle(void __iomem *enable_base, int hwirq, int enable)
 
 static void plic_toggle(struct plic_handler *handler, int hwirq, int enable)
 {
-	unsigned long flags;
-
-	raw_spin_lock_irqsave(&handler->enable_lock, flags);
+	raw_spin_lock(&handler->enable_lock);
 	__plic_toggle(handler->enable_base, hwirq, enable);
-	raw_spin_unlock_irqrestore(&handler->enable_lock, flags);
+	raw_spin_unlock(&handler->enable_lock);
 }
 
 static inline void plic_irq_toggle(const struct cpumask *mask,
@@ -244,7 +242,6 @@ static int plic_irq_set_type(struct irq_data *d, unsigned int type)
 static int plic_irq_suspend(void)
 {
 	unsigned int i, cpu;
-	unsigned long flags;
 	u32 __iomem *reg;
 	struct plic_priv *priv;
 
@@ -262,12 +259,12 @@ static int plic_irq_suspend(void)
 		if (!handler->present)
 			continue;
 
-		raw_spin_lock_irqsave(&handler->enable_lock, flags);
+		raw_spin_lock(&handler->enable_lock);
 		for (i = 0; i < DIV_ROUND_UP(priv->nr_irqs, 32); i++) {
 			reg = handler->enable_base + i * sizeof(u32);
 			handler->enable_save[i] = readl(reg);
 		}
-		raw_spin_unlock_irqrestore(&handler->enable_lock, flags);
+		raw_spin_unlock(&handler->enable_lock);
 	}
 
 	return 0;
@@ -276,7 +273,6 @@ static int plic_irq_suspend(void)
 static void plic_irq_resume(void)
 {
 	unsigned int i, index, cpu;
-	unsigned long flags;
 	u32 __iomem *reg;
 	struct plic_priv *priv;
 
@@ -294,12 +290,12 @@ static void plic_irq_resume(void)
 		if (!handler->present)
 			continue;
 
-		raw_spin_lock_irqsave(&handler->enable_lock, flags);
+		raw_spin_lock(&handler->enable_lock);
 		for (i = 0; i < DIV_ROUND_UP(priv->nr_irqs, 32); i++) {
 			reg = handler->enable_base + i * sizeof(u32);
 			writel(handler->enable_save[i], reg);
 		}
-		raw_spin_unlock_irqrestore(&handler->enable_lock, flags);
+		raw_spin_unlock(&handler->enable_lock);
 	}
 }
 
-- 
2.43.0




More information about the linux-riscv mailing list