Skip to content

Commit dae7253

Browse files
bglympe
authored andcommitted
powerpc/pseries: Add pseries SR-IOV Machine dependent calls
Add calls for pseries platform to configure/deconfigure SR-IOV. Signed-off-by: Bryant G. Ly <[email protected]> Signed-off-by: Juan J. Alvarez <[email protected]> Acked-by: Russell Currey <[email protected]> Reviewed-by: Alexey Kardashevskiy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 988fc3b commit dae7253

File tree

2 files changed

+49
-4
lines changed

2 files changed

+49
-4
lines changed

arch/powerpc/platforms/pseries/eeh_pseries.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,27 @@ static int ibm_get_config_addr_info;
5555
static int ibm_get_config_addr_info2;
5656
static int ibm_configure_pe;
5757

58+
void pseries_pcibios_bus_add_device(struct pci_dev *pdev)
59+
{
60+
struct pci_dn *pdn = pci_get_pdn(pdev);
61+
62+
if (!pdev->is_virtfn)
63+
return;
64+
65+
pdn->device_id = pdev->device;
66+
pdn->vendor_id = pdev->vendor;
67+
pdn->class_code = pdev->class;
68+
69+
/*
70+
* The following operations will fail if VF's sysfs files
71+
* aren't created or its resources aren't finalized.
72+
*/
73+
eeh_add_device_early(pdn);
74+
eeh_add_device_late(pdev);
75+
eeh_sysfs_add_device(pdev);
76+
77+
}
78+
5879
/*
5980
* Buffer for reporting slot-error-detail rtas calls. Its here
6081
* in BSS, and not dynamically alloced, so that it ends up in
@@ -120,6 +141,9 @@ static int pseries_eeh_init(void)
120141
/* Set EEH probe mode */
121142
eeh_add_flag(EEH_PROBE_MODE_DEVTREE | EEH_ENABLE_IO_FOR_LOG);
122143

144+
/* Set EEH machine dependent code */
145+
ppc_md.pcibios_bus_add_device = pseries_pcibios_bus_add_device;
146+
123147
return 0;
124148
}
125149

arch/powerpc/platforms/pseries/pci.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
* Copyright (C) 2003 Anton Blanchard <[email protected]>, IBM
44
*
55
* pSeries specific routines for PCI.
6-
*
6+
*
77
* This program is free software; you can redistribute it and/or modify
88
* it under the terms of the GNU General Public License as published by
99
* the Free Software Foundation; either version 2 of the License, or
1010
* (at your option) any later version.
11-
*
11+
*
1212
* This program is distributed in the hope that it will be useful,
1313
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1414
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1515
* GNU General Public License for more details.
16-
*
16+
*
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program; if not, write to the Free Software
1919
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -54,10 +54,26 @@ void pcibios_name_device(struct pci_dev *dev)
5454
}
5555
}
5656
}
57-
}
57+
}
5858
DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device);
5959
#endif
6060

61+
#ifdef CONFIG_PCI_IOV
62+
int pseries_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs)
63+
{
64+
/* Allocate PCI data */
65+
add_dev_pci_data(pdev);
66+
return 0;
67+
}
68+
69+
int pseries_pcibios_sriov_disable(struct pci_dev *pdev)
70+
{
71+
/* Release PCI data */
72+
remove_dev_pci_data(pdev);
73+
return 0;
74+
}
75+
#endif
76+
6177
static void __init pSeries_request_regions(void)
6278
{
6379
if (!isa_io_base)
@@ -76,6 +92,11 @@ void __init pSeries_final_fixup(void)
7692
pSeries_request_regions();
7793

7894
eeh_addr_cache_build();
95+
96+
#ifdef CONFIG_PCI_IOV
97+
ppc_md.pcibios_sriov_enable = pseries_pcibios_sriov_enable;
98+
ppc_md.pcibios_sriov_disable = pseries_pcibios_sriov_disable;
99+
#endif
79100
}
80101

81102
/*

0 commit comments

Comments
 (0)