Revert "drm/amdgpu: Remove redundant GFX v9.4.3 sequence"
Subsystems (2)
PATCH 1/2 Revert "drm/amdgpu: Remove redundant GFX v9.4.3 sequence"
This reverts commit cd65f5547f06b8c144063b1744011a135157e364.
FW programming is not yet functional fully. Revert till the programming is in place in FW.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +29 -0
@@ -1034,6 +1034,32 @@ static void gfx_v9_4_3_xcc_disable_gpa_mode(struct amdgpu_device *adev, int xcc_WREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCPC_PSP_DEBUG, data); } +static void gfx_v9_4_3_xcc_program_xcc_id (struct amdgpu_device *adev, +int xcc_id) +{ +uint32_t tmp =0 ; +int num_xcc; + + num_xcc =NUM_XCC (adev->gfx.xcc_mask); +switch (num_xcc) { +/* directly config VIRTUAL_XCC_ID to 0 for 1-XCC */ +case 1 : +WREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_HYP_XCP_CTL,0x8 ); +break ; +case 2 : +case 4 : +case 6 : +case 8 : + tmp = (xcc_id % adev->gfx.num_xcc_per_xcp) <<REG_FIELD_SHIFT (CP_HYP_XCP_CTL ,VIRTUAL_XCC_ID ); + tmp = tmp | (adev->gfx.num_xcc_per_xcp <<REG_FIELD_SHIFT (CP_HYP_XCP_CTL ,NUM_XCC_IN_XCP )); +WREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_HYP_XCP_CTL, tmp); + +break ; +default : +break ; + } +} +static bool gfx_v9_4_3_is_rlc_enabled (struct amdgpu_device *adev) {uint32_t rlc_setting;
@@ -1910,6 +1936,9 @@ static int gfx_v9_4_3_xcc_cp_resume(struct amdgpu_device *adev, int xcc_id)return r; } +/* set the virtual and physical id based on partition_mode */ +gfx_v9_4_3_xcc_program_xcc_id (adev, xcc_id); + r =gfx_v9_4_3_xcc_kiq_resume (adev, xcc_id);if (r)return r;
Signature · 1 line
2.25.1
PATCH 2/2 drm/amdgpu: Program xcp_ctl registers as needed
XCP_CTL register is expected to be programmed by firmware. Under certain conditions FW may not have programmed it correctly. As a workaround, program only when FW has not programmed the right values.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 28 ++++++++++--------------- 1 file changed, 11 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +11 -17
@@ -1037,26 +1037,20 @@ static void gfx_v9_4_3_xcc_disable_gpa_mode(struct amdgpu_device *adev, int xcc_static void gfx_v9_4_3_xcc_program_xcc_id (struct amdgpu_device *adev,int xcc_id) { -uint32_t tmp =0 ; -int num_xcc; +uint32_t expval, regval; +int num_xcc, i; num_xcc =NUM_XCC (adev->gfx.xcc_mask); -switch (num_xcc) { -/* directly config VIRTUAL_XCC_ID to 0 for 1-XCC */ -case 1 : -WREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_HYP_XCP_CTL,0x8 ); -break ; -case 2 : -case 4 : -case 6 : -case 8 : - tmp = (xcc_id % adev->gfx.num_xcc_per_xcp) <<REG_FIELD_SHIFT (CP_HYP_XCP_CTL ,VIRTUAL_XCC_ID ); - tmp = tmp | (adev->gfx.num_xcc_per_xcp <<REG_FIELD_SHIFT (CP_HYP_XCP_CTL ,NUM_XCC_IN_XCP )); -WREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_HYP_XCP_CTL, tmp); +for (i =0 ; i < num_xcc; i++) { + expval =REG_SET_FIELD (expval,CP_HYP_XCP_CTL ,NUM_XCC_IN_XCP , + adev->gfx.num_xcc_per_xcp); + expval =REG_SET_FIELD (expval,CP_HYP_XCP_CTL ,VIRTUAL_XCC_ID , + i % adev->gfx.num_xcc_per_xcp); -break ; -default : -break ; + regval =RREG32_SOC15 (GC ,GET_INST (GC , i), regCP_HYP_XCP_CTL); +if (regval != expval) +WREG32_SOC15 (GC ,GET_INST (GC , i), regCP_HYP_XCP_CTL, + expval); } }
Signature · 1 line
2.25.1
RE: [PATCH 2/2] drm/amdgpu: Program xcp_ctl registers as needed
[AMD Official Use Only - General]
Please ignore this series. I will send a fresh one.
Thanks,
Lijo
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lijo Lazar
Sent: Thursday, July 20, 2023 11:10 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Morris <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: Program xcp_ctl registers as needed
XCP_CTL register is expected to be programmed by firmware. Under certain conditions FW may not have programmed it correctly. As a workaround, program only when FW has not programmed the right values.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 28 ++++++++++--------------- 1 file changed, 11 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +11 -18
@@ -1037,26 +1037,20 @@ static void gfx_v9_4_3_xcc_disable_gpa_mode(struct amdgpu_device *adev, int xcc_ static void gfx_v9_4_3_xcc_program_xcc_id(struct amdgpu_device *adev, int xcc_id) { -uint32_t tmp =0 ; -int num_xcc; +uint32_t expval, regval; +int num_xcc, i; num_xcc =NUM_XCC (adev->gfx.xcc_mask); -switch (num_xcc) { -/* directly config VIRTUAL_XCC_ID to 0 for 1-XCC */ -case 1 : -WREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_HYP_XCP_CTL,0x8 ); -break ; -case 2 : -case 4 : -case 6 : -case 8 : - tmp = (xcc_id % adev->gfx.num_xcc_per_xcp) <<REG_FIELD_SHIFT (CP_HYP_XCP_CTL ,VIRTUAL_XCC_ID ); - tmp = tmp | (adev->gfx.num_xcc_per_xcp <<REG_FIELD_SHIFT (CP_HYP_XCP_CTL ,NUM_XCC_IN_XCP )); -WREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_HYP_XCP_CTL, tmp); +for (i =0 ; i < num_xcc; i++) { + expval =REG_SET_FIELD (expval,CP_HYP_XCP_CTL ,NUM_XCC_IN_XCP , + adev->gfx.num_xcc_per_xcp); + expval =REG_SET_FIELD (expval,CP_HYP_XCP_CTL ,VIRTUAL_XCC_ID , + i % adev->gfx.num_xcc_per_xcp); -break ; -default : -break ; + regval =RREG32_SOC15 (GC ,GET_INST (GC , i), regCP_HYP_XCP_CTL); +if (regval != expval) +WREG32_SOC15 (GC ,GET_INST (GC , i), regCP_HYP_XCP_CTL, + expval); } } --
2.25.1