Skip to content

Commit 999f458

Browse files
jones-drewKAGA-KOKO
authored andcommitted
irqchip/riscv-imsic: Set irq_set_affinity() for IMSIC base
The IMSIC driver assigns the IMSIC domain specific imsic_irq_set_affinity() callback to the per device leaf MSI domain. That's a layering violation as it is called with the leaf domain data and not with the IMSIC domain data. This prevents moving the IMSIC driver to the common MSI library which uses the generic msi_domain_set_affinity() callback for device MSI domains. Instead of using imsic_irq_set_affinity() for leaf MSI domains, use imsic_irq_set_affinity() for the non-leaf IMSIC base domain and use irq_chip_set_affinity_parent() for leaf MSI domains. [ tglx: Massaged change log ] Signed-off-by: Andrew Jones <[email protected]> Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 0699e57 commit 999f458

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,8 @@ static int imsic_irq_set_affinity(struct irq_data *d, const struct cpumask *mask
9696
bool force)
9797
{
9898
struct imsic_vector *old_vec, *new_vec;
99-
struct irq_data *pd = d->parent_data;
10099

101-
old_vec = irq_data_get_irq_chip_data(pd);
100+
old_vec = irq_data_get_irq_chip_data(d);
102101
if (WARN_ON(!old_vec))
103102
return -ENOENT;
104103

@@ -116,13 +115,13 @@ static int imsic_irq_set_affinity(struct irq_data *d, const struct cpumask *mask
116115
return -ENOSPC;
117116

118117
/* Point device to the new vector */
119-
imsic_msi_update_msg(d, new_vec);
118+
imsic_msi_update_msg(irq_get_irq_data(d->irq), new_vec);
120119

121120
/* Update irq descriptors with the new vector */
122-
pd->chip_data = new_vec;
121+
d->chip_data = new_vec;
123122

124-
/* Update effective affinity of parent irq data */
125-
irq_data_update_effective_affinity(pd, cpumask_of(new_vec->cpu));
123+
/* Update effective affinity */
124+
irq_data_update_effective_affinity(d, cpumask_of(new_vec->cpu));
126125

127126
/* Move state of the old vector to the new vector */
128127
imsic_vector_move(old_vec, new_vec);
@@ -135,6 +134,9 @@ static struct irq_chip imsic_irq_base_chip = {
135134
.name = "IMSIC",
136135
.irq_mask = imsic_irq_mask,
137136
.irq_unmask = imsic_irq_unmask,
137+
#ifdef CONFIG_SMP
138+
.irq_set_affinity = imsic_irq_set_affinity,
139+
#endif
138140
.irq_retrigger = imsic_irq_retrigger,
139141
.irq_compose_msi_msg = imsic_irq_compose_msg,
140142
.flags = IRQCHIP_SKIP_SET_WAKE |
@@ -245,7 +247,7 @@ static bool imsic_init_dev_msi_info(struct device *dev,
245247
if (WARN_ON_ONCE(domain != real_parent))
246248
return false;
247249
#ifdef CONFIG_SMP
248-
info->chip->irq_set_affinity = imsic_irq_set_affinity;
250+
info->chip->irq_set_affinity = irq_chip_set_affinity_parent;
249251
#endif
250252
break;
251253
default:

0 commit comments

Comments
 (0)