Skip to contentSkip to conversation

drm/amdgpu: remove unpin clear_state_obj for gfx v8

PATCH In review likun Gao 3 participants 5 messages Aug 2, 2019 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

likun Gao

author
#0 lore raw

PATCH 1/1 drm/amdgpu: remove unpin clear_state_obj for gfx v8

From: Likun Gao <[email protected]>

Remove unpin rlc clear_state_obj for gfx v8 when rlc init, which will make Stoney pm_suspend hang.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +19 -3
index d290718..0b73c6e 100644
@@ -1292,6 +1292,8 @@ static int gfx_v8_0_cp_jump_table_num(struct amdgpu_device *adev)
 
 static int gfx_v8_0_rlc_init(struct amdgpu_device *adev)
 {
+	volatile u32 *dst_ptr;
+	u32 dws;
 	const struct cs_section_def *cs_data;
 	int r;
 
@@ -1300,10 +1302,24 @@ static int gfx_v8_0_rlc_init(struct amdgpu_device *adev)
 	cs_data = adev->gfx.rlc.cs_data;
 
 	if (cs_data) {
-		/* init clear state block */
-		r = amdgpu_gfx_rlc_init_csb(adev);
-		if (r)
+		/* clear state block */
+		adev->gfx.rlc.clear_state_size = dws = adev->gfx.rlc.funcs->get_csb_size(adev);
+		r = amdgpu_bo_create_reserved(adev, dws * 4, PAGE_SIZE,
+					      AMDGPU_GEM_DOMAIN_VRAM,
+					      &adev->gfx.rlc.clear_state_obj,
+					      &adev->gfx.rlc.clear_state_gpu_addr,
+					      (void **)&adev->gfx.rlc.cs_ptr);
+		if (r) {
+			dev_warn(adev->dev, "(%d) create RLC c bo failed\n", r);
+			amdgpu_gfx_rlc_fini(adev);
 			return r;
+		}
+
+		/* set up the cs buffer */
+		dst_ptr = adev->gfx.rlc.cs_ptr;
+		adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
+		amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
+		amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
 	}
 
 	if ((adev->asic_type == CHIP_CARRIZO) ||
Signature · 6 lines
2.7.4

_______________________________________________
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): 1564723334-18375-1-git-send-email-likun.gao-5C7GfCeVMHo@public.gmane.org

Reviewed-by Huang Rui
#2 lore raw

Hi Likun,

Looks like you can pin csb buffer @gfx_v8_0_hw_init() just like what following patch does for gfx9, so that we can still use the common function amdgpu_gfx_rlc_init_csb():

commit 137dc4b9060e99a22dce59b42ca71912cf0180f3

Author: Evan Quan <[email protected]>
Date:   Wed Jul 4 16:21:52 2018 +0800

drm/amdgpu: pin the csb buffer on hw init v2

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.

v2: fit amdgpu_bo_pin change(take one less argument)

BR,
Xiaojie

________________________________________
From: amd-gfx <[email protected]> on behalf of likun Gao <[email protected]>
Sent: Friday, August 2, 2019 1:22 PM
To: [email protected]
Cc: Deucher, Alexander; Gao, Likun; Paul Gover
Subject: [PATCH] drm/amdgpu: remove unpin clear_state_obj for gfx v8

From: Likun Gao <[email protected]>

Remove unpin rlc clear_state_obj for gfx v8 when rlc init, which will make Stoney pm_suspend hang.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +19 -3
index d290718..0b73c6e 100644
@@ -1292,6 +1292,8 @@ static int gfx_v8_0_cp_jump_table_num(struct amdgpu_device *adev)
 
 static int gfx_v8_0_rlc_init(struct amdgpu_device *adev)
 {
+       volatile u32 *dst_ptr;
+       u32 dws;
        const struct cs_section_def *cs_data;
        int r;
 
@@ -1300,10 +1302,24 @@ static int gfx_v8_0_rlc_init(struct amdgpu_device *adev)
        cs_data = adev->gfx.rlc.cs_data;
 
        if (cs_data) {
-               /* init clear state block */
-               r = amdgpu_gfx_rlc_init_csb(adev);
-               if (r)
+               /* clear state block */
+               adev->gfx.rlc.clear_state_size = dws = adev->gfx.rlc.funcs->get_csb_size(adev);
+               r = amdgpu_bo_create_reserved(adev, dws * 4, PAGE_SIZE,
+                                             AMDGPU_GEM_DOMAIN_VRAM,
+                                             &adev->gfx.rlc.clear_state_obj,
+                                             &adev->gfx.rlc.clear_state_gpu_addr,
+                                             (void **)&adev->gfx.rlc.cs_ptr);
+               if (r) {
+                       dev_warn(adev->dev, "(%d) create RLC c bo failed\n", r);
+                       amdgpu_gfx_rlc_fini(adev);
                        return r;
+               }
+
+               /* set up the cs buffer */
+               dst_ptr = adev->gfx.rlc.cs_ptr;
+               adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
+               amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
+               amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
        }
 
        if ((adev->asic_type == CHIP_CARRIZO) ||

--
2.7.4

_______________________________________________
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): BN8PR12MB3602D2293EFA72B3A3545EE389D90-h6+T2+wrnx1lGJ5xs4l7kQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author Reviewed-by Huang Rui
#4 lore raw

OK, thanks, will try to fix with that method.

Regards,
Likun

-----Original Message-----
From: Yuan, Xiaojie <[email protected]>
Sent: Friday, August 2, 2019 2:12 PM
To: Gao, Likun <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Paul Gover <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: remove unpin clear_state_obj for gfx v8

Hi Likun,

Looks like you can pin csb buffer @gfx_v8_0_hw_init() just like what following patch does for gfx9, so that we can still use the common function amdgpu_gfx_rlc_init_csb():

commit 137dc4b9060e99a22dce59b42ca71912cf0180f3

Author: Evan Quan <[email protected]>
Date:   Wed Jul 4 16:21:52 2018 +0800

drm/amdgpu: pin the csb buffer on hw init v2

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.

v2: fit amdgpu_bo_pin change(take one less argument)

BR,
Xiaojie

________________________________________
From: amd-gfx <[email protected]> on behalf of likun Gao <[email protected]>
Sent: Friday, August 2, 2019 1:22 PM
To: [email protected]
Cc: Deucher, Alexander; Gao, Likun; Paul Gover
Subject: [PATCH] drm/amdgpu: remove unpin clear_state_obj for gfx v8

From: Likun Gao <[email protected]>

Remove unpin rlc clear_state_obj for gfx v8 when rlc init, which will make Stoney pm_suspend hang.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +19 -3
index d290718..0b73c6e 100644
@@ -1292,6 +1292,8 @@ static int gfx_v8_0_cp_jump_table_num(struct amdgpu_device *adev)
 
 static int gfx_v8_0_rlc_init(struct amdgpu_device *adev)  {
+       volatile u32 *dst_ptr;
+       u32 dws;
        const struct cs_section_def *cs_data;
        int r;
 
@@ -1300,10 +1302,24 @@ static int gfx_v8_0_rlc_init(struct amdgpu_device *adev)
        cs_data = adev->gfx.rlc.cs_data;
 
        if (cs_data) {
-               /* init clear state block */
-               r = amdgpu_gfx_rlc_init_csb(adev);
-               if (r)
+               /* clear state block */
+               adev->gfx.rlc.clear_state_size = dws = adev->gfx.rlc.funcs->get_csb_size(adev);
+               r = amdgpu_bo_create_reserved(adev, dws * 4, PAGE_SIZE,
+                                             AMDGPU_GEM_DOMAIN_VRAM,
+                                             &adev->gfx.rlc.clear_state_obj,
+                                             &adev->gfx.rlc.clear_state_gpu_addr,
+                                             (void **)&adev->gfx.rlc.cs_ptr);
+               if (r) {
+                       dev_warn(adev->dev, "(%d) create RLC c bo failed\n", r);
+                       amdgpu_gfx_rlc_fini(adev);
                        return r;
+               }
+
+               /* set up the cs buffer */
+               dst_ptr = adev->gfx.rlc.cs_ptr;
+               adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
+               amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
+               amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
        }
 
        if ((adev->asic_type == CHIP_CARRIZO) ||

--
2.7.4

_______________________________________________
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

#5 lore raw
In reply to a message not in the archive

Is the issue triggered on APU?

Actually, while we do S3, the vram bo won't be cleared on APU. This patch is to fix the vram bo clearing on the DGPU side.

Thanks,
Ray

Quoted 99 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Yuan, Xiaojie
Sent: Friday, August 02, 2019 2:12 PM
To: Gao, Likun <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Paul Gover <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: remove unpin clear_state_obj for gfx v8

Hi Likun,

Looks like you can pin csb buffer @gfx_v8_0_hw_init() just like what following patch does for gfx9, so that we can still use the common function amdgpu_gfx_rlc_init_csb():

commit 137dc4b9060e99a22dce59b42ca71912cf0180f3

Author: Evan Quan <[email protected]>
Date:   Wed Jul 4 16:21:52 2018 +0800

drm/amdgpu: pin the csb buffer on hw init v2

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.

v2: fit amdgpu_bo_pin change(take one less argument)

BR,
Xiaojie

________________________________________
From: amd-gfx <[email protected]> on behalf of likun Gao <[email protected]>
Sent: Friday, August 2, 2019 1:22 PM
To: [email protected]
Cc: Deucher, Alexander; Gao, Likun; Paul Gover
Subject: [PATCH] drm/amdgpu: remove unpin clear_state_obj for gfx v8

From: Likun Gao <[email protected]>

Remove unpin rlc clear_state_obj for gfx v8 when rlc init, which will make Stoney pm_suspend hang.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +19 -3
index d290718..0b73c6e 100644
@@ -1292,6 +1292,8 @@ static int gfx_v8_0_cp_jump_table_num(struct
 amdgpu_device *adev)
 
 static int gfx_v8_0_rlc_init(struct amdgpu_device *adev)  {
+       volatile u32 *dst_ptr;
+       u32 dws;
        const struct cs_section_def *cs_data;
        int r;
 
@@ -1300,10 +1302,24 @@ static int gfx_v8_0_rlc_init(struct amdgpu_device
 *adev)
        cs_data = adev->gfx.rlc.cs_data;
 
        if (cs_data) {
-               /* init clear state block */
-               r = amdgpu_gfx_rlc_init_csb(adev);
-               if (r)
+               /* clear state block */
+               adev->gfx.rlc.clear_state_size = dws = adev->gfx.rlc.funcs-
 >get_csb_size(adev);
+               r = amdgpu_bo_create_reserved(adev, dws * 4, PAGE_SIZE,
+                                             AMDGPU_GEM_DOMAIN_VRAM,
+                                             &adev->gfx.rlc.clear_state_obj,
+                                             &adev->gfx.rlc.clear_state_gpu_addr,
+                                             (void **)&adev->gfx.rlc.cs_ptr);
+               if (r) {
+                       dev_warn(adev->dev, "(%d) create RLC c bo failed\n", r);
+                       amdgpu_gfx_rlc_fini(adev);
                        return r;
+               }
+
+               /* set up the cs buffer */
+               dst_ptr = adev->gfx.rlc.cs_ptr;
+               adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
+               amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
+               amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
        }
        if ((adev->asic_type == CHIP_CARRIZO) ||

--
2.7.4

Quoted 8 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): MN2PR12MB3309BB83CBB215AA393EDEF7ECD90-rweVpJHSKTpWdvXm18W95QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author
#7 lore raw

This issue occurred on Stoney.

Regards,
Likun

-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, August 2, 2019 5:36 PM
To: Yuan, Xiaojie <[email protected]>; Gao, Likun <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Paul Gover <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: remove unpin clear_state_obj for gfx v8

Is the issue triggered on APU?

Actually, while we do S3, the vram bo won't be cleared on APU. This patch is to fix the vram bo clearing on the DGPU side.

Thanks,
Ray

Quoted 103 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Yuan, Xiaojie
Sent: Friday, August 02, 2019 2:12 PM
To: Gao, Likun <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Paul Gover <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: remove unpin clear_state_obj for gfx v8

Hi Likun,

Looks like you can pin csb buffer @gfx_v8_0_hw_init() just like what following patch does for gfx9, so that we can still use the common function
amdgpu_gfx_rlc_init_csb():

commit 137dc4b9060e99a22dce59b42ca71912cf0180f3

Author: Evan Quan <[email protected]>
Date:   Wed Jul 4 16:21:52 2018 +0800

drm/amdgpu: pin the csb buffer on hw init v2

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.

v2: fit amdgpu_bo_pin change(take one less argument)

BR,
Xiaojie

________________________________________
From: amd-gfx <[email protected]> on behalf of likun Gao <[email protected]>
Sent: Friday, August 2, 2019 1:22 PM
To: [email protected]
Cc: Deucher, Alexander; Gao, Likun; Paul Gover
Subject: [PATCH] drm/amdgpu: remove unpin clear_state_obj for gfx v8

From: Likun Gao <[email protected]>

Remove unpin rlc clear_state_obj for gfx v8 when rlc init, which will make Stoney pm_suspend hang.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
index d290718..0b73c6e 100644
@@ -1292,6 +1292,8 @@ static int gfx_v8_0_cp_jump_table_num(struct 
 amdgpu_device *adev)
 
 static int gfx_v8_0_rlc_init(struct amdgpu_device *adev)  {
+       volatile u32 *dst_ptr;
+       u32 dws;
        const struct cs_section_def *cs_data;
        int r;
 
@@ -1300,10 +1302,24 @@ static int gfx_v8_0_rlc_init(struct 

amdgpu_device
*adev)

        cs_data = adev->gfx.rlc.cs_data;

        if (cs_data) {
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -3
-               /* init clear state block */
-               r = amdgpu_gfx_rlc_init_csb(adev);
-               if (r)
+               /* clear state block */
+               adev->gfx.rlc.clear_state_size = dws = 
+ adev->gfx.rlc.funcs-
Quoted 1 line

get_csb_size(adev);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +15 -1
+               r = amdgpu_bo_create_reserved(adev, dws * 4, PAGE_SIZE,
+                                             AMDGPU_GEM_DOMAIN_VRAM,
+                                             &adev->gfx.rlc.clear_state_obj,
+                                             &adev->gfx.rlc.clear_state_gpu_addr,
+                                             (void **)&adev->gfx.rlc.cs_ptr);
+               if (r) {
+                       dev_warn(adev->dev, "(%d) create RLC c bo failed\n", r);
+                       amdgpu_gfx_rlc_fini(adev);
                        return r;
+               }
+
+               /* set up the cs buffer */
+               dst_ptr = adev->gfx.rlc.cs_ptr;
+               adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
+               amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
+               amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
        }
 
        if ((adev->asic_type == CHIP_CARRIZO) ||
--

2.7.4

Quoted 8 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