]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
irqchip/riscv-imsic: Inline imsic_vector_from_local_id()
authorSamuel Holland <samuel.holland@sifive.com>
Wed, 15 Oct 2025 19:55:14 +0000 (12:55 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 16 Oct 2025 16:17:28 +0000 (18:17 +0200)
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>
drivers/irqchip/irq-riscv-imsic-early.c
drivers/irqchip/irq-riscv-imsic-state.c
drivers/irqchip/irq-riscv-imsic-state.h

index 2c4c682627b8cc81ad51a98a1f341aa506d649ac..6bac67cc0b6d992046853acd17b256c9cf46b959 100644 (file)
@@ -91,9 +91,8 @@ static int __init imsic_ipi_domain_init(void) { return 0; }
  */
 static void imsic_handle_irq(struct irq_desc *desc)
 {
+       struct imsic_local_priv *lpriv = this_cpu_ptr(imsic->lpriv);
        struct irq_chip *chip = irq_desc_get_chip(desc);
-       int cpu = smp_processor_id();
-       struct imsic_vector *vec;
        unsigned long local_id;
 
        /*
@@ -113,16 +112,12 @@ static void imsic_handle_irq(struct irq_desc *desc)
                        continue;
                }
 
-               if (unlikely(!imsic->base_domain))
-                       continue;
-
-               vec = imsic_vector_from_local_id(cpu, local_id);
-               if (!vec) {
+               if (unlikely(local_id > imsic->global.nr_ids)) {
                        pr_warn_ratelimited("vector not found for local ID 0x%lx\n", local_id);
                        continue;
                }
 
-               generic_handle_irq(vec->irq);
+               generic_handle_irq(lpriv->vectors[local_id].irq);
        }
 
        chained_irq_exit(chip, desc);
index 9a499efdebe3639f1ed8d8bbcf10cf312b326374..385368052d5c0f45d42b7ee85f6196d1d4fadc56 100644 (file)
@@ -434,16 +434,6 @@ void imsic_vector_debug_show_summary(struct seq_file *m, int ind)
 }
 #endif
 
-struct imsic_vector *imsic_vector_from_local_id(unsigned int cpu, unsigned int local_id)
-{
-       struct imsic_local_priv *lpriv = per_cpu_ptr(imsic->lpriv, cpu);
-
-       if (!lpriv || imsic->global.nr_ids < local_id)
-               return NULL;
-
-       return &lpriv->vectors[local_id];
-}
-
 struct imsic_vector *imsic_vector_alloc(unsigned int irq, const struct cpumask *mask)
 {
        struct imsic_vector *vec = NULL;
index 196457f1bbca62ce0b54eb0e4eaced255a77d869..6332501dcbd8ef5d61587cafe7ae37cbe05ebeec 100644 (file)
@@ -95,8 +95,6 @@ static inline struct imsic_vector *imsic_vector_get_move(struct imsic_vector *ve
 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);
-
 struct imsic_vector *imsic_vector_alloc(unsigned int irq, const struct cpumask *mask);
 void imsic_vector_free(struct imsic_vector *vector);