On Tue, Jun 10, 2014 at 09:56:34AM +0800, Wei Yang wrote: >This patch implements the pcibios_sriov_resource_alignment() on powernv >platform. > >Signed-off-by: Wei Yang <weiyang@xxxxxxxxxxxxxxxxxx> >--- > arch/powerpc/include/asm/machdep.h | 1 + > arch/powerpc/kernel/pci-common.c | 8 ++++++++ > arch/powerpc/platforms/powernv/pci-ioda.c | 17 +++++++++++++++++ > 3 files changed, 26 insertions(+) > >diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h >index 2f2e770..3bbc55f 100644 >--- a/arch/powerpc/include/asm/machdep.h >+++ b/arch/powerpc/include/asm/machdep.h >@@ -242,6 +242,7 @@ struct machdep_calls { > resource_size_t (*pcibios_window_alignment)(struct pci_bus *, unsigned long type); > #ifdef CONFIG_PCI_IOV > resource_size_t (*__pci_sriov_resource_size)(struct pci_dev *, int resno); >+ resource_size_t (*__pci_sriov_resource_alignment)(struct pci_dev *, int resno, resource_size_t align); > #endif /* CONFIG_PCI_IOV */ > > /* 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 c4e2e92..35345ac 100644 >--- a/arch/powerpc/kernel/pci-common.c >+++ b/arch/powerpc/kernel/pci-common.c >@@ -128,6 +128,14 @@ resource_size_t pcibios_sriov_resource_size(struct pci_dev *pdev, int resno) > > return 0; > } >+ >+resource_size_t pcibios_sriov_resource_alignment(struct pci_dev *pdev, int resno, resource_size_t align) >+{ >+ if (ppc_md.__pci_sriov_resource_alignment) >+ return ppc_md.__pci_sriov_resource_alignment(pdev, resno, align); >+ >+ return 0; >+} > #endif /* CONFIG_PCI_IOV */ > > static resource_size_t pcibios_io_size(const struct pci_controller *hose) >diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c >index 7dfad6a..b0ac851 100644 >--- a/arch/powerpc/platforms/powernv/pci-ioda.c >+++ b/arch/powerpc/platforms/powernv/pci-ioda.c >@@ -1573,6 +1573,22 @@ static resource_size_t __pnv_pci_sriov_resource_size(struct pci_dev *pdev, int r > > return size; > } >+ >+static resource_size_t __pnv_pci_sriov_resource_alignment(struct pci_dev *pdev, int resno, >+ resource_size_t align) The function could be "pcibios_sriov_resource_alignment()", but it's not a big deal. If you prefer the original one, then keep it :) >+{ >+ struct pci_dn *pdn = pci_get_pdn(pdev); >+ resource_size_t iov_align; >+ >+ iov_align = resource_size(&pdev->resource[resno]); >+ if (iov_align) >+ return iov_align; >+ >+ if (pdn->vfs) >+ return pdn->vfs * align; >+ >+ return align; >+} > #endif /* CONFIG_PCI_IOV */ > > /* Prevent enabling devices for which we couldn't properly >@@ -1777,6 +1793,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, > ppc_md.pcibios_window_alignment = pnv_pci_window_alignment; > #ifdef CONFIG_PCI_IOV > ppc_md.__pci_sriov_resource_size = __pnv_pci_sriov_resource_size; >+ ppc_md.__pci_sriov_resource_alignment = __pnv_pci_sriov_resource_alignment; > #endif /* CONFIG_PCI_IOV */ > pci_add_flags(PCI_REASSIGN_ALL_RSRC); > Thanks, Gavin -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html