Skip to content

Commit 92fdb52

Browse files
kolerovvineetgarc
authored andcommitted
ARCv2: MCIP: Deprecate setting of affinity in Device Tree
Ignore value of interrupt distribution mode for common interrupts in IDU since setting of affinity using value from Device Tree is deprecated in ARC. Originally it is done in idu_irq_xlate() function and it is semantically wrong and does not guaranty that an affinity value will be set properly. idu_irq_enable() function is better place for initialization of common interrupts. By default send all common interrupts to all available online CPUs. The affinity of common interrupts in IDU must be set manually since in some cases the kernel will not call irq_set_affinity() by itself: 1. When the kernel is not configured with support of SMP. 2. When the kernel is configured with support of SMP but upper interrupt controllers does not support setting of the affinity and cannot propagate it to IDU. Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent 7a308bb commit 92fdb52

2 files changed

Lines changed: 25 additions & 30 deletions

File tree

‎Documentation/devicetree/bindings/interrupt-controller/snps,archs-idu-intc.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Properties:
1515
Second cell specifies the irq distribution mode to cores
1616
0=Round Robin; 1=cpu0, 2=cpu1, 4=cpu2, 8=cpu3
1717

18+
The second cell in interrupts property is deprecated and may be ignored by
19+
the kernel.
20+
1821
intc accessed via the special ARC AUX register interface, hence "reg" property
1922
is not specified.
2023

‎arch/arc/kernel/mcip.c‎

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ static void idu_irq_unmask(struct irq_data *data)
175175
raw_spin_unlock_irqrestore(&mcip_lock, flags);
176176
}
177177

178-
#ifdef CONFIG_SMP
179178
static int
180179
idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask,
181180
bool force)
@@ -205,12 +204,27 @@ idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask,
205204

206205
return IRQ_SET_MASK_OK;
207206
}
208-
#endif
207+
208+
static void idu_irq_enable(struct irq_data *data)
209+
{
210+
/*
211+
* By default send all common interrupts to all available online CPUs.
212+
* The affinity of common interrupts in IDU must be set manually since
213+
* in some cases the kernel will not call irq_set_affinity() by itself:
214+
* 1. When the kernel is not configured with support of SMP.
215+
* 2. When the kernel is configured with support of SMP but upper
216+
* interrupt controllers does not support setting of the affinity
217+
* and cannot propagate it to IDU.
218+
*/
219+
idu_irq_set_affinity(data, cpu_online_mask, false);
220+
idu_irq_unmask(data);
221+
}
209222

210223
static struct irq_chip idu_irq_chip = {
211224
.name = "MCIP IDU Intc",
212225
.irq_mask = idu_irq_mask,
213226
.irq_unmask = idu_irq_unmask,
227+
.irq_enable = idu_irq_enable,
214228
#ifdef CONFIG_SMP
215229
.irq_set_affinity = idu_irq_set_affinity,
216230
#endif
@@ -243,36 +257,14 @@ static int idu_irq_xlate(struct irq_domain *d, struct device_node *n,
243257
const u32 *intspec, unsigned int intsize,
244258
irq_hw_number_t *out_hwirq, unsigned int *out_type)
245259
{
246-
irq_hw_number_t hwirq = *out_hwirq = intspec[0];
247-
int distri = intspec[1];
248-
unsigned long flags;
249-
260+
/*
261+
* Ignore value of interrupt distribution mode for common interrupts in
262+
* IDU which resides in intspec[1] since setting an affinity using value
263+
* from Device Tree is deprecated in ARC.
264+
*/
265+
*out_hwirq = intspec[0];
250266
*out_type = IRQ_TYPE_NONE;
251267

252-
/* XXX: validate distribution scheme again online cpu mask */
253-
if (distri == 0) {
254-
/* 0 - Round Robin to all cpus, otherwise 1 bit per core */
255-
raw_spin_lock_irqsave(&mcip_lock, flags);
256-
idu_set_dest(hwirq, BIT(num_online_cpus()) - 1);
257-
idu_set_mode(hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_RR);
258-
raw_spin_unlock_irqrestore(&mcip_lock, flags);
259-
} else {
260-
/*
261-
* DEST based distribution for Level Triggered intr can only
262-
* have 1 CPU, so generalize it to always contain 1 cpu
263-
*/
264-
int cpu = ffs(distri);
265-
266-
if (cpu != fls(distri))
267-
pr_warn("IDU irq %lx distri mode set to cpu %x\n",
268-
hwirq, cpu);
269-
270-
raw_spin_lock_irqsave(&mcip_lock, flags);
271-
idu_set_dest(hwirq, cpu);
272-
idu_set_mode(hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_DEST);
273-
raw_spin_unlock_irqrestore(&mcip_lock, flags);
274-
}
275-
276268
return 0;
277269
}
278270

0 commit comments

Comments
 (0)