Skip to contentSkip to conversation

powerpc: Fix minor build issues on 2.6.32-rc7 without CONFIG_XICS set

PATCH In review Mel Gorman 3 participants 16 messages Nov 17, 2009 – Nov 27, 2009 PowerPC

lore
Share & tools
lore

Mel Gorman

author
#0 lore raw

cover powerpc: Fix minor build issues on 2.6.32-rc7 without CONFIG_XICS set

KConfig doesn't require CONFIG_XICS to be set with CONFIG_PSERIES but if it's not set, there are numerous small build errors. This is a small series of patches to allow CONFIG_XICS to be unset in the config.

XICS appears to be some sort of interrupt controller but I'm not sure how common it is on systems that require CONFIG_PSERIES. If CONFIG_PSERIES universally requires CONFIG_XICS, the better path might be to force it to be set.

Testing was building with make oldconfig a configuration from 2.6.31 on a PPC970.

author
#1 lore raw

PATCH 1/4 powerpc: Add Kconfig dependency for PCI_MSI as needed by XICS

It's possible to set CONFIG_XICS without CONFIG_PCI_MSI. When that happens, the kernel fails to build with

arch/powerpc/platforms/built-in.o: In function `.xics_startup':
xics.c:(.text+0x12f60): undefined reference to `.unmask_msi_irq'
make: *** [.tmp_vmlinux1] Error 1

This patch adds the dependency in KConfig.

---
 arch/powerpc/platforms/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/platforms/Kconfig +1 -1
index 04a8061..21a1fa1 100644
@@ -52,7 +52,7 @@ config PPC_UDBG_BEAT
 	default n
 
 config XICS
-	depends on PPC_PSERIES
+	depends on PPC_PSERIES && PCI_MSI
 	bool
 	default y
 
Signature · 1 line
1.6.5
#2 lore raw

Re: [PATCH 1/4] powerpc: Add Kconfig dependency for PCI_MSI as needed by XICS

Quoted 8 lines · Mel Gorman

It's possible to set CONFIG_XICS without CONFIG_PCI_MSI. When that happens, the kernel fails to build with

arch/powerpc/platforms/built-in.o: In function `.xics_startup':
xics.c:(.text+0x12f60): undefined reference to `.unmask_msi_irq'
make: *** [.tmp_vmlinux1] Error 1

This patch adds the dependency in KConfig.

Actually we should ifdef the code instead, XICS doesn't require MSI - that code chunk just needs to be conditional.

cheers

author
#3 lore raw

PATCH 2/4 powerpc: Panic on platform ppc-xicp when CONFIG_XICS not set instead of build failure

In reply to Mel Gorman

If CONFIG_XICS is not set but CONFIG_PPC_PSERIES is, then the kernel fails to build with

arch/powerpc/platforms/pseries/smp.c: In function ‘smp_init_pseries_xics’:
arch/powerpc/platforms/pseries/smp.c:202: error: ‘pSeries_xics_smp_ops’ undeclared (first use in this function) arch/powerpc/platforms/pseries/smp.c:202: error: (Each undeclared identifier is reported only once arch/powerpc/platforms/pseries/smp.c:202: error: for each function it appears in.)
make[2]: *** [arch/powerpc/platforms/pseries/smp.o] Error 1

As CONFIG_XICS is not always necessary, this patch allows the kernel to build but the system will panic at runtime if it is found that XICS is required.

---
 arch/powerpc/platforms/pseries/smp.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/powerpc/platforms/pseries/smp.c +4 -0
index 440000c..da78ea5 100644
@@ -199,7 +199,11 @@ void __init smp_init_pseries_mpic(void)
 
 void __init smp_init_pseries_xics(void)
 {
+#ifdef CONFIG_XICS
 	smp_ops = &pSeries_xics_smp_ops;
+#else
+	panic("Support for platform ppc-xicp not configured");
+#endif
 
 	smp_init_pseries();
 }
Signature · 1 line
1.6.5
#4 lore raw

Re: [PATCH 2/4] powerpc: Panic on platform ppc-xicp when CONFIG_XICS not set instead of build failure

