Skip to contentSkip to conversation

pci32: 4xx embedded platforms want to reassign all PCI resources

PATCH In review Benjamin Herrenschmidt 3 participants 14 messages Dec 13, 2007 – Dec 14, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 19/20 pci32: 4xx embedded platforms want to reassign all PCI resources

This makes 4xx embedded platforms re-assign all PCI resources as we pretty much never care about what the various firmwares have done on these, it's generally not compatible with the way the kernel will map the bridges.

We still need to also enable bus renumbering on some of them, but I will do that from a separate patch after I've fixed 4xx PCIe to handle all bus numbers.

---

 arch/powerpc/platforms/40x/ep405.c   |    2 ++
 arch/powerpc/platforms/40x/kilauea.c |    3 +++
 arch/powerpc/platforms/40x/walnut.c  |    3 +++
 arch/powerpc/platforms/44x/bamboo.c  |    4 ++++
 arch/powerpc/platforms/44x/ebony.c   |    3 +++
 arch/powerpc/platforms/44x/katmai.c  |    3 +++
 arch/powerpc/platforms/44x/sequoia.c |    5 ++++-
 arch/powerpc/platforms/44x/taishan.c |    2 ++
 8 files changed, 24 insertions(+), 1 deletion(-)
arch/powerpc/platforms/44x/bamboo.c +4 -0
@@ -21,6 +21,8 @@
 #include <asm/udbg.h>
 #include <asm/time.h>
 #include <asm/uic.h>
+#include <asm/pci-bridge.h>
+
 #include "44x.h"
 
 static struct of_device_id bamboo_of_bus[] = {
@@ -48,6 +50,8 @@ static int __init bamboo_probe(void)
 	if (!of_flat_dt_is_compatible(root, "amcc,bamboo"))
 		return 0;
 
+	ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
+
 	return 1;
 }
 
arch/powerpc/platforms/40x/ep405.c +2 -0
Index: linux-work/arch/powerpc/platforms/40x/ep405.c
===================================================================
@@ -101,6 +101,8 @@ static void __init ep405_setup_arch(void
 {
 	/* Find & init the BCSR CPLD */
 	ep405_init_bcsr();
+
+	ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
 }
 
 static int __init ep405_probe(void)
arch/powerpc/platforms/40x/kilauea.c +3 -0
Index: linux-work/arch/powerpc/platforms/40x/kilauea.c
===================================================================
@@ -19,6 +19,7 @@
 #include <asm/udbg.h>
 #include <asm/time.h>
 #include <asm/uic.h>
+#include <asm/pci-bridge.h>
 
 static struct of_device_id kilauea_of_bus[] = {
 	{ .compatible = "ibm,plb4", },
@@ -45,6 +46,8 @@ static int __init kilauea_probe(void)
 	if (!of_flat_dt_is_compatible(root, "amcc,kilauea"))
 		return 0;
 
+	ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
+
 	return 1;
 }
 
arch/powerpc/platforms/40x/walnut.c +3 -0
Index: linux-work/arch/powerpc/platforms/40x/walnut.c
===================================================================
@@ -24,6 +24,7 @@
 #include <asm/udbg.h>
 #include <asm/time.h>
 #include <asm/uic.h>
+#include <asm/pci-bridge.h>
 
 static struct of_device_id walnut_of_bus[] = {
 	{ .compatible = "ibm,plb3", },
@@ -51,6 +52,8 @@ static int __init walnut_probe(void)
 	if (!of_flat_dt_is_compatible(root, "ibm,walnut"))
 		return 0;
 
+	ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
+
 	return 1;
 }
 
arch/powerpc/platforms/44x/ebony.c +3 -0
Index: linux-work/arch/powerpc/platforms/44x/ebony.c
===================================================================
@@ -24,6 +24,7 @@
 #include <asm/udbg.h>
 #include <asm/time.h>
 #include <asm/uic.h>
+#include <asm/pci-bridge.h>
 
 #include "44x.h"
 
@@ -55,6 +56,8 @@ static int __init ebony_probe(void)
 	if (!of_flat_dt_is_compatible(root, "ibm,ebony"))
 		return 0;
 
+	ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
+
 	return 1;
 }
 
