Skip to content

Commit 3a16b05

Browse files
SiFiveHollandKAGA-KOKO
authored andcommitted
irqchip/riscv-imsic: Inline imsic_vector_from_local_id()
This function is only called from one place, which is in the interrupt handling hot path. Inline it to improve code generation and to take advantage of this_cpu operations. lpriv and imsic->base_domain can never be NULL because irq_set_chained_handler() is called after they are allocated. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 79eaabc commit 3a16b05

3 files changed

Lines changed: 3 additions & 20 deletions

File tree

drivers/irqchip/irq-riscv-imsic-early.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ static int __init imsic_ipi_domain_init(void) { return 0; }
9191
*/
9292
static void imsic_handle_irq(struct irq_desc *desc)
9393
{
94+
struct imsic_local_priv *lpriv = this_cpu_ptr(imsic->lpriv);
9495
struct irq_chip *chip = irq_desc_get_chip(desc);
95-
int cpu = smp_processor_id();
96-
struct imsic_vector *vec;
9796
unsigned long local_id;
9897

9998
/*
@@ -113,16 +112,12 @@ static void imsic_handle_irq(struct irq_desc *desc)
113112
continue;
114113
}
115114

116-
if (unlikely(!imsic->base_domain))
117-
continue;
118-
119-
vec = imsic_vector_from_local_id(cpu, local_id);
120-
if (!vec) {
115+
if (unlikely(local_id > imsic->global.nr_ids)) {
121116
pr_warn_ratelimited("vector not found for local ID 0x%lx\n", local_id);
122117
continue;
123118
}
124119

125-
generic_handle_irq(vec->irq);
120+
generic_handle_irq(lpriv->vectors[local_id].irq);
126121
}
127122

128123
chained_irq_exit(chip, desc);

drivers/irqchip/irq-riscv-imsic-state.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -434,16 +434,6 @@ void imsic_vector_debug_show_summary(struct seq_file *m, int ind)
434434
}
435435
#endif
436436

437-
struct imsic_vector *imsic_vector_from_local_id(unsigned int cpu, unsigned int local_id)
438-
{
439-
struct imsic_local_priv *lpriv = per_cpu_ptr(imsic->lpriv, cpu);
440-
441-
if (!lpriv || imsic->global.nr_ids < local_id)
442-
return NULL;
443-
444-
return &lpriv->vectors[local_id];
445-
}
446-
447437
struct imsic_vector *imsic_vector_alloc(unsigned int irq, const struct cpumask *mask)
448438
{
449439
struct imsic_vector *vec = NULL;

drivers/irqchip/irq-riscv-imsic-state.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ static inline struct imsic_vector *imsic_vector_get_move(struct imsic_vector *ve
9595
void imsic_vector_force_move_cleanup(struct imsic_vector *vec);
9696
void imsic_vector_move(struct imsic_vector *old_vec, struct imsic_vector *new_vec);
9797

98-
struct imsic_vector *imsic_vector_from_local_id(unsigned int cpu, unsigned int local_id);
99-
10098
struct imsic_vector *imsic_vector_alloc(unsigned int irq, const struct cpumask *mask);
10199
void imsic_vector_free(struct imsic_vector *vector);
102100

0 commit comments

Comments
 (0)