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

soc: fsl: qbman: Check if CPU is offline when initializing portals

If the CPU to affine the portal interrupt is offline at boot time
affine the portal interrupt to another online CPU. If the CPU is later
brought online the hotplug handler will correctly adjust the affinity.
Moved common code in a function.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>

authored by

Roy Pledge and committed by
Li Yang
9beaf661 56740a71

+24 -8
+2 -4
drivers/soc/fsl/qbman/bman.c
··· 562 562 dev_err(c->dev, "request_irq() failed\n"); 563 563 goto fail_irq; 564 564 } 565 - if (c->cpu != -1 && irq_can_set_affinity(c->irq) && 566 - irq_set_affinity(c->irq, cpumask_of(c->cpu))) { 567 - dev_err(c->dev, "irq_set_affinity() failed\n"); 565 + 566 + if (dpaa_set_portal_irq_affinity(c->dev, c->irq, c->cpu)) 568 567 goto fail_affinity; 569 - } 570 568 571 569 /* Need RCR to be empty before continuing */ 572 570 ret = bm_rcr_get_fill(p);
+20
drivers/soc/fsl/qbman/dpaa_sys.h
··· 111 111 #define QBMAN_MEMREMAP_ATTR MEMREMAP_WC 112 112 #endif 113 113 114 + static inline int dpaa_set_portal_irq_affinity(struct device *dev, 115 + int irq, int cpu) 116 + { 117 + int ret = 0; 118 + 119 + if (!irq_can_set_affinity(irq)) { 120 + dev_err(dev, "unable to set IRQ affinity\n"); 121 + return -EINVAL; 122 + } 123 + 124 + if (cpu == -1 || !cpu_online(cpu)) 125 + cpu = cpumask_any(cpu_online_mask); 126 + 127 + ret = irq_set_affinity(irq, cpumask_of(cpu)); 128 + if (ret) 129 + dev_err(dev, "irq_set_affinity() on CPU %d failed\n", cpu); 130 + 131 + return ret; 132 + } 133 + 114 134 #endif /* __DPAA_SYS_H */
+2 -4
drivers/soc/fsl/qbman/qman.c
··· 1210 1210 dev_err(c->dev, "request_irq() failed\n"); 1211 1211 goto fail_irq; 1212 1212 } 1213 - if (c->cpu != -1 && irq_can_set_affinity(c->irq) && 1214 - irq_set_affinity(c->irq, cpumask_of(c->cpu))) { 1215 - dev_err(c->dev, "irq_set_affinity() failed\n"); 1213 + 1214 + if (dpaa_set_portal_irq_affinity(c->dev, c->irq, c->cpu)) 1216 1215 goto fail_affinity; 1217 - } 1218 1216 1219 1217 /* Need EQCR to be empty before continuing */ 1220 1218 isdr &= ~QM_PIRQ_EQCI;