Skip to contentSkip to conversation

always enable PCIE atomics

PATCH In review Xiao, Jack 3 participants 6 messages May 29, 2019 – May 30, 2019 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Xiao, Jack

author
#0 lore raw

cover always enable PCIE atomics

GPU atomics operation depends on PCIE atomics support. Always enable PCIE atomics ops support in case that it hasn't been enabled.

Add field to amdgpu device, that can be exposed to UMD or kfd indicating whether the system has PCIE atomics support.

Jack Xiao (3):
drm/amdgpu: add field indicating if has PCIE atomics support drm/amdgpu: enable PCIE atomics ops support drm/amdkfd: remove duplicated PCIE atomics request

 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c |  7 +++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 +++++++++++
 drivers/gpu/drm/amd/amdkfd/kfd_device.c    | 10 ++++------
 5 files changed, 24 insertions(+), 6 deletions(-)
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1559111516-21940-1-git-send-email-Jack.Xiao-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 1/3 drm/amdgpu: add field indicating if has PCIE atomics support

The new field in amdgpu device is used to record whether the system has PCIE atomics support. The field can be exposed to UMD or kfd whether PCIE atomics have supported.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index d355e9a..b0a01e4 100644
@@ -767,6 +767,7 @@ struct amdgpu_device {
 	struct mutex                    grbm_idx_mutex;
 	struct dev_pm_domain		vga_pm_domain;
 	bool				have_disp_power_ref;
+	bool                            have_atomics_support;
 
 	/* BIOS */
 	bool				is_atom_fw;
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#3 lore raw

PATCH 2/3 drm/amdgpu: enable PCIE atomics ops support

In reply to a message not in the archive

GPU atomics operation depends on PCIE atomics support. Always enable PCIE atomics ops support in case that it hasn't been enabled.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +11 -0
index bdd1fe73..55772eb 100644
@@ -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 */
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#4 lore raw

PATCH 3/3 drm/amdkfd: remove duplicated PCIE atomics request

In reply to a message not in the archive

Since amdgpu has always requested PCIE atomics, kfd don't need duplicated PCIE atomics enablement. Referring to amdgpu request result is enough.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c |  7 +++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  1 +
 drivers/gpu/drm/amd/amdkfd/kfd_device.c    | 10 ++++------
 3 files changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +7 -0
index 98326e3b..ddd6c52 100644
@@ -620,6 +620,13 @@ bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)
 	return false;
 }
 
+bool amdgpu_amdkfd_have_atomics_support(struct kgd_dev *kgd)
+{
+	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+	return adev->have_atomics_support;
+}
+
 #ifndef CONFIG_HSA_AMD
 bool amdkfd_fence_check_mm(struct dma_fence *f, struct mm_struct *mm)
 {
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 -0
index f57f297..8d135c82 100644
@@ -135,6 +135,7 @@ int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
 				uint32_t vmid, uint64_t gpu_addr,
 				uint32_t *ib_cmd, uint32_t ib_len);
 void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle);
+bool amdgpu_amdkfd_have_atomics_support(struct kgd_dev *kgd);
 
 struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void);
 struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void);
drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -6
index 7b4ea24..76a1599 100644
@@ -481,17 +481,15 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd,
 	 * 32 and 64-bit requests are possible and must be
 	 * supported.
 	 */
-	ret = pci_enable_atomic_ops_to_root(pdev,
-			PCI_EXP_DEVCAP2_ATOMIC_COMP32 |
-			PCI_EXP_DEVCAP2_ATOMIC_COMP64);
-	if (device_info->needs_pci_atomics && ret < 0) {
+	kfd->pci_atomic_requested = amdgpu_amdkfd_have_atomics_support(kgd);
+	if (device_info->needs_pci_atomics &&
+	    !kfd->pci_atomic_requested) {
 		dev_info(kfd_device,
 			 "skipped device %x:%x, PCI rejects atomics\n",
 			 pdev->vendor, pdev->device);
 		kfree(kfd);
 		return NULL;
-	} else if (!ret)
-		kfd->pci_atomic_requested = true;
+	}
 
 	kfd->kgd = kgd;
 	kfd->device_info = device_info;
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1559111516-21940-4-git-send-email-Jack.Xiao-5C7GfCeVMHo@public.gmane.org

#6 lore raw

Re: [PATCH 3/3] drm/amdkfd: remove duplicated PCIE atomics request

Quoted 5 lines · Jack

Since amdgpu has always requested PCIE atomics, kfd don't need duplicated PCIE atomics enablement. Referring to amdgpu request result is enough.

This patch is Reviewed-by: Felix Kuehling <[email protected]>

Quoted 52 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c |  7 +++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  1 +
  drivers/gpu/drm/amd/amdkfd/kfd_device.c    | 10 ++++------
  3 files changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +7 -0