Quoted 24 lines · Mel Gorman

If CONFIG_XICS is not set but CONFIG_PPC_PSERIES is, then the kernel fails to build with

arch/powerpc/platforms/pseries/smp.c: In function ‘smp_init_pseries_xics’:
arch/powerpc/platforms/pseries/smp.c:202: error: ‘pSeries_xics_smp_ops’ undeclared (first use in this function) arch/powerpc/platforms/pseries/smp.c:202: error: (Each undeclared identifier is reported only once arch/powerpc/platforms/pseries/smp.c:202: error: for each function it appears in.)
make[2]: *** [arch/powerpc/platforms/pseries/smp.o] Error 1

As CONFIG_XICS is not always necessary, this patch allows the kernel to build but the system will panic at runtime if it is found that XICS is required.

---
 arch/powerpc/platforms/pseries/smp.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/powerpc/platforms/pseries/smp.c +0 -0
index 440000c..da78ea5 100644
@@ -199,7 +199,11 @@ void __init smp_init_pseries_mpic(void)
 

arch/powerpc/platforms/pseries/smp.c void __init smp_init_pseries_mpic(void) · line 209

Quoted 10 lines
arch/powerpc/platforms/pseries/smp.c +4 -0
 void __init smp_init_pseries_xics(void)
 {
+#ifdef CONFIG_XICS
 	smp_ops = &pSeries_xics_smp_ops;
+#else
+	panic("Support for platform ppc-xicp not configured");
+#endif
 
 	smp_init_pseries();
 }

I think it'd be neater to just ifdef the whole block in pseries_discover_pic(), or move it out and ifdef that. That'd avoid referencing pseries_xics_init_IRQ() and setup_kexec_cpu_down_xics() also.

cheers

author
#5 lore raw

PATCH 3/4 powerpc: Only define smp_pSeries_cpu_bootable when CONFIG_XICS is set

In reply to Mel Gorman

If CONFIG_XICS is set, then smp_pSeries_cpu_bootable() is unnecessary. As warnings are treated as errors, this fails to build.

This patch only defines smp_pSeries_cpu_bootable() when CONFIG_XICS is set.

---
 arch/powerpc/platforms/pseries/smp.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
arch/powerpc/platforms/pseries/smp.c +10 -9
index da78ea5..62b1141 100644
@@ -130,6 +130,15 @@ static void __devinit smp_pSeries_kick_cpu(int nr)
 	paca[nr].cpu_start = 1;
 }
 
