Skip to contentSkip to conversation

drm/amdgpu/sriov: Only sriov runtime support use kiq

PATCH Superseded Emily Deng 2 participants 3 messages Aug 21, 2018 2 messages not in the archive

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH v3 1/1 drm/amdgpu/sriov: Only sriov runtime support use kiq

Move the check into the caller instead of returning an error code here

For sriov, don't use kiq in exclusive mode, as don't know how long time it will take, some times it will occur exclusive timeout.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +11 -8
index 0bf8439..de1467e 100644
@@ -321,9 +321,6 @@ signed long  amdgpu_kiq_reg_write_reg_wait(struct amdgpu_device *adev,
 	struct amdgpu_kiq *kiq = &adev->gfx.kiq;
 	struct amdgpu_ring *ring = &kiq->ring;
 
-	if (!ring->ready)
-		return -EINVAL;
-
 	spin_lock_irqsave(&kiq->ring_lock, flags);
 
 	amdgpu_ring_alloc(ring, 32);
@@ -389,11 +386,17 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev,
 	for (i = 0; i < AMDGPU_MAX_VMHUBS; ++i) {
 		struct amdgpu_vmhub *hub = &adev->vmhub[i];
 		u32 tmp = gmc_v9_0_get_invalidate_req(vmid);
-
-		r = amdgpu_kiq_reg_write_reg_wait(adev, hub->vm_inv_eng0_req + eng,
-			hub->vm_inv_eng0_ack + eng, tmp, 1 << vmid);
-		if (!r)
-			continue;
+		struct amdgpu_kiq *kiq = &adev->gfx.kiq;
+		struct amdgpu_ring *ring = &kiq->ring;
+
+		if (ring->ready &&
+		    (amdgpu_sriov_runtime(adev) ||
+		     !amdgpu_sriov_vf(adev))) {
+			r = amdgpu_kiq_reg_write_reg_wait(adev, hub->vm_inv_eng0_req + eng,
+				hub->vm_inv_eng0_ack + eng, tmp, 1 << vmid);
+			if (!r)
+				continue;
+		}
 
 		spin_lock(&adev->gmc.invalidate_lock);
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#2 lore raw
In reply to a message not in the archive

Am 21.08.2018 um 10:41 schrieb Emily Deng:

Quoted 27 lines

Move the check into the caller instead of returning an error code here

For sriov, don't use kiq in exclusive mode, as don't know how long time it will take, some times it will occur exclusive timeout.

---
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 19 +++++++++++--------
  1 file changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -3
index 0bf8439..de1467e 100644
@@ -321,9 +321,6 @@ signed long  amdgpu_kiq_reg_write_reg_wait(struct amdgpu_device *adev,
  	struct amdgpu_kiq *kiq = &adev->gfx.kiq;
  	struct amdgpu_ring *ring = &kiq->ring;
 
-	if (!ring->ready)
-		return -EINVAL;
-
  	spin_lock_irqsave(&kiq->ring_lock, flags);
 
  	amdgpu_ring_alloc(ring, 32);
@@ -389,11 +386,17 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev,
  	for (i = 0; i < AMDGPU_MAX_VMHUBS; ++i) {
  		struct amdgpu_vmhub *hub = &adev->vmhub[i];

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, · line 392

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +4 -5
  		u32 tmp = gmc_v9_0_get_invalidate_req(vmid);
-
-		r = amdgpu_kiq_reg_write_reg_wait(adev, hub->vm_inv_eng0_req + eng,
-			hub->vm_inv_eng0_ack + eng, tmp, 1 << vmid);
-		if (!r)
-			continue;
+		struct amdgpu_kiq *kiq = &adev->gfx.kiq;
+		struct amdgpu_ring *ring = &kiq->ring;
+
+		if (ring->ready &&

Do you really need the local variable here? Just check adev->gfx.kiq.ring.ready directly.

Apart from that the patch is Reviewed-by: Christian König <[email protected]>.

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, · line 402

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +7 -0
+		    (amdgpu_sriov_runtime(adev) ||
+		     !amdgpu_sriov_vf(adev))) {
+			r = amdgpu_kiq_reg_write_reg_wait(adev, hub->vm_inv_eng0_req + eng,
+				hub->vm_inv_eng0_ack + eng, tmp, 1 << vmid);
+			if (!r)
+				continue;
+		}
 
  		spin_lock(&adev->gmc.invalidate_lock);
 

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

#4 lore raw
In reply to a message not in the archive
Quoted 35 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, August 21, 2018 5:05 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH v3] drm/amdgpu/sriov: Only sriov runtime support use kiq

Am 21.08.2018 um 10:41 schrieb Emily Deng:

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c signed long amdgpu_kiq_reg_write_reg_wait(struct

Quoted 16 lines

Move the check into the caller instead of returning an error code here

For sriov, don't use kiq in exclusive mode, as don't know how long time it will take, some times it will occur exclusive timeout.

---
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 19 +++++++++++--------
  1 file changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
index 0bf8439..de1467e 100644
@@ -321,9 +321,6 @@ signed long  amdgpu_kiq_reg_write_reg_wait(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_flush_gpu_tlb(struct

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -3
  	struct amdgpu_kiq *kiq = &adev->gfx.kiq;
  	struct amdgpu_ring *ring = &kiq->ring;
 
-	if (!ring->ready)
-		return -EINVAL;
-
  	spin_lock_irqsave(&kiq->ring_lock, flags);
 
  	amdgpu_ring_alloc(ring, 32);
@@ -389,11 +386,17 @@ static void gmc_v9_0_flush_gpu_tlb(struct

amdgpu_device *adev,

Quoted 16 lines

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, · line 392

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +4 -5
  	for (i = 0; i < AMDGPU_MAX_VMHUBS; ++i) {
  		struct amdgpu_vmhub *hub = &adev->vmhub[i];
  		u32 tmp = gmc_v9_0_get_invalidate_req(vmid);
-
-		r = amdgpu_kiq_reg_write_reg_wait(adev, hub-
 vm_inv_eng0_req + eng,
-			hub->vm_inv_eng0_ack + eng, tmp, 1 << vmid);
-		if (!r)
-			continue;
+		struct amdgpu_kiq *kiq = &adev->gfx.kiq;
+		struct amdgpu_ring *ring = &kiq->ring;
+
+		if (ring->ready &&

Do you really need the local variable here? Just check adev->gfx.kiq.ring.ready directly.

Ok, will modify.

Quoted 15 lines

Apart from that the patch is Reviewed-by: Christian König <[email protected]>.

Regards,
Christian.

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +7 -0
+		    (amdgpu_sriov_runtime(adev) ||
+		     !amdgpu_sriov_vf(adev))) {
+			r = amdgpu_kiq_reg_write_reg_wait(adev, hub-
 vm_inv_eng0_req + eng,
+				hub->vm_inv_eng0_ack + eng, tmp, 1 << vmid);
+			if (!r)
+				continue;
+		}
 
Quoted 2 lines
Quoted 2 lines
  		spin_lock(&adev->gmc.invalidate_lock);

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