Skip to contentSkip to conversation

drm/amdgpu: remove mdelay in psp v12

PATCH In review Huang Rui 2 participants 3 messages Apr 22, 2025 – May 7, 2025

Subsystems (2)
lore
Share & tools
lore

Huang Rui

author
#0 lore raw

PATCH 1/1 drm/amdgpu: remove mdelay in psp v12

Since secure firmware is more stable than bring up phase, I believe we don't need such mdelays any more before wait PSP response on PSP v12.

---
 drivers/gpu/drm/amd/amdgpu/psp_v12_0.c | 16 ----------------
 1 file changed, 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -16
index fcd708eae75c..6331941440d9 100644
@@ -99,9 +99,6 @@ static int psp_v12_0_bootloader_load_sysdrv(struct psp_context *psp)
 	WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35,
 	       psp_gfxdrv_command_reg);
 
-	/* there might be handshake issue with hardware which needs delay */
-	mdelay(20);
-
 	ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35),
 			   0x80000000, 0x80000000, false);
 
@@ -138,8 +135,6 @@ static int psp_v12_0_bootloader_load_sos(struct psp_context *psp)
 	WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35,
 	       psp_gfxdrv_command_reg);
 
-	/* there might be handshake issue with hardware which needs delay */
-	mdelay(20);
 	ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_81),
 			   RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81),
 			   0, true);
@@ -161,7 +156,6 @@ static void psp_v12_0_reroute_ih(struct psp_context *psp)
 	WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_70, tmp);
 	WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, GFX_CTRL_CMD_ID_GBR_IH_SET);
 
-	mdelay(20);
 	psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
 		     0x80000000, 0x8000FFFF, false);
 
@@ -173,7 +167,6 @@ static void psp_v12_0_reroute_ih(struct psp_context *psp)
 	WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_70, tmp);
 	WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, GFX_CTRL_CMD_ID_GBR_IH_SET);
 
-	mdelay(20);
 	psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
 		     0x80000000, 0x8000FFFF, false);
 }
@@ -200,9 +193,6 @@ static int psp_v12_0_ring_create(struct psp_context *psp,
 		WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
 					     GFX_CTRL_CMD_ID_INIT_GPCOM_RING);
 
-		/* there might be handshake issue with hardware which needs delay */
-		mdelay(20);
-
 		/* Wait for response flag (bit 31) in C2PMSG_101 */
 		ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
 				   0x80000000, 0x8000FFFF, false);
@@ -222,9 +212,6 @@ static int psp_v12_0_ring_create(struct psp_context *psp,
 		psp_ring_reg = psp_ring_reg << 16;
 		WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, psp_ring_reg);
 
-		/* there might be handshake issue with hardware which needs delay */
-		mdelay(20);
-
 		/* Wait for response flag (bit 31) in C2PMSG_64 */
 		ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
 				   0x80000000, 0x8000FFFF, false);
@@ -247,9 +234,6 @@ static int psp_v12_0_ring_stop(struct psp_context *psp,
 		WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64,
 				     GFX_CTRL_CMD_ID_DESTROY_RINGS);
 
-	/* there might be handshake issue with hardware which needs delay */
-	mdelay(20);
-
 	/* Wait for response flag (bit 31) */
 	if (amdgpu_sriov_vf(adev))
 		ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
Signature · 1 line
2.25.1
author
#1 lore raw

Soft ping~

Quoted 80 lines · Huang Rui

Since secure firmware is more stable than bring up phase, I believe we don't need such mdelays any more before wait PSP response on PSP v12.

---
 drivers/gpu/drm/amd/amdgpu/psp_v12_0.c | 16 ----------------
 1 file changed, 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -16
index fcd708eae75c..6331941440d9 100644
@@ -99,9 +99,6 @@ static int psp_v12_0_bootloader_load_sysdrv(struct psp_context *psp)
 	WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35,
 	       psp_gfxdrv_command_reg);
 
-	/* there might be handshake issue with hardware which needs delay */
-	mdelay(20);
-
 	ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35),
 			   0x80000000, 0x80000000, false);
 
@@ -138,8 +135,6 @@ static int psp_v12_0_bootloader_load_sos(struct psp_context *psp)
 	WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35,
 	       psp_gfxdrv_command_reg);
 
-	/* there might be handshake issue with hardware which needs delay */
-	mdelay(20);
 	ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_81),
 			   RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81),
 			   0, true);
@@ -161,7 +156,6 @@ static void psp_v12_0_reroute_ih(struct psp_context *psp)
 	WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_70, tmp);
 	WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, GFX_CTRL_CMD_ID_GBR_IH_SET);
 
-	mdelay(20);
 	psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
 		     0x80000000, 0x8000FFFF, false);
 
@@ -173,7 +167,6 @@ static void psp_v12_0_reroute_ih(struct psp_context *psp)
 	WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_70, tmp);
 	WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, GFX_CTRL_CMD_ID_GBR_IH_SET);
 
-	mdelay(20);
 	psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
 		     0x80000000, 0x8000FFFF, false);
 }
@@ -200,9 +193,6 @@ static int psp_v12_0_ring_create(struct psp_context *psp,
 		WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
 					     GFX_CTRL_CMD_ID_INIT_GPCOM_RING);
 
-		/* there might be handshake issue with hardware which needs delay */
-		mdelay(20);
-
 		/* Wait for response flag (bit 31) in C2PMSG_101 */
 		ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
 				   0x80000000, 0x8000FFFF, false);
@@ -222,9 +212,6 @@ static int psp_v12_0_ring_create(struct psp_context *psp,
 		psp_ring_reg = psp_ring_reg << 16;
 		WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, psp_ring_reg);
 
-		/* there might be handshake issue with hardware which needs delay */
-		mdelay(20);
-
 		/* Wait for response flag (bit 31) in C2PMSG_64 */
 		ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
 				   0x80000000, 0x8000FFFF, false);
@@ -247,9 +234,6 @@ static int psp_v12_0_ring_stop(struct psp_context *psp,
 		WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64,
 				     GFX_CTRL_CMD_ID_DESTROY_RINGS);
 
-	/* there might be handshake issue with hardware which needs delay */
-	mdelay(20);
-
 	/* Wait for response flag (bit 31) */
 	if (amdgpu_sriov_vf(adev))
 		ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
Signature · 1 line
2.25.1
Reviewed-by
#2 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Quoted 9 lines

-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Tuesday, April 29, 2025 9:46 PM
To: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Huang, Trigger <[email protected]>; Zhu, Lingshan <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: remove mdelay in psp v12

Quoted 7 lines

Soft ping~

Quoted 4 lines · Huang Rui

Since secure firmware is more stable than bring up phase, I believe we don't need such mdelays any more before wait PSP response on PSP v12.

Quoted 96 lines

drivers/gpu/drm/amd/amdgpu/psp_v12_0.c static int psp_v12_0_bootloader_load_sysdrv(struct

Quoted 10 lines
---
 drivers/gpu/drm/amd/amdgpu/psp_v12_0.c | 16 ----------------
 1 file changed, 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -0
index fcd708eae75c..6331941440d9 100644
@@ -99,9 +99,6 @@ static int psp_v12_0_bootloader_load_sysdrv(struct

psp_context *psp)

drivers/gpu/drm/amd/amdgpu/psp_v12_0.c static int psp_v12_0_bootloader_load_sysdrv(struct psp_context *psp)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -3
    WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35,
           psp_gfxdrv_command_reg);
 
-   /* there might be handshake issue with hardware which needs delay */
-   mdelay(20);
-
    ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0,

mmMP0_SMN_C2PMSG_35),

drivers/gpu/drm/amd/amdgpu/psp_v12_0.c static int psp_v12_0_bootloader_load_sos(struct

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -0
                       0x80000000, 0x80000000, false);
 