+#ifdef CONFIG_MPIC
+static struct smp_ops_t pSeries_mpic_smp_ops = {
+	.message_pass	= smp_mpic_message_pass,
+	.probe		= smp_mpic_probe,
+	.kick_cpu	= smp_pSeries_kick_cpu,
+	.setup_cpu	= smp_mpic_setup_cpu,
+};
+#endif
+#ifdef CONFIG_XICS
 static int smp_pSeries_cpu_bootable(unsigned int nr)
 {
 	/* Special case - we inhibit secondary thread startup
@@ -142,15 +151,7 @@ static int smp_pSeries_cpu_bootable(unsigned int nr)
 
 	return 1;
 }
-#ifdef CONFIG_MPIC
-static struct smp_ops_t pSeries_mpic_smp_ops = {
-	.message_pass	= smp_mpic_message_pass,
-	.probe		= smp_mpic_probe,
-	.kick_cpu	= smp_pSeries_kick_cpu,
-	.setup_cpu	= smp_mpic_setup_cpu,
-};
-#endif
-#ifdef CONFIG_XICS
+
 static struct smp_ops_t pSeries_xics_smp_ops = {
 	.message_pass	= smp_xics_message_pass,
 	.probe		= smp_xics_probe,
Signature · 1 line
1.6.5
#6 lore raw

Re: [PATCH 3/4] powerpc: Only define smp_pSeries_cpu_bootable when CONFIG_XICS is set

Quoted 5 lines · Mel Gorman

If CONFIG_XICS is set, then smp_pSeries_cpu_bootable() is unnecessary. As warnings are treated as errors, this fails to build.

This patch only defines smp_pSeries_cpu_bootable() when CONFIG_XICS is set.

I'm not sure, but I would guess that was just an oversight by whoever added the cpu_bootable check. By which I mean it should be in the mpic ops as well - avoiding the need for any ifdefery.

cheers

author
#7 lore raw

PATCH 4/4 powerpc: Avoid reference to XICS-related functions when CONFIG_XICS is not set

In reply to Mel Gorman

Calls to XICS-related functions is open-coded in a number of places even when CONFIG_XICS is not set resulting in build failures such as

arch/powerpc/platforms/built-in.o: In function `.pseries_kexec_cpu_down_xics':
kexec.c:(.text+0x15558): undefined reference to `.xics_kexec_teardown_cpu'
arch/powerpc/platforms/built-in.o: In function .pseries_cpu_disable': hotplug-cpu.c:(.text+0x16104): undefined reference to .xics_migrate_irqs_away' arch/powerpc/platforms/built-in.o: In function .pseries_mach_cpu_die': hotplug-cpu.c:(.text+0x1615c): undefined reference to .xics_teardown_cpu' arch/powerpc/platforms/built-in.o: In function .pseries_xics_init_IRQ': setup.c:(.init.text+0x4590): undefined reference to .xics_init_IRQ'
make: *** [.tmp_vmlinux1] Error 1

This patch fixes up a number of references such as those described above.

---
 arch/powerpc/platforms/pseries/hotplug-cpu.c |    2 ++
 arch/powerpc/platforms/pseries/kexec.c       |    7 +++++++
 arch/powerpc/platforms/pseries/setup.c       |    7 +++++++
 arch/powerpc/platforms/pseries/xics.h        |    8 +++++++-
 4 files changed, 23 insertions(+), 1 deletions(-)
arch/powerpc/platforms/pseries/hotplug-cpu.c +2 -0
index ebff6d9..a2957d6 100644
@@ -58,7 +58,9 @@ static void pseries_mach_cpu_die(void)
 {
 	local_irq_disable();
 	idle_task_exit();
+#ifdef CONFIG_XICS
 	xics_teardown_cpu();
+#endif
 	unregister_slb_shadow(hard_smp_processor_id(), __pa(get_slb_shadow()));
 	rtas_stop_self();
 	/* Should never get here... */
arch/powerpc/platforms/pseries/kexec.c +7 -0
index 53cbd53..ab79947 100644
@@ -51,6 +51,7 @@ void __init setup_kexec_cpu_down_mpic(void)
 	ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_mpic;
 }
 
