drivers: pci: remove unused pci_sys_data structures
PATCH 1/1 drivers: pci: remove unused pci_sys_data structures
Commit b3a72384fe29 ("ARM/PCI: Replace pci_sys_data->align_resource with global function pointer") removed the struct pci_sys_data dependency from the ARM pcibios functions that are part of the common ARM PCI arch back-end (eg pcibios_align_resource()), so that struct pci_sys_data has now become data that is only used internally by the ARM bios32 layer (ie pci_common_init_dev()) and by host controllers drivers callbacks (eg pci_sys_data.setup) that rely on the ARM bios32 API to probe.
PCI host controller drivers that do not rely on ARM bios32 calls to probe do not need to have the pci_bus.sysdata pointer field pointing at a struct pci_sys_data anymore, therefore it can be removed from the respective drivers data structures.
This patch removes the pci_sys_data structures from the host controller drivers that do not rely on ARM bios32 interface to scan the PCI bus, completing the pci_sys_data clean-up and removing the related dependency on arch/arm specific data.
---
Rob,
I could not test it on versatile, only compile tested, so please have an additional look.
Tested the PCI host generic on 32-bit and 64-bit guests, through kvmtool.
Thanks,
Lorenzo
drivers/pci/host/pci-host-generic.c | 9 --------- drivers/pci/host/pci-versatile.c | 5 +---- 2 files changed, 1 insertion(+), 13 deletions(-)
drivers/pci/host/pci-host-generic.c +0 -9
@@ -38,16 +38,7 @@ struct gen_pci_cfg_windows {struct gen_pci_cfg_bus_ops *ops; }; -/* -* ARM pcibios functions expect the ARM struct pci_sys_data as the PCI -* sysdata. Add pci_sys_data as the first element in struct gen_pci so -* that when we use a gen_pci pointer as sysdata, it is also a pointer to -* a struct pci_sys_data. -*/ struct gen_pci { -#ifdef CONFIG_ARM -struct pci_sys_data sys; -#endif struct pci_host_bridge host;struct gen_pci_cfg_windows cfg;struct list_head resources;
drivers/pci/host/pci-versatile.c +1 -4
@@ -125,9 +125,6 @@ out_release_res:return err; } -/* Unused, temporary to satisfy ARM arch code */ -struct pci_sys_data sys; -static int versatile_pci_probe (struct platform_device *pdev) {struct resource *res;
@@ -208,7 +205,7 @@ static int versatile_pci_probe(struct platform_device *pdev)pci_add_flags (PCI_ENABLE_PROC_DOMAINS );pci_add_flags (PCI_REASSIGN_ALL_BUS |PCI_REASSIGN_ALL_RSRC ); - bus =pci_scan_root_bus (&pdev->dev,0 , &pci_versatile_ops, &sys, &pci_res); + bus =pci_scan_root_bus (&pdev->dev,0 , &pci_versatile_ops,NULL , &pci_res);if (!bus)return -ENOMEM ;
Signature · 1 line
2.5.1
PATCH 1/1 drivers: pci: remove unused pci_sys_data structures
Quoted 19 lines · On Monday 09 November 2015 18:57:39 Lorenzo Pieralisi wrote:
Commit
b3a72384fe29("ARM/PCI: Replacepci_sys_data->align_resourcewith global function pointer") removed the structpci_sys_datadependency from the ARM pcibios functions that are part of the common ARM PCI arch back-end (egpcibios_align_resource()), so that structpci_sys_datahas now become data that is only used internally by the ARM bios32 layer (iepci_common_init_dev()) and by host controllers drivers callbacks (eg pci_sys_data.setup) that rely on the ARM bios32 API to probe.PCI host controller drivers that do not rely on ARM bios32 calls to probe do not need to have the pci_bus.sysdata pointer field pointing at a struct
pci_sys_dataanymore, therefore it can be removed from the respective drivers data structures.This patch removes the
pci_sys_datastructures from the host controller drivers that do not rely on ARM bios32 interface to scan the PCI bus, completing thepci_sys_dataclean-up and removing the related dependency onarch/armspecific data.
Quoted 6 lines
Signed-off-by Lorenzo Pieralisi <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Will Deacon <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Rob Herring <[email protected]>
Nice!
On the downside, I just saw how b3a72384fe29 ("ARM/PCI: Replace pci_sys_data->align_resource with global function pointer") manages to get rid of the last user of this, and how this is not the way we had planned for it to be done.
It doesn't matter that much, because there is only a single user of hw->align_resource, but this is now unportable code and cannot easily be separated from hw_pci. It also breaks if we ever get a machine with two different host controllers on ARM that don't use the same pointer here.
I really would have hoped we could put that function pointer into 'struct pci_host_bridge' instead, and eventually killed off the architecture specific pcibios_align_resource function as well.
Any idea why it was done with a global function pointer for ARM rather than a proper solution?
Arnd
PATCH 1/1 drivers: pci: remove unused pci_sys_data structures
Hi Arnd
[...]
Quoted 16 lines
Nice!
Acked-by Arnd Bergmann <[email protected]>On the downside, I just saw how
b3a72384fe29("ARM/PCI: Replacepci_sys_data->align_resourcewith global function pointer") manages to get rid of the last user of this, and how this is not the way we had planned for it to be done.It doesn't matter that much, because there is only a single user of
hw->align_resource, but this is now unportable code and cannot easily be separated fromhw_pci. It also breaks if we ever get a machine with two different host controllers on ARM that don't use the same pointer here.
Quoted 4 lines
I really would have hoped we could put that function pointer into 'struct
pci_host_bridge' instead, and eventually killed off the architecture specificpcibios_align_resourcefunction as well.
say we move that in pci_host_bridge struct,
Are you suggesting to modify pcibios_init_hw to assign the align_resource function pointer at the end after pci_scan_root_bus_msi() has created the host bridge structure; then we can retrieve it in pcibios_align_resource using pci_find_host_bridge(dev->bus)....?
Quoted 3 lines
Any idea why it was done with a global function pointer for ARM rather than a proper solution?
Well just because I didn't think about the solution above...
If you think the above one can work I can send out another patch to fix this...
Many Thanks
Gab
Quoted 2 lines
Arnd
PATCH 1/1 drivers: pci: remove unused pci_sys_data structures
Quoted 18 lines · On Tuesday 10 November 2015 06:19:17 Gabriele Paoloni wrote:
Quoted 13 lines
Acked-by Arnd Bergmann <[email protected]>On the downside, I just saw how
b3a72384fe29("ARM/PCI: Replacepci_sys_data->align_resourcewith global function pointer") manages to get rid of the last user of this, and how this is not the way we had planned for it to be done.It doesn't matter that much, because there is only a single user of
hw->align_resource, but this is now unportable code and cannot easily be separated fromhw_pci. It also breaks if we ever get a machine with two different host controllers on ARM that don't use the same pointer here.Quoted 4 lines
I really would have hoped we could put that function pointer into 'struct
pci_host_bridge' instead, and eventually killed off the architecture specificpcibios_align_resourcefunction as well.
Quoted 7 lines
say we move that in
pci_host_bridgestruct,Are you suggesting to modify
pcibios_init_hwto assign thealign_resourcefunction pointer at the end afterpci_scan_root_bus_msi()has created the host bridge structure; then we can retrieve it inpcibios_align_resourceusingpci_find_host_bridge(dev->bus)....?
What I had in mind was more along the lines of removing the any mention of the align_resource callback from the ARM bios32.c code and to have the pci-mvebu driver set the pointer manually at an appropriate point (I did not look what would be that point). What you suggest above would work too, just doesn't go as far.
In the long run, I think it would be good to migrate all drivers in drivers/pci/host/ away from calling pcibios_init_hw() at all, and just use architecture-independent interfaces and leave the hw_pci/pci_sys_data based implementation for the traditional PCI host implementations that we have in arch/arm/mach-* for platforms that do not use devicetree. This is not something I'm asking you to do at this point, though any help here is appreciated.
Quoted 7 lines
Quoted 2 lines
Any idea why it was done with a global function pointer for ARM rather than a proper solution?
Well just because I didn't think about the solution above...
If you think the above one can work I can send out another patch to fix this...
That would be great, yes. As I said, it's currently harmless but it would be better to get it right.
Arnd
PATCH 1/1 drivers: pci: remove unused pci_sys_data structures
In reply to Lorenzo PieralisiQuoted 19 lines · Lorenzo Pieralisi
Commit
b3a72384fe29("ARM/PCI: Replacepci_sys_data->align_resourcewith global function pointer") removed the structpci_sys_datadependency from the ARM pcibios functions that are part of the common ARM PCI arch back-end (egpcibios_align_resource()), so that structpci_sys_datahas now become data that is only used internally by the ARM bios32 layer (iepci_common_init_dev()) and by host controllers drivers callbacks (eg pci_sys_data.setup) that rely on the ARM bios32 API to probe.PCI host controller drivers that do not rely on ARM bios32 calls to probe do not need to have the pci_bus.sysdata pointer field pointing at a struct
pci_sys_dataanymore, therefore it can be removed from the respective drivers data structures.This patch removes the
pci_sys_datastructures from the host controller drivers that do not rely on ARM bios32 interface to scan the PCI bus, completing thepci_sys_dataclean-up and removing the related dependency onarch/armspecific data.
Quoted 5 lines
Signed-off-by Lorenzo Pieralisi <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Will Deacon <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Rob Herring <[email protected]>
Applied with Arnd's ack to pci/host-generic for v4.5, thanks!
Quoted 67 lines
---
Rob,I could not test it on versatile, only compile tested, so please have an additional look.
Tested the PCI host generic on 32-bit and 64-bit guests, through kvmtool.
Thanks,
Lorenzodrivers/pci/host/pci-host-generic.c | 9 --------- drivers/pci/host/pci-versatile.c | 5 +---- 2 files changed, 1 insertion(+), 13 deletions(-)drivers/pci/host/pci-host-generic.c +0
-9@@ -38,16 +38,7 @@ struct gen_pci_cfg_windows {struct gen_pci_cfg_bus_ops *ops; }; -/* -* ARM pcibios functions expect the ARM struct pci_sys_data as the PCI -* sysdata. Add pci_sys_data as the first element in struct gen_pci so -* that when we use a gen_pci pointer as sysdata, it is also a pointer to -* a struct pci_sys_data. -*/ struct gen_pci { -#ifdef CONFIG_ARM -struct pci_sys_data sys; -#endif struct pci_host_bridge host;struct gen_pci_cfg_windows cfg;struct list_head resources;drivers/pci/host/pci-versatile.c +1
-4@@ -125,9 +125,6 @@ out_release_res:return err; } -/* Unused, temporary to satisfy ARM arch code */ -struct pci_sys_data sys; -static int versatile_pci_probe (struct platform_device *pdev) {struct resource *res;@@ -208,7 +205,7 @@ static int versatile_pci_probe(struct platform_device *pdev)pci_add_flags (PCI_ENABLE_PROC_DOMAINS );pci_add_flags (PCI_REASSIGN_ALL_BUS |PCI_REASSIGN_ALL_RSRC ); - bus =pci_scan_root_bus (&pdev->dev,0 , &pci_versatile_ops, &sys, &pci_res); + bus =pci_scan_root_bus (&pdev->dev,0 , &pci_versatile_ops,NULL , &pci_res);if (!bus)return -ENOMEM ;Signature · 6 lines
2.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html