• Alexey Kardashevskiy's avatar
    powerpc/powernv/npu: Do not attempt NPU2 setup on POWER8NVL NPU · b1198a88
    Alexey Kardashevskiy authored
    We execute certain NPU2 setup code (such as mapping an LPID to a device
    in NPU2) unconditionally if an Nvlink bridge is detected. However this
    cannot succeed on POWER8NVL machines and errors appear in dmesg. This is
    harmless as skiboot returns an error and the only place we check it is
    vfio-pci but that code does not get called on P8+ either.
    
    This adds a check if pnv_npu2_xxx helpers are called on a machine with
    NPU2 which initializes pnv_phb::npu in pnv_npu2_init();
    pnv_phb::npu==NULL on POWER8/NVL (Naples).
    
    While at this, fix NULL derefencing in pnv_npu_peers_take_ownership/
    pnv_npu_peers_release_ownership which occurs when GPUs on mentioned P8s
    cause EEH which happens if "vfio-pci" disables devices using
    the D3 power state; the vfio-pci's disable_idle_d3 module parameter
    controls this and must be set on Naples. The EEH handling clears
    the entire pnv_ioda_pe struct in pnv_ioda_free_pe() hence
    the NULL derefencing. We cannot recover from that but at least we stop
    crashing.
    
    Tested on
    - POWER9 pvr=004e1201, Ubuntu 19.04 host, Ubuntu 18.04 vm,
      NVIDIA GV100 10de:1db1 driver 418.39
    - POWER8 pvr=004c0100, RHEL 7.6 host, Ubuntu 16.10 vm,
      NVIDIA P100 10de:15f9 driver 396.47
    
    Fixes: 1b785611 ("powerpc/powernv/npu: Add release_ownership hook")
    Cc: stable@vger.kernel.org # 5.0
    Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20201122073828.15446-1-aik@ozlabs.ru
    b1198a88
npu-dma.c 17.8 KB