+#ifdef CONFIG_XICS
 static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary)
 {
 	pseries_kexec_cpu_down(crash_shutdown, secondary);
@@ -61,6 +62,12 @@ void __init setup_kexec_cpu_down_xics(void)
 {
 	ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_xics;
 }
+#else
+void __init setup_kexec_cpu_down_xics(void)
+{
+	BUG();
+}
+#endif
 
 static int __init pseries_kexec_setup(void)
 {
arch/powerpc/platforms/pseries/setup.c +7 -0
index ca5f2e1..a925fbb 100644
@@ -210,11 +210,18 @@ static void __init pseries_mpic_init_IRQ(void)
 	pseries_setup_i8259_cascade();
 }
 
+#ifdef CONFIG_XICS
 static void __init pseries_xics_init_IRQ(void)
 {
 	xics_init_IRQ();
 	pseries_setup_i8259_cascade();
 }
+#else
+static void __init pseries_xics_init_IRQ(void)
+{
+	BUG();
+}
+#endif
 
 static void pseries_lpar_enable_pmcs(void)
 {
arch/powerpc/platforms/pseries/xics.h +7 -1
index d1d5a83..d0a618d 100644
@@ -16,8 +16,14 @@ extern void xics_init_IRQ(void);
 extern void xics_setup_cpu(void);
 extern void xics_teardown_cpu(void);
 extern void xics_kexec_teardown_cpu(int secondary);
-extern void xics_migrate_irqs_away(void);
 extern int smp_xics_probe(void);
 extern void smp_xics_message_pass(int target, int msg);
+#ifdef CONFIG_XICS
+extern void xics_migrate_irqs_away(void);
+#else
+static inline void xics_migrate_irqs_away(void)
+{
+	BUG();
+}
 
 #endif /* _POWERPC_KERNEL_XICS_H */
Signature · 1 line
1.6.5
#8 lore raw
In reply to Mel Gorman
Quoted 8 lines · Mel Gorman

KConfig doesn't require CONFIG_XICS to be set with CONFIG_PSERIES but if it's not set, there are numerous small build errors. This is a small series of patches to allow CONFIG_XICS to be unset in the config.

XICS appears to be some sort of interrupt controller but I'm not sure how common it is on systems that require CONFIG_PSERIES. If CONFIG_PSERIES universally requires CONFIG_XICS, the better path might be to force it to be set.

It is indeed 'some sort of interrupt controller' :)

All the virtualised PSERIES systems have, or appear to have, a XICS. So it's pretty common.

I think the only time you see an MPIC is on older machines, and even then maybe only if you're running bare metal.

So it is pretty much required for a PSERIES kernel, but perhaps there are cases where the BML guys want to be able to turn it off.

cheers

#9 lore raw
Quoted 12 lines · Michael Ellerman
Quoted 8 lines · Mel Gorman

KConfig doesn't require CONFIG_XICS to be set with CONFIG_PSERIES but if it's not set, there are numerous small build errors. This is a small series of patches to allow CONFIG_XICS to be unset in the config.

XICS appears to be some sort of interrupt controller but I'm not sure how common it is on systems that require CONFIG_PSERIES. If CONFIG_PSERIES universally requires CONFIG_XICS, the better path might be to force it to be set.

It is indeed 'some sort of interrupt controller' :)

Quoted 8 lines

All the virtualised PSERIES systems have, or appear to have, a XICS. So it's pretty common.

I think the only time you see an MPIC is on older machines, and even then maybe only if you're running bare metal.

So it is pretty much required for a PSERIES kernel, but perhaps there are cases where the BML guys want to be able to turn it off.

In fact this series makes me wonder whether we can drop support for a single kernel image with pseries XICS & MPIC support.

If we could drop that requirement we could have a single set of names, ie. API, for the irq routines and build either the XICS or MPIC versions.

That would avoid all the code that needs a setup_foo_xics() and setup_foo_mpic() - it'd just be setup_foo(), implemented by either the XICS or MPIC code.

cheers

#10 lore raw
Quoted 3 lines · Michael Ellerman

In fact this series makes me wonder whether we can drop support for a single kernel image with pseries XICS & MPIC support.

Nope. Not happening. We should just hide CONFIG_XICS just like CONFIG_MPIC, it should be select'ed by the platform (which today is only pseries but that might change).

Quoted 3 lines

If we could drop that requirement we could have a single set of names, ie. API, for the irq routines and build either the XICS or MPIC versions.

And so we would have the ability to build a kernel that supports in a single binary every platform, as is the case today, ie, pseries, powermac, pa6t, cell, etc... _BUT_ for pseries support, we would have to choose at compile time whether to support old or new machines ? Sounds backward to me :-)

Quoted 3 lines

That would avoid all the code that needs a setup_foo_xics() and setup_foo_mpic() - it'd just be setup_foo(), implemented by either the XICS or MPIC code.

And that would save us what ? one page on a pSeries machine ? yeah !

Cheers,
Ben.

author
#11 lore raw
In reply to Michael Ellerman
Quoted 12 lines · Michael Ellerman
Quoted 8 lines · Mel Gorman

KConfig doesn't require CONFIG_XICS to be set with CONFIG_PSERIES but if it's not set, there are numerous small build errors. This is a small series of patches to allow CONFIG_XICS to be unset in the config.

XICS appears to be some sort of interrupt controller but I'm not sure how common it is on systems that require CONFIG_PSERIES. If CONFIG_PSERIES universally requires CONFIG_XICS, the better path might be to force it to be set.

It is indeed 'some sort of interrupt controller' :)

Quoted 9 lines

All the virtualised PSERIES systems have, or appear to have, a XICS. So it's pretty common.

I think the only time you see an MPIC is on older machines, and even then maybe only if you're running bare metal.

So it is pretty much required for a PSERIES kernel, but perhaps there are cases where the BML guys want to be able to turn it off.

Do you want to take ownership of the series as I'm a bit unclear on how and when XICS should be used? If not, I don't mind fixing the series up as you suggested but I wouldn't be in the best position to determine if the final result is sensible or not.

Signature · 3 lines
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab
#12 lore raw
In reply to Mel Gorman
Quoted 11 lines · Mel Gorman

KConfig doesn't require CONFIG_XICS to be set with CONFIG_PSERIES but if it's not set, there are numerous small build errors. This is a small series of patches to allow CONFIG_XICS to be unset in the config.

XICS appears to be some sort of interrupt controller but I'm not sure how common it is on systems that require CONFIG_PSERIES. If CONFIG_PSERIES universally requires CONFIG_XICS, the better path might be to force it to be set.

Testing was building with make oldconfig a configuration from 2.6.31 on a PPC970.

CONFIG_XICS should be made invisible and selected by PSERIES.

Cheers,
Ben.

author
#13 lore raw
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 9 lines · Mel Gorman

KConfig doesn't require CONFIG_XICS to be set with CONFIG_PSERIES but if it's not set, there are numerous small build errors. This is a small series of patches to allow CONFIG_XICS to be unset in the config.

XICS appears to be some sort of interrupt controller but I'm not sure how common it is on systems that require CONFIG_PSERIES. If CONFIG_PSERIES universally requires CONFIG_XICS, the better path might be to force it to be set.

Quoted 5 lines
Quoted 2 lines

Testing was building with make oldconfig a configuration from 2.6.31 on a PPC970.

CONFIG_XICS should be made invisible and selected by PSERIES.

Like so?

==== CUT HERE ====

powerpc: Add Kconfig dependency on PCI_MSI for XICS and select for PSERIES

It's possible to set CONFIG_XICS without CONFIG_PCI_MSI. When that happens, the kernel fails to build with

arch/powerpc/platforms/built-in.o: In function `.xics_startup':
xics.c:(.text+0x12f60): undefined reference to `.unmask_msi_irq'
make: *** [.tmp_vmlinux1] Error 1

Furthermore, as noted by Benjamin Herrenschmidt, "CONFIG_XICS should be made invisible and selected by PSERIES."

This patch adds the dependency in KConfig for XICS on PCI_MSI. When PSERIES support is being configured, both options are silently selected.

---

 arch/powerpc/platforms/Kconfig         |    4 ++--
 arch/powerpc/platforms/pseries/Kconfig |    2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/platforms/Kconfig +2 -2
index 04a8061..a82c470 100644
@@ -52,9 +52,9 @@ config PPC_UDBG_BEAT
 	default n
 
 config XICS
-	depends on PPC_PSERIES
+	depends on PCI_MSI
 	bool
-	default y
+	default n
 
 config IPIC
 	bool
arch/powerpc/platforms/pseries/Kconfig +2 -0
index f0e6f28..81c2289 100644
@@ -5,6 +5,8 @@ config PPC_PSERIES
 	select PPC_I8259
 	select PPC_RTAS
 	select RTAS_ERROR_LOGGING
+	select PCI_MSI
+	select XICS
 	select PPC_UDBG_16550
 	select PPC_NATIVE
 	select PPC_PCI_CHOICE if EMBEDDED
#14 lore raw
Quoted 6 lines · Mel Gorman
arch/powerpc/platforms/Kconfig +0 -0
index 04a8061..a82c470 100644

arch/powerpc/platforms/Kconfig config PPC_UDBG_BEAT · line 57

Quoted 8 lines
arch/powerpc/platforms/Kconfig +2 -2
@@ -52,9 +52,9 @@ config PPC_UDBG_BEAT
 	default n
 
 config XICS
-	depends on PPC_PSERIES
+	depends on PCI_MSI
 	bool
-	default y
+	default n

Why the above ? XICS only exist on PSERIES and select bypass depends in nasty ways anyways.

