[v3] drm/amdgpu/sriov: Only sriov runtime support use kiq

Submitted by Deng, Emily on Aug. 21, 2018, 8:41 a.m.

Details

Message ID 1534840863-14875-1-git-send-email-Emily.Deng@amd.com
State New
Headers show
Series "drm/amdgpu/sriov: Only sriov runtime support use kiq" ( rev: 3 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Deng, Emily Aug. 21, 2018, 8:41 a.m.
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.

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 0bf8439..de1467e 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -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);
 

Comments

>-----Original Message-----

>From: Christian König <ckoenig.leichtzumerken@gmail.com>

>Sent: Tuesday, August 21, 2018 5:05 PM

>To: Deng, Emily <Emily.Deng@amd.com>; amd-gfx@lists.freedesktop.org

>Subject: Re: [PATCH v3] drm/amdgpu/sriov: Only sriov runtime support use kiq

>

>Am 21.08.2018 um 10:41 schrieb Emily Deng:

>> 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.

>>

>> Signed-off-by: Emily Deng <Emily.Deng@amd.com>

>> ---

>>   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 19 +++++++++++--------

>>   1 file changed, 11 insertions(+), 8 deletions(-)

>>

>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

>> b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

>> index 0bf8439..de1467e 100644

>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

>> @@ -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 &&

>

>Do you really need the local variable here? Just check

>adev->gfx.kiq.ring.ready directly.

Ok, will modify.
>Apart from that the patch is Reviewed-by: Christian König

><christian.koenig@amd.com>.

>

>Regards,

>Christian.

>

>> +		    (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);

>>