@@ -138,8 +135,6 @@ static int psp_v12_0_bootloader_load_sos(struct

psp_context *psp)

drivers/gpu/drm/amd/amdgpu/psp_v12_0.c static int psp_v12_0_bootloader_load_sysdrv(struct psp_context *psp)

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -2
    WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35,
           psp_gfxdrv_command_reg);
 
-   /* there might be handshake issue with hardware which needs delay */
-   mdelay(20);
    ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0,

mmMP0_SMN_C2PMSG_81),

drivers/gpu/drm/amd/amdgpu/psp_v12_0.c static void psp_v12_0_reroute_ih(struct psp_context

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -0
                       RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81),
                       0, true);
@@ -161,7 +156,6 @@ static void psp_v12_0_reroute_ih(struct psp_context

*psp)

drivers/gpu/drm/amd/amdgpu/psp_v12_0.c static int psp_v12_0_ring_stop(struct psp_context *psp,

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -1
    WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_70, tmp);
    WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64,
 GFX_CTRL_CMD_ID_GBR_IH_SET);
 
-   mdelay(20);
    psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0,

mmMP0_SMN_C2PMSG_64),

drivers/gpu/drm/amd/amdgpu/psp_v12_0.c static void psp_v12_0_reroute_ih(struct psp_context

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -0
                 0x80000000, 0x8000FFFF, false);
@@ -173,7 +167,6 @@ static void psp_v12_0_reroute_ih(struct psp_context

*psp)

drivers/gpu/drm/amd/amdgpu/psp_v12_0.c static int psp_v12_0_ring_stop(struct psp_context *psp,

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -1
    WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_70, tmp);
    WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64,
 GFX_CTRL_CMD_ID_GBR_IH_SET);
 
-   mdelay(20);
    psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0,

mmMP0_SMN_C2PMSG_64),

drivers/gpu/drm/amd/amdgpu/psp_v12_0.c static void psp_v12_0_reroute_ih(struct psp_context · line 172

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -0
                 0x80000000, 0x8000FFFF, false);  } @@ -200,9 +193,6 @@

static

Quoted 3 lines

int psp_v12_0_ring_create(struct psp_context *psp,

            WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,

GFX_CTRL_CMD_ID_INIT_GPCOM_RING);

Quoted 2 lines

- /* there might be handshake issue with hardware which needs delay

*/

drivers/gpu/drm/amd/amdgpu/psp_v12_0.c static int psp_v12_0_ring_create(struct psp_context *psp,

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -2
-           mdelay(20);
-
            /* Wait for response flag (bit 31) in C2PMSG_101 */
            ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0,

mmMP0_SMN_C2PMSG_101),

Quoted 1 line
                               0x80000000, 0x8000FFFF, false); @@ -222,9

+212,6 @@ static int

Quoted 3 lines

psp_v12_0_ring_create(struct psp_context *psp,

            psp_ring_reg = psp_ring_reg << 16;
            WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64,

psp_ring_reg);

Quoted 2 lines

- /* there might be handshake issue with hardware which needs delay

*/

drivers/gpu/drm/amd/amdgpu/psp_v12_0.c static int psp_v12_0_ring_create(struct psp_context *psp,

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -2
-           mdelay(20);
-
            /* Wait for response flag (bit 31) in C2PMSG_64 */
            ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0,

mmMP0_SMN_C2PMSG_64),

Quoted 1 line
                               0x80000000, 0x8000FFFF, false); @@ -247,9

+234,6 @@ static int

Quoted 14 lines

psp_v12_0_ring_stop(struct psp_context *psp,

            WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64,
                                 GFX_CTRL_CMD_ID_DESTROY_RINGS);
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c +0 -3
-   /* there might be handshake issue with hardware which needs delay */
-   mdelay(20);
-
    /* Wait for response flag (bit 31) */
    if (amdgpu_sriov_vf(adev))
            ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0,

mmMP0_SMN_C2PMSG_101),
--
2.25.1