drm/amdgpu: correct tcp harvest setting
Subsystems (2)
PATCH v3 1/7 drm/amdgpu: correct tcp harvest setting
Add missing settings for SQC bits. And correct some confusing logics around active wgp bitmap calculation.
---V1->V2:
- restore correct tcp_harvest setting for NV10 and NV12
- move asic type guard upper layer for better readability
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 103 ++++++++++++++----------- 1 file changed, 57 insertions(+), 46 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +57 -46
@@ -5090,47 +5090,50 @@ static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)4 +/* RMI */ 1); /* SQG */ -if (adev->asic_type ==CHIP_NAVI10 || - adev->asic_type ==CHIP_NAVI14 || - adev->asic_type ==CHIP_NAVI12 ) { -mutex_lock (&adev->grbm_idx_mutex); -for (i =0 ; i < adev->gfx.config.max_shader_engines; i++) { -for (j =0 ; j < adev->gfx.config.max_sh_per_se; j++) { -gfx_v10_0_select_se_sh (adev, i, j,0xffffffff ); - wgp_active_bitmap =gfx_v10_0_get_wgp_active_bitmap_per_sh (adev); -/* -* Set corresponding TCP bits for the inactive WGPs in -* GCRD_SA_TARGETS_DISABLE -*/ - gcrd_targets_disable_tcp =0 ; -/* Set TCP & SQC bits in UTCL1_UTCL0_INVREQ_DISABLE */ - utcl_invreq_disable =0 ; - -for (k =0 ; k < max_wgp_per_sh; k++) { -if (!(wgp_active_bitmap & (1 << k))) { - gcrd_targets_disable_tcp |=3 << (2 * k); - utcl_invreq_disable |= (3 << (2 * k)) | - (3 << (2 * (max_wgp_per_sh + k))); - } +mutex_lock (&adev->grbm_idx_mutex); +for (i =0 ; i < adev->gfx.config.max_shader_engines; i++) { +for (j =0 ; j < adev->gfx.config.max_sh_per_se; j++) { +gfx_v10_0_select_se_sh (adev, i, j,0xffffffff ); + wgp_active_bitmap =gfx_v10_0_get_wgp_active_bitmap_per_sh (adev); +/* +* Set corresponding TCP bits for the inactive WGPs in +* GCRD_SA_TARGETS_DISABLE +*/ + gcrd_targets_disable_tcp =0 ; +/* Set TCP & SQC bits in UTCL1_UTCL0_INVREQ_DISABLE */ + utcl_invreq_disable =0 ; + +for (k =0 ; k < max_wgp_per_sh; k++) { +if (!(wgp_active_bitmap & (1 << k))) { + gcrd_targets_disable_tcp |=3 << (2 * k); + gcrd_targets_disable_tcp |=1 << (k + (max_wgp_per_sh *2 )); + utcl_invreq_disable |= (3 << (2 * k)) | + (3 << (2 * (max_wgp_per_sh + k))); } - - tmp =RREG32_SOC15 (GC ,0 , mmUTCL1_UTCL0_INVREQ_DISABLE); -/* only override TCP & SQC bits */ - tmp &=0xffffffff << (4 * max_wgp_per_sh); - tmp |= (utcl_invreq_disable & utcl_invreq_disable_mask); -WREG32_SOC15 (GC ,0 , mmUTCL1_UTCL0_INVREQ_DISABLE, tmp); - - tmp =RREG32_SOC15 (GC ,0 , mmGCRD_SA_TARGETS_DISABLE); -/* only override TCP bits */ - tmp &=0xffffffff << (2 * max_wgp_per_sh); - tmp |= (gcrd_targets_disable_tcp & gcrd_targets_disable_mask); -WREG32_SOC15 (GC ,0 , mmGCRD_SA_TARGETS_DISABLE, tmp); } - } -gfx_v10_0_select_se_sh (adev,0xffffffff ,0xffffffff ,0xffffffff ); -mutex_unlock (&adev->grbm_idx_mutex); + tmp =RREG32_SOC15 (GC ,0 , mmUTCL1_UTCL0_INVREQ_DISABLE); +/* only override TCP & SQC bits */ +if (adev->asic_type ==CHIP_NAVI14 ) + tmp &=0xff000000 ; +else + tmp &=0xfff00000 ; + tmp |= (utcl_invreq_disable & utcl_invreq_disable_mask); +WREG32_SOC15 (GC ,0 , mmUTCL1_UTCL0_INVREQ_DISABLE, tmp); + + tmp =RREG32_SOC15 (GC ,0 , mmGCRD_SA_TARGETS_DISABLE); +/* only override TCP & SQC bits */ +if (adev->asic_type ==CHIP_NAVI14 ) + tmp &=0xfffc0000 ; +else + tmp &=0xffff8000 ; + tmp |= (gcrd_targets_disable_tcp & gcrd_targets_disable_mask); +WREG32_SOC15 (GC ,0 , mmGCRD_SA_TARGETS_DISABLE, tmp); + } } + +gfx_v10_0_select_se_sh (adev,0xffffffff ,0xffffffff ,0xffffffff ); +mutex_unlock (&adev->grbm_idx_mutex); }static void gfx_v10_0_get_tcc_info (struct amdgpu_device *adev)
@@ -7408,7 +7411,10 @@ static int gfx_v10_0_hw_init(void *handle)* init golden registers and rlc resume may override some registers, * reconfig them here */ -gfx_v10_0_tcp_harvest (adev); +if (adev->asic_type ==CHIP_NAVI10 || + adev->asic_type ==CHIP_NAVI14 || + adev->asic_type ==CHIP_NAVI12 ) +gfx_v10_0_tcp_harvest (adev); r =gfx_v10_0_cp_resume (adev);if (r)
@@ -9328,17 +9334,22 @@ static void gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(struct amdgpu_device *static u32 gfx_v10_0_get_wgp_active_bitmap_per_sh (struct amdgpu_device *adev) { -u32 data, wgp_bitmask; - data =RREG32_SOC15 (GC ,0 , mmCC_GC_SHADER_ARRAY_CONFIG); - data |=RREG32_SOC15 (GC ,0 , mmGC_USER_SHADER_ARRAY_CONFIG); +u32 disabled_mask = + ~amdgpu_gfx_create_bitmask (adev->gfx.config.max_cu_per_sh >>1 ); +u32 efuse_setting =0 ; +u32 vbios_setting =0 ; + + efuse_setting =RREG32_SOC15 (GC ,0 , mmCC_GC_SHADER_ARRAY_CONFIG); + efuse_setting &=CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS_MASK ; + efuse_setting >>=CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS__SHIFT ; - data &=CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS_MASK ; - data >>=CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS__SHIFT ; + vbios_setting =RREG32_SOC15 (GC ,0 , mmGC_USER_SHADER_ARRAY_CONFIG); + vbios_setting &=GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_WGPS_MASK ; + vbios_setting >>=GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_WGPS__SHIFT ; - wgp_bitmask = -amdgpu_gfx_create_bitmask (adev->gfx.config.max_cu_per_sh >>1 ); + disabled_mask |= efuse_setting | vbios_setting; -return (~data) & wgp_bitmask; +return (~disabled_mask); }static u32 gfx_v10_0_get_cu_active_bitmap_per_sh (struct amdgpu_device *adev)
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v3 2/7 drm/amdgpu: fix Navi1x tcp power gating hang when issuing lightweight invalidaiton
Fix TCP hang when a lightweight invalidation happens on Navi1x.
---V1->V2:
- Alex: use ARRAY_SIZE instead of hard code
- limit the changes for Navi1x only
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 95 ++++++++++++++++++++++++++ 1 file changed, 95 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +95 -0
@@ -7971,6 +7971,97 @@ static void gfx_v10_0_update_fine_grain_clock_gating(struct amdgpu_device *adev, } } +static void gfx_v10_0_apply_medium_grain_clock_gating_workaround (struct amdgpu_device *adev) +{ +uint32_t reg_data =0 ; +uint32_t reg_idx =0 ; +uint32_t i; + +const uint32_t tcp_ctrl_regs[] = { + mmCGTS_SA0_WGP00_CU0_TCP_CTRL_REG, + mmCGTS_SA0_WGP00_CU1_TCP_CTRL_REG, + mmCGTS_SA0_WGP01_CU0_TCP_CTRL_REG, + mmCGTS_SA0_WGP01_CU1_TCP_CTRL_REG, + mmCGTS_SA0_WGP02_CU0_TCP_CTRL_REG, + mmCGTS_SA0_WGP02_CU1_TCP_CTRL_REG, + mmCGTS_SA0_WGP10_CU0_TCP_CTRL_REG, + mmCGTS_SA0_WGP10_CU1_TCP_CTRL_REG, + mmCGTS_SA0_WGP11_CU0_TCP_CTRL_REG, + mmCGTS_SA0_WGP11_CU1_TCP_CTRL_REG, + mmCGTS_SA0_WGP12_CU0_TCP_CTRL_REG, + mmCGTS_SA0_WGP12_CU1_TCP_CTRL_REG, + mmCGTS_SA1_WGP00_CU0_TCP_CTRL_REG, + mmCGTS_SA1_WGP00_CU1_TCP_CTRL_REG, + mmCGTS_SA1_WGP01_CU0_TCP_CTRL_REG, + mmCGTS_SA1_WGP01_CU1_TCP_CTRL_REG, + mmCGTS_SA1_WGP02_CU0_TCP_CTRL_REG, + mmCGTS_SA1_WGP02_CU1_TCP_CTRL_REG, + mmCGTS_SA1_WGP10_CU0_TCP_CTRL_REG, + mmCGTS_SA1_WGP10_CU1_TCP_CTRL_REG, + mmCGTS_SA1_WGP11_CU0_TCP_CTRL_REG, + mmCGTS_SA1_WGP11_CU1_TCP_CTRL_REG, + mmCGTS_SA1_WGP12_CU0_TCP_CTRL_REG, + mmCGTS_SA1_WGP12_CU1_TCP_CTRL_REG + }; + +const uint32_t tcp_ctrl_regs_nv12[] = { + mmCGTS_SA0_WGP00_CU0_TCP_CTRL_REG, + mmCGTS_SA0_WGP00_CU1_TCP_CTRL_REG, + mmCGTS_SA0_WGP01_CU0_TCP_CTRL_REG, + mmCGTS_SA0_WGP01_CU1_TCP_CTRL_REG, + mmCGTS_SA0_WGP02_CU0_TCP_CTRL_REG, + mmCGTS_SA0_WGP02_CU1_TCP_CTRL_REG, + mmCGTS_SA0_WGP10_CU0_TCP_CTRL_REG, + mmCGTS_SA0_WGP10_CU1_TCP_CTRL_REG, + mmCGTS_SA0_WGP11_CU0_TCP_CTRL_REG, + mmCGTS_SA0_WGP11_CU1_TCP_CTRL_REG, + mmCGTS_SA1_WGP00_CU0_TCP_CTRL_REG, + mmCGTS_SA1_WGP00_CU1_TCP_CTRL_REG, + mmCGTS_SA1_WGP01_CU0_TCP_CTRL_REG, + mmCGTS_SA1_WGP01_CU1_TCP_CTRL_REG, + mmCGTS_SA1_WGP02_CU0_TCP_CTRL_REG, + mmCGTS_SA1_WGP02_CU1_TCP_CTRL_REG, + mmCGTS_SA1_WGP10_CU0_TCP_CTRL_REG, + mmCGTS_SA1_WGP10_CU1_TCP_CTRL_REG, + mmCGTS_SA1_WGP11_CU0_TCP_CTRL_REG, + mmCGTS_SA1_WGP11_CU1_TCP_CTRL_REG, + }; + +const uint32_t sm_ctlr_regs[] = { + mmCGTS_SA0_QUAD0_SM_CTRL_REG, + mmCGTS_SA0_QUAD1_SM_CTRL_REG, + mmCGTS_SA1_QUAD0_SM_CTRL_REG, + mmCGTS_SA1_QUAD1_SM_CTRL_REG + }; + +if (adev->asic_type ==CHIP_NAVI12 ) { +for (i =0 ; i <ARRAY_SIZE (tcp_ctrl_regs_nv12); i++) { + reg_idx = adev->reg_offset[GC_HWIP ][0 ][mmCGTS_SA0_WGP00_CU0_TCP_CTRL_REG_BASE_IDX] + + tcp_ctrl_regs_nv12[i]; + reg_data =RREG32 (reg_idx); + reg_data |=CGTS_SA0_WGP00_CU0_TCP_CTRL_REG__TCPI_LS_OVERRIDE_MASK ; +WREG32 (reg_idx, reg_data); + } + }else { +for (i =0 ; i <ARRAY_SIZE (tcp_ctrl_regs); i++) { + reg_idx = adev->reg_offset[GC_HWIP ][0 ][mmCGTS_SA0_WGP00_CU0_TCP_CTRL_REG_BASE_IDX] + + tcp_ctrl_regs[i]; + reg_data =RREG32 (reg_idx); + reg_data |=CGTS_SA0_WGP00_CU0_TCP_CTRL_REG__TCPI_LS_OVERRIDE_MASK ; +WREG32 (reg_idx, reg_data); + } + } + +for (i =0 ; i <ARRAY_SIZE (sm_ctlr_regs); i++) { + reg_idx = adev->reg_offset[GC_HWIP ][0 ][mmCGTS_SA0_QUAD0_SM_CTRL_REG_BASE_IDX] + + sm_ctlr_regs[i]; + reg_data =RREG32 (reg_idx); + reg_data &= ~CGTS_SA0_QUAD0_SM_CTRL_REG__SM_MODE_MASK ; + reg_data |=2 <<CGTS_SA0_QUAD0_SM_CTRL_REG__SM_MODE__SHIFT ; +WREG32 (reg_idx, reg_data); + } +} +static int gfx_v10_0_update_gfx_clock_gating (struct amdgpu_device *adev,bool enable) {
@@ -7987,6 +8078,10 @@ static int gfx_v10_0_update_gfx_clock_gating(struct amdgpu_device *adev,gfx_v10_0_update_3d_clock_gating (adev, enable);/* === CGCG + CGLS === */ gfx_v10_0_update_coarse_grain_clock_gating (adev, enable); + +if ((adev->asic_type >=CHIP_NAVI10 ) && + (adev->asic_type <=CHIP_NAVI12 )) +gfx_v10_0_apply_medium_grain_clock_gating_workaround (adev); }else {/* CGCG/CGLS should be disabled before MGCG/MGLS * === CGCG + CGLS ===
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v3 3/7 drm/amdgpu: fix NAK-G generation during PCI-e link width switch
In reply to Evan QuanA lot of NAK-G being generated when link widht switching is happening. WA for this issue is to program the SPC to 4 symbols per clock during bootup when the native PCIE width is x4.
---V1->V2:
- move the code to nbio_v2_3.c as that's where the pcie related changes reside
--- drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h | 1 + drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 28 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/nv.c | 3 +++ 3 files changed, 32 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h +1 -0
@@ -93,6 +93,7 @@ struct amdgpu_nbio_funcs {void (*enable_aspm)(struct amdgpu_device *adev,bool enable);void (*program_aspm)(struct amdgpu_device *adev); +void (*apply_lc_spc_mode_wa)(struct amdgpu_device *adev); };struct amdgpu_nbio {
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +28 -0
@@ -51,6 +51,8 @@#define mmBIF_MMSCH1_DOORBELL_RANGE 0x01d8#define mmBIF_MMSCH1_DOORBELL_RANGE_BASE_IDX 2 +#define smnPCIE_LC_LINK_WIDTH_CNTL 0x11140288 +static void nbio_v2_3_remap_hdp_registers (struct amdgpu_device *adev) { WREG32_SOC15(NBIO, 0, mmREMAP_HDP_MEM_FLUSH_CNTL,
@@ -463,6 +465,31 @@ static void nbio_v2_3_program_aspm(struct amdgpu_device *adev)WREG32_PCIE (smnPCIE_LC_CNTL3, data); } +static void nbio_v2_3_apply_lc_spc_mode_wa (struct amdgpu_device *adev) +{ +uint32_t reg_data =0 ; +uint32_t link_width =0 ; + +if (!((adev->asic_type >=CHIP_NAVI10 ) && + (adev->asic_type <=CHIP_NAVI12 ))) +return ; + + reg_data =RREG32_PCIE (smnPCIE_LC_LINK_WIDTH_CNTL); + link_width = (reg_data &PCIE_LC_LINK_WIDTH_CNTL__LC_LINK_WIDTH_RD_MASK ) + >>PCIE_LC_LINK_WIDTH_CNTL__LC_LINK_WIDTH_RD__SHIFT ; + +/* +* Program PCIE_LC_CNTL6.LC_SPC_MODE_8GT to 0x2 (4 symbols per clock data) +* if link_width is 0x3 (x4) +*/ +if (0x3 == link_width) { + reg_data =RREG32_PCIE (smnPCIE_LC_CNTL6); + reg_data &= ~PCIE_LC_CNTL6__LC_SPC_MODE_8GT_MASK ; + reg_data |= (0x2 <<PCIE_LC_CNTL6__LC_SPC_MODE_8GT__SHIFT ); +WREG32_PCIE (smnPCIE_LC_CNTL6, reg_data); + } +} +const struct amdgpu_nbio_funcs nbio_v2_3_funcs = { .get_hdp_flush_req_offset = nbio_v2_3_get_hdp_flush_req_offset, .get_hdp_flush_done_offset = nbio_v2_3_get_hdp_flush_done_offset,
@@ -484,4 +511,5 @@ const struct amdgpu_nbio_funcs nbio_v2_3_funcs = { .remap_hdp_registers = nbio_v2_3_remap_hdp_registers, .enable_aspm = nbio_v2_3_enable_aspm, .program_aspm = nbio_v2_3_program_aspm, + .apply_lc_spc_mode_wa = nbio_v2_3_apply_lc_spc_mode_wa, };
drivers/gpu/drm/amd/amdgpu/nv.c +3 -0
@@ -1411,6 +1411,9 @@ static int nv_common_hw_init(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +if (adev->nbio.funcs->apply_lc_spc_mode_wa) + adev->nbio.funcs->apply_lc_spc_mode_wa (adev); +/* enable pcie gen2/3 link */ nv_pcie_gen3_enable (adev);/* enable aspm */
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v3 4/7 drm/amdgpu: fix the hang caused by PCIe link width switch
In reply to Evan QuanSMU had set all the necessary fields for a link width switch but the width switch wasn't occurring because the link was idle in the L1 state. Setting LC_L1_RECONFIG_EN=0x1 will allow width switches to also be initiated while in L1 instead of waiting until the link is back in L0.
---V1->V2:
- limit the change for Navi10 onlyV2->V3:
- move the code to nbio_v2_3.c
--- drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h | 1 + drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 13 +++++++++++++ drivers/gpu/drm/amd/amdgpu/nv.c | 3 +++ 3 files changed, 17 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h +1 -0
@@ -94,6 +94,7 @@ struct amdgpu_nbio_funcs { bool enable);void (*program_aspm)(struct amdgpu_device *adev);void (*apply_lc_spc_mode_wa)(struct amdgpu_device *adev); +void (*apply_l1_link_width_reconfig_wa)(struct amdgpu_device *adev); };struct amdgpu_nbio {
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +13 -0
@@ -490,6 +490,18 @@ static void nbio_v2_3_apply_lc_spc_mode_wa(struct amdgpu_device *adev) } } +static void nbio_v2_3_apply_l1_link_width_reconfig_wa (struct amdgpu_device *adev) +{ +uint32_t reg_data =0 ; + +if (adev->asic_type !=CHIP_NAVI10 ) +return ; + + reg_data =RREG32_PCIE (smnPCIE_LC_LINK_WIDTH_CNTL); + reg_data |=PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK ; +WREG32_PCIE (smnPCIE_LC_LINK_WIDTH_CNTL, reg_data); +} +const struct amdgpu_nbio_funcs nbio_v2_3_funcs = { .get_hdp_flush_req_offset = nbio_v2_3_get_hdp_flush_req_offset, .get_hdp_flush_done_offset = nbio_v2_3_get_hdp_flush_done_offset,
@@ -512,4 +524,5 @@ const struct amdgpu_nbio_funcs nbio_v2_3_funcs = { .enable_aspm = nbio_v2_3_enable_aspm, .program_aspm = nbio_v2_3_program_aspm, .apply_lc_spc_mode_wa = nbio_v2_3_apply_lc_spc_mode_wa, + .apply_l1_link_width_reconfig_wa = nbio_v2_3_apply_l1_link_width_reconfig_wa, };
drivers/gpu/drm/amd/amdgpu/nv.c +3 -0
@@ -1414,6 +1414,9 @@ static int nv_common_hw_init(void *handle)if (adev->nbio.funcs->apply_lc_spc_mode_wa) adev->nbio.funcs->apply_lc_spc_mode_wa (adev); +if (adev->nbio.funcs->apply_l1_link_width_reconfig_wa) + adev->nbio.funcs->apply_l1_link_width_reconfig_wa (adev); +/* enable pcie gen2/3 link */ nv_pcie_gen3_enable (adev);/* enable aspm */
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v3 5/7 drm/amdgpu: correct clock gating settings on feature unsupported
In reply to Evan QuanClock gating setting is still performed even when the corresponding CG feature is not supported. And the tricky part is disablement is actually performed no matter for enablement or disablement request. That seems not logically right.
Considering HW should already properly take care of the CG state, we will just skip the corresponding clock gating setting when the feature is not supported.
--- drivers/gpu/drm/amd/amdgpu/athub_v2_0.c | 12 +++-- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 69 ++++++++++++++++++------ drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c | 10 +++- drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 10 +++- drivers/gpu/drm/amd/amdgpu/smuio_v11_0.c | 5 +- 5 files changed, 83 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/amdgpu/athub_v2_0.c +9 -3
@@ -36,9 +36,12 @@ athub_v2_0_update_medium_grain_clock_gating(struct amdgpu_device *adev, {uint32_t def, data; +if (!(adev->cg_flags &AMD_CG_SUPPORT_MC_MGCG )) +return ; + def = data =RREG32_SOC15 (ATHUB ,0 , mmATHUB_MISC_CNTL); -if (enable && (adev->cg_flags &AMD_CG_SUPPORT_MC_MGCG )) +if (enable) data |=ATHUB_MISC_CNTL__CG_ENABLE_MASK ;else data &= ~ATHUB_MISC_CNTL__CG_ENABLE_MASK ;
@@ -53,10 +56,13 @@ athub_v2_0_update_medium_grain_light_sleep(struct amdgpu_device *adev, {uint32_t def, data; +if (!((adev->cg_flags &AMD_CG_SUPPORT_MC_LS ) && + (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS ))) +return ; + def = data =RREG32_SOC15 (ATHUB ,0 , mmATHUB_MISC_CNTL); -if (enable && (adev->cg_flags &AMD_CG_SUPPORT_MC_LS ) && - (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS )) +if (enable) data |=ATHUB_MISC_CNTL__CG_MEM_LS_ENABLE_MASK ;else data &= ~ATHUB_MISC_CNTL__CG_MEM_LS_ENABLE_MASK ;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +54 -15
133 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c +8 -2
@@ -568,6 +568,9 @@ static void mmhub_v2_0_update_medium_grain_clock_gating(struct amdgpu_device *ad {uint32_t def, data, def1, data1; +if (!(adev->cg_flags &AMD_CG_SUPPORT_MC_MGCG )) +return ; +switch (adev->asic_type) {case CHIP_SIENNA_CICHLID :case CHIP_NAVY_FLOUNDER :
@@ -582,7 +585,7 @@ static void mmhub_v2_0_update_medium_grain_clock_gating(struct amdgpu_device *adbreak ; } -if (enable && (adev->cg_flags &AMD_CG_SUPPORT_MC_MGCG )) { +if (enable) { data |=MM_ATC_L2_MISC_CG__ENABLE_MASK ; data1 &= ~(DAGB0_CNTL_MISC2__DISABLE_WRREQ_CG_MASK |
@@ -627,6 +630,9 @@ static void mmhub_v2_0_update_medium_grain_light_sleep(struct amdgpu_device *ade {uint32_t def, data; +if (!(adev->cg_flags &AMD_CG_SUPPORT_MC_LS )) +return ; +switch (adev->asic_type) {case CHIP_SIENNA_CICHLID :case CHIP_NAVY_FLOUNDER :
@@ -639,7 +645,7 @@ static void mmhub_v2_0_update_medium_grain_light_sleep(struct amdgpu_device *adebreak ; } -if (enable && (adev->cg_flags &AMD_CG_SUPPORT_MC_LS )) +if (enable) data |=MM_ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK ;else data &= ~MM_ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK ;
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +8 -2
@@ -220,8 +220,11 @@ static void nbio_v2_3_update_medium_grain_clock_gating(struct amdgpu_device *ade {uint32_t def, data; +if (!(adev->cg_flags &AMD_CG_SUPPORT_BIF_MGCG )) +return ; + def = data =RREG32_PCIE (smnCPM_CONTROL); -if (enable && (adev->cg_flags &AMD_CG_SUPPORT_BIF_MGCG )) { +if (enable) { data |= (CPM_CONTROL__LCLK_DYN_GATE_ENABLE_MASK | CPM_CONTROL__TXCLK_DYN_GATE_ENABLE_MASK | CPM_CONTROL__TXCLK_LCNT_GATE_ENABLE_MASK |
@@ -246,8 +249,11 @@ static void nbio_v2_3_update_medium_grain_light_sleep(struct amdgpu_device *adev {uint32_t def, data; +if (!(adev->cg_flags &AMD_CG_SUPPORT_BIF_LS )) +return ; + def = data =RREG32_PCIE (smnPCIE_CNTL2); -if (enable && (adev->cg_flags &AMD_CG_SUPPORT_BIF_LS )) { +if (enable) { data |= (PCIE_CNTL2__SLV_MEM_LS_EN_MASK |PCIE_CNTL2__MST_MEM_LS_EN_MASK |PCIE_CNTL2__REPLAY_MEM_LS_EN_MASK );
drivers/gpu/drm/amd/amdgpu/smuio_v11_0.c +4 -1
@@ -43,9 +43,12 @@ static void smuio_v11_0_update_rom_clock_gating(struct amdgpu_device *adev, boolif (adev->flags &AMD_IS_APU )return ; +if (!(adev->cg_flags &AMD_CG_SUPPORT_ROM_MGCG )) +return ; + def = data =RREG32_SOC15 (SMUIO ,0 , mmCGTT_ROM_CLK_CTRL0); -if (enable && (adev->cg_flags &AMD_CG_SUPPORT_ROM_MGCG )) +if (enable) data &= ~(CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK |CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE1_MASK );else
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v3 6/7 drm/amdgpu: update GFX MGCG settings
In reply to Evan QuanUpdate GFX MGCG related settings.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +7 -4
@@ -7787,11 +7787,11 @@ static void gfx_v10_0_update_medium_grain_clock_gating(struct amdgpu_device *ade {uint32_t data, def; -if (!(adev->cg_flags &AMD_CG_SUPPORT_GFX_MGCG )) +if (!(adev->cg_flags & (AMD_CG_SUPPORT_GFX_MGCG |AMD_CG_SUPPORT_GFX_MGLS )))return ;/* It is disabled by HW by default */ -if (enable) { +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_GFX_MGCG )) {/* 0 - Disable some blocks' MGCG */ WREG32_SOC15 (GC ,0 , mmGRBM_GFX_INDEX,0xe0000000 );WREG32_SOC15 (GC ,0 , mmCGTT_WD_CLK_CTRL,0xff000000 );
@@ -7804,6 +7804,7 @@ static void gfx_v10_0_update_medium_grain_clock_gating(struct amdgpu_device *adeRLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK |RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK |RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK | +RLC_CGTT_MGCG_OVERRIDE__GFXIP_FGCG_OVERRIDE_MASK | RLC_CGTT_MGCG_OVERRIDE__ENABLE_CGTS_LEGACY_MASK);if (def != data)
@@ -7826,13 +7827,15 @@ static void gfx_v10_0_update_medium_grain_clock_gating(struct amdgpu_device *adeWREG32_SOC15 (GC ,0 , mmCP_MEM_SLP_CNTL, data); } } - }else { + }else if (!enable || !(adev->cg_flags &AMD_CG_SUPPORT_GFX_MGCG )) {/* 1 - MGCG_OVERRIDE */ def = data =RREG32_SOC15 (GC ,0 , mmRLC_CGTT_MGCG_OVERRIDE); data |= (RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK |RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK | -RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK ); +RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK | +RLC_CGTT_MGCG_OVERRIDE__GFXIP_FGCG_OVERRIDE_MASK | +RLC_CGTT_MGCG_OVERRIDE__ENABLE_CGTS_LEGACY_MASK );if (def != data)WREG32_SOC15 (GC ,0 , mmRLC_CGTT_MGCG_OVERRIDE, data);
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v3 7/7 drm/amdgpu: update HDP LS settings
In reply to Evan QuanAvoid unnecessary register programming on feature disablement.
--- drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c | 85 +++++++++++++++------------ 1 file changed, 48 insertions(+), 37 deletions(-)
drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c +48 -37
@@ -90,45 +90,56 @@ static void hdp_v5_0_update_mem_power_gating(struct amdgpu_device *adev, RC_MEM_POWER_SD_EN, 0);WREG32_SOC15 (HDP ,0 , mmHDP_MEM_POWER_CTRL, hdp_mem_pwr_cntl); -/* only one clock gating mode (LS/DS/SD) can be enabled */ -if (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS ) { - hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, -HDP_MEM_POWER_CTRL , -IPH_MEM_POWER_LS_EN , enable); - hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, -HDP_MEM_POWER_CTRL , -RC_MEM_POWER_LS_EN , enable); - }else if (adev->cg_flags &AMD_CG_SUPPORT_HDP_DS ) { - hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, -HDP_MEM_POWER_CTRL , -IPH_MEM_POWER_DS_EN , enable); - hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, -HDP_MEM_POWER_CTRL , -RC_MEM_POWER_DS_EN , enable); - }else if (adev->cg_flags &AMD_CG_SUPPORT_HDP_SD ) { - hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, -HDP_MEM_POWER_CTRL , -IPH_MEM_POWER_SD_EN , enable); -/* RC should not use shut down mode, fallback to ds */ - hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, -HDP_MEM_POWER_CTRL , -RC_MEM_POWER_DS_EN , enable); - } - -/* confirmed that IPH_MEM_POWER_CTRL_EN and RC_MEM_POWER_CTRL_EN have to -* be set for SRAM LS/DS/SD */ -if (adev->cg_flags & (AMD_CG_SUPPORT_HDP_LS |AMD_CG_SUPPORT_HDP_DS | -AMD_CG_SUPPORT_HDP_SD )) { - hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , -IPH_MEM_POWER_CTRL_EN ,1 ); - hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , -RC_MEM_POWER_CTRL_EN ,1 ); +/* Already disabled above. The actions below are for "enabled" only */ +if (enable) { +/* only one clock gating mode (LS/DS/SD) can be enabled */ +if (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS ) { + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, +HDP_MEM_POWER_CTRL , +IPH_MEM_POWER_LS_EN ,1 ); + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, +HDP_MEM_POWER_CTRL , +RC_MEM_POWER_LS_EN ,1 ); + }else if (adev->cg_flags &AMD_CG_SUPPORT_HDP_DS ) { + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, +HDP_MEM_POWER_CTRL , +IPH_MEM_POWER_DS_EN ,1 ); + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, +HDP_MEM_POWER_CTRL , +RC_MEM_POWER_DS_EN ,1 ); + }else if (adev->cg_flags &AMD_CG_SUPPORT_HDP_SD ) { + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, +HDP_MEM_POWER_CTRL , +IPH_MEM_POWER_SD_EN ,1 ); +/* RC should not use shut down mode, fallback to ds or ls if allowed */ +if (adev->cg_flags &AMD_CG_SUPPORT_HDP_DS ) + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, +HDP_MEM_POWER_CTRL , +RC_MEM_POWER_DS_EN ,1 ); +else if (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS ) + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl, +HDP_MEM_POWER_CTRL , +RC_MEM_POWER_LS_EN ,1 ); + } + +/* confirmed that IPH_MEM_POWER_CTRL_EN and RC_MEM_POWER_CTRL_EN have to +* be set for SRAM LS/DS/SD */ +if (adev->cg_flags & (AMD_CG_SUPPORT_HDP_LS |AMD_CG_SUPPORT_HDP_DS | +AMD_CG_SUPPORT_HDP_SD )) { + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , +IPH_MEM_POWER_CTRL_EN ,1 ); + hdp_mem_pwr_cntl =REG_SET_FIELD (hdp_mem_pwr_cntl,HDP_MEM_POWER_CTRL , +RC_MEM_POWER_CTRL_EN ,1 ); +WREG32_SOC15 (HDP ,0 , mmHDP_MEM_POWER_CTRL, hdp_mem_pwr_cntl); + } } -WREG32_SOC15 (HDP ,0 , mmHDP_MEM_POWER_CTRL, hdp_mem_pwr_cntl); - -/* restore IPH & RC clock override after clock/power mode changing */ -WREG32_SOC15 (HDP ,0 , mmHDP_CLK_CNTL, hdp_clk_cntl1); +/* disable IPH & RC clock override after clock/power mode changing */ + hdp_clk_cntl =REG_SET_FIELD (hdp_clk_cntl,HDP_CLK_CNTL , +IPH_MEM_CLK_SOFT_OVERRIDE ,0 ); + hdp_clk_cntl =REG_SET_FIELD (hdp_clk_cntl,HDP_CLK_CNTL , +RC_MEM_CLK_SOFT_OVERRIDE ,0 ); +WREG32_SOC15 (HDP ,0 , mmHDP_CLK_CNTL, hdp_clk_cntl); } static void hdp_v5_0_update_medium_grain_clock_gating(struct amdgpu_device *adev,
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
One minor comment below, apart from that the series looks good.
Quoted 76 lines · Evan Quan
Add missing settings for SQC bits. And correct some confusing logics around active wgp bitmap calculation.
Change-Id If4992e175fd61d5609b00328cbe21f487517d039Signed-off-by Evan Quan <[email protected]>---
V1->V2:
- restore correcttcp_harvestsetting for NV10 and NV12
- move asic type guard upper layer for better readability--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 103 ++++++++++++++----------- 1 file changed, 57 insertions(+), 46 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +19
-34@@ -5090,47 +5090,50 @@ static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)4 +/* RMI */ 1); /* SQG */ -if (adev->asic_type ==CHIP_NAVI10 || - adev->asic_type ==CHIP_NAVI14 || - adev->asic_type ==CHIP_NAVI12 ) { -mutex_lock (&adev->grbm_idx_mutex); -for (i =0 ; i < adev->gfx.config.max_shader_engines; i++) { -for (j =0 ; j < adev->gfx.config.max_sh_per_se; j++) { -gfx_v10_0_select_se_sh (adev, i, j,0xffffffff ); - wgp_active_bitmap =gfx_v10_0_get_wgp_active_bitmap_per_sh (adev); -/* -* Set corresponding TCP bits for the inactive WGPs in -* GCRD_SA_TARGETS_DISABLE -*/ - gcrd_targets_disable_tcp =0 ; -/* Set TCP & SQC bits in UTCL1_UTCL0_INVREQ_DISABLE */ - utcl_invreq_disable =0 ; - -for (k =0 ; k < max_wgp_per_sh; k++) { -if (!(wgp_active_bitmap & (1 << k))) { - gcrd_targets_disable_tcp |=3 << (2 * k); - utcl_invreq_disable |= (3 << (2 * k)) | - (3 << (2 * (max_wgp_per_sh + k))); - } +mutex_lock (&adev->grbm_idx_mutex); +for (i =0 ; i < adev->gfx.config.max_shader_engines; i++) { +for (j =0 ; j < adev->gfx.config.max_sh_per_se; j++) { +gfx_v10_0_select_se_sh (adev, i, j,0xffffffff ); + wgp_active_bitmap =gfx_v10_0_get_wgp_active_bitmap_per_sh (adev); +/* +* Set corresponding TCP bits for the inactive WGPs in +* GCRD_SA_TARGETS_DISABLE +*/ + gcrd_targets_disable_tcp =0 ; +/* Set TCP & SQC bits in UTCL1_UTCL0_INVREQ_DISABLE */ + utcl_invreq_disable =0 ; + +for (k =0 ; k < max_wgp_per_sh; k++) { +if (!(wgp_active_bitmap & (1 << k))) { + gcrd_targets_disable_tcp |=3 << (2 * k); + gcrd_targets_disable_tcp |=1 << (k + (max_wgp_per_sh *2 )); + utcl_invreq_disable |= (3 << (2 * k)) | + (3 << (2 * (max_wgp_per_sh + k))); } - - tmp =RREG32_SOC15 (GC ,0 , mmUTCL1_UTCL0_INVREQ_DISABLE); -/* only override TCP & SQC bits */ - tmp &=0xffffffff << (4 * max_wgp_per_sh); - tmp |= (utcl_invreq_disable & utcl_invreq_disable_mask); -WREG32_SOC15 (GC ,0 , mmUTCL1_UTCL0_INVREQ_DISABLE, tmp); - - tmp =RREG32_SOC15 (GC ,0 , mmGCRD_SA_TARGETS_DISABLE); -/* only override TCP bits */ - tmp &=0xffffffff << (2 * max_wgp_per_sh); - tmp |= (gcrd_targets_disable_tcp & gcrd_targets_disable_mask); -WREG32_SOC15 (GC ,0 , mmGCRD_SA_TARGETS_DISABLE, tmp); }
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev) · line 5120
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +6
-3- } -gfx_v10_0_select_se_sh (adev,0xffffffff ,0xffffffff ,0xffffffff ); -mutex_unlock (&adev->grbm_idx_mutex); + tmp =RREG32_SOC15 (GC ,0 , mmUTCL1_UTCL0_INVREQ_DISABLE); +/* only override TCP & SQC bits */ +if (adev->asic_type ==CHIP_NAVI14 ) + tmp &=0xff000000 ; +else + tmp &=0xfff00000 ;
For the disable field mask calculation (which is the value that is applied finally), there is no ASIC check. The above code may utilize the same method as in the original code without ASIC check.
tmp &= 0xffffffff << (4 * max_wgp_per_sh);
Same for below case also - 3*max_wgp_per_sh.
Thanks,
Lijo
Quoted 53 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +30
-6+ tmp |= (utcl_invreq_disable & utcl_invreq_disable_mask); +WREG32_SOC15 (GC ,0 , mmUTCL1_UTCL0_INVREQ_DISABLE, tmp); + + tmp =RREG32_SOC15 (GC ,0 , mmGCRD_SA_TARGETS_DISABLE); +/* only override TCP & SQC bits */ +if (adev->asic_type ==CHIP_NAVI14 ) + tmp &=0xfffc0000 ; +else + tmp &=0xffff8000 ; + tmp |= (gcrd_targets_disable_tcp & gcrd_targets_disable_mask); +WREG32_SOC15 (GC ,0 , mmGCRD_SA_TARGETS_DISABLE, tmp); + } } + +gfx_v10_0_select_se_sh (adev,0xffffffff ,0xffffffff ,0xffffffff ); +mutex_unlock (&adev->grbm_idx_mutex); }static void gfx_v10_0_get_tcc_info (struct amdgpu_device *adev)@@ -7408,7 +7411,10 @@ static int gfx_v10_0_hw_init(void *handle)* init golden registers and rlc resume may override some registers, * reconfig them here */ -gfx_v10_0_tcp_harvest (adev); +if (adev->asic_type ==CHIP_NAVI10 || + adev->asic_type ==CHIP_NAVI14 || + adev->asic_type ==CHIP_NAVI12 ) +gfx_v10_0_tcp_harvest (adev); r =gfx_v10_0_cp_resume (adev);if (r)@@ -9328,17 +9334,22 @@ static void gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(struct amdgpu_device *static u32 gfx_v10_0_get_wgp_active_bitmap_per_sh (struct amdgpu_device *adev) { -u32 data, wgp_bitmask; - data =RREG32_SOC15 (GC ,0 , mmCC_GC_SHADER_ARRAY_CONFIG); - data |=RREG32_SOC15 (GC ,0 , mmGC_USER_SHADER_ARRAY_CONFIG); +u32 disabled_mask = + ~amdgpu_gfx_create_bitmask (adev->gfx.config.max_cu_per_sh >>1 ); +u32 efuse_setting =0 ; +u32 vbios_setting =0 ; + + efuse_setting =RREG32_SOC15 (GC ,0 , mmCC_GC_SHADER_ARRAY_CONFIG); + efuse_setting &=CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS_MASK ; + efuse_setting >>=CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS__SHIFT ; - data &=CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS_MASK ; - data >>=CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS__SHIFT ; + vbios_setting =RREG32_SOC15 (GC ,0 , mmGC_USER_SHADER_ARRAY_CONFIG); + vbios_setting &=GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_WGPS_MASK ; + vbios_setting >>=GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_WGPS__SHIFT ;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(struct amdgpu_device * · line 9355
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2
-3- wgp_bitmask = -amdgpu_gfx_create_bitmask (adev->gfx.config.max_cu_per_sh >>1 ); + disabled_mask |= efuse_setting | vbios_setting; -return (~data) & wgp_bitmask; +return (~disabled_mask); }static u32 gfx_v10_0_get_cu_active_bitmap_per_sh (struct amdgpu_device *adev)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only]
Thanks Lijo.
However, I'm not quite sure whether " 0xffffffff << (4 * max_wgp_per_sh);" is a valid expression since it kind of triggers some overflow. Can that work for non-x86 platform or even work reliably for x86 platform?
BR
Evan
Quoted 206 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, June 21, 2021 8:08 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH V3 1/7] drm/amdgpu: correct tcp harvest settingOne minor comment below, apart from that the series looks good.
Reviewed-by Lijo Lazar <[email protected]>Quoted 11 lines · Evan Quan
Add missing settings for SQC bits. And correct some confusing logics around active wgp bitmap calculation.
Change-Id If4992e175fd61d5609b00328cbe21f487517d039Signed-off-by Evan Quan <[email protected]>---
V1->V2:
- restore correcttcp_harvestsetting for NV10 and NV12
- move asic type guard upper layer for better readability--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 103 ++++++++++++++-----------
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct
Quoted 8 lines
1 file changed, 57 insertions(+), 46 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-0@@ -5090,47 +5090,50 @@ static void gfx_v10_0_tcp_harvest(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-84 +/* RMI */ 1); /* SQG */ -if (adev->asic_type ==CHIP_NAVI10 || - adev->asic_type ==CHIP_NAVI14 || - adev->asic_type ==CHIP_NAVI12 ) { -mutex_lock (&adev->grbm_idx_mutex); -for (i =0 ; i < adev->gfx.config.max_shader_engines; i++) { -for (j =0 ; j < adev->gfx.config.max_sh_per_se; j++) { -gfx_v10_0_select_se_sh (adev, i, j,0xffffffff ); - wgp_active_bitmap =
gfx_v10_0_get_wgp_active_bitmap_per_sh(adev);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5102
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-2-/* -* Set corresponding TCP bits for the inactive WGPs in
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-4-* GCRD_SA_TARGETS_DISABLE -*/ - gcrd_targets_disable_tcp =0 ; -/* Set TCP & SQC bits in
UTCL1_UTCL0_INVREQ_DISABLE*/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-5- utcl_invreq_disable =0 ; - -for (k =0 ; k < max_wgp_per_sh; k++) { -if (!(wgp_active_bitmap & (1 << k))) { - gcrd_targets_disable_tcp |=3 << (2 * k);
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5112
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-1- utcl_invreq_disable |= (3 <<(2 * k)) |
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5113
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-1- (3 << (2 *(
max_wgp_per_sh+ k)));drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5
-1- } +mutex_lock (&adev->grbm_idx_mutex); +for (i =0 ; i < adev->gfx.config.max_shader_engines; i++) { +for (j =0 ; j < adev->gfx.config.max_sh_per_se; j++) { +gfx_v10_0_select_se_sh (adev, i, j,0xffffffff ); + wgp_active_bitmap =
gfx_v10_0_get_wgp_active_bitmap_per_sh(adev);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +6
-0+/* +* Set corresponding TCP bits for the inactive WGPs in +* GCRD_SA_TARGETS_DISABLE +*/ + gcrd_targets_disable_tcp =0 ; +/* Set TCP & SQC bits in
UTCL1_UTCL0_INVREQ_DISABLE*/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5
-0+ utcl_invreq_disable =0 ; + +for (k =0 ; k < max_wgp_per_sh; k++) { +if (!(wgp_active_bitmap & (1 << k))) { + gcrd_targets_disable_tcp |= 3 << (2 *k);
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5109
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ gcrd_targets_disable_tcp |= 1 << (k +(
max_wgp_per_sh* 2));drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5111
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2
-0+ utcl_invreq_disable |= (3 << (2 * k)) | + (3 << (2 * (max_wgp_per_sh+ k)));
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-2} - - tmp = RREG32_SOC15(GC, 0,
mmUTCL1_UTCL0_INVREQ_DISABLE);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-3-/* only override TCP & SQC bits */ - tmp &=0xffffffff << (4 * max_wgp_per_sh); - tmp |= (utcl_invreq_disable &
utcl_invreq_disable_mask);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5121
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-1- WREG32_SOC15(GC, 0,
mmUTCL1_UTCL0_INVREQ_DISABLE, tmp);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5123
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-2- - tmp = RREG32_SOC15(GC, 0,
mmGCRD_SA_TARGETS_DISABLE);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-3-/* only override TCP bits */ - tmp &=0xffffffff << (2 * max_wgp_per_sh); - tmp |= (gcrd_targets_disable_tcp &
gcrd_targets_disable_mask);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5127
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-1- WREG32_SOC15(GC, 0,
mmGCRD_SA_TARGETS_DISABLE, tmp);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-3} - } -gfx_v10_0_select_se_sh (adev,0xffffffff ,0xffffffff ,0xffffffff ); -mutex_unlock (&adev->grbm_idx_mutex); + tmp = RREG32_SOC15(GC, 0,
mmUTCL1_UTCL0_INVREQ_DISABLE);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev) · line 5120
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5
-0+/* only override TCP & SQC bits */ +if (adev->asic_type ==CHIP_NAVI14 ) + tmp &=0xff000000 ; +else + tmp &=0xfff00000 ;For the disable field mask calculation (which is the value that is applied finally), there is no ASIC check. The above code may utilize the same method as in the original code without ASIC check.
tmp &=
0xffffffff<< (4 *max_wgp_per_sh);Same for below case also - 3*max_wgp_per_sh.
Thanks,
Lijodrivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5121
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ tmp |= (utcl_invreq_disable &
utcl_invreq_disable_mask);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5122
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ WREG32_SOC15(GC, 0,
mmUTCL1_UTCL0_INVREQ_DISABLE, tmp);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5124
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2
-0+ + tmp = RREG32_SOC15(GC, 0,
mmGCRD_SA_TARGETS_DISABLE);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +6
-0+/* only override TCP & SQC bits */ +if (adev->asic_type ==CHIP_NAVI14 ) + tmp &=0xfffc0000 ; +else + tmp &=0xffff8000 ; + tmp |= (gcrd_targets_disable_tcp &
gcrd_targets_disable_mask);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5131
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ WREG32_SOC15(GC, 0,
mmGCRD_SA_TARGETS_DISABLE, tmp);Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +8
-2+} } + +gfx_v10_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); +mutex_unlock(&adev->grbm_idx_mutex); } static void gfx_v10_0_get_tcc_info(struct amdgpu_device *adev) @@ -7408,7 +7411,10 @@ static int gfx_v10_0_hw_init(void *handle) * init golden registers and rlc resume may override some registers, * reconfig them here */ -gfx_v10_0_tcp_harvest (adev); +if (adev->asic_type ==CHIP_NAVI10 || + adev->asic_type ==CHIP_NAVI14 || + adev->asic_type ==CHIP_NAVI12 ) +gfx_v10_0_tcp_harvest (adev); r =gfx_v10_0_cp_resume (adev);if (r)@@ -9328,17 +9334,22 @@ static voidQuoted 1 line
gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(struct
amdgpu_device*
Quoted 2 lines
static u32 gfx_v10_0_get_wgp_active_bitmap_per_sh(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(struct amdgpu_device *
Quoted 4 lines
{drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-3-u32 data, wgp_bitmask; - data =RREG32_SOC15 (GC ,0 , mmCC_GC_SHADER_ARRAY_CONFIG); - data |= RREG32_SOC15(GC, 0,
mmGC_USER_SHADER_ARRAY_CONFIG);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(struct amdgpu_device *
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2
-0+u32 disabled_mask = + ~amdgpu_gfx_create_bitmask(adev-gfx.config.max_cu_per_sh >> 1);
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4
-0+u32 efuse_setting =0 ; +u32 vbios_setting =0 ; + + efuse_setting = RREG32_SOC15(GC, 0,
mmCC_GC_SHADER_ARRAY_CONFIG);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ efuse_setting &=
CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS_MASK;drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ efuse_setting >>=
CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS__SHIFT;drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-2- data &=CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS_MASK ; - data >>=
CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS__SHIFT;drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ vbios_setting = RREG32_SOC15(GC, 0,
mmGC_USER_SHADER_ARRAY_CONFIG);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ vbios_setting &=
GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_WGPS_MASK;drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ vbios_setting >>=
GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_WGPS__SHIFT;Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-2- wgp_bitmask = - amdgpu_gfx_create_bitmask(adev-gfx.config.max_cu_per_sh >> 1);
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ disabled_mask |= efuse_setting | vbios_setting;
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-1-return (~data) & wgp_bitmask; +return (~disabled_mask); } static u32 gfx_v10_0_get_cu_active_bitmap_per_sh(struct
amdgpu_device*adev)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[Public]
AFAIK, that expression is legal (some code analyzer may warn on value of 4*max_wgp_per_sh); similar kind is used in rotate shift operations.
Thanks,
Lijo
-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Tuesday, June 22, 2021 7:56 AM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH V3 1/7] drm/amdgpu: correct tcp harvest setting
[AMD Official Use Only]
Thanks Lijo.
However, I'm not quite sure whether " 0xffffffff << (4 * max_wgp_per_sh);" is a valid expression since it kind of triggers some overflow. Can that work for non-x86 platform or even work reliably for x86 platform?
BR
Evan
Quoted 206 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, June 21, 2021 8:08 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH V3 1/7] drm/amdgpu: correct tcp harvest settingOne minor comment below, apart from that the series looks good.
Reviewed-by Lijo Lazar <[email protected]>Quoted 11 lines · Evan Quan
Add missing settings for SQC bits. And correct some confusing logics around active wgp bitmap calculation.
Change-Id If4992e175fd61d5609b00328cbe21f487517d039Signed-off-by Evan Quan <[email protected]>---
V1->V2:
- restore correcttcp_harvestsetting for NV10 and NV12
- move asic type guard upper layer for better readability--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 103 ++++++++++++++-----------
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct
Quoted 8 lines
1 file changed, 57 insertions(+), 46 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-0@@ -5090,47 +5090,50 @@ static void gfx_v10_0_tcp_harvest(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-84 +/* RMI */ 1); /* SQG */ -if (adev->asic_type ==CHIP_NAVI10 || - adev->asic_type ==CHIP_NAVI14 || - adev->asic_type ==CHIP_NAVI12 ) { -mutex_lock (&adev->grbm_idx_mutex); -for (i =0 ; i < adev->gfx.config.max_shader_engines; i++) { -for (j =0 ; j < adev->gfx.config.max_sh_per_se; j++) { -gfx_v10_0_select_se_sh (adev, i, j,0xffffffff ); - wgp_active_bitmap =
gfx_v10_0_get_wgp_active_bitmap_per_sh(adev);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5102
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-2-/* -* Set corresponding TCP bits for the inactive WGPs in
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-4-* GCRD_SA_TARGETS_DISABLE -*/ - gcrd_targets_disable_tcp =0 ; -/* Set TCP & SQC bits in
UTCL1_UTCL0_INVREQ_DISABLE*/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-5- utcl_invreq_disable =0 ; - -for (k =0 ; k < max_wgp_per_sh; k++) { -if (!(wgp_active_bitmap & (1 << k))) { - gcrd_targets_disable_tcp |=3 << (2 * k);
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5112
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-1- utcl_invreq_disable |= (3 <<(2 * k)) |
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5113
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-1- (3 << (2 *(
max_wgp_per_sh+ k)));drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5
-1- } +mutex_lock (&adev->grbm_idx_mutex); +for (i =0 ; i < adev->gfx.config.max_shader_engines; i++) { +for (j =0 ; j < adev->gfx.config.max_sh_per_se; j++) { +gfx_v10_0_select_se_sh (adev, i, j,0xffffffff ); + wgp_active_bitmap =
gfx_v10_0_get_wgp_active_bitmap_per_sh(adev);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +6
-0+/* +* Set corresponding TCP bits for the inactive WGPs in +* GCRD_SA_TARGETS_DISABLE +*/ + gcrd_targets_disable_tcp =0 ; +/* Set TCP & SQC bits in
UTCL1_UTCL0_INVREQ_DISABLE*/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5
-0+ utcl_invreq_disable =0 ; + +for (k =0 ; k < max_wgp_per_sh; k++) { +if (!(wgp_active_bitmap & (1 << k))) { + gcrd_targets_disable_tcp |= 3 << (2 *k);
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5109
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ gcrd_targets_disable_tcp |= 1 << (k +(
max_wgp_per_sh* 2));drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5111
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2
-0+ utcl_invreq_disable |= (3 << (2 * k)) | + (3 << (2 * (max_wgp_per_sh+ k)));
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-2} - - tmp = RREG32_SOC15(GC, 0,
mmUTCL1_UTCL0_INVREQ_DISABLE);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-3-/* only override TCP & SQC bits */ - tmp &=0xffffffff << (4 * max_wgp_per_sh); - tmp |= (utcl_invreq_disable &
utcl_invreq_disable_mask);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5121
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-1- WREG32_SOC15(GC, 0,
mmUTCL1_UTCL0_INVREQ_DISABLE, tmp);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5123
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-2- - tmp = RREG32_SOC15(GC, 0,
mmGCRD_SA_TARGETS_DISABLE);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-3-/* only override TCP bits */ - tmp &=0xffffffff << (2 * max_wgp_per_sh); - tmp |= (gcrd_targets_disable_tcp &
gcrd_targets_disable_mask);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5127
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-1- WREG32_SOC15(GC, 0,
mmGCRD_SA_TARGETS_DISABLE, tmp);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-3} - } -gfx_v10_0_select_se_sh (adev,0xffffffff ,0xffffffff ,0xffffffff ); -mutex_unlock (&adev->grbm_idx_mutex); + tmp = RREG32_SOC15(GC, 0,
mmUTCL1_UTCL0_INVREQ_DISABLE);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev) · line 5120
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5
-0+/* only override TCP & SQC bits */ +if (adev->asic_type ==CHIP_NAVI14 ) + tmp &=0xff000000 ; +else + tmp &=0xfff00000 ;For the disable field mask calculation (which is the value that is applied finally), there is no ASIC check. The above code may utilize the same method as in the original code without ASIC check.
tmp &=
0xffffffff<< (4 *max_wgp_per_sh);Same for below case also - 3*max_wgp_per_sh.
Thanks,
Lijodrivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5121
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ tmp |= (utcl_invreq_disable &
utcl_invreq_disable_mask);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5122
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ WREG32_SOC15(GC, 0,
mmUTCL1_UTCL0_INVREQ_DISABLE, tmp);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5124
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2
-0+ + tmp = RREG32_SOC15(GC, 0,
mmGCRD_SA_TARGETS_DISABLE);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +6
-0+/* only override TCP & SQC bits */ +if (adev->asic_type ==CHIP_NAVI14 ) + tmp &=0xfffc0000 ; +else + tmp &=0xffff8000 ; + tmp |= (gcrd_targets_disable_tcp &
gcrd_targets_disable_mask);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_tcp_harvest(struct · line 5131
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ WREG32_SOC15(GC, 0,
mmGCRD_SA_TARGETS_DISABLE, tmp);Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +8
-2+} } + +gfx_v10_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); +mutex_unlock(&adev->grbm_idx_mutex); } static void gfx_v10_0_get_tcc_info(struct amdgpu_device *adev) @@ -7408,7 +7411,10 @@ static int gfx_v10_0_hw_init(void *handle) * init golden registers and rlc resume may override some registers, * reconfig them here */ -gfx_v10_0_tcp_harvest (adev); +if (adev->asic_type ==CHIP_NAVI10 || + adev->asic_type ==CHIP_NAVI14 || + adev->asic_type ==CHIP_NAVI12 ) +gfx_v10_0_tcp_harvest (adev); r =gfx_v10_0_cp_resume (adev);if (r)@@ -9328,17 +9334,22 @@ static voidQuoted 1 line
gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(struct
amdgpu_device*
Quoted 2 lines
static u32 gfx_v10_0_get_wgp_active_bitmap_per_sh(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(struct amdgpu_device *
Quoted 4 lines
{drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-3-u32 data, wgp_bitmask; - data =RREG32_SOC15 (GC ,0 , mmCC_GC_SHADER_ARRAY_CONFIG); - data |= RREG32_SOC15(GC, 0,
mmGC_USER_SHADER_ARRAY_CONFIG);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(struct amdgpu_device *
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2
-0+u32 disabled_mask = + ~amdgpu_gfx_create_bitmask(adev-gfx.config.max_cu_per_sh >> 1);
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4
-0+u32 efuse_setting =0 ; +u32 vbios_setting =0 ; + + efuse_setting = RREG32_SOC15(GC, 0,
mmCC_GC_SHADER_ARRAY_CONFIG);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ efuse_setting &=
CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS_MASK;drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ efuse_setting >>=
CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS__SHIFT;drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-2- data &=CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS_MASK ; - data >>=
CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_WGPS__SHIFT;drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ vbios_setting = RREG32_SOC15(GC, 0,
mmGC_USER_SHADER_ARRAY_CONFIG);drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ vbios_setting &=
GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_WGPS_MASK;drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ vbios_setting >>=
GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_WGPS__SHIFT;Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0
-2- wgp_bitmask = - amdgpu_gfx_create_bitmask(adev-gfx.config.max_cu_per_sh >> 1);
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-0+ disabled_mask |= efuse_setting | vbios_setting;
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-1-return (~data) & wgp_bitmask; +return (~disabled_mask); } static u32 gfx_v10_0_get_cu_active_bitmap_per_sh(struct
amdgpu_device*adev)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 3 lines · Lijo
[Public]
AFAIK, that expression is legal (some code analyzer may warn on value of 4*max_wgp_per_sh); similar kind is used in rotate shift operations.
The default type for constants in C is int, so 0xffffffff is a 32-bit signed integer.
The C99 specification lists this under J.2 Undefined behavior:
— An expression having signed promoted type is left-shifted and either the value of the
expression is negative or the result of shifting would be not be representable in the promoted type (6.5.7).
So it would be safer to make it unsigned: 0xffffffffu (or just ~0u).
Quoted 12 lines
-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Tuesday, June 22, 2021 7:56 AM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH V3 1/7] drm/amdgpu: correct tcp harvest setting[AMD Official Use Only]
Thanks Lijo.
However, I'm not quite sure whether "0xffffffff<< (4 *max_wgp_per_sh);" is a valid expression since it kind of triggers some overflow. Can that work for non-x86 platform or even work reliably for x86 platform?
Signature · 6 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 6 lines · Michel Dänzer
Quoted 3 lines · Lijo
[Public]
AFAIK, that expression is legal (some code analyzer may warn on value of 4*max_wgp_per_sh); similar kind is used in rotate shift operations.
The default type for constants in C is int, so
0xffffffffis a 32-bit signed integer.
Probably not as per section 6.4.4.
"The type of an integer constant is the first of the corresponding list in which its value can be represented."
It is a hexadecimal constant and the first to fit this value is unsigned int. Regardless, adding u suffix will avoid any ambiguity.
Thanks,
Lijo
Quoted 25 lines
The C99 specification lists this under J.2 Undefined behavior:
— An expression having signed promoted type is left-shifted and either the value of the
expression is negative or the result of shifting would be not be representable in the promoted type (6.5.7).So it would be safer to make it unsigned:
0xffffffffu(or just ~0u).Quoted 12 lines
-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Tuesday, June 22, 2021 7:56 AM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH V3 1/7] drm/amdgpu: correct tcp harvest setting[AMD Official Use Only]
Thanks Lijo.
However, I'm not quite sure whether "0xffffffff<< (4 *max_wgp_per_sh);" is a valid expression since it kind of triggers some overflow. Can that work for non-x86 platform or even work reliably for x86 platform?
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only]
Thanks for the information. I will use 0xffffffffu then.
BR
Evan
Quoted 51 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, June 22, 2021 6:40 PM
To: Michel Dänzer <[email protected]>; Quan, Evan <[email protected]>
Cc: Deucher, Alexander <[email protected]>; amd- [email protected]
Subject: Re: [PATCH V3 1/7] drm/amdgpu: correct tcp harvest settingQuoted 4 lines · Michel Dänzer
Quoted 3 lines · Lijo
[Public]
AFAIK, that expression is legal (some code analyzer may warn on value of
4*max_wgp_per_sh); similar kind is used in rotate shift operations.
Quoted 2 lines
The default type for constants in C is int, so
0xffffffffis a 32-bit signedinteger.
Probably not as per section 6.4.4.
"The type of an integer constant is the first of the corresponding list in which its value can be represented."
It is a hexadecimal constant and the first to fit this value is unsigned int. Regardless, adding u suffix will avoid any ambiguity.
Thanks,
LijoQuoted 4 lines
The C99 specification lists this under J.2 Undefined behavior:
— An expression having signed promoted type is left-shifted and either
the value of the
Quoted 1 line
expression is negative or the result of shifting would be not be
representable in the
Quoted 12 lines
promoted type (6.5.7).
So it would be safer to make it unsigned:
0xffffffffu(or just ~0u).Quoted 7 lines
-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Tuesday, June 22, 2021 7:56 AM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH V3 1/7] drm/amdgpu: correct tcp harvest setting
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
[AMD Official Use Only]
Thanks Lijo.
However, I'm not quite sure whether "0xffffffff<< (4 *
max_wgp_per_sh);" is a valid expression since it kind of triggers some overflow.Quoted 4 lines
Quoted 1 line
Can that work for non-x86 platform or even work reliably for x86 platform?
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 6 lines · Lijo
Quoted 5 lines · Michel Dänzer
Quoted 3 lines · Lijo
[Public]
AFAIK, that expression is legal (some code analyzer may warn on value of 4*max_wgp_per_sh); similar kind is used in rotate shift operations.
Quoted 7 lines
Quoted 1 line
The default type for constants in C is int, so
0xffffffffis a 32-bit signed integer.Probably not as per section 6.4.4.
"The type of an integer constant is the first of the corresponding list in which its value can be represented."
It is a hexadecimal constant and the first to fit this value is unsigned int.
Ah, indeed, thanks.
Signature · 6 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx