[2/3] drm/amdgpu: enable PCIE atomics ops support

Submitted by Xiao, Jack on May 29, 2019, 6:32 a.m.

Details

Message ID 1559111516-21940-3-git-send-email-Jack.Xiao@amd.com
State New
Headers show
Series "always enable PCIE atomics" ( rev: 2 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Xiao, Jack May 29, 2019, 6:32 a.m.
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>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

-- 
1.9.1

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index bdd1fe73..55772eb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2562,6 +2562,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);
 
 	/* early init functions */