Skip to contentSkip to conversation

drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

PATCH In review Rohit Khaire 5 participants 13 messages Jun 7, 2021 – Jun 8, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

This is similar to IH_RB_CNTL programming in
navi10_ih_toggle_ring_interrupts

---
 drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +18 -2
index eac564e8dd52..e41188c04846 100644
@@ -120,11 +120,27 @@ force_update_wptr_for_self_int(struct amdgpu_device *adev,
 	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
 				   RB_USED_INT_THRESHOLD, threshold);
 
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1, ih_rb_cntl)) {
+			DRM_ERROR("PSP program IH_RB_CNTL_RING1 failed!\n");
+			return;
+		}
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	}
+
 	ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
 	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
 				   RB_USED_INT_THRESHOLD, threshold);
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2, ih_rb_cntl)) {
+			DRM_ERROR("PSP program IH_RB_CNTL_RING2 failed!\n");
+			return;
+		}
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	}
+
 	WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl);
 }
 
Signature · 6 lines
2.17.1

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

Why are the ring 1&2 enabled on SRIOV in the first place?

Christian.

Am 07.06.21 um 16:23 schrieb Rohit Khaire:

Quoted 32 lines

This is similar to IH_RB_CNTL programming in
navi10_ih_toggle_ring_interrupts

---
  drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 20 ++++++++++++++++++--
  1 file changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +11 -2
index eac564e8dd52..e41188c04846 100644
@@ -120,11 +120,27 @@ force_update_wptr_for_self_int(struct amdgpu_device *adev,
  	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
  				   RB_USED_INT_THRESHOLD, threshold);
 
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1, ih_rb_cntl)) {
+			DRM_ERROR("PSP program IH_RB_CNTL_RING1 failed!\n");
+			return;
+		}
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	}
+
  	ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
  	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
  				   RB_USED_INT_THRESHOLD, threshold);
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2, ih_rb_cntl)) {

drivers/gpu/drm/amd/amdgpu/navi10_ih.c force_update_wptr_for_self_int(struct amdgpu_device *adev, · line 146

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +7 -0
+			DRM_ERROR("PSP program IH_RB_CNTL_RING2 failed!\n");
+			return;
+		}
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	}
+
  	WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl);
  }
 

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

#2 lore raw

[AMD Public Use]

We don't need RING1 and RING2 functionality for SRIOV afaik.

But looking at the description of the original commit message it affects RING0 too?

" drm/amdgpu: add timeout flush mechanism to update wptr for self interrupt (v2)

outstanding log reaches threshold will trigger IH ring1/2's wptr reported, that will avoid generating interrupts to ring0 too frequent. But if ring1/2's wptr hasn't been increased for a long time, the outstanding log can't reach threshold so that driver can't get latest wptr info and miss some interrupts."

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 10:31 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Why are the ring 1&2 enabled on SRIOV in the first place?

Christian.

Am 07.06.21 um 16:23 schrieb Rohit Khaire:

Quoted 33 lines

This is similar to IH_RB_CNTL programming in
navi10_ih_toggle_ring_interrupts

---
  drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 20 ++++++++++++++++++--
  1 file changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +11 -2
index eac564e8dd52..e41188c04846 100644
@@ -120,11 +120,27 @@ force_update_wptr_for_self_int(struct amdgpu_device *adev,
  	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
  				   RB_USED_INT_THRESHOLD, threshold);
 
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1, ih_rb_cntl)) {
+			DRM_ERROR("PSP program IH_RB_CNTL_RING1 failed!\n");
+			return;
+		}
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	}
+
  	ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
  	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
  				   RB_USED_INT_THRESHOLD, threshold);
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2, ih_rb_cntl)) {

drivers/gpu/drm/amd/amdgpu/navi10_ih.c force_update_wptr_for_self_int(struct amdgpu_device *adev, · line 146

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +7 -0
+			DRM_ERROR("PSP program IH_RB_CNTL_RING2 failed!\n");
+			return;
+		}
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	}
+
  	WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl);
  }
 

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

maintainer
#3 lore raw

Do you have the hash for this commit?

Thanks,
Christian.

Am 07.06.21 um 17:30 schrieb Khaire, Rohit:

Quoted 63 lines

[AMD Public Use]

We don't need RING1 and RING2 functionality for SRIOV afaik.

But looking at the description of the original commit message it affects RING0 too?

" drm/amdgpu: add timeout flush mechanism to update wptr for self interrupt (v2)

outstanding log reaches threshold will trigger IH ring1/2's wptr reported, that will avoid generating interrupts to ring0 too frequent. But if ring1/2's wptr hasn't been increased for a long time, the outstanding log can't reach threshold so that driver can't get latest wptr info and miss some interrupts."

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 10:31 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Why are the ring 1&2 enabled on SRIOV in the first place?

Christian.

Am 07.06.21 um 16:23 schrieb Rohit Khaire:

Quoted 35 lines

This is similar to IH_RB_CNTL programming in
navi10_ih_toggle_ring_interrupts

---
   drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 20 ++++++++++++++++++--
   1 file changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +13 -2
index eac564e8dd52..e41188c04846 100644
@@ -120,11 +120,27 @@ force_update_wptr_for_self_int(struct amdgpu_device *adev,
   	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
   				   RB_USED_INT_THRESHOLD, threshold);
 
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1, ih_rb_cntl)) {
+			DRM_ERROR("PSP program IH_RB_CNTL_RING1 failed!\n");
+			return;
+		}
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	}
+
   	ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
   	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
   				   RB_USED_INT_THRESHOLD, threshold);
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2, ih_rb_cntl)) {
+			DRM_ERROR("PSP program IH_RB_CNTL_RING2 failed!\n");
+			return;
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/navi10_ih.c force_update_wptr_for_self_int(struct amdgpu_device *adev, · line 146

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +5 -0
+		}
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	}
+
   	WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl);
   }
 

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

#4 lore raw

[AMD Public Use]

The hash is 5ea6f9c

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 11:58 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Do you have the hash for this commit?

Thanks,
Christian.

Am 07.06.21 um 17:30 schrieb Khaire, Rohit:

Quoted 69 lines

[AMD Public Use]

We don't need RING1 and RING2 functionality for SRIOV afaik.

But looking at the description of the original commit message it affects RING0 too?

" drm/amdgpu: add timeout flush mechanism to update wptr for self interrupt (v2)

outstanding log reaches threshold will trigger IH ring1/2's wptr reported, that will avoid generating interrupts to ring0 too frequent. But if ring1/2's wptr hasn't been increased for a long time, the outstanding log can't reach threshold so that driver can't get latest wptr info and miss some interrupts."

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 10:31 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Why are the ring 1&2 enabled on SRIOV in the first place?

Christian.

Am 07.06.21 um 16:23 schrieb Rohit Khaire:

Quoted 35 lines

This is similar to IH_RB_CNTL programming in
navi10_ih_toggle_ring_interrupts

---
   drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 20 ++++++++++++++++++--
   1 file changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +13 -2
index eac564e8dd52..e41188c04846 100644
@@ -120,11 +120,27 @@ force_update_wptr_for_self_int(struct amdgpu_device *adev,
   	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
   				   RB_USED_INT_THRESHOLD, threshold);
 
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1, ih_rb_cntl)) {
+			DRM_ERROR("PSP program IH_RB_CNTL_RING1 failed!\n");
+			return;
+		}
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	}
+
   	ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
   	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
   				   RB_USED_INT_THRESHOLD, threshold);
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2, ih_rb_cntl)) {
+			DRM_ERROR("PSP program IH_RB_CNTL_RING2 failed!\n");
+			return;
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/navi10_ih.c force_update_wptr_for_self_int(struct amdgpu_device *adev, · line 146

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +5 -0
+		}
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	}
+
   	WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl);
   }
 

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

maintainer
#5 lore raw

That's a workaround for bare metal and as far as I know doesn't apply to SRIOV.

We only need the additional IH rings for page fault handling or log handling and as far as I know that is incompatible with SRIOV for the moment. But Felix might have some more updates on this.

So as long as we don't support that under SRIOV we don't need this patch either.

Christian.

Am 07.06.21 um 17:59 schrieb Khaire, Rohit:

Quoted 88 lines

[AMD Public Use]

The hash is 5ea6f9c

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 11:58 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Do you have the hash for this commit?

Thanks,
Christian.

Am 07.06.21 um 17:30 schrieb Khaire, Rohit:

Quoted 69 lines

[AMD Public Use]

We don't need RING1 and RING2 functionality for SRIOV afaik.

But looking at the description of the original commit message it affects RING0 too?

" drm/amdgpu: add timeout flush mechanism to update wptr for self interrupt (v2)

outstanding log reaches threshold will trigger IH ring1/2's wptr reported, that will avoid generating interrupts to ring0 too frequent. But if ring1/2's wptr hasn't been increased for a long time, the outstanding log can't reach threshold so that driver can't get latest wptr info and miss some interrupts."

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 10:31 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Why are the ring 1&2 enabled on SRIOV in the first place?

Christian.

Am 07.06.21 um 16:23 schrieb Rohit Khaire:

Quoted 35 lines

This is similar to IH_RB_CNTL programming in
navi10_ih_toggle_ring_interrupts

---
    drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 20 ++++++++++++++++++--
    1 file changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +13 -2
index eac564e8dd52..e41188c04846 100644
@@ -120,11 +120,27 @@ force_update_wptr_for_self_int(struct amdgpu_device *adev,
    	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
    				   RB_USED_INT_THRESHOLD, threshold);
 
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1, ih_rb_cntl)) {
+			DRM_ERROR("PSP program IH_RB_CNTL_RING1 failed!\n");
+			return;
+		}
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	}
+
    	ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
    	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
    				   RB_USED_INT_THRESHOLD, threshold);
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2, ih_rb_cntl)) {
+			DRM_ERROR("PSP program IH_RB_CNTL_RING2 failed!\n");
+			return;
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/navi10_ih.c force_update_wptr_for_self_int(struct amdgpu_device *adev, · line 146

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +5 -0
+		}
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	}
+
    	WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl);
    }
 

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

#6 lore raw

With SRIOV, the interrupt routing is setup by the hypervisor driver. We need the secondary IH rings in case the hypervisor enabled rerouting of page fault interrupts. I'm not sure what the hypervisor driver does today.

Regards,
  Felix

Am 2021-06-07 um 12:29 p.m. schrieb Christian König:

Quoted 111 lines

That's a workaround for bare metal and as far as I know doesn't apply to SRIOV.

We only need the additional IH rings for page fault handling or log handling and as far as I know that is incompatible with SRIOV for the moment. But Felix might have some more updates on this.

So as long as we don't support that under SRIOV we don't need this patch either.

Christian.

Am 07.06.21 um 17:59 schrieb Khaire, Rohit:

Quoted 98 lines

[AMD Public Use]

The hash is 5ea6f9c

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 11:58 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Do you have the hash for this commit?

Thanks,
Christian.

Am 07.06.21 um 17:30 schrieb Khaire, Rohit:

Quoted 74 lines

[AMD Public Use]

We don't need RING1 and RING2 functionality for SRIOV afaik.

But looking at the description of the original commit message it affects RING0 too?

" drm/amdgpu: add timeout flush mechanism to update wptr for self interrupt (v2)

outstanding log reaches threshold will trigger IH ring1/2's wptr reported, that will avoid generating interrupts to ring0 too frequent. But if ring1/2's wptr hasn't been increased for a long time, the outstanding log can't reach threshold so that driver can't get latest wptr info and miss some interrupts."

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 10:31 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Why are the ring 1&2 enabled on SRIOV in the first place?

Christian.

Am 07.06.21 um 16:23 schrieb Rohit Khaire:

Quoted 39 lines

This is similar to IH_RB_CNTL programming in
navi10_ih_toggle_ring_interrupts

---
    drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 20 ++++++++++++++++++--

    1 file changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +11 -1
index eac564e8dd52..e41188c04846 100644
@@ -120,11 +120,27 @@ force_update_wptr_for_self_int(struct
 amdgpu_device *adev,
         ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
                        RB_USED_INT_THRESHOLD, threshold);
     -    WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+    if (amdgpu_sriov_vf(adev) &&
 amdgpu_sriov_reg_indirect_ih(adev)) {
+        if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1,
 ih_rb_cntl)) {
+            DRM_ERROR("PSP program IH_RB_CNTL_RING1 failed!\n");
+            return;
+        }
+    } else {
+        WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+    }
+
         ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
         ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
                        RB_USED_INT_THRESHOLD, threshold);
-    WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+    if (amdgpu_sriov_vf(adev) &&
 amdgpu_sriov_reg_indirect_ih(adev)) {
+        if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2,

ih_rb_cntl)) {
+            DRM_ERROR("PSP program IH_RB_CNTL_RING2 failed!\n"); +            return;

Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+        }
+    } else {
+        WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl); +    }
+
        WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl);
    }

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

maintainer
#7 lore raw

Ah, good point. In this case we should probably rather save than sorry.

Then I suggest to clean up this patch, repeating the psp_reg_program() and error message is pretty horrible coding style.

Christian.

Am 07.06.21 um 18:36 schrieb Felix Kuehling:

Quoted 120 lines

With SRIOV, the interrupt routing is setup by the hypervisor driver. We need the secondary IH rings in case the hypervisor enabled rerouting of page fault interrupts. I'm not sure what the hypervisor driver does today.

Regards,
  Felix

Am 2021-06-07 um 12:29 p.m. schrieb Christian König:

Quoted 111 lines

That's a workaround for bare metal and as far as I know doesn't apply to SRIOV.

We only need the additional IH rings for page fault handling or log handling and as far as I know that is incompatible with SRIOV for the moment. But Felix might have some more updates on this.

So as long as we don't support that under SRIOV we don't need this patch either.

Christian.

Am 07.06.21 um 17:59 schrieb Khaire, Rohit:

Quoted 98 lines

[AMD Public Use]

The hash is 5ea6f9c

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 11:58 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Do you have the hash for this commit?

Thanks,
Christian.

Am 07.06.21 um 17:30 schrieb Khaire, Rohit:

Quoted 74 lines

[AMD Public Use]

We don't need RING1 and RING2 functionality for SRIOV afaik.

But looking at the description of the original commit message it affects RING0 too?

" drm/amdgpu: add timeout flush mechanism to update wptr for self interrupt (v2)

outstanding log reaches threshold will trigger IH ring1/2's wptr reported, that will avoid generating interrupts to ring0 too frequent. But if ring1/2's wptr hasn't been increased for a long time, the outstanding log can't reach threshold so that driver can't get latest wptr info and miss some interrupts."

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 10:31 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Why are the ring 1&2 enabled on SRIOV in the first place?

Christian.

Am 07.06.21 um 16:23 schrieb Rohit Khaire:

Quoted 39 lines

This is similar to IH_RB_CNTL programming in
navi10_ih_toggle_ring_interrupts

---
     drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 20 ++++++++++++++++++--
     1 file changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +11 -1
index eac564e8dd52..e41188c04846 100644
@@ -120,11 +120,27 @@ force_update_wptr_for_self_int(struct
 amdgpu_device *adev,
         ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
                        RB_USED_INT_THRESHOLD, threshold);
     -    WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+    if (amdgpu_sriov_vf(adev) &&
 amdgpu_sriov_reg_indirect_ih(adev)) {
+        if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1,
 ih_rb_cntl)) {
+            DRM_ERROR("PSP program IH_RB_CNTL_RING1 failed!\n");
+            return;
+        }
+    } else {
+        WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+    }
+
         ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
         ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
                        RB_USED_INT_THRESHOLD, threshold);
-    WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+    if (amdgpu_sriov_vf(adev) &&
 amdgpu_sriov_reg_indirect_ih(adev)) {
+        if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2,

ih_rb_cntl)) {
+            DRM_ERROR("PSP program IH_RB_CNTL_RING2 failed!\n"); +            return;

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+        }
+    } else {
+        WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl); +    }
+
        WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl); }

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

#8 lore raw

[AMD Public Use]

OK.

I will just skip the function call for SRIOV and resend.

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 12:42 PM
To: Kuehling, Felix <[email protected]>; Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Ah, good point. In this case we should probably rather save than sorry.

Then I suggest to clean up this patch, repeating the psp_reg_program() and error message is pretty horrible coding style.

Christian.

Am 07.06.21 um 18:36 schrieb Felix Kuehling:

Quoted 123 lines

With SRIOV, the interrupt routing is setup by the hypervisor driver.
We need the secondary IH rings in case the hypervisor enabled
rerouting of page fault interrupts. I'm not sure what the hypervisor driver does today.

Regards,
  Felix

Am 2021-06-07 um 12:29 p.m. schrieb Christian König:

Quoted 114 lines

That's a workaround for bare metal and as far as I know doesn't apply to SRIOV.

We only need the additional IH rings for page fault handling or log handling and as far as I know that is incompatible with SRIOV for the moment. But Felix might have some more updates on this.

So as long as we don't support that under SRIOV we don't need this patch either.

Christian.

Am 07.06.21 um 17:59 schrieb Khaire, Rohit:

Quoted 101 lines

[AMD Public Use]

The hash is 5ea6f9c

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 11:58 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Do you have the hash for this commit?

Thanks,
Christian.

Am 07.06.21 um 17:30 schrieb Khaire, Rohit:

Quoted 76 lines

[AMD Public Use]

We don't need RING1 and RING2 functionality for SRIOV afaik.

But looking at the description of the original commit message it affects RING0 too?

" drm/amdgpu: add timeout flush mechanism to update wptr for self interrupt (v2)

outstanding log reaches threshold will trigger IH ring1/2's wptr reported, that will avoid generating interrupts to ring0 too frequent. But if ring1/2's wptr hasn't been increased for a long time, the outstanding log can't reach threshold so that driver can't get latest wptr info and miss some interrupts."

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 10:31 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Why are the ring 1&2 enabled on SRIOV in the first place?

Christian.

Am 07.06.21 um 16:23 schrieb Rohit Khaire:

Quoted 40 lines

This is similar to IH_RB_CNTL programming in
navi10_ih_toggle_ring_interrupts

---
     drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 20 
++++++++++++++++++--
     1 file changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +11 -1
index eac564e8dd52..e41188c04846 100644
@@ -120,11 +120,27 @@ force_update_wptr_for_self_int(struct
 amdgpu_device *adev,
         ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
                        RB_USED_INT_THRESHOLD, threshold);
     -    WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+    if (amdgpu_sriov_vf(adev) &&
 amdgpu_sriov_reg_indirect_ih(adev)) {
+        if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1,
 ih_rb_cntl)) {
+            DRM_ERROR("PSP program IH_RB_CNTL_RING1 failed!\n");
+            return;
+        }
+    } else {
+        WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+    }
+
         ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
         ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
                        RB_USED_INT_THRESHOLD, threshold);
-    WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+    if (amdgpu_sriov_vf(adev) &&
 amdgpu_sriov_reg_indirect_ih(adev)) {
+        if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2,

ih_rb_cntl)) {
+            DRM_ERROR("PSP program IH_RB_CNTL_RING2 failed!\n"); +            return;

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+        }
+    } else {
+        WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl); +    }
+
        WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl); }

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

#9 lore raw

That won't work either.

We still need to initialize the control registers and tell the hardware that we have properly setup the ring buffers.

Just add the error message to psp_reg_program() instead of duplicating that over and over again.

Christian.

Am 07.06.21 um 19:33 schrieb Khaire, Rohit:

Quoted 149 lines

[AMD Public Use]

OK.

I will just skip the function call for SRIOV and resend.

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 12:42 PM
To: Kuehling, Felix <[email protected]>; Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Ah, good point. In this case we should probably rather save than sorry.

Then I suggest to clean up this patch, repeating the psp_reg_program() and error message is pretty horrible coding style.

Christian.

Am 07.06.21 um 18:36 schrieb Felix Kuehling:

Quoted 127 lines

With SRIOV, the interrupt routing is setup by the hypervisor driver.
We need the secondary IH rings in case the hypervisor enabled
rerouting of page fault interrupts. I'm not sure what the hypervisor driver does today.

Regards,
  Felix

Am 2021-06-07 um 12:29 p.m. schrieb Christian König:

Quoted 118 lines

That's a workaround for bare metal and as far as I know doesn't apply to SRIOV.

We only need the additional IH rings for page fault handling or log handling and as far as I know that is incompatible with SRIOV for the moment. But Felix might have some more updates on this.

So as long as we don't support that under SRIOV we don't need this patch either.

Christian.

Am 07.06.21 um 17:59 schrieb Khaire, Rohit:

Quoted 105 lines

[AMD Public Use]

The hash is 5ea6f9c

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 11:58 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Do you have the hash for this commit?

Thanks,
Christian.

Am 07.06.21 um 17:30 schrieb Khaire, Rohit:

Quoted 80 lines

[AMD Public Use]

We don't need RING1 and RING2 functionality for SRIOV afaik.

But looking at the description of the original commit message it affects RING0 too?

" drm/amdgpu: add timeout flush mechanism to update wptr for self interrupt (v2)

outstanding log reaches threshold will trigger IH ring1/2's wptr reported, that will avoid generating interrupts to ring0 too frequent. But if ring1/2's wptr hasn't been increased for a long time, the outstanding log can't reach threshold so that driver can't get latest wptr info and miss some interrupts."

Rohit

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: June 7, 2021 10:31 AM
To: Khaire, Rohit <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]>
Cc: Ming, Davis <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Why are the ring 1&2 enabled on SRIOV in the first place?

Christian.

Am 07.06.21 um 16:23 schrieb Rohit Khaire:

Quoted 44 lines

This is similar to IH_RB_CNTL programming in
navi10_ih_toggle_ring_interrupts

---
      drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 20
++++++++++++++++++--
      1 file changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +11 -1
index eac564e8dd52..e41188c04846 100644
@@ -120,11 +120,27 @@ force_update_wptr_for_self_int(struct
 amdgpu_device *adev,
          ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
                         RB_USED_INT_THRESHOLD, threshold);
      -    WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+    if (amdgpu_sriov_vf(adev) &&
 amdgpu_sriov_reg_indirect_ih(adev)) {
+        if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1,
 ih_rb_cntl)) {
+            DRM_ERROR("PSP program IH_RB_CNTL_RING1 failed!\n");
+            return;
+        }
+    } else {
+        WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+    }
+
          ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
          ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
                         RB_USED_INT_THRESHOLD, threshold);
-    WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+    if (amdgpu_sriov_vf(adev) &&
 amdgpu_sriov_reg_indirect_ih(adev)) {
+        if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2,

ih_rb_cntl)) {
+            DRM_ERROR("PSP program IH_RB_CNTL_RING2 failed!\n"); +            return;
+        }
+    } else {
+        WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl); +    }

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

+
        WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl); }

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

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

#10 lore raw

PATCH 1/1 drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

This is similar to IH_RB_CNTL programming in
navi10_ih_toggle_ring_interrupts

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c |  2 ++
 drivers/gpu/drm/amd/amdgpu/navi10_ih.c  | 20 +++++++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -0
index 47ceb783e2a5..058b1b1271e1 100644
@@ -683,6 +683,8 @@ int psp_reg_program(struct psp_context *psp, enum psp_reg_prog_id reg,
 
 	psp_prep_reg_prog_cmd_buf(cmd, reg, value);
 	ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
+	if (ret)
+		DRM_ERROR("PSP failed to program reg id %d", reg);
 
 	kfree(cmd);
 	return ret;
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +15 -5
index eac564e8dd52..376ea281c4a7 100644
@@ -120,11 +120,23 @@ force_update_wptr_for_self_int(struct amdgpu_device *adev,
 	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
 				   RB_USED_INT_THRESHOLD, threshold);
 
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1, ih_rb_cntl))
+			return;
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	}
+
 	ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
 	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
 				   RB_USED_INT_THRESHOLD, threshold);
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2, ih_rb_cntl))
+			return;
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	}
+
 	WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl);
 }
 
@@ -153,10 +165,8 @@ static int navi10_ih_toggle_ring_interrupts(struct amdgpu_device *adev,
 		tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, ENABLE_INTR, (enable ? 1 : 0));
 
 	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
-		if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp)) {
-			DRM_ERROR("PSP program IH_RB_CNTL failed!\n");
+		if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp))
 			return -ETIMEDOUT;
-		}
 	} else {
 		WREG32(ih_regs->ih_rb_cntl, tmp);
 	}
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
maintainer Acked-by on v1 1/1
#11 lore raw

Am 07.06.21 um 21:39 schrieb Rohit Khaire:

Quoted 4 lines

This is similar to IH_RB_CNTL programming in
navi10_ih_toggle_ring_interrupts

Quoted 50 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c |  2 ++
  drivers/gpu/drm/amd/amdgpu/navi10_ih.c  | 20 +++++++++++++++-----
  2 files changed, 17 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -0
