Skip to contentSkip to conversation

xilinx-pci driver and pci in general

DISCUSSION Michal Simek 4 participants 6 messages Jan 13, 2010 – Jan 18, 2010

lore
Share & tools
lore
#0 lore raw

Hi guys,

We (John and partially I) did initial support for pci on Microblaze.
It is based on powerpc files and almost everything is the same.
There are some small differences which could be easily removed that's why I think that will be good to move that file to any generic location. That's why I would like to know your opinion about this step.
If you don't like or prefer we will add that modified versions to arch/microblaze and in future we can merge them and move to any other location.

Affected files: xilinx-pci.c, pci_32.c pci-common.c, indirect_pci.c and some headers.

The main problems are:
ppc use ppc_md struct which we don't have it on Microblaze.
xilinx-pci driver uses exclude_device function. This function is used in indirect_pci.c too. There could be a way to move that function directly to pci_controller structure which could be useful for other controllers too. What do you think?

Then there are some other ppc_md. calling like pcibios_after_init which if I see correctly not used for ppc too.

The next thing is that some files contains asm/machdep.h which could be added to asm/pci-bridge.h and the same is for asm/ppc-pci.h

Files contains CONFIG_PPC_OF and we would like to use only CONFIG_OF. I remember any discuss around but not sure what was the conclusion on powerpc.

Part of headers are the same that's why there will be a space to move them to asm-generic.
Anyway: I look at your dma-mapping.h and you can use asm-generic/dma-mapping-common.h as I am using.

Then I have some question about EARLY_PCI_OP in ppc_32.c. Is there any reason to use early_##rw##_config_##size fucntions instead of proper pci_bus_##rw##_config_##size functions? There is one comment that these functions are used before PCI scanning is done but there are used the same function as are in driver/pci/access.c.
Is there any "secret" reason to do it in this way?

Thanks for this early discuss. I would like to hear your opinion and then I will choose solution how to add our pci support to mainline.

Thanks,
Michal

Signature · 3 lines
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663
#1 lore raw
Quoted 9 lines · Michal Simek

The main problems are:
ppc use ppc_md struct which we don't have it on Microblaze. xilinx-pci driver uses exclude_device function. This function is used in indirect_pci.c too. There could be a way to move that function directly to pci_controller structure which could be useful for other controllers too. What do you think?

Then there are some other ppc_md. calling like pcibios_after_init which if I see correctly not used for ppc too.

We may not be using after_init() anymore in which case you are welcome to send a patch to remove it :-)

As for the others, well ... maybe you can do wrappers for these that call into ppc_md. on powerpc and into some kind of arch_pci_ops. that the platform provides on microblaze ?

I'm not sure moving them into the pci_controller is the best way to go there.

Quoted 2 lines

The next thing is that some files contains asm/machdep.h which could be added to asm/pci-bridge.h and the same is for asm/ppc-pci.h

Yeah, moving includes like that is ok.

Quoted 3 lines

Files contains CONFIG_PPC_OF and we would like to use only CONFIG_OF. I remember any discuss around but not sure what was the conclusion on powerpc.

I think that should be allright, Grant, any objection there ?

Quoted 2 lines

Part of headers are the same that's why there will be a space to move them to asm-generic.

If you can convince other archs that it makes sense to do so ? :-)

Quoted 2 lines

Anyway: I look at your dma-mapping.h and you can use asm-generic/dma-mapping-common.h as I am using.

Not just quite yet, there's still some stuff we need to cleanup with the !coherent cases.

Quoted 6 lines

Then I have some question about EARLY_PCI_OP in ppc_32.c. Is there any reason to use early_##rw##_config_##size fucntions instead of proper pci_bus_##rw##_config_##size functions?
There is one comment that these functions are used before PCI scanning is done but there are used the same function as are in driver/pci/access.c. Is there any "secret" reason to do it in this way?

Well, first of all, those aren't ppc32 only anymore, they are in pci-common.c now. Then, if you look at them you'll notice that they are just a wrapper on top of pci_bus_* which uses a fake pci_bus structure. IE. They are meant to be used in very early arch fixup code at a time when we may not even have the struct pci_bus at hand. Their use is pretty rare though, maybe we -could- get rid of them at some stage by moving some of that fixup code.

Quoted 2 lines

Thanks for this early discuss. I would like to hear your opinion and then I will choose solution how to add our pci support to mainline.

Cheers,
Ben.

#2 lore raw
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 6 lines · Michal Simek

The main problems are:
ppc use ppc_md struct which we don't have it on Microblaze.
xilinx-pci driver uses exclude_device function. This function is used in indirect_pci.c too. There could be a way to move that function directly to pci_controller structure which could be useful for other controllers too. What do you think?

Then there are some other ppc_md. calling like pcibios_after_init which if I see correctly not used for ppc too.

We may not be using after_init() anymore in which case you are welcome to send a patch to remove it :-)