arch/powerpc/platforms/44x/katmai.c +3 -0
Index: linux-work/arch/powerpc/platforms/44x/katmai.c
===================================================================
@@ -21,6 +21,7 @@
 #include <asm/udbg.h>
 #include <asm/time.h>
 #include <asm/uic.h>
+#include <asm/pci-bridge.h>
 
 #include "44x.h"
 
@@ -49,6 +50,8 @@ static int __init katmai_probe(void)
 	if (!of_flat_dt_is_compatible(root, "amcc,katmai"))
 		return 0;
 
+	ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
+
 	return 1;
 }
 
arch/powerpc/platforms/44x/sequoia.c +4 -1
Index: linux-work/arch/powerpc/platforms/44x/sequoia.c
===================================================================
@@ -21,7 +21,8 @@
 #include <asm/udbg.h>
 #include <asm/time.h>
 #include <asm/uic.h>
-#include "44x.h"
+#include <asm/pci-bridge.h>
+
 
 static struct of_device_id sequoia_of_bus[] = {
 	{ .compatible = "ibm,plb4", },
@@ -48,6 +49,8 @@ static int __init sequoia_probe(void)
 	if (!of_flat_dt_is_compatible(root, "amcc,sequoia"))
 		return 0;
 
+	ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
+
 	return 1;
 }
 
arch/powerpc/platforms/44x/taishan.c +2 -0
Index: linux-work/arch/powerpc/platforms/44x/taishan.c
===================================================================
@@ -60,6 +60,8 @@ static int __init taishan_probe(void)
 	if (!of_flat_dt_is_compatible(root, "amcc,taishan"))
 		return 0;
 
+	ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
+
 	return 1;
 }
 
#1 lore raw
Quoted 8 lines · Benjamin Herrenschmidt

This makes 4xx embedded platforms re-assign all PCI resources as we pretty much never care about what the various firmwares have done on these, it's generally not compatible with the way the kernel will map the bridges.

We still need to also enable bus renumbering on some of them, but I will do that from a separate patch after I've fixed 4xx PCIe to handle all bus numbers.

I just applied this series on top of Paulus's for-2.6.25 branch and I get the following error:

/home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c: In function 'kilauea_probe':
/home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49: error: 'ppc_pci_flags' undeclared (first use in this function) /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49: error: (Each undeclared identifier is reported only once /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49: error: for each function it appears in.) /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49: error: 'PPC_PCI_REASSIGN_ALL_RSRC' undeclared (first use in this function) make[3]: *** [arch/powerpc/platforms/40x/kilauea.o] Error 1

Seems like the patch:

powerpc: pci32: Add flags modifying the PCI code behaviour

This adds to the 32 bits PCI code some flags, replacing the old pci_assign_all_busses global, that allow to control various aspects of the PCI probing, such as whether to re-assign all resources or not, or to not try to assign anything at all.

This also adds the flag x86 already has to avoid ISA alignment on bridges that don't have ISA forwarding enabled (no legacy devices on the top level bus) and sets it for PowerMacs.

is missing.

Thanks.

Ciao,
Stefan

#2 lore raw
Quoted 13 lines · Stefan Roese
Quoted 8 lines · Benjamin Herrenschmidt

This makes 4xx embedded platforms re-assign all PCI resources as we pretty much never care about what the various firmwares have done on these, it's generally not compatible with the way the kernel will map the bridges.

We still need to also enable bus renumbering on some of them, but I will do that from a separate patch after I've fixed 4xx PCIe to handle all bus numbers.

I just applied this series on top of Paulus's for-2.6.25 branch and I get the following error:

Quoted 11 lines

/home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilaue a.c: In function 'kilauea_probe':
/home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilaue a.c:49: error: 'ppc_pci_flags' undeclared (first use in this function) /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilaue a.c:49: error: (Each undeclared identifier is reported only once /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilaue a.c:49: error: for each function it appears in.) /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilaue a.c:49: error: 'PPC_PCI_REASSIGN_ALL_RSRC' undeclared (first use in this function) make[3]: *** [arch/powerpc/platforms/40x/kilauea.o] Error 1

Sorry for the noise, but this was my problem. I didn't apply Ben's PCI patch series.

Ciao,
Stefan

#3 lore raw
In reply to Stefan Roese
Quoted 13 lines · Stefan Roese
Quoted 8 lines · Benjamin Herrenschmidt

This makes 4xx embedded platforms re-assign all PCI resources as we pretty much never care about what the various firmwares have done on these, it's generally not compatible with the way the kernel will map the bridges.

We still need to also enable bus renumbering on some of them, but I will do that from a separate patch after I've fixed 4xx PCIe to handle all bus numbers.

I just applied this series on top of Paulus's for-2.6.25 branch and I get the following error:

Quoted 6 lines

/home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c: In function 'kilauea_probe':
/home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49: error: 'ppc_pci_flags' undeclared (first use in this function) /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49: error: (Each undeclared identifier is reported only once /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49: error: for each function it appears in.) /home/stefan/git/linux-2.6/paulus-powerpc/arch/powerpc/platforms/40x/kilauea.c:49: error: 'PPC_PCI_REASSIGN_ALL_RSRC' undeclared (first use in this function) make[3]: *** [arch/powerpc/platforms/40x/kilauea.o] Error 1

As discussed on IRC, that's just because you are missing the PCI series of patches :-)

Cheers,
Ben.

#4 lore raw
In reply to Benjamin Herrenschmidt
Quoted 8 lines · On Thu, 13 Dec 2007 18:38:46 +1100 Benjamin Herrenschmidt…

This makes 4xx embedded platforms re-assign all PCI resources as we pretty much never care about what the various firmwares have done on these, it's generally not compatible with the way the kernel will map the bridges.

We still need to also enable bus renumbering on some of them, but I will do that from a separate patch after I've fixed 4xx PCIe to handle all bus numbers.

This one is slightly broken in my opinion. You've added the ppc_pci_flags to all of these platforms, which is fine for your intended goal. But now all of these platforms _have_ to compile with PCI enabled or they'll break with:

arch/powerpc/platforms/built-in.o: In function `walnut_probe':
walnut.c:(.init.text+0x9a): undefined reference to ppc_pci_flags' walnut.c:(.init.text+0xa6): undefined reference to ppc_pci_flags' make[1]: *** [.tmp_vmlinux1] Error 1

So to do it correctly we need to either select CONFIG_PCI for all of them, wrap the ppc_pci_flags assignment in #ifdef CONFIG_PCI, or move the ppc_pci_flags variable declaration into something that always gets compiled.

josh

#5 lore raw
Quoted 11 lines

This one is slightly broken in my opinion. You've added the ppc_pci_flags to all of these platforms, which is fine for your intended goal. But now all of these platforms _have_ to compile with PCI enabled or they'll break with:

arch/powerpc/platforms/built-in.o: In function `walnut_probe':
walnut.c:(.init.text+0x9a): undefined reference to ppc_pci_flags' walnut.c:(.init.text+0xa6): undefined reference to ppc_pci_flags' make[1]: *** [.tmp_vmlinux1] Error 1

Quoted 4 lines

So to do it correctly we need to either select CONFIG_PCI for all of them, wrap the ppc_pci_flags assignment in #ifdef CONFIG_PCI, or move the ppc_pci_flags variable declaration into something that always gets compiled.

Hrm... PCI is user selectable ? Forgot about that ...

All those platforms have PCI slots, so we may as well select it in Kconfig... I'd rather avoid #ifdef's

Ben.

#6 lore raw
Quoted 16 lines · On Fri, 14 Dec 2007 07:37:23 +1100 Benjamin Herrenschmidt…
Quoted 11 lines

This one is slightly broken in my opinion. You've added the ppc_pci_flags to all of these platforms, which is fine for your intended goal. But now all of these platforms _have_ to compile with PCI enabled or they'll break with:

arch/powerpc/platforms/built-in.o: In function `walnut_probe':
walnut.c:(.init.text+0x9a): undefined reference to ppc_pci_flags' walnut.c:(.init.text+0xa6): undefined reference to ppc_pci_flags' make[1]: *** [.tmp_vmlinux1] Error 1

Quoted 4 lines

So to do it correctly we need to either select CONFIG_PCI for all of them, wrap the ppc_pci_flags assignment in #ifdef CONFIG_PCI, or move the ppc_pci_flags variable declaration into something that always gets compiled.

Quoted 4 lines

Hrm... PCI is user selectable ? Forgot about that ...

All those platforms have PCI slots, so we may as well select it in Kconfig... I'd rather avoid #ifdef's

What about people that don't have PCI on their boards, or don't really care about it?

josh

#7 lore raw
Quoted 21 lines · Josh Boyer
Quoted 3 lines
Quoted 3 lines

This one is slightly broken in my opinion. You've added the ppc_pci_flags to all of these platforms, which is fine for

your

Quoted 1 line
Quoted 1 line

intended goal. But now all of these platforms _have_ to compile

with

Quoted 8 lines
Quoted 8 lines

PCI enabled or they'll break with:

arch/powerpc/platforms/built-in.o: In function `walnut_probe':
walnut.c:(.init.text+0x9a): undefined reference to ppc_pci_flags' walnut.c:(.init.text+0xa6): undefined reference to ppc_pci_flags' make[1]: *** [.tmp_vmlinux1] Error 1

So to do it correctly we need to either select CONFIG_PCI for all

of

Quoted 1 line
Quoted 1 line

them, wrap the ppc_pci_flags assignment in #ifdef CONFIG_PCI, or

move

Quoted 1 line
Quoted 1 line

the ppc_pci_flags variable declaration into something that always

gets

Quoted 2 lines
Quoted 1 line

compiled.

Quoted 7 lines
Quoted 4 lines

Hrm... PCI is user selectable ? Forgot about that ...

All those platforms have PCI slots, so we may as well select it in Kconfig... I'd rather avoid #ifdef's

What about people that don't have PCI on their boards, or don't really care about it?

Then those boards wouldn't be a walnut, ep405, ... right ?

That's why I put the flags in the BSP. If your board has no PCI, don't muck around with the PCI flags.

Ben.

#8 lore raw
Quoted 28 lines · On Fri, 14 Dec 2007 07:52:57 +1100 Benjamin Herrenschmidt…
Quoted 26 lines · Josh Boyer
Quoted 3 lines
Quoted 3 lines

This one is slightly broken in my opinion. You've added the ppc_pci_flags to all of these platforms, which is fine for

your

Quoted 1 line
Quoted 1 line

intended goal. But now all of these platforms _have_ to compile

with

Quoted 8 lines
Quoted 8 lines

PCI enabled or they'll break with:

arch/powerpc/platforms/built-in.o: In function `walnut_probe':
walnut.c:(.init.text+0x9a): undefined reference to ppc_pci_flags' walnut.c:(.init.text+0xa6): undefined reference to ppc_pci_flags' make[1]: *** [.tmp_vmlinux1] Error 1

So to do it correctly we need to either select CONFIG_PCI for all

of

Quoted 1 line
Quoted 1 line

them, wrap the ppc_pci_flags assignment in #ifdef CONFIG_PCI, or

move

Quoted 1 line
Quoted 1 line

the ppc_pci_flags variable declaration into something that always

gets

Quoted 6 lines
Quoted 1 line

compiled.

Hrm... PCI is user selectable ? Forgot about that ...

All those platforms have PCI slots, so we may as well select it in Kconfig... I'd rather avoid #ifdef's

Quoted 7 lines
Quoted 2 lines

What about people that don't have PCI on their boards, or don't really care about it?

Then those boards wouldn't be a walnut, ep405, ... right ?

That's why I put the flags in the BSP. If your board has no PCI, don't muck around with the PCI flags.

Well, there is physical PCI hardware on the boards, yes. But what if people have no intention of using it? E.g. they have no devices, etc. Now we're requiring PCI support to be built into the kernel.

I'm just being pedantic about keeping embedded tiny.

josh

#9 lore raw
Quoted 5 lines · Josh Boyer

Well, there is physical PCI hardware on the boards, yes. But what if people have no intention of using it? E.g. they have no devices, etc. Now we're requiring PCI support to be built into the kernel.

I'm just being pedantic about keeping embedded tiny.

Keeping your embedded design tiny (and thus your own BSP) is one thing, but adding ifdef's all over the place so that somebody can tinify an eval board, I'm less sure about this... but if you want, you can fixup my patches.

Ben.

#10 lore raw
Quoted 6 lines · On Fri, 14 Dec 2007 08:37:26 +1100 Benjamin Herrenschmidt…
Quoted 4 lines · Josh Boyer

Well, there is physical PCI hardware on the boards, yes. But what if people have no intention of using it? E.g. they have no devices, etc. Now we're requiring PCI support to be built into the kernel.

Quoted 6 lines
Quoted 1 line

I'm just being pedantic about keeping embedded tiny.

Keeping your embedded design tiny (and thus your own BSP) is one thing, but adding ifdef's all over the place so that somebody can tinify an eval board, I'm less sure about this... but if you want, you can fixup my patches.

I'm not really advocating for ifdefs. If it annoys me enough (which I doubt it will), then I'd try to come up with some way to avoid those too. For now, I think selecting PCI in Kconfig for those boards is OK.

josh

#11 lore raw
Quoted 8 lines · Josh Boyer
Quoted 4 lines

Keeping your embedded design tiny (and thus your own BSP) is one thing, but adding ifdef's all over the place so that somebody can tinify an eval board, I'm less sure about this... but if you want, you can fixup my patches.

I'm not really advocating for ifdefs. If it annoys me enough (which I doubt it will), then I'd try to come up with some way to avoid those too. For now, I think selecting PCI in Kconfig for those boards is OK.

Yes, I think it is OK to select it this way an those boards since they are evaluation boards with PCI slots.

Ciao,
Stefan

#12 lore raw
In reply to Benjamin Herrenschmidt
Quoted 10 lines · On Thu, 13 Dec 2007 18:38:46 +1100 Benjamin Herrenschmidt…

This makes 4xx embedded platforms re-assign all PCI resources as we pretty much never care about what the various firmwares have done on these, it's generally not compatible with the way the kernel will map the bridges.

We still need to also enable bus renumbering on some of them, but I will do that from a separate patch after I've fixed 4xx PCIe to handle all bus numbers.

[snip]

arch/powerpc/platforms/44x/sequoia.c line 25

Quoted 11 lines

Index: linux-work/arch/powerpc/platforms/44x/sequoia.c
===================================================================

arch/powerpc/platforms/44x/sequoia.c +2 -1
@@ -21,7 +21,8 @@
 #include <asm/udbg.h>
 #include <asm/time.h>
 #include <asm/uic.h>
-#include "44x.h"
+#include <asm/pci-bridge.h>
+

Oh, and you also broke the Sequoia build with this change because you removed the 44x.h include :).

josh

#13 lore raw
Quoted 16 lines · Josh Boyer
Quoted 10 lines · On Thu, 13 Dec 2007 18:38:46 +1100 Benjamin Herrenschmidt…

This makes 4xx embedded platforms re-assign all PCI resources as we pretty much never care about what the various firmwares have done on these, it's generally not compatible with the way the kernel will map the bridges.

We still need to also enable bus renumbering on some of them, but I will do that from a separate patch after I've fixed 4xx PCIe to handle all bus numbers.

[snip]

Quoted 14 lines

arch/powerpc/platforms/44x/sequoia.c line 25

Quoted 11 lines

Index: linux-work/arch/powerpc/platforms/44x/sequoia.c
===================================================================

arch/powerpc/platforms/44x/sequoia.c +2 -1
@@ -21,7 +21,8 @@
 #include <asm/udbg.h>
 #include <asm/time.h>
 #include <asm/uic.h>
-#include "44x.h"
+#include <asm/pci-bridge.h>
+

Oh, and you also broke the Sequoia build with this change because you removed the 44x.h include :).

Ok.

Ben.