index 47ceb783e2a5..058b1b1271e1 100644
@@ -683,6 +683,8 @@ int psp_reg_program(struct psp_context *psp, enum psp_reg_prog_id reg,
 
  	psp_prep_reg_prog_cmd_buf(cmd, reg, value);
  	ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
+	if (ret)
+		DRM_ERROR("PSP failed to program reg id %d", reg);
 
  	kfree(cmd);
  	return ret;
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +14 -2
index eac564e8dd52..376ea281c4a7 100644
@@ -120,11 +120,23 @@ force_update_wptr_for_self_int(struct amdgpu_device *adev,
  	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
  				   RB_USED_INT_THRESHOLD, threshold);
 
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1, ih_rb_cntl))
+			return;
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+	}
+
  	ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
  	ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
  				   RB_USED_INT_THRESHOLD, threshold);
-	WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+		if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2, ih_rb_cntl))
+			return;
+	} else {
+		WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+	}
+
  	WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl);
  }
 
@@ -153,10 +165,8 @@ static int navi10_ih_toggle_ring_interrupts(struct amdgpu_device *adev,
  		tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, ENABLE_INTR, (enable ? 1 : 0));

drivers/gpu/drm/amd/amdgpu/navi10_ih.c static int navi10_ih_toggle_ring_interrupts(struct amdgpu_device *adev, · line 172

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +1 -3
 
  	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
-		if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp)) {
-			DRM_ERROR("PSP program IH_RB_CNTL failed!\n");
+		if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp))
  			return -ETIMEDOUT;
-		}
  	} else {
  		WREG32(ih_regs->ih_rb_cntl, tmp);
  	}

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

Reviewed-by Acked-by Christian König
#12 lore raw

________________________________
发件人: Koenig, Christian <[email protected]>
发送时间: 2021年6月8日 3:41
收件人: Khaire, Rohit <[email protected]>; [email protected] <[email protected]>; Kuehling, Felix <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Deng, Emily <[email protected]>; Liu, Monk <[email protected]>; Zhou, Peng Ju <[email protected]>; Chen, Horace <[email protected]> 抄送: Ming, Davis <[email protected]>
主题: Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV

Am 07.06.21 um 21:39 schrieb Rohit Khaire:

Quoted 4 lines

This is similar to IH_RB_CNTL programming in
navi10_ih_toggle_ring_interrupts

Quoted 50 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c |  2 ++
  drivers/gpu/drm/amd/amdgpu/navi10_ih.c  | 20 +++++++++++++++-----
  2 files changed, 17 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -0
index 47ceb783e2a5..058b1b1271e1 100644
@@ -683,6 +683,8 @@ int psp_reg_program(struct psp_context *psp, enum psp_reg_prog_id reg,
 
       psp_prep_reg_prog_cmd_buf(cmd, reg, value);
       ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
+     if (ret)
+             DRM_ERROR("PSP failed to program reg id %d", reg);
 
       kfree(cmd);
       return ret;
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +14 -2
index eac564e8dd52..376ea281c4a7 100644
@@ -120,11 +120,23 @@ force_update_wptr_for_self_int(struct amdgpu_device *adev,
       ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,
                                  RB_USED_INT_THRESHOLD, threshold);
 
-     WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+     if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+             if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1, ih_rb_cntl))
+                     return;
+     } else {
+             WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);
+     }
+
       ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);
       ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,
                                  RB_USED_INT_THRESHOLD, threshold);
-     WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+     if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
+             if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2, ih_rb_cntl))
+                     return;
+     } else {
+             WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);
+     }
+
       WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl);
  }
 
@@ -153,10 +165,8 @@ static int navi10_ih_toggle_ring_interrupts(struct amdgpu_device *adev,
               tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, ENABLE_INTR, (enable ? 1 : 0));

drivers/gpu/drm/amd/amdgpu/navi10_ih.c static int navi10_ih_toggle_ring_interrupts(struct amdgpu_device *adev, · line 172

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +1 -3
 
       if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
-             if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp)) {
-                     DRM_ERROR("PSP program IH_RB_CNTL failed!\n");
+             if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp))
                       return -ETIMEDOUT;
-             }
       } else {
               WREG32(ih_regs->ih_rb_cntl, tmp);
       }

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