|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 26/26] xen/riscv: manage IRQ_DISABLED flag in APLIC irq enable/disable callbacks
desc->status is only set once during setup_irq(), but interrupts can be
enabled/disabled at runtime, so update it in the corresponding callbacks.
wmb() in aplic_irq_enable() ensures do_IRQ(), which can fire immediately
after the interrupt is enabled, sees the updated desc->status. No rmb() is
needed on the do_IRQ() side because desc->status is read under a spinlock,
which implies an acquire barrier.
No barrier is needed in aplic_irq_disable() because the hardware disables
the interrupt before the status is updated, so do_IRQ() cannot fire, and
spin_unlock() makes the updated value visible.
Fixes: d4676a1398bc5 ("xen/riscv: implementation of aplic and imsic operations")
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
Changes in v2:
- New patch.
---
xen/arch/riscv/aplic.c | 5 +++++
xen/arch/riscv/irq.c | 3 ---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/xen/arch/riscv/aplic.c b/xen/arch/riscv/aplic.c
index 1976733dfbaa..7933a00772a8 100644
--- a/xen/arch/riscv/aplic.c
+++ b/xen/arch/riscv/aplic.c
@@ -161,6 +161,9 @@ static void cf_check aplic_irq_enable(struct irq_desc *desc)
spin_lock(&aplic.lock);
+ desc->status &= ~IRQ_DISABLED;
+ wmb();
+
/* Enable interrupt in IMSIC */
imsic_irq_enable(desc->irq);
@@ -189,6 +192,8 @@ static void cf_check aplic_irq_disable(struct irq_desc
*desc)
/* Disable interrupt in IMSIC */
imsic_irq_disable(desc->irq);
+ desc->status |= IRQ_DISABLED;
+
spin_unlock(&aplic.lock);
}
diff --git a/xen/arch/riscv/irq.c b/xen/arch/riscv/irq.c
index 4481ae23aa8e..f9c10a7c9faf 100644
--- a/xen/arch/riscv/irq.c
+++ b/xen/arch/riscv/irq.c
@@ -145,9 +145,6 @@ int setup_irq(unsigned int irq, unsigned int irqflags,
struct irqaction *new)
desc->handler->set_affinity(desc, cpumask_of(smp_processor_id()));
desc->handler->startup(desc);
-
- /* Enable irq */
- desc->status &= ~IRQ_DISABLED;
}
err:
--
2.54.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |