soc: fsl: qbman: replace CPU 0 with any online CPU in hotplug handlers
authorMadalin Bucur <madalin.bucur@nxp.com>
Fri, 28 Sep 2018 08:43:21 +0000 (11:43 +0300)
committerLi Yang <leoyang.li@nxp.com>
Fri, 5 Oct 2018 19:01:46 +0000 (14:01 -0500)
The existing code sets portal IRQ affinity to CPU 0 in the
offline hotplug handler. If CPU 0 is offline this is invalid.
Use a different online CPU instead.

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
drivers/soc/fsl/qbman/bman_portal.c
drivers/soc/fsl/qbman/qman_portal.c

index 2f71f7df3465a0a65301cb031ab183c4b0ddee7c..088cdfa7c034b8484936d2dfed5cc647d6258740 100644 (file)
@@ -65,7 +65,9 @@ static int bman_offline_cpu(unsigned int cpu)
        if (!pcfg)
                return 0;
 
-       irq_set_affinity(pcfg->irq, cpumask_of(0));
+       /* use any other online CPU */
+       cpu = cpumask_any_but(cpu_online_mask, cpu);
+       irq_set_affinity(pcfg->irq, cpumask_of(cpu));
        return 0;
 }
 
index 3e9391d117c543cb46f49893610e528ed52984e8..661c9b234d32bc04da676e54e5568c0a10e3a0b4 100644 (file)
@@ -195,8 +195,10 @@ static int qman_offline_cpu(unsigned int cpu)
        if (p) {
                pcfg = qman_get_qm_portal_config(p);
                if (pcfg) {
-                       irq_set_affinity(pcfg->irq, cpumask_of(0));
-                       qman_portal_update_sdest(pcfg, 0);
+                       /* select any other online CPU */
+                       cpu = cpumask_any_but(cpu_online_mask, cpu);
+                       irq_set_affinity(pcfg->irq, cpumask_of(cpu));
+                       qman_portal_update_sdest(pcfg, cpu);
                }
        }
        return 0;