aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@mips.com>2017-10-31 12:41:48 -0400
committerMarc Zyngier <marc.zyngier@arm.com>2017-11-02 11:55:47 -0400
commit25c51dad664d1e69f90541c2558a39fd86a506e6 (patch)
treeaddd6badf7f98b1fa49395ddb92e9c14f66f4f96
parent890f6b55e5a5cc4e1a2efe36026c6fe3fb253b3b (diff)
irqchip: mips-gic: Use num_possible_cpus() to reserve IPIs
Reserving a number of IPIs based upon the number of VPs reported by the GIC makes little sense for a few reasons: - The kernel may have been configured with NR_CPUS less than the number of VPs in the cluster, in which case using gic_vpes causes us to reserve more interrupts for IPIs than we will possibly use. - If a kernel is configured without support for multi-threading & runs on a system with multi-threading & multiple VPs per core then we'll similarly reserve more interrupts for IPIs than we will possibly use. - In systems with multiple clusters the GIC can only provide us with the number of VPs in its cluster, not across all clusters. In this case we'll reserve fewer interrupts for IPIs than we need. Fix these issues by using num_possible_cpus() instead, which in all cases is actually indicative of how many IPIs we may need. Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: Jason Cooper <jason@lakedaemon.net> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-mips@linux-mips.org Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r--drivers/irqchip/irq-mips-gic.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index b1320ccb9f94..4304283bfb1a 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -671,7 +671,7 @@ static int gic_cpu_startup(unsigned int cpu)
671static int __init gic_of_init(struct device_node *node, 671static int __init gic_of_init(struct device_node *node,
672 struct device_node *parent) 672 struct device_node *parent)
673{ 673{
674 unsigned int cpu_vec, i, gicconfig, v[2]; 674 unsigned int cpu_vec, i, gicconfig, v[2], num_ipis;
675 unsigned long reserved; 675 unsigned long reserved;
676 phys_addr_t gic_base; 676 phys_addr_t gic_base;
677 struct resource res; 677 struct resource res;
@@ -781,10 +781,12 @@ static int __init gic_of_init(struct device_node *node,
781 !of_property_read_u32_array(node, "mti,reserved-ipi-vectors", v, 2)) { 781 !of_property_read_u32_array(node, "mti,reserved-ipi-vectors", v, 2)) {
782 bitmap_set(ipi_resrv, v[0], v[1]); 782 bitmap_set(ipi_resrv, v[0], v[1]);
783 } else { 783 } else {
784 /* Make the last 2 * gic_vpes available for IPIs */ 784 /*
785 bitmap_set(ipi_resrv, 785 * Reserve 2 interrupts per possible CPU/VP for use as IPIs,
786 gic_shared_intrs - 2 * gic_vpes, 786 * meeting the requirements of arch/mips SMP.
787 2 * gic_vpes); 787 */
788 num_ipis = 2 * num_possible_cpus();
789 bitmap_set(ipi_resrv, gic_shared_intrs - num_ipis, num_ipis);
788 } 790 }
789 791
790 bitmap_copy(ipi_available, ipi_resrv, GIC_MAX_INTRS); 792 bitmap_copy(ipi_available, ipi_resrv, GIC_MAX_INTRS);