hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/arch/powerpc/platforms/pseries/pci.c
....@@ -1,22 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2001 Dave Engebretsen, IBM Corporation
34 * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM
45 *
56 * pSeries specific routines for PCI.
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
207 */
218
229 #include <linux/init.h>
....@@ -29,6 +16,7 @@
2916 #include <asm/pci-bridge.h>
3017 #include <asm/prom.h>
3118 #include <asm/ppc-pci.h>
19
+#include <asm/pci.h>
3220 #include "pseries.h"
3321
3422 #if 0
....@@ -204,7 +192,7 @@
204192 int pseries_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs)
205193 {
206194 /* Allocate PCI data */
207
- add_dev_pci_data(pdev);
195
+ add_sriov_vf_pdns(pdev);
208196 return pseries_pci_sriov_enable(pdev, num_vfs);
209197 }
210198
....@@ -216,7 +204,7 @@
216204 /* Releasing pe_num_map */
217205 kfree(pdn->pe_num_map);
218206 /* Release PCI data */
219
- remove_dev_pci_data(pdev);
207
+ remove_sriov_vf_pdns(pdev);
220208 pci_vf_drivers_autoprobe(pdev, true);
221209 return 0;
222210 }
....@@ -237,14 +225,37 @@
237225
238226 void __init pSeries_final_fixup(void)
239227 {
228
+ struct pci_controller *hose;
229
+
240230 pSeries_request_regions();
241231
242
- eeh_addr_cache_build();
232
+ eeh_show_enabled();
243233
244234 #ifdef CONFIG_PCI_IOV
245235 ppc_md.pcibios_sriov_enable = pseries_pcibios_sriov_enable;
246236 ppc_md.pcibios_sriov_disable = pseries_pcibios_sriov_disable;
247237 #endif
238
+ list_for_each_entry(hose, &hose_list, list_node) {
239
+ struct device_node *dn = hose->dn, *nvdn;
240
+
241
+ while (1) {
242
+ dn = of_find_all_nodes(dn);
243
+ if (!dn)
244
+ break;
245
+ nvdn = of_parse_phandle(dn, "ibm,nvlink", 0);
246
+ if (!nvdn)
247
+ continue;
248
+ if (!of_device_is_compatible(nvdn, "ibm,npu-link"))
249
+ continue;
250
+ if (!of_device_is_compatible(nvdn->parent,
251
+ "ibm,power9-npu"))
252
+ continue;
253
+#ifdef CONFIG_PPC_POWERNV
254
+ WARN_ON_ONCE(pnv_npu2_init(hose));
255
+#endif
256
+ break;
257
+ }
258
+ }
248259 }
249260
250261 /*