Skip to content

Commit 0bd5508

Browse files
avpatelKAGA-KOKO
authored andcommitted
irqchip/riscv-imsic: Avoid interrupt translation in interrupt handler
Currently, imsic_handle_irq() uses generic_handle_domain_irq() to handle the interrupt, which internally has an extra step of resolving hwirq using domain. Avoid the translation step by replacing the hardware interrupt number with the Linux interrupt number in the IMSIC vector data and directly call generic_handle_irq(). Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 5161113 commit 0bd5508

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static int __init imsic_ipi_domain_init(void) { return 0; }
7373
static void imsic_handle_irq(struct irq_desc *desc)
7474
{
7575
struct irq_chip *chip = irq_desc_get_chip(desc);
76-
int err, cpu = smp_processor_id();
76+
int cpu = smp_processor_id();
7777
struct imsic_vector *vec;
7878
unsigned long local_id;
7979

@@ -103,9 +103,7 @@ static void imsic_handle_irq(struct irq_desc *desc)
103103
continue;
104104
}
105105

106-
err = generic_handle_domain_irq(imsic->base_domain, vec->hwirq);
107-
if (unlikely(err))
108-
pr_warn_ratelimited("hwirq 0x%x mapping not found\n", vec->hwirq);
106+
generic_handle_irq(vec->irq);
109107
}
110108

111109
chained_irq_exit(chip, desc);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static int imsic_irq_set_affinity(struct irq_data *d, const struct cpumask *mask
111111
return -EBUSY;
112112

113113
/* Get a new vector on the desired set of CPUs */
114-
new_vec = imsic_vector_alloc(old_vec->hwirq, mask_val);
114+
new_vec = imsic_vector_alloc(old_vec->irq, mask_val);
115115
if (!new_vec)
116116
return -ENOSPC;
117117

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ struct imsic_vector *imsic_vector_from_local_id(unsigned int cpu, unsigned int l
422422
return &lpriv->vectors[local_id];
423423
}
424424

425-
struct imsic_vector *imsic_vector_alloc(unsigned int hwirq, const struct cpumask *mask)
425+
struct imsic_vector *imsic_vector_alloc(unsigned int irq, const struct cpumask *mask)
426426
{
427427
struct imsic_vector *vec = NULL;
428428
struct imsic_local_priv *lpriv;
@@ -438,7 +438,7 @@ struct imsic_vector *imsic_vector_alloc(unsigned int hwirq, const struct cpumask
438438

439439
lpriv = per_cpu_ptr(imsic->lpriv, cpu);
440440
vec = &lpriv->vectors[local_id];
441-
vec->hwirq = hwirq;
441+
vec->irq = irq;
442442
vec->enable = false;
443443
vec->move_next = NULL;
444444
vec->move_prev = NULL;
@@ -451,7 +451,7 @@ void imsic_vector_free(struct imsic_vector *vec)
451451
unsigned long flags;
452452

453453
raw_spin_lock_irqsave(&imsic->matrix_lock, flags);
454-
vec->hwirq = UINT_MAX;
454+
vec->irq = 0;
455455
irq_matrix_free(imsic->matrix, vec->cpu, vec->local_id, false);
456456
raw_spin_unlock_irqrestore(&imsic->matrix_lock, flags);
457457
}
@@ -510,7 +510,7 @@ static int __init imsic_local_init(void)
510510
vec = &lpriv->vectors[i];
511511
vec->cpu = cpu;
512512
vec->local_id = i;
513-
vec->hwirq = UINT_MAX;
513+
vec->irq = 0;
514514
}
515515
}
516516

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct imsic_vector {
2020
unsigned int cpu;
2121
unsigned int local_id;
2222
/* Details saved by driver in the vector */
23-
unsigned int hwirq;
23+
unsigned int irq;
2424
/* Details accessed using local lock held */
2525
bool enable;
2626
struct imsic_vector *move_next;
@@ -96,7 +96,7 @@ void imsic_vector_move(struct imsic_vector *old_vec, struct imsic_vector *new_ve
9696

9797
struct imsic_vector *imsic_vector_from_local_id(unsigned int cpu, unsigned int local_id);
9898

99-
struct imsic_vector *imsic_vector_alloc(unsigned int hwirq, const struct cpumask *mask);
99+
struct imsic_vector *imsic_vector_alloc(unsigned int irq, const struct cpumask *mask);
100100
void imsic_vector_free(struct imsic_vector *vector);
101101

102102
void imsic_vector_debug_show(struct seq_file *m, struct imsic_vector *vec, int ind);

0 commit comments

Comments
 (0)