aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yang <weiyang@linux.vnet.ibm.com>2015-03-25 04:23:56 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2015-03-30 22:02:37 -0400
commit5350ab3fd794f899079d9f6b2b6fe1a7917087ef (patch)
treece7466d8d07e6bc1f150c3003daf0cc15dbfef21
parent6e628c7d33d99406cef374972c89389edcc3570f (diff)
powerpc/powernv: Implement pcibios_iov_resource_alignment() on powernv
Implement pcibios_iov_resource_alignment() on powernv platform. On PowerNV platform, there are 3 cases for the IOV BAR: 1. initial state, the IOV BAR size is multiple times of VF BAR size 2. after expanded, the IOV BAR size is expanded to meet the M64 segment size 3. sizing stage, the IOV BAR is truncated to 0 pnv_pci_iov_resource_alignment() handle these three cases respectively. [bhelgaas: adjust to drop "align" parameter, return pci_iov_resource_size() if no ppc_md machdep_call version] Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/machdep.h1
-rw-r--r--arch/powerpc/kernel/pci-common.c10
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c20
3 files changed, 31 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index b303833fa3fb..1b268044f290 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -252,6 +252,7 @@ struct machdep_calls {
252 252
253#ifdef CONFIG_PCI_IOV 253#ifdef CONFIG_PCI_IOV
254 void (*pcibios_fixup_sriov)(struct pci_dev *pdev); 254 void (*pcibios_fixup_sriov)(struct pci_dev *pdev);
255 resource_size_t (*pcibios_iov_resource_alignment)(struct pci_dev *, int resno);
255#endif /* CONFIG_PCI_IOV */ 256#endif /* CONFIG_PCI_IOV */
256 257
257 /* Called to shutdown machine specific hardware not already controlled 258 /* Called to shutdown machine specific hardware not already controlled
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 375bf7099912..9a306ff304ae 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -130,6 +130,16 @@ void pcibios_reset_secondary_bus(struct pci_dev *dev)
130 pci_reset_secondary_bus(dev); 130 pci_reset_secondary_bus(dev);
131} 131}
132 132
133#ifdef CONFIG_PCI_IOV
134resource_size_t pcibios_iov_resource_alignment(struct pci_dev *pdev, int resno)
135{
136 if (ppc_md.pcibios_iov_resource_alignment)
137 return ppc_md.pcibios_iov_resource_alignment(pdev, resno);
138
139 return pci_iov_resource_size(pdev, resno);
140}
141#endif /* CONFIG_PCI_IOV */
142
133static resource_size_t pcibios_io_size(const struct pci_controller *hose) 143static resource_size_t pcibios_io_size(const struct pci_controller *hose)
134{ 144{
135#ifdef CONFIG_PPC64 145#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 1da45aa76a03..217eaad23cde 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1965,6 +1965,25 @@ static resource_size_t pnv_pci_window_alignment(struct pci_bus *bus,
1965 return phb->ioda.io_segsize; 1965 return phb->ioda.io_segsize;
1966} 1966}
1967 1967
1968#ifdef CONFIG_PCI_IOV
1969static resource_size_t pnv_pci_iov_resource_alignment(struct pci_dev *pdev,
1970 int resno)
1971{
1972 struct pci_dn *pdn = pci_get_pdn(pdev);
1973 resource_size_t align, iov_align;
1974
1975 iov_align = resource_size(&pdev->resource[resno]);
1976 if (iov_align)
1977 return iov_align;
1978
1979 align = pci_iov_resource_size(pdev, resno);
1980 if (pdn->vfs_expanded)
1981 return pdn->vfs_expanded * align;
1982
1983 return align;
1984}
1985#endif /* CONFIG_PCI_IOV */
1986
1968/* Prevent enabling devices for which we couldn't properly 1987/* Prevent enabling devices for which we couldn't properly
1969 * assign a PE 1988 * assign a PE
1970 */ 1989 */
@@ -2164,6 +2183,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
2164 ppc_md.pcibios_reset_secondary_bus = pnv_pci_reset_secondary_bus; 2183 ppc_md.pcibios_reset_secondary_bus = pnv_pci_reset_secondary_bus;
2165#ifdef CONFIG_PCI_IOV 2184#ifdef CONFIG_PCI_IOV
2166 ppc_md.pcibios_fixup_sriov = pnv_pci_ioda_fixup_iov_resources; 2185 ppc_md.pcibios_fixup_sriov = pnv_pci_ioda_fixup_iov_resources;
2186 ppc_md.pcibios_iov_resource_alignment = pnv_pci_iov_resource_alignment;
2167#endif /* CONFIG_PCI_IOV */ 2187#endif /* CONFIG_PCI_IOV */
2168 pci_add_flags(PCI_REASSIGN_ALL_RSRC); 2188 pci_add_flags(PCI_REASSIGN_ALL_RSRC);
2169 2189