mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
irqchip/riscv-imsic: Implement irq_force_complete_move() for IMSIC
Implement irq_force_complete_move() for IMSIC driver so that in-flight vector movements on a CPU can be cleaned-up when the CPU goes down. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20250217085657.789309-9-apatel@ventanamicro.com
This commit is contained in:
parent
0f67911e82
commit
51611130d5
|
|
@ -129,6 +129,37 @@ static int imsic_irq_set_affinity(struct irq_data *d, const struct cpumask *mask
|
|||
|
||||
return IRQ_SET_MASK_OK_DONE;
|
||||
}
|
||||
|
||||
static void imsic_irq_force_complete_move(struct irq_data *d)
|
||||
{
|
||||
struct imsic_vector *mvec, *vec = irq_data_get_irq_chip_data(d);
|
||||
unsigned int cpu = smp_processor_id();
|
||||
|
||||
if (WARN_ON(!vec))
|
||||
return;
|
||||
|
||||
/* Do nothing if there is no in-flight move */
|
||||
mvec = imsic_vector_get_move(vec);
|
||||
if (!mvec)
|
||||
return;
|
||||
|
||||
/* Do nothing if the old IMSIC vector does not belong to current CPU */
|
||||
if (mvec->cpu != cpu)
|
||||
return;
|
||||
|
||||
/*
|
||||
* The best we can do is force cleanup the old IMSIC vector.
|
||||
*
|
||||
* The challenges over here are same as x86 vector domain so
|
||||
* refer to the comments in irq_force_complete_move() function
|
||||
* implemented at arch/x86/kernel/apic/vector.c.
|
||||
*/
|
||||
|
||||
/* Force cleanup in-flight move */
|
||||
pr_info("IRQ fixup: irq %d move in progress, old vector cpu %d local_id %d\n",
|
||||
d->irq, mvec->cpu, mvec->local_id);
|
||||
imsic_vector_force_move_cleanup(vec);
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct irq_chip imsic_irq_base_chip = {
|
||||
|
|
@ -137,6 +168,7 @@ static struct irq_chip imsic_irq_base_chip = {
|
|||
.irq_unmask = imsic_irq_unmask,
|
||||
#ifdef CONFIG_SMP
|
||||
.irq_set_affinity = imsic_irq_set_affinity,
|
||||
.irq_force_complete_move = imsic_irq_force_complete_move,
|
||||
#endif
|
||||
.irq_retrigger = imsic_irq_retrigger,
|
||||
.irq_compose_msi_msg = imsic_irq_compose_msg,
|
||||
|
|
|
|||
|
|
@ -311,6 +311,23 @@ void imsic_vector_unmask(struct imsic_vector *vec)
|
|||
raw_spin_unlock(&lpriv->lock);
|
||||
}
|
||||
|
||||
void imsic_vector_force_move_cleanup(struct imsic_vector *vec)
|
||||
{
|
||||
struct imsic_local_priv *lpriv;
|
||||
struct imsic_vector *mvec;
|
||||
unsigned long flags;
|
||||
|
||||
lpriv = per_cpu_ptr(imsic->lpriv, vec->cpu);
|
||||
raw_spin_lock_irqsave(&lpriv->lock, flags);
|
||||
|
||||
mvec = READ_ONCE(vec->move_prev);
|
||||
WRITE_ONCE(vec->move_prev, NULL);
|
||||
if (mvec)
|
||||
imsic_vector_free(mvec);
|
||||
|
||||
raw_spin_unlock_irqrestore(&lpriv->lock, flags);
|
||||
}
|
||||
|
||||
static bool imsic_vector_move_update(struct imsic_local_priv *lpriv,
|
||||
struct imsic_vector *vec, bool is_old_vec,
|
||||
bool new_enable, struct imsic_vector *move_vec)
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ static inline struct imsic_vector *imsic_vector_get_move(struct imsic_vector *ve
|
|||
return READ_ONCE(vec->move_prev);
|
||||
}
|
||||
|
||||
void imsic_vector_force_move_cleanup(struct imsic_vector *vec);
|
||||
void imsic_vector_move(struct imsic_vector *old_vec, struct imsic_vector *new_vec);
|
||||
|
||||
struct imsic_vector *imsic_vector_from_local_id(unsigned int cpu, unsigned int local_id);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user