Minor PCI & DMA init cleanups
Pulled out of my big series since these are fairly standalone changes
The series folds some single-use functions together and shovels around some code so it lives in a more sensible location. No functional changes.
PATCH 1/5 powerpc/pci: Fold pcibios_setup_device() into pcibios_bus_add_device()
pcibios_bus_add_device() is the only caller of pcibios_setup_device(). Fold them together since there's no real reason to keep them separate.
--- arch/powerpc/kernel/pci-common.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
arch/powerpc/kernel/pci-common.c +2 -8
@@ -958,7 +958,7 @@ void pcibios_setup_bus_self(struct pci_bus *bus) phb->controller_ops.dma_bus_setup (bus); } -static void pcibios_setup_device (struct pci_dev *dev) +void pcibios_bus_add_device (struct pci_dev *dev) {struct pci_controller *phb;/* Fixup NUMA node as it may not be setup yet by the generic
@@ -979,15 +979,9 @@ static void pcibios_setup_device(struct pci_dev *dev)pci_read_irq_line (dev);if (ppc_md.pci_irq_fixup) ppc_md.pci_irq_fixup (dev); -} - -void pcibios_bus_add_device (struct pci_dev *pdev) -{ -/* Perform platform-specific device setup */ -pcibios_setup_device (pdev);if (ppc_md.pcibios_bus_add_device) - ppc_md.pcibios_bus_add_device (pdev); + ppc_md.pcibios_bus_add_device (dev); }int pcibios_add_device (struct pci_dev *dev)
Signature · 1 line
2.9.5
PATCH 2/5 powernv/pci: Remove dma_dev_setup() for NPU PHBs
In reply to Oliver O'HalloranThe pnv_pci_dma_dev_setup() only does something when:
1) There PHB contains VFs, or
2) The PHB defines a dma_dev_setup() callback in the pnv_phb structure.
Neither is true for NPU PHBs so there's no reason to set the callback.
--- arch/powerpc/platforms/powernv/pci-ioda.c | 1 - 1 file changed, 1 deletion(-)
arch/powerpc/platforms/powernv/pci-ioda.c +0 -1
@@ -3620,7 +3620,6 @@ static const struct pci_controller_ops pnv_pci_ioda_controller_ops = { };static const struct pci_controller_ops pnv_npu_ioda_controller_ops = { - .dma_dev_setup = pnv_pci_dma_dev_setup, .setup_msi_irqs = pnv_setup_msi_irqs, .teardown_msi_irqs = pnv_teardown_msi_irqs, .enable_device_hook = pnv_pci_enable_device_hook,
Signature · 1 line
2.9.5
PATCH 3/5 powerpc/iov: Move VF pdev fixup into pcibios_fixup_iov()
In reply to Oliver O'HalloranAn ioda_pe for each VF is allocated in pnv_pci_sriov_enable() before the pci_dev for the VF is created. We need to set the pe->pdev pointer at some point after the pci_dev is created. Currently we do that in:
pcibios_bus_add_device()
pnv_pci_dma_dev_setup() (via phb->ops.dma_dev_setup) /* fixup is done here */ pnv_pci_ioda_dma_dev_setup() (via pnv_phb->dma_dev_setup)
The fixup needs to be done before setting up DMA for for the VF's PE, but there's no real reason to delay it until this point. Move the fixup into pnv_pci_ioda_fixup_iov() so the ordering is:
pcibios_add_device() pnv_pci_ioda_fixup_iov() (via ppc_md.pcibios_fixup_sriov) pcibios_bus_add_device() ...
This isn't strictly required, but it's slightly a slightly more logical place to do the fixup and it simplifies pnv_pci_dma_dev_setup().
--- arch/powerpc/platforms/powernv/pci-ioda.c | 29 +++++++++++++++++++++++++---- arch/powerpc/platforms/powernv/pci.c | 14 -------------- 2 files changed, 25 insertions(+), 18 deletions(-)
arch/powerpc/platforms/powernv/pci-ioda.c +25 -4
@@ -2900,9 +2900,6 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev)struct pci_dn *pdn;int mul, total_vfs; -if (!pdev->is_physfn ||pci_dev_is_added (pdev)) -return ; - pdn =pci_get_pdn (pdev); pdn->vfs_expanded =0 ; pdn->m64_single_mode = false;
@@ -2977,6 +2974,30 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev) res->end = res->start - 1; } } + +static void pnv_pci_ioda_fixup_iov (struct pci_dev *pdev) +{ +if (WARN_ON (pci_dev_is_added (pdev))) +return ; + +if (pdev->is_virtfn) { +struct pnv_ioda_pe *pe =pnv_ioda_get_pe (pdev); + +/* +* VF PEs are single-device PEs so their pdev pointer needs to +* be set. The pdev doesn't exist when the PE is allocated (in +* (pcibios_sriov_enable()) so we fix it up here. +*/ + pe->pdev = pdev; +WARN_ON (!(pe->flags &PNV_IODA_PE_VF )); + }else if (pdev->is_physfn) { +/* +* For PFs adjust their allocated IOV resources to match what +* the PHB can support using it's M64 BAR table. +*/ +pnv_pci_ioda_fixup_iov_resources (pdev); + } +}#endif /* CONFIG_PCI_IOV */ static void pnv_ioda_setup_pe_res(struct pnv_ioda_pe *pe,
@@ -3872,7 +3893,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, ppc_md.pcibios_default_alignment = pnv_pci_default_alignment;#ifdef CONFIG_PCI_IOV - ppc_md.pcibios_fixup_sriov = pnv_pci_ioda_fixup_iov_resources; + ppc_md.pcibios_fixup_sriov = pnv_pci_ioda_fixup_iov; ppc_md.pcibios_iov_resource_alignment = pnv_pci_iov_resource_alignment; ppc_md.pcibios_sriov_enable = pnv_pcibios_sriov_enable; ppc_md.pcibios_sriov_disable = pnv_pcibios_sriov_disable;
arch/powerpc/platforms/powernv/pci.c +0 -14
@@ -814,20 +814,6 @@ void pnv_pci_dma_dev_setup(struct pci_dev *pdev) {struct pci_controller *hose =pci_bus_to_host (pdev->bus);struct pnv_phb *phb = hose->private_data; -#ifdef CONFIG_PCI_IOV -struct pnv_ioda_pe *pe; - -/* Fix the VF pdn PE number */ -if (pdev->is_virtfn) { -list_for_each_entry (pe, &phb->ioda.pe_list, list) { -if (pe->rid == ((pdev->bus->number <<8 ) | - (pdev->devfn &0xff ))) { - pe->pdev = pdev; -break ; - } - } - } -#endif /* CONFIG_PCI_IOV */ if (phb && phb->dma_dev_setup) phb->dma_dev_setup (phb, pdev);
Signature · 1 line
2.9.5
PATCH 4/5 powernv/pci: Fold pnv_pci_dma_dev_setup() into the pci-ioda.c version
In reply to Oliver O'Halloranpnv_pci_dma_dev_setup() does nothing but call the phb->dma_dev_setup() callback, if one exists. That callback is only set for normal PCIe PHBs so we can remove the layer of indirection and use the ioda version in the pci_controller_ops.
--- arch/powerpc/platforms/powernv/pci-ioda.c | 7 ++++--- arch/powerpc/platforms/powernv/pci.c | 9 --------- arch/powerpc/platforms/powernv/pci.h | 2 -- 3 files changed, 4 insertions(+), 14 deletions(-)
arch/powerpc/platforms/powernv/pci-ioda.c +4 -3
@@ -1743,8 +1743,10 @@ int pnv_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs) }#endif /* CONFIG_PCI_IOV */ -static void pnv_pci_ioda_dma_dev_setup (struct pnv_phb *phb,struct pci_dev *pdev) +static void pnv_pci_ioda_dma_dev_setup (struct pci_dev *pdev) { +struct pci_controller *hose =pci_bus_to_host (pdev->bus); +struct pnv_phb *phb = hose->private_data;struct pci_dn *pdn =pci_get_pdn (pdev);struct pnv_ioda_pe *pe;
@@ -3627,7 +3629,7 @@ static void pnv_pci_ioda_shutdown(struct pci_controller *hose) }static const struct pci_controller_ops pnv_pci_ioda_controller_ops = { - .dma_dev_setup = pnv_pci_dma_dev_setup, + .dma_dev_setup = pnv_pci_ioda_dma_dev_setup, .dma_bus_setup = pnv_pci_dma_bus_setup, .iommu_bypass_supported = pnv_pci_ioda_iommu_bypass_supported, .setup_msi_irqs = pnv_setup_msi_irqs,
@@ -3886,7 +3888,6 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, hose->controller_ops = pnv_npu_ocapi_ioda_controller_ops;break ;default : - phb->dma_dev_setup = pnv_pci_ioda_dma_dev_setup; hose->controller_ops = pnv_pci_ioda_controller_ops; }
arch/powerpc/platforms/powernv/pci.c +0 -9
@@ -810,15 +810,6 @@ struct iommu_table *pnv_pci_table_alloc(int nid)return tbl; } -void pnv_pci_dma_dev_setup (struct pci_dev *pdev) -{ -struct pci_controller *hose =pci_bus_to_host (pdev->bus); -struct pnv_phb *phb = hose->private_data; - -if (phb && phb->dma_dev_setup) - phb->dma_dev_setup (phb, pdev); -} -void pnv_pci_dma_bus_setup (struct pci_bus *bus) {struct pci_controller *hose = bus->sysdata;
arch/powerpc/platforms/powernv/pci.h +0 -2
@@ -108,7 +108,6 @@ struct pnv_phb {int (*msi_setup)(struct pnv_phb *phb,struct pci_dev *dev,unsigned int hwirq,unsigned int virq,unsigned int is_64,struct msi_msg *msg); -void (*dma_dev_setup)(struct pnv_phb *phb,struct pci_dev *pdev);int (*init_m64)(struct pnv_phb *phb);int (*get_pe_state)(struct pnv_phb *phb,int pe_no);void (*freeze_pe)(struct pnv_phb *phb,int pe_no);
@@ -189,7 +188,6 @@ extern void pnv_npu2_map_lpar(struct pnv_ioda_pe *gpe, unsigned long msr);extern void pnv_pci_reset_secondary_bus (struct pci_dev *dev);extern int pnv_eeh_phb_reset (struct pci_controller *hose,int option); -extern void pnv_pci_dma_dev_setup (struct pci_dev *pdev);extern void pnv_pci_dma_bus_setup (struct pci_bus *bus);extern int pnv_setup_msi_irqs (struct pci_dev *pdev,int nvec,int type);extern void pnv_teardown_msi_irqs (struct pci_dev *pdev);
Signature · 1 line
2.9.5
PATCH 5/5 powernv/pci: Move pnv_pci_dma_bus_setup() to pci-ioda.c
In reply to Oliver O'HalloranThis is only used in pci-ioda.c so move it there and rename it to match.
--- arch/powerpc/platforms/powernv/pci-ioda.c | 22 +++++++++++++++++++++- arch/powerpc/platforms/powernv/pci.c | 20 -------------------- arch/powerpc/platforms/powernv/pci.h | 1 - 3 files changed, 21 insertions(+), 22 deletions(-)
arch/powerpc/platforms/powernv/pci-ioda.c +21 -1
@@ -3628,9 +3628,29 @@ static void pnv_pci_ioda_shutdown(struct pci_controller *hose) OPAL_ASSERT_RESET); } +static void pnv_pci_ioda_dma_bus_setup (struct pci_bus *bus) +{ +struct pci_controller *hose = bus->sysdata; +struct pnv_phb *phb = hose->private_data; +struct pnv_ioda_pe *pe; + +list_for_each_entry (pe, &phb->ioda.pe_list, list) { +if (!(pe->flags & (PNV_IODA_PE_BUS |PNV_IODA_PE_BUS_ALL ))) +continue ; + +if (!pe->pbus) +continue ; + +if (bus->number == ((pe->rid >>8 ) &0xFF )) { + pe->pbus = bus; +break ; + } + } +} +static const struct pci_controller_ops pnv_pci_ioda_controller_ops = { .dma_dev_setup = pnv_pci_ioda_dma_dev_setup, - .dma_bus_setup = pnv_pci_dma_bus_setup, + .dma_bus_setup = pnv_pci_ioda_dma_bus_setup, .iommu_bypass_supported = pnv_pci_ioda_iommu_bypass_supported, .setup_msi_irqs = pnv_setup_msi_irqs, .teardown_msi_irqs = pnv_teardown_msi_irqs,
arch/powerpc/platforms/powernv/pci.c +0 -20
@@ -810,26 +810,6 @@ struct iommu_table *pnv_pci_table_alloc(int nid)return tbl; } -void pnv_pci_dma_bus_setup (struct pci_bus *bus) -{ -struct pci_controller *hose = bus->sysdata; -struct pnv_phb *phb = hose->private_data; -struct pnv_ioda_pe *pe; - -list_for_each_entry (pe, &phb->ioda.pe_list, list) { -if (!(pe->flags & (PNV_IODA_PE_BUS |PNV_IODA_PE_BUS_ALL ))) -continue ; - -if (!pe->pbus) -continue ; - -if (bus->number == ((pe->rid >>8 ) &0xFF )) { - pe->pbus = bus; -break ; - } - } -} -struct device_node *pnv_pci_get_phb_node (struct pci_dev *dev) {struct pci_controller *hose =pci_bus_to_host (dev->bus);
arch/powerpc/platforms/powernv/pci.h +0 -1
@@ -188,7 +188,6 @@ extern void pnv_npu2_map_lpar(struct pnv_ioda_pe *gpe, unsigned long msr);extern void pnv_pci_reset_secondary_bus (struct pci_dev *dev);extern int pnv_eeh_phb_reset (struct pci_controller *hose,int option); -extern void pnv_pci_dma_bus_setup (struct pci_bus *bus);extern int pnv_setup_msi_irqs (struct pci_dev *pdev,int nvec,int type);extern void pnv_teardown_msi_irqs (struct pci_dev *pdev);extern struct pnv_ioda_pe *pnv_ioda_get_pe (struct pci_dev *dev);
Signature · 1 line
2.9.5
Re: [PATCH 1/5] powerpc/pci: Fold pcibios_setup_device() into pcibios_bus_add_device()
In reply to Oliver O'HalloranQuoted 4 lines · Oliver O'Halloran
pcibios_bus_add_device()is the only caller ofpcibios_setup_device(). Fold them together since there's no real reason to keep them separate.Signed-off-by Oliver O'Halloran <[email protected]>
Quoted 35 lines
--- arch/powerpc/kernel/pci-common.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)arch/powerpc/kernel/pci-common.c +2
-8@@ -958,7 +958,7 @@ void pcibios_setup_bus_self(struct pci_bus *bus) phb->controller_ops.dma_bus_setup (bus); } -static void pcibios_setup_device (struct pci_dev *dev) +void pcibios_bus_add_device (struct pci_dev *dev) {struct pci_controller *phb;/* Fixup NUMA node as it may not be setup yet by the generic @@ -979,15 +979,9 @@ static void pcibios_setup_device(struct pci_dev *dev)pci_read_irq_line (dev);if (ppc_md.pci_irq_fixup) ppc_md.pci_irq_fixup (dev); -} - -void pcibios_bus_add_device (struct pci_dev *pdev) -{ -/* Perform platform-specific device setup */ -pcibios_setup_device (pdev);if (ppc_md.pcibios_bus_add_device) - ppc_md.pcibios_bus_add_device (pdev); + ppc_md.pcibios_bus_add_device (dev); }int pcibios_add_device (struct pci_dev *dev)
Signature · 1 line
Alexey
Re: [PATCH 3/5] powerpc/iov: Move VF pdev fixup into pcibios_fixup_iov()
In reply to Oliver O'HalloranQuoted 13 lines · Oliver O'Halloran
An
ioda_pefor each VF is allocated inpnv_pci_sriov_enable()before thepci_devfor the VF is created. We need to set thepe->pdevpointer at some point after thepci_devis created. Currently we do that in:
pcibios_bus_add_device()pnv_pci_dma_dev_setup() (via phb->ops.dma_dev_setup) /* fixup is done here */ pnv_pci_ioda_dma_dev_setup() (via pnv_phb->dma_dev_setup)The fixup needs to be done before setting up DMA for for the VF's PE, but there's no real reason to delay it until this point. Move the fixup into
pnv_pci_ioda_fixup_iov()so the ordering is:
Quoted 7 lines
pcibios_add_device() pnv_pci_ioda_fixup_iov() (via ppc_md.pcibios_fixup_sriov) pcibios_bus_add_device() ...This isn't strictly required, but it's slightly a slightly more logical
s/slightly a slightly/slightly/ ?
Quoted 88 lines
place to do the fixup and it simplifies
pnv_pci_dma_dev_setup().Signed-off-by Oliver O'Halloran <[email protected]>--- arch/powerpc/platforms/powernv/pci-ioda.c | 29 +++++++++++++++++++++++++---- arch/powerpc/platforms/powernv/pci.c | 14 -------------- 2 files changed, 25 insertions(+), 18 deletions(-)arch/powerpc/platforms/powernv/pci-ioda.c +25
-4@@ -2900,9 +2900,6 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev)struct pci_dn *pdn;int mul, total_vfs; -if (!pdev->is_physfn ||pci_dev_is_added (pdev)) -return ; - pdn =pci_get_pdn (pdev); pdn->vfs_expanded =0 ; pdn->m64_single_mode = false;@@ -2977,6 +2974,30 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev) res->end = res->start - 1; } } + +static void pnv_pci_ioda_fixup_iov (struct pci_dev *pdev) +{ +if (WARN_ON (pci_dev_is_added (pdev))) +return ; + +if (pdev->is_virtfn) { +struct pnv_ioda_pe *pe =pnv_ioda_get_pe (pdev); + +/* +* VF PEs are single-device PEs so their pdev pointer needs to +* be set. The pdev doesn't exist when the PE is allocated (in +* (pcibios_sriov_enable()) so we fix it up here. +*/ + pe->pdev = pdev; +WARN_ON (!(pe->flags &PNV_IODA_PE_VF )); + }else if (pdev->is_physfn) { +/* +* For PFs adjust their allocated IOV resources to match what +* the PHB can support using it's M64 BAR table. +*/ +pnv_pci_ioda_fixup_iov_resources (pdev); + } +}#endif /* CONFIG_PCI_IOV */ static void pnv_ioda_setup_pe_res(struct pnv_ioda_pe *pe,@@ -3872,7 +3893,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, ppc_md.pcibios_default_alignment = pnv_pci_default_alignment;#ifdef CONFIG_PCI_IOV - ppc_md.pcibios_fixup_sriov = pnv_pci_ioda_fixup_iov_resources; + ppc_md.pcibios_fixup_sriov = pnv_pci_ioda_fixup_iov; ppc_md.pcibios_iov_resource_alignment = pnv_pci_iov_resource_alignment; ppc_md.pcibios_sriov_enable = pnv_pcibios_sriov_enable; ppc_md.pcibios_sriov_disable = pnv_pcibios_sriov_disable;arch/powerpc/platforms/powernv/pci.c +0
-14@@ -814,20 +814,6 @@ void pnv_pci_dma_dev_setup(struct pci_dev *pdev) {struct pci_controller *hose =pci_bus_to_host (pdev->bus);struct pnv_phb *phb = hose->private_data; -#ifdef CONFIG_PCI_IOV -struct pnv_ioda_pe *pe; - -/* Fix the VF pdn PE number */ -if (pdev->is_virtfn) { -list_for_each_entry (pe, &phb->ioda.pe_list, list) { -if (pe->rid == ((pdev->bus->number <<8 ) | - (pdev->devfn &0xff ))) { - pe->pdev = pdev; -break ; - } - } - } -#endif /* CONFIG_PCI_IOV */ if (phb && phb->dma_dev_setup) phb->dma_dev_setup (phb, pdev);
Signature · 1 line
Alexey
Re: [PATCH 4/5] powernv/pci: Fold pnv_pci_dma_dev_setup() into the pci-ioda.c version
In reply to Oliver O'HalloranQuoted 6 lines · Oliver O'Halloran
pnv_pci_dma_dev_setup()does nothing but call thephb->dma_dev_setup()callback, if one exists. That callback is only set for normal PCIe PHBs so we can remove the layer of indirection and use the ioda version in thepci_controller_ops.Signed-off-by Oliver O'Halloran <[email protected]>
Quoted 80 lines
--- arch/powerpc/platforms/powernv/pci-ioda.c | 7 ++++--- arch/powerpc/platforms/powernv/pci.c | 9 --------- arch/powerpc/platforms/powernv/pci.h | 2 -- 3 files changed, 4 insertions(+), 14 deletions(-)arch/powerpc/platforms/powernv/pci-ioda.c +4
-3@@ -1743,8 +1743,10 @@ int pnv_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs) }#endif /* CONFIG_PCI_IOV */ -static void pnv_pci_ioda_dma_dev_setup (struct pnv_phb *phb,struct pci_dev *pdev) +static void pnv_pci_ioda_dma_dev_setup (struct pci_dev *pdev) { +struct pci_controller *hose =pci_bus_to_host (pdev->bus); +struct pnv_phb *phb = hose->private_data;struct pci_dn *pdn =pci_get_pdn (pdev);struct pnv_ioda_pe *pe;@@ -3627,7 +3629,7 @@ static void pnv_pci_ioda_shutdown(struct pci_controller *hose) }static const struct pci_controller_ops pnv_pci_ioda_controller_ops = { - .dma_dev_setup = pnv_pci_dma_dev_setup, + .dma_dev_setup = pnv_pci_ioda_dma_dev_setup, .dma_bus_setup = pnv_pci_dma_bus_setup, .iommu_bypass_supported = pnv_pci_ioda_iommu_bypass_supported, .setup_msi_irqs = pnv_setup_msi_irqs,@@ -3886,7 +3888,6 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, hose->controller_ops = pnv_npu_ocapi_ioda_controller_ops;break ;default : - phb->dma_dev_setup = pnv_pci_ioda_dma_dev_setup; hose->controller_ops = pnv_pci_ioda_controller_ops; }arch/powerpc/platforms/powernv/pci.c +0
-9@@ -810,15 +810,6 @@ struct iommu_table *pnv_pci_table_alloc(int nid)return tbl; } -void pnv_pci_dma_dev_setup (struct pci_dev *pdev) -{ -struct pci_controller *hose =pci_bus_to_host (pdev->bus); -struct pnv_phb *phb = hose->private_data; - -if (phb && phb->dma_dev_setup) - phb->dma_dev_setup (phb, pdev); -} -void pnv_pci_dma_bus_setup (struct pci_bus *bus) {struct pci_controller *hose = bus->sysdata;arch/powerpc/platforms/powernv/pci.h +0
-2@@ -108,7 +108,6 @@ struct pnv_phb {int (*msi_setup)(struct pnv_phb *phb,struct pci_dev *dev,unsigned int hwirq,unsigned int virq,unsigned int is_64,struct msi_msg *msg); -void (*dma_dev_setup)(struct pnv_phb *phb,struct pci_dev *pdev);int (*init_m64)(struct pnv_phb *phb);int (*get_pe_state)(struct pnv_phb *phb,int pe_no);void (*freeze_pe)(struct pnv_phb *phb,int pe_no);@@ -189,7 +188,6 @@ extern void pnv_npu2_map_lpar(struct pnv_ioda_pe *gpe, unsigned long msr);extern void pnv_pci_reset_secondary_bus (struct pci_dev *dev);extern int pnv_eeh_phb_reset (struct pci_controller *hose,int option); -extern void pnv_pci_dma_dev_setup (struct pci_dev *pdev);extern void pnv_pci_dma_bus_setup (struct pci_bus *bus);extern int pnv_setup_msi_irqs (struct pci_dev *pdev,int nvec,int type);extern void pnv_teardown_msi_irqs (struct pci_dev *pdev);
Signature · 1 line
Alexey
Re: [PATCH 5/5] powernv/pci: Move pnv_pci_dma_bus_setup() to pci-ioda.c
In reply to Oliver O'HalloranQuoted 3 lines · Oliver O'Halloran
This is only used in
pci-ioda.cso move it there and rename it to match.Signed-off-by Oliver O'Halloran <[email protected]>
Quoted 85 lines
--- arch/powerpc/platforms/powernv/pci-ioda.c | 22 +++++++++++++++++++++- arch/powerpc/platforms/powernv/pci.c | 20 -------------------- arch/powerpc/platforms/powernv/pci.h | 1 - 3 files changed, 21 insertions(+), 22 deletions(-)arch/powerpc/platforms/powernv/pci-ioda.c +21
-1@@ -3628,9 +3628,29 @@ static void pnv_pci_ioda_shutdown(struct pci_controller *hose) OPAL_ASSERT_RESET); } +static void pnv_pci_ioda_dma_bus_setup (struct pci_bus *bus) +{ +struct pci_controller *hose = bus->sysdata; +struct pnv_phb *phb = hose->private_data; +struct pnv_ioda_pe *pe; + +list_for_each_entry (pe, &phb->ioda.pe_list, list) { +if (!(pe->flags & (PNV_IODA_PE_BUS |PNV_IODA_PE_BUS_ALL ))) +continue ; + +if (!pe->pbus) +continue ; + +if (bus->number == ((pe->rid >>8 ) &0xFF )) { + pe->pbus = bus; +break ; + } + } +} +static const struct pci_controller_ops pnv_pci_ioda_controller_ops = { .dma_dev_setup = pnv_pci_ioda_dma_dev_setup, - .dma_bus_setup = pnv_pci_dma_bus_setup, + .dma_bus_setup = pnv_pci_ioda_dma_bus_setup, .iommu_bypass_supported = pnv_pci_ioda_iommu_bypass_supported, .setup_msi_irqs = pnv_setup_msi_irqs, .teardown_msi_irqs = pnv_teardown_msi_irqs,arch/powerpc/platforms/powernv/pci.c +0
-20@@ -810,26 +810,6 @@ struct iommu_table *pnv_pci_table_alloc(int nid)return tbl; } -void pnv_pci_dma_bus_setup (struct pci_bus *bus) -{ -struct pci_controller *hose = bus->sysdata; -struct pnv_phb *phb = hose->private_data; -struct pnv_ioda_pe *pe; - -list_for_each_entry (pe, &phb->ioda.pe_list, list) { -if (!(pe->flags & (PNV_IODA_PE_BUS |PNV_IODA_PE_BUS_ALL ))) -continue ; - -if (!pe->pbus) -continue ; - -if (bus->number == ((pe->rid >>8 ) &0xFF )) { - pe->pbus = bus; -break ; - } - } -} -struct device_node *pnv_pci_get_phb_node (struct pci_dev *dev) {struct pci_controller *hose =pci_bus_to_host (dev->bus);arch/powerpc/platforms/powernv/pci.h +0
-1@@ -188,7 +188,6 @@ extern void pnv_npu2_map_lpar(struct pnv_ioda_pe *gpe, unsigned long msr);extern void pnv_pci_reset_secondary_bus (struct pci_dev *dev);extern int pnv_eeh_phb_reset (struct pci_controller *hose,int option); -extern void pnv_pci_dma_bus_setup (struct pci_bus *bus);extern int pnv_setup_msi_irqs (struct pci_dev *pdev,int nvec,int type);extern void pnv_teardown_msi_irqs (struct pci_dev *pdev);extern struct pnv_ioda_pe *pnv_ioda_get_pe (struct pci_dev *dev);
Signature · 1 line
Alexey
Re: [PATCH 1/5] powerpc/pci: Fold pcibios_setup_device() into pcibios_bus_add_device()
In reply to Oliver O'HalloranQuoted 4 lines · Oliver O'Halloran
pcibios_bus_add_device()is the only caller ofpcibios_setup_device(). Fold them together since there's no real reason to keep them separate.Signed-off-by Oliver O'Halloran <[email protected]>
Series applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/3ab3f3c9df348324029e3fbdf381f551b1df8f1e
cheers