drm/amdgpu/sriov: add ring_stop before ring_create in psp v11 code
Subsystems (2)
PATCH 1/1 drm/amdgpu/sriov: add ring_stop before ring_create in psp v11 code
psp v11 code missed ring stop in ring create function(VMR) while psp v3.1 code had the code. This will cause VM destroy1 fail and psp ring create fail.
For SIOV-VF, ring_stop should not be deleted in ring_create function.
--- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 61 +++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +34 -27
@@ -397,6 +397,34 @@ static bool psp_v11_0_support_vmr_ring(struct psp_context *psp)return false; } +static int psp_v11_0_ring_stop (struct psp_context *psp, +enum psp_ring_type ring_type) +{ +int ret =0 ; +struct amdgpu_device *adev = psp->adev; + +/* Write the ring destroy command*/ +if (psp_v11_0_support_vmr_ring (psp)) +WREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_101, +GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING ); +else +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 (psp_v11_0_support_vmr_ring (psp)) + ret =psp_wait_for (psp,SOC15_REG_OFFSET (MP0 ,0 , mmMP0_SMN_C2PMSG_101), +0x80000000 ,0x80000000 , false); +else + ret =psp_wait_for (psp,SOC15_REG_OFFSET (MP0 ,0 , mmMP0_SMN_C2PMSG_64), +0x80000000 ,0x80000000 , false); + +return ret; +} +static int psp_v11_0_ring_create (struct psp_context *psp,enum psp_ring_type ring_type) {
@@ -406,6 +434,12 @@ static int psp_v11_0_ring_create(struct psp_context *psp,struct amdgpu_device *adev = psp->adev;if (psp_v11_0_support_vmr_ring (psp)) { + ret =psp_v11_0_ring_stop (psp, ring_type); +if (ret) { +DRM_ERROR ("psp_v11_0_ring_stop_sriov failed!\n" ); +return ret; + } +/* Write low address of the ring to C2PMSG_102 */ psp_ring_reg =lower_32_bits (ring->ring_mem_mc_addr);WREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_102, psp_ring_reg);
@@ -450,33 +484,6 @@ static int psp_v11_0_ring_create(struct psp_context *psp,return ret; } -static int psp_v11_0_ring_stop (struct psp_context *psp, -enum psp_ring_type ring_type) -{ -int ret =0 ; -struct amdgpu_device *adev = psp->adev; - -/* Write the ring destroy command*/ -if (psp_v11_0_support_vmr_ring (psp)) -WREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_101, -GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING ); -else -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 (psp_v11_0_support_vmr_ring (psp)) - ret =psp_wait_for (psp,SOC15_REG_OFFSET (MP0 ,0 , mmMP0_SMN_C2PMSG_101), -0x80000000 ,0x80000000 , false); -else - ret =psp_wait_for (psp,SOC15_REG_OFFSET (MP0 ,0 , mmMP0_SMN_C2PMSG_64), -0x80000000 ,0x80000000 , false); - -return ret; -}static int psp_v11_0_ring_destroy (struct psp_context *psp,enum psp_ring_type ring_type)
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): [email protected]
ping
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jack Zhang
Sent: Tuesday, September 10, 2019 4:09 PM
To: [email protected]
Cc: Zhang, Jack (Jian) <[email protected]>
Subject: [PATCH] drm/amdgpu/sriov: add ring_stop before ring_create in psp v11 code
psp v11 code missed ring stop in ring create function(VMR) while psp v3.1 code had the code. This will cause VM destroy1 fail and psp ring create fail.
For SIOV-VF, ring_stop should not be deleted in ring_create function.
--- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 61 +++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +34 -0
@@ -397,6 +397,34 @@ static bool psp_v11_0_support_vmr_ring(struct psp_context *psp)return false; } +static int psp_v11_0_ring_stop (struct psp_context *psp, +enum psp_ring_type ring_type) +{ +int ret =0 ; +struct amdgpu_device *adev = psp->adev; + +/* Write the ring destroy command*/ +if (psp_v11_0_support_vmr_ring (psp)) +WREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_101, +GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING ); +else +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 (psp_v11_0_support_vmr_ring (psp)) + ret =psp_wait_for (psp,SOC15_REG_OFFSET (MP0 ,0 , mmMP0_SMN_C2PMSG_101), +0x80000000 ,0x80000000 , false); +else + ret =psp_wait_for (psp,SOC15_REG_OFFSET (MP0 ,0 , mmMP0_SMN_C2PMSG_64), +0x80000000 ,0x80000000 , false); + +return ret; +} +static int psp_v11_0_ring_create (struct psp_context *psp,enum psp_ring_type ring_type) {
@@ -406,6 +434,12 @@ static int psp_v11_0_ring_create(struct psp_context *psp,struct amdgpu_device *adev = psp->adev;if (psp_v11_0_support_vmr_ring (psp)) { + ret =psp_v11_0_ring_stop (psp, ring_type); +if (ret) { +DRM_ERROR ("psp_v11_0_ring_stop_sriov failed!\n" ); +return ret; + } +/* Write low address of the ring to C2PMSG_102 */ psp_ring_reg =lower_32_bits (ring->ring_mem_mc_addr); WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, psp_ring_reg); @@ -450,33 +484,6 @@ static int psp_v11_0_ring_create(struct psp_context *psp,
return ret;
}
-static int psp_v11_0_ring_stop(struct psp_context *psp,
- enum psp_ring_type ring_type)
-{
- int ret = 0;
- struct amdgpu_device *adev = psp->adev;
-
- /* Write the ring destroy command*/
- if (psp_v11_0_support_vmr_ring(psp))
- WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
- GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING);
- else
- 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 (psp_v11_0_support_vmr_ring(psp))
- ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
- 0x80000000, 0x80000000, false);
- else
- ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
- 0x80000000, 0x80000000, false);
-
- return ret;
-}
static int psp_v11_0_ring_destroy(struct psp_context *psp,
enum psp_ring_type ring_type)
--
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): DM6PR12MB367543F375AE028DE9B4F810BBB10-lmeGfMZKVrETl6lK/[email protected]
Xu, Feifei
Reviewed-by Feifei Xu-----Original Message-----
From: Zhang, Jack (Jian) <[email protected]>
Sent: Wednesday, September 11, 2019 10:56 AM
To: [email protected]; Xu, Feifei <[email protected]>
Cc: Zhang, Jack (Jian) <[email protected]>
Subject: RE: [PATCH] drm/amdgpu/sriov: add ring_stop before ring_create in psp v11 code
ping
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jack Zhang
Sent: Tuesday, September 10, 2019 4:09 PM
To: [email protected]
Cc: Zhang, Jack (Jian) <[email protected]>
Subject: [PATCH] drm/amdgpu/sriov: add ring_stop before ring_create in psp v11 code
psp v11 code missed ring stop in ring create function(VMR) while psp v3.1 code had the code. This will cause VM destroy1 fail and psp ring create fail.
For SIOV-VF, ring_stop should not be deleted in ring_create function.
--- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 61 +++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +34 -0
@@ -397,6 +397,34 @@ static bool psp_v11_0_support_vmr_ring(struct psp_context *psp)return false; } +static int psp_v11_0_ring_stop (struct psp_context *psp, +enum psp_ring_type ring_type) +{ +int ret =0 ; +struct amdgpu_device *adev = psp->adev; + +/* Write the ring destroy command*/ +if (psp_v11_0_support_vmr_ring (psp)) +WREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_101, +GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING ); +else +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 (psp_v11_0_support_vmr_ring (psp)) + ret =psp_wait_for (psp,SOC15_REG_OFFSET (MP0 ,0 , mmMP0_SMN_C2PMSG_101), +0x80000000 ,0x80000000 , false); +else + ret =psp_wait_for (psp,SOC15_REG_OFFSET (MP0 ,0 , mmMP0_SMN_C2PMSG_64), +0x80000000 ,0x80000000 , false); + +return ret; +} +static int psp_v11_0_ring_create (struct psp_context *psp,enum psp_ring_type ring_type) {
@@ -406,6 +434,12 @@ static int psp_v11_0_ring_create(struct psp_context *psp,struct amdgpu_device *adev = psp->adev;if (psp_v11_0_support_vmr_ring (psp)) { + ret =psp_v11_0_ring_stop (psp, ring_type); +if (ret) { +DRM_ERROR ("psp_v11_0_ring_stop_sriov failed!\n" ); +return ret; + } +/* Write low address of the ring to C2PMSG_102 */ psp_ring_reg =lower_32_bits (ring->ring_mem_mc_addr); WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, psp_ring_reg); @@ -450,33 +484,6 @@ static int psp_v11_0_ring_create(struct psp_context *psp,
return ret;
}
-static int psp_v11_0_ring_stop(struct psp_context *psp,
- enum psp_ring_type ring_type)
-{
- int ret = 0;
- struct amdgpu_device *adev = psp->adev;
-
- /* Write the ring destroy command*/
- if (psp_v11_0_support_vmr_ring(psp))
- WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
- GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING);
- else
- 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 (psp_v11_0_support_vmr_ring(psp))
- ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
- 0x80000000, 0x80000000, false);
- else
- ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
- 0x80000000, 0x80000000, false);
-
- return ret;
-}
static int psp_v11_0_ring_destroy(struct psp_context *psp,
enum psp_ring_type ring_type)
--
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