Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] MIPS: Fix broken malta qemu
@ 2016-03-17 21:08 Qais Yousef
  2016-03-18  1:17 ` Guenter Roeck
  2016-04-01 12:48 ` Paul Burton
  0 siblings, 2 replies; 19+ messages in thread
From: Qais Yousef @ 2016-03-17 21:08 UTC (permalink / raw)
  To: ralf; +Cc: Qais Yousef, Guenter Roeck, Thomas Gleixner, linux-mips,
	linux-kernel

Malta defconfig compiles with GIC on. Hence when compiling for SMP it causes the
new IPI code to be activated. But on qemu malta there's no GIC causing a
BUG_ON(!ipidomain) to be hit in mips_smp_ipi_init().

Since in that configuration one can only run a single core SMP (!), skip IPI
initialisation if we detect that this is the case. It is a sensible behaviour
to introduce and should keep such possible configuration to run rather than die
hard unnecessarily.

Signed-off-by: Qais Yousef <qsyousef@gmail.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
---
 arch/mips/kernel/smp.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 37708d9..27cb638 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -243,6 +243,18 @@ static int __init mips_smp_ipi_init(void)
 	struct irq_domain *ipidomain;
 	struct device_node *node;
 
+	/*
+	 * In some cases like qemu-malta, it is desired to try SMP with
+	 * a single core. Qemu-malta has no GIC, so an attempt to set any IPIs
+	 * would cause a BUG_ON() to be triggered since there's no ipidomain.
+	 *
+	 * Since for a single core system IPIs aren't required really, skip the
+	 * initialisation which should generally keep any such configurations
+	 * happy and only fail hard when trying to truely run SMP.
+	 */
+	if (cpumask_weight(cpu_possible_mask) == 1)
+		return 0;
+
 	node = of_irq_find_parent(of_root);
 	ipidomain = irq_find_matching_host(node, DOMAIN_BUS_IPI);
 
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [PATCH] MIPS: Fix broken malta qemu
@ 2016-03-16 21:55 Qais Yousef
  0 siblings, 0 replies; 19+ messages in thread
From: Qais Yousef @ 2016-03-16 21:55 UTC (permalink / raw)


Malta defconfig compile with GIC on. Hence when compiling for SMP it causes the
new IPI code to be activated. But on qemu malta there's no GIC causing a
BUG_ON(!ipidomain) to be hit in mips_smp_ipi_init().

Introduce an extra check that gic_preset is true and skip initialising IPIs if
it's not.

Signed-off-by: Qais Yousef <qsyousef@gmail.com>
---
 arch/mips/kernel/smp.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 37708d9..972f64d 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -33,6 +33,7 @@
 #include <linux/cpu.h>
 #include <linux/err.h>
 #include <linux/ftrace.h>
+#include <linux/irqchip/mips-gic.h>
 #include <linux/irqdomain.h>
 #include <linux/of.h>
 #include <linux/of_irq.h>
@@ -243,6 +244,13 @@ static int __init mips_smp_ipi_init(void)
 	struct irq_domain *ipidomain;
 	struct device_node *node;
 
+	/*
+	 * If the config says GIC is present, but the harware doesn't actually
+	 * have it we could get stuffed, so double check that GIC is present
+	 */
+	if (WARN_ON(!gic_present))
+		return 0;
+
 	node = of_irq_find_parent(of_root);
 	ipidomain = irq_find_matching_host(node, DOMAIN_BUS_IPI);
 
-- 
1.9.1


--------------070206070600080600020506--

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2016-04-04  9:05 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-17 21:08 [PATCH] MIPS: Fix broken malta qemu Qais Yousef
2016-03-18  1:17 ` Guenter Roeck
2016-04-01 12:48 ` Paul Burton
2016-04-01 12:48   ` Paul Burton
2016-04-02 12:19   ` Qais Yousef
2016-04-02 14:05     ` Guenter Roeck
2016-04-04  6:41     ` Paul Burton
2016-04-04  6:41       ` Paul Burton
2016-04-04  7:59       ` [PATCH] MIPS: Don't BUG_ON when no IPI domain is found Paul Burton
2016-04-04  7:59         ` Paul Burton
2016-04-04  9:04         ` [PATCH v2] " Paul Burton
2016-04-04  9:04           ` Paul Burton
2016-04-04  8:02       ` [PATCH] MIPS: Fix broken malta qemu Ralf Baechle
2016-04-04  8:06         ` Paul Burton
2016-04-04  8:06           ` Paul Burton
2016-04-04  8:32           ` Ralf Baechle
     [not found]           ` <CA+mqd+7YA5JH=CfLBV9S-c+0aQw=NHihT+WyPvgUF6UkmK+tEQ@mail.gmail.com>
2016-04-04  8:40             ` Paul Burton
2016-04-04  8:40               ` Paul Burton
  -- strict thread matches above, loose matches on Subject: below --
2016-03-16 21:55 Qais Yousef

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox