Skip to contentSkip to conversation

drm/amdgpu: pin the csb buffer on hw init

PATCH In review Evan Quan 3 participants 35 messages Jul 5, 2018 – Jul 11, 2018 19 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/10 drm/amdgpu: pin the csb buffer on hw init

Without this pin, the csb buffer will be filled with inconsistent data after S3 resume. And that will causes gfx hang on gfxoff exit since this csb will be executed then.

Change-Id I1ae1f2eed096eaba5f601cf2a3e2650c8e583dc9
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 40 +++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +40 -0
index ac46eabe3bcd..65cc30766658 100644
@@ -943,6 +943,7 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
 		dst_ptr = adev->gfx.rlc.cs_ptr;
 		gfx_v9_0_get_csb_buffer(adev, dst_ptr);
 		amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
+		amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
 		amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
 	}
 
@@ -971,6 +972,39 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
 	return 0;
 }
 
+static int gfx_v9_0_csb_vram_pin(struct amdgpu_device *adev)
+{
+	uint64_t gpu_addr;
+	int r;
+
+	r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
+	if (unlikely(r != 0))
+		return r;
+
+	r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
+			AMDGPU_GEM_DOMAIN_VRAM, &gpu_addr);
+	if (!r)
+		adev->gfx.rlc.clear_state_gpu_addr = gpu_addr;
+
+	amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
+
+	return r;
+}
+
+static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev)
+{
+	int r;
+
+	if (!adev->gfx.rlc.clear_state_obj)
+		return;
+
+	r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
+	if (likely(r == 0)) {
+		amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
+		amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
+	}
+}
+
 static void gfx_v9_0_mec_fini(struct amdgpu_device *adev)
 {
 	amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL);
@@ -3116,6 +3150,10 @@ static int gfx_v9_0_hw_init(void *handle)
 
 	gfx_v9_0_gpu_init(adev);
 
+	r = gfx_v9_0_csb_vram_pin(adev);
+	if (r)
+		return r;
+
 	r = gfx_v9_0_rlc_resume(adev);
 	if (r)
 		return r;
@@ -3224,6 +3262,8 @@ static int gfx_v9_0_hw_fini(void *handle)
 	gfx_v9_0_cp_enable(adev, false);
 	gfx_v9_0_rlc_stop(adev);
 
+	gfx_v9_0_csb_vram_unpin(adev);
+
 	return 0;
 }
 
Signature · 6 lines
2.18.0

_______________________________________________
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): [email protected]

author
#2 lore raw

PATCH 2/10 drm/amdgpu: init CSIB regardless of rlc version and pg status

CSIB init has no relation with rlc version and pg status. It should be needed regardless of them.

Change-Id Iccd12e1015f41c7e2bc3fe02472dc979015514d4
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
index 65cc30766658..2f6ac255203f 100644
@@ -2182,6 +2182,8 @@ static void gfx_v9_0_enable_gfx_dynamic_mg_power_gating(struct amdgpu_device *ad
 
 static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
 {
+	gfx_v9_0_init_csb(adev);
+
 	if (!adev->gfx.rlc.is_rlc_v2_1)
 		return;
 
@@ -2191,7 +2193,6 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
 			      AMD_PG_SUPPORT_CP |
 			      AMD_PG_SUPPORT_GDS |
 			      AMD_PG_SUPPORT_RLC_SMU_HS)) {
-		gfx_v9_0_init_csb(adev);
 		gfx_v9_1_init_rlc_save_restore_list(adev);
 		gfx_v9_0_enable_save_restore_machine(adev);
 
Signature · 6 lines
2.18.0

_______________________________________________
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): [email protected]

author
#4 lore raw

RE: [PATCH 02/10] drm/amdgpu: init CSIB regardless of rlc version and pg status

Ping..

Quoted 42 lines

-----Original Message-----
From: Evan Quan [mailto:[email protected]]
Sent: Thursday, July 05, 2018 5:09 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 02/10] drm/amdgpu: init CSIB regardless of rlc version and pg status

CSIB init has no relation with rlc version and pg status. It should be needed regardless of them.

Change-Id Iccd12e1015f41c7e2bc3fe02472dc979015514d4
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 65cc30766658..2f6ac255203f 100644
@@ -2182,6 +2182,8 @@ static void

gfx_v9_0_enable_gfx_dynamic_mg_power_gating(struct amdgpu_device *ad

static void gfx_v9_0_init_pg(struct amdgpu_device *adev) {

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
+	gfx_v9_0_init_csb(adev);
+
 	if (!adev->gfx.rlc.is_rlc_v2_1)
 		return;
@@ -2191,7 +2193,6 @@ static void gfx_v9_0_init_pg(struct amdgpu_device
 *adev)
 			      AMD_PG_SUPPORT_CP |
 			      AMD_PG_SUPPORT_GDS |
 			      AMD_PG_SUPPORT_RLC_SMU_HS)) {
-		gfx_v9_0_init_csb(adev);
 		gfx_v9_1_init_rlc_save_restore_list(adev);
 		gfx_v9_0_enable_save_restore_machine(adev);
 
--
Quoted 1 line

2.18.0

_______________________________________________
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): SN6PR12MB265670B1B3AAC47773CBA7A9E4440-kxOKjb6HO/FeL/[email protected]

Acked-by
#6 lore raw

Re: [PATCH 02/10] drm/amdgpu: init CSIB regardless of rlc version and pg status

Quoted 15 lines · Evan

Ping..

Quoted 13 lines

-----Original Message-----
From: Evan Quan [mailto:[email protected]]
Sent: Thursday, July 05, 2018 5:09 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 02/10] drm/amdgpu: init CSIB regardless of rlc version and pg status

CSIB init has no relation with rlc version and pg status. It should be needed regardless of them.

Change-Id Iccd12e1015f41c7e2bc3fe02472dc979015514d4
Quoted 28 lines
Quoted 28 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 65cc30766658..2f6ac255203f 100644
@@ -2182,6 +2182,8 @@ static void

gfx_v9_0_enable_gfx_dynamic_mg_power_gating(struct amdgpu_device *ad

static void gfx_v9_0_init_pg(struct amdgpu_device *adev) {

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
+     gfx_v9_0_init_csb(adev);
+
      if (!adev->gfx.rlc.is_rlc_v2_1)
              return;
@@ -2191,7 +2193,6 @@ static void gfx_v9_0_init_pg(struct amdgpu_device
 *adev)
                            AMD_PG_SUPPORT_CP |
                            AMD_PG_SUPPORT_GDS |
                            AMD_PG_SUPPORT_RLC_SMU_HS)) {
-             gfx_v9_0_init_csb(adev);
              gfx_v9_1_init_rlc_save_restore_list(adev);
              gfx_v9_0_enable_save_restore_machine(adev);
Quoted 7 lines
Quoted 2 lines

--
2.18.0

_______________________________________________
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

author
#7 lore raw

PATCH 3/10 drm/amdgpu: init rlc save restore as long as the lists exist

In reply to a message not in the archive

It does not have to be rlc v2_1 and pg enabled. For rlc v2_0, rlc save restore is also needed. And pg support is definitely not a must for rlc save restore.

Change-Id I85c0e3525ca7fb385c3d0b9e5abc13708c91e795
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7 -5
index 2f6ac255203f..8d895afa6c69 100644
@@ -2184,8 +2184,13 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
 {
 	gfx_v9_0_init_csb(adev);
 
-	if (!adev->gfx.rlc.is_rlc_v2_1)
-		return;
+	/* init rlc save restore as long as the lists exist */
+	if (adev->gfx.rlc.reg_list_format_size_bytes &&
+	    adev->gfx.rlc.reg_list_size_bytes &&
+	    adev->gfx.rlc.reg_restore_list_size) {
+		gfx_v9_1_init_rlc_save_restore_list(adev);
+		gfx_v9_0_enable_save_restore_machine(adev);
+	}
 
 	if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
 			      AMD_PG_SUPPORT_GFX_SMG |
@@ -2193,9 +2198,6 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
 			      AMD_PG_SUPPORT_CP |
 			      AMD_PG_SUPPORT_GDS |
 			      AMD_PG_SUPPORT_RLC_SMU_HS)) {
-		gfx_v9_1_init_rlc_save_restore_list(adev);
-		gfx_v9_0_enable_save_restore_machine(adev);
-
 		WREG32(mmRLC_JUMP_TABLE_RESTORE,
 		       adev->gfx.rlc.cp_table_gpu_addr >> 8);
 		gfx_v9_0_init_gfx_power_gating(adev);
Signature · 6 lines
2.18.0

_______________________________________________
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): [email protected]

#9 lore raw

Re: [PATCH 03/10] drm/amdgpu: init rlc save restore as long as the lists exist

Quoted 15 lines · Evan Quan

It does not have to be rlc v2_1 and pg enabled. For rlc v2_0, rlc save restore is also needed. And pg support is definitely not a must for rlc save restore.

Change-Id I85c0e3525ca7fb385c3d0b9e5abc13708c91e795
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 2f6ac255203f..8d895afa6c69 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_init_pg(struct amdgpu_device *adev) · line 2187

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -2
@@ -2184,8 +2184,13 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
 {
 	gfx_v9_0_init_csb(adev);
 
-	if (!adev->gfx.rlc.is_rlc_v2_1)
-		return;
+	/* init rlc save restore as long as the lists exist */

Is there any case if the save restore list not exist? As far as I know, it should be always existed.

Thanks,
Ray

Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6 -3
+	if (adev->gfx.rlc.reg_list_format_size_bytes &&
+	    adev->gfx.rlc.reg_list_size_bytes &&
+	    adev->gfx.rlc.reg_restore_list_size) {
+		gfx_v9_1_init_rlc_save_restore_list(adev);
+		gfx_v9_0_enable_save_restore_machine(adev);
+	}
 
 	if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
 			      AMD_PG_SUPPORT_GFX_SMG |
@@ -2193,9 +2198,6 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
 			      AMD_PG_SUPPORT_CP |
 			      AMD_PG_SUPPORT_GDS |
 			      AMD_PG_SUPPORT_RLC_SMU_HS)) {
-		gfx_v9_1_init_rlc_save_restore_list(adev);
-		gfx_v9_0_enable_save_restore_machine(adev);
-
 		WREG32(mmRLC_JUMP_TABLE_RESTORE,
 		       adev->gfx.rlc.cp_table_gpu_addr >> 8);
 		gfx_v9_0_init_gfx_power_gating(adev);
Signature · 6 lines
2.18.0

_______________________________________________
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

author
#10 lore raw

RE: [PATCH 03/10] drm/amdgpu: init rlc save restore as long as the lists exist

For vega10, the rlc save & restore list is still not imported yet.

Regards,
Evan

Quoted 62 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Huang Rui
Sent: Thursday, July 05, 2018 11:19 PM
To: Quan, Evan <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 03/10] drm/amdgpu: init rlc save restore as long as the lists exist

Quoted 16 lines · Evan Quan

It does not have to be rlc v2_1 and pg enabled. For rlc v2_0, rlc save restore is also needed. And pg support is definitely not a must for rlc save restore.

Change-Id I85c0e3525ca7fb385c3d0b9e5abc13708c91e795
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 2f6ac255203f..8d895afa6c69 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_init_pg(struct · line 2187

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -2
@@ -2184,8 +2184,13 @@ static void gfx_v9_0_init_pg(struct
 amdgpu_device *adev)  {
 	gfx_v9_0_init_csb(adev);
 
-	if (!adev->gfx.rlc.is_rlc_v2_1)
-		return;
+	/* init rlc save restore as long as the lists exist */

Is there any case if the save restore list not exist? As far as I know, it should be always existed.

Thanks,
Ray

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_init_pg(struct

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6 -0
+	if (adev->gfx.rlc.reg_list_format_size_bytes &&
+	    adev->gfx.rlc.reg_list_size_bytes &&
+	    adev->gfx.rlc.reg_restore_list_size) {
+		gfx_v9_1_init_rlc_save_restore_list(adev);
+		gfx_v9_0_enable_save_restore_machine(adev);
+	}
 
 	if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
 			      AMD_PG_SUPPORT_GFX_SMG |
@@ -2193,9 +2198,6 @@ static void gfx_v9_0_init_pg(struct

amdgpu_device *adev)

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -4
 			      AMD_PG_SUPPORT_CP |
 			      AMD_PG_SUPPORT_GDS |
 			      AMD_PG_SUPPORT_RLC_SMU_HS)) {
-		gfx_v9_1_init_rlc_save_restore_list(adev);
-		gfx_v9_0_enable_save_restore_machine(adev);
-
 		WREG32(mmRLC_JUMP_TABLE_RESTORE,
 		       adev->gfx.rlc.cp_table_gpu_addr >> 8);
 		gfx_v9_0_init_gfx_power_gating(adev);
--

2.18.0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
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

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

#11 lore raw

Re: [PATCH 03/10] drm/amdgpu: init rlc save restore as long as the lists exist

In reply to a message not in the archive
Quoted 15 lines · Evan Quan

It does not have to be rlc v2_1 and pg enabled. For rlc v2_0, rlc save restore is also needed. And pg support is definitely not a must for rlc save restore.

Change-Id I85c0e3525ca7fb385c3d0b9e5abc13708c91e795
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 2f6ac255203f..8d895afa6c69 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_init_pg(struct amdgpu_device *adev) · line 2188

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -2
@@ -2184,8 +2184,13 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
 {
 	gfx_v9_0_init_csb(adev);
 
-	if (!adev->gfx.rlc.is_rlc_v2_1)
-		return;

Furthermore, as talked with you, we can continue using "adev->gfx.rlc.is_rlc_v2_1" rlc firmware header version to check if the current asic and ucode supported gfxoff, you know, we have to support legacy ucode even the driver codes are updated.

Thanks,
Ray

Quoted 27 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7 -3
+	/* init rlc save restore as long as the lists exist */
+	if (adev->gfx.rlc.reg_list_format_size_bytes &&
+	    adev->gfx.rlc.reg_list_size_bytes &&
+	    adev->gfx.rlc.reg_restore_list_size) {
+		gfx_v9_1_init_rlc_save_restore_list(adev);
+		gfx_v9_0_enable_save_restore_machine(adev);
+	}
 
 	if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
 			      AMD_PG_SUPPORT_GFX_SMG |
@@ -2193,9 +2198,6 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
 			      AMD_PG_SUPPORT_CP |
 			      AMD_PG_SUPPORT_GDS |
 			      AMD_PG_SUPPORT_RLC_SMU_HS)) {
-		gfx_v9_1_init_rlc_save_restore_list(adev);
-		gfx_v9_0_enable_save_restore_machine(adev);
-
 		WREG32(mmRLC_JUMP_TABLE_RESTORE,
 		       adev->gfx.rlc.cp_table_gpu_addr >> 8);
 		gfx_v9_0_init_gfx_power_gating(adev);
Signature · 6 lines
2.18.0

_______________________________________________
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

author
#12 lore raw

RE: [PATCH 03/10] drm/amdgpu: init rlc save restore as long as the lists exist

Hi Ray,

After reconsideration, I think for the rlc save restore related, there are the following issues:
1. To use adev->gfx.rlc.reg_list_format_direct_reg_list_length or GFX9_RLC_FORMAT_DIRECT_REG_LIST_LENGTH?
-> "reg_list_format_direct_reg_list_length" is new introduced by rlc v2_1.
To back compatible with asics(vega12,vega20 and vega10) with rlc v2_0, i will suggest to use GFX9_RLC_FORMAT_DIRECT_REG_LIST_LENGTH directly.

2. Do we need to consider the gfxoff enable/disable message + old rlc fw case?
Per my observatrion and tests, there will be no harms for such case.
Since gfxoff will actually not take effect if the rlc fw is not ready. So, we do not need to consider back compatibility here.

Conclude all, I do not think we need to update vega12 rlc from v2_0 to v2_1. The below comparations can guard we do not break old vega12 rlc fws.
+ if (adev->gfx.rlc.reg_list_format_size_bytes &&
+ adev->gfx.rlc.reg_list_size_bytes &&
+ adev->gfx.rlc.reg_restore_list_size) {

Regards,
Evan

Quoted 63 lines

-----Original Message-----
From: Huang Rui [mailto:[email protected]]
Sent: Friday, July 06, 2018 6:15 PM
To: Quan, Evan <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 03/10] drm/amdgpu: init rlc save restore as long as the lists exist

Quoted 16 lines · Evan Quan

It does not have to be rlc v2_1 and pg enabled. For rlc v2_0, rlc save restore is also needed. And pg support is definitely not a must for rlc save restore.

Change-Id I85c0e3525ca7fb385c3d0b9e5abc13708c91e795
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 2f6ac255203f..8d895afa6c69 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_init_pg(struct · line 2188

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -2
@@ -2184,8 +2184,13 @@ static void gfx_v9_0_init_pg(struct
 amdgpu_device *adev)  {
 	gfx_v9_0_init_csb(adev);
 
-	if (!adev->gfx.rlc.is_rlc_v2_1)
-		return;

Furthermore, as talked with you, we can continue using "adev-

Quoted 1 line

gfx.rlc.is_rlc_v2_1" rlc firmware header version to check if the current asic

and ucode supported gfxoff, you know, we have to support legacy ucode even the driver codes are updated.

Thanks,
Ray

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_init_pg(struct

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7 -0
+	/* init rlc save restore as long as the lists exist */
+	if (adev->gfx.rlc.reg_list_format_size_bytes &&
+	    adev->gfx.rlc.reg_list_size_bytes &&
+	    adev->gfx.rlc.reg_restore_list_size) {
+		gfx_v9_1_init_rlc_save_restore_list(adev);
+		gfx_v9_0_enable_save_restore_machine(adev);
+	}
 
 	if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
 			      AMD_PG_SUPPORT_GFX_SMG |
@@ -2193,9 +2198,6 @@ static void gfx_v9_0_init_pg(struct

amdgpu_device *adev)

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -4
 			      AMD_PG_SUPPORT_CP |
 			      AMD_PG_SUPPORT_GDS |
 			      AMD_PG_SUPPORT_RLC_SMU_HS)) {
-		gfx_v9_1_init_rlc_save_restore_list(adev);
-		gfx_v9_0_enable_save_restore_machine(adev);
-
 		WREG32(mmRLC_JUMP_TABLE_RESTORE,
 		       adev->gfx.rlc.cp_table_gpu_addr >> 8);
 		gfx_v9_0_init_gfx_power_gating(adev);
--

2.18.0

Quoted 4 lines
Quoted 4 lines

_______________________________________________
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

author
#13 lore raw

PATCH 4/10 drm/amdgpu: correct direct reg list length for v2_0 rlc

In reply to a message not in the archive

For v2_0 rlc, rlc save restore list also needs to be initialized. However, there is no reg_list_format_direct_reg_list_length member(v2_1 spefic) for it.

Change-Id I29bfe441c4f4b4726a7dd61b315347fea057163b
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -2
index 8d895afa6c69..8d870d4f8414 100644
@@ -42,6 +42,7 @@
 #define GFX9_MEC_HPD_SIZE 2048
 #define RLCG_UCODE_LOADING_START_ADDRESS 0x00002000L
 #define RLC_SAVE_RESTORE_ADDR_STARTING_OFFSET 0x00000000L
+#define GFX9_RLC_FORMAT_DIRECT_REG_LIST_LENGTH 34
 
 #define mmPWR_MISC_CNTL_STATUS					0x0183
 #define mmPWR_MISC_CNTL_STATUS_BASE_IDX				0
@@ -1927,7 +1928,7 @@ static int gfx_v9_1_init_rlc_save_restore_list(struct amdgpu_device *adev)
 	/* setup unique_indirect_regs array and indirect_start_offsets array */
 	unique_indirect_reg_count = ARRAY_SIZE(unique_indirect_regs);
 	gfx_v9_1_parse_ind_reg_list(register_list_format,
-				    adev->gfx.rlc.reg_list_format_direct_reg_list_length,
+				    GFX9_RLC_FORMAT_DIRECT_REG_LIST_LENGTH,
 				    adev->gfx.rlc.reg_list_format_size_bytes >> 2,
 				    unique_indirect_regs,
 				    unique_indirect_reg_count,
@@ -1952,7 +1953,7 @@ static int gfx_v9_1_init_rlc_save_restore_list(struct amdgpu_device *adev)
 		adev->gfx.rlc.reg_list_format_start);
 
 	/* direct register portion */
-	for (i = 0; i < adev->gfx.rlc.reg_list_format_direct_reg_list_length; i++)
+	for (i = 0; i < GFX9_RLC_FORMAT_DIRECT_REG_LIST_LENGTH; i++)
 		WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_GPM_SCRATCH_DATA),
 			register_list_format[i]);
 
Signature · 6 lines
2.18.0

_______________________________________________
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): [email protected]

#15 lore raw

Re: [PATCH 04/10] drm/amdgpu: correct direct reg list length for v2_0 rlc

Quoted 32 lines · Evan Quan

For v2_0 rlc, rlc save restore list also needs to be initialized. However, there is no reg_list_format_direct_reg_list_length member(v2_1 spefic) for it.

Change-Id I29bfe441c4f4b4726a7dd61b315347fea057163b
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
index 8d895afa6c69..8d870d4f8414 100644
@@ -42,6 +42,7 @@
 #define GFX9_MEC_HPD_SIZE 2048
 #define RLCG_UCODE_LOADING_START_ADDRESS 0x00002000L
 #define RLC_SAVE_RESTORE_ADDR_STARTING_OFFSET 0x00000000L
+#define GFX9_RLC_FORMAT_DIRECT_REG_LIST_LENGTH 34
 
 #define mmPWR_MISC_CNTL_STATUS					0x0183
 #define mmPWR_MISC_CNTL_STATUS_BASE_IDX				0
@@ -1927,7 +1928,7 @@ static int gfx_v9_1_init_rlc_save_restore_list(struct amdgpu_device *adev)
 	/* setup unique_indirect_regs array and indirect_start_offsets array */
 	unique_indirect_reg_count = ARRAY_SIZE(unique_indirect_regs);
 	gfx_v9_1_parse_ind_reg_list(register_list_format,
-				    adev->gfx.rlc.reg_list_format_direct_reg_list_length,
+				    GFX9_RLC_FORMAT_DIRECT_REG_LIST_LENGTH,
 				    adev->gfx.rlc.reg_list_format_size_bytes >> 2,
 				    unique_indirect_regs,
 				    unique_indirect_reg_count,

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_1_init_rlc_save_restore_list(struct amdgpu_device *adev) · line 1956

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
@@ -1952,7 +1953,7 @@ static int gfx_v9_1_init_rlc_save_restore_list(struct amdgpu_device *adev)
 		adev->gfx.rlc.reg_list_format_start);
 
 	/* direct register portion */
-	for (i = 0; i < adev->gfx.rlc.reg_list_format_direct_reg_list_length; i++)
+	for (i = 0; i < GFX9_RLC_FORMAT_DIRECT_REG_LIST_LENGTH; i++)

This definition is actually defined on register_list_format.h in the ucode. So we would better to put it in firmware header.

Thanks,
Ray

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 		WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_GPM_SCRATCH_DATA),
 			register_list_format[i]);
 
Signature · 6 lines
2.18.0

_______________________________________________
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

author
#16 lore raw

RE: [PATCH 04/10] drm/amdgpu: correct direct reg list length for v2_0 rlc

As discussed for patch3, reg_list_format_direct_reg_list_length is newly introduced by rlc v2_1. For ASICs(vega10/12/20) with rlc v2_0, it's not a good idea to use reg_list_format_direct_reg_list_length.

Regards,
Evan

Quoted 59 lines

-----Original Message-----
From: Huang Rui [mailto:[email protected]]
Sent: Thursday, July 05, 2018 11:07 PM
To: Quan, Evan <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 04/10] drm/amdgpu: correct direct reg list length for v2_0 rlc

Quoted 21 lines · Evan Quan

For v2_0 rlc, rlc save restore list also needs to be initialized. However, there is no reg_list_format_direct_reg_list_length member(v2_1 spefic) for it.

Change-Id I29bfe441c4f4b4726a7dd61b315347fea057163b
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 8d895afa6c69..8d870d4f8414 100644
@@ -42,6 +42,7 @@
 #define GFX9_MEC_HPD_SIZE 2048
 #define RLCG_UCODE_LOADING_START_ADDRESS 0x00002000L  #define

RLC_SAVE_RESTORE_ADDR_STARTING_OFFSET 0x00000000L +#define GFX9_RLC_FORMAT_DIRECT_REG_LIST_LENGTH 34

Quoted 1 line

#define mmPWR_MISC_CNTL_STATUS

	0x0183
Quoted 1 line

#define mmPWR_MISC_CNTL_STATUS_BASE_IDX

	0

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
@@ -1927,7 +1928,7 @@ static int

gfx_v9_1_init_rlc_save_restore_list(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int · line 1928

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 	/* setup unique_indirect_regs array and indirect_start_offsets array

*/

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int · line 1932

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
 	unique_indirect_reg_count = ARRAY_SIZE(unique_indirect_regs);
 	gfx_v9_1_parse_ind_reg_list(register_list_format,
-				    adev-
 gfx.rlc.reg_list_format_direct_reg_list_length,
+

GFX9_RLC_FORMAT_DIRECT_REG_LIST_LENGTH,

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int · line 1933

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 				    adev->gfx.rlc.reg_list_format_size_bytes >>

2,

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 				    unique_indirect_regs,
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 				    unique_indirect_reg_count,
@@ -1952,7 +1953,7 @@ static int

gfx_v9_1_init_rlc_save_restore_list(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_1_init_rlc_save_restore_list(struct amdgpu_device *adev) · line 1956

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
 		adev->gfx.rlc.reg_list_format_start);
 
 	/* direct register portion */
-	for (i = 0; i < adev->gfx.rlc.reg_list_format_direct_reg_list_length; i++)
+	for (i = 0; i < GFX9_RLC_FORMAT_DIRECT_REG_LIST_LENGTH; i++)

This definition is actually defined on register_list_format.h in the ucode. So we would better to put it in firmware header.

Quoted 14 lines

Thanks,
Ray

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int · line 1957

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 		WREG32(SOC15_REG_OFFSET(GC, 0,

mmRLC_GPM_SCRATCH_DATA),

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -1
 			register_list_format[i]);
 
--

2.18.0

_______________________________________________
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

author
#17 lore raw

PATCH 5/10 drm/amdgpu: drop mmRLC_PG_CNTL clear

In reply to a message not in the archive

This may break gfxoff support since this register will be set by smc fw(for vega12, that's the case).

Change-Id Id3108c63634a2f941289021bfbd78588c0f6c4d6
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -3
index 8d870d4f8414..3a75641a071d 100644
@@ -2290,9 +2290,6 @@ static int gfx_v9_0_rlc_resume(struct amdgpu_device *adev)
 	/* disable CG */
 	WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL, 0);
 
-	/* disable PG */
-	WREG32_SOC15(GC, 0, mmRLC_PG_CNTL, 0);
-
 	gfx_v9_0_rlc_reset(adev);
 
 	gfx_v9_0_init_pg(adev);
Signature · 6 lines
2.18.0

_______________________________________________
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): [email protected]

Reviewed-by
#19 lore raw

Re: [PATCH 05/10] drm/amdgpu: drop mmRLC_PG_CNTL clear

Quoted 5 lines · Evan Quan

This may break gfxoff support since this register will be set by smc fw(for vega12, that's the case).

Change-Id Id3108c63634a2f941289021bfbd78588c0f6c4d6
Quoted 25 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -3
index 8d870d4f8414..3a75641a071d 100644
@@ -2290,9 +2290,6 @@ static int gfx_v9_0_rlc_resume(struct amdgpu_device *adev)
 	/* disable CG */
 	WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL, 0);
 
-	/* disable PG */
-	WREG32_SOC15(GC, 0, mmRLC_PG_CNTL, 0);
-
 	gfx_v9_0_rlc_reset(adev);
 
 	gfx_v9_0_init_pg(adev);
Signature · 6 lines
2.18.0

_______________________________________________
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

Reviewed-by
#20 lore raw

Re: [PATCH 05/10] drm/amdgpu: drop mmRLC_PG_CNTL clear

In reply to a message not in the archive
Quoted 3 lines · Evan Quan

This may break gfxoff support since this register will be set by smc fw(for vega12, that's the case).

It took me a second to understand what you meant here. Might be worthwhile to clarify with something like:
SMU owns this register so the driver should not set it to avoid breaking gfxoff.

With that fixed up:

Alex

Quoted 23 lines
Change-Id Id3108c63634a2f941289021bfbd78588c0f6c4d6
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -4
index 8d870d4f8414..3a75641a071d 100644
@@ -2290,9 +2290,6 @@ static int gfx_v9_0_rlc_resume(struct amdgpu_device *adev)
        /* disable CG */
        WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL, 0);
 
-       /* disable PG */
-       WREG32_SOC15(GC, 0, mmRLC_PG_CNTL, 0);
-
        gfx_v9_0_rlc_reset(adev);
 
        gfx_v9_0_init_pg(adev);
--

2.18.0

Quoted 4 lines

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): CADnq5_Mkjuj9hLahht=s70wwXKNqnRcaFMJNjOjR8HSh_DWpUw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#22 lore raw

Re: [PATCH 05/10] drm/amdgpu: drop mmRLC_PG_CNTL clear

Quoted 9 lines · Alex Deucher
Quoted 3 lines · Evan Quan

This may break gfxoff support since this register will be set by smc fw(for vega12, that's the case).

It took me a second to understand what you meant here. Might be worthwhile to clarify with something like:
SMU owns this register so the driver should not set it to avoid breaking gfxoff.

Agree. Actually, it cleared Ultra_Low_Voltage_Enable bit of mmRLC_PG_CNTL, that caused gfxoff break before. We should have explained clearly here. :-)

Thanks,
Ray

Quoted 28 lines

With that fixed up:

Alex

Quoted 23 lines
Change-Id Id3108c63634a2f941289021bfbd78588c0f6c4d6
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -4
index 8d870d4f8414..3a75641a071d 100644
@@ -2290,9 +2290,6 @@ static int gfx_v9_0_rlc_resume(struct amdgpu_device *adev)
        /* disable CG */
        WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL, 0);
 
-       /* disable PG */
-       WREG32_SOC15(GC, 0, mmRLC_PG_CNTL, 0);
-
        gfx_v9_0_rlc_reset(adev);
 
        gfx_v9_0_init_pg(adev);
--

2.18.0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
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

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

author
#23 lore raw

PATCH 6/10 drm/amdgpu: no touch for the reserved bit of RLC_CGTT_MGCG_OVERRIDE

In reply to a message not in the archive

On vega12, the bit0 of RLC_CGTT_MGCG_OVERRIDE is reserved.

Change-Id I9042a8c89db16f220da5a589264937b51870c187
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +11 -4
index 3a75641a071d..ee537423af11 100644
@@ -3551,8 +3551,11 @@ static void gfx_v9_0_update_medium_grain_clock_gating(struct amdgpu_device *adev
 	if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_MGCG)) {
 		/* 1 - RLC_CGTT_MGCG_OVERRIDE */
 		def = data = RREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE);
-		data &= ~(RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK |
-			  RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |
+
+		if (adev->asic_type != CHIP_VEGA12)
+			data &= ~RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK;
+
+		data &= ~(RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |
 			  RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK |
 			  RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK);
 
@@ -3582,11 +3585,15 @@ static void gfx_v9_0_update_medium_grain_clock_gating(struct amdgpu_device *adev
 	} else {
 		/* 1 - MGCG_OVERRIDE */
 		def = data = RREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE);
-		data |= (RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK |
-			 RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK |
+
+		if (adev->asic_type != CHIP_VEGA12)
+			data |= RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK;
+
+		data |= (RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK |
 			 RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |
 			 RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK |
 			 RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK);
+
 		if (def != data)
 			WREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE, data);
 
Signature · 6 lines
2.18.0

_______________________________________________
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): [email protected]

author
#25 lore raw

RE: [PATCH 06/10] drm/amdgpu: no touch for the reserved bit of RLC_CGTT_MGCG_OVERRIDE

Ping..

Quoted 71 lines

-----Original Message-----
From: Evan Quan [mailto:[email protected]]
Sent: Thursday, July 05, 2018 5:10 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 06/10] drm/amdgpu: no touch for the reserved bit of RLC_CGTT_MGCG_OVERRIDE

On vega12, the bit0 of RLC_CGTT_MGCG_OVERRIDE is reserved.

Change-Id I9042a8c89db16f220da5a589264937b51870c187
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 3a75641a071d..ee537423af11 100644
@@ -3551,8 +3551,11 @@ static void

gfx_v9_0_update_medium_grain_clock_gating(struct amdgpu_device *adev

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 	if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_MGCG)) {
 		/* 1 - RLC_CGTT_MGCG_OVERRIDE */
 		def = data = RREG32_SOC15(GC, 0,

mmRLC_CGTT_MGCG_OVERRIDE);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -1
-		data &=

~(RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK | - RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
+
+		if (adev->asic_type != CHIP_VEGA12)
+			data &=

~RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK;

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
+
+		data &=

~(RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |

RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK |

RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
@@ -3582,11 +3585,15 @@ static void

gfx_v9_0_update_medium_grain_clock_gating(struct amdgpu_device *adev

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 	} else {
 		/* 1 - MGCG_OVERRIDE */
 		def = data = RREG32_SOC15(GC, 0,

mmRLC_CGTT_MGCG_OVERRIDE);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -1
-		data |=

(RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK | - RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK |

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
+
+		if (adev->asic_type != CHIP_VEGA12)
+			data |=

RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK;

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
+
+		data |=

(RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK |

RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |

RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK |

RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -0
+
 		if (def != data)
 			WREG32_SOC15(GC, 0,

mmRLC_CGTT_MGCG_OVERRIDE, data);

Quoted 2 lines

--
2.18.0

_______________________________________________
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): SN6PR12MB2656F298CDBE1A2607BA5B36E4440-kxOKjb6HO/FeL/[email protected]

Acked-by
#27 lore raw

Re: [PATCH 06/10] drm/amdgpu: no touch for the reserved bit of RLC_CGTT_MGCG_OVERRIDE

Quoted 14 lines · Evan

Ping..

Quoted 12 lines

-----Original Message-----
From: Evan Quan [mailto:[email protected]]
Sent: Thursday, July 05, 2018 5:10 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 06/10] drm/amdgpu: no touch for the reserved bit of RLC_CGTT_MGCG_OVERRIDE

On vega12, the bit0 of RLC_CGTT_MGCG_OVERRIDE is reserved.

Change-Id I9042a8c89db16f220da5a589264937b51870c187
Quoted 59 lines
Quoted 59 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 3a75641a071d..ee537423af11 100644
@@ -3551,8 +3551,11 @@ static void

gfx_v9_0_update_medium_grain_clock_gating(struct amdgpu_device *adev

      if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_MGCG)) {
              /* 1 - RLC_CGTT_MGCG_OVERRIDE */
              def = data = RREG32_SOC15(GC, 0,

mmRLC_CGTT_MGCG_OVERRIDE);
- data &=
~(RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK | - RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
+
+             if (adev->asic_type != CHIP_VEGA12)
+                     data &=

~RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK;

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
+
+             data &=

~(RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |

RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK |

RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
@@ -3582,11 +3585,15 @@ static void

gfx_v9_0_update_medium_grain_clock_gating(struct amdgpu_device *adev

      } else {
              /* 1 - MGCG_OVERRIDE */
              def = data = RREG32_SOC15(GC, 0,

mmRLC_CGTT_MGCG_OVERRIDE);
- data |=
(RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK | - RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK |

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
+
+             if (adev->asic_type != CHIP_VEGA12)
+                     data |=

RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK;

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
+
+             data |=

(RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK |

RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |

RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK |

RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK); +

              if (def != data)
                      WREG32_SOC15(GC, 0,

mmRLC_CGTT_MGCG_OVERRIDE, data);

Quoted 7 lines
Quoted 2 lines

--
2.18.0

_______________________________________________
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

author
#28 lore raw

PATCH 7/10 drm/amdgpu: reduce the idle period that RLC has to wait before request CGCG

In reply to a message not in the archive

Gfxoff feature may depends on the CGCG(on vega12, that's the case). This change will help to enable gfxoff feature more frequently.

Change-Id I021577e331b7beb19796bd6f5465b867f6038974
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7 -4
index ee537423af11..cb7f2efa9882 100644
@@ -3629,9 +3629,11 @@ static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,
 		/* update CGCG and CGLS override bits */
 		if (def != data)
 			WREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE, data);
-		/* enable 3Dcgcg FSM(0x0020003f) */
+
+		/* enable 3Dcgcg FSM(0x0000363f) */
 		def = RREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL_3D);
-		data = (0x2000 << RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |
+
+		data = (0x36 << RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |
 			RLC_CGCG_CGLS_CTRL_3D__CGCG_EN_MASK;
 		if (adev->cg_flags & AMD_CG_SUPPORT_GFX_3D_CGLS)
 			data |= (0x000F << RLC_CGCG_CGLS_CTRL_3D__CGLS_REP_COMPANSAT_DELAY__SHIFT) |
@@ -3678,9 +3680,10 @@ static void gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device *adev
 		if (def != data)
 			WREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE, data);
 
-		/* enable cgcg FSM(0x0020003F) */
+		/* enable cgcg FSM(0x0000363F) */
 		def = RREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL);
-		data = (0x2000 << RLC_CGCG_CGLS_CTRL__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |
+
+		data = (0x36 << RLC_CGCG_CGLS_CTRL__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |
 			RLC_CGCG_CGLS_CTRL__CGCG_EN_MASK;
 		if (adev->cg_flags & AMD_CG_SUPPORT_GFX_CGLS)
 			data |= (0x000F << RLC_CGCG_CGLS_CTRL__CGLS_REP_COMPANSAT_DELAY__SHIFT) |
Signature · 6 lines
2.18.0

_______________________________________________
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): [email protected]

author
#30 lore raw

RE: [PATCH 07/10] drm/amdgpu: reduce the idle period that RLC has to wait before request CGCG

Ping..

Quoted 58 lines

-----Original Message-----
From: Evan Quan [mailto:[email protected]]
Sent: Thursday, July 05, 2018 5:10 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 07/10] drm/amdgpu: reduce the idle period that RLC has to wait before request CGCG

Gfxoff feature may depends on the CGCG(on vega12, that's the case). This change will help to enable gfxoff feature more frequently.

Change-Id I021577e331b7beb19796bd6f5465b867f6038974
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index ee537423af11..cb7f2efa9882 100644
@@ -3629,9 +3629,11 @@ static void
 gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,
 		/* update CGCG and CGLS override bits */
 		if (def != data)
 			WREG32_SOC15(GC, 0,
 mmRLC_CGTT_MGCG_OVERRIDE, data);
-		/* enable 3Dcgcg FSM(0x0020003f) */
+
+		/* enable 3Dcgcg FSM(0x0000363f) */
 		def = RREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL_3D);
-		data = (0x2000 <<

RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
+
+		data = (0x36 <<
+RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |
 			RLC_CGCG_CGLS_CTRL_3D__CGCG_EN_MASK;
 		if (adev->cg_flags & AMD_CG_SUPPORT_GFX_3D_CGLS)
 			data |= (0x000F <<

RLC_CGCG_CGLS_CTRL_3D__CGLS_REP_COMPANSAT_DELAY__SHIFT) |

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
@@ -3678,9 +3680,10 @@ static void

gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device *adev

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 		if (def != data)
 			WREG32_SOC15(GC, 0,

mmRLC_CGTT_MGCG_OVERRIDE, data);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -2
-		/* enable cgcg FSM(0x0020003F) */
+		/* enable cgcg FSM(0x0000363F) */
 		def = RREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL);
-		data = (0x2000 <<

RLC_CGCG_CGLS_CTRL__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
+
+		data = (0x36 <<

RLC_CGCG_CGLS_CTRL__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 			RLC_CGCG_CGLS_CTRL__CGCG_EN_MASK;
 		if (adev->cg_flags & AMD_CG_SUPPORT_GFX_CGLS)
 			data |= (0x000F <<
Quoted 3 lines

RLC_CGCG_CGLS_CTRL__CGLS_REP_COMPANSAT_DELAY__SHIFT) | --
2.18.0

_______________________________________________
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): SN6PR12MB2656009EA5F895E6F2B399B5E4440-kxOKjb6HO/FeL/[email protected]

Acked-by
#32 lore raw

Re: [PATCH 07/10] drm/amdgpu: reduce the idle period that RLC has to wait before request CGCG

Quoted 12 lines · Evan

Ping..

Quoted 10 lines

-----Original Message-----
From: Evan Quan [mailto:[email protected]]
Sent: Thursday, July 05, 2018 5:10 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 07/10] drm/amdgpu: reduce the idle period that RLC has to wait before request CGCG

Gfxoff feature may depends on the CGCG(on vega12, that's the case). This change will help to enable gfxoff feature more frequently.

I assume this is ok for RV gfxoff as well? if so:

Quoted 48 lines
Quoted 48 lines
Change-Id I021577e331b7beb19796bd6f5465b867f6038974
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index ee537423af11..cb7f2efa9882 100644
@@ -3629,9 +3629,11 @@ static void
 gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,
              /* update CGCG and CGLS override bits */
              if (def != data)
                      WREG32_SOC15(GC, 0,
 mmRLC_CGTT_MGCG_OVERRIDE, data);
-             /* enable 3Dcgcg FSM(0x0020003f) */
+
+             /* enable 3Dcgcg FSM(0x0000363f) */
              def = RREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL_3D);
-             data = (0x2000 <<

RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
+
+             data = (0x36 <<
+RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |
                      RLC_CGCG_CGLS_CTRL_3D__CGCG_EN_MASK;
              if (adev->cg_flags & AMD_CG_SUPPORT_GFX_3D_CGLS)
                      data |= (0x000F <<

RLC_CGCG_CGLS_CTRL_3D__CGLS_REP_COMPANSAT_DELAY__SHIFT) |

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
@@ -3678,9 +3680,10 @@ static void

gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device *adev

              if (def != data)
                      WREG32_SOC15(GC, 0,

mmRLC_CGTT_MGCG_OVERRIDE, data);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -2
-             /* enable cgcg FSM(0x0020003F) */
+             /* enable cgcg FSM(0x0000363F) */
              def = RREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL);
-             data = (0x2000 <<

RLC_CGCG_CGLS_CTRL__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
+
+             data = (0x36 <<

RLC_CGCG_CGLS_CTRL__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |

                      RLC_CGCG_CGLS_CTRL__CGCG_EN_MASK;
              if (adev->cg_flags & AMD_CG_SUPPORT_GFX_CGLS)
                      data |= (0x000F <<
Quoted 8 lines
Quoted 3 lines

RLC_CGCG_CGLS_CTRL__CGLS_REP_COMPANSAT_DELAY__SHIFT) | --
2.18.0

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): CADnq5_NhmSk62EE3VG+V-=9M-pWZo-jJzzrLKL_K0By2_OaQ7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#34 lore raw

RE: [PATCH 07/10] drm/amdgpu: reduce the idle period that RLC has to wait before request CGCG

Yes, Rv gfxoff is not affected.

Regards,
Evan

Quoted 60 lines

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Wednesday, July 11, 2018 1:20 AM
To: Quan, Evan <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 07/10] drm/amdgpu: reduce the idle period that RLC has to wait before request CGCG

Quoted 12 lines · Evan

Ping..

Quoted 10 lines

-----Original Message-----
From: Evan Quan [mailto:[email protected]]
Sent: Thursday, July 05, 2018 5:10 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 07/10] drm/amdgpu: reduce the idle period that RLC has to wait before request CGCG

Gfxoff feature may depends on the CGCG(on vega12, that's the case). This change will help to enable gfxoff feature more frequently.

I assume this is ok for RV gfxoff as well? if so:

Quoted 23 lines
Quoted 23 lines
Change-Id I021577e331b7beb19796bd6f5465b867f6038974
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index ee537423af11..cb7f2efa9882 100644
@@ -3629,9 +3629,11 @@ static void
 gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,
              /* update CGCG and CGLS override bits */
              if (def != data)
                      WREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE,
 data);
-             /* enable 3Dcgcg FSM(0x0020003f) */
+
+             /* enable 3Dcgcg FSM(0x0000363f) */
              def = RREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL_3D);
-             data = (0x2000 <<
Quoted 8 lines
Quoted 8 lines

RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
+
+             data = (0x36 <<
+RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |
                      RLC_CGCG_CGLS_CTRL_3D__CGCG_EN_MASK;
              if (adev->cg_flags & AMD_CG_SUPPORT_GFX_3D_CGLS)
                      data |= (0x000F <<

RLC_CGCG_CGLS_CTRL_3D__CGLS_REP_COMPANSAT_DELAY__SHIFT) |

@@ -3678,9

Quoted 26 lines
Quoted 2 lines
Quoted 2 lines

+3680,10 @@ static void gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device

*adev

Quoted 23 lines
Quoted 12 lines
              if (def != data)
                      WREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE,

data);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -2
-             /* enable cgcg FSM(0x0020003F) */
+             /* enable cgcg FSM(0x0000363F) */
              def = RREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL);
-             data = (0x2000 <<

RLC_CGCG_CGLS_CTRL__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
+
+             data = (0x36 <<

RLC_CGCG_CGLS_CTRL__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |

Quoted 6 lines
                      RLC_CGCG_CGLS_CTRL__CGCG_EN_MASK;
              if (adev->cg_flags & AMD_CG_SUPPORT_GFX_CGLS)
                      data |= (0x000F <<

RLC_CGCG_CGLS_CTRL__CGLS_REP_COMPANSAT_DELAY__SHIFT) | --
2.18.0

_______________________________________________
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

author
#35 lore raw

PATCH 8/10 drm/amdgpu: use the accessible target rlc safe mode Apis directly

In reply to a message not in the archive

No need to do double dereference to reach the Apis. They are accessible directly.

Change-Id I4b810c5e1981e0810df36a701b20edaf1f6af207
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4 -4
index cb7f2efa9882..9679bdc0ea2e 100644
@@ -3618,7 +3618,7 @@ static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,
 {
 	uint32_t data, def;
 
-	adev->gfx.rlc.funcs->enter_safe_mode(adev);
+	gfx_v9_0_enter_rlc_safe_mode(adev);
 
 	/* Enable 3D CGCG/CGLS */
 	if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_3D_CGCG)) {
@@ -3658,7 +3658,7 @@ static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,
 			WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL_3D, data);
 	}
 
-	adev->gfx.rlc.funcs->exit_safe_mode(adev);
+	gfx_v9_0_exit_rlc_safe_mode(adev);
 }
 
 static void gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device *adev,
@@ -3666,7 +3666,7 @@ static void gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device *adev
 {
 	uint32_t def, data;
 
-	adev->gfx.rlc.funcs->enter_safe_mode(adev);
+	gfx_v9_0_enter_rlc_safe_mode(adev);
 
 	if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_CGCG)) {
 		def = data = RREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE);
@@ -3706,7 +3706,7 @@ static void gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device *adev
 			WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL, data);
 	}
 
-	adev->gfx.rlc.funcs->exit_safe_mode(adev);
+	gfx_v9_0_exit_rlc_safe_mode(adev);
 }
 
 static int gfx_v9_0_update_gfx_clock_gating(struct amdgpu_device *adev,
Signature · 6 lines
2.18.0

_______________________________________________
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): [email protected]

author
#37 lore raw

RE: [PATCH 08/10] drm/amdgpu: use the accessible target rlc safe mode Apis directly

Ping..

Quoted 63 lines

-----Original Message-----
From: Evan Quan [mailto:[email protected]]
Sent: Thursday, July 05, 2018 5:10 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 08/10] drm/amdgpu: use the accessible target rlc safe mode Apis directly

No need to do double dereference to reach the Apis. They are accessible directly.

Change-Id I4b810c5e1981e0810df36a701b20edaf1f6af207
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
index cb7f2efa9882..9679bdc0ea2e 100644
@@ -3618,7 +3618,7 @@ static void
 gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,  {
 	uint32_t data, def;
 
-	adev->gfx.rlc.funcs->enter_safe_mode(adev);
+	gfx_v9_0_enter_rlc_safe_mode(adev);
 
 	/* Enable 3D CGCG/CGLS */
 	if (enable && (adev->cg_flags &

AMD_CG_SUPPORT_GFX_3D_CGCG)) { @@ -3658,7 +3658,7 @@ static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,
WREG32_SOC15(GC, 0,
mmRLC_CGCG_CGLS_CTRL_3D, data);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
 	}
 
-	adev->gfx.rlc.funcs->exit_safe_mode(adev);
+	gfx_v9_0_exit_rlc_safe_mode(adev);
 }
 
 static void gfx_v9_0_update_coarse_grain_clock_gating(struct

amdgpu_device *adev, @@ -3666,7 +3666,7 @@ static void gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device *adev {

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
 	uint32_t def, data;
 
-	adev->gfx.rlc.funcs->enter_safe_mode(adev);
+	gfx_v9_0_enter_rlc_safe_mode(adev);
 
 	if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_CGCG)) {
 		def = data = RREG32_SOC15(GC, 0,

mmRLC_CGTT_MGCG_OVERRIDE); @@ -3706,7 +3706,7 @@ static void gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device *adev
WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL,
data);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -2
 	}
 
-	adev->gfx.rlc.funcs->exit_safe_mode(adev);
+	gfx_v9_0_exit_rlc_safe_mode(adev);
 }
 
 static int gfx_v9_0_update_gfx_clock_gating(struct amdgpu_device *adev,
--
Quoted 1 line

2.18.0

_______________________________________________
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): SN6PR12MB26569BE03C4B86F63E161B94E4440-kxOKjb6HO/FeL/[email protected]

#39 lore raw

Re: [PATCH 08/10] drm/amdgpu: use the accessible target rlc safe mode Apis directly

Quoted 13 lines · Evan

Ping..

Quoted 11 lines

-----Original Message-----
From: Evan Quan [mailto:[email protected]]
Sent: Thursday, July 05, 2018 5:10 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 08/10] drm/amdgpu: use the accessible target rlc safe mode Apis directly

No need to do double dereference to reach the Apis. They are accessible directly.

One advantage of using the callback is that you may end up having different callbacks for different asics within the gfx9 family. I don't know if this will be the case or not. IIRC, there were differences between chips on older gfx versions.

Alex

Quoted 50 lines
Quoted 50 lines
Change-Id I4b810c5e1981e0810df36a701b20edaf1f6af207
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
index cb7f2efa9882..9679bdc0ea2e 100644
@@ -3618,7 +3618,7 @@ static void
 gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,  {
      uint32_t data, def;
 
-     adev->gfx.rlc.funcs->enter_safe_mode(adev);
+     gfx_v9_0_enter_rlc_safe_mode(adev);
 
      /* Enable 3D CGCG/CGLS */
      if (enable && (adev->cg_flags &

AMD_CG_SUPPORT_GFX_3D_CGCG)) { @@ -3658,7 +3658,7 @@ static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,

                      WREG32_SOC15(GC, 0,
mmRLC_CGCG_CGLS_CTRL_3D, data);
      }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
-     adev->gfx.rlc.funcs->exit_safe_mode(adev);
+     gfx_v9_0_exit_rlc_safe_mode(adev);
 }
 
 static void gfx_v9_0_update_coarse_grain_clock_gating(struct

amdgpu_device *adev, @@ -3666,7 +3666,7 @@ static void

gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device *adev  {
      uint32_t def, data;
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
-     adev->gfx.rlc.funcs->enter_safe_mode(adev);
+     gfx_v9_0_enter_rlc_safe_mode(adev);
 
      if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_CGCG)) {
              def = data = RREG32_SOC15(GC, 0,

mmRLC_CGTT_MGCG_OVERRIDE); @@ -3706,7 +3706,7 @@ static void gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device *adev

                      WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL,
data);
      }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
-     adev->gfx.rlc.funcs->exit_safe_mode(adev);
+     gfx_v9_0_exit_rlc_safe_mode(adev);
 }
Quoted 8 lines
Quoted 3 lines

static int gfx_v9_0_update_gfx_clock_gating(struct amdgpu_device *adev,
--
2.18.0

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): CADnq5_OkzpNCaGBNsB5uOCutr9+m6szm6O6QpmkoEvBSh7Ux5A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#41 lore raw

RE: [PATCH 08/10] drm/amdgpu: use the accessible target rlc safe mode Apis directly

Ok, I will drop this patch.

Regards,
Evan

Quoted 67 lines

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Wednesday, July 11, 2018 1:24 AM
To: Quan, Evan <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 08/10] drm/amdgpu: use the accessible target rlc safe mode Apis directly

Quoted 13 lines · Evan

Ping..

Quoted 11 lines

-----Original Message-----
From: Evan Quan [mailto:[email protected]]
Sent: Thursday, July 05, 2018 5:10 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 08/10] drm/amdgpu: use the accessible target rlc safe mode Apis directly

No need to do double dereference to reach the Apis. They are accessible directly.

One advantage of using the callback is that you may end up having different callbacks for different asics within the gfx9 family. I don't know if this will be the case or not. IIRC, there were differences between chips on older gfx versions.

Alex

Quoted 15 lines
Quoted 15 lines
Change-Id I4b810c5e1981e0810df36a701b20edaf1f6af207
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index cb7f2efa9882..9679bdc0ea2e 100644
@@ -3618,7 +3618,7 @@ static void
 gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,  {
      uint32_t data, def;
 
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
-     adev->gfx.rlc.funcs->enter_safe_mode(adev);
+     gfx_v9_0_enter_rlc_safe_mode(adev);
 
      /* Enable 3D CGCG/CGLS */
      if (enable && (adev->cg_flags &

AMD_CG_SUPPORT_GFX_3D_CGCG)) { @@ -3658,7 +3658,7 @@ static

void

Quoted 5 lines
Quoted 5 lines

gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev,

                      WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL_3D,
data);
      }
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
-     adev->gfx.rlc.funcs->exit_safe_mode(adev);
+     gfx_v9_0_exit_rlc_safe_mode(adev);
 }
 
 static void gfx_v9_0_update_coarse_grain_clock_gating(struct

amdgpu_device *adev, @@ -3666,7 +3666,7 @@ static void gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device

*adev {

Quoted 2 lines
Quoted 2 lines
      uint32_t def, data;
Quoted 25 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
-     adev->gfx.rlc.funcs->enter_safe_mode(adev);
+     gfx_v9_0_enter_rlc_safe_mode(adev);
 
      if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_CGCG)) {
              def = data = RREG32_SOC15(GC, 0,

mmRLC_CGTT_MGCG_OVERRIDE); @@ -3706,7 +3706,7 @@ static void gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device

*adev

Quoted 17 lines
Quoted 9 lines
                      WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL,
data);
      }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
-     adev->gfx.rlc.funcs->exit_safe_mode(adev);
+     gfx_v9_0_exit_rlc_safe_mode(adev);
 }
 
 static int gfx_v9_0_update_gfx_clock_gating(struct amdgpu_device
Quoted 3 lines

*adev,
--
2.18.0

_______________________________________________
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

author
#42 lore raw

PATCH 9/10 drm/amd/powerplay: add vega12 SMU gfxoff support

In reply to a message not in the archive

Export apis for enabling/disabling SMU gfxoff support.

Change-Id Idcea1db9f3dbe15edda1b76e1ff05435865af2a1
---
 .../drm/amd/powerplay/hwmgr/vega12_hwmgr.c    | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c +19 -0
index 57492878874f..8efa983c41de 100644
@@ -2329,6 +2329,24 @@ static int vega12_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
 	return 0;
 }
 
+static int vega12_enable_gfx_off(struct pp_hwmgr *hwmgr)
+{
+	return smum_send_msg_to_smc(hwmgr, PPSMC_MSG_AllowGfxOff);
+}
+
+static int vega12_disable_gfx_off(struct pp_hwmgr *hwmgr)
+{
+	return smum_send_msg_to_smc(hwmgr, PPSMC_MSG_DisallowGfxOff);
+}
+
+static int vega12_gfx_off_control(struct pp_hwmgr *hwmgr, bool enable)
+{
+	if (enable)
+		return vega12_enable_gfx_off(hwmgr);
+	else
+		return vega12_disable_gfx_off(hwmgr);
+}
+
 static const struct pp_hwmgr_func vega12_hwmgr_funcs = {
 	.backend_init = vega12_hwmgr_backend_init,
 	.backend_fini = vega12_hwmgr_backend_fini,
@@ -2378,6 +2396,7 @@ static const struct pp_hwmgr_func vega12_hwmgr_funcs = {
 	.get_thermal_temperature_range = vega12_get_thermal_temperature_range,
 	.register_irq_handlers = smu9_register_irq_handlers,
 	.start_thermal_controller = vega12_start_thermal_controller,
+	.gfx_off_control = vega12_gfx_off_control,
 };
 
 int vega12_hwmgr_init(struct pp_hwmgr *hwmgr)
Signature · 6 lines
2.18.0

_______________________________________________
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): [email protected]

Reviewed-by
#44 lore raw

Re: [PATCH 09/10] drm/amd/powerplay: add vega12 SMU gfxoff support

Quoted 4 lines · Evan Quan

Export apis for enabling/disabling SMU gfxoff support.

Change-Id Idcea1db9f3dbe15edda1b76e1ff05435865af2a1
Quoted 48 lines
---
 .../drm/amd/powerplay/hwmgr/vega12_hwmgr.c    | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c +19 -0
index 57492878874f..8efa983c41de 100644
@@ -2329,6 +2329,24 @@ static int vega12_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
 	return 0;
 }
 
+static int vega12_enable_gfx_off(struct pp_hwmgr *hwmgr)
+{
+	return smum_send_msg_to_smc(hwmgr, PPSMC_MSG_AllowGfxOff);
+}
+
+static int vega12_disable_gfx_off(struct pp_hwmgr *hwmgr)
+{
+	return smum_send_msg_to_smc(hwmgr, PPSMC_MSG_DisallowGfxOff);
+}
+
+static int vega12_gfx_off_control(struct pp_hwmgr *hwmgr, bool enable)
+{
+	if (enable)
+		return vega12_enable_gfx_off(hwmgr);
+	else
+		return vega12_disable_gfx_off(hwmgr);
+}
+
 static const struct pp_hwmgr_func vega12_hwmgr_funcs = {
 	.backend_init = vega12_hwmgr_backend_init,
 	.backend_fini = vega12_hwmgr_backend_fini,
@@ -2378,6 +2396,7 @@ static const struct pp_hwmgr_func vega12_hwmgr_funcs = {
 	.get_thermal_temperature_range = vega12_get_thermal_temperature_range,
 	.register_irq_handlers = smu9_register_irq_handlers,
 	.start_thermal_controller = vega12_start_thermal_controller,
+	.gfx_off_control = vega12_gfx_off_control,
 };
 
 int vega12_hwmgr_init(struct pp_hwmgr *hwmgr)
Signature · 6 lines
2.18.0

_______________________________________________
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

author
#45 lore raw

PATCH 10/10 drm/amd/powerplay: no need to mask workable gfxoff feature for vega12

In reply to a message not in the archive

Gfxoff feature for vega12 is workable. So, there is no need to mask it any more.

Change-Id I7e4d05c5c0acc2aa2b077eaaaf6f13589c87114b
---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +1 -1
index 9b675d9bd162..8994aa5c8cf8 100644
@@ -147,10 +147,10 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)
 		smu7_init_function_pointers(hwmgr);
 		break;
 	case AMDGPU_FAMILY_AI:
-		hwmgr->feature_mask &= ~PP_GFXOFF_MASK;
 		switch (hwmgr->chip_id) {
 		case CHIP_VEGA10:
 		case CHIP_VEGA20:
+			hwmgr->feature_mask &= ~PP_GFXOFF_MASK;
 			hwmgr->smumgr_funcs = &vega10_smu_funcs;
 			vega10_hwmgr_init(hwmgr);
 			break;
Signature · 6 lines
2.18.0

_______________________________________________
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): [email protected]

author
#47 lore raw

RE: [PATCH 10/10] drm/amd/powerplay: no need to mask workable gfxoff feature for vega12

Ping..

Quoted 35 lines

-----Original Message-----
From: Evan Quan [mailto:[email protected]]
Sent: Thursday, July 05, 2018 5:10 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 10/10] drm/amd/powerplay: no need to mask workable gfxoff feature for vega12

Gfxoff feature for vega12 is workable. So, there is no need to mask it any more.

Change-Id I7e4d05c5c0acc2aa2b077eaaaf6f13589c87114b
---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +1 -2
index 9b675d9bd162..8994aa5c8cf8 100644
@@ -147,10 +147,10 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)
 		smu7_init_function_pointers(hwmgr);
 		break;
 	case AMDGPU_FAMILY_AI:
-		hwmgr->feature_mask &= ~PP_GFXOFF_MASK;
 		switch (hwmgr->chip_id) {
 		case CHIP_VEGA10:
 		case CHIP_VEGA20:
+			hwmgr->feature_mask &= ~PP_GFXOFF_MASK;
 			hwmgr->smumgr_funcs = &vega10_smu_funcs;
 			vega10_hwmgr_init(hwmgr);
 			break;
--
Quoted 1 line

2.18.0

_______________________________________________
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): SN6PR12MB2656713C37BA977A41CB04CEE4440-kxOKjb6HO/FeL/[email protected]

Acked-by
#49 lore raw

Re: [PATCH 10/10] drm/amd/powerplay: no need to mask workable gfxoff feature for vega12

Quoted 15 lines · Evan

Ping..

Quoted 13 lines

-----Original Message-----
From: Evan Quan [mailto:[email protected]]
Sent: Thursday, July 05, 2018 5:10 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 10/10] drm/amd/powerplay: no need to mask workable gfxoff feature for vega12