index 98326e3b..ddd6c52 100644
@@ -620,6 +620,13 @@ bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)
  	return false;
  }
 
+bool amdgpu_amdkfd_have_atomics_support(struct kgd_dev *kgd)
+{
+	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+	return adev->have_atomics_support;
+}
+
  #ifndef CONFIG_HSA_AMD
  bool amdkfd_fence_check_mm(struct dma_fence *f, struct mm_struct *mm)
  {
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 -0
index f57f297..8d135c82 100644
@@ -135,6 +135,7 @@ int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
  				uint32_t vmid, uint64_t gpu_addr,
  				uint32_t *ib_cmd, uint32_t ib_len);
  void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle);
+bool amdgpu_amdkfd_have_atomics_support(struct kgd_dev *kgd);
 
  struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void);
  struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void);
drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -4
index 7b4ea24..76a1599 100644
@@ -481,17 +481,15 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd,
  	 * 32 and 64-bit requests are possible and must be
  	 * supported.
  	 */
-	ret = pci_enable_atomic_ops_to_root(pdev,
-			PCI_EXP_DEVCAP2_ATOMIC_COMP32 |
-			PCI_EXP_DEVCAP2_ATOMIC_COMP64);
-	if (device_info->needs_pci_atomics && ret < 0) {
+	kfd->pci_atomic_requested = amdgpu_amdkfd_have_atomics_support(kgd);
+	if (device_info->needs_pci_atomics &&
+	    !kfd->pci_atomic_requested) {
  		dev_info(kfd_device,

drivers/gpu/drm/amd/amdkfd/kfd_device.c struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, · line 495

Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 -2
  			 "skipped device %x:%x, PCI rejects atomics\n",
  			 pdev->vendor, pdev->device);
  		kfree(kfd);
  		return NULL;
-	} else if (!ret)
-		kfd->pci_atomic_requested = true;
+	}
 
  	kfd->kgd = kgd;
  	kfd->device_info = device_info;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Hawking Zhang
#7 lore raw

RE: [PATCH 3/3] drm/amdkfd: remove duplicated PCIE atomics request

In reply to a message not in the archive

Series is

Regards,
Hawking
-----Original Message-----
From: Xiao, Jack <[email protected]>
Sent: 2019年5月29日 14:32
To: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Koenig, Christian <[email protected]>; Kuehling, Felix <[email protected]>
Cc: Xiao, Jack <[email protected]>
Subject: [PATCH 3/3] drm/amdkfd: remove duplicated PCIE atomics request

Since amdgpu has always requested PCIE atomics, kfd don't need duplicated PCIE atomics enablement. Referring to amdgpu request result is enough.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c |  7 +++++++  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  1 +
 drivers/gpu/drm/amd/amdkfd/kfd_device.c    | 10 ++++------
 3 files changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +6 -0
index 98326e3b..ddd6c52 100644
@@ -620,6 +620,13 @@ bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)
 	return false;
 }
 
+bool amdgpu_amdkfd_have_atomics_support(struct kgd_dev *kgd) {
+	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
+
+	return adev->have_atomics_support;
+}
+
 #ifndef CONFIG_HSA_AMD
 bool amdkfd_fence_check_mm(struct dma_fence *f, struct mm_struct *mm)  { diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h

index f57f297..8d135c82 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 -0
@@ -135,6 +135,7 @@ int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
 				uint32_t vmid, uint64_t gpu_addr,
 				uint32_t *ib_cmd, uint32_t ib_len);  void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle);
+bool amdgpu_amdkfd_have_atomics_support(struct kgd_dev *kgd);
 
 struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void);
 struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void);
drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -6
index 7b4ea24..76a1599 100644
@@ -481,17 +481,15 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd,
 	 * 32 and 64-bit requests are possible and must be
 	 * supported.
 	 */
-	ret = pci_enable_atomic_ops_to_root(pdev,
-			PCI_EXP_DEVCAP2_ATOMIC_COMP32 |
-			PCI_EXP_DEVCAP2_ATOMIC_COMP64);
-	if (device_info->needs_pci_atomics && ret < 0) {
+	kfd->pci_atomic_requested = amdgpu_amdkfd_have_atomics_support(kgd);
+	if (device_info->needs_pci_atomics &&
+	    !kfd->pci_atomic_requested) {
 		dev_info(kfd_device,
 			 "skipped device %x:%x, PCI rejects atomics\n",
 			 pdev->vendor, pdev->device);
 		kfree(kfd);
 		return NULL;
-	} else if (!ret)
-		kfd->pci_atomic_requested = true;
+	}
 
 	kfd->kgd = kgd;
 	kfd->device_info = device_info;

--
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx