diff options
Diffstat (limited to 'drivers/vfio/pci/vfio_pci_nvlink2.c')
-rw-r--r-- | drivers/vfio/pci/vfio_pci_nvlink2.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c index 65c61710c0e9..9adcf6a8f888 100644 --- a/drivers/vfio/pci/vfio_pci_nvlink2.c +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c | |||
@@ -231,7 +231,7 @@ int vfio_pci_nvdia_v100_nvlink2_init(struct vfio_pci_device *vdev) | |||
231 | return -EINVAL; | 231 | return -EINVAL; |
232 | 232 | ||
233 | if (of_property_read_u32(npu_node, "memory-region", &mem_phandle)) | 233 | if (of_property_read_u32(npu_node, "memory-region", &mem_phandle)) |
234 | return -EINVAL; | 234 | return -ENODEV; |
235 | 235 | ||
236 | mem_node = of_find_node_by_phandle(mem_phandle); | 236 | mem_node = of_find_node_by_phandle(mem_phandle); |
237 | if (!mem_node) | 237 | if (!mem_node) |
@@ -393,7 +393,7 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev) | |||
393 | int ret; | 393 | int ret; |
394 | struct vfio_pci_npu2_data *data; | 394 | struct vfio_pci_npu2_data *data; |
395 | struct device_node *nvlink_dn; | 395 | struct device_node *nvlink_dn; |
396 | u32 nvlink_index = 0; | 396 | u32 nvlink_index = 0, mem_phandle = 0; |
397 | struct pci_dev *npdev = vdev->pdev; | 397 | struct pci_dev *npdev = vdev->pdev; |
398 | struct device_node *npu_node = pci_device_to_OF_node(npdev); | 398 | struct device_node *npu_node = pci_device_to_OF_node(npdev); |
399 | struct pci_controller *hose = pci_bus_to_host(npdev->bus); | 399 | struct pci_controller *hose = pci_bus_to_host(npdev->bus); |
@@ -408,6 +408,9 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev) | |||
408 | if (!pnv_pci_get_gpu_dev(vdev->pdev)) | 408 | if (!pnv_pci_get_gpu_dev(vdev->pdev)) |
409 | return -ENODEV; | 409 | return -ENODEV; |
410 | 410 | ||
411 | if (of_property_read_u32(npu_node, "memory-region", &mem_phandle)) | ||
412 | return -ENODEV; | ||
413 | |||
411 | /* | 414 | /* |
412 | * NPU2 normally has 8 ATSD registers (for concurrency) and 6 links | 415 | * NPU2 normally has 8 ATSD registers (for concurrency) and 6 links |
413 | * so we can allocate one register per link, using nvlink index as | 416 | * so we can allocate one register per link, using nvlink index as |