Skip to content

Commit 3be2df0

Browse files
aikmpe
authored andcommitted
powerpc/pseries/npu: Enable platform support
We already changed NPU API for GPUs to not to call OPAL and the remaining bit is initializing NPU structures. This searches for POWER9 NVLinks attached to any device on a PHB and initializes an NPU structure if any found. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 68c0449 commit 3be2df0

File tree

1 file changed

+22
-0
lines changed
  • arch/powerpc/platforms/pseries

1 file changed

+22
-0
lines changed

arch/powerpc/platforms/pseries/pci.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <asm/pci-bridge.h>
3030
#include <asm/prom.h>
3131
#include <asm/ppc-pci.h>
32+
#include <asm/pci.h>
3233
#include "pseries.h"
3334

3435
#if 0
@@ -237,6 +238,8 @@ static void __init pSeries_request_regions(void)
237238

238239
void __init pSeries_final_fixup(void)
239240
{
241+
struct pci_controller *hose;
242+
240243
pSeries_request_regions();
241244

242245
eeh_probe_devices();
@@ -246,6 +249,25 @@ void __init pSeries_final_fixup(void)
246249
ppc_md.pcibios_sriov_enable = pseries_pcibios_sriov_enable;
247250
ppc_md.pcibios_sriov_disable = pseries_pcibios_sriov_disable;
248251
#endif
252+
list_for_each_entry(hose, &hose_list, list_node) {
253+
struct device_node *dn = hose->dn, *nvdn;
254+
255+
while (1) {
256+
dn = of_find_all_nodes(dn);
257+
if (!dn)
258+
break;
259+
nvdn = of_parse_phandle(dn, "ibm,nvlink", 0);
260+
if (!nvdn)
261+
continue;
262+
if (!of_device_is_compatible(nvdn, "ibm,npu-link"))
263+
continue;
264+
if (!of_device_is_compatible(nvdn->parent,
265+
"ibm,power9-npu"))
266+
continue;
267+
WARN_ON_ONCE(pnv_npu2_init(hose));
268+
break;
269+
}
270+
}
249271
}
250272

251273
/*

0 commit comments

Comments
 (0)