drm/amdgpu: update mcm_addr_lut data for imu v12_1
Subsystems (2)
Alex Deucher
maintainerPATCH 1/4 drm/amdgpu: update mcm_addr_lut data for imu v12_1
From: Likun Gao <[email protected]>
Support for partition mode to program MCM_ADDR_LUT.
v2: clean up (Alex)
Signed-off-by Likun Gao <[email protected]>
Reviewed-by Hawking Zhang <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/soc_v1_0.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc_v1_0.c +9 -2
@@ -1115,8 +1115,15 @@ static int soc_v1_0_switch_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr, num_xcc_per_xcp =__soc_v1_0_get_xcc_per_xcp (xcp_mgr, mode);if (adev->gfx.imu.funcs && - adev->gfx.imu.funcs->switch_compute_partition) - adev->gfx.imu.funcs->switch_compute_partition (xcp_mgr->adev, num_xcc_per_xcp, mode); + adev->gfx.imu.funcs->switch_compute_partition) { + ret = adev->gfx.imu.funcs->switch_compute_partition (xcp_mgr->adev, num_xcc_per_xcp, mode); +if (ret) + goto out; + } +if (adev->gfx.imu.funcs && + adev->gfx.imu.funcs->init_mcm_addr_lut && + amdgpu_emu_mode) + adev->gfx.imu.funcs->init_mcm_addr_lut (adev);/* Init info about new xcps */ *num_xcps = num_xcc / num_xcc_per_xcp;
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 2/4 drm/amdgpu: Init mcm_addr look up table
From: Hawking Zhang <[email protected]>
Encode mcm address look up table in SPX mode as a temp solution.
v2: fill in when interface is ready (Alex)
Signed-off-by Hawking Zhang <[email protected]>
Reviewed-by Likun Gao <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_imu.h | 1 + drivers/gpu/drm/amd/amdgpu/imu_v12_1.c | 6 ++++++ 2 files changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_imu.h +1 -0
@@ -39,6 +39,7 @@ struct amdgpu_imu_funcs {int (*switch_compute_partition)(struct amdgpu_device *adev,int num_xccs_per_xcp,int compute_partition_mode); +void (*init_mcm_addr_lut)(struct amdgpu_device *adev); };struct imu_rlc_ram_golden {
drivers/gpu/drm/amd/amdgpu/imu_v12_1.c +6 -0
@@ -201,8 +201,14 @@ static int imu_v12_1_switch_compute_partition(struct amdgpu_device *adev,return 0 ; } +static void imu_v12_1_init_mcm_addr_lut (struct amdgpu_device *adev) +{ +/* todo: fill in when interface is ready */ +} +const struct amdgpu_imu_funcs gfx_v12_1_imu_funcs = { .init_microcode = imu_v12_1_init_microcode, .load_microcode = imu_v12_1_load_microcode, .switch_compute_partition = imu_v12_1_switch_compute_partition, + .init_mcm_addr_lut = imu_v12_1_init_mcm_addr_lut, };
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 3/4 drm/amdgpu: update mcm_addr_lut data for imu v12_1
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Support for partition mode to program MCM_ADDR_LUT.
Signed-off-by Likun Gao <[email protected]>
Reviewed-by Hawking Zhang <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/imu_v12_1.c | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/imu_v12_1.c +26 -1
@@ -201,9 +201,34 @@ static int imu_v12_1_switch_compute_partition(struct amdgpu_device *adev,return 0 ; } +#define regGFX_IMU_MCM_ADDR_LUT_PF 0x5f8d +#define regGFX_IMU_MCM_ADDR_LUT_PF_BASE_IDX 1 +static void imu_v12_1_init_mcm_addr_lut (struct amdgpu_device *adev) { -/* todo: fill in when interface is ready */ +/* Encoding mcm_addr_lut in SPX mode for now +* I've noticed variations in encoding +* Need to revisit the configuration later +* XCD0:: Bits-[3:0 ] AID-01 XCD-00 +* XCD1:: Bits-[7:4 ] AID-01 XCD-01 +* XCD2:: Bits-[11:8 ] AID-01 XCD-10 +* XCD3:: Bits-[15:12] AID-01 XCD-11 +* XCD4:: Bits-[19:16] AID-10 XCD-00 +* XCD5:: Bits-[23:20] AID-10 XCD-01 +* XCD6:: Bits-[27:24] AID-10 XCD-10 +* XCD7:: Bits-[31:28] AID-10 XCD-11 +*/ +int data =0xba987654 ; +int i, num_xcc, partition_num, encode_data; + + num_xcc =NUM_XCC (adev->gfx.xcc_mask); +for (i =0 ; i < num_xcc; i++) { + partition_num =GET_INST (GC , i) / adev->gfx.num_xcc_per_xcp; + encode_data = (data >> (partition_num * adev->gfx.num_xcc_per_xcp *4 )) & +GENMASK (adev->gfx.num_xcc_per_xcp *4 -1 ,0 ); +WREG32_SOC15 (GC ,GET_INST (GC , i), + regGFX_IMU_MCM_ADDR_LUT_PF, encode_data); + } }const struct amdgpu_imu_funcs gfx_v12_1_imu_funcs = {
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 4/4 drm/amdgpu: correct mcm_addr_lut value for gc v12_1
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Correct GFX_IMU_MCM_ADDR_LUT_PF register value to suit for xcc harvest situation.
Signed-off-by Likun Gao <[email protected]>
Reviewed-by Jinzhou Su <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/imu_v12_1.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/imu_v12_1.c +12 -8
@@ -218,16 +218,20 @@ static void imu_v12_1_init_mcm_addr_lut(struct amdgpu_device *adev)* XCD6:: Bits-[27:24] AID-10 XCD-10 * XCD7:: Bits-[31:28] AID-10 XCD-11 */ -int data =0xba987654 ; -int i, num_xcc, partition_num, encode_data; +int data, encode_data; +int i, j, num_xcc; num_xcc =NUM_XCC (adev->gfx.xcc_mask); -for (i =0 ; i < num_xcc; i++) { - partition_num =GET_INST (GC , i) / adev->gfx.num_xcc_per_xcp; - encode_data = (data >> (partition_num * adev->gfx.num_xcc_per_xcp *4 )) & -GENMASK (adev->gfx.num_xcc_per_xcp *4 -1 ,0 ); -WREG32_SOC15 (GC ,GET_INST (GC , i), - regGFX_IMU_MCM_ADDR_LUT_PF, encode_data); +for (i =0 ; i < (num_xcc / adev->gfx.num_xcc_per_xcp); i++) { + encode_data =0 ; +for (j =0 ; j < adev->gfx.num_xcc_per_xcp; j++) { + data = ((GET_INST (GC , i * adev->gfx.num_xcc_per_xcp + j) /4 +1 ) <<2 ) | + (GET_INST (GC , i * adev->gfx.num_xcc_per_xcp + j) %4 ); + encode_data |= data << (j *4 ); + } +for (j =0 ; j < adev->gfx.num_xcc_per_xcp; j++) +WREG32_SOC15 (GC ,GET_INST (GC , i * adev->gfx.num_xcc_per_xcp + j), + regGFX_IMU_MCM_ADDR_LUT_PF, encode_data); } }
Signature · 1 line
2.55.0