Cleanup platform pci_domain_nr()
Subsystems (22)
v12 cover Cleanup platform pci_domain_nr()
This series is splitted out from previous patchset "Refine PCI scan interfaces and make generic pci host bridge". It try to clean up all platform pci_domain_nr(), save domain in pci_host_bridge, so we could get domain number from the common interface.
v11->v12:
Introduce wrap function pci_create_root_bus_generic() and pci_create_root_bus_generic() for arm/arm64 which enable CONFIG_PCI_DOMAINS_GENERIC.
Rebased this series based 4.2-rc1
Yijing Wang (10):
PCI: Save domain in pci_host_bridge
PCI: Move pci_bus_assign_domain_nr() declaration into
drivers/pci/pci.h
PCI: Remove declaration for pci_get_new_domain_nr()
PCI: Introduce pci_host_assign_domain_nr() to assign domain powerpc/PCI: Rename pcibios_root_bridge_prepare() to
pcibios_root_bus_prepare()
PCI: Make pci_host_bridge hold sysdata in drvdata
PCI: Create pci host bridge prior to root bus
PCI: Introduce common pci_domain_nr() and remove platform specific
code
PCI: Remove pci_bus_assign_domain_nr()
IA64/PCI: Fix build warning found by kbuild test
arch/alpha/include/asm/pci.h | 2 - arch/alpha/kernel/pci.c | 4 +- arch/alpha/kernel/sys_nautilus.c | 2 +- arch/arm/kernel/bios32.c | 2 +- arch/arm/mach-dove/pcie.c | 2 +- arch/arm/mach-iop13xx/pci.c | 4 +- arch/arm/mach-mv78xx0/pcie.c | 2 +- arch/arm/mach-orion5x/pci.c | 4 +- arch/frv/mb93090-mb00/pci-vdk.c | 3 +- arch/ia64/include/asm/pci.h | 1 - arch/ia64/pci/pci.c | 6 +- arch/ia64/sn/kernel/io_acpi_init.c | 6 +- arch/ia64/sn/kernel/io_init.c | 6 +- arch/m68k/coldfire/pci.c | 2 +- arch/microblaze/include/asm/pci.h | 2 - arch/microblaze/pci/pci-common.c | 15 +---- arch/mips/include/asm/pci.h | 2 - arch/mips/pci/pci.c | 4 +- arch/mn10300/unit-asb2305/pci.c | 3 +- arch/powerpc/include/asm/machdep.h | 2 +- arch/powerpc/include/asm/pci.h | 2 - arch/powerpc/kernel/pci-common.c | 21 ++----- arch/powerpc/platforms/pseries/pci.c | 2 +- arch/powerpc/platforms/pseries/pseries.h | 2 +- arch/powerpc/platforms/pseries/setup.c | 2 +- arch/s390/include/asm/pci.h | 1 - arch/s390/pci/pci.c | 10 +--- arch/sh/drivers/pci/pci.c | 4 +- arch/sh/include/asm/pci.h | 2 - arch/sparc/include/asm/pci_64.h | 1 - arch/sparc/kernel/leon_pci.c | 2 +- arch/sparc/kernel/pci.c | 21 +------ arch/sparc/kernel/pcic.c | 2 +- arch/tile/include/asm/pci.h | 2 - arch/tile/kernel/pci.c | 4 +- arch/tile/kernel/pci_gx.c | 4 +- arch/unicore32/kernel/pci.c | 2 +- arch/x86/include/asm/pci.h | 6 -- arch/x86/pci/acpi.c | 6 +- arch/x86/pci/common.c | 2 +- arch/xtensa/kernel/pci.c | 2 +- drivers/parisc/dino.c | 2 +- drivers/parisc/lba_pci.c | 2 +- drivers/pci/host/pci-versatile.c | 3 +- drivers/pci/host/pci-xgene.c | 2 +- drivers/pci/host/pcie-designware.c | 2 +- drivers/pci/host/pcie-iproc.c | 2 +- drivers/pci/host/pcie-xilinx.c | 2 +- drivers/pci/hotplug/ibmphp_core.c | 2 +- drivers/pci/pci.c | 31 ++++++++-- drivers/pci/pci.h | 1 + drivers/pci/probe.c | 92 +++++++++++++++++------------- drivers/pci/xen-pcifront.c | 2 +- include/linux/pci.h | 39 ++++++------- 54 files changed, 161 insertions(+), 195 deletions(-)
PATCH v12 1/10 PCI: Save domain in pci_host_bridge
Save domain in pci_host_bridge, so we could get domain from pci_host_bridge, and at the end of series, we could clean up the arch specific pci_domain_nr(). For arm/arm64, the domain argument is pointless, because they enable CONFIG_PCI_DOMAINS_GENERIC, PCI core would assign domain number for them, so introduce pci_create_root_bus_generic and pci_scan_root_bus_generic() which simply assign domain number to -1.
--- arch/alpha/kernel/pci.c | 4 ++-- arch/alpha/kernel/sys_nautilus.c | 2 +- arch/arm/kernel/bios32.c | 2 +- arch/arm/mach-dove/pcie.c | 2 +- arch/arm/mach-iop13xx/pci.c | 4 ++-- arch/arm/mach-mv78xx0/pcie.c | 2 +- arch/arm/mach-orion5x/pci.c | 4 ++-- arch/frv/mb93090-mb00/pci-vdk.c | 3 ++- arch/ia64/pci/pci.c | 4 ++-- arch/ia64/sn/kernel/io_init.c | 4 ++-- arch/m68k/coldfire/pci.c | 2 +- arch/microblaze/pci/pci-common.c | 4 ++-- arch/mips/pci/pci.c | 4 ++-- arch/mn10300/unit-asb2305/pci.c | 3 ++- arch/powerpc/kernel/pci-common.c | 4 ++-- arch/s390/pci/pci.c | 4 ++-- arch/sh/drivers/pci/pci.c | 4 ++-- arch/sparc/kernel/leon_pci.c | 2 +- arch/sparc/kernel/pci.c | 4 ++-- arch/sparc/kernel/pcic.c | 2 +- arch/tile/kernel/pci.c | 4 ++-- arch/tile/kernel/pci_gx.c | 4 ++-- arch/unicore32/kernel/pci.c | 2 +- arch/x86/pci/acpi.c | 4 ++-- arch/x86/pci/common.c | 2 +- arch/xtensa/kernel/pci.c | 2 +- drivers/parisc/dino.c | 2 +- drivers/parisc/lba_pci.c | 2 +- drivers/pci/host/pci-versatile.c | 3 ++- drivers/pci/host/pci-xgene.c | 2 +- drivers/pci/host/pcie-designware.c | 2 +- drivers/pci/host/pcie-iproc.c | 2 +- drivers/pci/host/pcie-xilinx.c | 2 +- drivers/pci/hotplug/ibmphp_core.c | 2 +- drivers/pci/probe.c | 21 +++++++++++++-------- drivers/pci/xen-pcifront.c | 2 +- include/linux/pci.h | 20 +++++++++++++++++--- 37 files changed, 82 insertions(+), 60 deletions(-)
arch/alpha/kernel/pci.c +2 -2
@@ -336,8 +336,8 @@ common_init_pci(void)pci_add_resource_offset (&resources, hose->mem_space, hose->mem_space->start); - bus =pci_scan_root_bus (NULL , next_busno, alpha_mv.pci_ops, - hose, &resources); + bus =pci_scan_root_bus (NULL , hose->index, next_busno, + alpha_mv.pci_ops, hose, &resources);if (!bus)continue ; hose->bus = bus;
arch/alpha/kernel/sys_nautilus.c +1 -1
@@ -205,7 +205,7 @@ nautilus_init_pci(void)unsigned long memtop = max_low_pfn <<PAGE_SHIFT ;/* Scan our single hose. */ - bus =pci_scan_bus (0 , alpha_mv.pci_ops, hose); + bus =pci_scan_bus (hose->index,0 , alpha_mv.pci_ops, hose);if (!bus)return ;
arch/arm/kernel/bios32.c +1 -1
@@ -486,7 +486,7 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,if (hw->scan) sys->bus = hw->scan (nr, sys);else - sys->bus =pci_scan_root_bus (parent, sys->busnr, + sys->bus =pci_scan_root_bus_generic (parent, sys->busnr, hw->ops, sys, &sys->resources);if (!sys->bus)
arch/arm/mach-dove/pcie.c +1 -1
@@ -160,7 +160,7 @@ dove_pcie_scan_bus(int nr, struct pci_sys_data *sys)return NULL ; } -return pci_scan_root_bus (NULL , sys->busnr, &pcie_ops, sys, +return pci_scan_root_bus_generic (NULL , sys->busnr, &pcie_ops, sys, &sys->resources); }
arch/arm/mach-iop13xx/pci.c +2 -2
@@ -535,12 +535,12 @@ struct pci_bus *iop13xx_scan_bus(int nr, struct pci_sys_data *sys)while (time_before (jiffies, atux_trhfa_timeout))udelay (100 ); - bus = pci_bus_atux =pci_scan_root_bus (NULL , sys->busnr, + bus = pci_bus_atux =pci_scan_root_bus_generic (NULL , sys->busnr, &iop13xx_atux_ops, sys, &sys->resources);break ;case IOP13XX_INIT_ATU_ATUE : - bus = pci_bus_atue =pci_scan_root_bus (NULL , sys->busnr, + bus = pci_bus_atue =pci_scan_root_bus_generic (NULL , sys->busnr, &iop13xx_atue_ops, sys, &sys->resources);break ;
arch/arm/mach-mv78xx0/pcie.c +1 -1
@@ -202,7 +202,7 @@ mv78xx0_pcie_scan_bus(int nr, struct pci_sys_data *sys)return NULL ; } -return pci_scan_root_bus (NULL , sys->busnr, &pcie_ops, sys, +return pci_scan_root_bus_generic (NULL , sys->busnr, &pcie_ops, sys, &sys->resources); }
arch/arm/mach-orion5x/pci.c +2 -2
@@ -558,11 +558,11 @@ int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys)struct pci_bus __init *orion5x_pci_sys_scan_bus (int nr,struct pci_sys_data *sys) {if (nr ==0 ) -return pci_scan_root_bus (NULL , sys->busnr, &pcie_ops, sys, +return pci_scan_root_bus_generic (NULL , sys->busnr, &pcie_ops, sys, &sys->resources);if (nr ==1 && !orion5x_pci_disabled) -return pci_scan_root_bus (NULL , sys->busnr, &pci_ops, sys, +return pci_scan_root_bus_generic (NULL , sys->busnr, &pci_ops, sys, &sys->resources);BUG ();
arch/frv/mb93090-mb00/pci-vdk.c +2 -1
@@ -384,7 +384,8 @@ int __init pcibios_init(void)printk ("PCI: Probing PCI hardware\n" );pci_add_resource (&resources, &pci_ioport_resource);pci_add_resource (&resources, &pci_iomem_resource); - bus =pci_scan_root_bus (NULL ,0 , pci_root_ops,NULL , &resources); + bus =pci_scan_root_bus (NULL ,0 ,0 , pci_root_ops,NULL , + &resources);pcibios_irq_init ();pcibios_fixup_irqs ();
arch/ia64/pci/pci.c +2 -2
@@ -462,8 +462,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)* should handle the case here, but it appears that IA64 hasn't * such quirk. So we just ignore the case now. */ - pbus =pci_create_root_bus (NULL , bus, &pci_root_ops, controller, - &info->resources); + pbus =pci_create_root_bus (NULL , domain, bus, &pci_root_ops, + controller, &info->resources);if (!pbus) {pci_free_resource_list (&info->resources);__release_pci_root_info (info);
arch/ia64/sn/kernel/io_init.c +2 -2
@@ -266,8 +266,8 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)pci_add_resource_offset (&resources, &res[1 ], prom_bussoft_ptr->bs_legacy_mem); - bus =pci_scan_root_bus (NULL , busnum, &pci_root_ops, controller, - &resources); + bus =pci_scan_root_bus (NULL , controller->segment, busnum, + &pci_root_ops, controller, &resources);if (bus ==NULL ) {kfree (res);kfree (controller);
arch/m68k/coldfire/pci.c +1 -1
@@ -312,7 +312,7 @@ static int __init mcf_pci_init(void)set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (msecs_to_jiffies (200 )); - rootbus =pci_scan_bus (0 , &mcf_pci_ops,NULL ); + rootbus =pci_scan_bus (0 ,0 , &mcf_pci_ops,NULL );if (!rootbus)return -ENODEV ;
arch/microblaze/pci/pci-common.c +2 -2
@@ -1350,8 +1350,8 @@ static void pcibios_scan_phb(struct pci_controller *hose)pcibios_setup_phb_resources (hose, &resources); - bus =pci_scan_root_bus (hose->parent, hose->first_busno, - hose->ops, hose, &resources); + bus =pci_scan_root_bus (hose->parent, hose->global_number, + hose->first_busno, hose->ops, hose, &resources);if (bus ==NULL ) {pr_err ("Failed to create bus for PCI domain %04x\n" , hose->global_number);
arch/mips/pci/pci.c +2 -2
@@ -95,8 +95,8 @@ static void pcibios_scanbus(struct pci_controller *hose) hose->io_resource, hose->io_offset);pci_add_resource_offset (&resources, hose->busn_resource, hose->busn_offset); - bus =pci_scan_root_bus (NULL , next_busno, hose->pci_ops, hose, - &resources); + bus =pci_scan_root_bus (NULL , hose->index, next_busno, + hose->pci_ops, hose, &resources); hose->bus = bus; need_domain_info = need_domain_info || hose->index;
arch/mn10300/unit-asb2305/pci.c +2 -1
@@ -372,7 +372,8 @@ static int __init pcibios_init(void)pci_add_resource_offset (&resources, &pci_ioport_resource, io_offset);pci_add_resource_offset (&resources, &pci_iomem_resource, mem_offset); - bus =pci_scan_root_bus (NULL ,0 , &pci_direct_ampci,NULL , &resources); + bus =pci_scan_root_bus (NULL ,0 ,0 , &pci_direct_ampci, +NULL , &resources);if (!bus)return 0 ;
arch/powerpc/kernel/pci-common.c +2 -2
@@ -1653,8 +1653,8 @@ void pcibios_scan_phb(struct pci_controller *hose)pci_add_resource (&resources, &hose->busn);/* Create an empty bus for the toplevel */ - bus =pci_create_root_bus (hose->parent, hose->first_busno, - hose->ops, hose, &resources); + bus =pci_create_root_bus (hose->parent, hose->global_number, + hose->first_busno, hose->ops, hose, &resources);if (bus ==NULL ) {pr_err ("Failed to create bus for PCI domain %04x\n" , hose->global_number);
arch/s390/pci/pci.c +2 -2
@@ -779,8 +779,8 @@ static int zpci_scan_bus(struct zpci_dev *zdev)if (ret)return ret; - zdev->bus =pci_scan_root_bus (NULL ,ZPCI_BUS_NR , &pci_root_ops, - zdev, &resources); + zdev->bus =pci_scan_root_bus (NULL , zdev->domain,ZPCI_BUS_NR , + &pci_root_ops, zdev, &resources);if (!zdev->bus) {zpci_cleanup_bus_resources (zdev);return -EIO ;
arch/sh/drivers/pci/pci.c +2 -2
@@ -52,8 +52,8 @@ static void pcibios_scanbus(struct pci_channel *hose)pci_add_resource_offset (&resources, res, offset); } - bus =pci_scan_root_bus (NULL , next_busno, hose->pci_ops, hose, - &resources); + bus =pci_scan_root_bus (NULL , hose->index, next_busno, + hose->pci_ops, hose, &resources); hose->bus = bus; need_domain_info = need_domain_info || hose->index;
arch/sparc/kernel/leon_pci.c +1 -1
@@ -32,7 +32,7 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info) info->busn.flags =IORESOURCE_BUS ;pci_add_resource (&resources, &info->busn); - root_bus =pci_scan_root_bus (&ofdev->dev,0 , info->ops, info, + root_bus =pci_scan_root_bus (&ofdev->dev,0 ,0 , info->ops, info, &resources);if (!root_bus) {pci_free_resource_list (&resources);
arch/sparc/kernel/pci.c +2 -2
@@ -664,8 +664,8 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, pbm->busn.end = pbm->pci_last_busno; pbm->busn.flags =IORESOURCE_BUS ;pci_add_resource (&resources, &pbm->busn); - bus =pci_create_root_bus (parent, pbm->pci_first_busno, pbm->pci_ops, - pbm, &resources); + bus =pci_create_root_bus (parent, pbm->index, pbm->pci_first_busno, + pbm->pci_ops, pbm, &resources);if (!bus) {printk (KERN_ERR "Failed to create bus for %s\n" , node->full_name);
arch/sparc/kernel/pcic.c +1 -1
@@ -390,7 +390,7 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic) {struct linux_pbm_info *pbm = &pcic->pbm; - pbm->pci_bus =pci_scan_bus (pbm->pci_first_busno, &pcic_ops, pbm); + pbm->pci_bus =pci_scan_bus (0 , pbm->pci_first_busno, &pcic_ops, pbm);if (!pbm->pci_bus)return ;
arch/tile/kernel/pci.c +2 -2
@@ -306,8 +306,8 @@ int __init pcibios_init(void)pci_add_resource (&resources, &ioport_resource);pci_add_resource (&resources, &iomem_resource); - bus =pci_scan_root_bus (NULL ,0 , controller->ops, - controller, &resources); + bus =pci_scan_root_bus (NULL , controller->index,0 , + controller->ops, controller, &resources); controller->root_bus = bus; controller->last_busno = bus->busn_res.end; }
arch/tile/kernel/pci_gx.c +2 -2
@@ -881,8 +881,8 @@ int __init pcibios_init(void) controller->mem_offset);pci_add_resource (&resources, &controller->io_space); controller->first_busno = next_busno; - bus =pci_scan_root_bus (NULL , next_busno, controller->ops, - controller, &resources); + bus =pci_scan_root_bus (NULL , controller->index, next_busno, + controller->ops, controller, &resources); controller->root_bus = bus; next_busno = bus->busn_res.end +1 ; }
arch/unicore32/kernel/pci.c +1 -1
@@ -258,7 +258,7 @@ static int __init pci_common_init(void)pci_puv3_preinit (); - puv3_bus =pci_scan_bus (0 , &pci_puv3_ops,NULL ); + puv3_bus =pci_scan_bus (0 ,0 , &pci_puv3_ops,NULL );if (!puv3_bus)panic ("PCI: unable to scan bus!" );
arch/x86/pci/acpi.c +2 -2
@@ -463,8 +463,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)if (!setup_mcfg_map (info, domain, (u8 )root->secondary.start, (u8 )root->secondary.end, root->mcfg_addr)) - bus =pci_create_root_bus (NULL , busnum, &pci_root_ops, - sd, &resources); + bus =pci_create_root_bus (NULL , domain, busnum, + &pci_root_ops, sd, &resources);if (bus) {pci_scan_child_bus (bus);
arch/x86/pci/common.c +1 -1
@@ -486,7 +486,7 @@ void pcibios_scan_root(int busnum) sd->node =x86_pci_root_bus_node (busnum);x86_pci_root_bus_resources (busnum, &resources);printk (KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n" , busnum); - bus =pci_scan_root_bus (NULL , busnum, &pci_root_ops, sd, &resources); + bus =pci_scan_root_bus (NULL ,0 , busnum, &pci_root_ops, sd, &resources);if (!bus) {pci_free_resource_list (&resources);kfree (sd);
arch/xtensa/kernel/pci.c +1 -1
@@ -183,7 +183,7 @@ static int __init pcibios_init(void) pci_ctrl->last_busno =0xff ;INIT_LIST_HEAD (&resources);pci_controller_apertures (pci_ctrl, &resources); - bus =pci_scan_root_bus (NULL , pci_ctrl->first_busno, + bus =pci_scan_root_bus (NULL ,0 , pci_ctrl->first_busno, pci_ctrl->ops, pci_ctrl, &resources);if (!bus)continue ;
drivers/parisc/dino.c +1 -1
@@ -986,7 +986,7 @@ static int __init dino_probe(struct parisc_device *dev)** with configuration accessor functions. */ dino_dev->hba.hba_bus = bus =pci_create_root_bus (&dev->dev, - dino_current_bus, &dino_cfg_ops,NULL , &resources); +0 , dino_current_bus, &dino_cfg_ops,NULL , &resources);if (!bus) {printk (KERN_ERR "ERROR: failed to scan PCI bus on %s (duplicate bus number %d?)\n" ,dev_name (&dev->dev), dino_current_bus);
drivers/parisc/lba_pci.c +1 -1
@@ -1563,7 +1563,7 @@ lba_driver_probe(struct parisc_device *dev) dev->dev.platform_data = lba_dev; lba_bus = lba_dev->hba.hba_bus = -pci_create_root_bus (&dev->dev, lba_dev->hba.bus_num.start, +pci_create_root_bus (&dev->dev,0 , lba_dev->hba.bus_num.start, cfg_ops,NULL , &resources);if (!lba_bus) {pci_free_resource_list (&resources);
drivers/pci/host/pci-versatile.c +2 -1
@@ -208,7 +208,8 @@ 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_generic (&pdev->dev,0 , &pci_versatile_ops, + &sys, &pci_res);if (!bus)return -ENOMEM ;
drivers/pci/host/pci-xgene.c +1 -1
@@ -553,7 +553,7 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)if (ret)return ret; - bus =pci_create_root_bus (&pdev->dev,0 , + bus =pci_create_root_bus_generic (&pdev->dev,0 , &xgene_pcie_ops, port, &res);if (!bus)return -ENOMEM ;
drivers/pci/host/pcie-designware.c +1 -1
@@ -708,7 +708,7 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)struct pcie_port *pp =sys_to_pcie (sys); pp->root_bus_nr = sys->busnr; - bus =pci_scan_root_bus (pp->dev, sys->busnr, + bus =pci_scan_root_bus_generic (pp->dev, sys->busnr, &dw_pcie_ops, sys, &sys->resources);if (!bus)return NULL ;
drivers/pci/host/pcie-iproc.c +1 -1
@@ -210,7 +210,7 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res) pcie->sysdata.private_data = pcie; - bus =pci_create_root_bus (pcie->dev,0 , &iproc_pcie_ops, + bus =pci_create_root_bus_generic (pcie->dev,0 , &iproc_pcie_ops, &pcie->sysdata, res);if (!bus) {dev_err (pcie->dev,"unable to create PCI root bus\n" );
drivers/pci/host/pcie-xilinx.c +1 -1
@@ -647,7 +647,7 @@ static struct pci_bus *xilinx_pcie_scan_bus(int nr, struct pci_sys_data *sys)struct pci_bus *bus; port->root_busno = sys->busnr; - bus =pci_scan_root_bus (port->dev, sys->busnr, &xilinx_pcie_ops, + bus =pci_scan_root_bus_generic (port->dev, sys->busnr, &xilinx_pcie_ops, sys, &sys->resources);return bus;
drivers/pci/hotplug/ibmphp_core.c +1 -1
@@ -765,7 +765,7 @@ static u8 bus_structure_fixup(u8 busno) (l != 0x0000) && (l != 0xffff)) {debug ("%s - Inside bus_structure_fixup()\n" , __func__); - b =pci_scan_bus (busno, ibmphp_pci_bus->ops,NULL ); + b =pci_scan_bus (0 , busno, ibmphp_pci_bus->ops,NULL );if (!b)continue ;
drivers/pci/probe.c +13 -8
@@ -1927,8 +1927,9 @@ void __weak pcibios_remove_bus(struct pci_bus *bus) { } -struct pci_bus *pci_create_root_bus (struct device *parent,int bus, -struct pci_ops *ops,void *sysdata,struct list_head *resources) +struct pci_bus *pci_create_root_bus (struct device *parent,int domain, +int bus,struct pci_ops *ops,void *sysdata, +struct list_head *resources) {int error;struct pci_host_bridge *bridge;
@@ -1958,6 +1959,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,if (!bridge) goto err_out; + bridge->domain = domain; bridge->dev.parent = parent; bridge->dev.release = pci_release_host_bridge_dev;dev_set_name (&bridge->dev,"pci%04x:%02x" ,pci_domain_nr (b), bus);
@@ -2096,8 +2098,9 @@ void pci_bus_release_busn_res(struct pci_bus *b) res, ret ? "can not be" : "is"); } -struct pci_bus *pci_scan_root_bus (struct device *parent,int bus, -struct pci_ops *ops,void *sysdata,struct list_head *resources) +struct pci_bus *pci_scan_root_bus (struct device *parent,int domain, +int bus,struct pci_ops *ops,void *sysdata, +struct list_head *resources) {struct resource_entry *window;bool found = false;
@@ -2110,7 +2113,8 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,break ; } - b =pci_create_root_bus (parent, bus, ops, sysdata, resources); + b =pci_create_root_bus (parent, domain, bus, ops, + sysdata, resources);if (!b)return NULL ;
@@ -2130,8 +2134,8 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, }EXPORT_SYMBOL (pci_scan_root_bus); -struct pci_bus *pci_scan_bus (int bus,struct pci_ops *ops, -void *sysdata) +struct pci_bus *pci_scan_bus (int domain,int bus, +struct pci_ops *ops,void *sysdata) {LIST_HEAD (resources);struct pci_bus *b;
@@ -2139,7 +2143,8 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,pci_add_resource (&resources, &ioport_resource);pci_add_resource (&resources, &iomem_resource);pci_add_resource (&resources, &busn_resource); - b =pci_create_root_bus (NULL , bus, ops, sysdata, &resources); + b =pci_create_root_bus (NULL , domain, bus, ops, sysdata, + &resources);if (b) {pci_scan_child_bus (b); }else {
drivers/pci/xen-pcifront.c +1 -1
@@ -481,7 +481,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,pci_lock_rescan_remove (); - b =pci_scan_root_bus (&pdev->xdev->dev, bus, + b =pci_scan_root_bus (&pdev->xdev->dev, sd->domain, bus, &pcifront_bus_ops, sd, &resources);if (!b) { dev_err(&pdev->xdev->dev,
include/linux/pci.h +17 -3
@@ -402,6 +402,7 @@ static inline int pci_channel_offline(struct pci_dev *pdev) }struct pci_host_bridge { +int domain;struct device dev;struct pci_bus *bus;/* root bus */ struct list_head windows;/* resource_entry */
@@ -780,16 +781,29 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,void pcibios_scan_specific_bus (int busn);struct pci_bus *pci_find_bus (int domain,int busnr);void pci_bus_add_devices (const struct pci_bus *bus); -struct pci_bus *pci_scan_bus (int bus,struct pci_ops *ops,void *sysdata); -struct pci_bus *pci_create_root_bus (struct device *parent,int bus, +struct pci_bus *pci_scan_bus (int domain,int bus,struct pci_ops *ops, +void *sysdata); +struct pci_bus *pci_create_root_bus (struct device *parent,int domain,int bus,struct pci_ops *ops,void *sysdata,struct list_head *resources); +static inline struct pci_bus *pci_create_root_bus_generic ( +struct device *parent,int bus,struct pci_ops *ops, +void *sysdata,struct list_head *resources) +{ +return pci_create_root_bus (parent,-1 , bus, ops, sysdata, resources); +}int pci_bus_insert_busn_res (struct pci_bus *b,int bus,int busmax);int pci_bus_update_busn_res_end (struct pci_bus *b,int busmax);void pci_bus_release_busn_res (struct pci_bus *b); -struct pci_bus *pci_scan_root_bus (struct device *parent,int bus, +struct pci_bus *pci_scan_root_bus (struct device *parent,int domain,int bus,struct pci_ops *ops,void *sysdata,struct list_head *resources); +static inline struct pci_bus *pci_scan_root_bus_generic ( +struct device *parent,int bus,struct pci_ops *ops, +void *sysdata,struct list_head *resources) +{ +return pci_scan_root_bus (parent,-1 , bus, ops, sysdata, resources); +}struct pci_bus *pci_add_new_bus (struct pci_bus *parent,struct pci_dev *dev,int busnr);void pcie_update_link_speed (struct pci_bus *bus,u16 link_status);
Signature · 1 line
1.7.1
PATCH v12 1/10 PCI: Save domain in pci_host_bridge
In reply to Yijing WangSave domain in pci_host_bridge, so we could get domain from pci_host_bridge, and at the end of series, we could clean up the arch specific pci_domain_nr(). For arm/arm64, the domain argument is pointless, because they enable CONFIG_PCI_DOMAINS_GENERIC, PCI core would assign domain number for them, so introduce pci_create_root_bus_generic and pci_scan_root_bus_generic() which simply assign domain number to -1.
--- arch/alpha/kernel/pci.c | 4 ++-- arch/alpha/kernel/sys_nautilus.c | 2 +- arch/arm/kernel/bios32.c | 2 +- arch/arm/mach-dove/pcie.c | 2 +- arch/arm/mach-iop13xx/pci.c | 4 ++-- arch/arm/mach-mv78xx0/pcie.c | 2 +- arch/arm/mach-orion5x/pci.c | 4 ++-- arch/frv/mb93090-mb00/pci-vdk.c | 3 ++- arch/ia64/pci/pci.c | 4 ++-- arch/ia64/sn/kernel/io_init.c | 4 ++-- arch/m68k/coldfire/pci.c | 2 +- arch/microblaze/pci/pci-common.c | 4 ++-- arch/mips/pci/pci.c | 4 ++-- arch/mn10300/unit-asb2305/pci.c | 3 ++- arch/powerpc/kernel/pci-common.c | 4 ++-- arch/s390/pci/pci.c | 4 ++-- arch/sh/drivers/pci/pci.c | 4 ++-- arch/sparc/kernel/leon_pci.c | 2 +- arch/sparc/kernel/pci.c | 4 ++-- arch/sparc/kernel/pcic.c | 2 +- arch/tile/kernel/pci.c | 4 ++-- arch/tile/kernel/pci_gx.c | 4 ++-- arch/unicore32/kernel/pci.c | 2 +- arch/x86/pci/acpi.c | 4 ++-- arch/x86/pci/common.c | 2 +- arch/xtensa/kernel/pci.c | 2 +- drivers/parisc/dino.c | 2 +- drivers/parisc/lba_pci.c | 2 +- drivers/pci/host/pci-versatile.c | 3 ++- drivers/pci/host/pci-xgene.c | 2 +- drivers/pci/host/pcie-designware.c | 2 +- drivers/pci/host/pcie-iproc.c | 2 +- drivers/pci/host/pcie-xilinx.c | 2 +- drivers/pci/hotplug/ibmphp_core.c | 2 +- drivers/pci/probe.c | 21 +++++++++++++-------- drivers/pci/xen-pcifront.c | 2 +- include/linux/pci.h | 20 +++++++++++++++++--- 37 files changed, 82 insertions(+), 60 deletions(-)
arch/alpha/kernel/pci.c +2 -2
@@ -336,8 +336,8 @@ common_init_pci(void)pci_add_resource_offset (&resources, hose->mem_space, hose->mem_space->start); - bus =pci_scan_root_bus (NULL , next_busno, alpha_mv.pci_ops, - hose, &resources); + bus =pci_scan_root_bus (NULL , hose->index, next_busno, + alpha_mv.pci_ops, hose, &resources);if (!bus)continue ; hose->bus = bus;
arch/alpha/kernel/sys_nautilus.c +1 -1
@@ -205,7 +205,7 @@ nautilus_init_pci(void)unsigned long memtop = max_low_pfn <<PAGE_SHIFT ;/* Scan our single hose. */ - bus =pci_scan_bus (0 , alpha_mv.pci_ops, hose); + bus =pci_scan_bus (hose->index,0 , alpha_mv.pci_ops, hose);if (!bus)return ;
arch/arm/kernel/bios32.c +1 -1
@@ -486,7 +486,7 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,if (hw->scan) sys->bus = hw->scan (nr, sys);else - sys->bus =pci_scan_root_bus (parent, sys->busnr, + sys->bus =pci_scan_root_bus_generic (parent, sys->busnr, hw->ops, sys, &sys->resources);if (!sys->bus)
arch/arm/mach-dove/pcie.c +1 -1
@@ -160,7 +160,7 @@ dove_pcie_scan_bus(int nr, struct pci_sys_data *sys)return NULL ; } -return pci_scan_root_bus (NULL , sys->busnr, &pcie_ops, sys, +return pci_scan_root_bus_generic (NULL , sys->busnr, &pcie_ops, sys, &sys->resources); }
arch/arm/mach-iop13xx/pci.c +2 -2
@@ -535,12 +535,12 @@ struct pci_bus *iop13xx_scan_bus(int nr, struct pci_sys_data *sys)while (time_before (jiffies, atux_trhfa_timeout))udelay (100 ); - bus = pci_bus_atux =pci_scan_root_bus (NULL , sys->busnr, + bus = pci_bus_atux =pci_scan_root_bus_generic (NULL , sys->busnr, &iop13xx_atux_ops, sys, &sys->resources);break ;case IOP13XX_INIT_ATU_ATUE : - bus = pci_bus_atue =pci_scan_root_bus (NULL , sys->busnr, + bus = pci_bus_atue =pci_scan_root_bus_generic (NULL , sys->busnr, &iop13xx_atue_ops, sys, &sys->resources);break ;
arch/arm/mach-mv78xx0/pcie.c +1 -1
@@ -202,7 +202,7 @@ mv78xx0_pcie_scan_bus(int nr, struct pci_sys_data *sys)return NULL ; } -return pci_scan_root_bus (NULL , sys->busnr, &pcie_ops, sys, +return pci_scan_root_bus_generic (NULL , sys->busnr, &pcie_ops, sys, &sys->resources); }
arch/arm/mach-orion5x/pci.c +2 -2
@@ -558,11 +558,11 @@ int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys)struct pci_bus __init *orion5x_pci_sys_scan_bus (int nr,struct pci_sys_data *sys) {if (nr ==0 ) -return pci_scan_root_bus (NULL , sys->busnr, &pcie_ops, sys, +return pci_scan_root_bus_generic (NULL , sys->busnr, &pcie_ops, sys, &sys->resources);if (nr ==1 && !orion5x_pci_disabled) -return pci_scan_root_bus (NULL , sys->busnr, &pci_ops, sys, +return pci_scan_root_bus_generic (NULL , sys->busnr, &pci_ops, sys, &sys->resources);BUG ();
arch/frv/mb93090-mb00/pci-vdk.c +2 -1
@@ -384,7 +384,8 @@ int __init pcibios_init(void)printk ("PCI: Probing PCI hardware\n" );pci_add_resource (&resources, &pci_ioport_resource);pci_add_resource (&resources, &pci_iomem_resource); - bus =pci_scan_root_bus (NULL ,0 , pci_root_ops,NULL , &resources); + bus =pci_scan_root_bus (NULL ,0 ,0 , pci_root_ops,NULL , + &resources);pcibios_irq_init ();pcibios_fixup_irqs ();
arch/ia64/pci/pci.c +2 -2
@@ -462,8 +462,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)* should handle the case here, but it appears that IA64 hasn't * such quirk. So we just ignore the case now. */ - pbus =pci_create_root_bus (NULL , bus, &pci_root_ops, controller, - &info->resources); + pbus =pci_create_root_bus (NULL , domain, bus, &pci_root_ops, + controller, &info->resources);if (!pbus) {pci_free_resource_list (&info->resources);__release_pci_root_info (info);
arch/ia64/sn/kernel/io_init.c +2 -2
@@ -266,8 +266,8 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)pci_add_resource_offset (&resources, &res[1 ], prom_bussoft_ptr->bs_legacy_mem); - bus =pci_scan_root_bus (NULL , busnum, &pci_root_ops, controller, - &resources); + bus =pci_scan_root_bus (NULL , controller->segment, busnum, + &pci_root_ops, controller, &resources);if (bus ==NULL ) {kfree (res);kfree (controller);
arch/m68k/coldfire/pci.c +1 -1
@@ -312,7 +312,7 @@ static int __init mcf_pci_init(void)set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (msecs_to_jiffies (200 )); - rootbus =pci_scan_bus (0 , &mcf_pci_ops,NULL ); + rootbus =pci_scan_bus (0 ,0 , &mcf_pci_ops,NULL );if (!rootbus)return -ENODEV ;
arch/microblaze/pci/pci-common.c +2 -2
@@ -1350,8 +1350,8 @@ static void pcibios_scan_phb(struct pci_controller *hose)pcibios_setup_phb_resources (hose, &resources); - bus =pci_scan_root_bus (hose->parent, hose->first_busno, - hose->ops, hose, &resources); + bus =pci_scan_root_bus (hose->parent, hose->global_number, + hose->first_busno, hose->ops, hose, &resources);if (bus ==NULL ) {pr_err ("Failed to create bus for PCI domain %04x\n" , hose->global_number);
arch/mips/pci/pci.c +2 -2
@@ -95,8 +95,8 @@ static void pcibios_scanbus(struct pci_controller *hose) hose->io_resource, hose->io_offset);pci_add_resource_offset (&resources, hose->busn_resource, hose->busn_offset); - bus =pci_scan_root_bus (NULL , next_busno, hose->pci_ops, hose, - &resources); + bus =pci_scan_root_bus (NULL , hose->index, next_busno, + hose->pci_ops, hose, &resources); hose->bus = bus; need_domain_info = need_domain_info || hose->index;
arch/mn10300/unit-asb2305/pci.c +2 -1
@@ -372,7 +372,8 @@ static int __init pcibios_init(void)pci_add_resource_offset (&resources, &pci_ioport_resource, io_offset);pci_add_resource_offset (&resources, &pci_iomem_resource, mem_offset); - bus =pci_scan_root_bus (NULL ,0 , &pci_direct_ampci,NULL , &resources); + bus =pci_scan_root_bus (NULL ,0 ,0 , &pci_direct_ampci, +NULL , &resources);if (!bus)return 0 ;
arch/powerpc/kernel/pci-common.c +2 -2
@@ -1653,8 +1653,8 @@ void pcibios_scan_phb(struct pci_controller *hose)pci_add_resource (&resources, &hose->busn);/* Create an empty bus for the toplevel */ - bus =pci_create_root_bus (hose->parent, hose->first_busno, - hose->ops, hose, &resources); + bus =pci_create_root_bus (hose->parent, hose->global_number, + hose->first_busno, hose->ops, hose, &resources);if (bus ==NULL ) {pr_err ("Failed to create bus for PCI domain %04x\n" , hose->global_number);
arch/s390/pci/pci.c +2 -2
@@ -779,8 +779,8 @@ static int zpci_scan_bus(struct zpci_dev *zdev)if (ret)return ret; - zdev->bus =pci_scan_root_bus (NULL ,ZPCI_BUS_NR , &pci_root_ops, - zdev, &resources); + zdev->bus =pci_scan_root_bus (NULL , zdev->domain,ZPCI_BUS_NR , + &pci_root_ops, zdev, &resources);if (!zdev->bus) {zpci_cleanup_bus_resources (zdev);return -EIO ;
arch/sh/drivers/pci/pci.c +2 -2
@@ -52,8 +52,8 @@ static void pcibios_scanbus(struct pci_channel *hose)pci_add_resource_offset (&resources, res, offset); } - bus =pci_scan_root_bus (NULL , next_busno, hose->pci_ops, hose, - &resources); + bus =pci_scan_root_bus (NULL , hose->index, next_busno, + hose->pci_ops, hose, &resources); hose->bus = bus; need_domain_info = need_domain_info || hose->index;
arch/sparc/kernel/leon_pci.c +1 -1
@@ -32,7 +32,7 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info) info->busn.flags =IORESOURCE_BUS ;pci_add_resource (&resources, &info->busn); - root_bus =pci_scan_root_bus (&ofdev->dev,0 , info->ops, info, + root_bus =pci_scan_root_bus (&ofdev->dev,0 ,0 , info->ops, info, &resources);if (!root_bus) {pci_free_resource_list (&resources);
arch/sparc/kernel/pci.c +2 -2
@@ -664,8 +664,8 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, pbm->busn.end = pbm->pci_last_busno; pbm->busn.flags =IORESOURCE_BUS ;pci_add_resource (&resources, &pbm->busn); - bus =pci_create_root_bus (parent, pbm->pci_first_busno, pbm->pci_ops, - pbm, &resources); + bus =pci_create_root_bus (parent, pbm->index, pbm->pci_first_busno, + pbm->pci_ops, pbm, &resources);if (!bus) {printk (KERN_ERR "Failed to create bus for %s\n" , node->full_name);
arch/sparc/kernel/pcic.c +1 -1
@@ -390,7 +390,7 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic) {struct linux_pbm_info *pbm = &pcic->pbm; - pbm->pci_bus =pci_scan_bus (pbm->pci_first_busno, &pcic_ops, pbm); + pbm->pci_bus =pci_scan_bus (0 , pbm->pci_first_busno, &pcic_ops, pbm);if (!pbm->pci_bus)return ;
arch/tile/kernel/pci.c +2 -2
@@ -306,8 +306,8 @@ int __init pcibios_init(void)pci_add_resource (&resources, &ioport_resource);pci_add_resource (&resources, &iomem_resource); - bus =pci_scan_root_bus (NULL ,0 , controller->ops, - controller, &resources); + bus =pci_scan_root_bus (NULL , controller->index,0 , + controller->ops, controller, &resources); controller->root_bus = bus; controller->last_busno = bus->busn_res.end; }
arch/tile/kernel/pci_gx.c +2 -2
@@ -881,8 +881,8 @@ int __init pcibios_init(void) controller->mem_offset);pci_add_resource (&resources, &controller->io_space); controller->first_busno = next_busno; - bus =pci_scan_root_bus (NULL , next_busno, controller->ops, - controller, &resources); + bus =pci_scan_root_bus (NULL , controller->index, next_busno, + controller->ops, controller, &resources); controller->root_bus = bus; next_busno = bus->busn_res.end +1 ; }
arch/unicore32/kernel/pci.c +1 -1
@@ -258,7 +258,7 @@ static int __init pci_common_init(void)pci_puv3_preinit (); - puv3_bus =pci_scan_bus (0 , &pci_puv3_ops,NULL ); + puv3_bus =pci_scan_bus (0 ,0 , &pci_puv3_ops,NULL );if (!puv3_bus)panic ("PCI: unable to scan bus!" );
arch/x86/pci/acpi.c +2 -2
@@ -463,8 +463,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)if (!setup_mcfg_map (info, domain, (u8 )root->secondary.start, (u8 )root->secondary.end, root->mcfg_addr)) - bus =pci_create_root_bus (NULL , busnum, &pci_root_ops, - sd, &resources); + bus =pci_create_root_bus (NULL , domain, busnum, + &pci_root_ops, sd, &resources);if (bus) {pci_scan_child_bus (bus);
arch/x86/pci/common.c +1 -1
@@ -486,7 +486,7 @@ void pcibios_scan_root(int busnum) sd->node =x86_pci_root_bus_node (busnum);x86_pci_root_bus_resources (busnum, &resources);printk (KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n" , busnum); - bus =pci_scan_root_bus (NULL , busnum, &pci_root_ops, sd, &resources); + bus =pci_scan_root_bus (NULL ,0 , busnum, &pci_root_ops, sd, &resources);if (!bus) {pci_free_resource_list (&resources);kfree (sd);
arch/xtensa/kernel/pci.c +1 -1
@@ -183,7 +183,7 @@ static int __init pcibios_init(void) pci_ctrl->last_busno =0xff ;INIT_LIST_HEAD (&resources);pci_controller_apertures (pci_ctrl, &resources); - bus =pci_scan_root_bus (NULL , pci_ctrl->first_busno, + bus =pci_scan_root_bus (NULL ,0 , pci_ctrl->first_busno, pci_ctrl->ops, pci_ctrl, &resources);if (!bus)continue ;
drivers/parisc/dino.c +1 -1
@@ -986,7 +986,7 @@ static int __init dino_probe(struct parisc_device *dev)** with configuration accessor functions. */ dino_dev->hba.hba_bus = bus =pci_create_root_bus (&dev->dev, - dino_current_bus, &dino_cfg_ops,NULL , &resources); +0 , dino_current_bus, &dino_cfg_ops,NULL , &resources);if (!bus) {printk (KERN_ERR "ERROR: failed to scan PCI bus on %s (duplicate bus number %d?)\n" ,dev_name (&dev->dev), dino_current_bus);
drivers/parisc/lba_pci.c +1 -1
@@ -1563,7 +1563,7 @@ lba_driver_probe(struct parisc_device *dev) dev->dev.platform_data = lba_dev; lba_bus = lba_dev->hba.hba_bus = -pci_create_root_bus (&dev->dev, lba_dev->hba.bus_num.start, +pci_create_root_bus (&dev->dev,0 , lba_dev->hba.bus_num.start, cfg_ops,NULL , &resources);if (!lba_bus) {pci_free_resource_list (&resources);
drivers/pci/host/pci-versatile.c +2 -1
@@ -208,7 +208,8 @@ 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_generic (&pdev->dev,0 , &pci_versatile_ops, + &sys, &pci_res);if (!bus)return -ENOMEM ;
drivers/pci/host/pci-xgene.c +1 -1
@@ -553,7 +553,7 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)if (ret)return ret; - bus =pci_create_root_bus (&pdev->dev,0 , + bus =pci_create_root_bus_generic (&pdev->dev,0 , &xgene_pcie_ops, port, &res);if (!bus)return -ENOMEM ;
drivers/pci/host/pcie-designware.c +1 -1
@@ -708,7 +708,7 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)struct pcie_port *pp =sys_to_pcie (sys); pp->root_bus_nr = sys->busnr; - bus =pci_scan_root_bus (pp->dev, sys->busnr, + bus =pci_scan_root_bus_generic (pp->dev, sys->busnr, &dw_pcie_ops, sys, &sys->resources);if (!bus)return NULL ;
drivers/pci/host/pcie-iproc.c +1 -1
@@ -210,7 +210,7 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res) pcie->sysdata.private_data = pcie; - bus =pci_create_root_bus (pcie->dev,0 , &iproc_pcie_ops, + bus =pci_create_root_bus_generic (pcie->dev,0 , &iproc_pcie_ops, &pcie->sysdata, res);if (!bus) {dev_err (pcie->dev,"unable to create PCI root bus\n" );
drivers/pci/host/pcie-xilinx.c +1 -1
@@ -647,7 +647,7 @@ static struct pci_bus *xilinx_pcie_scan_bus(int nr, struct pci_sys_data *sys)struct pci_bus *bus; port->root_busno = sys->busnr; - bus =pci_scan_root_bus (port->dev, sys->busnr, &xilinx_pcie_ops, + bus =pci_scan_root_bus_generic (port->dev, sys->busnr, &xilinx_pcie_ops, sys, &sys->resources);return bus;
drivers/pci/hotplug/ibmphp_core.c +1 -1
@@ -765,7 +765,7 @@ static u8 bus_structure_fixup(u8 busno) (l != 0x0000) && (l != 0xffff)) {debug ("%s - Inside bus_structure_fixup()\n" , __func__); - b =pci_scan_bus (busno, ibmphp_pci_bus->ops,NULL ); + b =pci_scan_bus (0 , busno, ibmphp_pci_bus->ops,NULL );if (!b)continue ;
drivers/pci/probe.c +13 -8
@@ -1927,8 +1927,9 @@ void __weak pcibios_remove_bus(struct pci_bus *bus) { } -struct pci_bus *pci_create_root_bus (struct device *parent,int bus, -struct pci_ops *ops,void *sysdata,struct list_head *resources) +struct pci_bus *pci_create_root_bus (struct device *parent,int domain, +int bus,struct pci_ops *ops,void *sysdata, +struct list_head *resources) {int error;struct pci_host_bridge *bridge;
@@ -1958,6 +1959,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,if (!bridge) goto err_out; + bridge->domain = domain; bridge->dev.parent = parent; bridge->dev.release = pci_release_host_bridge_dev;dev_set_name (&bridge->dev,"pci%04x:%02x" ,pci_domain_nr (b), bus);
@@ -2096,8 +2098,9 @@ void pci_bus_release_busn_res(struct pci_bus *b) res, ret ? "can not be" : "is"); } -struct pci_bus *pci_scan_root_bus (struct device *parent,int bus, -struct pci_ops *ops,void *sysdata,struct list_head *resources) +struct pci_bus *pci_scan_root_bus (struct device *parent,int domain, +int bus,struct pci_ops *ops,void *sysdata, +struct list_head *resources) {struct resource_entry *window;bool found = false;
@@ -2110,7 +2113,8 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,break ; } - b =pci_create_root_bus (parent, bus, ops, sysdata, resources); + b =pci_create_root_bus (parent, domain, bus, ops, + sysdata, resources);if (!b)return NULL ;
@@ -2130,8 +2134,8 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, }EXPORT_SYMBOL (pci_scan_root_bus); -struct pci_bus *pci_scan_bus (int bus,struct pci_ops *ops, -void *sysdata) +struct pci_bus *pci_scan_bus (int domain,int bus, +struct pci_ops *ops,void *sysdata) {LIST_HEAD (resources);struct pci_bus *b;
@@ -2139,7 +2143,8 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,pci_add_resource (&resources, &ioport_resource);pci_add_resource (&resources, &iomem_resource);pci_add_resource (&resources, &busn_resource); - b =pci_create_root_bus (NULL , bus, ops, sysdata, &resources); + b =pci_create_root_bus (NULL , domain, bus, ops, sysdata, + &resources);if (b) {pci_scan_child_bus (b); }else {
drivers/pci/xen-pcifront.c +1 -1
@@ -481,7 +481,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,pci_lock_rescan_remove (); - b =pci_scan_root_bus (&pdev->xdev->dev, bus, + b =pci_scan_root_bus (&pdev->xdev->dev, sd->domain, bus, &pcifront_bus_ops, sd, &resources);if (!b) { dev_err(&pdev->xdev->dev,
include/linux/pci.h +17 -3
@@ -402,6 +402,7 @@ static inline int pci_channel_offline(struct pci_dev *pdev) }struct pci_host_bridge { +int domain;struct device dev;struct pci_bus *bus;/* root bus */ struct list_head windows;/* resource_entry */
@@ -780,16 +781,29 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,void pcibios_scan_specific_bus (int busn);struct pci_bus *pci_find_bus (int domain,int busnr);void pci_bus_add_devices (const struct pci_bus *bus); -struct pci_bus *pci_scan_bus (int bus,struct pci_ops *ops,void *sysdata); -struct pci_bus *pci_create_root_bus (struct device *parent,int bus, +struct pci_bus *pci_scan_bus (int domain,int bus,struct pci_ops *ops, +void *sysdata); +struct pci_bus *pci_create_root_bus (struct device *parent,int domain,int bus,struct pci_ops *ops,void *sysdata,struct list_head *resources); +static inline struct pci_bus *pci_create_root_bus_generic ( +struct device *parent,int bus,struct pci_ops *ops, +void *sysdata,struct list_head *resources) +{ +return pci_create_root_bus (parent,-1 , bus, ops, sysdata, resources); +}int pci_bus_insert_busn_res (struct pci_bus *b,int bus,int busmax);int pci_bus_update_busn_res_end (struct pci_bus *b,int busmax);void pci_bus_release_busn_res (struct pci_bus *b); -struct pci_bus *pci_scan_root_bus (struct device *parent,int bus, +struct pci_bus *pci_scan_root_bus (struct device *parent,int domain,int bus,struct pci_ops *ops,void *sysdata,struct list_head *resources); +static inline struct pci_bus *pci_scan_root_bus_generic ( +struct device *parent,int bus,struct pci_ops *ops, +void *sysdata,struct list_head *resources) +{ +return pci_scan_root_bus (parent,-1 , bus, ops, sysdata, resources); +}struct pci_bus *pci_add_new_bus (struct pci_bus *parent,struct pci_dev *dev,int busnr);void pcie_update_link_speed (struct pci_bus *bus,u16 link_status);
Signature · 1 line
1.7.1
PATCH v12 2/10 PCI: Move pci_bus_assign_domain_nr() declaration into drivers/pci/pci.h
In reply to Yijing Wangpci_bus_assign_domain_nr() is only called in probe.c, Move pci_bus_assign_domain_nr() declaration into drivers/pci/pci.h.
--- drivers/pci/pci.h | 9 +++++++++ include/linux/pci.h | 6 ------ 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/pci/pci.h +9 -0
@@ -335,4 +335,13 @@ static inline int pci_dev_specific_reset(struct pci_dev *dev, int probe)struct pci_host_bridge *pci_find_host_bridge (struct pci_bus *bus); +#ifdef CONFIG_PCI_DOMAINS_GENERIC +void pci_bus_assign_domain_nr (struct pci_bus *bus,struct device *parent); +#else +static inline void pci_bus_assign_domain_nr (struct pci_bus *bus, +struct device *parent) +{ +} +#endif +#endif /* DRIVERS_PCI_H */
include/linux/pci.h +0 -6
@@ -1337,12 +1337,6 @@ static inline int pci_domain_nr(struct pci_bus *bus) {return bus->domain_nr; } -void pci_bus_assign_domain_nr (struct pci_bus *bus,struct device *parent); -#else -static inline void pci_bus_assign_domain_nr (struct pci_bus *bus, -struct device *parent) -{ -}#endif /* some architectures require additional setup to direct VGA traffic */
Signature · 1 line
1.7.1
PATCH v12 2/10 PCI: Move pci_bus_assign_domain_nr() declaration into drivers/pci/pci.h
In reply to Yijing Wangpci_bus_assign_domain_nr() is only called in probe.c, Move pci_bus_assign_domain_nr() declaration into drivers/pci/pci.h.
--- drivers/pci/pci.h | 9 +++++++++ include/linux/pci.h | 6 ------ 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/pci/pci.h +9 -0
@@ -335,4 +335,13 @@ static inline int pci_dev_specific_reset(struct pci_dev *dev, int probe)struct pci_host_bridge *pci_find_host_bridge (struct pci_bus *bus); +#ifdef CONFIG_PCI_DOMAINS_GENERIC +void pci_bus_assign_domain_nr (struct pci_bus *bus,struct device *parent); +#else +static inline void pci_bus_assign_domain_nr (struct pci_bus *bus, +struct device *parent) +{ +} +#endif +#endif /* DRIVERS_PCI_H */
include/linux/pci.h +0 -6
@@ -1337,12 +1337,6 @@ static inline int pci_domain_nr(struct pci_bus *bus) {return bus->domain_nr; } -void pci_bus_assign_domain_nr (struct pci_bus *bus,struct device *parent); -#else -static inline void pci_bus_assign_domain_nr (struct pci_bus *bus, -struct device *parent) -{ -}#endif /* some architectures require additional setup to direct VGA traffic */
Signature · 1 line
1.7.1
PATCH v12 3/10 PCI: Remove declaration for pci_get_new_domain_nr()
In reply to Yijing Wangpci_get_new_domain_nr() is only used in drivers/pci/pci.c, remove the declaration in include/linux/pci.h.
--- drivers/pci/pci.c | 4 ++-- include/linux/pci.h | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/pci/pci.c +2 -2
@@ -4476,14 +4476,14 @@ static void pci_no_domains(void) } #ifdef CONFIG_PCI_DOMAINS +#ifdef CONFIG_PCI_DOMAINS_GENERIC static atomic_t __domain_nr = ATOMIC_INIT(-1); -int pci_get_new_domain_nr(void) +static int pci_get_new_domain_nr(void) { return atomic_inc_return(&__domain_nr); } -#ifdef CONFIG_PCI_DOMAINS_GENERIC void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent) { static int use_dt_domains = -1;
include/linux/pci.h +0 -3
@@ -1319,12 +1319,10 @@ void pci_cfg_access_unlock(struct pci_dev *dev);*/ #ifdef CONFIG_PCI_DOMAINS extern int pci_domains_supported; -int pci_get_new_domain_nr (void );#else enum { pci_domains_supported =0 };static inline int pci_domain_nr (struct pci_bus *bus) {return 0 ; }static inline int pci_proc_domain (struct pci_bus *bus) {return 0 ; } -static inline int pci_get_new_domain_nr (void ) {return -ENOSYS ; }#endif /* CONFIG_PCI_DOMAINS */ /*
@@ -1445,7 +1443,6 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,static inline int pci_domain_nr (struct pci_bus *bus) {return 0 ; }static inline struct pci_dev *pci_dev_get (struct pci_dev *dev) {return NULL ; } -static inline int pci_get_new_domain_nr (void ) {return -ENOSYS ; }#define dev_is_pci (d) (false)#define dev_is_pf (d) (false)
Signature · 1 line
1.7.1
PATCH v12 4/10 PCI: Introduce pci_host_assign_domain_nr() to assign domain
In reply to Yijing WangIntroduce pci_host_assign_domain_nr() to assign domain number for pci_host_bridge.
--- drivers/pci/pci.c | 24 +++++++++++++++++++----- drivers/pci/pci.h | 1 + 2 files changed, 20 insertions(+), 5 deletions(-)
drivers/pci/pci.c +19 -5
@@ -4484,10 +4484,10 @@ static int pci_get_new_domain_nr(void)return atomic_inc_return (&__domain_nr); } -void pci_bus_assign_domain_nr (struct pci_bus *bus,struct device *parent) +static int pci_assign_domain_nr (struct device *dev) {static int use_dt_domains =-1 ; -int domain =of_get_pci_domain_nr (parent->of_node); +int domain =of_get_pci_domain_nr (dev->of_node);/* * Check DT domain and use_dt_domains values.
@@ -4521,16 +4521,30 @@ void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent) use_dt_domains =0 ; domain =pci_get_new_domain_nr (); } else { -dev_err (parent,"Node %s has inconsistent \"linux,pci-domain\" property in DT\n" , - parent->of_node->full_name); +dev_err (dev,"Node %s has inconsistent \"linux,pci-domain\" property in DT\n" , + dev->of_node->full_name); domain =-1 ; } - bus->domain_nr = domain; +return domain; +} + +void pci_bus_assign_domain_nr (struct pci_bus *bus,struct device *parent) +{ + bus->domain_nr =pci_assign_domain_nr (parent); }#endif #endif +void pci_host_assign_domain_nr (struct pci_host_bridge *host,int domain) +{ +#ifdef CONFIG_PCI_DOMAINS_GENERIC + host->domain =pci_assign_domain_nr (host->dev.parent); +#else + host->domain = domain; +#endif +} +/** * pci_ext_cfg_avail - can we access extended PCI config space? *
drivers/pci/pci.h +1 -0
@@ -344,4 +344,5 @@ static inline void pci_bus_assign_domain_nr(struct pci_bus *bus, }#endif +void pci_host_assign_domain_nr (struct pci_host_bridge *host,int domain);#endif /* DRIVERS_PCI_H */
Signature · 1 line
1.7.1
PATCH v12 4/10 PCI: Introduce pci_host_assign_domain_nr() to assign domain
In reply to Yijing WangIntroduce pci_host_assign_domain_nr() to assign domain number for pci_host_bridge.
--- drivers/pci/pci.c | 24 +++++++++++++++++++----- drivers/pci/pci.h | 1 + 2 files changed, 20 insertions(+), 5 deletions(-)
drivers/pci/pci.c +19 -5
@@ -4484,10 +4484,10 @@ static int pci_get_new_domain_nr(void)return atomic_inc_return (&__domain_nr); } -void pci_bus_assign_domain_nr (struct pci_bus *bus,struct device *parent) +static int pci_assign_domain_nr (struct device *dev) {static int use_dt_domains =-1 ; -int domain =of_get_pci_domain_nr (parent->of_node); +int domain =of_get_pci_domain_nr (dev->of_node);/* * Check DT domain and use_dt_domains values.
@@ -4521,16 +4521,30 @@ void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent) use_dt_domains =0 ; domain =pci_get_new_domain_nr (); } else { -dev_err (parent,"Node %s has inconsistent \"linux,pci-domain\" property in DT\n" , - parent->of_node->full_name); +dev_err (dev,"Node %s has inconsistent \"linux,pci-domain\" property in DT\n" , + dev->of_node->full_name); domain =-1 ; } - bus->domain_nr = domain; +return domain; +} + +void pci_bus_assign_domain_nr (struct pci_bus *bus,struct device *parent) +{ + bus->domain_nr =pci_assign_domain_nr (parent); }#endif #endif +void pci_host_assign_domain_nr (struct pci_host_bridge *host,int domain) +{ +#ifdef CONFIG_PCI_DOMAINS_GENERIC + host->domain =pci_assign_domain_nr (host->dev.parent); +#else + host->domain = domain; +#endif +} +/** * pci_ext_cfg_avail - can we access extended PCI config space? *
drivers/pci/pci.h +1 -0
@@ -344,4 +344,5 @@ static inline void pci_bus_assign_domain_nr(struct pci_bus *bus, }#endif +void pci_host_assign_domain_nr (struct pci_host_bridge *host,int domain);#endif /* DRIVERS_PCI_H */
Signature · 1 line
1.7.1
PATCH v12 5/10 powerpc/PCI: Rename pcibios_root_bridge_prepare() to pcibios_root_bus_prepare()
In reply to Yijing WangPcibios_root_bridge_prepare() in powerpc set root bus speed, it's not the preparation for pci host bridge. For better separation of host bridge and root bus creation, It's need to rename it to another weak function.
--- arch/powerpc/include/asm/machdep.h | 2 +- arch/powerpc/kernel/pci-common.c | 6 +++--- arch/powerpc/platforms/pseries/pci.c | 2 +- arch/powerpc/platforms/pseries/pseries.h | 2 +- arch/powerpc/platforms/pseries/setup.c | 2 +- drivers/pci/probe.c | 9 +++++++++ 6 files changed, 16 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/machdep.h +1 -1
@@ -100,7 +100,7 @@ struct machdep_calls {/* Called after allocating resources */ void (*pcibios_fixup)(void );void (*pci_irq_fixup)(struct pci_dev *dev); -int (*pcibios_root_bridge_prepare)(struct pci_host_bridge +int (*pcibios_root_bus_prepare)(struct pci_host_bridge *bridge);/* To setup PHBs when using automatic OF platform driver for PCI */
arch/powerpc/kernel/pci-common.c +3 -3
@@ -782,10 +782,10 @@ int pci_proc_domain(struct pci_bus *bus)return 1 ; } -int pcibios_root_bridge_prepare (struct pci_host_bridge *bridge) +int pcibios_root_bus_prepare (struct pci_host_bridge *bridge) { -if (ppc_md.pcibios_root_bridge_prepare) -return ppc_md.pcibios_root_bridge_prepare (bridge); +if (ppc_md.pcibios_root_bus_prepare) +return ppc_md.pcibios_root_bus_prepare (bridge);return 0 ; }
arch/powerpc/platforms/pseries/pci.c +1 -1
@@ -110,7 +110,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_WINBOND ,PCI_DEVICE_ID_WINBOND_82C105 , fixup_winbond_82c105); -int pseries_root_bridge_prepare (struct pci_host_bridge *bridge) +int pseries_root_bus_prepare (struct pci_host_bridge *bridge) {struct device_node *dn, *pdn;struct pci_bus *bus;
arch/powerpc/platforms/pseries/pseries.h +1 -1
@@ -75,7 +75,7 @@ static inline int dlpar_memory(struct pseries_hp_errorlog *hp_elog)/* PCI root bridge prepare function override for pseries */ struct pci_host_bridge ; -int pseries_root_bridge_prepare (struct pci_host_bridge *bridge); +int pseries_root_bus_prepare (struct pci_host_bridge *bridge);extern struct pci_controller_ops pseries_pci_controller_ops;
arch/powerpc/platforms/pseries/setup.c +1 -1
@@ -537,7 +537,7 @@ static void __init pSeries_setup_arch(void) ppc_md.enable_pmcs = power4_enable_pmcs; } - ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare; + ppc_md.pcibios_root_bus_prepare = pseries_root_bus_prepare;if (firmware_has_feature (FW_FEATURE_SET_MODE )) {long rc;
drivers/pci/probe.c +9 -0
@@ -1919,6 +1919,11 @@ int __weak pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)return 0 ; } +int __weak pcibios_root_bus_prepare (struct pci_host_bridge *bridge) +{ +return 0 ; +} +void __weak pcibios_add_bus (struct pci_bus *bus) { }
@@ -1984,6 +1989,10 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int domain, b->dev.class = &pcibus_class; b->dev.parent = b->bridge;dev_set_name (&b->dev,"%04x:%02x" ,pci_domain_nr (b), bus); + error =pcibios_root_bus_prepare (bridge); +if (error) + goto class_dev_reg_err; + error =device_register (&b->dev);if (error) goto class_dev_reg_err;
Signature · 1 line
1.7.1
PATCH v12 5/10 powerpc/PCI: Rename pcibios_root_bridge_prepare() to pcibios_root_bus_prepare()
In reply to Yijing WangPcibios_root_bridge_prepare() in powerpc set root bus speed, it's not the preparation for pci host bridge. For better separation of host bridge and root bus creation, It's need to rename it to another weak function.
--- arch/powerpc/include/asm/machdep.h | 2 +- arch/powerpc/kernel/pci-common.c | 6 +++--- arch/powerpc/platforms/pseries/pci.c | 2 +- arch/powerpc/platforms/pseries/pseries.h | 2 +- arch/powerpc/platforms/pseries/setup.c | 2 +- drivers/pci/probe.c | 9 +++++++++ 6 files changed, 16 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/machdep.h +1 -1
@@ -100,7 +100,7 @@ struct machdep_calls {/* Called after allocating resources */ void (*pcibios_fixup)(void );void (*pci_irq_fixup)(struct pci_dev *dev); -int (*pcibios_root_bridge_prepare)(struct pci_host_bridge +int (*pcibios_root_bus_prepare)(struct pci_host_bridge *bridge);/* To setup PHBs when using automatic OF platform driver for PCI */
arch/powerpc/kernel/pci-common.c +3 -3
@@ -782,10 +782,10 @@ int pci_proc_domain(struct pci_bus *bus)return 1 ; } -int pcibios_root_bridge_prepare (struct pci_host_bridge *bridge) +int pcibios_root_bus_prepare (struct pci_host_bridge *bridge) { -if (ppc_md.pcibios_root_bridge_prepare) -return ppc_md.pcibios_root_bridge_prepare (bridge); +if (ppc_md.pcibios_root_bus_prepare) +return ppc_md.pcibios_root_bus_prepare (bridge);return 0 ; }
arch/powerpc/platforms/pseries/pci.c +1 -1
@@ -110,7 +110,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_WINBOND ,PCI_DEVICE_ID_WINBOND_82C105 , fixup_winbond_82c105); -int pseries_root_bridge_prepare (struct pci_host_bridge *bridge) +int pseries_root_bus_prepare (struct pci_host_bridge *bridge) {struct device_node *dn, *pdn;struct pci_bus *bus;
arch/powerpc/platforms/pseries/pseries.h +1 -1
@@ -75,7 +75,7 @@ static inline int dlpar_memory(struct pseries_hp_errorlog *hp_elog)/* PCI root bridge prepare function override for pseries */ struct pci_host_bridge ; -int pseries_root_bridge_prepare (struct pci_host_bridge *bridge); +int pseries_root_bus_prepare (struct pci_host_bridge *bridge);extern struct pci_controller_ops pseries_pci_controller_ops;
arch/powerpc/platforms/pseries/setup.c +1 -1
@@ -537,7 +537,7 @@ static void __init pSeries_setup_arch(void) ppc_md.enable_pmcs = power4_enable_pmcs; } - ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare; + ppc_md.pcibios_root_bus_prepare = pseries_root_bus_prepare;if (firmware_has_feature (FW_FEATURE_SET_MODE )) {long rc;
drivers/pci/probe.c +9 -0
@@ -1919,6 +1919,11 @@ int __weak pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)return 0 ; } +int __weak pcibios_root_bus_prepare (struct pci_host_bridge *bridge) +{ +return 0 ; +} +void __weak pcibios_add_bus (struct pci_bus *bus) { }
@@ -1984,6 +1989,10 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int domain, b->dev.class = &pcibus_class; b->dev.parent = b->bridge;dev_set_name (&b->dev,"%04x:%02x" ,pci_domain_nr (b), bus); + error =pcibios_root_bus_prepare (bridge); +if (error) + goto class_dev_reg_err; + error =device_register (&b->dev);if (error) goto class_dev_reg_err;
Signature · 1 line
1.7.1
PATCH v12 6/10 PCI: Make pci_host_bridge hold sysdata in drvdata
In reply to Yijing WangNow platform specific sysdata is saved in pci_bus, and pcibios_root_bridge_prepare() need to know
the sysdata. Later, we would move pcibios_root_bridge_prepare() prior to root bus creation, so we need to make pci_host_bridge hold sysdata.
--- arch/ia64/pci/pci.c | 2 +- arch/x86/pci/acpi.c | 2 +- drivers/pci/probe.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-)
arch/ia64/pci/pci.c +1 -1
@@ -485,7 +485,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)* that case. */ if (!bridge->dev.parent) { -struct pci_controller *controller = bridge->bus->sysdata; +struct pci_controller *controller =dev_get_drvdata (&bridge->dev);ACPI_COMPANION_SET (&bridge->dev, controller->companion); }return 0 ;
arch/x86/pci/acpi.c +1 -1
@@ -502,7 +502,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)* that case. */ if (!bridge->dev.parent) { -struct pci_sysdata *sd = bridge->bus->sysdata; +struct pci_sysdata *sd =dev_get_drvdata (&bridge->dev);ACPI_COMPANION_SET (&bridge->dev, sd->companion); }return 0 ;
drivers/pci/probe.c +1 -0
@@ -1967,6 +1967,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int domain, bridge->domain = domain; bridge->dev.parent = parent; bridge->dev.release = pci_release_host_bridge_dev; +dev_set_drvdata (&bridge->dev, sysdata);dev_set_name (&bridge->dev,"pci%04x:%02x" ,pci_domain_nr (b), bus); error =pcibios_root_bridge_prepare (bridge);if (error) {
Signature · 1 line
1.7.1
PATCH v12 6/10 PCI: Make pci_host_bridge hold sysdata in drvdata
In reply to Yijing WangNow platform specific sysdata is saved in pci_bus, and pcibios_root_bridge_prepare() need to know
the sysdata. Later, we would move pcibios_root_bridge_prepare() prior to root bus creation, so we need to make pci_host_bridge hold sysdata.
--- arch/ia64/pci/pci.c | 2 +- arch/x86/pci/acpi.c | 2 +- drivers/pci/probe.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-)
arch/ia64/pci/pci.c +1 -1
@@ -485,7 +485,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)* that case. */ if (!bridge->dev.parent) { -struct pci_controller *controller = bridge->bus->sysdata; +struct pci_controller *controller =dev_get_drvdata (&bridge->dev);ACPI_COMPANION_SET (&bridge->dev, controller->companion); }return 0 ;
arch/x86/pci/acpi.c +1 -1
@@ -502,7 +502,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)* that case. */ if (!bridge->dev.parent) { -struct pci_sysdata *sd = bridge->bus->sysdata; +struct pci_sysdata *sd =dev_get_drvdata (&bridge->dev);ACPI_COMPANION_SET (&bridge->dev, sd->companion); }return 0 ;
drivers/pci/probe.c +1 -0
@@ -1967,6 +1967,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int domain, bridge->domain = domain; bridge->dev.parent = parent; bridge->dev.release = pci_release_host_bridge_dev; +dev_set_drvdata (&bridge->dev, sysdata);dev_set_name (&bridge->dev,"pci%04x:%02x" ,pci_domain_nr (b), bus); error =pcibios_root_bridge_prepare (bridge);if (error) {
Signature · 1 line
1.7.1
PATCH v12 7/10 PCI: Create pci host bridge prior to root bus
In reply to Yijing WangPci_host_bridge hold the domain number, we need to assign domain number prior to root bus creation, because root bus need to know the domain number to check whether it's alreay exist. Also it's preparation for separating pci_host_bridge creation from pci_create_root_bus().
--- drivers/pci/probe.c | 58 +++++++++++++++++++++++++++----------------------- 1 files changed, 31 insertions(+), 27 deletions(-)
drivers/pci/probe.c +31 -27
@@ -515,7 +515,7 @@ static void pci_release_host_bridge_dev(struct device *dev)kfree (bridge); } -static struct pci_host_bridge *pci_alloc_host_bridge (struct pci_bus *b) +static struct pci_host_bridge *pci_alloc_host_bridge (void ) {struct pci_host_bridge *bridge;
@@ -524,7 +524,6 @@ static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)return NULL ;INIT_LIST_HEAD (&bridge->windows); - bridge->bus = b;return bridge; }
@@ -1938,48 +1937,53 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int domain, {int error;struct pci_host_bridge *bridge; -struct pci_bus *b, *b2; +struct pci_bus *b;struct resource_entry *window, *n;struct resource *res;resource_size_t offset;char bus_addr[64 ];char *fmt; - b =pci_alloc_bus (NULL ); -if (!b) + bridge =pci_alloc_host_bridge (); +if (!bridge)return NULL ; - b->sysdata = sysdata; - b->ops = ops; - b->number = b->busn_res.start = bus; -pci_bus_assign_domain_nr (b, parent); - b2 =pci_find_bus (pci_domain_nr (b), bus); -if (b2) { + bridge->dev.parent = parent; +pci_host_assign_domain_nr (bridge, domain); + + b =pci_find_bus (bridge->domain, bus); +if (b) {/* If we already got to this bus through a different bridge, ignore it */ -dev_dbg (&b2->dev,"bus already known\n" ); - goto err_out; +dev_dbg (&b->dev,"bus already known\n" ); +kfree (bridge); +return NULL ; } - bridge =pci_alloc_host_bridge (b); -if (!bridge) - goto err_out; - - bridge->domain = domain; - bridge->dev.parent = parent; bridge->dev.release = pci_release_host_bridge_dev;dev_set_drvdata (&bridge->dev, sysdata); -dev_set_name (&bridge->dev,"pci%04x:%02x" ,pci_domain_nr (b), bus); +dev_set_name (&bridge->dev,"pci%04x:%02x" , bridge->domain, bus); error =pcibios_root_bridge_prepare (bridge);if (error) {kfree (bridge); - goto err_out; +return NULL ; } error =device_register (&bridge->dev);if (error) {put_device (&bridge->dev); - goto err_out; +return NULL ; } + + b =pci_alloc_bus (NULL ); +if (!b) + goto unregister_host; + + bridge->bus = b; + b->sysdata = sysdata; + b->ops = ops; + b->number = b->busn_res.start = bus; +pci_bus_assign_domain_nr (b, parent); + b->bridge =get_device (&bridge->dev);device_enable_async_suspend (b->bridge);pci_set_bus_of_node (b);
@@ -1992,11 +1996,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int domain,dev_set_name (&b->dev,"%04x:%02x" ,pci_domain_nr (b), bus); error =pcibios_root_bus_prepare (bridge);if (error) - goto class_dev_reg_err; + goto free_bus; error =device_register (&b->dev);if (error) - goto class_dev_reg_err; + goto free_bus;pcibios_add_bus (b);
@@ -2036,11 +2040,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int domain,return b; -class_dev_reg_err: +free_bus: +kfree (b);put_device (&bridge->dev); +unregister_host:device_unregister (&bridge->dev); -err_out: -kfree (b);return NULL ; }EXPORT_SYMBOL_GPL (pci_create_root_bus);
Signature · 1 line
1.7.1
PATCH v12 8/10 PCI: Introduce common pci_domain_nr() and remove platform specific code
In reply to Yijing WangNow pci_host_bridge holds the domain number, we could introduce common pci_domain_nr(), and remove platform specific code.
--- arch/alpha/include/asm/pci.h | 2 -- arch/ia64/include/asm/pci.h | 1 - arch/microblaze/include/asm/pci.h | 2 -- arch/microblaze/pci/pci-common.c | 11 ----------- arch/mips/include/asm/pci.h | 2 -- arch/powerpc/include/asm/pci.h | 2 -- arch/powerpc/kernel/pci-common.c | 11 ----------- arch/s390/include/asm/pci.h | 1 - arch/s390/pci/pci.c | 6 ------ arch/sh/include/asm/pci.h | 2 -- arch/sparc/include/asm/pci_64.h | 1 - arch/sparc/kernel/pci.c | 17 ----------------- arch/tile/include/asm/pci.h | 2 -- arch/x86/include/asm/pci.h | 6 ------ drivers/pci/pci.c | 8 ++++++++ include/linux/pci.h | 7 +------ 16 files changed, 9 insertions(+), 72 deletions(-)
arch/alpha/include/asm/pci.h +0 -2
@@ -79,8 +79,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)return channel ?15 :14 ; } -#define pci_domain_nr (bus) ((struct pci_controller *)(bus)->sysdata)->index -static inline int pci_proc_domain (struct pci_bus *bus) {struct pci_controller *hose = bus->sysdata;
arch/ia64/include/asm/pci.h +0 -1
@@ -80,7 +80,6 @@ struct pci_controller {#define PCI_CONTROLLER (busdev) ((struct pci_controller *) busdev->sysdata) -#define pci_domain_nr (busdev) (PCI_CONTROLLER(busdev)->segment)extern struct pci_ops pci_root_ops;
arch/microblaze/include/asm/pci.h +0 -2
@@ -42,8 +42,6 @@*/ #define pcibios_assign_all_busses () 0 -extern int pci_domain_nr (struct pci_bus *bus); -/* Decide whether to display the domain number in /proc */ extern int pci_proc_domain (struct pci_bus *bus);
arch/microblaze/pci/pci-common.c +0 -11
@@ -123,17 +123,6 @@ unsigned long pci_address_to_pio(phys_addr_t address) }EXPORT_SYMBOL_GPL (pci_address_to_pio); -/* -* Return the domain number for this bus. -*/ -int pci_domain_nr (struct pci_bus *bus) -{ -struct pci_controller *hose =pci_bus_to_host (bus); - -return hose->global_number; -} -EXPORT_SYMBOL (pci_domain_nr); -/* This routine is meant to be used early during boot, when the * PCI bus numbers have not yet been assigned, and you need to * issue PCI config cycles to an OF device.
arch/mips/include/asm/pci.h +0 -2
@@ -114,8 +114,6 @@ struct pci_dev;extern unsigned int PCI_DMA_BUS_IS_PHYS ;#ifdef CONFIG_PCI_DOMAINS -#define pci_domain_nr (bus) ((struct pci_controller *)(bus)->sysdata)->index -static inline int pci_proc_domain (struct pci_bus *bus) {struct pci_controller *hose = bus->sysdata;
arch/powerpc/include/asm/pci.h +0 -2
@@ -73,8 +73,6 @@ extern struct dma_map_ops *get_pci_dma_ops(void);#endif /* CONFIG_PPC64 */ -extern int pci_domain_nr (struct pci_bus *bus); -/* Decide whether to display the domain number in /proc */ extern int pci_proc_domain (struct pci_bus *bus);
arch/powerpc/kernel/pci-common.c +0 -11
@@ -196,17 +196,6 @@ unsigned long pci_address_to_pio(phys_addr_t address) }EXPORT_SYMBOL_GPL (pci_address_to_pio); -/* -* Return the domain number for this bus. -*/ -int pci_domain_nr (struct pci_bus *bus) -{ -struct pci_controller *hose =pci_bus_to_host (bus); - -return hose->global_number; -} -EXPORT_SYMBOL (pci_domain_nr); -/* This routine is meant to be used early during boot, when the * PCI bus numbers have not yet been assigned, and you need to * issue PCI config cycles to an OF device.
arch/s390/include/asm/pci.h +0 -1
@@ -20,7 +20,6 @@void __iomem *pci_iomap (struct pci_dev *,int ,unsigned long );void pci_iounmap (struct pci_dev *,void __iomem *); -int pci_domain_nr (struct pci_bus *);int pci_proc_domain (struct pci_bus *);#define ZPCI_BUS_NR 0/* default bus number */
arch/s390/pci/pci.c +0 -6
@@ -101,12 +101,6 @@ static struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus)return (bus && bus->sysdata) ? (struct zpci_dev *) bus->sysdata :NULL ; } -int pci_domain_nr (struct pci_bus *bus) -{ -return ((struct zpci_dev *) bus->sysdata)->domain; -} -EXPORT_SYMBOL_GPL (pci_domain_nr); -int pci_proc_domain (struct pci_bus *bus) {return pci_domain_nr (bus);
arch/sh/include/asm/pci.h +0 -2
@@ -91,8 +91,6 @@ extern void pcibios_set_master(struct pci_dev *dev);/* Board-specific fixup routines. */ int pcibios_map_platform_irq (const struct pci_dev *dev,u8 slot,u8 pin); -#define pci_domain_nr (bus) ((struct pci_channel *)(bus)->sysdata)->index -static inline int pci_proc_domain (struct pci_bus *bus) {struct pci_channel *hose = bus->sysdata;
arch/sparc/include/asm/pci_64.h +0 -1
@@ -33,7 +33,6 @@/* Return the index of the PCI controller for device PDEV. */ -int pci_domain_nr (struct pci_bus *bus);static inline int pci_proc_domain (struct pci_bus *bus) {return 1 ;
arch/sparc/kernel/pci.c +0 -17
@@ -886,23 +886,6 @@ int pcibus_to_node(struct pci_bus *pbus)EXPORT_SYMBOL (pcibus_to_node);#endif -/* Return the domain number for this pci bus */ - -int pci_domain_nr (struct pci_bus *pbus) -{ -struct pci_pbm_info *pbm = pbus->sysdata; -int ret; - -if (!pbm) { - ret = -ENXIO ; - }else { - ret = pbm->index; - } - -return ret; -} -EXPORT_SYMBOL (pci_domain_nr); -#ifdef CONFIG_PCI_MSI int arch_setup_msi_irq (struct pci_dev *pdev,struct msi_desc *desc) {
arch/tile/include/asm/pci.h +0 -2
@@ -199,8 +199,6 @@ int __init pcibios_init(void);void pcibios_fixup_bus (struct pci_bus *bus); -#define pci_domain_nr (bus) (((struct pci_controller *)(bus)->sysdata)->index) -/* * This decides whether to display the domain number in /proc. */
arch/x86/include/asm/pci.h +0 -6
@@ -29,12 +29,6 @@ extern int noioapicreroute; #ifdef CONFIG_PCI #ifdef CONFIG_PCI_DOMAINS -static inline int pci_domain_nr(struct pci_bus *bus) -{ - struct pci_sysdata *sd = bus->sysdata; - return sd->domain; -} - static inline int pci_proc_domain(struct pci_bus *bus) { return pci_domain_nr(bus);
drivers/pci/pci.c +8 -0
@@ -4476,6 +4476,14 @@ static void pci_no_domains(void) }#ifdef CONFIG_PCI_DOMAINS +int pci_domain_nr (struct pci_bus *bus) +{ +struct pci_host_bridge *host =pci_find_host_bridge (bus); + +return host->domain; +} +EXPORT_SYMBOL (pci_domain_nr); +#ifdef CONFIG_PCI_DOMAINS_GENERIC static atomic_t __domain_nr =ATOMIC_INIT (-1 );
include/linux/pci.h +1 -6
@@ -1319,6 +1319,7 @@ void pci_cfg_access_unlock(struct pci_dev *dev);*/ #ifdef CONFIG_PCI_DOMAINS extern int pci_domains_supported; +int pci_domain_nr (struct pci_bus *bus);#else enum { pci_domains_supported =0 };static inline int pci_domain_nr (struct pci_bus *bus) {return 0 ; }
@@ -1330,12 +1331,6 @@ static inline int pci_proc_domain(struct pci_bus *bus) { return 0; }* architecture does not need custom management of PCI * domains then this implementation will be used */ -#ifdef CONFIG_PCI_DOMAINS_GENERIC -static inline int pci_domain_nr (struct pci_bus *bus) -{ -return bus->domain_nr; -} -#endif /* some architectures require additional setup to direct VGA traffic */ typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode,
Signature · 1 line
1.7.1
PATCH v12 8/10 PCI: Introduce common pci_domain_nr() and remove platform specific code
In reply to Yijing WangNow pci_host_bridge holds the domain number, we could introduce common pci_domain_nr(), and remove platform specific code.
--- arch/alpha/include/asm/pci.h | 2 -- arch/ia64/include/asm/pci.h | 1 - arch/microblaze/include/asm/pci.h | 2 -- arch/microblaze/pci/pci-common.c | 11 ----------- arch/mips/include/asm/pci.h | 2 -- arch/powerpc/include/asm/pci.h | 2 -- arch/powerpc/kernel/pci-common.c | 11 ----------- arch/s390/include/asm/pci.h | 1 - arch/s390/pci/pci.c | 6 ------ arch/sh/include/asm/pci.h | 2 -- arch/sparc/include/asm/pci_64.h | 1 - arch/sparc/kernel/pci.c | 17 ----------------- arch/tile/include/asm/pci.h | 2 -- arch/x86/include/asm/pci.h | 6 ------ drivers/pci/pci.c | 8 ++++++++ include/linux/pci.h | 7 +------ 16 files changed, 9 insertions(+), 72 deletions(-)
arch/alpha/include/asm/pci.h +0 -2
@@ -79,8 +79,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)return channel ?15 :14 ; } -#define pci_domain_nr (bus) ((struct pci_controller *)(bus)->sysdata)->index -static inline int pci_proc_domain (struct pci_bus *bus) {struct pci_controller *hose = bus->sysdata;
arch/ia64/include/asm/pci.h +0 -1
@@ -80,7 +80,6 @@ struct pci_controller {#define PCI_CONTROLLER (busdev) ((struct pci_controller *) busdev->sysdata) -#define pci_domain_nr (busdev) (PCI_CONTROLLER(busdev)->segment)extern struct pci_ops pci_root_ops;
arch/microblaze/include/asm/pci.h +0 -2
@@ -42,8 +42,6 @@*/ #define pcibios_assign_all_busses () 0 -extern int pci_domain_nr (struct pci_bus *bus); -/* Decide whether to display the domain number in /proc */ extern int pci_proc_domain (struct pci_bus *bus);
arch/microblaze/pci/pci-common.c +0 -11
@@ -123,17 +123,6 @@ unsigned long pci_address_to_pio(phys_addr_t address) }EXPORT_SYMBOL_GPL (pci_address_to_pio); -/* -* Return the domain number for this bus. -*/ -int pci_domain_nr (struct pci_bus *bus) -{ -struct pci_controller *hose =pci_bus_to_host (bus); - -return hose->global_number; -} -EXPORT_SYMBOL (pci_domain_nr); -/* This routine is meant to be used early during boot, when the * PCI bus numbers have not yet been assigned, and you need to * issue PCI config cycles to an OF device.
arch/mips/include/asm/pci.h +0 -2
@@ -114,8 +114,6 @@ struct pci_dev;extern unsigned int PCI_DMA_BUS_IS_PHYS ;#ifdef CONFIG_PCI_DOMAINS -#define pci_domain_nr (bus) ((struct pci_controller *)(bus)->sysdata)->index -static inline int pci_proc_domain (struct pci_bus *bus) {struct pci_controller *hose = bus->sysdata;
arch/powerpc/include/asm/pci.h +0 -2
@@ -73,8 +73,6 @@ extern struct dma_map_ops *get_pci_dma_ops(void);#endif /* CONFIG_PPC64 */ -extern int pci_domain_nr (struct pci_bus *bus); -/* Decide whether to display the domain number in /proc */ extern int pci_proc_domain (struct pci_bus *bus);
arch/powerpc/kernel/pci-common.c +0 -11
@@ -196,17 +196,6 @@ unsigned long pci_address_to_pio(phys_addr_t address) }EXPORT_SYMBOL_GPL (pci_address_to_pio); -/* -* Return the domain number for this bus. -*/ -int pci_domain_nr (struct pci_bus *bus) -{ -struct pci_controller *hose =pci_bus_to_host (bus); - -return hose->global_number; -} -EXPORT_SYMBOL (pci_domain_nr); -/* This routine is meant to be used early during boot, when the * PCI bus numbers have not yet been assigned, and you need to * issue PCI config cycles to an OF device.
arch/s390/include/asm/pci.h +0 -1
@@ -20,7 +20,6 @@void __iomem *pci_iomap (struct pci_dev *,int ,unsigned long );void pci_iounmap (struct pci_dev *,void __iomem *); -int pci_domain_nr (struct pci_bus *);int pci_proc_domain (struct pci_bus *);#define ZPCI_BUS_NR 0/* default bus number */
arch/s390/pci/pci.c +0 -6
@@ -101,12 +101,6 @@ static struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus)return (bus && bus->sysdata) ? (struct zpci_dev *) bus->sysdata :NULL ; } -int pci_domain_nr (struct pci_bus *bus) -{ -return ((struct zpci_dev *) bus->sysdata)->domain; -} -EXPORT_SYMBOL_GPL (pci_domain_nr); -int pci_proc_domain (struct pci_bus *bus) {return pci_domain_nr (bus);
arch/sh/include/asm/pci.h +0 -2
@@ -91,8 +91,6 @@ extern void pcibios_set_master(struct pci_dev *dev);/* Board-specific fixup routines. */ int pcibios_map_platform_irq (const struct pci_dev *dev,u8 slot,u8 pin); -#define pci_domain_nr (bus) ((struct pci_channel *)(bus)->sysdata)->index -static inline int pci_proc_domain (struct pci_bus *bus) {struct pci_channel *hose = bus->sysdata;
arch/sparc/include/asm/pci_64.h +0 -1
@@ -33,7 +33,6 @@/* Return the index of the PCI controller for device PDEV. */ -int pci_domain_nr (struct pci_bus *bus);static inline int pci_proc_domain (struct pci_bus *bus) {return 1 ;
arch/sparc/kernel/pci.c +0 -17
@@ -886,23 +886,6 @@ int pcibus_to_node(struct pci_bus *pbus)EXPORT_SYMBOL (pcibus_to_node);#endif -/* Return the domain number for this pci bus */ - -int pci_domain_nr (struct pci_bus *pbus) -{ -struct pci_pbm_info *pbm = pbus->sysdata; -int ret; - -if (!pbm) { - ret = -ENXIO ; - }else { - ret = pbm->index; - } - -return ret; -} -EXPORT_SYMBOL (pci_domain_nr); -#ifdef CONFIG_PCI_MSI int arch_setup_msi_irq (struct pci_dev *pdev,struct msi_desc *desc) {
arch/tile/include/asm/pci.h +0 -2
@@ -199,8 +199,6 @@ int __init pcibios_init(void);void pcibios_fixup_bus (struct pci_bus *bus); -#define pci_domain_nr (bus) (((struct pci_controller *)(bus)->sysdata)->index) -/* * This decides whether to display the domain number in /proc. */
arch/x86/include/asm/pci.h +0 -6
@@ -29,12 +29,6 @@ extern int noioapicreroute; #ifdef CONFIG_PCI #ifdef CONFIG_PCI_DOMAINS -static inline int pci_domain_nr(struct pci_bus *bus) -{ - struct pci_sysdata *sd = bus->sysdata; - return sd->domain; -} - static inline int pci_proc_domain(struct pci_bus *bus) { return pci_domain_nr(bus);
drivers/pci/pci.c +8 -0
@@ -4476,6 +4476,14 @@ static void pci_no_domains(void) }#ifdef CONFIG_PCI_DOMAINS +int pci_domain_nr (struct pci_bus *bus) +{ +struct pci_host_bridge *host =pci_find_host_bridge (bus); + +return host->domain; +} +EXPORT_SYMBOL (pci_domain_nr); +#ifdef CONFIG_PCI_DOMAINS_GENERIC static atomic_t __domain_nr =ATOMIC_INIT (-1 );
include/linux/pci.h +1 -6
@@ -1319,6 +1319,7 @@ void pci_cfg_access_unlock(struct pci_dev *dev);*/ #ifdef CONFIG_PCI_DOMAINS extern int pci_domains_supported; +int pci_domain_nr (struct pci_bus *bus);#else enum { pci_domains_supported =0 };static inline int pci_domain_nr (struct pci_bus *bus) {return 0 ; }
@@ -1330,12 +1331,6 @@ static inline int pci_proc_domain(struct pci_bus *bus) { return 0; }* architecture does not need custom management of PCI * domains then this implementation will be used */ -#ifdef CONFIG_PCI_DOMAINS_GENERIC -static inline int pci_domain_nr (struct pci_bus *bus) -{ -return bus->domain_nr; -} -#endif /* some architectures require additional setup to direct VGA traffic */ typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode,
Signature · 1 line
1.7.1
PATCH v12 9/10 PCI: Remove pci_bus_assign_domain_nr()
In reply to Yijing WangNow we save the domain number in pci_host_bridge,
we could remove pci_bus_assign_domain_nr() and
clean the domain member in pci_bus.
--- drivers/pci/pci.c | 5 ----- drivers/pci/pci.h | 9 --------- drivers/pci/probe.c | 11 +++-------- include/linux/pci.h | 3 --- 4 files changed, 3 insertions(+), 25 deletions(-)
drivers/pci/pci.c +0 -5
@@ -4536,11 +4536,6 @@ static int pci_assign_domain_nr(struct device *dev)return domain; } - -void pci_bus_assign_domain_nr (struct pci_bus *bus,struct device *parent) -{ - bus->domain_nr =pci_assign_domain_nr (parent); -}#endif #endif
drivers/pci/pci.h +0 -9
@@ -335,14 +335,5 @@ static inline int pci_dev_specific_reset(struct pci_dev *dev, int probe)struct pci_host_bridge *pci_find_host_bridge (struct pci_bus *bus); -#ifdef CONFIG_PCI_DOMAINS_GENERIC -void pci_bus_assign_domain_nr (struct pci_bus *bus,struct device *parent); -#else -static inline void pci_bus_assign_domain_nr (struct pci_bus *bus, -struct device *parent) -{ -} -#endif -void pci_host_assign_domain_nr (struct pci_host_bridge *host,int domain);#endif /* DRIVERS_PCI_H */
drivers/pci/probe.c +3 -8
@@ -481,7 +481,7 @@ void pci_read_bridge_bases(struct pci_bus *child) } } -static struct pci_bus *pci_alloc_bus (struct pci_bus *parent) +static struct pci_bus *pci_alloc_bus (void ) {struct pci_bus *b;
@@ -496,10 +496,6 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)INIT_LIST_HEAD (&b->resources); b->max_bus_speed =PCI_SPEED_UNKNOWN ; b->cur_bus_speed =PCI_SPEED_UNKNOWN ; -#ifdef CONFIG_PCI_DOMAINS_GENERIC -if (parent) - b->domain_nr = parent->domain_nr; -#endif return b; }
@@ -670,7 +666,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,/* * Allocate a new bus, and inherit stuff from the parent.. */ - child =pci_alloc_bus (parent); + child =pci_alloc_bus ();if (!child)return NULL ;
@@ -1974,7 +1970,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int domain,return NULL ; } - b =pci_alloc_bus (NULL ); + b =pci_alloc_bus ();if (!b) goto unregister_host;
@@ -1982,7 +1978,6 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int domain, b->sysdata = sysdata; b->ops = ops; b->number = b->busn_res.start = bus; -pci_bus_assign_domain_nr (b, parent); b->bridge =get_device (&bridge->dev);device_enable_async_suspend (b->bridge);
include/linux/pci.h +0 -3
@@ -461,9 +461,6 @@ struct pci_bus {unsigned char primary;/* number of primary bridge */ unsigned char max_bus_speed;/* enum pci_bus_speed */ unsigned char cur_bus_speed;/* enum pci_bus_speed */ -#ifdef CONFIG_PCI_DOMAINS_GENERIC -int domain_nr; -#endif char name[48 ];
Signature · 1 line
1.7.1
PATCH v12 9/10 PCI: Remove pci_bus_assign_domain_nr()
In reply to Yijing WangNow we save the domain number in pci_host_bridge,
we could remove pci_bus_assign_domain_nr() and
clean the domain member in pci_bus.
--- drivers/pci/pci.c | 5 ----- drivers/pci/pci.h | 9 --------- drivers/pci/probe.c | 11 +++-------- include/linux/pci.h | 3 --- 4 files changed, 3 insertions(+), 25 deletions(-)
drivers/pci/pci.c +0 -5
@@ -4536,11 +4536,6 @@ static int pci_assign_domain_nr(struct device *dev)return domain; } - -void pci_bus_assign_domain_nr (struct pci_bus *bus,struct device *parent) -{ - bus->domain_nr =pci_assign_domain_nr (parent); -}#endif #endif
drivers/pci/pci.h +0 -9
@@ -335,14 +335,5 @@ static inline int pci_dev_specific_reset(struct pci_dev *dev, int probe)struct pci_host_bridge *pci_find_host_bridge (struct pci_bus *bus); -#ifdef CONFIG_PCI_DOMAINS_GENERIC -void pci_bus_assign_domain_nr (struct pci_bus *bus,struct device *parent); -#else -static inline void pci_bus_assign_domain_nr (struct pci_bus *bus, -struct device *parent) -{ -} -#endif -void pci_host_assign_domain_nr (struct pci_host_bridge *host,int domain);#endif /* DRIVERS_PCI_H */
drivers/pci/probe.c +3 -8
@@ -481,7 +481,7 @@ void pci_read_bridge_bases(struct pci_bus *child) } } -static struct pci_bus *pci_alloc_bus (struct pci_bus *parent) +static struct pci_bus *pci_alloc_bus (void ) {struct pci_bus *b;
@@ -496,10 +496,6 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)INIT_LIST_HEAD (&b->resources); b->max_bus_speed =PCI_SPEED_UNKNOWN ; b->cur_bus_speed =PCI_SPEED_UNKNOWN ; -#ifdef CONFIG_PCI_DOMAINS_GENERIC -if (parent) - b->domain_nr = parent->domain_nr; -#endif return b; }
@@ -670,7 +666,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,/* * Allocate a new bus, and inherit stuff from the parent.. */ - child =pci_alloc_bus (parent); + child =pci_alloc_bus ();if (!child)return NULL ;
@@ -1974,7 +1970,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int domain,return NULL ; } - b =pci_alloc_bus (NULL ); + b =pci_alloc_bus ();if (!b) goto unregister_host;
@@ -1982,7 +1978,6 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int domain, b->sysdata = sysdata; b->ops = ops; b->number = b->busn_res.start = bus; -pci_bus_assign_domain_nr (b, parent); b->bridge =get_device (&bridge->dev);device_enable_async_suspend (b->bridge);
include/linux/pci.h +0 -3
@@ -461,9 +461,6 @@ struct pci_bus {unsigned char primary;/* number of primary bridge */ unsigned char max_bus_speed;/* enum pci_bus_speed */ unsigned char cur_bus_speed;/* enum pci_bus_speed */ -#ifdef CONFIG_PCI_DOMAINS_GENERIC -int domain_nr; -#endif char name[48 ];
Signature · 1 line
1.7.1
PATCH v12 10/10 IA64/PCI: Fix build warning found by kbuild test
In reply to Yijing WangKbuild test robot found we passed a pci_dev * to pci_domain_nr(). In old IA64 specific pci_domain_nr() It was macro defines:
#define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
#define pci_domain_nr(busdev) (PCI_CONTROLLER(busdev)->segment)
Both pci_dev * and pci_bus * have opaque sysdata, so IA64 specific pci_domain_nr() could get the pci_controller and return the exact domain number, but now we use common pci_domain_nr() functions, so we should fix this warning.
--- arch/ia64/sn/kernel/io_acpi_init.c | 6 +++--- arch/ia64/sn/kernel/io_init.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/ia64/sn/kernel/io_acpi_init.c +3 -3
@@ -364,12 +364,12 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info, status =acpi_evaluate_integer (rootbus_handle,METHOD_NAME__SEG ,NULL , &segment);if (ACPI_SUCCESS (status)) { -if (segment !=pci_domain_nr (dev)) { +if (segment !=pci_domain_nr (dev->bus)) {acpi_get_name (rootbus_handle,ACPI_FULL_PATHNAME , &name_buffer);printk (KERN_ERR "%s: Segment number mismatch, 0x%llx vs 0x%x for: %s\n" , - __func__, segment,pci_domain_nr (dev), + __func__, segment,pci_domain_nr (dev->bus), (char *)name_buffer.pointer);kfree (name_buffer.pointer);return 1 ;
@@ -407,7 +407,7 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info,/* Build up the pcidev_info.pdi_slot_host_handle */ host_devfn =get_host_devfn (pcidev_match.handle, rootbus_handle); (*pcidev_info)->pdi_slot_host_handle = - ((unsigned long )pci_domain_nr (dev) <<40 ) | + ((unsigned long )pci_domain_nr (dev->bus) <<40 ) |/* bus == 0 */ host_devfn;return 0 ;
arch/ia64/sn/kernel/io_init.c +1 -1
@@ -164,7 +164,7 @@ sn_io_slot_fixup(struct pci_dev *dev)panic ("%s: Unable to alloc memory for sn_irq_info" , __func__);/* Call to retrieve pci device information needed by kernel. */ - status = sal_get_pcidev_info((u64) pci_domain_nr(dev), + status = sal_get_pcidev_info((u64) pci_domain_nr(dev->bus), (u64) dev->bus->number, dev->devfn, (u64) __pa(pcidev_info),
Signature · 1 line
1.7.1
PATCH v12 10/10 IA64/PCI: Fix build warning found by kbuild test
In reply to Yijing WangKbuild test robot found we passed a pci_dev * to pci_domain_nr(). In old IA64 specific pci_domain_nr() It was macro defines:
#define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
#define pci_domain_nr(busdev) (PCI_CONTROLLER(busdev)->segment)
Both pci_dev * and pci_bus * have opaque sysdata, so IA64 specific pci_domain_nr() could get the pci_controller and return the exact domain number, but now we use common pci_domain_nr() functions, so we should fix this warning.
--- arch/ia64/sn/kernel/io_acpi_init.c | 6 +++--- arch/ia64/sn/kernel/io_init.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/ia64/sn/kernel/io_acpi_init.c +3 -3
@@ -364,12 +364,12 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info, status =acpi_evaluate_integer (rootbus_handle,METHOD_NAME__SEG ,NULL , &segment);if (ACPI_SUCCESS (status)) { -if (segment !=pci_domain_nr (dev)) { +if (segment !=pci_domain_nr (dev->bus)) {acpi_get_name (rootbus_handle,ACPI_FULL_PATHNAME , &name_buffer);printk (KERN_ERR "%s: Segment number mismatch, 0x%llx vs 0x%x for: %s\n" , - __func__, segment,pci_domain_nr (dev), + __func__, segment,pci_domain_nr (dev->bus), (char *)name_buffer.pointer);kfree (name_buffer.pointer);return 1 ;
@@ -407,7 +407,7 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info,/* Build up the pcidev_info.pdi_slot_host_handle */ host_devfn =get_host_devfn (pcidev_match.handle, rootbus_handle); (*pcidev_info)->pdi_slot_host_handle = - ((unsigned long )pci_domain_nr (dev) <<40 ) | + ((unsigned long )pci_domain_nr (dev->bus) <<40 ) |/* bus == 0 */ host_devfn;return 0 ;
arch/ia64/sn/kernel/io_init.c +1 -1
@@ -164,7 +164,7 @@ sn_io_slot_fixup(struct pci_dev *dev)panic ("%s: Unable to alloc memory for sn_irq_info" , __func__);/* Call to retrieve pci device information needed by kernel. */ - status = sal_get_pcidev_info((u64) pci_domain_nr(dev), + status = sal_get_pcidev_info((u64) pci_domain_nr(dev->bus), (u64) dev->bus->number, dev->devfn, (u64) __pa(pcidev_info),
Signature · 1 line
1.7.1
Quoted 74 lines · Yijing Wang
This series is splitted out from previous patchset "Refine PCI scan interfaces and make generic pci host bridge". It try to clean up all platform
pci_domain_nr(), save domain inpci_host_bridge, so we could get domain number from the common interface.
v11->v12:
Introduce wrap functionpci_create_root_bus_generic()andpci_create_root_bus_generic()for arm/arm64 which enableCONFIG_PCI_DOMAINS_GENERIC.
Rebased this series based 4.2-rc1Yijing Wang (10):
PCI: Save domain inpci_host_bridge
PCI: Movepci_bus_assign_domain_nr()declaration into
drivers/pci/pci.h
PCI: Remove declaration forpci_get_new_domain_nr()
PCI: Introducepci_host_assign_domain_nr()to assign domain powerpc/PCI: Renamepcibios_root_bridge_prepare()to
pcibios_root_bus_prepare()
PCI: Makepci_host_bridgehold sysdata in drvdata
PCI: Create pci host bridge prior to root bus
PCI: Introduce commonpci_domain_nr()and remove platform specific
code
PCI: Removepci_bus_assign_domain_nr()
IA64/PCI: Fix build warning found by kbuild testarch/alpha/include/asm/pci.h | 2 - arch/alpha/kernel/pci.c | 4 +- arch/alpha/kernel/sys_nautilus.c | 2 +- arch/arm/kernel/bios32.c | 2 +- arch/arm/mach-dove/pcie.c | 2 +- arch/arm/mach-iop13xx/pci.c | 4 +- arch/arm/mach-mv78xx0/pcie.c | 2 +- arch/arm/mach-orion5x/pci.c | 4 +- arch/frv/mb93090-mb00/pci-vdk.c | 3 +- arch/ia64/include/asm/pci.h | 1 - arch/ia64/pci/pci.c | 6 +- arch/ia64/sn/kernel/io_acpi_init.c | 6 +- arch/ia64/sn/kernel/io_init.c | 6 +- arch/m68k/coldfire/pci.c | 2 +- arch/microblaze/include/asm/pci.h | 2 - arch/microblaze/pci/pci-common.c | 15 +---- arch/mips/include/asm/pci.h | 2 - arch/mips/pci/pci.c | 4 +- arch/mn10300/unit-asb2305/pci.c | 3 +- arch/powerpc/include/asm/machdep.h | 2 +- arch/powerpc/include/asm/pci.h | 2 - arch/powerpc/kernel/pci-common.c | 21 ++----- arch/powerpc/platforms/pseries/pci.c | 2 +- arch/powerpc/platforms/pseries/pseries.h | 2 +- arch/powerpc/platforms/pseries/setup.c | 2 +- arch/s390/include/asm/pci.h | 1 - arch/s390/pci/pci.c | 10 +--- arch/sh/drivers/pci/pci.c | 4 +- arch/sh/include/asm/pci.h | 2 - arch/sparc/include/asm/pci_64.h | 1 - arch/sparc/kernel/leon_pci.c | 2 +- arch/sparc/kernel/pci.c | 21 +------ arch/sparc/kernel/pcic.c | 2 +- arch/tile/include/asm/pci.h | 2 - arch/tile/kernel/pci.c | 4 +- arch/tile/kernel/pci_gx.c | 4 +- arch/unicore32/kernel/pci.c | 2 +- arch/x86/include/asm/pci.h | 6 -- arch/x86/pci/acpi.c | 6 +- arch/x86/pci/common.c | 2 +- arch/xtensa/kernel/pci.c | 2 +- drivers/parisc/dino.c | 2 +- drivers/parisc/lba_pci.c | 2 +- drivers/pci/host/pci-versatile.c | 3 +- drivers/pci/host/pci-xgene.c | 2 +- drivers/pci/host/pcie-designware.c | 2 +- drivers/pci/host/pcie-iproc.c | 2 +-
Quoted 8 lines
drivers/pci/host/pcie-xilinx.c | 2 +- drivers/pci/hotplug/ibmphp_core.c | 2 +- drivers/pci/pci.c | 31 ++++++++-- drivers/pci/pci.h | 1 + drivers/pci/probe.c | 92 +++++++++++++++++------------- drivers/pci/xen-pcifront.c | 2 +- include/linux/pci.h | 39 ++++++------- 54 files changed, 161 insertions(+), 195 deletions(-)
Doesn't apply to v4.4-rc2. Please refresh and repost if this is still relevant.
Bjorn
Quoted 3 lines
Doesn't apply to v4.4-rc2. Please refresh and repost if this is still relevant.
Hi Bjorn, this is still relevant, I will refresh it and post the new version soon.
Thanks!
Yijing.
Quoted 3 lines
.
Quoted 3 lines
Doesn't apply to v4.4-rc2. Please refresh and repost if this is still relevant.
Hi Bjorn, this is still relevant, I will refresh it and post the new version soon.
Thanks!
Yijing.
Quoted 3 lines
.
Quoted 74 lines · Yijing Wang
This series is splitted out from previous patchset "Refine PCI scan interfaces and make generic pci host bridge". It try to clean up all platform
pci_domain_nr(), save domain inpci_host_bridge, so we could get domain number from the common interface.
v11->v12:
Introduce wrap functionpci_create_root_bus_generic()andpci_create_root_bus_generic()for arm/arm64 which enableCONFIG_PCI_DOMAINS_GENERIC.
Rebased this series based 4.2-rc1Yijing Wang (10):
PCI: Save domain inpci_host_bridge
PCI: Movepci_bus_assign_domain_nr()declaration into
drivers/pci/pci.h
PCI: Remove declaration forpci_get_new_domain_nr()
PCI: Introducepci_host_assign_domain_nr()to assign domain powerpc/PCI: Renamepcibios_root_bridge_prepare()to
pcibios_root_bus_prepare()
PCI: Makepci_host_bridgehold sysdata in drvdata
PCI: Create pci host bridge prior to root bus
PCI: Introduce commonpci_domain_nr()and remove platform specific
code
PCI: Removepci_bus_assign_domain_nr()
IA64/PCI: Fix build warning found by kbuild testarch/alpha/include/asm/pci.h | 2 - arch/alpha/kernel/pci.c | 4 +- arch/alpha/kernel/sys_nautilus.c | 2 +- arch/arm/kernel/bios32.c | 2 +- arch/arm/mach-dove/pcie.c | 2 +- arch/arm/mach-iop13xx/pci.c | 4 +- arch/arm/mach-mv78xx0/pcie.c | 2 +- arch/arm/mach-orion5x/pci.c | 4 +- arch/frv/mb93090-mb00/pci-vdk.c | 3 +- arch/ia64/include/asm/pci.h | 1 - arch/ia64/pci/pci.c | 6 +- arch/ia64/sn/kernel/io_acpi_init.c | 6 +- arch/ia64/sn/kernel/io_init.c | 6 +- arch/m68k/coldfire/pci.c | 2 +- arch/microblaze/include/asm/pci.h | 2 - arch/microblaze/pci/pci-common.c | 15 +---- arch/mips/include/asm/pci.h | 2 - arch/mips/pci/pci.c | 4 +- arch/mn10300/unit-asb2305/pci.c | 3 +- arch/powerpc/include/asm/machdep.h | 2 +- arch/powerpc/include/asm/pci.h | 2 - arch/powerpc/kernel/pci-common.c | 21 ++----- arch/powerpc/platforms/pseries/pci.c | 2 +- arch/powerpc/platforms/pseries/pseries.h | 2 +- arch/powerpc/platforms/pseries/setup.c | 2 +- arch/s390/include/asm/pci.h | 1 - arch/s390/pci/pci.c | 10 +--- arch/sh/drivers/pci/pci.c | 4 +- arch/sh/include/asm/pci.h | 2 - arch/sparc/include/asm/pci_64.h | 1 - arch/sparc/kernel/leon_pci.c | 2 +- arch/sparc/kernel/pci.c | 21 +------ arch/sparc/kernel/pcic.c | 2 +- arch/tile/include/asm/pci.h | 2 - arch/tile/kernel/pci.c | 4 +- arch/tile/kernel/pci_gx.c | 4 +- arch/unicore32/kernel/pci.c | 2 +- arch/x86/include/asm/pci.h | 6 -- arch/x86/pci/acpi.c | 6 +- arch/x86/pci/common.c | 2 +- arch/xtensa/kernel/pci.c | 2 +- drivers/parisc/dino.c | 2 +- drivers/parisc/lba_pci.c | 2 +- drivers/pci/host/pci-versatile.c | 3 +- drivers/pci/host/pci-xgene.c | 2 +- drivers/pci/host/pcie-designware.c | 2 +- drivers/pci/host/pcie-iproc.c | 2 +-
Quoted 8 lines
drivers/pci/host/pcie-xilinx.c | 2 +- drivers/pci/hotplug/ibmphp_core.c | 2 +- drivers/pci/pci.c | 31 ++++++++-- drivers/pci/pci.h | 1 + drivers/pci/probe.c | 92 +++++++++++++++++------------- drivers/pci/xen-pcifront.c | 2 +- include/linux/pci.h | 39 ++++++------- 54 files changed, 161 insertions(+), 195 deletions(-)
Doesn't apply to v4.4-rc2. Please refresh and repost if this is still relevant.
Bjorn