Gfxoff feature for vega12 is workable. So, there is no need to mask it any more.

Change-Id I7e4d05c5c0acc2aa2b077eaaaf6f13589c87114b
Quoted 20 lines
Quoted 20 lines
---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +1 -1
index 9b675d9bd162..8994aa5c8cf8 100644
@@ -147,10 +147,10 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)
              smu7_init_function_pointers(hwmgr);
              break;
      case AMDGPU_FAMILY_AI:
-             hwmgr->feature_mask &= ~PP_GFXOFF_MASK;
              switch (hwmgr->chip_id) {
              case CHIP_VEGA10:
              case CHIP_VEGA20:
+                     hwmgr->feature_mask &= ~PP_GFXOFF_MASK;
                      hwmgr->smumgr_funcs = &vega10_smu_funcs;
                      vega10_hwmgr_init(hwmgr);
Quoted 8 lines
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +0 -1
                      break;
--

2.18.0

_______________________________________________
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

Reviewed-by
#50 lore raw
In reply to a message not in the archive
Quoted 6 lines · Evan Quan

Without this pin, the csb buffer will be filled with inconsistent data after S3 resume. And that will causes gfx hang on gfxoff exit since this csb will be executed then.

Change-Id I1ae1f2eed096eaba5f601cf2a3e2650c8e583dc9

It is nice to have the comments behind of csb_vram_pin function to explain why we need "pin" here during resume phase.

Quoted 83 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 40 +++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +40 -0
index ac46eabe3bcd..65cc30766658 100644
@@ -943,6 +943,7 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
 		dst_ptr = adev->gfx.rlc.cs_ptr;
 		gfx_v9_0_get_csb_buffer(adev, dst_ptr);
 		amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
+		amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
 		amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
 	}
 
@@ -971,6 +972,39 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
 	return 0;
 }
 
+static int gfx_v9_0_csb_vram_pin(struct amdgpu_device *adev)
+{
+	uint64_t gpu_addr;
+	int r;
+
+	r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
+	if (unlikely(r != 0))
+		return r;
+
+	r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
+			AMDGPU_GEM_DOMAIN_VRAM, &gpu_addr);
+	if (!r)
+		adev->gfx.rlc.clear_state_gpu_addr = gpu_addr;
+
+	amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
+
+	return r;
+}
+
+static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev)
+{
+	int r;
+
+	if (!adev->gfx.rlc.clear_state_obj)
+		return;
+
+	r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
+	if (likely(r == 0)) {
+		amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
+		amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
+	}
+}
+
 static void gfx_v9_0_mec_fini(struct amdgpu_device *adev)
 {
 	amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL);
@@ -3116,6 +3150,10 @@ static int gfx_v9_0_hw_init(void *handle)
 
 	gfx_v9_0_gpu_init(adev);
 
+	r = gfx_v9_0_csb_vram_pin(adev);
+	if (r)
+		return r;
+
 	r = gfx_v9_0_rlc_resume(adev);
 	if (r)
 		return r;
@@ -3224,6 +3262,8 @@ static int gfx_v9_0_hw_fini(void *handle)
 	gfx_v9_0_cp_enable(adev, false);
 	gfx_v9_0_rlc_stop(adev);
 
+	gfx_v9_0_csb_vram_unpin(adev);
+
 	return 0;
 }
 
Signature · 6 lines
2.18.0

_______________________________________________
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

#51 lore raw
Quoted 5 lines · Huang Rui
Quoted 4 lines · Evan Quan

Without this pin, the csb buffer will be filled with inconsistent data after S3 resume. And that will causes gfx hang on gfxoff exit since this csb will be executed then.

Quoted 7 lines
Quoted 2 lines
Change-Id I1ae1f2eed096eaba5f601cf2a3e2650c8e583dc9

It is nice to have the comments behind of csb_vram_pin function to explain why we need "pin" here during resume phase.

Do the save restore buffers in gfx7 and 8 need a similar fix?

Alex

Quoted 80 lines
Quoted 80 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 40 +++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +40 -1
index ac46eabe3bcd..65cc30766658 100644
@@ -943,6 +943,7 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
              dst_ptr = adev->gfx.rlc.cs_ptr;
              gfx_v9_0_get_csb_buffer(adev, dst_ptr);
              amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
+             amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
              amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
      }
 
@@ -971,6 +972,39 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
      return 0;
 }
 
+static int gfx_v9_0_csb_vram_pin(struct amdgpu_device *adev)
+{
+     uint64_t gpu_addr;
+     int r;
+
+     r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
+     if (unlikely(r != 0))
+             return r;
+
+     r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
+                     AMDGPU_GEM_DOMAIN_VRAM, &gpu_addr);
+     if (!r)
+             adev->gfx.rlc.clear_state_gpu_addr = gpu_addr;
+
+     amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
+
+     return r;
+}
+
+static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev)
+{
+     int r;
+
+     if (!adev->gfx.rlc.clear_state_obj)
+             return;
+
+     r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
+     if (likely(r == 0)) {
+             amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
+             amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
+     }
+}
+
 static void gfx_v9_0_mec_fini(struct amdgpu_device *adev)
 {
      amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL);
@@ -3116,6 +3150,10 @@ static int gfx_v9_0_hw_init(void *handle)
 
      gfx_v9_0_gpu_init(adev);
 
+     r = gfx_v9_0_csb_vram_pin(adev);
+     if (r)
+             return r;
+
      r = gfx_v9_0_rlc_resume(adev);
      if (r)
              return r;
@@ -3224,6 +3262,8 @@ static int gfx_v9_0_hw_fini(void *handle)
      gfx_v9_0_cp_enable(adev, false);
      gfx_v9_0_rlc_stop(adev);
 
+     gfx_v9_0_csb_vram_unpin(adev);
+
      return 0;
 }
 
--

2.18.0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
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

_______________________________________________
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): CADnq5_ObbDpsjt1-gC5oOJLe-89jU2L1VBs4sOr1-4tgq8n=3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#53 lore raw

Comment inline

Quoted 17 lines

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Thursday, July 05, 2018 11:25 PM
To: Huang, Ray <[email protected]>
Cc: Quan, Evan <[email protected]>; amd-gfx list <amd- [email protected]>
Subject: Re: [PATCH 01/10] drm/amdgpu: pin the csb buffer on hw init

Quoted 8 lines · Huang Rui
Quoted 6 lines · Evan Quan

Without this pin, the csb buffer will be filled with inconsistent data after S3 resume. And that will causes gfx hang on gfxoff exit since this csb will be executed then.

Change-Id I1ae1f2eed096eaba5f601cf2a3e2650c8e583dc9
Quoted 8 lines
Quoted 4 lines

It is nice to have the comments behind of csb_vram_pin function to explain why we need "pin" here during resume phase.

Do the save restore buffers in gfx7 and 8 need a similar fix?

Alex

It seems so. Test on polaris11, the csb is corrupt after resume from S3. I will send another patch to fix them.

Quoted 20 lines
Quoted 6 lines
Quoted 6 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 40
+++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_rlc_init(struct amdgpu_device

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index ac46eabe3bcd..65cc30766658 100644
@@ -943,6 +943,7 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device

*adev)

Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -0
              dst_ptr = adev->gfx.rlc.cs_ptr;
              gfx_v9_0_get_csb_buffer(adev, dst_ptr);
              amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
+             amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
              amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
      }
 
Quoted 69 lines
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_rlc_init(struct amdgpu_device

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
@@ -971,6 +972,39 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device

*adev)

Quoted 67 lines
Quoted 59 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +37 -1
      return 0;
 }
 
+static int gfx_v9_0_csb_vram_pin(struct amdgpu_device *adev) {
+     uint64_t gpu_addr;
+     int r;
+
+     r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
+     if (unlikely(r != 0))
+             return r;
+
+     r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
+                     AMDGPU_GEM_DOMAIN_VRAM, &gpu_addr);
+     if (!r)
+             adev->gfx.rlc.clear_state_gpu_addr = gpu_addr;
+
+     amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
+
+     return r;
+}
+
+static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev) {
+     int r;
+
+     if (!adev->gfx.rlc.clear_state_obj)
+             return;
+
+     r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
+     if (likely(r == 0)) {
+             amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
+             amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
+     }
+}
+
 static void gfx_v9_0_mec_fini(struct amdgpu_device *adev)  {
      amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL);
@@ -3116,6 +3150,10 @@ static int gfx_v9_0_hw_init(void *handle)
 
      gfx_v9_0_gpu_init(adev);
 
+     r = gfx_v9_0_csb_vram_pin(adev);
+     if (r)
+             return r;
+
      r = gfx_v9_0_rlc_resume(adev);
      if (r)
              return r;
@@ -3224,6 +3262,8 @@ static int gfx_v9_0_hw_fini(void *handle)
      gfx_v9_0_cp_enable(adev, false);
      gfx_v9_0_rlc_stop(adev);
 
+     gfx_v9_0_csb_vram_unpin(adev);
+
      return 0;
 }
 
--

2.18.0

Quoted 4 lines

_______________________________________________
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

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