Misc amdgpu patches
Subsystems (2)
This is just a bunch of patches that I've been carrying in my -wip tree for a while. Some are minor updates to previous versions I've sent out.
- Fixes to non-DAL modesetting code for Polaris
- Clockgating fixes and enablement
- Misc powerplay bug fixes
- Misc bug fixes and cleanups
I meant to send these out last week, but time got away from me.
Alex
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu/dce11: fix vertical bars appear on monitor
From: Vitaly Prosyak <[email protected]>
Fixed mc stop and resume hardware programming sequence.
--- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 65 +++------------------------------- 1 file changed, 5 insertions(+), 60 deletions(-)
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +5 -60
@@ -565,35 +565,14 @@ static void dce_v11_0_stop_mc_access(struct amdgpu_device *adev, crtc_enabled =REG_GET_FIELD (RREG32 (mmCRTC_CONTROL + crtc_offsets[i]),CRTC_CONTROL ,CRTC_MASTER_EN );if (crtc_enabled) { -#if 0 -u32 frame_count; -int j; - +#if 1 save->crtc_enabled[i] = true; tmp =RREG32 (mmCRTC_BLANK_CONTROL + crtc_offsets[i]);if (REG_GET_FIELD (tmp,CRTC_BLANK_CONTROL ,CRTC_BLANK_DATA_EN ) ==0 ) { -amdgpu_display_vblank_wait (adev, i); -WREG32 (mmCRTC_UPDATE_LOCK + crtc_offsets[i],1 ); +/*it is correct only for RGB ; black is 0*/ +WREG32 (mmCRTC_BLANK_DATA_COLOR + crtc_offsets[i],0 ); tmp =REG_SET_FIELD (tmp,CRTC_BLANK_CONTROL ,CRTC_BLANK_DATA_EN ,1 );WREG32 (mmCRTC_BLANK_CONTROL + crtc_offsets[i], tmp); -WREG32 (mmCRTC_UPDATE_LOCK + crtc_offsets[i],0 ); - } -/* wait for the next frame */ - frame_count =amdgpu_display_vblank_get_counter (adev, i); -for (j =0 ; j < adev->usec_timeout; j++) { -if (amdgpu_display_vblank_get_counter (adev, i) != frame_count) -break ; -udelay (1 ); - } - tmp =RREG32 (mmGRPH_UPDATE + crtc_offsets[i]); -if (REG_GET_FIELD (tmp,GRPH_UPDATE ,GRPH_UPDATE_LOCK ) ==0 ) { - tmp =REG_SET_FIELD (tmp,GRPH_UPDATE ,GRPH_UPDATE_LOCK ,1 ); -WREG32 (mmGRPH_UPDATE + crtc_offsets[i], tmp); - } - tmp =RREG32 (mmCRTC_MASTER_UPDATE_LOCK + crtc_offsets[i]); -if (REG_GET_FIELD (tmp,CRTC_MASTER_UPDATE_LOCK ,MASTER_UPDATE_LOCK ) ==0 ) { - tmp =REG_SET_FIELD (tmp,CRTC_MASTER_UPDATE_LOCK ,MASTER_UPDATE_LOCK ,1 ); -WREG32 (mmCRTC_MASTER_UPDATE_LOCK + crtc_offsets[i], tmp); }#else /* XXX this is a hack to avoid strange behavior with EFI on certain systems */
@@ -614,54 +593,20 @@ static void dce_v11_0_stop_mc_access(struct amdgpu_device *adev,static void dce_v11_0_resume_mc_access (struct amdgpu_device *adev,struct amdgpu_mode_mc_save *save) { -u32 tmp, frame_count; -int i, j; +u32 tmp; +int i;/* update crtc base addresses */ for (i =0 ; i < adev->mode_info.num_crtc; i++) {WREG32 (mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + crtc_offsets[i],upper_32_bits (adev->mc.vram_start)); -WREG32 (mmGRPH_SECONDARY_SURFACE_ADDRESS_HIGH + crtc_offsets[i], -upper_32_bits (adev->mc.vram_start));WREG32 (mmGRPH_PRIMARY_SURFACE_ADDRESS + crtc_offsets[i], (u32 )adev->mc.vram_start); -WREG32 (mmGRPH_SECONDARY_SURFACE_ADDRESS + crtc_offsets[i], - (u32 )adev->mc.vram_start);if (save->crtc_enabled[i]) { - tmp =RREG32 (mmCRTC_MASTER_UPDATE_MODE + crtc_offsets[i]); -if (REG_GET_FIELD (tmp,CRTC_MASTER_UPDATE_MODE ,MASTER_UPDATE_MODE ) !=3 ) { - tmp =REG_SET_FIELD (tmp,CRTC_MASTER_UPDATE_MODE ,MASTER_UPDATE_MODE ,3 ); -WREG32 (mmCRTC_MASTER_UPDATE_MODE + crtc_offsets[i], tmp); - } - tmp =RREG32 (mmGRPH_UPDATE + crtc_offsets[i]); -if (REG_GET_FIELD (tmp,GRPH_UPDATE ,GRPH_UPDATE_LOCK )) { - tmp =REG_SET_FIELD (tmp,GRPH_UPDATE ,GRPH_UPDATE_LOCK ,0 ); -WREG32 (mmGRPH_UPDATE + crtc_offsets[i], tmp); - } - tmp =RREG32 (mmCRTC_MASTER_UPDATE_LOCK + crtc_offsets[i]); -if (REG_GET_FIELD (tmp,CRTC_MASTER_UPDATE_LOCK ,MASTER_UPDATE_LOCK )) { - tmp =REG_SET_FIELD (tmp,CRTC_MASTER_UPDATE_LOCK ,MASTER_UPDATE_LOCK ,0 ); -WREG32 (mmCRTC_MASTER_UPDATE_LOCK + crtc_offsets[i], tmp); - } -for (j =0 ; j < adev->usec_timeout; j++) { - tmp =RREG32 (mmGRPH_UPDATE + crtc_offsets[i]); -if (REG_GET_FIELD (tmp,GRPH_UPDATE ,GRPH_SURFACE_UPDATE_PENDING ) ==0 ) -break ; -udelay (1 ); - } tmp =RREG32 (mmCRTC_BLANK_CONTROL + crtc_offsets[i]); tmp =REG_SET_FIELD (tmp,CRTC_BLANK_CONTROL ,CRTC_BLANK_DATA_EN ,0 ); -WREG32 (mmCRTC_UPDATE_LOCK + crtc_offsets[i],1 );WREG32 (mmCRTC_BLANK_CONTROL + crtc_offsets[i], tmp); -WREG32 (mmCRTC_UPDATE_LOCK + crtc_offsets[i],0 ); -/* wait for the next frame */ - frame_count =amdgpu_display_vblank_get_counter (adev, i); -for (j =0 ; j < adev->usec_timeout; j++) { -if (amdgpu_display_vblank_get_counter (adev, i) != frame_count) -break ; -udelay (1 ); - } } }
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/amdgpu: Add SW clock gating support to UVD 5 and 6
In reply to Alex DeucherFrom: Tom St Denis <[email protected]>
This patch adds support for software clock gating to UVD 5 and UVD 6 blocks with a preliminary commented out hardware gating routine.
Currently hardware gating does not work so it's not activated.
--- drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 115 ++++++++++++++ drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 281 ++++++++++++++-------------------- 2 files changed, 232 insertions(+), 164 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +115 -0
@@ -31,6 +31,7 @@#include "uvd/uvd_5_0_sh_mask.h" #include "oss/oss_2_0_d.h" #include "oss/oss_2_0_sh_mask.h" +#include "vi.h" static void uvd_v5_0_set_ring_funcs (struct amdgpu_device *adev);static void uvd_v5_0_set_irq_funcs (struct amdgpu_device *adev);
@@ -754,14 +755,128 @@ static int uvd_v5_0_process_interrupt(struct amdgpu_device *adev,return 0 ; } +static void uvd_v5_0_set_sw_clock_gating (struct amdgpu_device *adev) +{ +uint32_t data, data1, data2, suvd_flags; + + data =RREG32 (mmUVD_CGC_CTRL); + data1 =RREG32 (mmUVD_SUVD_CGC_GATE); + data2 =RREG32 (mmUVD_SUVD_CGC_CTRL); + + data &= ~(UVD_CGC_CTRL__CLK_OFF_DELAY_MASK | +UVD_CGC_CTRL__CLK_GATE_DLY_TIMER_MASK ); + + suvd_flags =UVD_SUVD_CGC_GATE__SRE_MASK | +UVD_SUVD_CGC_GATE__SIT_MASK | +UVD_SUVD_CGC_GATE__SMP_MASK | +UVD_SUVD_CGC_GATE__SCM_MASK | +UVD_SUVD_CGC_GATE__SDB_MASK ; + + data |=UVD_CGC_CTRL__DYN_CLOCK_MODE_MASK | + (1 <<REG_FIELD_SHIFT (UVD_CGC_CTRL ,CLK_GATE_DLY_TIMER )) | + (4 <<REG_FIELD_SHIFT (UVD_CGC_CTRL ,CLK_OFF_DELAY )); + + data &= ~(UVD_CGC_CTRL__UDEC_RE_MODE_MASK | +UVD_CGC_CTRL__UDEC_CM_MODE_MASK | +UVD_CGC_CTRL__UDEC_IT_MODE_MASK | +UVD_CGC_CTRL__UDEC_DB_MODE_MASK | +UVD_CGC_CTRL__UDEC_MP_MODE_MASK | +UVD_CGC_CTRL__SYS_MODE_MASK | +UVD_CGC_CTRL__UDEC_MODE_MASK | +UVD_CGC_CTRL__MPEG2_MODE_MASK | +UVD_CGC_CTRL__REGS_MODE_MASK | +UVD_CGC_CTRL__RBC_MODE_MASK | +UVD_CGC_CTRL__LMI_MC_MODE_MASK | +UVD_CGC_CTRL__LMI_UMC_MODE_MASK | +UVD_CGC_CTRL__IDCT_MODE_MASK | +UVD_CGC_CTRL__MPRD_MODE_MASK | +UVD_CGC_CTRL__MPC_MODE_MASK | +UVD_CGC_CTRL__LBSI_MODE_MASK | +UVD_CGC_CTRL__LRBBM_MODE_MASK | +UVD_CGC_CTRL__WCB_MODE_MASK | +UVD_CGC_CTRL__VCPU_MODE_MASK | +UVD_CGC_CTRL__JPEG_MODE_MASK | +UVD_CGC_CTRL__SCPU_MODE_MASK ); + data2 &= ~(UVD_SUVD_CGC_CTRL__SRE_MODE_MASK | +UVD_SUVD_CGC_CTRL__SIT_MODE_MASK | +UVD_SUVD_CGC_CTRL__SMP_MODE_MASK | +UVD_SUVD_CGC_CTRL__SCM_MODE_MASK | +UVD_SUVD_CGC_CTRL__SDB_MODE_MASK ); + data1 |= suvd_flags; + +WREG32 (mmUVD_CGC_CTRL, data); +WREG32 (mmUVD_CGC_GATE,0 ); +WREG32 (mmUVD_SUVD_CGC_GATE, data1); +WREG32 (mmUVD_SUVD_CGC_CTRL, data2); +} + +#if 0 +static void uvd_v5_0_set_hw_clock_gating (struct amdgpu_device *adev) +{ +uint32_t data, data1, cgc_flags, suvd_flags; + + data =RREG32 (mmUVD_CGC_GATE); + data1 =RREG32 (mmUVD_SUVD_CGC_GATE); + + cgc_flags =UVD_CGC_GATE__SYS_MASK | +UVD_CGC_GATE__UDEC_MASK | +UVD_CGC_GATE__MPEG2_MASK | +UVD_CGC_GATE__RBC_MASK | +UVD_CGC_GATE__LMI_MC_MASK | +UVD_CGC_GATE__IDCT_MASK | +UVD_CGC_GATE__MPRD_MASK | +UVD_CGC_GATE__MPC_MASK | +UVD_CGC_GATE__LBSI_MASK | +UVD_CGC_GATE__LRBBM_MASK | +UVD_CGC_GATE__UDEC_RE_MASK | +UVD_CGC_GATE__UDEC_CM_MASK | +UVD_CGC_GATE__UDEC_IT_MASK | +UVD_CGC_GATE__UDEC_DB_MASK | +UVD_CGC_GATE__UDEC_MP_MASK | +UVD_CGC_GATE__WCB_MASK | +UVD_CGC_GATE__VCPU_MASK | +UVD_CGC_GATE__SCPU_MASK ; + + suvd_flags =UVD_SUVD_CGC_GATE__SRE_MASK | +UVD_SUVD_CGC_GATE__SIT_MASK | +UVD_SUVD_CGC_GATE__SMP_MASK | +UVD_SUVD_CGC_GATE__SCM_MASK | +UVD_SUVD_CGC_GATE__SDB_MASK ; + + data |= cgc_flags; + data1 |= suvd_flags; + +WREG32 (mmUVD_CGC_GATE, data); +WREG32 (mmUVD_SUVD_CGC_GATE, data1); +} +#endif +static int uvd_v5_0_set_clockgating_state (void *handle,enum amd_clockgating_state state) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +bool enable = (state ==AMD_CG_STATE_GATE ) ? true : false; +static int curstate =-1 ;if (!(adev->cg_flags &AMD_CG_SUPPORT_UVD_MGCG ))return 0 ; +if (curstate == state) +return 0 ; + + curstate = state; +if (enable) { +/* disable HW gating and enable Sw gating */ +uvd_v5_0_set_sw_clock_gating (adev); + }else { +/* wait for STATUS to clear */ +if (uvd_v5_0_wait_for_idle (handle)) +return -EBUSY ; + +/* enable HW gates because UVD is idle */ +/* uvd_v5_0_set_hw_clock_gating(adev); */ + } +return 0 ; }
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +117 -164
327 lines not on this page · raw message
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/amdgpu: Enable clockgating for UVD5 on Tonga
In reply to Alex DeucherFrom: Tom St Denis <[email protected]>
This patch enables clock gating for the UVD5 block with Tonga.
--- drivers/gpu/drm/amd/amdgpu/vi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vi.c +1 -1
@@ -1081,7 +1081,7 @@ static int vi_common_early_init(void *handle) adev->external_rev_id = adev->rev_id +0x3c ;break ;case CHIP_TONGA : - adev->cg_flags =0 ; + adev->cg_flags =AMD_CG_SUPPORT_UVD_MGCG ; adev->pg_flags =0 ; adev->external_rev_id = adev->rev_id +0x14 ;break ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/amdgpu: Enable clockgating in UVD6 for Stoney
In reply to Alex DeucherFrom: Tom St Denis <[email protected]>
This patch enables clockgating for the UVD6 block in Stoney.
--- drivers/gpu/drm/amd/amdgpu/vi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vi.c +5 -1
@@ -1086,11 +1086,15 @@ static int vi_common_early_init(void *handle) adev->external_rev_id = adev->rev_id +0x14 ;break ;case CHIP_CARRIZO : -case CHIP_STONEY : adev->cg_flags =0 ; adev->pg_flags =0 ; adev->external_rev_id = adev->rev_id +0x1 ;break ; +case CHIP_STONEY : + adev->cg_flags =AMD_CG_SUPPORT_UVD_MGCG ; + adev->pg_flags =0 ; + adev->external_rev_id = adev->rev_id +0x1 ; +break ;default :/* FIXME: not supported yet */ return -EINVAL ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: use min_clock_in_sr for deep sleep feature.
In reply to Alex DeucherFrom: Rex Zhu <[email protected]>
This comes from the display handling code.
--- drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | 50 ++++++++++++++---------- 1 file changed, 30 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +30 -20
@@ -1885,6 +1885,23 @@ static int fiji_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,return 0 ; } + +static uint8_t fiji_get_sleep_divider_id_from_clock (struct pp_hwmgr *hwmgr, +uint32_t clock,uint32_t clock_insr) +{ +uint8_t i; +uint32_t temp; +uint32_t min = clock_insr >2500 ? clock_insr :2500 ; + + PP_ASSERT_WITH_CODE((clock >= min), "Engine clock can't satisfy stutter requirement!", return 0); +for (i =FIJI_MAX_DEEPSLEEP_DIVIDER_ID ; ; i--) { + temp = clock / (1UL << i); + +if (temp >= min || i ==0 ) +break ; + } +return i; +}/** * Populates single SMC SCLK structure using the provided engine clock *
@@ -1928,17 +1945,13 @@ static int fiji_populate_single_graphic_level(struct pp_hwmgr *hwmgr, threshold = clock * data->fast_watermark_threshold /100 ; -/* -* TODO: get minimum clocks from dal configaration -* PECI_GetMinClockSettings(hwmgr->pPECI, &minClocks); -*/ -/* data->DisplayTiming.minClockInSR = minClocks.engineClockInSR; */ -/* get level->DeepSleepDivId -if (phm_cap_enabled(hwmgr->platformDescriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) -{ -level->DeepSleepDivId = PhwFiji_GetSleepDividerIdFromClock(hwmgr, clock, minClocks.engineClockInSR); -} */ + data->display_timing.min_clock_in_sr = hwmgr->display_config.min_core_set_clock_in_sr; + +if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) + level->DeepSleepDivId =fiji_get_sleep_divider_id_from_clock (hwmgr, clock, + hwmgr->display_config.min_core_set_clock_in_sr); +/* Default to slow, highest DPM level will be * set to PPSMC_DISPLAY_WATERMARK_LOW later.
@@ -4066,7 +4079,6 @@ static int fiji_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, consstruct fiji_single_dpm_table *mclk_table = &(data->dpm_table.mclk_table);uint32_t mclk = fiji_ps->performance_levels [fiji_ps->performance_level_count -1 ].memory_clock; -struct PP_Clocks min_clocks = {0 };uint32_t i;struct cgs_display_info info = {0 };
@@ -4080,10 +4092,8 @@ static int fiji_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, consif (i >= sclk_table->count) data->need_update_smu7_dpm_table |=DPMTABLE_OD_UPDATE_SCLK ;else { -/* TODO: Check SCLK in DAL's minimum clocks -* in case DeepSleep divider update is required. -*/ -if (data->display_timing.min_clock_in_sr != min_clocks.engineClockInSR) +if (data->display_timing.min_clock_in_sr != + hwmgr->display_config.min_core_set_clock_in_sr) data->need_update_smu7_dpm_table |=DPMTABLE_UPDATE_SCLK ; }
@@ -5252,12 +5262,12 @@ bool fiji_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hif (data->display_timing.num_existing_displays != info.display_count) is_update_required = true; -/* TO DO NEED TO GET DEEP SLEEP CLOCK FROM DAL -if (phm_cap_enabled(hwmgr->hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) { -cgs_get_min_clock_settings(hwmgr->device, &min_clocks); -if(min_clocks.engineClockInSR != data->display_timing.minClockInSR) + +if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) { +if (hwmgr->display_config.min_core_set_clock_in_sr != data->display_timing.min_clock_in_sr) is_update_required = true; -*/ + } +return is_update_required; }
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu: Set PFLIP_SUBMITTED for crtc after address update
In reply to Alex DeucherFrom: Andrey Grodzovsky <[email protected]>
Also add some pflip debug prints.
This change allows us to wait on pflip status until the new surface address is actually submitted to the register.
This reverts ed3020e923240829dcdfd3343f6e91dc02c63775 drm/amdgpu: Move MMIO flip out of spinlocked region
The original change assumed DAL will aquire locks inside DAL implemetion of page_flip callback which eventaully didn't happen.
This moves the flip before status update which makes sense for the non-DAL code pathes as well.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +11 -3
@@ -131,12 +131,17 @@ static void amdgpu_flip_work_func(struct work_struct *__work) vblank->framedur_ns /1000 , vblank->linedur_ns / 1000, stat, vpos, hpos); -/* set the flip status */ +/* Do the flip (mmio) */ + adev->mode_info.funcs->page_flip (adev, work->crtc_id, work->base); + +/* Set the flip status */ amdgpuCrtc->pflip_status =AMDGPU_FLIP_SUBMITTED ;spin_unlock_irqrestore (&crtc->dev->event_lock, flags); -/* Do the flip (mmio) */ - adev->mode_info.funcs->page_flip (adev, work->crtc_id, work->base); + +DRM_DEBUG_DRIVER ("crtc:%d[%p], pflip_stat:AMDGPU_FLIP_SUBMITTED, work: %p,\n" , + amdgpuCrtc->crtc_id, amdgpuCrtc, work); + }/*
@@ -252,6 +257,9 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc, amdgpu_crtc->pflip_status =AMDGPU_FLIP_PENDING ; amdgpu_crtc->pflip_works = work; + +DRM_DEBUG_DRIVER ("crtc:%d[%p], pflip_stat:AMDGPU_FLIP_PENDING, work: %p,\n" , + amdgpu_crtc->crtc_id, amdgpu_crtc, work);/* update crtc fb */ crtc->primary->fb = fb;spin_unlock_irqrestore (&crtc->dev->event_lock, flags);
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu: add new CG flag for ROM clockgating
In reply to Alex Deucher--- drivers/gpu/drm/amd/include/amd_shared.h | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
@@ -104,6 +104,7 @@ enum amd_powergating_state {#define AMD_CG_SUPPORT_VCE_MGCG (1 << 14)#define AMD_CG_SUPPORT_HDP_LS (1 << 15)#define AMD_CG_SUPPORT_HDP_MGCG (1 << 16) +#define AMD_CG_SUPPORT_ROM_MGCG (1 << 17)/* PG flags */ #define AMD_PG_SUPPORT_GFX_PG (1 << 0)
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu/gfx: add proper CG flags for fiji
In reply to Alex DeucherWe were already enabling these CG features, this uses the standard interface for doing so.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 82 ++++++++++++++++++++--------------- drivers/gpu/drm/amd/amdgpu/vi.c | 9 +++- 2 files changed, 56 insertions(+), 35 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +48 -34
@@ -4282,7 +4282,7 @@ static int gfx_v8_0_set_powergating_state(void *handle, }static void fiji_send_serdes_cmd (struct amdgpu_device *adev, -uint32_t reg_addr,uint32_t cmd) +uint32_t reg_addr,uint32_t cmd) {uint32_t data;
@@ -4312,23 +4312,29 @@ static void fiji_send_serdes_cmd(struct amdgpu_device *adev, }static void fiji_update_medium_grain_clock_gating (struct amdgpu_device *adev, -bool enable) +bool enable) {uint32_t temp, data;/* It is disabled by HW by default */ -if (enable) { -/* 1 - RLC memory Light sleep */ - temp = data =RREG32 (mmRLC_MEM_SLP_CNTL); - data |=RLC_MEM_SLP_CNTL__RLC_MEM_LS_EN_MASK ; -if (temp != data) -WREG32 (mmRLC_MEM_SLP_CNTL, data); +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_GFX_MGCG )) { +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_MGLS ) { +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_RLC_LS ) { +/* 1 - RLC memory Light sleep */ + temp = data =RREG32 (mmRLC_MEM_SLP_CNTL); + data |=RLC_MEM_SLP_CNTL__RLC_MEM_LS_EN_MASK ; +if (temp != data) +WREG32 (mmRLC_MEM_SLP_CNTL, data); + } -/* 2 - CP memory Light sleep */ - temp = data =RREG32 (mmCP_MEM_SLP_CNTL); - data |=CP_MEM_SLP_CNTL__CP_MEM_LS_EN_MASK ; -if (temp != data) -WREG32 (mmCP_MEM_SLP_CNTL, data); +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_CP_LS ) { +/* 2 - CP memory Light sleep */ + temp = data =RREG32 (mmCP_MEM_SLP_CNTL); + data |=CP_MEM_SLP_CNTL__CP_MEM_LS_EN_MASK ; +if (temp != data) +WREG32 (mmCP_MEM_SLP_CNTL, data); + } + }/* 3 - RLC_CGTT_MGCG_OVERRIDE */ temp = data =RREG32 (mmRLC_CGTT_MGCG_OVERRIDE);
@@ -4346,17 +4352,21 @@ static void fiji_update_medium_grain_clock_gating(struct amdgpu_device *adev,/* 5 - clear mgcg override */ fiji_send_serdes_cmd (adev,BPM_REG_MGCG_OVERRIDE ,CLE_BPM_SERDES_CMD ); -/* 6 - Enable CGTS(Tree Shade) MGCG /MGLS */ - temp = data =RREG32 (mmCGTS_SM_CTRL_REG); - data &= ~(CGTS_SM_CTRL_REG__SM_MODE_MASK ); - data |= (0x2 <<CGTS_SM_CTRL_REG__SM_MODE__SHIFT ); - data |=CGTS_SM_CTRL_REG__SM_MODE_ENABLE_MASK ; - data &= ~CGTS_SM_CTRL_REG__OVERRIDE_MASK ; - data &= ~CGTS_SM_CTRL_REG__LS_OVERRIDE_MASK ; - data |=CGTS_SM_CTRL_REG__ON_MONITOR_ADD_EN_MASK ; - data |= (0x96 <<CGTS_SM_CTRL_REG__ON_MONITOR_ADD__SHIFT ); -if (temp != data) -WREG32 (mmCGTS_SM_CTRL_REG, data); +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_CGTS ) { +/* 6 - Enable CGTS(Tree Shade) MGCG /MGLS */ + temp = data =RREG32 (mmCGTS_SM_CTRL_REG); + data &= ~(CGTS_SM_CTRL_REG__SM_MODE_MASK ); + data |= (0x2 <<CGTS_SM_CTRL_REG__SM_MODE__SHIFT ); + data |=CGTS_SM_CTRL_REG__SM_MODE_ENABLE_MASK ; + data &= ~CGTS_SM_CTRL_REG__OVERRIDE_MASK ; +if ((adev->cg_flags &AMD_CG_SUPPORT_GFX_MGLS ) && + (adev->cg_flags &AMD_CG_SUPPORT_GFX_CGTS_LS )) + data &= ~CGTS_SM_CTRL_REG__LS_OVERRIDE_MASK ; + data |=CGTS_SM_CTRL_REG__ON_MONITOR_ADD_EN_MASK ; + data |= (0x96 <<CGTS_SM_CTRL_REG__ON_MONITOR_ADD__SHIFT ); +if (temp != data) +WREG32 (mmCGTS_SM_CTRL_REG, data); + }udelay (50 );/* 7 - wait for RLC_SERDES_CU_MASTER & RLC_SERDES_NONCU_MASTER idle */
@@ -4406,13 +4416,13 @@ static void fiji_update_medium_grain_clock_gating(struct amdgpu_device *adev, }static void fiji_update_coarse_grain_clock_gating (struct amdgpu_device *adev, -bool enable) +bool enable) {uint32_t temp, temp1, data, data1; temp = data =RREG32 (mmRLC_CGCG_CGLS_CTRL); -if (enable) { +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_GFX_CGCG )) {/* 1 enable cntx_empty_int_enable/cntx_busy_int_enable/ * Cmp_busy/GFX_Idle interrupts */
@@ -4438,14 +4448,18 @@ static void fiji_update_coarse_grain_clock_gating(struct amdgpu_device *adev,/* 5 - enable cgcg */ data |=RLC_CGCG_CGLS_CTRL__CGCG_EN_MASK ; -/* enable cgls*/ - data |=RLC_CGCG_CGLS_CTRL__CGLS_EN_MASK ; +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_CGLS ) { +/* enable cgls*/ + data |=RLC_CGCG_CGLS_CTRL__CGLS_EN_MASK ; - temp1 = data1 =RREG32 (mmRLC_CGTT_MGCG_OVERRIDE); - data1 &= ~RLC_CGTT_MGCG_OVERRIDE__CGLS_MASK ; + temp1 = data1 =RREG32 (mmRLC_CGTT_MGCG_OVERRIDE); + data1 &= ~RLC_CGTT_MGCG_OVERRIDE__CGLS_MASK ; -if (temp1 != data1) -WREG32 (mmRLC_CGTT_MGCG_OVERRIDE, data1); +if (temp1 != data1) +WREG32 (mmRLC_CGTT_MGCG_OVERRIDE, data1); + }else { + data &= ~RLC_CGCG_CGLS_CTRL__CGLS_EN_MASK ; + }if (temp != data)WREG32 (mmRLC_CGCG_CGLS_CTRL, data);
@@ -4480,13 +4494,13 @@ static void fiji_update_coarse_grain_clock_gating(struct amdgpu_device *adev,/* disable cgcg, cgls should be disabled too. */ data &= ~(RLC_CGCG_CGLS_CTRL__CGCG_EN_MASK | -RLC_CGCG_CGLS_CTRL__CGLS_EN_MASK ); +RLC_CGCG_CGLS_CTRL__CGLS_EN_MASK );if (temp != data)WREG32 (mmRLC_CGCG_CGLS_CTRL, data); } }static int fiji_update_gfx_clock_gating (struct amdgpu_device *adev, -bool enable) +bool enable) {if (enable) {/* CGCG/CGLS should be enabled after MGCG/MGLS/TS(CG/LS)
drivers/gpu/drm/amd/amdgpu/vi.c +8 -1
@@ -1076,7 +1076,14 @@ static int vi_common_early_init(void *handle) adev->external_rev_id =0x1 ;break ;case CHIP_FIJI : - adev->cg_flags =0 ; + adev->cg_flags =AMD_CG_SUPPORT_GFX_MGCG | +AMD_CG_SUPPORT_GFX_MGLS | +AMD_CG_SUPPORT_GFX_RLC_LS | +AMD_CG_SUPPORT_GFX_CP_LS | +AMD_CG_SUPPORT_GFX_CGTS | +AMD_CG_SUPPORT_GFX_CGTS_LS | +AMD_CG_SUPPORT_GFX_CGCG | +AMD_CG_SUPPORT_GFX_CGLS ; adev->pg_flags =0 ; adev->external_rev_id = adev->rev_id +0x3c ;break ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu/sdma: add proper CG flags for fiji
In reply to Alex DeucherWe were already enabling these CG features, this uses the standard interface for doing so.
--- drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/vi.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -2
@@ -1464,7 +1464,7 @@ static void fiji_update_sdma_medium_grain_clock_gating( {uint32_t temp, data; -if (enable) { +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_SDMA_MGCG )) { temp = data =RREG32 (mmSDMA0_CLK_CTRL); data &= ~(SDMA0_CLK_CTRL__SOFT_OVERRIDE7_MASK | SDMA0_CLK_CTRL__SOFT_OVERRIDE6_MASK |
@@ -1524,7 +1524,7 @@ static void fiji_update_sdma_medium_grain_light_sleep( {uint32_t temp, data; -if (enable) { +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_SDMA_LS )) { temp = data =RREG32 (mmSDMA0_POWER_CNTL); data |=SDMA0_POWER_CNTL__MEM_POWER_OVERRIDE_MASK ;
drivers/gpu/drm/amd/amdgpu/vi.c +3 -1
@@ -1083,7 +1083,9 @@ static int vi_common_early_init(void *handle)AMD_CG_SUPPORT_GFX_CGTS |AMD_CG_SUPPORT_GFX_CGTS_LS |AMD_CG_SUPPORT_GFX_CGCG | -AMD_CG_SUPPORT_GFX_CGLS ; +AMD_CG_SUPPORT_GFX_CGLS | +AMD_CG_SUPPORT_SDMA_MGCG | +AMD_CG_SUPPORT_SDMA_LS ; adev->pg_flags =0 ; adev->external_rev_id = adev->rev_id +0x3c ;break ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu/common: add proper CG flags for fiji
In reply to Alex DeucherWe were already enabling these CG features, this uses the standard interface for doing so.
--- drivers/gpu/drm/amd/amdgpu/vi.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/vi.c +13 -9
@@ -1085,7 +1085,11 @@ static int vi_common_early_init(void *handle)AMD_CG_SUPPORT_GFX_CGCG |AMD_CG_SUPPORT_GFX_CGLS |AMD_CG_SUPPORT_SDMA_MGCG | -AMD_CG_SUPPORT_SDMA_LS ; +AMD_CG_SUPPORT_SDMA_LS | +AMD_CG_SUPPORT_BIF_LS | +AMD_CG_SUPPORT_HDP_MGCG | +AMD_CG_SUPPORT_HDP_LS | +AMD_CG_SUPPORT_ROM_MGCG ; adev->pg_flags =0 ; adev->external_rev_id = adev->rev_id +0x3c ;break ;
@@ -1188,13 +1192,13 @@ static int vi_common_soft_reset(void *handle) }static void fiji_update_bif_medium_grain_light_sleep (struct amdgpu_device *adev, -bool enable) +bool enable) {uint32_t temp, data; temp = data =RREG32_PCIE (ixPCIE_CNTL2); -if (enable) +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_BIF_LS )) data |=PCIE_CNTL2__SLV_MEM_LS_EN_MASK |PCIE_CNTL2__MST_MEM_LS_EN_MASK |PCIE_CNTL2__REPLAY_MEM_LS_EN_MASK ;
@@ -1208,13 +1212,13 @@ static void fiji_update_bif_medium_grain_light_sleep(struct amdgpu_device *adev, }static void fiji_update_hdp_medium_grain_clock_gating (struct amdgpu_device *adev, -bool enable) +bool enable) {uint32_t temp, data; temp = data =RREG32 (mmHDP_HOST_PATH_CNTL); -if (enable) +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_HDP_MGCG )) data &= ~HDP_HOST_PATH_CNTL__CLOCK_GATING_DIS_MASK ;else data |=HDP_HOST_PATH_CNTL__CLOCK_GATING_DIS_MASK ;
@@ -1230,7 +1234,7 @@ static void fiji_update_hdp_light_sleep(struct amdgpu_device *adev, temp = data =RREG32 (mmHDP_MEM_POWER_LS); -if (enable) +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS )) data |=HDP_MEM_POWER_LS__LS_ENABLE_MASK ;else data &= ~HDP_MEM_POWER_LS__LS_ENABLE_MASK ;
@@ -1240,13 +1244,13 @@ static void fiji_update_hdp_light_sleep(struct amdgpu_device *adev, }static void fiji_update_rom_medium_grain_clock_gating (struct amdgpu_device *adev, -bool enable) +bool enable) {uint32_t temp, data; temp = data =RREG32_SMC (ixCGTT_ROM_CLK_CTRL0); -if (enable) +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_ROM_MGCG )) data &= ~(CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK |CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE1_MASK );else
@@ -1258,7 +1262,7 @@ static void fiji_update_rom_medium_grain_clock_gating(struct amdgpu_device *adev }static int vi_common_set_clockgating_state (void *handle, -enum amd_clockgating_state state) +enum amd_clockgating_state state) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu/gmc: add proper CG flags for fiji
In reply to Alex DeucherWe were already enabling these CG features, this uses the standard interface for doing so.
--- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/vi.c | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +4 -4
@@ -1310,11 +1310,11 @@ static int gmc_v8_0_process_interrupt(struct amdgpu_device *adev, }static void fiji_update_mc_medium_grain_clock_gating (struct amdgpu_device *adev, -bool enable) +bool enable) {uint32_t data; -if (enable) { +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_MC_MGCG )) { data =RREG32 (mmMC_HUB_MISC_HUB_CG); data |=MC_HUB_MISC_HUB_CG__ENABLE_MASK ;WREG32 (mmMC_HUB_MISC_HUB_CG, data);
@@ -1390,11 +1390,11 @@ static void fiji_update_mc_medium_grain_clock_gating(struct amdgpu_device *adev, }static void fiji_update_mc_light_sleep (struct amdgpu_device *adev, -bool enable) +bool enable) {uint32_t data; -if (enable) { +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_MC_LS )) { data =RREG32 (mmMC_HUB_MISC_HUB_CG); data |=MC_HUB_MISC_HUB_CG__MEM_LS_ENABLE_MASK ;WREG32 (mmMC_HUB_MISC_HUB_CG, data);
drivers/gpu/drm/amd/amdgpu/vi.c +3 -1
@@ -1089,7 +1089,9 @@ static int vi_common_early_init(void *handle)AMD_CG_SUPPORT_BIF_LS |AMD_CG_SUPPORT_HDP_MGCG |AMD_CG_SUPPORT_HDP_LS | -AMD_CG_SUPPORT_ROM_MGCG ; +AMD_CG_SUPPORT_ROM_MGCG | +AMD_CG_SUPPORT_MC_MGCG | +AMD_CG_SUPPORT_MC_LS ; adev->pg_flags =0 ; adev->external_rev_id = adev->rev_id +0x3c ;break ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu/gfx8: rename send_serdes_cmd
In reply to Alex DeucherSo it can be shared with CZ/ST.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7 -7
@@ -4281,7 +4281,7 @@ static int gfx_v8_0_set_powergating_state(void *handle,return 0 ; } -static void fiji_send_serdes_cmd (struct amdgpu_device *adev, +static void gfx_v8_0_send_serdes_cmd (struct amdgpu_device *adev,uint32_t reg_addr,uint32_t cmd) {uint32_t data;
@@ -4350,7 +4350,7 @@ static void fiji_update_medium_grain_clock_gating(struct amdgpu_device *adev,gfx_v8_0_wait_for_rlc_serdes (adev);/* 5 - clear mgcg override */ -fiji_send_serdes_cmd (adev,BPM_REG_MGCG_OVERRIDE ,CLE_BPM_SERDES_CMD ); +gfx_v8_0_send_serdes_cmd (adev,BPM_REG_MGCG_OVERRIDE ,CLE_BPM_SERDES_CMD );if (adev->cg_flags &AMD_CG_SUPPORT_GFX_CGTS ) {/* 6 - Enable CGTS(Tree Shade) MGCG /MGLS */
@@ -4406,7 +4406,7 @@ static void fiji_update_medium_grain_clock_gating(struct amdgpu_device *adev,gfx_v8_0_wait_for_rlc_serdes (adev);/* 6 - set mgcg override */ -fiji_send_serdes_cmd (adev,BPM_REG_MGCG_OVERRIDE ,SET_BPM_SERDES_CMD ); +gfx_v8_0_send_serdes_cmd (adev,BPM_REG_MGCG_OVERRIDE ,SET_BPM_SERDES_CMD );udelay (50 );
@@ -4437,13 +4437,13 @@ static void fiji_update_coarse_grain_clock_gating(struct amdgpu_device *adev,gfx_v8_0_wait_for_rlc_serdes (adev);/* 3 - clear cgcg override */ -fiji_send_serdes_cmd (adev,BPM_REG_CGCG_OVERRIDE ,CLE_BPM_SERDES_CMD ); +gfx_v8_0_send_serdes_cmd (adev,BPM_REG_CGCG_OVERRIDE ,CLE_BPM_SERDES_CMD );/* wait for RLC_SERDES_CU_MASTER & RLC_SERDES_NONCU_MASTER idle */ gfx_v8_0_wait_for_rlc_serdes (adev);/* 4 - write cmd to set CGLS */ -fiji_send_serdes_cmd (adev,BPM_REG_CGLS_EN ,SET_BPM_SERDES_CMD ); +gfx_v8_0_send_serdes_cmd (adev,BPM_REG_CGLS_EN ,SET_BPM_SERDES_CMD );/* 5 - enable cgcg */ data |=RLC_CGCG_CGLS_CTRL__CGCG_EN_MASK ;
@@ -4484,13 +4484,13 @@ static void fiji_update_coarse_grain_clock_gating(struct amdgpu_device *adev,gfx_v8_0_wait_for_rlc_serdes (adev);/* write cmd to Set CGCG Overrride */ -fiji_send_serdes_cmd (adev,BPM_REG_CGCG_OVERRIDE ,SET_BPM_SERDES_CMD ); +gfx_v8_0_send_serdes_cmd (adev,BPM_REG_CGCG_OVERRIDE ,SET_BPM_SERDES_CMD );/* wait for RLC_SERDES_CU_MASTER & RLC_SERDES_NONCU_MASTER idle */ gfx_v8_0_wait_for_rlc_serdes (adev);/* write cmd to Clear CGLS */ -fiji_send_serdes_cmd (adev,BPM_REG_CGLS_EN ,CLE_BPM_SERDES_CMD ); +gfx_v8_0_send_serdes_cmd (adev,BPM_REG_CGLS_EN ,CLE_BPM_SERDES_CMD );/* disable cgcg, cgls should be disabled too. */ data &= ~(RLC_CGCG_CGLS_CTRL__CGCG_EN_MASK |
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu/gfx: adjust gfx_v8_0_send_serdes_cmd for ST
In reply to Alex Deucher--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +17 -6
@@ -4292,7 +4292,8 @@ static void gfx_v8_0_send_serdes_cmd(struct amdgpu_device *adev,WREG32 (mmRLC_SERDES_WR_NONCU_MASTER_MASK,0xffffffff ); data =RREG32 (mmRLC_SERDES_WR_CTRL); - data &= ~(RLC_SERDES_WR_CTRL__WRITE_COMMAND_MASK | +if (adev->asic_type ==CHIP_STONEY ) + data &= ~(RLC_SERDES_WR_CTRL__WRITE_COMMAND_MASK | RLC_SERDES_WR_CTRL__READ_COMMAND_MASK | RLC_SERDES_WR_CTRL__P1_SELECT_MASK | RLC_SERDES_WR_CTRL__P2_SELECT_MASK |
@@ -4300,13 +4301,23 @@ static void gfx_v8_0_send_serdes_cmd(struct amdgpu_device *adev,RLC_SERDES_WR_CTRL__POWER_DOWN_MASK |RLC_SERDES_WR_CTRL__POWER_UP_MASK |RLC_SERDES_WR_CTRL__SHORT_FORMAT_MASK | -RLC_SERDES_WR_CTRL__BPM_DATA_MASK | -RLC_SERDES_WR_CTRL__REG_ADDR_MASK | RLC_SERDES_WR_CTRL__SRBM_OVERRIDE_MASK); + else + data &= ~(RLC_SERDES_WR_CTRL__WRITE_COMMAND_MASK | +RLC_SERDES_WR_CTRL__READ_COMMAND_MASK | +RLC_SERDES_WR_CTRL__P1_SELECT_MASK | +RLC_SERDES_WR_CTRL__P2_SELECT_MASK | +RLC_SERDES_WR_CTRL__RDDATA_RESET_MASK | +RLC_SERDES_WR_CTRL__POWER_DOWN_MASK | +RLC_SERDES_WR_CTRL__POWER_UP_MASK | +RLC_SERDES_WR_CTRL__SHORT_FORMAT_MASK | +RLC_SERDES_WR_CTRL__BPM_DATA_MASK | +RLC_SERDES_WR_CTRL__REG_ADDR_MASK | +RLC_SERDES_WR_CTRL__SRBM_OVERRIDE_MASK ); data |= (RLC_SERDES_WR_CTRL__RSVD_BPM_ADDR_MASK | - (cmd <<RLC_SERDES_WR_CTRL__BPM_DATA__SHIFT ) | - (reg_addr <<RLC_SERDES_WR_CTRL__REG_ADDR__SHIFT ) | - (0xff <<RLC_SERDES_WR_CTRL__BPM_ADDR__SHIFT )); + (cmd <<RLC_SERDES_WR_CTRL__BPM_DATA__SHIFT ) | + (reg_addr <<RLC_SERDES_WR_CTRL__REG_ADDR__SHIFT ) | + (0xff <<RLC_SERDES_WR_CTRL__BPM_ADDR__SHIFT ));WREG32 (mmRLC_SERDES_WR_CTRL, data); }
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu: add a new set of rlc function pointers
In reply to Alex DeucherDifferent asics tend to have different ways to interact with the RLC. This just covers enter/exit of safe mode for updating CG and PG state, but could be extended to cover other RLC operations in the future if necessary.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +9 -0
@@ -1037,6 +1037,11 @@ void amdgpu_bo_list_free(struct amdgpu_bo_list *list);*/ #include "clearstate_defs.h" +struct amdgpu_rlc_funcs { +void (*enter_safe_mode)(struct amdgpu_device *adev); +void (*exit_safe_mode)(struct amdgpu_device *adev); +}; +struct amdgpu_rlc {/* for power gating */ struct amdgpu_bo *save_restore_obj;
@@ -1055,6 +1060,10 @@ struct amdgpu_rlc {uint64_t cp_table_gpu_addr;volatile uint32_t *cp_table_ptr;u32 cp_table_size; + +/* safe mode for updating CG/PG state */ +bool in_safe_mode; +const struct amdgpu_rlc_funcs *funcs; };struct amdgpu_mec {
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu/gfx: rework fiji cg functions so they can be shared
In reply to Alex DeucherThey can be shared with other asics with minor modifications.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 218 +++++++++++++++++++++++++++++++--- 1 file changed, 202 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +202 -16
@@ -558,6 +558,7 @@ static const u32 stoney_mgcg_cgcg_init[] =static void gfx_v8_0_set_ring_funcs (struct amdgpu_device *adev);static void gfx_v8_0_set_irq_funcs (struct amdgpu_device *adev);static void gfx_v8_0_set_gds_init (struct amdgpu_device *adev); +static void gfx_v8_0_set_rlc_funcs (struct amdgpu_device *adev);static void gfx_v8_0_init_golden_registers (struct amdgpu_device *adev) {
@@ -4250,6 +4251,7 @@ static int gfx_v8_0_early_init(void *handle)gfx_v8_0_set_ring_funcs (adev);gfx_v8_0_set_irq_funcs (adev);gfx_v8_0_set_gds_init (adev); +gfx_v8_0_set_rlc_funcs (adev);return 0 ; }
@@ -4322,11 +4324,166 @@ static void gfx_v8_0_send_serdes_cmd(struct amdgpu_device *adev,WREG32 (mmRLC_SERDES_WR_CTRL, data); } -static void fiji_update_medium_grain_clock_gating (struct amdgpu_device *adev, -bool enable) +#define MSG_ENTER_RLC_SAFE_MODE 1 +#define MSG_EXIT_RLC_SAFE_MODE 0 + +#define RLC_GPR_REG2__REQ_MASK 0x00000001 +#define RLC_GPR_REG2__MESSAGE__SHIFT 0x00000001 +#define RLC_GPR_REG2__MESSAGE_MASK 0x0000001e + +static void cz_enter_rlc_safe_mode (struct amdgpu_device *adev) +{ +u32 data =0 ; +unsigned i; + + data =RREG32 (mmRLC_CNTL); +if ((data &RLC_CNTL__RLC_ENABLE_F32_MASK ) ==0 ) +return ; + +if ((adev->cg_flags & (AMD_CG_SUPPORT_GFX_CGCG |AMD_CG_SUPPORT_GFX_MGCG )) || + (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |AMD_PG_SUPPORT_GFX_SMG | +AMD_PG_SUPPORT_GFX_DMG ))) { + data |=RLC_GPR_REG2__REQ_MASK ; + data &= ~RLC_GPR_REG2__MESSAGE_MASK ; + data |= (MSG_ENTER_RLC_SAFE_MODE <<RLC_GPR_REG2__MESSAGE__SHIFT ); +WREG32 (mmRLC_GPR_REG2, data); + +for (i =0 ; i < adev->usec_timeout; i++) { +if ((RREG32 (mmRLC_GPM_STAT) & + (RLC_GPM_STAT__GFX_CLOCK_STATUS_MASK | +RLC_GPM_STAT__GFX_POWER_STATUS_MASK )) == + (RLC_GPM_STAT__GFX_CLOCK_STATUS_MASK | +RLC_GPM_STAT__GFX_POWER_STATUS_MASK )) +break ; +udelay (1 ); + } + +for (i =0 ; i < adev->usec_timeout; i++) { +if ((RREG32 (mmRLC_GPR_REG2) &RLC_GPR_REG2__REQ_MASK ) ==0 ) +break ; +udelay (1 ); + } + adev->gfx.rlc.in_safe_mode = true; + } +} + +static void cz_exit_rlc_safe_mode (struct amdgpu_device *adev) +{ +u32 data; +unsigned i; + + data =RREG32 (mmRLC_CNTL); +if ((data &RLC_CNTL__RLC_ENABLE_F32_MASK ) ==0 ) +return ; + +if ((adev->cg_flags & (AMD_CG_SUPPORT_GFX_CGCG |AMD_CG_SUPPORT_GFX_MGCG )) || + (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |AMD_PG_SUPPORT_GFX_SMG | +AMD_PG_SUPPORT_GFX_DMG ))) { + data |=RLC_GPR_REG2__REQ_MASK ; + data &= ~RLC_GPR_REG2__MESSAGE_MASK ; + data |= (MSG_EXIT_RLC_SAFE_MODE <<RLC_GPR_REG2__MESSAGE__SHIFT ); +WREG32 (mmRLC_GPR_REG2, data); + adev->gfx.rlc.in_safe_mode = false; + } + +for (i =0 ; i < adev->usec_timeout; i++) { +if ((RREG32 (mmRLC_GPR_REG2) &RLC_GPR_REG2__REQ_MASK ) ==0 ) +break ; +udelay (1 ); + } +} + +static void iceland_enter_rlc_safe_mode (struct amdgpu_device *adev) +{ +u32 data; +unsigned i; + + data =RREG32 (mmRLC_CNTL); +if (!(data &RLC_CNTL__RLC_ENABLE_F32_MASK )) +return ; + +if (adev->cg_flags & (AMD_CG_SUPPORT_GFX_CGCG |AMD_CG_SUPPORT_GFX_MGCG )) { + data |=RLC_SAFE_MODE__CMD_MASK ; + data &= ~RLC_SAFE_MODE__MESSAGE_MASK ; + data |= (1 <<RLC_SAFE_MODE__MESSAGE__SHIFT ); +WREG32 (mmRLC_SAFE_MODE, data); + +for (i =0 ; i < adev->usec_timeout; i++) { +if ((RREG32 (mmRLC_GPM_STAT) & + (RLC_GPM_STAT__GFX_CLOCK_STATUS_MASK | +RLC_GPM_STAT__GFX_POWER_STATUS_MASK )) == + (RLC_GPM_STAT__GFX_CLOCK_STATUS_MASK | +RLC_GPM_STAT__GFX_POWER_STATUS_MASK )) +break ; +udelay (1 ); + } + +for (i =0 ; i < adev->usec_timeout; i++) { +if ((RREG32 (mmRLC_SAFE_MODE) &RLC_SAFE_MODE__CMD_MASK ) ==0 ) +break ; +udelay (1 ); + } + adev->gfx.rlc.in_safe_mode = true; + } +} + +static void iceland_exit_rlc_safe_mode (struct amdgpu_device *adev) +{ +u32 data =0 ; +unsigned i; + + data =RREG32 (mmRLC_CNTL); +if (!(data &RLC_CNTL__RLC_ENABLE_F32_MASK )) +return ; + +if (adev->cg_flags & (AMD_CG_SUPPORT_GFX_CGCG |AMD_CG_SUPPORT_GFX_MGCG )) { +if (adev->gfx.rlc.in_safe_mode) { + data |=RLC_SAFE_MODE__CMD_MASK ; + data &= ~RLC_SAFE_MODE__MESSAGE_MASK ; +WREG32 (mmRLC_SAFE_MODE, data); + adev->gfx.rlc.in_safe_mode = false; + } + } + +for (i =0 ; i < adev->usec_timeout; i++) { +if ((RREG32 (mmRLC_SAFE_MODE) &RLC_SAFE_MODE__CMD_MASK ) ==0 ) +break ; +udelay (1 ); + } +} + +static void gfx_v8_0_nop_enter_rlc_safe_mode (struct amdgpu_device *adev) +{ + adev->gfx.rlc.in_safe_mode = true; +} + +static void gfx_v8_0_nop_exit_rlc_safe_mode (struct amdgpu_device *adev) +{ + adev->gfx.rlc.in_safe_mode = false; +} + +static const struct amdgpu_rlc_funcs cz_rlc_funcs = { + .enter_safe_mode = cz_enter_rlc_safe_mode, + .exit_safe_mode = cz_exit_rlc_safe_mode +}; + +static const struct amdgpu_rlc_funcs iceland_rlc_funcs = { + .enter_safe_mode = iceland_enter_rlc_safe_mode, + .exit_safe_mode = iceland_exit_rlc_safe_mode +}; + +static const struct amdgpu_rlc_funcs gfx_v8_0_nop_rlc_funcs = { + .enter_safe_mode = gfx_v8_0_nop_enter_rlc_safe_mode, + .exit_safe_mode = gfx_v8_0_nop_exit_rlc_safe_mode +}; + +static void gfx_v8_0_update_medium_grain_clock_gating (struct amdgpu_device *adev, +bool enable) {uint32_t temp, data; + adev->gfx.rlc.funcs->enter_safe_mode (adev); +/* It is disabled by HW by default */ if (enable && (adev->cg_flags &AMD_CG_SUPPORT_GFX_MGCG )) {if (adev->cg_flags &AMD_CG_SUPPORT_GFX_MGLS ) {
@@ -4349,10 +4506,15 @@ static void fiji_update_medium_grain_clock_gating(struct amdgpu_device *adev,/* 3 - RLC_CGTT_MGCG_OVERRIDE */ temp = data =RREG32 (mmRLC_CGTT_MGCG_OVERRIDE); - data &= ~(RLC_CGTT_MGCG_OVERRIDE__CPF_MASK | -RLC_CGTT_MGCG_OVERRIDE__RLC_MASK | -RLC_CGTT_MGCG_OVERRIDE__MGCG_MASK | -RLC_CGTT_MGCG_OVERRIDE__GRBM_MASK ); +if (adev->flags &AMD_IS_APU ) + data &= ~(RLC_CGTT_MGCG_OVERRIDE__CPF_MASK | +RLC_CGTT_MGCG_OVERRIDE__RLC_MASK | +RLC_CGTT_MGCG_OVERRIDE__MGCG_MASK ); +else + data &= ~(RLC_CGTT_MGCG_OVERRIDE__CPF_MASK | +RLC_CGTT_MGCG_OVERRIDE__RLC_MASK | +RLC_CGTT_MGCG_OVERRIDE__MGCG_MASK | +RLC_CGTT_MGCG_OVERRIDE__GRBM_MASK );if (temp != data)WREG32 (mmRLC_CGTT_MGCG_OVERRIDE, data);
@@ -4424,15 +4586,19 @@ static void fiji_update_medium_grain_clock_gating(struct amdgpu_device *adev,/* 7- wait for RLC_SERDES_CU_MASTER & RLC_SERDES_NONCU_MASTER idle */ gfx_v8_0_wait_for_rlc_serdes (adev); } + + adev->gfx.rlc.funcs->exit_safe_mode (adev); } -static void fiji_update_coarse_grain_clock_gating (struct amdgpu_device *adev, -bool enable) +static void gfx_v8_0_update_coarse_grain_clock_gating (struct amdgpu_device *adev, +bool enable) {uint32_t temp, temp1, data, data1; temp = data =RREG32 (mmRLC_CGCG_CGLS_CTRL); + adev->gfx.rlc.funcs->enter_safe_mode (adev); +if (enable && (adev->cg_flags &AMD_CG_SUPPORT_GFX_CGCG )) {/* 1 enable cntx_empty_int_enable/cntx_busy_int_enable/ * Cmp_busy/GFX_Idle interrupts
@@ -4509,22 +4675,24 @@ static void fiji_update_coarse_grain_clock_gating(struct amdgpu_device *adev,if (temp != data)WREG32 (mmRLC_CGCG_CGLS_CTRL, data); } + + adev->gfx.rlc.funcs->exit_safe_mode (adev); } -static int fiji_update_gfx_clock_gating (struct amdgpu_device *adev, -bool enable) +static int gfx_v8_0_update_gfx_clock_gating (struct amdgpu_device *adev, +bool enable) {if (enable) {/* CGCG/CGLS should be enabled after MGCG/MGLS/TS(CG/LS) * === MGCG + MGLS + TS(CG/LS) === */ -fiji_update_medium_grain_clock_gating (adev, enable); -fiji_update_coarse_grain_clock_gating (adev, enable); +gfx_v8_0_update_medium_grain_clock_gating (adev, enable); +gfx_v8_0_update_coarse_grain_clock_gating (adev, enable); }else {/* CGCG/CGLS should be disabled before MGCG/MGLS/TS(CG/LS) * === CGCG + CGLS === */ -fiji_update_coarse_grain_clock_gating (adev, enable); -fiji_update_medium_grain_clock_gating (adev, enable); +gfx_v8_0_update_coarse_grain_clock_gating (adev, enable); +gfx_v8_0_update_medium_grain_clock_gating (adev, enable); }return 0 ; }
@@ -4536,8 +4704,10 @@ static int gfx_v8_0_set_clockgating_state(void *handle,switch (adev->asic_type) {case CHIP_FIJI : -fiji_update_gfx_clock_gating (adev, - state ==AMD_CG_STATE_GATE ? true : false); +case CHIP_CARRIZO : +case CHIP_STONEY : +gfx_v8_0_update_gfx_clock_gating (adev, + state ==AMD_CG_STATE_GATE ? true : false);break ;default :break ;
@@ -5137,6 +5307,22 @@ static void gfx_v8_0_set_irq_funcs(struct amdgpu_device *adev) adev->gfx.priv_inst_irq.funcs = &gfx_v8_0_priv_inst_irq_funcs; } +static void gfx_v8_0_set_rlc_funcs (struct amdgpu_device *adev) +{ +switch (adev->asic_type) { +case CHIP_TOPAZ : +case CHIP_STONEY : + adev->gfx.rlc.funcs = &iceland_rlc_funcs; +break ; +case CHIP_CARRIZO : + adev->gfx.rlc.funcs = &cz_rlc_funcs; +break ; +default : + adev->gfx.rlc.funcs = &gfx_v8_0_nop_rlc_funcs; +break ; + } +} +static void gfx_v8_0_set_gds_init (struct amdgpu_device *adev) {/* init asci gds info */
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu: enable gfx clockgating for CZ
In reply to Alex Deucher--- drivers/gpu/drm/amd/amdgpu/vi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vi.c +9 -1
@@ -1101,7 +1101,15 @@ static int vi_common_early_init(void *handle) adev->external_rev_id = adev->rev_id +0x14 ;break ;case CHIP_CARRIZO : - adev->cg_flags =0 ; + adev->cg_flags =AMD_CG_SUPPORT_GFX_MGCG | +AMD_CG_SUPPORT_GFX_MGLS | +AMD_CG_SUPPORT_GFX_RLC_LS | +AMD_CG_SUPPORT_GFX_CP_LS | +AMD_CG_SUPPORT_GFX_CGTS | +AMD_CG_SUPPORT_GFX_MGLS | +AMD_CG_SUPPORT_GFX_CGTS_LS | +AMD_CG_SUPPORT_GFX_CGCG | +AMD_CG_SUPPORT_GFX_CGLS ; adev->pg_flags =0 ; adev->external_rev_id = adev->rev_id +0x1 ;break ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu: enable gfx clockgating for ST (v2)
In reply to Alex Deucherv2: just enable MGCG for now since CGCG causes hangs
--- drivers/gpu/drm/amd/amdgpu/vi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vi.c +3 -1
@@ -1114,7 +1114,9 @@ static int vi_common_early_init(void *handle) adev->external_rev_id = adev->rev_id +0x1 ;break ;case CHIP_STONEY : - adev->cg_flags =AMD_CG_SUPPORT_UVD_MGCG ; + adev->cg_flags =AMD_CG_SUPPORT_UVD_MGCG | +AMD_CG_SUPPORT_GFX_MGCG | +AMD_CG_SUPPORT_GFX_MGLS ; adev->pg_flags =0 ; adev->external_rev_id = adev->rev_id +0x1 ;break ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu/vi: rename fiji cg functions
In reply to Alex DeucherThey can be used for other VI parts.
--- drivers/gpu/drm/amd/amdgpu/vi.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/vi.c +21 -12
@@ -1203,8 +1203,8 @@ static int vi_common_soft_reset(void *handle)return 0 ; } -static void fiji_update_bif_medium_grain_light_sleep (struct amdgpu_device *adev, -bool enable) +static void vi_update_bif_medium_grain_light_sleep (struct amdgpu_device *adev, +bool enable) {uint32_t temp, data;
@@ -1223,8 +1223,8 @@ static void fiji_update_bif_medium_grain_light_sleep(struct amdgpu_device *adev,WREG32_PCIE (ixPCIE_CNTL2, data); } -static void fiji_update_hdp_medium_grain_clock_gating (struct amdgpu_device *adev, -bool enable) +static void vi_update_hdp_medium_grain_clock_gating (struct amdgpu_device *adev, +bool enable) {uint32_t temp, data;
@@ -1239,8 +1239,8 @@ static void fiji_update_hdp_medium_grain_clock_gating(struct amdgpu_device *adevWREG32 (mmHDP_HOST_PATH_CNTL, data); } -static void fiji_update_hdp_light_sleep (struct amdgpu_device *adev, -bool enable) +static void vi_update_hdp_light_sleep (struct amdgpu_device *adev, +bool enable) {uint32_t temp, data;
@@ -1255,8 +1255,8 @@ static void fiji_update_hdp_light_sleep(struct amdgpu_device *adev,WREG32 (mmHDP_MEM_POWER_LS, data); } -static void fiji_update_rom_medium_grain_clock_gating (struct amdgpu_device *adev, -bool enable) +static void vi_update_rom_medium_grain_clock_gating (struct amdgpu_device *adev, +bool enable) {uint32_t temp, data;
@@ -1280,13 +1280,22 @@ static int vi_common_set_clockgating_state(void *handle,switch (adev->asic_type) {case CHIP_FIJI : -fiji_update_bif_medium_grain_light_sleep (adev, +vi_update_bif_medium_grain_light_sleep (adev, state ==AMD_CG_STATE_GATE ? true : false); -fiji_update_hdp_medium_grain_clock_gating (adev, +vi_update_hdp_medium_grain_clock_gating (adev, state ==AMD_CG_STATE_GATE ? true : false); -fiji_update_hdp_light_sleep (adev, +vi_update_hdp_light_sleep (adev, state ==AMD_CG_STATE_GATE ? true : false); -fiji_update_rom_medium_grain_clock_gating (adev, +vi_update_rom_medium_grain_clock_gating (adev, + state ==AMD_CG_STATE_GATE ? true : false); +break ; +case CHIP_CARRIZO : +case CHIP_STONEY : +vi_update_bif_medium_grain_light_sleep (adev, + state ==AMD_CG_STATE_GATE ? true : false); +vi_update_hdp_medium_grain_clock_gating (adev, + state ==AMD_CG_STATE_GATE ? true : false); +vi_update_hdp_light_sleep (adev, state ==AMD_CG_STATE_GATE ? true : false);break ;default :
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu: enable gmc clockgating for CZ
In reply to Alex Deucher--- drivers/gpu/drm/amd/amdgpu/vi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vi.c +4 -1
@@ -1109,7 +1109,10 @@ static int vi_common_early_init(void *handle)AMD_CG_SUPPORT_GFX_MGLS |AMD_CG_SUPPORT_GFX_CGTS_LS |AMD_CG_SUPPORT_GFX_CGCG | -AMD_CG_SUPPORT_GFX_CGLS ; +AMD_CG_SUPPORT_GFX_CGLS | +AMD_CG_SUPPORT_BIF_LS | +AMD_CG_SUPPORT_HDP_MGCG | +AMD_CG_SUPPORT_HDP_LS ; adev->pg_flags =0 ; adev->external_rev_id = adev->rev_id +0x1 ;break ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu: enable gmc clockgating for ST
In reply to Alex Deucher--- drivers/gpu/drm/amd/amdgpu/vi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vi.c +4 -1
@@ -1119,7 +1119,10 @@ static int vi_common_early_init(void *handle)case CHIP_STONEY : adev->cg_flags =AMD_CG_SUPPORT_UVD_MGCG |AMD_CG_SUPPORT_GFX_MGCG | -AMD_CG_SUPPORT_GFX_MGLS ; +AMD_CG_SUPPORT_GFX_MGLS | +AMD_CG_SUPPORT_BIF_LS | +AMD_CG_SUPPORT_HDP_MGCG | +AMD_CG_SUPPORT_HDP_LS ; adev->pg_flags =0 ; adev->external_rev_id = adev->rev_id +0x1 ;break ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu/sdma: rename fiji cg functions
In reply to Alex DeucherThey care common for all sdma 3.0 parts
--- drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 104 +++++++++++++-------------------- 1 file changed, 39 insertions(+), 65 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +39 -65
@@ -1458,40 +1458,31 @@ static int sdma_v3_0_process_illegal_inst_irq(struct amdgpu_device *adev,return 0 ; } -static void fiji_update_sdma_medium_grain_clock_gating ( +static void sdma_v3_0_update_sdma_medium_grain_clock_gating (struct amdgpu_device *adev,bool enable) {uint32_t temp, data; +int i;if (enable && (adev->cg_flags &AMD_CG_SUPPORT_SDMA_MGCG )) { - temp = data =RREG32 (mmSDMA0_CLK_CTRL); - data &= ~(SDMA0_CLK_CTRL__SOFT_OVERRIDE7_MASK | -SDMA0_CLK_CTRL__SOFT_OVERRIDE6_MASK | -SDMA0_CLK_CTRL__SOFT_OVERRIDE5_MASK | -SDMA0_CLK_CTRL__SOFT_OVERRIDE4_MASK | -SDMA0_CLK_CTRL__SOFT_OVERRIDE3_MASK | -SDMA0_CLK_CTRL__SOFT_OVERRIDE2_MASK | -SDMA0_CLK_CTRL__SOFT_OVERRIDE1_MASK | -SDMA0_CLK_CTRL__SOFT_OVERRIDE0_MASK ); -if (data != temp) -WREG32 (mmSDMA0_CLK_CTRL, data); - - temp = data =RREG32 (mmSDMA1_CLK_CTRL); - data &= ~(SDMA1_CLK_CTRL__SOFT_OVERRIDE7_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE6_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE5_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE4_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE3_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE2_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE1_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE0_MASK ); - -if (data != temp) -WREG32 (mmSDMA1_CLK_CTRL, data); +for (i =0 ; i < adev->sdma.num_instances; i++) { + temp = data =RREG32 (mmSDMA0_CLK_CTRL + sdma_offsets[i]); + data &= ~(SDMA0_CLK_CTRL__SOFT_OVERRIDE7_MASK | +SDMA0_CLK_CTRL__SOFT_OVERRIDE6_MASK | +SDMA0_CLK_CTRL__SOFT_OVERRIDE5_MASK | +SDMA0_CLK_CTRL__SOFT_OVERRIDE4_MASK | +SDMA0_CLK_CTRL__SOFT_OVERRIDE3_MASK | +SDMA0_CLK_CTRL__SOFT_OVERRIDE2_MASK | +SDMA0_CLK_CTRL__SOFT_OVERRIDE1_MASK | +SDMA0_CLK_CTRL__SOFT_OVERRIDE0_MASK ); +if (data != temp) +WREG32 (mmSDMA0_CLK_CTRL + sdma_offsets[i], data); + } }else { - temp = data =RREG32 (mmSDMA0_CLK_CTRL); - data |=SDMA0_CLK_CTRL__SOFT_OVERRIDE7_MASK | +for (i =0 ; i < adev->sdma.num_instances; i++) { + temp = data =RREG32 (mmSDMA0_CLK_CTRL + sdma_offsets[i]); + data |=SDMA0_CLK_CTRL__SOFT_OVERRIDE7_MASK |SDMA0_CLK_CTRL__SOFT_OVERRIDE6_MASK |SDMA0_CLK_CTRL__SOFT_OVERRIDE5_MASK | SDMA0_CLK_CTRL__SOFT_OVERRIDE4_MASK |
@@ -1500,54 +1491,35 @@ static void fiji_update_sdma_medium_grain_clock_gating(SDMA0_CLK_CTRL__SOFT_OVERRIDE1_MASK |SDMA0_CLK_CTRL__SOFT_OVERRIDE0_MASK ; -if (data != temp) -WREG32 (mmSDMA0_CLK_CTRL, data); - - temp = data =RREG32 (mmSDMA1_CLK_CTRL); - data |=SDMA1_CLK_CTRL__SOFT_OVERRIDE7_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE6_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE5_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE4_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE3_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE2_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE1_MASK | -SDMA1_CLK_CTRL__SOFT_OVERRIDE0_MASK ; - -if (data != temp) -WREG32 (mmSDMA1_CLK_CTRL, data); +if (data != temp) +WREG32 (mmSDMA0_CLK_CTRL + sdma_offsets[i], data); + } } } -static void fiji_update_sdma_medium_grain_light_sleep ( +static void sdma_v3_0_update_sdma_medium_grain_light_sleep (struct amdgpu_device *adev,bool enable) {uint32_t temp, data; +int i;if (enable && (adev->cg_flags &AMD_CG_SUPPORT_SDMA_LS )) { - temp = data =RREG32 (mmSDMA0_POWER_CNTL); - data |=SDMA0_POWER_CNTL__MEM_POWER_OVERRIDE_MASK ; - -if (temp != data) -WREG32 (mmSDMA0_POWER_CNTL, data); - - temp = data =RREG32 (mmSDMA1_POWER_CNTL); - data |=SDMA1_POWER_CNTL__MEM_POWER_OVERRIDE_MASK ; +for (i =0 ; i < adev->sdma.num_instances; i++) { + temp = data =RREG32 (mmSDMA0_POWER_CNTL + sdma_offsets[i]); + data |=SDMA0_POWER_CNTL__MEM_POWER_OVERRIDE_MASK ; -if (temp != data) -WREG32 (mmSDMA1_POWER_CNTL, data); +if (temp != data) +WREG32 (mmSDMA0_POWER_CNTL + sdma_offsets[i], data); + } }else { - temp = data =RREG32 (mmSDMA0_POWER_CNTL); - data &= ~SDMA0_POWER_CNTL__MEM_POWER_OVERRIDE_MASK ; - -if (temp != data) -WREG32 (mmSDMA0_POWER_CNTL, data); - - temp = data =RREG32 (mmSDMA1_POWER_CNTL); - data &= ~SDMA1_POWER_CNTL__MEM_POWER_OVERRIDE_MASK ; +for (i =0 ; i < adev->sdma.num_instances; i++) { + temp = data =RREG32 (mmSDMA0_POWER_CNTL + sdma_offsets[i]); + data &= ~SDMA0_POWER_CNTL__MEM_POWER_OVERRIDE_MASK ; -if (temp != data) -WREG32 (mmSDMA1_POWER_CNTL, data); +if (temp != data) +WREG32 (mmSDMA0_POWER_CNTL + sdma_offsets[i], data); + } } }
@@ -1558,9 +1530,11 @@ static int sdma_v3_0_set_clockgating_state(void *handle,switch (adev->asic_type) {case CHIP_FIJI : -fiji_update_sdma_medium_grain_clock_gating (adev, +case CHIP_CARRIZO : +case CHIP_STONEY : +sdma_v3_0_update_sdma_medium_grain_clock_gating (adev, state ==AMD_CG_STATE_GATE ? true : false); -fiji_update_sdma_medium_grain_light_sleep (adev, +sdma_v3_0_update_sdma_medium_grain_light_sleep (adev, state ==AMD_CG_STATE_GATE ? true : false);break ;default :
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu: enable sdma clockgating on CZ
In reply to Alex Deucher--- drivers/gpu/drm/amd/amdgpu/vi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vi.c +3 -1
@@ -1112,7 +1112,9 @@ static int vi_common_early_init(void *handle)AMD_CG_SUPPORT_GFX_CGLS |AMD_CG_SUPPORT_BIF_LS |AMD_CG_SUPPORT_HDP_MGCG | -AMD_CG_SUPPORT_HDP_LS ; +AMD_CG_SUPPORT_HDP_LS | +AMD_CG_SUPPORT_SDMA_MGCG | +AMD_CG_SUPPORT_SDMA_LS ; adev->pg_flags =0 ; adev->external_rev_id = adev->rev_id +0x1 ;break ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu: enable sdma clockgating on ST
In reply to Alex Deucher--- drivers/gpu/drm/amd/amdgpu/vi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vi.c +3 -1
@@ -1124,7 +1124,9 @@ static int vi_common_early_init(void *handle)AMD_CG_SUPPORT_GFX_MGLS |AMD_CG_SUPPORT_BIF_LS |AMD_CG_SUPPORT_HDP_MGCG | -AMD_CG_SUPPORT_HDP_LS ; +AMD_CG_SUPPORT_HDP_LS | +AMD_CG_SUPPORT_SDMA_MGCG | +AMD_CG_SUPPORT_SDMA_LS ; adev->pg_flags =0 ; adev->external_rev_id = adev->rev_id +0x1 ;break ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu: add ELM/BAF DCE11 configs (v2)
In reply to Alex DeucherAdd support for the display configuration on elm/baf.
v2: add missing Stoney case
--- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +24 -1
@@ -1580,7 +1580,20 @@ static int dce_v11_0_audio_init(struct amdgpu_device *adev) adev->mode_info.audio.enabled = true; - adev->mode_info.audio.num_pins =7 ; +switch (adev->asic_type) { +case CHIP_CARRIZO : +case CHIP_STONEY : + adev->mode_info.audio.num_pins =7 ; +break ; +case CHIP_ELLESMERE : + adev->mode_info.audio.num_pins =8 ; +break ; +case CHIP_BAFFIN : + adev->mode_info.audio.num_pins =6 ; +break ; +default : +return -EINVAL ; + }for (i =0 ; i < adev->mode_info.audio.num_pins; i++) { adev->mode_info.audio.pin[i].channels =-1 ;
@@ -2900,6 +2913,16 @@ static int dce_v11_0_early_init(void *handle) adev->mode_info.num_hpd =6 ; adev->mode_info.num_dig =9 ;break ; +case CHIP_ELLESMERE : + adev->mode_info.num_crtc =6 ; + adev->mode_info.num_hpd =6 ; + adev->mode_info.num_dig =6 ; +break ; +case CHIP_BAFFIN : + adev->mode_info.num_crtc =5 ; + adev->mode_info.num_hpd =5 ; + adev->mode_info.num_dig =5 ; +break ;default :/* FIXME: not supported yet */ return -EINVAL ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu: add ELM/BAF support to dce_v11_0_pick_pll (v2)
In reply to Alex DeucherNew PLL scheme on ELM/BAF.
v2: squash in pll fix. Plls are part of the phys.
--- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +38 -0
@@ -2385,6 +2385,44 @@ static u32 dce_v11_0_pick_pll(struct drm_crtc *crtc)u32 pll_in_use;int pll; +if ((adev->asic_type ==CHIP_ELLESMERE ) || + (adev->asic_type ==CHIP_BAFFIN )) { +struct amdgpu_encoder *amdgpu_encoder = +to_amdgpu_encoder (amdgpu_crtc->encoder); +struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; + +if (ENCODER_MODE_IS_DP (amdgpu_atombios_encoder_get_encoder_mode (amdgpu_crtc->encoder))) +return ATOM_DP_DTO ; +/* use the same PPLL for all monitors with the same clock */ + pll =amdgpu_pll_get_shared_nondp_ppll (crtc); +if (pll !=ATOM_PPLL_INVALID ) +return pll; + +switch (amdgpu_encoder->encoder_id) { +case ENCODER_OBJECT_ID_INTERNAL_UNIPHY : +if (dig->linkb) +return ATOM_COMBOPHY_PLL1 ; +else +return ATOM_COMBOPHY_PLL0 ; +break ; +case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 : +if (dig->linkb) +return ATOM_COMBOPHY_PLL3 ; +else +return ATOM_COMBOPHY_PLL2 ; +break ; +case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 : +if (dig->linkb) +return ATOM_COMBOPHY_PLL5 ; +else +return ATOM_COMBOPHY_PLL4 ; +break ; +default : +DRM_ERROR ("invalid encoder_id: 0x%x\n" , amdgpu_encoder->encoder_id); +return ATOM_PPLL_INVALID ; + } + } +if (ENCODER_MODE_IS_DP (amdgpu_atombios_encoder_get_encoder_mode (amdgpu_crtc->encoder))) {if (adev->clock.dp_extclk)/* skip PPLL programming if using ext clock */
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: enable some feature for baffin/ellesmere. (v2)
In reply to Alex DeucherFrom: Rex Zhu <[email protected]>
Sync up with internal updates.
v2: squash in:
drm/amd/powerplay: set revert flag for enable thermal protect.
--- drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | 2 +- .../gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 94 +++++++++++++++++++--- 2 files changed, 83 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +1 -1
@@ -3377,7 +3377,7 @@ static void fiji_set_dpm_event_sources(struct pp_hwmgr *hwmgr, DPM_EVENT_SRC, src);PHM_WRITE_INDIRECT_FIELD (hwmgr->device,CGS_IND_REG__SMC ,GENERAL_PWRMGT ,THERMAL_PROTECTION_DIS , -phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, + !phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_ThermalController)); }else PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, GENERAL_PWRMGT,
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +82 -12
160 lines not on this page · raw message
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: add fan control mode interface for baffin
In reply to Alex DeucherFrom: Rex Zhu <[email protected]>
Add interface for manual fan control.
--- .../gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +26 -0
@@ -4871,6 +4871,30 @@ static int polaris10_print_clock_levels(struct pp_hwmgr *hwmgr,return size; } +static int polaris10_set_fan_control_mode (struct pp_hwmgr *hwmgr,uint32_t mode) +{ +if (mode) { +/* stop auto-manage */ +if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, + PHM_PlatformCaps_MicrocodeFanControl)) +polaris10_fan_ctrl_stop_smc_fan_control (hwmgr); +polaris10_fan_ctrl_set_static_mode (hwmgr, mode); + }else +/* restart auto-manage */ +polaris10_fan_ctrl_reset_fan_speed_to_default (hwmgr); + +return 0 ; +} + +static int polaris10_get_fan_control_mode (struct pp_hwmgr *hwmgr) +{ +if (hwmgr->fan_ctrl_is_in_default_mode) +return hwmgr->fan_ctrl_default_mode; +else +return PHM_READ_VFPF_INDIRECT_FIELD (hwmgr->device,CGS_IND_REG__SMC , +CG_FDO_CTRL2 ,FDO_PWM_MODE ); +} +static const struct pp_hwmgr_func polaris10_hwmgr_funcs = { .backend_init = &polaris10_hwmgr_backend_init, .backend_fini = &polaris10_hwmgr_backend_fini,
@@ -4907,6 +4931,8 @@ static const struct pp_hwmgr_func polaris10_hwmgr_funcs = { .register_internal_thermal_interrupt = polaris10_register_internal_thermal_interrupt, .check_smc_update_required_for_display_configuration = polaris10_check_smc_update_required_for_display_configuration, .check_states_equal = polaris10_check_states_equal, + .set_fan_control_mode = polaris10_set_fan_control_mode, + .get_fan_control_mode = polaris10_get_fan_control_mode, .get_pp_table = polaris10_get_pp_table, .set_pp_table = polaris10_set_pp_table, .force_clock_level = polaris10_force_clock_level,
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: parameter updates according to SMC.
In reply to Alex DeucherFrom: Rex Zhu <[email protected]>
Update to latest changes for SMC team.
--- .../drm/amd/powerplay/hwmgr/polaris10_powertune.c | 32 ++++++++++++---------- drivers/gpu/drm/amd/powerplay/inc/smu74_discrete.h | 10 +++---- 2 files changed, 22 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.c +17 -15
@@ -57,6 +57,13 @@ void polaris10_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr) } +static uint16_t scale_fan_gain_settings (uint16_t raw_setting) +{ +uint32_t tmp; + tmp = raw_setting *4096 /100 ; +return (uint16_t )tmp; +} +int polaris10_populate_bapm_parameters_in_dpm_table (struct pp_hwmgr *hwmgr) {struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend);
@@ -65,6 +72,8 @@ int polaris10_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr)struct phm_ppt_v1_information *table_info = (struct phm_ppt_v1_information *)(hwmgr->pptable);struct phm_cac_tdp_table *cac_dtp_table = table_info->cac_dtp_table; +struct pp_advance_fan_control_parameters *fan_table= + &hwmgr->thermal_controller.advanceFanControlParameters;int i, j, k;uint16_t *pdef1;uint16_t *pdef2;
@@ -75,15 +84,16 @@ int polaris10_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr)PP_ASSERT_WITH_CODE (cac_dtp_table->usTargetOperatingTemp <=255 , "Target Operating Temp is out of Range!", ); -/* This is the same value as TemperatureLimitHigh except it is integer with no fraction bit. */ - dpm_table->GpuTjMax = (uint8_t )(cac_dtp_table->usTargetOperatingTemp); -/* HW request to hard code this value to 8 which is 0.5C */ - dpm_table->GpuTjHyst =8 ; + dpm_table->TemperatureLimitEdge =PP_HOST_TO_SMC_US ( + cac_dtp_table->usTargetOperatingTemp *256 ); + dpm_table->TemperatureLimitHotspot =PP_HOST_TO_SMC_US ( + cac_dtp_table->usTemperatureLimitHotspot *256 ); + dpm_table->FanGainEdge =PP_HOST_TO_SMC_US ( +scale_fan_gain_settings (fan_table->usFanGainEdge)); + dpm_table->FanGainHotspot =PP_HOST_TO_SMC_US ( +scale_fan_gain_settings (fan_table->usFanGainHotspot)); - dpm_table->DTEAmbientTempBase = defaults->DTEAmbientTempBase; - dpm_table->DTETjOffset = (uint8_t )(data->dte_tj_offset); - dpm_table->BAPM_TEMP_GRADIENT =PP_HOST_TO_SMC_UL (defaults->BAPM_TEMP_GRADIENT); pdef1 = defaults->BAPMTI_R; pdef2 = defaults->BAPMTI_RC;
@@ -330,14 +340,6 @@ int polaris10_enable_power_containment(struct pp_hwmgr *hwmgr) data->power_containment_features =0 ;if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_PowerContainment)) { -if (data->enable_dte_feature) { - smc_result =smum_send_msg_to_smc (hwmgr->smumgr, - (uint16_t )(PPSMC_MSG_EnableDTE)); -PP_ASSERT_WITH_CODE ((0 == smc_result), - "Failed to enable DTE in SMC.", result = -1;); -if (0 == smc_result) - data->power_containment_features |=POWERCONTAINMENT_FEATURE_DTE ; - }if (data->enable_tdc_limit_feature) { smc_result = smum_send_msg_to_smc(hwmgr->smumgr,
drivers/gpu/drm/amd/powerplay/inc/smu74_discrete.h +5 -5
@@ -323,14 +323,14 @@ struct SMU74_Discrete_DpmTable {uint16_t BAPMTI_R [SMU74_DTE_ITERATIONS ][SMU74_DTE_SOURCES ][SMU74_DTE_SINKS ];uint16_t BAPMTI_RC [SMU74_DTE_ITERATIONS ][SMU74_DTE_SOURCES ][SMU74_DTE_SINKS ]; -uint8_t DTEAmbientTempBase; -uint8_t DTETjOffset; -uint8_t GpuTjMax; -uint8_t GpuTjHyst; +uint16_t TemperatureLimitEdge; +uint16_t TemperatureLimitHotspot; +uint16_t BootVddc;uint16_t BootVddci; -uint32_t BAPM_TEMP_GRADIENT ; +uint16_t FanGainEdge; +uint16_t FanGainHotspot;uint32_t LowSclkInterruptThreshold;uint32_t VddGfxReChkWait;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: fix issue that get wrong reference clock value.
In reply to Alex DeucherFrom: Rex Zhu <[email protected]>
use wrong parameter to compute the reference clock.
--- drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +1 -1
@@ -5893,7 +5893,7 @@ uint32_t tonga_get_xclk(struct pp_hwmgr *hwmgr)if (!fw_info)return 0 ; - reference_clock =le16_to_cpu (fw_info->usMinPixelClockPLL_Output); + reference_clock =le16_to_cpu (fw_info->usReferenceClock); divide =PHM_READ_VFPF_INDIRECT_FIELD (hwmgr->device,CGS_IND_REG__SMC ,CG_CLKPIN_CNTL ,XTALIN_DIVIDE );
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: Fix a bug for enabling ACDC gpio interrupt
In reply to Alex DeucherFrom: Eric Huang <[email protected]>
Only enable it if it's supported rather than unconitionally.
--- drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +7 -4
@@ -2354,10 +2354,13 @@ static int polaris10_start_dpm(struct pp_hwmgr *hwmgr) return -1); } -PP_ASSERT_WITH_CODE ((0 ==smum_send_msg_to_smc (hwmgr->smumgr, - PPSMC_MSG_EnableACDCGPIOInterrupt)), - "Failed to enable AC DC GPIO Interrupt!", - ); +if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, + PHM_PlatformCaps_Falcon_QuickTransition)) { +PP_ASSERT_WITH_CODE ((0 ==smum_send_msg_to_smc (hwmgr->smumgr, + PPSMC_MSG_EnableACDCGPIOInterrupt)), + "Failed to enable AC DC GPIO Interrupt!", + ); + }return 0 ; }
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: update vce power gate state for baffin.
In reply to Alex DeucherFrom: Rex Zhu <[email protected]>
Forgot to save the current gate state so we don't know what the current state is if we try and gate/ungate the block.
--- drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.c +2 -0
@@ -123,6 +123,8 @@ int polaris10_phm_powergate_vce(struct pp_hwmgr *hwmgr, bool bgate)if (data->vce_power_gated == bgate)return 0 ; + data->vce_power_gated = bgate; +if (bgate)polaris10_phm_powerdown_vce (hwmgr);else
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu: fix memory leak in CGS (FW info)
In reply to Alex DeucherFrom: Mykola Lysenko <[email protected]>
Previously requested FW pointer should not be
overwritten on a subsequent call.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 70 +++++++++++++++++---------------- 1 file changed, 36 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +36 -34
@@ -735,42 +735,44 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,const uint8_t *src;const struct smc_firmware_header_v1_0 *hdr; -switch (adev->asic_type) { -case CHIP_TONGA : -strcpy (fw_name,"amdgpu/tonga_smc.bin" ); -break ; -case CHIP_FIJI : -strcpy (fw_name,"amdgpu/fiji_smc.bin" ); -break ; -case CHIP_POLARIS11 : -if (type ==CGS_UCODE_ID_SMU ) -strcpy (fw_name,"amdgpu/polaris11_smc.bin" ); -else if (type ==CGS_UCODE_ID_SMU_SK ) -strcpy (fw_name,"amdgpu/polaris11_smc_sk.bin" ); -break ; -case CHIP_POLARIS10 : -if (type ==CGS_UCODE_ID_SMU ) -strcpy (fw_name,"amdgpu/polaris10_smc.bin" ); -else if (type ==CGS_UCODE_ID_SMU_SK ) -strcpy (fw_name,"amdgpu/polaris10_smc_sk.bin" ); -break ; -default : -DRM_ERROR ("SMC firmware not supported\n" ); -return -EINVAL ; - } +if (!adev->pm.fw) { +switch (adev->asic_type) { +case CHIP_TONGA : +strcpy (fw_name,"amdgpu/tonga_smc.bin" ); +break ; +case CHIP_FIJI : +strcpy (fw_name,"amdgpu/fiji_smc.bin" ); +break ; +case CHIP_POLARIS11 : +if (type ==CGS_UCODE_ID_SMU ) +strcpy (fw_name,"amdgpu/polaris11_smc.bin" ); +else if (type ==CGS_UCODE_ID_SMU_SK ) +strcpy (fw_name,"amdgpu/polaris11_smc_sk.bin" ); +break ; +case CHIP_POLARIS10 : +if (type ==CGS_UCODE_ID_SMU ) +strcpy (fw_name,"amdgpu/polaris10_smc.bin" ); +else if (type ==CGS_UCODE_ID_SMU_SK ) +strcpy (fw_name,"amdgpu/polaris10_smc_sk.bin" ); +break ; +default : +DRM_ERROR ("SMC firmware not supported\n" ); +return -EINVAL ; + } - err =request_firmware (&adev->pm.fw, fw_name, adev->dev); -if (err) { -DRM_ERROR ("Failed to request firmware\n" ); -return err; - } + err =request_firmware (&adev->pm.fw, fw_name, adev->dev); +if (err) { +DRM_ERROR ("Failed to request firmware\n" ); +return err; + } - err =amdgpu_ucode_validate (adev->pm.fw); -if (err) { -DRM_ERROR ("Failed to load firmware \"%s\"" , fw_name); -release_firmware (adev->pm.fw); - adev->pm.fw =NULL ; -return err; + err =amdgpu_ucode_validate (adev->pm.fw); +if (err) { +DRM_ERROR ("Failed to load firmware \"%s\"" , fw_name); +release_firmware (adev->pm.fw); + adev->pm.fw =NULL ; +return err; + } } hdr = (const struct smc_firmware_header_v1_0 *) adev->pm.fw->data;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: return 0 when interface not implement on some asic.
In reply to Alex DeucherFrom: Rex Zhu <[email protected]>
Don't fail if certain optional interface callbacks are missing.
--- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 169 +++++++++++++++++--------- 1 file changed, 113 insertions(+), 56 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +113 -56
@@ -37,6 +37,12 @@return -EINVAL ; \ } while (0) +#define PP_CHECK_HW (hwmgr) \ + do { \ + if ((hwmgr) == NULL || (hwmgr)->hwmgr_func == NULL) \ + return -EINVAL; \ + } while (0) +static int pp_early_init (void *handle) {return 0 ;
@@ -54,8 +60,9 @@ static int pp_sw_init(void *handle) pp_handle = (struct pp_instance *)handle; hwmgr = pp_handle->hwmgr; -if (hwmgr ==NULL || hwmgr->pptable_func ==NULL || - hwmgr->hwmgr_func ==NULL || +PP_CHECK_HW (hwmgr); + +if (hwmgr->pptable_func ==NULL || hwmgr->pptable_func->pptable_init ==NULL || hwmgr->hwmgr_func->backend_init ==NULL )return -EINVAL ;
@@ -66,9 +73,9 @@ static int pp_sw_init(void *handle) ret = hwmgr->hwmgr_func->backend_init (hwmgr);if (ret) -printk ("amdgpu: powerplay initialization failed\n" ); +printk (KERN_ERR "amdgpu: powerplay initialization failed\n" );else -printk ("amdgpu: powerplay initialized\n" ); +printk (KERN_INFO "amdgpu: powerplay initialized\n" );return ret; }
@@ -85,8 +92,9 @@ static int pp_sw_fini(void *handle) pp_handle = (struct pp_instance *)handle; hwmgr = pp_handle->hwmgr; -if (hwmgr !=NULL || hwmgr->hwmgr_func !=NULL || - hwmgr->hwmgr_func->backend_fini !=NULL ) +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->backend_fini !=NULL ) ret = hwmgr->hwmgr_func->backend_fini (hwmgr);return ret;
@@ -188,11 +196,12 @@ static int pp_set_clockgating_state(void *handle, hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); -if (hwmgr->hwmgr_func->update_clock_gatings ==NULL ) +if (hwmgr->hwmgr_func->update_clock_gatings ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__);return 0 ; + }if (state ==AMD_CG_STATE_UNGATE ) pp_state =0 ;
@@ -276,9 +285,12 @@ static int pp_set_powergating_state(void *handle, hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->enable_per_cu_power_gating ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->enable_per_cu_power_gating ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }/* Enable/disable GFX per cu powergating through SMU */ return hwmgr->hwmgr_func->enable_per_cu_power_gating(hwmgr,
@@ -371,9 +383,12 @@ static int pp_dpm_force_performance_level(void *handle, hwmgr = pp_handle->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->force_dpm_level ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->force_dpm_level ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + } hwmgr->hwmgr_func->force_dpm_level (hwmgr, level);
@@ -405,9 +420,12 @@ static int pp_dpm_get_sclk(void *handle, bool low) hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->get_sclk ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->get_sclk ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }return hwmgr->hwmgr_func->get_sclk (hwmgr, low); }
@@ -421,9 +439,12 @@ static int pp_dpm_get_mclk(void *handle, bool low) hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->get_mclk ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->get_mclk ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }return hwmgr->hwmgr_func->get_mclk (hwmgr, low); }
@@ -437,9 +458,12 @@ static int pp_dpm_powergate_vce(void *handle, bool gate) hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->powergate_vce ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->powergate_vce ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }return hwmgr->hwmgr_func->powergate_vce (hwmgr, gate); }
@@ -453,9 +477,12 @@ static int pp_dpm_powergate_uvd(void *handle, bool gate) hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->powergate_uvd ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->powergate_uvd ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }return hwmgr->hwmgr_func->powergate_uvd (hwmgr, gate); }
@@ -551,9 +578,13 @@ pp_debugfs_print_current_performance_level(void *handle, hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->print_current_perforce_level ==NULL ) +if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL ) +return ; + +if (hwmgr->hwmgr_func->print_current_perforce_level ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__);return ; + } hwmgr->hwmgr_func->print_current_perforce_level (hwmgr, m); }
@@ -567,9 +598,12 @@ static int pp_dpm_set_fan_control_mode(void *handle, uint32_t mode) hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->set_fan_control_mode ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->set_fan_control_mode ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }return hwmgr->hwmgr_func->set_fan_control_mode (hwmgr, mode); }
@@ -583,9 +617,12 @@ static int pp_dpm_get_fan_control_mode(void *handle) hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->get_fan_control_mode ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->get_fan_control_mode ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }return hwmgr->hwmgr_func->get_fan_control_mode (hwmgr); }
@@ -599,9 +636,12 @@ static int pp_dpm_set_fan_speed_percent(void *handle, uint32_t percent) hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->set_fan_speed_percent ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->set_fan_speed_percent ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }return hwmgr->hwmgr_func->set_fan_speed_percent (hwmgr, percent); }
@@ -615,9 +655,12 @@ static int pp_dpm_get_fan_speed_percent(void *handle, uint32_t *speed) hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->get_fan_speed_percent ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->get_fan_speed_percent ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }return hwmgr->hwmgr_func->get_fan_speed_percent (hwmgr, speed); }
@@ -631,9 +674,12 @@ static int pp_dpm_get_temperature(void *handle) hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->get_temperature ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->get_temperature ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }return hwmgr->hwmgr_func->get_temperature (hwmgr); }
@@ -687,9 +733,12 @@ static int pp_dpm_get_pp_table(void *handle, char **table) hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->get_pp_table ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->get_pp_table ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }return hwmgr->hwmgr_func->get_pp_table (hwmgr, table); }
@@ -703,9 +752,12 @@ static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size) hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->set_pp_table ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->set_pp_table ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }return hwmgr->hwmgr_func->set_pp_table (hwmgr, buf, size); }
@@ -720,9 +772,12 @@ static int pp_dpm_force_clock_level(void *handle, hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->force_clock_level ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); + +if (hwmgr->hwmgr_func->force_clock_level ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }return hwmgr->hwmgr_func->force_clock_level (hwmgr, type, level); }
@@ -737,10 +792,12 @@ static int pp_dpm_print_clock_levels(void *handle, hwmgr = ((struct pp_instance *)handle)->hwmgr; -if (hwmgr ==NULL || hwmgr->hwmgr_func ==NULL || - hwmgr->hwmgr_func->print_clock_levels ==NULL ) -return -EINVAL ; +PP_CHECK_HW (hwmgr); +if (hwmgr->hwmgr_func->print_clock_levels ==NULL ) { +printk (KERN_INFO "%s was not implemented.\n" , __func__); +return 0 ; + }return hwmgr->hwmgr_func->print_clock_levels (hwmgr, type, buf); }
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: fix some initialize error on polaris10.
In reply to Alex DeucherFrom: Rex Zhu <[email protected]>
1. don't enable SclkThrottleLowNotification, it's not supported.
2. Set missing mclk_dpm0_activity_target
--- drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +1 -4
@@ -2600,9 +2600,6 @@ int polaris10_set_features_platform_caps(struct pp_hwmgr *hwmgr)phm_cap_set (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_DynamicUVDState); -phm_cap_set (hwmgr->platform_descriptor.platformCaps, - PHM_PlatformCaps_SclkThrottleLowNotification); -/* power tune caps Assume disabled */ phm_cap_unset (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SQRamping);
@@ -2930,7 +2927,7 @@ int polaris10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) data->dll_default_on = false; data->sram_end =SMC_RAM_END ; - + data->mclk_dpm0_activity_target =0xa ; data->disable_dpm_mask =0xFF ; data->static_screen_threshold =PPPOLARIS10_STATICSCREENTHRESHOLD_DFLT ; data->static_screen_threshold_unit =PPPOLARIS10_STATICSCREENTHRESHOLD_DFLT ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: fix bug dpm can't work when resume back on Polaris
In reply to Alex DeucherFrom: Eric Huang <[email protected]>
Need to initialize the values to 0 since they get or'ed with additional values. If the initialization is missing, on resume, they may end up with a combination of stale data and new data.
Fixes dpm on resume.
--- drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +5 -0
@@ -1565,6 +1565,7 @@ static int polaris10_populate_smc_vce_level(struct pp_hwmgr *hwmgr,for (count =0 ; count < table->VceLevelCount; count++) { table->VceLevel[count].Frequency = mm_table->entries[count].eclk; + table->VceLevel[count].MinVoltage =0 ; table->VceLevel[count].MinVoltage |= (mm_table->entries[count].vddc *VOLTAGE_SCALE ) <<VDDC_SHIFT ; table->VceLevel[count].MinVoltage |=
@@ -1604,6 +1605,7 @@ static int polaris10_populate_smc_samu_level(struct pp_hwmgr *hwmgr,for (count =0 ; count < table->SamuLevelCount; count++) {/* not sure whether we need evclk or not */ + table->SamuLevel[count].MinVoltage =0 ; table->SamuLevel[count].Frequency = mm_table->entries[count].samclock; table->SamuLevel[count].MinVoltage |= (mm_table->entries[count].vddc *VOLTAGE_SCALE ) <<VDDC_SHIFT ;
@@ -1696,6 +1698,7 @@ static int polaris10_populate_smc_uvd_level(struct pp_hwmgr *hwmgr, table->UvdBootLevel =0 ;for (count =0 ; count < table->UvdLevelCount; count++) { + table->UvdLevel[count].MinVoltage =0 ; table->UvdLevel[count].VclkFrequency = mm_table->entries[count].vclk; table->UvdLevel[count].DclkFrequency = mm_table->entries[count].dclk; table->UvdLevel[count].MinVoltage |= (mm_table->entries[count].vddc *
@@ -2011,6 +2014,7 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr)if (POLARIS10_VOLTAGE_CONTROL_NONE != data->voltage_control)polaris10_populate_smc_voltage_tables (hwmgr, table); + table->SystemFlags =0 ;if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_AutomaticDCTransition)) table->SystemFlags |=PPSMC_SYSTEMFLAG_GPIO_DC ;
@@ -2104,6 +2108,7 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr) table->MemoryThermThrottleEnable =1 ; table->PCIeBootLinkLevel =0 ; table->PCIeGenInterval =1 ; + table->VRConfig =0 ; result =polaris10_populate_vr_config (hwmgr, table); PP_ASSERT_WITH_CODE(0 == result,
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: fix fan speed percent setting error on Polaris10
In reply to Alex DeucherFrom: Eric Huang <[email protected]>
The logic was reversed.
--- drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c +2 -2
@@ -220,8 +220,8 @@ int polaris10_fan_ctrl_set_fan_speed_percent(struct pp_hwmgr *hwmgr,if (duty100 ==0 )return -EINVAL ; - tmp64 = (uint64_t )speed *100 ; -do_div (tmp64, duty100); + tmp64 = (uint64_t )speed * duty100; +do_div (tmp64,100 ); duty = (uint32_t )tmp64; PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: add dpm force multiple levels on cz/tonga/fiji/polaris (v2)
In reply to Alex DeucherFrom: Eric Huang <[email protected]>
Allows you to force multiple levels rather than just one via the new sysfs interrface.
v2: squash in:
drm/amd/powerplay: ensure clock level set by user is valid. From Rex.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 51 +++++++++++++++------- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 4 +- drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | 6 +-- drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | 18 ++++++-- .../gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 16 +++++-- drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 16 +++++-- drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h | 2 +- drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 2 +- 8 files changed, 81 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +36 -15
@@ -362,16 +362,23 @@ static ssize_t amdgpu_set_pp_dpm_sclk(struct device *dev,struct amdgpu_device *adev = ddev->dev_private;int ret;long level; +uint32_t i, mask =0 ; +char sub_str[2 ]; - ret =kstrtol (buf,0 , &level); +for (i =0 ; i <strlen (buf) -1 ; i++) { + sub_str[0 ] = *(buf + i); + sub_str[1 ] ='\0' ; + ret =kstrtol (sub_str,0 , &level); -if (ret) { - count = -EINVAL ; - goto fail; +if (ret) { + count = -EINVAL ; + goto fail; + } + mask |=1 << level; }if (adev->pp_enabled) -amdgpu_dpm_force_clock_level (adev,PP_SCLK , level); +amdgpu_dpm_force_clock_level (adev,PP_SCLK , mask); fail:return count; }
@@ -399,16 +406,23 @@ static ssize_t amdgpu_set_pp_dpm_mclk(struct device *dev,struct amdgpu_device *adev = ddev->dev_private;int ret;long level; +uint32_t i, mask =0 ; +char sub_str[2 ]; - ret =kstrtol (buf,0 , &level); +for (i =0 ; i <strlen (buf) -1 ; i++) { + sub_str[0 ] = *(buf + i); + sub_str[1 ] ='\0' ; + ret =kstrtol (sub_str,0 , &level); -if (ret) { - count = -EINVAL ; - goto fail; +if (ret) { + count = -EINVAL ; + goto fail; + } + mask |=1 << level; }if (adev->pp_enabled) -amdgpu_dpm_force_clock_level (adev,PP_MCLK , level); +amdgpu_dpm_force_clock_level (adev,PP_MCLK , mask); fail:return count; }
@@ -436,16 +450,23 @@ static ssize_t amdgpu_set_pp_dpm_pcie(struct device *dev,struct amdgpu_device *adev = ddev->dev_private;int ret;long level; +uint32_t i, mask =0 ; +char sub_str[2 ]; - ret =kstrtol (buf,0 , &level); +for (i =0 ; i <strlen (buf) -1 ; i++) { + sub_str[0 ] = *(buf + i); + sub_str[1 ] ='\0' ; + ret =kstrtol (sub_str,0 , &level); -if (ret) { - count = -EINVAL ; - goto fail; +if (ret) { + count = -EINVAL ; + goto fail; + } + mask |=1 << level; }if (adev->pp_enabled) -amdgpu_dpm_force_clock_level (adev,PP_PCIE , level); +amdgpu_dpm_force_clock_level (adev,PP_PCIE , mask); fail:return count; }
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +2 -2
@@ -763,7 +763,7 @@ static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size) }static int pp_dpm_force_clock_level (void *handle, -enum pp_clock_type type,int level) +enum pp_clock_type type,uint32_t mask) {struct pp_hwmgr *hwmgr;
@@ -779,7 +779,7 @@ static int pp_dpm_force_clock_level(void *handle,return 0 ; } -return hwmgr->hwmgr_func->force_clock_level (hwmgr, type, level); +return hwmgr->hwmgr_func->force_clock_level (hwmgr, type, mask); } static int pp_dpm_print_clock_levels(void *handle,
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +3 -3
@@ -1729,7 +1729,7 @@ static int cz_get_dal_power_level(struct pp_hwmgr *hwmgr, }static int cz_force_clock_level (struct pp_hwmgr *hwmgr, -enum pp_clock_type type,int level) +enum pp_clock_type type,uint32_t mask) {if (hwmgr->dpm_level !=AMD_DPM_FORCED_LEVEL_MANUAL )return -EINVAL ;
@@ -1738,10 +1738,10 @@ static int cz_force_clock_level(struct pp_hwmgr *hwmgr,case PP_SCLK :smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, PPSMC_MSG_SetSclkSoftMin, - (1 << level)); + mask);smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, PPSMC_MSG_SetSclkSoftMax, - (1 << level)); + mask);break ;default :break ;
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +14 -4
@@ -5113,7 +5113,7 @@ static int fiji_set_pp_table(struct pp_hwmgr *hwmgr, const char *buf, size_t siz }static int fiji_force_clock_level (struct pp_hwmgr *hwmgr, -enum pp_clock_type type,int level) +enum pp_clock_type type,uint32_t mask) {struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend);
@@ -5125,20 +5125,30 @@ static int fiji_force_clock_level(struct pp_hwmgr *hwmgr,if (!data->sclk_dpm_key_disabled)smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, PPSMC_MSG_SCLKDPM_SetEnabledMask, - (1 << level)); + data->dpm_level_enable_mask.sclk_dpm_enable_mask & mask);break ; +case PP_MCLK :if (!data->mclk_dpm_key_disabled)smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, PPSMC_MSG_MCLKDPM_SetEnabledMask, - (1 << level)); + data->dpm_level_enable_mask.mclk_dpm_enable_mask & mask);break ; +case PP_PCIE : + { +uint32_t tmp = mask & data->dpm_level_enable_mask.pcie_dpm_enable_mask; +uint32_t level =0 ; + +while (tmp >>=1 ) + level++; +if (!data->pcie_dpm_key_disabled)smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, PPSMC_MSG_PCIeDPM_ForceLevel, - (1 << level)); + level);break ; + }default :break ; }
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +12 -4
@@ -4767,7 +4767,7 @@ static int polaris10_set_pp_table(struct pp_hwmgr *hwmgr, const char *buf, size_ }static int polaris10_force_clock_level (struct pp_hwmgr *hwmgr, -enum pp_clock_type type,int level) +enum pp_clock_type type,uint32_t mask) {struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend);
@@ -4779,20 +4779,28 @@ static int polaris10_force_clock_level(struct pp_hwmgr *hwmgr,if (!data->sclk_dpm_key_disabled)smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, PPSMC_MSG_SCLKDPM_SetEnabledMask, - (1 << level)); + data->dpm_level_enable_mask.sclk_dpm_enable_mask & mask);break ;case PP_MCLK :if (!data->mclk_dpm_key_disabled)smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, PPSMC_MSG_MCLKDPM_SetEnabledMask, - (1 << level)); + data->dpm_level_enable_mask.mclk_dpm_enable_mask & mask);break ;case PP_PCIE : + { +uint32_t tmp = mask & data->dpm_level_enable_mask.pcie_dpm_enable_mask; +uint32_t level =0 ; + +while (tmp >>=1 ) + level++; +if (!data->pcie_dpm_key_disabled)smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, PPSMC_MSG_PCIeDPM_ForceLevel, - (1 << level)); + level);break ; + }default :break ; }
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +12 -4
@@ -6075,7 +6075,7 @@ static int tonga_set_pp_table(struct pp_hwmgr *hwmgr, const char *buf, size_t si }static int tonga_force_clock_level (struct pp_hwmgr *hwmgr, -enum pp_clock_type type,int level) +enum pp_clock_type type,uint32_t mask) {struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
@@ -6087,20 +6087,28 @@ static int tonga_force_clock_level(struct pp_hwmgr *hwmgr,if (!data->sclk_dpm_key_disabled)smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, PPSMC_MSG_SCLKDPM_SetEnabledMask, - (1 << level)); + data->dpm_level_enable_mask.sclk_dpm_enable_mask & mask);break ;case PP_MCLK :if (!data->mclk_dpm_key_disabled)smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, PPSMC_MSG_MCLKDPM_SetEnabledMask, - (1 << level)); + data->dpm_level_enable_mask.mclk_dpm_enable_mask & mask);break ;case PP_PCIE : + { +uint32_t tmp = mask & data->dpm_level_enable_mask.pcie_dpm_enable_mask; +uint32_t level =0 ; + +while (tmp >>=1 ) + level++; +if (!data->pcie_dpm_key_disabled)smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, PPSMC_MSG_PCIeDPM_ForceLevel, - (1 << level)); + level);break ; + }default :break ; }
drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h +1 -1
@@ -340,7 +340,7 @@ struct amd_powerplay_funcs {int (*get_pp_num_states)(void *handle,struct pp_states_info *data);int (*get_pp_table)(void *handle,char **table);int (*set_pp_table)(void *handle,const char *buf,size_t size); -int (*force_clock_level)(void *handle,enum pp_clock_type type,int level); +int (*force_clock_level)(void *handle,enum pp_clock_type type,uint32_t mask);int (*print_clock_levels)(void *handle,enum pp_clock_type type,char *buf); };
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -1
@@ -335,7 +335,7 @@ struct pp_hwmgr_func {int (*power_off_asic)(struct pp_hwmgr *hwmgr);int (*get_pp_table)(struct pp_hwmgr *hwmgr,char **table);int (*set_pp_table)(struct pp_hwmgr *hwmgr,const char *buf,size_t size); -int (*force_clock_level)(struct pp_hwmgr *hwmgr,enum pp_clock_type type,int level); +int (*force_clock_level)(struct pp_hwmgr *hwmgr,enum pp_clock_type type,uint32_t mask);int (*print_clock_levels)(struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf);int (*enable_per_cu_power_gating)(struct pp_hwmgr *hwmgr,bool enable); };
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: revise caching the soft pptable and add it's size
In reply to Alex DeucherFrom: Eric Huang <[email protected]>
This fixes a bug in the pptable access interface that could lead to a crash. Check the pointer before using it.
--- .../gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c | 15 +++++++++------ drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 1 + 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c +9 -6
@@ -138,12 +138,15 @@ const void *get_powerplay_table(struct pp_hwmgr *hwmgr)u16 size;u8 frev, crev; -void *table_address; - - table_address = (ATOM_Tonga_POWERPLAYTABLE *) -cgs_atom_get_data_table (hwmgr->device, index, &size, &frev, &crev); - - hwmgr->soft_pp_table = table_address;/*Cache the result in RAM.*/ +void *table_address = (void *)hwmgr->soft_pp_table; + +if (!table_address) { + table_address = (ATOM_Tonga_POWERPLAYTABLE *) +cgs_atom_get_data_table (hwmgr->device, + index, &size, &frev, &crev); + hwmgr->soft_pp_table = table_address;/*Cache the result in RAM.*/ + hwmgr->soft_pp_table_size = size; + }return table_address; }
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
@@ -577,6 +577,7 @@ struct pp_hwmgr {void *device;struct pp_smumgr *smumgr;const void *soft_pp_table; +uint32_t soft_pp_table_size;bool need_pp_table_upload;enum amd_dpm_forced_level dpm_level;bool block_hw_access;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: revise reading/writing pptable on Fiji
In reply to Alex DeucherFrom: Eric Huang <[email protected]>
Change the way we store pptables in the driver to better facilitate eventual runtime updates for debugging.
--- drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | 40 ++++++++++++++++++++---- drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h | 4 ++- 2 files changed, 37 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +34 -6
@@ -579,6 +579,18 @@ static int fiji_patch_boot_state(struct pp_hwmgr *hwmgr,return 0 ; } +static int fiji_hwmgr_backend_fini (struct pp_hwmgr *hwmgr) +{ +struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend); + +if (data->soft_pp_table) { +kfree (data->soft_pp_table); + data->soft_pp_table =NULL ; + } + +return phm_hwmgr_backend_fini (hwmgr); +} +static int fiji_hwmgr_backend_init (struct pp_hwmgr *hwmgr) {struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend);
@@ -734,7 +746,7 @@ static int fiji_hwmgr_backend_init(struct pp_hwmgr *hwmgr) data->pcie_lane_cap = (uint32_t )sys_info.value; }else {/* Ignore return value in here, we are cleaning up a mess. */ -tonga_hwmgr_backend_fini (hwmgr); +fiji_hwmgr_backend_fini (hwmgr); }return 0 ;
@@ -5096,18 +5108,34 @@ static int fiji_get_pp_table(struct pp_hwmgr *hwmgr, char **table) {struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend); - *table = (char *)&data->smc_state_table; +if (!data->soft_pp_table) { + data->soft_pp_table =kzalloc (hwmgr->soft_pp_table_size,GFP_KERNEL ); +if (!data->soft_pp_table) +return -ENOMEM ; +memcpy (data->soft_pp_table, hwmgr->soft_pp_table, + hwmgr->soft_pp_table_size); + } + + *table = (char *)&data->soft_pp_table; -return sizeof (struct SMU73_Discrete_DpmTable ); +return hwmgr->soft_pp_table_size; }static int fiji_set_pp_table (struct pp_hwmgr *hwmgr,const char *buf,size_t size) {struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend); -void *table = (void *)&data->smc_state_table; +if (!data->soft_pp_table) { + data->soft_pp_table =kzalloc (hwmgr->soft_pp_table_size,GFP_KERNEL ); +if (!data->soft_pp_table) +return -ENOMEM ; + } + +memcpy (data->soft_pp_table, buf, size); + + hwmgr->soft_pp_table = data->soft_pp_table; -memcpy (table, buf, size); +/* TODO: re-init powerplay to implement modified pptable */ return 0 ; }
@@ -5284,7 +5312,7 @@ bool fiji_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hstatic const struct pp_hwmgr_func fiji_hwmgr_funcs = { .backend_init = &fiji_hwmgr_backend_init, - .backend_fini = &tonga_hwmgr_backend_fini, + .backend_fini = &fiji_hwmgr_backend_fini, .asic_setup = &fiji_setup_asic_task, .dynamic_state_management_enable = &fiji_enable_dpm_tasks, .force_dpm_level = &fiji_dpm_force_dpm_level,
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h +3 -1
@@ -302,6 +302,9 @@ struct fiji_hwmgr {bool pg_acp_init;bool frtc_enabled;bool frtc_status_changed; + +/* soft pptable for re-uploading into smu */ +void *soft_pp_table; };/* To convert to Q8.8 format for firmware */
@@ -338,7 +341,6 @@ enum Fiji_I2CLineID {#define FIJI_UNUSED_GPIO_PIN 0x7Fextern int tonga_initializa_dynamic_state_adjustment_rule_settings (struct pp_hwmgr *hwmgr); -extern int tonga_hwmgr_backend_fini (struct pp_hwmgr *hwmgr);extern int tonga_get_mc_microcode_version (struct pp_hwmgr *hwmgr);extern int tonga_notify_smc_display_config_after_ps_adjustment (struct pp_hwmgr *hwmgr);extern int tonga_notify_smc_display_change (struct pp_hwmgr *hwmgr,bool has_display);
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: revise reading/writing pptable on Tonga
In reply to Alex DeucherFrom: Eric Huang <[email protected]>
Change the way we store pptables in the driver to better facilitate eventual runtime updates for debugging.
--- drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 37 +++++++++++++++-------- drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h | 2 ++ 2 files changed, 27 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +25 -12
@@ -4443,17 +4443,14 @@ int tonga_reset_asic_tasks(struct pp_hwmgr *hwmgr)int tonga_hwmgr_backend_fini (struct pp_hwmgr *hwmgr) { -if (NULL != hwmgr->dyn_state.vddc_dep_on_dal_pwrl) { -kfree (hwmgr->dyn_state.vddc_dep_on_dal_pwrl); - hwmgr->dyn_state.vddc_dep_on_dal_pwrl =NULL ; - } +struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend); -if (NULL != hwmgr->backend) { -kfree (hwmgr->backend); - hwmgr->backend =NULL ; +if (data->soft_pp_table) { +kfree (data->soft_pp_table); + data->soft_pp_table =NULL ; } -return 0 ; +return phm_hwmgr_backend_fini (hwmgr); }/**
@@ -6058,18 +6055,34 @@ static int tonga_get_pp_table(struct pp_hwmgr *hwmgr, char **table) {struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend); - *table = (char *)&data->smc_state_table; +if (!data->soft_pp_table) { + data->soft_pp_table =kzalloc (hwmgr->soft_pp_table_size,GFP_KERNEL ); +if (!data->soft_pp_table) +return -ENOMEM ; +memcpy (data->soft_pp_table, hwmgr->soft_pp_table, + hwmgr->soft_pp_table_size); + } + + *table = (char *)&data->soft_pp_table; -return sizeof (struct SMU72_Discrete_DpmTable ); +return hwmgr->soft_pp_table_size; }static int tonga_set_pp_table (struct pp_hwmgr *hwmgr,const char *buf,size_t size) {struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend); -void *table = (void *)&data->smc_state_table; +if (!data->soft_pp_table) { + data->soft_pp_table =kzalloc (hwmgr->soft_pp_table_size,GFP_KERNEL ); +if (!data->soft_pp_table) +return -ENOMEM ; + } + +memcpy (data->soft_pp_table, buf, size); + + hwmgr->soft_pp_table = data->soft_pp_table; -memcpy (table, buf, size); +/* TODO: re-init powerplay to implement modified pptable */ return 0 ; }
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h +2 -0
@@ -353,6 +353,8 @@ struct tonga_hwmgr {bool acp_power_gated;/* 1: gated, 0:not gated */ bool pg_acp_init; +/* soft pptable for re-uploading into smu */ +void *soft_pp_table; };typedef struct tonga_hwmgr tonga_hwmgr ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/powerplay: revise reading/writing pptable on Polaris10
In reply to Alex DeucherFrom: Eric Huang <[email protected]>
Change the way we store pptables in the driver to better facilitate eventual runtime updates for debugging.
--- .../gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 31 +++++++++++++++++++--- .../gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h | 3 +++ 2 files changed, 30 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +27 -4
@@ -2560,6 +2560,13 @@ int polaris10_reset_asic_tasks(struct pp_hwmgr *hwmgr)int polaris10_hwmgr_backend_fini (struct pp_hwmgr *hwmgr) { +struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); + +if (data->soft_pp_table) { +kfree (data->soft_pp_table); + data->soft_pp_table =NULL ; + } +return phm_hwmgr_backend_fini (hwmgr); }
@@ -4750,18 +4757,34 @@ static int polaris10_get_pp_table(struct pp_hwmgr *hwmgr, char **table) {struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); - *table = (char *)&data->smc_state_table; +if (!data->soft_pp_table) { + data->soft_pp_table =kzalloc (hwmgr->soft_pp_table_size,GFP_KERNEL ); +if (!data->soft_pp_table) +return -ENOMEM ; +memcpy (data->soft_pp_table, hwmgr->soft_pp_table, + hwmgr->soft_pp_table_size); + } -return sizeof (struct SMU74_Discrete_DpmTable ); + *table = (char *)&data->soft_pp_table; + +return hwmgr->soft_pp_table_size; }static int polaris10_set_pp_table (struct pp_hwmgr *hwmgr,const char *buf,size_t size) {struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); -void *table = (void *)&data->smc_state_table; +if (!data->soft_pp_table) { + data->soft_pp_table =kzalloc (hwmgr->soft_pp_table_size,GFP_KERNEL ); +if (!data->soft_pp_table) +return -ENOMEM ; + } + +memcpy (data->soft_pp_table, buf, size); + + hwmgr->soft_pp_table = data->soft_pp_table; -memcpy (table, buf, size); +/* TODO: re-init powerplay to implement modified pptable */ return 0 ; }
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h +3 -0
@@ -309,6 +309,9 @@ struct polaris10_hwmgr {uint32_t up_hyst;uint32_t disable_dpm_mask;bool apply_optimized_settings; + +/* soft pptable for re-uploading into smu */ +void *soft_pp_table; };/* To convert to Q8.8 format for firmware */
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/amdgpu: Drop print_status callbacks.
In reply to Alex DeucherFrom: Tom St Denis <[email protected]>
First patch in series to move to user mode debug tools we're removing the print_status callbacks.
These functions were unused at the moment anyway.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 8 - drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 10 - drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 210 --------------------- drivers/gpu/drm/amd/amdgpu/cik.c | 6 - drivers/gpu/drm/amd/amdgpu/cik_ih.c | 34 ---- drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 56 ------ drivers/gpu/drm/amd/amdgpu/cz_dpm.c | 1 - drivers/gpu/drm/amd/amdgpu/cz_ih.c | 34 ---- drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 12 -- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 12 -- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 12 -- drivers/gpu/drm/amd/amdgpu/fiji_dpm.c | 1 - drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 253 -------------------------- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 182 ------------------ drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 113 ------------ drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 110 ----------- drivers/gpu/drm/amd/amdgpu/iceland_dpm.c | 1 - drivers/gpu/drm/amd/amdgpu/iceland_ih.c | 34 ---- drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 57 ------ drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 54 ------ drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 56 ------ drivers/gpu/drm/amd/amdgpu/tonga_dpm.c | 1 - drivers/gpu/drm/amd/amdgpu/tonga_ih.c | 34 ---- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 112 ------------ drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 115 ------------ drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 107 ----------- drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 70 ------- drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 68 ------- drivers/gpu/drm/amd/amdgpu/vi.c | 6 - drivers/gpu/drm/amd/include/amd_shared.h | 2 - drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 5 - 31 files changed, 1776 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +0 -8
@@ -463,13 +463,6 @@ static int acp_soft_reset(void *handle)return 0 ; } -static void acp_print_status (void *handle) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - -dev_info (adev->dev,"ACP STATUS\n" ); -} -static int acp_set_clockgating_state (void *handle,enum amd_clockgating_state state) {
@@ -494,7 +487,6 @@ const struct amd_ip_funcs acp_ip_funcs = { .is_idle = acp_is_idle, .wait_for_idle = acp_wait_for_idle, .soft_reset = acp_soft_reset, - .print_status = acp_print_status, .set_clockgating_state = acp_set_clockgating_state, .set_powergating_state = acp_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c +0 -10
@@ -303,15 +303,6 @@ static int amdgpu_pp_soft_reset(void *handle)return ret; } -static void amdgpu_pp_print_status (void *handle) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - -if (adev->powerplay.ip_funcs->print_status) - adev->powerplay.ip_funcs->print_status ( - adev->powerplay.pp_handle); -} -const struct amd_ip_funcs amdgpu_pp_ip_funcs = { .early_init = amdgpu_pp_early_init, .late_init = amdgpu_pp_late_init,
@@ -324,7 +315,6 @@ const struct amd_ip_funcs amdgpu_pp_ip_funcs = { .is_idle = amdgpu_pp_is_idle, .wait_for_idle = amdgpu_pp_wait_for_idle, .soft_reset = amdgpu_pp_soft_reset, - .print_status = amdgpu_pp_print_status, .set_clockgating_state = amdgpu_pp_set_clockgating_state, .set_powergating_state = amdgpu_pp_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -210
222 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/cik.c +0 -6
@@ -2214,11 +2214,6 @@ static int cik_common_wait_for_idle(void *handle)return 0 ; } -static void cik_common_print_status (void *handle) -{ - -} -static int cik_common_soft_reset (void *handle) {/* XXX hard reset?? */
@@ -2249,7 +2244,6 @@ const struct amd_ip_funcs cik_common_ip_funcs = { .is_idle = cik_common_is_idle, .wait_for_idle = cik_common_wait_for_idle, .soft_reset = cik_common_soft_reset, - .print_status = cik_common_print_status, .set_clockgating_state = cik_common_set_clockgating_state, .set_powergating_state = cik_common_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/cik_ih.c +0 -34
@@ -372,35 +372,6 @@ static int cik_ih_wait_for_idle(void *handle)return -ETIMEDOUT ; } -static void cik_ih_print_status (void *handle) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - -dev_info (adev->dev,"CIK IH registers\n" ); -dev_info (adev->dev," SRBM_STATUS=0x%08X\n" , -RREG32 (mmSRBM_STATUS)); -dev_info (adev->dev," SRBM_STATUS2=0x%08X\n" , -RREG32 (mmSRBM_STATUS2)); -dev_info (adev->dev," INTERRUPT_CNTL=0x%08X\n" , -RREG32 (mmINTERRUPT_CNTL)); -dev_info (adev->dev," INTERRUPT_CNTL2=0x%08X\n" , -RREG32 (mmINTERRUPT_CNTL2)); -dev_info (adev->dev," IH_CNTL=0x%08X\n" , -RREG32 (mmIH_CNTL)); -dev_info (adev->dev," IH_RB_CNTL=0x%08X\n" , -RREG32 (mmIH_RB_CNTL)); -dev_info (adev->dev," IH_RB_BASE=0x%08X\n" , -RREG32 (mmIH_RB_BASE)); -dev_info (adev->dev," IH_RB_WPTR_ADDR_LO=0x%08X\n" , -RREG32 (mmIH_RB_WPTR_ADDR_LO)); -dev_info (adev->dev," IH_RB_WPTR_ADDR_HI=0x%08X\n" , -RREG32 (mmIH_RB_WPTR_ADDR_HI)); -dev_info (adev->dev," IH_RB_RPTR=0x%08X\n" , -RREG32 (mmIH_RB_RPTR)); -dev_info (adev->dev," IH_RB_WPTR=0x%08X\n" , -RREG32 (mmIH_RB_WPTR)); -} -static int cik_ih_soft_reset (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -412,8 +383,6 @@ static int cik_ih_soft_reset(void *handle) srbm_soft_reset |=SRBM_SOFT_RESET__SOFT_RESET_IH_MASK ;if (srbm_soft_reset) { -cik_ih_print_status ((void *)adev); - tmp =RREG32 (mmSRBM_SOFT_RESET); tmp |= srbm_soft_reset;dev_info (adev->dev,"SRBM_SOFT_RESET=0x%08X\n" , tmp);
@@ -428,8 +397,6 @@ static int cik_ih_soft_reset(void *handle)/* Wait a little for things to settle down */ udelay (50 ); - -cik_ih_print_status ((void *)adev); }return 0 ;
@@ -459,7 +426,6 @@ const struct amd_ip_funcs cik_ih_ip_funcs = { .is_idle = cik_ih_is_idle, .wait_for_idle = cik_ih_wait_for_idle, .soft_reset = cik_ih_soft_reset, - .print_status = cik_ih_print_status, .set_clockgating_state = cik_ih_set_clockgating_state, .set_powergating_state = cik_ih_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -56
80 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/cz_dpm.c +0 -1
@@ -2241,7 +2241,6 @@ const struct amd_ip_funcs cz_dpm_ip_funcs = { .is_idle = NULL, .wait_for_idle = NULL, .soft_reset = NULL, - .print_status = NULL, .set_clockgating_state = cz_dpm_set_clockgating_state, .set_powergating_state = cz_dpm_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/cz_ih.c +0 -34
@@ -351,35 +351,6 @@ static int cz_ih_wait_for_idle(void *handle)return -ETIMEDOUT ; } -static void cz_ih_print_status (void *handle) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - -dev_info (adev->dev,"CZ IH registers\n" ); -dev_info (adev->dev," SRBM_STATUS=0x%08X\n" , -RREG32 (mmSRBM_STATUS)); -dev_info (adev->dev," SRBM_STATUS2=0x%08X\n" , -RREG32 (mmSRBM_STATUS2)); -dev_info (adev->dev," INTERRUPT_CNTL=0x%08X\n" , -RREG32 (mmINTERRUPT_CNTL)); -dev_info (adev->dev," INTERRUPT_CNTL2=0x%08X\n" , -RREG32 (mmINTERRUPT_CNTL2)); -dev_info (adev->dev," IH_CNTL=0x%08X\n" , -RREG32 (mmIH_CNTL)); -dev_info (adev->dev," IH_RB_CNTL=0x%08X\n" , -RREG32 (mmIH_RB_CNTL)); -dev_info (adev->dev," IH_RB_BASE=0x%08X\n" , -RREG32 (mmIH_RB_BASE)); -dev_info (adev->dev," IH_RB_WPTR_ADDR_LO=0x%08X\n" , -RREG32 (mmIH_RB_WPTR_ADDR_LO)); -dev_info (adev->dev," IH_RB_WPTR_ADDR_HI=0x%08X\n" , -RREG32 (mmIH_RB_WPTR_ADDR_HI)); -dev_info (adev->dev," IH_RB_RPTR=0x%08X\n" , -RREG32 (mmIH_RB_RPTR)); -dev_info (adev->dev," IH_RB_WPTR=0x%08X\n" , -RREG32 (mmIH_RB_WPTR)); -} -static int cz_ih_soft_reset (void *handle) {u32 srbm_soft_reset =0 ;
@@ -391,8 +362,6 @@ static int cz_ih_soft_reset(void *handle) SOFT_RESET_IH, 1);if (srbm_soft_reset) { -cz_ih_print_status ((void *)adev); - tmp =RREG32 (mmSRBM_SOFT_RESET); tmp |= srbm_soft_reset;dev_info (adev->dev,"SRBM_SOFT_RESET=0x%08X\n" , tmp);
@@ -407,8 +376,6 @@ static int cz_ih_soft_reset(void *handle)/* Wait a little for things to settle down */ udelay (50 ); - -cz_ih_print_status ((void *)adev); }return 0 ;
@@ -440,7 +407,6 @@ const struct amd_ip_funcs cz_ih_ip_funcs = { .is_idle = cz_ih_is_idle, .wait_for_idle = cz_ih_wait_for_idle, .soft_reset = cz_ih_soft_reset, - .print_status = cz_ih_print_status, .set_clockgating_state = cz_ih_set_clockgating_state, .set_powergating_state = cz_ih_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +0 -12
@@ -3130,14 +3130,6 @@ static int dce_v10_0_wait_for_idle(void *handle)return 0 ; } -static void dce_v10_0_print_status (void *handle) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - -dev_info (adev->dev,"DCE 10.x registers\n" ); -/* XXX todo */ -} -static int dce_v10_0_soft_reset (void *handle) {u32 srbm_soft_reset =0 , tmp;
@@ -3147,8 +3139,6 @@ static int dce_v10_0_soft_reset(void *handle) srbm_soft_reset |=SRBM_SOFT_RESET__SOFT_RESET_DC_MASK ;if (srbm_soft_reset) { -dce_v10_0_print_status ((void *)adev); - tmp =RREG32 (mmSRBM_SOFT_RESET); tmp |= srbm_soft_reset;dev_info (adev->dev,"SRBM_SOFT_RESET=0x%08X\n" , tmp);
@@ -3163,7 +3153,6 @@ static int dce_v10_0_soft_reset(void *handle)/* Wait a little for things to settle down */ udelay (50 ); -dce_v10_0_print_status ((void *)adev); }return 0 ; }
@@ -3512,7 +3501,6 @@ const struct amd_ip_funcs dce_v10_0_ip_funcs = { .is_idle = dce_v10_0_is_idle, .wait_for_idle = dce_v10_0_wait_for_idle, .soft_reset = dce_v10_0_soft_reset, - .print_status = dce_v10_0_print_status, .set_clockgating_state = dce_v10_0_set_clockgating_state, .set_powergating_state = dce_v10_0_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +0 -12
@@ -3193,14 +3193,6 @@ static int dce_v11_0_wait_for_idle(void *handle)return 0 ; } -static void dce_v11_0_print_status (void *handle) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - -dev_info (adev->dev,"DCE 10.x registers\n" ); -/* XXX todo */ -} -static int dce_v11_0_soft_reset (void *handle) {u32 srbm_soft_reset =0 , tmp;
@@ -3210,8 +3202,6 @@ static int dce_v11_0_soft_reset(void *handle) srbm_soft_reset |=SRBM_SOFT_RESET__SOFT_RESET_DC_MASK ;if (srbm_soft_reset) { -dce_v11_0_print_status ((void *)adev); - tmp =RREG32 (mmSRBM_SOFT_RESET); tmp |= srbm_soft_reset;dev_info (adev->dev,"SRBM_SOFT_RESET=0x%08X\n" , tmp);
@@ -3226,7 +3216,6 @@ static int dce_v11_0_soft_reset(void *handle)/* Wait a little for things to settle down */ udelay (50 ); -dce_v11_0_print_status ((void *)adev); }return 0 ; }
@@ -3575,7 +3564,6 @@ const struct amd_ip_funcs dce_v11_0_ip_funcs = { .is_idle = dce_v11_0_is_idle, .wait_for_idle = dce_v11_0_wait_for_idle, .soft_reset = dce_v11_0_soft_reset, - .print_status = dce_v11_0_print_status, .set_clockgating_state = dce_v11_0_set_clockgating_state, .set_powergating_state = dce_v11_0_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +0 -12
@@ -3038,14 +3038,6 @@ static int dce_v8_0_wait_for_idle(void *handle)return 0 ; } -static void dce_v8_0_print_status (void *handle) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - -dev_info (adev->dev,"DCE 8.x registers\n" ); -/* XXX todo */ -} -static int dce_v8_0_soft_reset (void *handle) {u32 srbm_soft_reset =0 , tmp;
@@ -3055,8 +3047,6 @@ static int dce_v8_0_soft_reset(void *handle) srbm_soft_reset |=SRBM_SOFT_RESET__SOFT_RESET_DC_MASK ;if (srbm_soft_reset) { -dce_v8_0_print_status ((void *)adev); - tmp =RREG32 (mmSRBM_SOFT_RESET); tmp |= srbm_soft_reset;dev_info (adev->dev,"SRBM_SOFT_RESET=0x%08X\n" , tmp);
@@ -3071,7 +3061,6 @@ static int dce_v8_0_soft_reset(void *handle)/* Wait a little for things to settle down */ udelay (50 ); -dce_v8_0_print_status ((void *)adev); }return 0 ; }
@@ -3442,7 +3431,6 @@ const struct amd_ip_funcs dce_v8_0_ip_funcs = { .is_idle = dce_v8_0_is_idle, .wait_for_idle = dce_v8_0_wait_for_idle, .soft_reset = dce_v8_0_soft_reset, - .print_status = dce_v8_0_print_status, .set_clockgating_state = dce_v8_0_set_clockgating_state, .set_powergating_state = dce_v8_0_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/fiji_dpm.c +0 -1
@@ -154,7 +154,6 @@ const struct amd_ip_funcs fiji_dpm_ip_funcs = { .is_idle = NULL, .wait_for_idle = NULL, .soft_reset = NULL, - .print_status = NULL, .set_clockgating_state = fiji_dpm_set_clockgating_state, .set_powergating_state = fiji_dpm_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -253
277 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -182
206 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +0 -113
137 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +0 -110
134 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/iceland_dpm.c +0 -1
@@ -168,7 +168,6 @@ const struct amd_ip_funcs iceland_dpm_ip_funcs = { .is_idle = NULL, .wait_for_idle = NULL, .soft_reset = NULL, - .print_status = NULL, .set_clockgating_state = iceland_dpm_set_clockgating_state, .set_powergating_state = iceland_dpm_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/iceland_ih.c +0 -34
@@ -351,35 +351,6 @@ static int iceland_ih_wait_for_idle(void *handle)return -ETIMEDOUT ; } -static void iceland_ih_print_status (void *handle) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - -dev_info (adev->dev,"ICELAND IH registers\n" ); -dev_info (adev->dev," SRBM_STATUS=0x%08X\n" , -RREG32 (mmSRBM_STATUS)); -dev_info (adev->dev," SRBM_STATUS2=0x%08X\n" , -RREG32 (mmSRBM_STATUS2)); -dev_info (adev->dev," INTERRUPT_CNTL=0x%08X\n" , -RREG32 (mmINTERRUPT_CNTL)); -dev_info (adev->dev," INTERRUPT_CNTL2=0x%08X\n" , -RREG32 (mmINTERRUPT_CNTL2)); -dev_info (adev->dev," IH_CNTL=0x%08X\n" , -RREG32 (mmIH_CNTL)); -dev_info (adev->dev," IH_RB_CNTL=0x%08X\n" , -RREG32 (mmIH_RB_CNTL)); -dev_info (adev->dev," IH_RB_BASE=0x%08X\n" , -RREG32 (mmIH_RB_BASE)); -dev_info (adev->dev," IH_RB_WPTR_ADDR_LO=0x%08X\n" , -RREG32 (mmIH_RB_WPTR_ADDR_LO)); -dev_info (adev->dev," IH_RB_WPTR_ADDR_HI=0x%08X\n" , -RREG32 (mmIH_RB_WPTR_ADDR_HI)); -dev_info (adev->dev," IH_RB_RPTR=0x%08X\n" , -RREG32 (mmIH_RB_RPTR)); -dev_info (adev->dev," IH_RB_WPTR=0x%08X\n" , -RREG32 (mmIH_RB_WPTR)); -} -static int iceland_ih_soft_reset (void *handle) {u32 srbm_soft_reset =0 ;
@@ -391,8 +362,6 @@ static int iceland_ih_soft_reset(void *handle) SOFT_RESET_IH, 1);if (srbm_soft_reset) { -iceland_ih_print_status ((void *)adev); - tmp =RREG32 (mmSRBM_SOFT_RESET); tmp |= srbm_soft_reset;dev_info (adev->dev,"SRBM_SOFT_RESET=0x%08X\n" , tmp);
@@ -407,8 +376,6 @@ static int iceland_ih_soft_reset(void *handle)/* Wait a little for things to settle down */ udelay (50 ); - -iceland_ih_print_status ((void *)adev); }return 0 ;
@@ -438,7 +405,6 @@ const struct amd_ip_funcs iceland_ih_ip_funcs = { .is_idle = iceland_ih_is_idle, .wait_for_idle = iceland_ih_wait_for_idle, .soft_reset = iceland_ih_soft_reset, - .print_status = iceland_ih_print_status, .set_clockgating_state = iceland_ih_set_clockgating_state, .set_powergating_state = iceland_ih_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +0 -57
69 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -54
78 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -56
80 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/tonga_dpm.c +0 -1
@@ -154,7 +154,6 @@ const struct amd_ip_funcs tonga_dpm_ip_funcs = { .is_idle = NULL, .wait_for_idle = NULL, .soft_reset = NULL, - .print_status = NULL, .set_clockgating_state = tonga_dpm_set_clockgating_state, .set_powergating_state = tonga_dpm_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/tonga_ih.c +0 -34
@@ -374,35 +374,6 @@ static int tonga_ih_wait_for_idle(void *handle)return -ETIMEDOUT ; } -static void tonga_ih_print_status (void *handle) -{ -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - -dev_info (adev->dev,"TONGA IH registers\n" ); -dev_info (adev->dev," SRBM_STATUS=0x%08X\n" , -RREG32 (mmSRBM_STATUS)); -dev_info (adev->dev," SRBM_STATUS2=0x%08X\n" , -RREG32 (mmSRBM_STATUS2)); -dev_info (adev->dev," INTERRUPT_CNTL=0x%08X\n" , -RREG32 (mmINTERRUPT_CNTL)); -dev_info (adev->dev," INTERRUPT_CNTL2=0x%08X\n" , -RREG32 (mmINTERRUPT_CNTL2)); -dev_info (adev->dev," IH_CNTL=0x%08X\n" , -RREG32 (mmIH_CNTL)); -dev_info (adev->dev," IH_RB_CNTL=0x%08X\n" , -RREG32 (mmIH_RB_CNTL)); -dev_info (adev->dev," IH_RB_BASE=0x%08X\n" , -RREG32 (mmIH_RB_BASE)); -dev_info (adev->dev," IH_RB_WPTR_ADDR_LO=0x%08X\n" , -RREG32 (mmIH_RB_WPTR_ADDR_LO)); -dev_info (adev->dev," IH_RB_WPTR_ADDR_HI=0x%08X\n" , -RREG32 (mmIH_RB_WPTR_ADDR_HI)); -dev_info (adev->dev," IH_RB_RPTR=0x%08X\n" , -RREG32 (mmIH_RB_RPTR)); -dev_info (adev->dev," IH_RB_WPTR=0x%08X\n" , -RREG32 (mmIH_RB_WPTR)); -} -static int tonga_ih_soft_reset (void *handle) {u32 srbm_soft_reset =0 ;
@@ -414,8 +385,6 @@ static int tonga_ih_soft_reset(void *handle) SOFT_RESET_IH, 1);if (srbm_soft_reset) { -tonga_ih_print_status (adev); - tmp =RREG32 (mmSRBM_SOFT_RESET); tmp |= srbm_soft_reset;dev_info (adev->dev,"SRBM_SOFT_RESET=0x%08X\n" , tmp);
@@ -430,8 +399,6 @@ static int tonga_ih_soft_reset(void *handle)/* Wait a little for things to settle down */ udelay (50 ); - -tonga_ih_print_status (adev); }return 0 ;
@@ -461,7 +428,6 @@ const struct amd_ip_funcs tonga_ih_ip_funcs = { .is_idle = tonga_ih_is_idle, .wait_for_idle = tonga_ih_wait_for_idle, .soft_reset = tonga_ih_soft_reset, - .print_status = tonga_ih_print_status, .set_clockgating_state = tonga_ih_set_clockgating_state, .set_powergating_state = tonga_ih_set_powergating_state, };
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0 -112
124 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +0 -115
127 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -107
119 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0 -70
82 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0 -68
80 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/vi.c +0 -6
@@ -1295,11 +1295,6 @@ static int vi_common_wait_for_idle(void *handle)return 0 ; } -static void vi_common_print_status (void *handle) -{ -return ; -} -static int vi_common_soft_reset (void *handle) {return 0 ;
@@ -1424,7 +1419,6 @@ const struct amd_ip_funcs vi_common_ip_funcs = { .is_idle = vi_common_is_idle, .wait_for_idle = vi_common_wait_for_idle, .soft_reset = vi_common_soft_reset, - .print_status = vi_common_print_status, .set_clockgating_state = vi_common_set_clockgating_state, .set_powergating_state = vi_common_set_powergating_state, };
drivers/gpu/drm/amd/include/amd_shared.h +0 -2
@@ -165,8 +165,6 @@ struct amd_ip_funcs {int (*wait_for_idle)(void *handle);/* soft reset the IP block */ int (*soft_reset)(void *handle); -/* dump the IP block status registers */ -void (*print_status)(void *handle);/* enable/disable cg for the IP block */ int (*set_clockgating_state)(void *handle,enum amd_clockgating_state state);
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +0 -5
@@ -180,10 +180,6 @@ static int pp_sw_reset(void *handle)return 0 ; } -static void pp_print_status (void *handle) -{ - -}static int pp_set_clockgating_state (void *handle,enum amd_clockgating_state state)
@@ -355,7 +351,6 @@ const struct amd_ip_funcs pp_ip_funcs = { .is_idle = pp_is_idle, .wait_for_idle = pp_wait_for_idle, .soft_reset = pp_sw_reset, - .print_status = pp_print_status, .set_clockgating_state = pp_set_clockgating_state, .set_powergating_state = pp_set_powergating_state, };
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amd/amdgpu: Add debugfs entries for smc/didt/pcie
In reply to Alex DeucherFrom: Tom St Denis <[email protected]>
This adds 3 new files that can be read/written to access indirect GPU registers.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 230 ++++++++++++++++++++++++++++- 2 files changed, 223 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
@@ -1953,7 +1953,7 @@ struct amdgpu_device {struct amdgpu_debugfs debugfs[AMDGPU_DEBUGFS_MAX_COMPONENTS ];unsigned debugfs_count;#if defined(CONFIG_DEBUG_FS ) -struct dentry *debugfs_regs; +struct dentry *debugfs_regs[AMDGPU_DEBUGFS_MAX_COMPONENTS ];#endif struct amdgpu_atif atif;struct amdgpu_atcs atcs;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +222 -8
254 lines not on this page · raw message
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/powerplay: add missing clockgating callback for tonga
In reply to Alex DeucherWithout this clockgating is not enabled.
--- drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +1 -0
@@ -6214,6 +6214,7 @@ static const struct pp_hwmgr_func tonga_hwmgr_funcs = { .powergate_uvd = tonga_phm_powergate_uvd, .powergate_vce = tonga_phm_powergate_vce, .disable_clock_power_gating = tonga_phm_disable_clock_power_gating, + .update_clock_gatings = tonga_phm_update_clock_gatings, .notify_smc_display_config_after_ps_adjustment = tonga_notify_smc_display_config_after_ps_adjustment, .display_config_changed = tonga_display_configuration_changed_task, .set_max_fan_pwm_output = tonga_set_max_fan_pwm_output,
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu/fiji: set UVD CG state when enabling UVD DPM (v2)
In reply to Alex DeucherNeed to call the IP cg callbacks.
v2: fix gate logic
--- drivers/gpu/drm/amd/powerplay/hwmgr/fiji_clockpowergating.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_clockpowergating.c +9 -2
@@ -47,10 +47,17 @@ int fiji_phm_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate) data->uvd_power_gated = bgate; -if (bgate) +if (bgate) { +cgs_set_clockgating_state (hwmgr->device, +AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE );fiji_update_uvd_dpm (hwmgr, true); -else + }else {fiji_update_uvd_dpm (hwmgr, false); +cgs_set_clockgating_state (hwmgr->device, +AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_UNGATE ); + }return 0 ; }
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/amdgpu/uvd6: add bypass support for fiji (v3)
In reply to Alex DeucherHandle uvd clock bypass settings as part of clockgating setup.
v2: fix gate logic
v3: fix header include
--- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +19 -0
@@ -31,6 +31,8 @@#include "uvd/uvd_6_0_sh_mask.h" #include "oss/oss_2_0_d.h" #include "oss/oss_2_0_sh_mask.h" +#include "smu/smu_7_1_3_d.h" +#include "smu/smu_7_1_3_sh_mask.h" #include "vi.h" static void uvd_v6_0_set_ring_funcs (struct amdgpu_device *adev);
@@ -823,6 +825,20 @@ static void uvd_v6_0_set_hw_clock_gating(struct amdgpu_device *adev) }#endif +static void uvd_v6_set_bypass_mode (struct amdgpu_device *adev,bool enable) +{ +u32 tmp =RREG32_SMC (ixGCK_DFS_BYPASS_CNTL); + +if (enable) + tmp |= (GCK_DFS_BYPASS_CNTL__BYPASSDCLK_MASK | +GCK_DFS_BYPASS_CNTL__BYPASSVCLK_MASK ); +else + tmp &= ~(GCK_DFS_BYPASS_CNTL__BYPASSDCLK_MASK | +GCK_DFS_BYPASS_CNTL__BYPASSVCLK_MASK ); + +WREG32_SMC (ixGCK_DFS_BYPASS_CNTL, tmp); +} +static int uvd_v6_0_set_clockgating_state (void *handle,enum amd_clockgating_state state) {
@@ -830,6 +846,9 @@ static int uvd_v6_0_set_clockgating_state(void *handle,bool enable = (state ==AMD_CG_STATE_GATE ) ? true : false;static int curstate =-1 ; +if (adev->asic_type ==CHIP_FIJI ) +uvd_v6_set_bypass_mode (adev, enable); +if (!(adev->cg_flags &AMD_CG_SUPPORT_UVD_MGCG ))return 0 ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel