Commit 00bc5095 authored by Sam Bobroff's avatar Sam Bobroff Committed by Alex Williamson
Browse files

vfio-pci/nvlink2: Allow fallback to ibm,mmio-atsd[0]



Older versions of skiboot only provide a single value in the device
tree property "ibm,mmio-atsd", even when multiple Address Translation
Shoot Down (ATSD) registers are present. This prevents NVLink2 devices
(other than the first) from being used with vfio-pci because vfio-pci
expects to be able to assign a dedicated ATSD register to each NVLink2
device.

However, ATSD registers can be shared among devices. This change
allows vfio-pci to fall back to sharing the register at index 0 if
necessary.

Fixes: 7f928917 ("vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver")
Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
Reviewed-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 48219795
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -422,8 +422,14 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)

	if (of_property_read_u64_index(hose->dn, "ibm,mmio-atsd", nvlink_index,
			&mmio_atsd)) {
		if (of_property_read_u64_index(hose->dn, "ibm,mmio-atsd", 0,
				&mmio_atsd)) {
			dev_warn(&vdev->pdev->dev, "No available ATSD found\n");
			mmio_atsd = 0;
		} else {
			dev_warn(&vdev->pdev->dev,
				 "Using fallback ibm,mmio-atsd[0] for ATSD.\n");
		}
	}

	if (of_property_read_u64(npu_node, "ibm,device-tgt-addr", &tgt)) {