mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-12 00:38:55 +00:00
powerpc/pci: Separate SR-IOV Calls
SR-IOV can now be enabled for the powernv platform and pseries platform. Therefore move the appropriate calls to machine dependent code instead of relying on definition at compile time. Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com> Signed-off-by: Juan J. Alvarez <jjalvare@us.ibm.com> Acked-by: Russell Currey <ruscur@russell.cc> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
5c45b52801
commit
988fc3ba56
@ -172,11 +172,19 @@ struct machdep_calls {
|
|||||||
/* Called after scan and before resource survey */
|
/* Called after scan and before resource survey */
|
||||||
void (*pcibios_fixup_phb)(struct pci_controller *hose);
|
void (*pcibios_fixup_phb)(struct pci_controller *hose);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called after device has been added to bus and
|
||||||
|
* before sysfs has been created.
|
||||||
|
*/
|
||||||
|
void (*pcibios_bus_add_device)(struct pci_dev *pdev);
|
||||||
|
|
||||||
resource_size_t (*pcibios_default_alignment)(void);
|
resource_size_t (*pcibios_default_alignment)(void);
|
||||||
|
|
||||||
#ifdef CONFIG_PCI_IOV
|
#ifdef CONFIG_PCI_IOV
|
||||||
void (*pcibios_fixup_sriov)(struct pci_dev *pdev);
|
void (*pcibios_fixup_sriov)(struct pci_dev *pdev);
|
||||||
resource_size_t (*pcibios_iov_resource_alignment)(struct pci_dev *, int resno);
|
resource_size_t (*pcibios_iov_resource_alignment)(struct pci_dev *, int resno);
|
||||||
|
int (*pcibios_sriov_enable)(struct pci_dev *pdev, u16 num_vfs);
|
||||||
|
int (*pcibios_sriov_disable)(struct pci_dev *pdev);
|
||||||
#endif /* CONFIG_PCI_IOV */
|
#endif /* CONFIG_PCI_IOV */
|
||||||
|
|
||||||
/* Called to shutdown machine specific hardware not already controlled
|
/* Called to shutdown machine specific hardware not already controlled
|
||||||
|
@ -203,10 +203,9 @@ struct pci_dn {
|
|||||||
struct eeh_dev *edev; /* eeh device */
|
struct eeh_dev *edev; /* eeh device */
|
||||||
#endif
|
#endif
|
||||||
#define IODA_INVALID_PE 0xFFFFFFFF
|
#define IODA_INVALID_PE 0xFFFFFFFF
|
||||||
#ifdef CONFIG_PPC_POWERNV
|
|
||||||
unsigned int pe_number;
|
unsigned int pe_number;
|
||||||
int vf_index; /* VF index in the PF */
|
|
||||||
#ifdef CONFIG_PCI_IOV
|
#ifdef CONFIG_PCI_IOV
|
||||||
|
int vf_index; /* VF index in the PF */
|
||||||
u16 vfs_expanded; /* number of VFs IOV BAR expanded */
|
u16 vfs_expanded; /* number of VFs IOV BAR expanded */
|
||||||
u16 num_vfs; /* number of VFs enabled*/
|
u16 num_vfs; /* number of VFs enabled*/
|
||||||
unsigned int *pe_num_map; /* PE# for the first VF PE or array */
|
unsigned int *pe_num_map; /* PE# for the first VF PE or array */
|
||||||
@ -215,7 +214,6 @@ struct pci_dn {
|
|||||||
int (*m64_map)[PCI_SRIOV_NUM_BARS];
|
int (*m64_map)[PCI_SRIOV_NUM_BARS];
|
||||||
#endif /* CONFIG_PCI_IOV */
|
#endif /* CONFIG_PCI_IOV */
|
||||||
int mps; /* Maximum Payload Size */
|
int mps; /* Maximum Payload Size */
|
||||||
#endif
|
|
||||||
struct list_head child_list;
|
struct list_head child_list;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
struct resource holes[PCI_SRIOV_NUM_BARS];
|
struct resource holes[PCI_SRIOV_NUM_BARS];
|
||||||
|
@ -440,7 +440,7 @@ static void *eeh_add_virt_device(void *data, void *userdata)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PPC_POWERNV
|
#ifdef CONFIG_PCI_IOV
|
||||||
pci_iov_add_virtfn(edev->physfn, pdn->vf_index);
|
pci_iov_add_virtfn(edev->physfn, pdn->vf_index);
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -496,7 +496,7 @@ static void *eeh_rmv_device(void *data, void *userdata)
|
|||||||
(*removed)++;
|
(*removed)++;
|
||||||
|
|
||||||
if (edev->physfn) {
|
if (edev->physfn) {
|
||||||
#ifdef CONFIG_PPC_POWERNV
|
#ifdef CONFIG_PCI_IOV
|
||||||
struct pci_dn *pdn = eeh_dev_to_pdn(edev);
|
struct pci_dn *pdn = eeh_dev_to_pdn(edev);
|
||||||
|
|
||||||
pci_iov_remove_virtfn(edev->physfn, pdn->vf_index);
|
pci_iov_remove_virtfn(edev->physfn, pdn->vf_index);
|
||||||
|
@ -249,8 +249,31 @@ resource_size_t pcibios_iov_resource_alignment(struct pci_dev *pdev, int resno)
|
|||||||
|
|
||||||
return pci_iov_resource_size(pdev, resno);
|
return pci_iov_resource_size(pdev, resno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs)
|
||||||
|
{
|
||||||
|
if (ppc_md.pcibios_sriov_enable)
|
||||||
|
return ppc_md.pcibios_sriov_enable(pdev, num_vfs);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pcibios_sriov_disable(struct pci_dev *pdev)
|
||||||
|
{
|
||||||
|
if (ppc_md.pcibios_sriov_disable)
|
||||||
|
return ppc_md.pcibios_sriov_disable(pdev);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_PCI_IOV */
|
#endif /* CONFIG_PCI_IOV */
|
||||||
|
|
||||||
|
void pcibios_bus_add_device(struct pci_dev *pdev)
|
||||||
|
{
|
||||||
|
if (ppc_md.pcibios_bus_add_device)
|
||||||
|
ppc_md.pcibios_bus_add_device(pdev);
|
||||||
|
}
|
||||||
|
|
||||||
static resource_size_t pcibios_io_size(const struct pci_controller *hose)
|
static resource_size_t pcibios_io_size(const struct pci_controller *hose)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PPC64
|
#ifdef CONFIG_PPC64
|
||||||
|
@ -156,10 +156,8 @@ static struct pci_dn *add_one_dev_pci_data(struct pci_dn *parent,
|
|||||||
pdn->parent = parent;
|
pdn->parent = parent;
|
||||||
pdn->busno = busno;
|
pdn->busno = busno;
|
||||||
pdn->devfn = devfn;
|
pdn->devfn = devfn;
|
||||||
#ifdef CONFIG_PPC_POWERNV
|
|
||||||
pdn->vf_index = vf_index;
|
pdn->vf_index = vf_index;
|
||||||
pdn->pe_number = IODA_INVALID_PE;
|
pdn->pe_number = IODA_INVALID_PE;
|
||||||
#endif
|
|
||||||
INIT_LIST_HEAD(&pdn->child_list);
|
INIT_LIST_HEAD(&pdn->child_list);
|
||||||
INIT_LIST_HEAD(&pdn->list);
|
INIT_LIST_HEAD(&pdn->list);
|
||||||
list_add_tail(&pdn->list, &parent->child_list);
|
list_add_tail(&pdn->list, &parent->child_list);
|
||||||
@ -226,9 +224,7 @@ void remove_dev_pci_data(struct pci_dev *pdev)
|
|||||||
*/
|
*/
|
||||||
if (pdev->is_virtfn) {
|
if (pdev->is_virtfn) {
|
||||||
pdn = pci_get_pdn(pdev);
|
pdn = pci_get_pdn(pdev);
|
||||||
#ifdef CONFIG_PPC_POWERNV
|
|
||||||
pdn->pe_number = IODA_INVALID_PE;
|
pdn->pe_number = IODA_INVALID_PE;
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,9 +290,7 @@ struct pci_dn *pci_add_device_node_info(struct pci_controller *hose,
|
|||||||
return NULL;
|
return NULL;
|
||||||
dn->data = pdn;
|
dn->data = pdn;
|
||||||
pdn->phb = hose;
|
pdn->phb = hose;
|
||||||
#ifdef CONFIG_PPC_POWERNV
|
|
||||||
pdn->pe_number = IODA_INVALID_PE;
|
pdn->pe_number = IODA_INVALID_PE;
|
||||||
#endif
|
|
||||||
regs = of_get_property(dn, "reg", NULL);
|
regs = of_get_property(dn, "reg", NULL);
|
||||||
if (regs) {
|
if (regs) {
|
||||||
u32 addr = of_read_number(regs, 1);
|
u32 addr = of_read_number(regs, 1);
|
||||||
|
@ -43,6 +43,22 @@
|
|||||||
|
|
||||||
static int eeh_event_irq = -EINVAL;
|
static int eeh_event_irq = -EINVAL;
|
||||||
|
|
||||||
|
void pnv_pcibios_bus_add_device(struct pci_dev *pdev)
|
||||||
|
{
|
||||||
|
struct pci_dn *pdn = pci_get_pdn(pdev);
|
||||||
|
|
||||||
|
if (!pdev->is_virtfn)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following operations will fail if VF's sysfs files
|
||||||
|
* aren't created or its resources aren't finalized.
|
||||||
|
*/
|
||||||
|
eeh_add_device_early(pdn);
|
||||||
|
eeh_add_device_late(pdev);
|
||||||
|
eeh_sysfs_add_device(pdev);
|
||||||
|
}
|
||||||
|
|
||||||
static int pnv_eeh_init(void)
|
static int pnv_eeh_init(void)
|
||||||
{
|
{
|
||||||
struct pci_controller *hose;
|
struct pci_controller *hose;
|
||||||
@ -86,6 +102,7 @@ static int pnv_eeh_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
eeh_set_pe_aux_size(max_diag_size);
|
eeh_set_pe_aux_size(max_diag_size);
|
||||||
|
ppc_md.pcibios_bus_add_device = pnv_pcibios_bus_add_device;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1749,22 +1766,6 @@ static struct eeh_ops pnv_eeh_ops = {
|
|||||||
.restore_config = pnv_eeh_restore_config
|
.restore_config = pnv_eeh_restore_config
|
||||||
};
|
};
|
||||||
|
|
||||||
void pcibios_bus_add_device(struct pci_dev *pdev)
|
|
||||||
{
|
|
||||||
struct pci_dn *pdn = pci_get_pdn(pdev);
|
|
||||||
|
|
||||||
if (!pdev->is_virtfn)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The following operations will fail if VF's sysfs files
|
|
||||||
* aren't created or its resources aren't finalized.
|
|
||||||
*/
|
|
||||||
eeh_add_device_early(pdn);
|
|
||||||
eeh_add_device_late(pdev);
|
|
||||||
eeh_sysfs_add_device(pdev);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_PCI_IOV
|
#ifdef CONFIG_PCI_IOV
|
||||||
static void pnv_pci_fixup_vf_mps(struct pci_dev *pdev)
|
static void pnv_pci_fixup_vf_mps(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
|
@ -1692,7 +1692,7 @@ m64_failed:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pcibios_sriov_disable(struct pci_dev *pdev)
|
int pnv_pcibios_sriov_disable(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
pnv_pci_sriov_disable(pdev);
|
pnv_pci_sriov_disable(pdev);
|
||||||
|
|
||||||
@ -1701,7 +1701,7 @@ int pcibios_sriov_disable(struct pci_dev *pdev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs)
|
int pnv_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs)
|
||||||
{
|
{
|
||||||
/* Allocate PCI data */
|
/* Allocate PCI data */
|
||||||
add_dev_pci_data(pdev);
|
add_dev_pci_data(pdev);
|
||||||
@ -4019,6 +4019,8 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
|
|||||||
#ifdef CONFIG_PCI_IOV
|
#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_resources;
|
||||||
ppc_md.pcibios_iov_resource_alignment = pnv_pci_iov_resource_alignment;
|
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;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pci_add_flags(PCI_REASSIGN_ALL_RSRC);
|
pci_add_flags(PCI_REASSIGN_ALL_RSRC);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user