aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/soc/fsl/qbman/dpaa_sys.h
diff options
context:
space:
mode:
authorRoy Pledge <roy.pledge@nxp.com>2018-09-28 11:43:20 +0300
committerLi Yang <leoyang.li@nxp.com>2018-10-05 14:01:46 -0500
commit9beaf661d6a72b7c05efb4b33d228032c7152f34 (patch)
tree1b70ad14038759d6e9e833616fa4ec55fb9e0894 /drivers/soc/fsl/qbman/dpaa_sys.h
parentMerge tag 'soc-fsl-fix-v4.19-2' into HEAD (diff)
downloadlinux-dev-9beaf661d6a72b7c05efb4b33d228032c7152f34.tar.xz
linux-dev-9beaf661d6a72b7c05efb4b33d228032c7152f34.zip
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>
Diffstat (limited to 'drivers/soc/fsl/qbman/dpaa_sys.h')
-rw-r--r--drivers/soc/fsl/qbman/dpaa_sys.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/soc/fsl/qbman/dpaa_sys.h b/drivers/soc/fsl/qbman/dpaa_sys.h
index 9f379000da85..ae8afa552b1e 100644
--- a/drivers/soc/fsl/qbman/dpaa_sys.h
+++ b/drivers/soc/fsl/qbman/dpaa_sys.h
@@ -111,4 +111,24 @@ int qbman_init_private_mem(struct device *dev, int idx, dma_addr_t *addr,
#define QBMAN_MEMREMAP_ATTR MEMREMAP_WC
#endif
+static inline int dpaa_set_portal_irq_affinity(struct device *dev,
+ int irq, int cpu)
+{
+ int ret = 0;
+
+ if (!irq_can_set_affinity(irq)) {
+ dev_err(dev, "unable to set IRQ affinity\n");
+ return -EINVAL;
+ }
+
+ if (cpu == -1 || !cpu_online(cpu))
+ cpu = cpumask_any(cpu_online_mask);
+
+ ret = irq_set_affinity(irq, cpumask_of(cpu));
+ if (ret)
+ dev_err(dev, "irq_set_affinity() on CPU %d failed\n", cpu);
+
+ return ret;
+}
+
#endif /* __DPAA_SYS_H */