Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Yuriy Kolerov and committed by
Vineet Gupta
92fdb527 7a308bb3

+25 -30
+3
Documentation/devicetree/bindings/interrupt-controller/snps,archs-idu-intc.txt
··· 15 15 Second cell specifies the irq distribution mode to cores 16 16 0=Round Robin; 1=cpu0, 2=cpu1, 4=cpu2, 8=cpu3 17 17 18 + The second cell in interrupts property is deprecated and may be ignored by 19 + the kernel. 20 + 18 21 intc accessed via the special ARC AUX register interface, hence "reg" property 19 22 is not specified. 20 23
+22 -30
arch/arc/kernel/mcip.c
··· 175 175 raw_spin_unlock_irqrestore(&mcip_lock, flags); 176 176 } 177 177 178 - #ifdef CONFIG_SMP 179 178 static int 180 179 idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask, 181 180 bool force) ··· 204 205 205 206 return IRQ_SET_MASK_OK; 206 207 } 207 - #endif 208 + 209 + static void idu_irq_enable(struct irq_data *data) 210 + { 211 + /* 212 + * By default send all common interrupts to all available online CPUs. 213 + * The affinity of common interrupts in IDU must be set manually since 214 + * in some cases the kernel will not call irq_set_affinity() by itself: 215 + * 1. When the kernel is not configured with support of SMP. 216 + * 2. When the kernel is configured with support of SMP but upper 217 + * interrupt controllers does not support setting of the affinity 218 + * and cannot propagate it to IDU. 219 + */ 220 + idu_irq_set_affinity(data, cpu_online_mask, false); 221 + idu_irq_unmask(data); 222 + } 208 223 209 224 static struct irq_chip idu_irq_chip = { 210 225 .name = "MCIP IDU Intc", 211 226 .irq_mask = idu_irq_mask, 212 227 .irq_unmask = idu_irq_unmask, 228 + .irq_enable = idu_irq_enable, 213 229 #ifdef CONFIG_SMP 214 230 .irq_set_affinity = idu_irq_set_affinity, 215 231 #endif ··· 257 243 const u32 *intspec, unsigned int intsize, 258 244 irq_hw_number_t *out_hwirq, unsigned int *out_type) 259 245 { 260 - irq_hw_number_t hwirq = *out_hwirq = intspec[0]; 261 - int distri = intspec[1]; 262 - unsigned long flags; 263 - 246 + /* 247 + * Ignore value of interrupt distribution mode for common interrupts in 248 + * IDU which resides in intspec[1] since setting an affinity using value 249 + * from Device Tree is deprecated in ARC. 250 + */ 251 + *out_hwirq = intspec[0]; 264 252 *out_type = IRQ_TYPE_NONE; 265 - 266 - /* XXX: validate distribution scheme again online cpu mask */ 267 - if (distri == 0) { 268 - /* 0 - Round Robin to all cpus, otherwise 1 bit per core */ 269 - raw_spin_lock_irqsave(&mcip_lock, flags); 270 - idu_set_dest(hwirq, BIT(num_online_cpus()) - 1); 271 - idu_set_mode(hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_RR); 272 - raw_spin_unlock_irqrestore(&mcip_lock, flags); 273 - } else { 274 - /* 275 - * DEST based distribution for Level Triggered intr can only 276 - * have 1 CPU, so generalize it to always contain 1 cpu 277 - */ 278 - int cpu = ffs(distri); 279 - 280 - if (cpu != fls(distri)) 281 - pr_warn("IDU irq %lx distri mode set to cpu %x\n", 282 - hwirq, cpu); 283 - 284 - raw_spin_lock_irqsave(&mcip_lock, flags); 285 - idu_set_dest(hwirq, cpu); 286 - idu_set_mode(hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_DEST); 287 - raw_spin_unlock_irqrestore(&mcip_lock, flags); 288 - } 289 253 290 254 return 0; 291 255 }