Quoted 7 lines
arch/powerpc/platforms/Kconfig +0 -0
 config IPIC
 	bool
arch/powerpc/platforms/pseries/Kconfig +0 -0
index f0e6f28..81c2289 100644

arch/powerpc/platforms/pseries/Kconfig config PPC_PSERIES · line 12

Quoted 8 lines
arch/powerpc/platforms/pseries/Kconfig +2 -0
@@ -5,6 +5,8 @@ config PPC_PSERIES
 	select PPC_I8259
 	select PPC_RTAS
 	select RTAS_ERROR_LOGGING
+	select PCI_MSI
+	select XICS
 	select PPC_UDBG_16550
 	select PPC_NATIVE
 	select PPC_PCI_CHOICE if EMBEDDED

The above bits look plenty enough. Can you also stick it next to the MPIC one ?

Cheers,
Ben.

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

author
#15 lore raw

PATCH 1/1 powerpc: Add Kconfig dependency on PCI_MSI for XICS and select for PSERIES

Quoted 10 lines · Benjamin Herrenschmidt
Quoted 8 lines · Mel Gorman
arch/powerpc/platforms/Kconfig +0 -0
index 04a8061..a82c470 100644
@@ -52,9 +52,9 @@ config PPC_UDBG_BEAT
 	default n
 
Quoted 10 lines

arch/powerpc/platforms/Kconfig config PPC_UDBG_BEAT · line 57

Quoted 6 lines
arch/powerpc/platforms/Kconfig +2 -2
 config XICS
-	depends on PPC_PSERIES
+	depends on PCI_MSI
 	bool
-	default y
+	default n

Why the above ? XICS only exist on PSERIES and select bypass depends in nasty ways anyways.

You're right. When I made that change, I assumed that a "select foo" would also resolve the dependencies. It doesn't but I failed to back this out as being unnecessary.

Quoted 10 lines
Quoted 10 lines
arch/powerpc/platforms/Kconfig +0 -0
 config IPIC
 	bool
arch/powerpc/platforms/pseries/Kconfig +0 -0
index f0e6f28..81c2289 100644
@@ -5,6 +5,8 @@ config PPC_PSERIES
 	select PPC_I8259
 	select PPC_RTAS
 	select RTAS_ERROR_LOGGING
Quoted 9 lines

arch/powerpc/platforms/pseries/Kconfig config PPC_PSERIES · line 12

Quoted 5 lines
arch/powerpc/platforms/pseries/Kconfig +2 -0
+	select PCI_MSI
+	select XICS
 	select PPC_UDBG_16550
 	select PPC_NATIVE
 	select PPC_PCI_CHOICE if EMBEDDED

The above bits look plenty enough. Can you also stick it next to the MPIC one ?

They are. I can.

==== CUT HERE ====
powerpc: Add Kconfig dependency on PCI_MSI for XICS and select for PSERIES

It's possible to set CONFIG_XICS without CONFIG_PCI_MSI. When that happens, the kernel fails to build with

arch/powerpc/platforms/built-in.o: In function `.xics_startup':
xics.c:(.text+0x12f60): undefined reference to `.unmask_msi_irq' make: *** [.tmp_vmlinux1] Error 1

Furthermore, as noted by Benjamin Herrenschmidt, "CONFIG_XICS should be made invisible and selected by PSERIES."

This patch adds the dependency in KConfig for XICS on PCI_MSI. When PSERIES support is being configured, both options are silently selected.

Signed-off-by Mel Gorman <mel[at]csn.ul.ie>
---
 arch/powerpc/platforms/pseries/Kconfig |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/powerpc/platforms/pseries/Kconfig +2 -0
index f0e6f28..60d53ed 100644
@@ -2,6 +2,8 @@ config PPC_PSERIES
 	depends on PPC64 && PPC_BOOK3S
 	bool "IBM pSeries & new (POWER5-based) iSeries"
 	select MPIC
+	select PCI_MSI
+	select XICS
 	select PPC_I8259
 	select PPC_RTAS
 	select RTAS_ERROR_LOGGING