hmm. I used older kernel and I see that in the latest version powermac use it. :-( I will just remove it.

Quoted 7 lines

As for the others, well ... maybe you can do wrappers for these that call into ppc_md. on powerpc and into some kind of arch_pci_ops. that the platform provides on microblaze ?

I'm not sure moving them into the pci_controller is the best way to go there.

ok. I will remove that part of code for now.

Quoted 5 lines
Quoted 2 lines

The next thing is that some files contains asm/machdep.h which could be added to asm/pci-bridge.h and the same is for asm/ppc-pci.h

Yeah, moving includes like that is ok.

Quoted 8 lines
Quoted 2 lines

Files contains CONFIG_PPC_OF and we would like to use only CONFIG_OF. I remember any discuss around but not sure what was the conclusion on powerpc.

I think that should be allright, Grant, any objection there ?

Quoted 1 line

Part of headers are the same that's why there will be a space to move them to asm-generic.

If you can convince other archs that it makes sense to do so ? :-)

will try.

Quoted 10 lines
Quoted 2 lines

Anyway: I look at your dma-mapping.h and you can use asm-generic/dma-mapping-common.h as I am using.

Not just quite yet, there's still some stuff we need to cleanup with the !coherent cases.

Quoted 3 lines

Then I have some question about EARLY_PCI_OP in ppc_32.c. Is there any reason to use early_##rw##_config_##size fucntions instead of proper pci_bus_##rw##_config_##size functions? There is one comment that these functions are used before PCI scanning is done but there are used the same function as are in driver/pci/access.c.
Is there any "secret" reason to do it in this way?

Quoted 7 lines

Well, first of all, those aren't ppc32 only anymore, they are in pci-common.c now. Then, if you look at them you'll notice that they are just a wrapper on top of pci_bus_* which uses a fake pci_bus structure. IE. They are meant to be used in very early arch fixup code at a time when we may not even have the struct pci_bus at hand. Their use is pretty rare though, maybe we -could- get rid of them at some stage by moving some of that fixup code.

Thanks for that.

Quoted 2 lines
Quoted 2 lines

Thanks for this early discuss. I would like to hear your opinion and then I will choose solution how to add our pci support to mainline.

I will keep you informed but I see that I will add that part of code to mainline and then we look at consolidation work.

Thanks,
Michal

Quoted 10 lines

Cheers,
Ben.

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#3 lore raw
Quoted 7 lines · Michal Simek
Quoted 3 lines · Benjamin Herrenschmidt
Quoted 2 lines · Michal Simek

Thanks for this early discuss. I would like to hear your opinion and then I will choose solution how to add our pci support to mainline.

I will keep you informed but I see that I will add that part of code to mainline and then we look at consolidation work.

As mentioned in previous email, please do it the other way around. It may seem like more work to do so, but it is less work in the long term.

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#4 lore raw
In reply to Benjamin Herrenschmidt
Quoted 12 lines · Benjamin Herrenschmidt
Quoted 9 lines · Michal Simek

The main problems are:
ppc use ppc_md struct which we don't have it on Microblaze. xilinx-pci driver uses exclude_device function. This function is used in indirect_pci.c too. There could be a way to move that function directly to pci_controller structure which could be useful for other controllers too. What do you think?

Then there are some other ppc_md. calling like pcibios_after_init which if I see correctly not used for ppc too.

Quoted 6 lines

We may not be using after_init() anymore in which case you are welcome to send a patch to remove it :-)

As for the others, well ... maybe you can do wrappers for these that call into ppc_md. on powerpc and into some kind of arch_pci_ops. that the platform provides on microblaze ?

I agree. Replace the direct ppc_md. references with arch-provided wrappers.

Quoted 5 lines
Quoted 3 lines

Files contains CONFIG_PPC_OF and we would like to use only CONFIG_OF. I remember any discuss around but not sure what was the conclusion on powerpc.

I think that should be allright, Grant, any objection there ?

None whatsoever.

Quoted 4 lines
Quoted 2 lines

Part of headers are the same that's why there will be a space to move them to asm-generic.

If you can convince other archs that it makes sense to do so ? :-)

Arnd can give you good advice here I think.

Cheers,
g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#5 lore raw
In reply to Michal Simek
Quoted 11 lines · Michal Simek

Hi guys,

We (John and partially I) did initial support for pci on Microblaze. It is based on powerpc files and almost everything is the same. There are some small differences which could be easily removed that's why I think that will be good to move that file to any generic location. That's why I would like to know your opinion about this step. If you don't like or prefer we will add that modified versions to arch/microblaze and in future we can merge them and move to any other location.

Quoted 2 lines

Affected files: xilinx-pci.c, pci_32.c pci-common.c, indirect_pci.c and some headers.

My preference is to move the common bits to a common location first, and then modify to make it suitable for Microblaze also. I've just finished doing a bunch of fdt merge work where PowerPC and Microblaze diverged in subtle ways. It isn't a whole lot of fun.

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.