drm/amdgpu: enable PCIE atomics ops support
authorJack Xiao <Jack.Xiao@amd.com>
Thu, 23 May 2019 16:13:14 +0000 (00:13 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 1 Jul 2019 19:54:40 +0000 (14:54 -0500)
GPU atomics operation depends on PCIE atomics support.
Always enable PCIE atomics ops support in case that
it hasn't been enabled.

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index ea79763..802809a 100644 (file)
@@ -2596,6 +2596,17 @@ int amdgpu_device_init(struct amdgpu_device *adev,
        if (adev->rio_mem == NULL)
                DRM_INFO("PCI I/O BAR is not found.\n");
 
+       /* enable PCIE atomic ops */
+       r = pci_enable_atomic_ops_to_root(adev->pdev,
+                                         PCI_EXP_DEVCAP2_ATOMIC_COMP32 |
+                                         PCI_EXP_DEVCAP2_ATOMIC_COMP64);
+       if (r) {
+               adev->have_atomics_support = false;
+               DRM_INFO("PCIE atomic ops is not supported\n");
+       } else {
+               adev->have_atomics_support = true;
+       }
+
        amdgpu_device_get_pcie_info(adev);
 
        if (amdgpu_mcbp)