drm/amdgpu/nv: set vcn pg flag
Subsystems (3)
PATCH 200/459 drm/amdgpu/nv: set vcn pg flag
From: Jack Xiao <[email protected]>
Enable VCN power gating by default.
--- drivers/gpu/drm/amd/amdgpu/nv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/nv.c +1 -1
@@ -505,7 +505,7 @@ static int nv_common_early_init(void *handle)AMD_CG_SUPPORT_VCN_MGCG |AMD_CG_SUPPORT_BIF_MGCG |AMD_CG_SUPPORT_BIF_LS ; - adev->pg_flags =0 ; + adev->pg_flags =AMD_PG_SUPPORT_VCN ; adev->external_rev_id = adev->rev_id +0x1 ;break ;default :
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20190617193106.18231-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 201/459 drm/amdgpu: fix memory leak in preemption unit test
From: Jack Xiao <[email protected]>
It forgot to put job fence, caused fence memory leak.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
@@ -968,10 +968,12 @@ static void amdgpu_ib_preempt_signal_fences(struct dma_fence **fences,static void amdgpu_ib_preempt_job_recovery (struct drm_gpu_scheduler *sched) {struct drm_sched_job *s_job; +struct dma_fence *fence;spin_lock (&sched->job_list_lock);list_for_each_entry (s_job, &sched->ring_mirror_list, node) { - sched->ops->run_job (s_job); + fence = sched->ops->run_job (s_job); +dma_fence_put (fence); }spin_unlock (&sched->job_list_lock); }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20190617193106.18231-2-alexander.deucher-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 201/459] drm/amdgpu: fix memory leak in preemption unit test
Can probably be squashed into the original adding of the unit test.
Christian.
Am 17.06.19 um 21:29 schrieb Alex Deucher:
Quoted 19 lines
From: Jack Xiao <[email protected]>
It forgot to put job fence, caused fence memory leak.
Signed-off-by Jack Xiao <[email protected]>Reviewed-by Alex Deucher <[email protected]>Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +0
-0@@ -968,10 +968,12 @@ static void amdgpu_ib_preempt_signal_fences(struct dma_fence **fences,static void amdgpu_ib_preempt_job_recovery (struct drm_gpu_scheduler *sched) {struct drm_sched_job *s_job;
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c static void amdgpu_ib_preempt_signal_fences(struct dma_fence **fences, · line 979
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3
-1+struct dma_fence *fence;spin_lock (&sched->job_list_lock);list_for_each_entry (s_job, &sched->ring_mirror_list, node) { - sched->ops->run_job (s_job); + fence = sched->ops->run_job (s_job); +dma_fence_put (fence); }spin_unlock (&sched->job_list_lock); }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 202/459 drm/amdgpu/gfx10: adjust GDS backup size according to real size
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
Adjust GDS backup size in metadata according to its real size in chip.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -1
@@ -4512,7 +4512,8 @@ static void gfx_v10_0_ring_emit_de_meta(struct amdgpu_ring *ring, bool resume)int cnt; csa_addr =amdgpu_csa_vaddr (ring->adev); - gds_addr = csa_addr +4096 ; + gds_addr =ALIGN (csa_addr +AMDGPU_CSA_SIZE - adev->gds.mem.total_size, +PAGE_SIZE ); de_payload.gds_backup_addrlo =lower_32_bits (gds_addr); de_payload.gds_backup_addrhi =upper_32_bits (gds_addr);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 203/459 drm/amd/powerplay: remove uvd_gated/vce_gated from smu_power_context (v2)
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
It's not needed for navi.
v2: remove unused variable (Alex)
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +4 -10
@@ -477,21 +477,15 @@ static int navi10_set_default_dpm_table(struct smu_context *smu)static int navi10_dpm_set_uvd_enable (struct smu_context *smu,bool enable) {int ret =0 ; -struct smu_power_context *smu_power = &smu->smu_power; -struct smu_power_gate *power_gate = &smu_power->power_gate; -if (enable && power_gate->uvd_gated) { +if (enable) { ret =smu_send_smc_msg_with_param (smu, SMU_MSG_PowerUpVcn,1 );if (ret)return ret; - power_gate->uvd_gated = false; }else { -if (!enable && !power_gate->uvd_gated) { - ret =smu_send_smc_msg (smu, SMU_MSG_PowerDownVcn); -if (ret) -return ret; - power_gate->uvd_gated = true; - } + ret =smu_send_smc_msg (smu, SMU_MSG_PowerDownVcn); +if (ret) +return ret; }return 0 ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 204/459 drm/amdgpu/sdma5: fix a sdma potential hang in VK_Examples test
In reply to a message not in the archiveFrom: tiancyin <[email protected]>
[why]
When page fault happens, it could lead to sdma hang is RESP_MODE = 0 for non-PRT case.
[how]
Setting SDMAx_UTCL1_CNTL.RESP_MODE to 0b011 to avoid SDMA halt.
--- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -1
@@ -658,7 +658,8 @@ static int sdma_v5_0_gfx_resume(struct amdgpu_device *adev)/* Set up RESP_MODE to non-copy addresses */ temp =RREG32 (sdma_v5_0_get_reg_offset (adev, i, mmSDMA0_UTCL1_CNTL)); - temp =REG_SET_FIELD (temp,SDMA0_UTCL1_CNTL ,RESP_MODE ,2 ); + temp =REG_SET_FIELD (temp,SDMA0_UTCL1_CNTL ,RESP_MODE ,3 ); + temp =REG_SET_FIELD (temp,SDMA0_UTCL1_CNTL ,REDO_DELAY ,9 );WREG32 (sdma_v5_0_get_reg_offset (adev, i, mmSDMA0_UTCL1_CNTL), temp);/* program default cache read and write policy */
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 205/459 drm/amdgpu/sdma5: incorrect variable type for gpu address
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
Incorrect programming with 64bit gpu address assignment for 32bit variable.
--- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -1
@@ -565,7 +565,8 @@ static int sdma_v5_0_gfx_resume(struct amdgpu_device *adev)u32 doorbell;u32 doorbell_offset;u32 temp; -u32 wptr_gpu_addr, wptr_poll_cntl; +u32 wptr_poll_cntl; +u64 wptr_gpu_addr;int i, r;for (i =0 ; i < adev->sdma.num_instances; i++) {
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 206/459 drm/amdgpu/ucode: add the definitions of MES ucode and ucode data
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
MES requires two seperate firmwares: ucode and ucode data.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +2 -0
@@ -242,6 +242,8 @@ enum AMDGPU_UCODE_ID {AMDGPU_UCODE_ID_CP_MEC1_JT ,AMDGPU_UCODE_ID_CP_MEC2 ,AMDGPU_UCODE_ID_CP_MEC2_JT , +AMDGPU_UCODE_ID_CP_MES , +AMDGPU_UCODE_ID_CP_MES_DATA ,AMDGPU_UCODE_ID_RLC_G ,AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL , AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 207/459 drm/amdgpu/ucode: add mes firmware file support
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
The newly added firmware struct is for mes firmware file.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +15 -0
@@ -104,6 +104,21 @@ struct gfx_firmware_header_v1_0 {uint32_t jt_size;/* size of jt */ }; +/* version_major=1, version_minor=0 */ +struct mes_firmware_header_v1_0 { +struct common_firmware_header header; +uint32_t mes_ucode_version; +uint32_t mes_ucode_size_bytes; +uint32_t mes_ucode_offset_bytes; +uint32_t mes_ucode_data_version; +uint32_t mes_ucode_data_size_bytes; +uint32_t mes_ucode_data_offset_bytes; +uint32_t mes_uc_start_addr_lo; +uint32_t mes_uc_start_addr_hi; +uint32_t mes_data_start_addr_lo; +uint32_t mes_data_start_addr_hi; +}; +/* version_major=1, version_minor=0 */ struct rlc_firmware_header_v1_0 {struct common_firmware_header header;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 208/459 drm/amdgpu/mes10.1: add mes firmware info fields
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
The newly added fields is to store mes firmware related information.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +16 -0
@@ -29,6 +29,22 @@ struct amdgpu_mes_funcs;struct amdgpu_mes {struct amdgpu_adev *adev; +const struct firmware *fw; + +/* mes ucode */ +struct amdgpu_bo *ucode_fw_obj; +uint64_t ucode_fw_gpu_addr; +uint32_t *ucode_fw_ptr; +uint32_t ucode_fw_version; +uint64_t uc_start_addr; + +/* mes ucode data */ +struct amdgpu_bo *data_fw_obj; +uint64_t data_fw_gpu_addr; +uint32_t *data_fw_ptr; +uint32_t data_fw_version; +uint64_t data_start_addr; +/* ip specific functions */ struct amdgpu_mes_funcs *funcs; };
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 209/459 drm/amdgpu/mes10.1: load mes firmware file to CPU buffer
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
It requests MES firmware binary and uploads to CPU buffer.
--- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +43 -0
@@ -23,6 +23,8 @@#include "amdgpu.h" +MODULE_FIRMWARE ("amdgpu/navi10_mes.bin" ); +static int mes_v10_1_add_hw_queue (struct amdgpu_mes *mes,struct mes_add_queue_input *input) {
@@ -54,6 +56,47 @@ static const struct amdgpu_mes_funcs mes_v10_1_funcs = { .resume_gang = mes_v10_1_resume_gang, }; +static int mes_v10_1_init_microcode (struct amdgpu_device *adev) +{ +const char *chip_name; +char fw_name[30 ]; +int err; +const struct mes_firmware_header_v1_0 *mes_hdr; + +switch (adev->asic_type) { +case CHIP_NAVI10 : + chip_name ="navi10" ; +break ; +default : +BUG (); + } + +snprintf (fw_name,sizeof (fw_name),"amdgpu/%s_mes.bin" , chip_name); + err =request_firmware (&adev->mes.fw, fw_name, adev->dev); +if (err) +return err; + + err =amdgpu_ucode_validate (adev->mes.fw); +if (err) { +release_firmware (adev->mes.fw); + adev->mes.fw =NULL ; +return err; + } + + mes_hdr = (const struct mes_firmware_header_v1_0 *)adev->mes.fw->data; + adev->mes.ucode_fw_version =le32_to_cpu (mes_hdr->mes_ucode_version); + adev->mes.ucode_fw_version = +le32_to_cpu (mes_hdr->mes_ucode_data_version); + adev->mes.uc_start_addr = +le32_to_cpu (mes_hdr->mes_uc_start_addr_lo) | + ((uint64_t )(le32_to_cpu (mes_hdr->mes_uc_start_addr_hi)) <<32 ); + adev->mes.data_start_addr = +le32_to_cpu (mes_hdr->mes_data_start_addr_lo) | + ((uint64_t )(le32_to_cpu (mes_hdr->mes_data_start_addr_hi)) <<32 ); + +return 0 ; +} +static int mes_v10_1_sw_init (void *handle) {return 0 ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 210/459 drm/amdgpu/mes10.1: implement ucode CPU buffer destruction
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
It implements the CPU buffer destruction of ucode.
--- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +6 -0
@@ -97,6 +97,12 @@ static int mes_v10_1_init_microcode(struct amdgpu_device *adev)return 0 ; } +static void mes_v10_1_free_microcode (struct amdgpu_device *adev) +{ +release_firmware (adev->mes.fw); + adev->mes.fw =NULL ; +} +static int mes_v10_1_sw_init (void *handle) {return 0 ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 211/459 drm/amdgpu/mes10.1: upload mes ucode to gpu buffer
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
Allocate GPU buffer and upload ucode firmware to the buffer.
--- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +34 -0
@@ -21,7 +21,9 @@* */ +#include <linux/firmware.h> #include "amdgpu.h" +#include "soc15_common.h" MODULE_FIRMWARE ("amdgpu/navi10_mes.bin" );
@@ -103,6 +105,38 @@ static void mes_v10_1_free_microcode(struct amdgpu_device *adev) adev->mes.fw =NULL ; } +static int mes_v10_1_allocate_ucode_buffer (struct amdgpu_device *adev) +{ +int r; +const struct mes_firmware_header_v1_0 *mes_hdr; +const __le32 *fw_data; +unsigned fw_size; + + mes_hdr = (const struct mes_firmware_header_v1_0 *) + adev->mes.fw->data; + + fw_data = (const __le32 *)(adev->mes.fw->data + +le32_to_cpu (mes_hdr->mes_ucode_offset_bytes)); + fw_size =le32_to_cpu (mes_hdr->mes_ucode_size_bytes); + + r =amdgpu_bo_create_reserved (adev, fw_size, +PAGE_SIZE ,AMDGPU_GEM_DOMAIN_GTT , + &adev->mes.ucode_fw_obj, + &adev->mes.ucode_fw_gpu_addr, + (void **)&adev->mes.ucode_fw_ptr); +if (r) { +dev_err (adev->dev,"(%d) failed to create mes fw bo\n" , r); +return r; + } + +memcpy (adev->mes.ucode_fw_ptr, fw_data, fw_size); + +amdgpu_bo_kunmap (adev->mes.ucode_fw_obj); +amdgpu_bo_unreserve (adev->mes.ucode_fw_obj); + +return 0 ; +} +static int mes_v10_1_sw_init (void *handle) {return 0 ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 212/459 drm/amdgpu/mes10.1: upload mes data ucode to gpu buffer
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
Allocate GPU buffer and upload mes data ucode to the buffer.
--- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +32 -0
@@ -137,6 +137,38 @@ static int mes_v10_1_allocate_ucode_buffer(struct amdgpu_device *adev)return 0 ; } +static int mes_v10_1_allocate_ucode_data_buffer (struct amdgpu_device *adev) +{ +int r; +const struct mes_firmware_header_v1_0 *mes_hdr; +const __le32 *fw_data; +unsigned fw_size; + + mes_hdr = (const struct mes_firmware_header_v1_0 *) + adev->mes.fw->data; + + fw_data = (const __le32 *)(adev->mes.fw->data + +le32_to_cpu (mes_hdr->mes_ucode_data_offset_bytes)); + fw_size =le32_to_cpu (mes_hdr->mes_ucode_data_size_bytes); + + r =amdgpu_bo_create_reserved (adev, fw_size, +64 *1024 ,AMDGPU_GEM_DOMAIN_GTT , + &adev->mes.data_fw_obj, + &adev->mes.data_fw_gpu_addr, + (void **)&adev->mes.data_fw_ptr); +if (r) { +dev_err (adev->dev,"(%d) failed to create mes data fw bo\n" , r); +return r; + } + +memcpy (adev->mes.data_fw_ptr, fw_data, fw_size); + +amdgpu_bo_kunmap (adev->mes.data_fw_obj); +amdgpu_bo_unreserve (adev->mes.data_fw_obj); + +return 0 ; +} +static int mes_v10_1_sw_init (void *handle) {return 0 ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 213/459 drm/amdgpu/mes10.1: implement ucode buffers destruction
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
Free ucode GPU buffers.
--- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +11 -0
@@ -169,6 +169,17 @@ static int mes_v10_1_allocate_ucode_data_buffer(struct amdgpu_device *adev)return 0 ; } +static void mes_v10_1_free_ucode_buffers (struct amdgpu_device *adev) +{ +amdgpu_bo_free_kernel (&adev->mes.data_fw_obj, + &adev->mes.data_fw_gpu_addr, + (void **)&adev->mes.data_fw_ptr); + +amdgpu_bo_free_kernel (&adev->mes.ucode_fw_obj, + &adev->mes.ucode_fw_gpu_addr, + (void **)&adev->mes.ucode_fw_ptr); +} +static int mes_v10_1_sw_init (void *handle) {return 0 ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 214/459 drm/amdgpu/mes10.1: implement MES firmware backdoor loading
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
It implements MES firmware backdoor loading.
--- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 67 ++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)
drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +67 -0
@@ -24,6 +24,9 @@#include <linux/firmware.h> #include "amdgpu.h" #include "soc15_common.h" +#include "nv.h" +#include "gc/gc_10_1_0_offset.h" +#include "gc/gc_10_1_0_sh_mask.h" MODULE_FIRMWARE ("amdgpu/navi10_mes.bin" );
@@ -180,6 +183,70 @@ static void mes_v10_1_free_ucode_buffers(struct amdgpu_device *adev) (void **)&adev->mes.ucode_fw_ptr); } +/* This function is for backdoor MES firmware */ +static int mes_v10_1_load_microcode (struct amdgpu_device *adev) +{ +int r; +uint32_t data; + +if (!adev->mes.fw) +return -EINVAL ; + + r =mes_v10_1_allocate_ucode_buffer (adev); +if (r) +return r; + + r =mes_v10_1_allocate_ucode_data_buffer (adev); +if (r) { +mes_v10_1_free_ucode_buffers (adev); +return r; + } + +WREG32_SOC15 (GC ,0 , mmCP_MES_IC_BASE_CNTL,0 ); + +mutex_lock (&adev->srbm_mutex); +/* me=3, pipe=0, queue=0 */ +nv_grbm_select (adev,3 ,0 ,0 ,0 ); + +/* set ucode start address */ +WREG32_SOC15 (GC ,0 , mmCP_MES_PRGRM_CNTR_START, + (uint32_t )(adev->mes.uc_start_addr) >>2 ); + +/* set ucode fimrware address */ +WREG32_SOC15 (GC ,0 , mmCP_MES_IC_BASE_LO, +lower_32_bits (adev->mes.ucode_fw_gpu_addr)); +WREG32_SOC15 (GC ,0 , mmCP_MES_IC_BASE_HI, +upper_32_bits (adev->mes.ucode_fw_gpu_addr)); + +/* set ucode instruction cache boundary to 2M-1 */ +WREG32_SOC15 (GC ,0 , mmCP_MES_MIBOUND_LO,0x1FFFFF ); + +/* set ucode data firmware address */ +WREG32_SOC15 (GC ,0 , mmCP_MES_MDBASE_LO, +lower_32_bits (adev->mes.data_fw_gpu_addr)); +WREG32_SOC15 (GC ,0 , mmCP_MES_MDBASE_HI, +upper_32_bits (adev->mes.data_fw_gpu_addr)); + +/* Set 0x3FFFF (256K-1) to CP_MES_MDBOUND_LO */ +WREG32_SOC15 (GC ,0 , mmCP_MES_MDBOUND_LO,0x3FFFF ); + +/* invalidate ICACHE */ + data =RREG32_SOC15 (GC ,0 , mmCP_MES_IC_OP_CNTL); + data =REG_SET_FIELD (data,CP_MES_IC_OP_CNTL ,PRIME_ICACHE ,0 ); + data =REG_SET_FIELD (data,CP_MES_IC_OP_CNTL ,INVALIDATE_CACHE ,1 ); +WREG32_SOC15 (GC ,0 , mmCP_MES_IC_OP_CNTL, data); + +/* prime the ICACHE. */ + data =RREG32_SOC15 (GC ,0 , mmCP_MES_IC_OP_CNTL); + data =REG_SET_FIELD (data,CP_MES_IC_OP_CNTL ,PRIME_ICACHE ,1 ); +WREG32_SOC15 (GC ,0 , mmCP_MES_IC_OP_CNTL, data); + +nv_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); + +return 0 ; +} +static int mes_v10_1_sw_init (void *handle) {return 0 ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 215/459 drm/amdgpu/mes10.1: implement mes enablement function
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
After MES firmware gets loaded, it enables MES engine starting execution.
--- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +33 -0
@@ -183,6 +183,39 @@ static void mes_v10_1_free_ucode_buffers(struct amdgpu_device *adev) (void **)&adev->mes.ucode_fw_ptr); } +static void mes_v10_1_enable (struct amdgpu_device *adev,bool enable) +{ +uint32_t data =0 ; + +if (enable) { + data =RREG32_SOC15 (GC ,0 , mmCP_MES_CNTL); + data =REG_SET_FIELD (data,CP_MES_CNTL ,MES_PIPE0_RESET ,1 ); +WREG32_SOC15 (GC ,0 , mmCP_MES_CNTL, data); + +/* set ucode start address */ +WREG32_SOC15 (GC ,0 , mmCP_MES_PRGRM_CNTR_START, + (uint32_t )(adev->mes.uc_start_addr) >>2 ); + +/* clear BYPASS_UNCACHED to avoid hangs after interrupt. */ + data =RREG32_SOC15 (GC ,0 , mmCP_MES_DC_OP_CNTL); + data =REG_SET_FIELD (data,CP_MES_DC_OP_CNTL , +BYPASS_UNCACHED ,0 ); +WREG32_SOC15 (GC ,0 , mmCP_MES_DC_OP_CNTL, data); + +/* unhalt MES and activate pipe0 */ + data =REG_SET_FIELD (0 ,CP_MES_CNTL ,MES_PIPE0_ACTIVE ,1 ); +WREG32_SOC15 (GC ,0 , mmCP_MES_CNTL, data); + }else { + data =RREG32_SOC15 (GC ,0 , mmCP_MES_CNTL); + data =REG_SET_FIELD (data,CP_MES_CNTL ,MES_PIPE0_ACTIVE ,0 ); + data =REG_SET_FIELD (data,CP_MES_CNTL , +MES_INVALIDATE_ICACHE ,1 ); + data =REG_SET_FIELD (data,CP_MES_CNTL ,MES_PIPE0_RESET ,1 ); + data =REG_SET_FIELD (data,CP_MES_CNTL ,MES_HALT ,1 ); +WREG32_SOC15 (GC ,0 , mmCP_MES_CNTL, data); + } +} +/* This function is for backdoor MES firmware */ static int mes_v10_1_load_microcode (struct amdgpu_device *adev) {
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 216/459 drm/amdgpu/mes10.1: enable mes FW backdoor loading
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
It enables MES FW backdoor loading in ip block functions.
--- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +36 -0
@@ -235,6 +235,8 @@ static int mes_v10_1_load_microcode(struct amdgpu_device *adev)return r; } +mes_v10_1_enable (adev, false); +WREG32_SOC15 (GC ,0 , mmCP_MES_IC_BASE_CNTL,0 );mutex_lock (&adev->srbm_mutex);
@@ -282,21 +284,55 @@ static int mes_v10_1_load_microcode(struct amdgpu_device *adev)static int mes_v10_1_sw_init (void *handle) { +int r; +struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + r =mes_v10_1_init_microcode (adev); +if (r) +return r; +return 0 ; }static int mes_v10_1_sw_fini (void *handle) { +struct amdgpu_device *adev = (struct amdgpu_device *)handle; + +mes_v10_1_free_microcode (adev); +return 0 ; }static int mes_v10_1_hw_init (void *handle) { +int r; +struct amdgpu_device *adev = (struct amdgpu_device *)handle; + +if (adev->firmware.load_type ==AMDGPU_FW_LOAD_DIRECT ) { + r =mes_v10_1_load_microcode (adev); +if (r) { +DRM_ERROR ("failed to MES fw, r=%d\n" , r); +return r; + } + }else { +DRM_ERROR ("only support direct fw loading on MES\n" ); +return -EINVAL ; + } + +mes_v10_1_enable (adev, true); +return 0 ; }static int mes_v10_1_hw_fini (void *handle) { +struct amdgpu_device *adev = (struct amdgpu_device *)handle; + +mes_v10_1_enable (adev, false); + +if (adev->firmware.load_type ==AMDGPU_FW_LOAD_DIRECT ) +mes_v10_1_free_ucode_buffers (adev); +return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 217/459 drm/amdgpu/gfx10: drop redundant se/sh selection
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
we already selected se/sh at the beginning of the for loop
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -1
@@ -1471,7 +1471,6 @@ static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev) } } -gfx_v10_0_select_se_sh (adev, i, j,0xffffffff ); tmp =RREG32_SOC15 (GC ,0 , mmUTCL1_UTCL0_INVREQ_DISABLE);/* only override TCP & SQC bits */ tmp &=0xffffffff << (4 * max_wgp_per_sh);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 218/459 drm/amdgpu/gfx10: fix unbalanced MAP/UNMAP_QUEUES when async_gfx_ring is disabled
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
gfx_v10_0_kiq_enable_kgq() is called only when async_gfx_ring is enabled, so should gfx_v10_0_kiq_disable_kgq().
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +7 -3
@@ -3563,7 +3563,7 @@ static int gfx_v10_0_hw_init(void *handle) }#ifndef BRING_UP_DEBUG -static int gfx10_0_disable_kgq (struct amdgpu_device *adev) +static int gfx_v10_0_kiq_disable_kgq (struct amdgpu_device *adev) {struct amdgpu_kiq *kiq = &adev->gfx.kiq;struct amdgpu_ring *ring, *kiq_ring = &kiq->ring;
@@ -3612,12 +3612,16 @@ static int gfx10_0_disable_kgq(struct amdgpu_device *adev)static int gfx_v10_0_hw_fini (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int r;amdgpu_irq_put (adev, &adev->gfx.priv_reg_irq,0 );amdgpu_irq_put (adev, &adev->gfx.priv_inst_irq,0 );#ifndef BRING_UP_DEBUG -if (gfx10_0_disable_kgq (adev)) -DRM_ERROR ("KGQ disable failed\n" ); +if (amdgpu_async_gfx_ring) { + r =gfx_v10_0_kiq_disable_kgq (adev); +if (r) +DRM_ERROR ("KGQ disable failed\n" ); + }#endif if (amdgpu_gfx_disable_kcq (adev))DRM_ERROR ("KCQ disable failed\n" );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 219/459 amd/powerplay: fix the issue of uclk dpm
In reply to a message not in the archiveFrom: Kenneth Feng <[email protected]>
PPSMC_MSG_SetUclkFastSwitch message can be applied on vega20, but can't on navi10. This is the prerequisite of uclk dpm on navi10.
--- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +3 -3
@@ -327,7 +327,6 @@ static int smu_v11_0_setup_pptable(struct smu_context *smu) hdr = (const struct smc_firmware_header_v1_0 *) adev->pm.fw->data; version_major =le16_to_cpu (hdr->header.header_version_major); version_minor =le16_to_cpu (hdr->header.header_version_minor); -if (version_major ==2 && smu->smu_table.boot_values.pp_table_id >0 ) {switch (version_minor) {case 0 :
@@ -900,8 +899,9 @@ static int smu_v11_0_notify_display_change(struct smu_context *smu)if (!smu->pm_enabled)return ret; -if (smu_feature_is_enabled (smu,SMU_FEATURE_DPM_UCLK_BIT )) - ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetUclkFastSwitch,1 ); +if (smu_feature_is_enabled (smu,SMU_FEATURE_DPM_UCLK_BIT ) && + smu->adev->gmc.vram_type ==AMDGPU_VRAM_TYPE_HBM ) + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetUclkFastSwitch,1 );return ret; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 220/459 amd/powerplay: enable uclk dpm
In reply to a message not in the archiveFrom: Kenneth Feng <[email protected]>
Enable uclk dpm on navi10 as the result of removing fast switch setting.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +4 -1
@@ -273,7 +273,10 @@ navi10_get_allowed_feature_mask(struct smu_context *smu, | FEATURE_MASK(FEATURE_LED_DISPLAY_BIT) |FEATURE_MASK (FEATURE_MMHUB_PG_BIT ) |FEATURE_MASK (FEATURE_ATHUB_PG_BIT ) - |FEATURE_MASK (FEATURE_DPM_DCEFCLK_BIT ); + |FEATURE_MASK (FEATURE_DPM_DCEFCLK_BIT ) + |FEATURE_MASK (FEATURE_DPM_UCLK_BIT ) + |FEATURE_MASK (FEATURE_MEM_VDDCI_SCALING_BIT ) + |FEATURE_MASK (FEATURE_MEM_MVDD_SCALING_BIT );if (adev->pm.pp_feature &PP_GFXOFF_MASK ) *(uint64_t *)feature_mask |=FEATURE_MASK (FEATURE_GFX_SS_BIT )
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 221/459 drm/amdgpu/VCN2.0: remove powergating for UVDW tile
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
No UVDW tile any more from VCN2.0, so mark out related fields.
It fixes error:
"[drm] Register(0) [mmUVD_PGFSM_STATUS] failed to reach value 0x002aaaaa != 0x00aaaaaa"
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 1 + drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 18 +++++++----------- 2 files changed, 8 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1 -0
@@ -68,6 +68,7 @@enum engine_status_constants {UVD_PGFSM_STATUS__UVDM_UVDU_PWR_ON =0x2AAAA0 , +UVD_PGFSM_STATUS__UVDM_UVDU_PWR_ON_2_0 =0xAAAA0 ,UVD_PGFSM_CONFIG__UVDM_UVDU_PWR_ON =0x00000002 ,UVD_STATUS__UVD_BUSY =0x00000004 ,GB_ADDR_CONFIG_DEFAULT =0x26010011 ,
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +7 -11
@@ -698,12 +698,11 @@ static void vcn_v2_0_disable_static_power_gating(struct amdgpu_device *adev) | 2 << UVD_PGFSM_CONFIG__UVDIR_PWR_CONFIG__SHIFT |2 <<UVD_PGFSM_CONFIG__UVDTD_PWR_CONFIG__SHIFT |2 <<UVD_PGFSM_CONFIG__UVDTE_PWR_CONFIG__SHIFT - |2 <<UVD_PGFSM_CONFIG__UVDE_PWR_CONFIG__SHIFT - | 2 << UVD_PGFSM_CONFIG__UVDW_PWR_CONFIG__SHIFT); + | 2 << UVD_PGFSM_CONFIG__UVDE_PWR_CONFIG__SHIFT);WREG32_SOC15 (VCN ,0 , mmUVD_PGFSM_CONFIG, data);SOC15_WAIT_ON_RREG (VCN ,0 , mmUVD_PGFSM_STATUS, -UVD_PGFSM_STATUS__UVDM_UVDU_PWR_ON ,0xFFFFFF , ret); +UVD_PGFSM_STATUS__UVDM_UVDU_PWR_ON_2_0 ,0xFFFFF , ret); }else { data = (1 <<UVD_PGFSM_CONFIG__UVDM_PWR_CONFIG__SHIFT | 1 << UVD_PGFSM_CONFIG__UVDU_PWR_CONFIG__SHIFT
@@ -714,10 +713,9 @@ static void vcn_v2_0_disable_static_power_gating(struct amdgpu_device *adev) | 1 << UVD_PGFSM_CONFIG__UVDIR_PWR_CONFIG__SHIFT |1 <<UVD_PGFSM_CONFIG__UVDTD_PWR_CONFIG__SHIFT |1 <<UVD_PGFSM_CONFIG__UVDTE_PWR_CONFIG__SHIFT - |1 <<UVD_PGFSM_CONFIG__UVDE_PWR_CONFIG__SHIFT - | 1 << UVD_PGFSM_CONFIG__UVDW_PWR_CONFIG__SHIFT); + | 1 << UVD_PGFSM_CONFIG__UVDE_PWR_CONFIG__SHIFT);WREG32_SOC15 (VCN ,0 , mmUVD_PGFSM_CONFIG, data); -SOC15_WAIT_ON_RREG (VCN ,0 , mmUVD_PGFSM_STATUS,0 ,0xFFFFFFFF , ret); +SOC15_WAIT_ON_RREG (VCN ,0 , mmUVD_PGFSM_STATUS,0 ,0xFFFFF , ret); }/* polling UVD_PGFSM_STATUS to confirm UVDM_PWR_STATUS,
@@ -754,8 +752,7 @@ static void vcn_v2_0_enable_static_power_gating(struct amdgpu_device *adev) | 2 << UVD_PGFSM_CONFIG__UVDIR_PWR_CONFIG__SHIFT |2 <<UVD_PGFSM_CONFIG__UVDTD_PWR_CONFIG__SHIFT |2 <<UVD_PGFSM_CONFIG__UVDTE_PWR_CONFIG__SHIFT - |2 <<UVD_PGFSM_CONFIG__UVDE_PWR_CONFIG__SHIFT - | 2 << UVD_PGFSM_CONFIG__UVDW_PWR_CONFIG__SHIFT); + | 2 << UVD_PGFSM_CONFIG__UVDE_PWR_CONFIG__SHIFT);WREG32_SOC15 (VCN ,0 , mmUVD_PGFSM_CONFIG, data);
@@ -768,9 +765,8 @@ static void vcn_v2_0_enable_static_power_gating(struct amdgpu_device *adev) | 2 << UVD_PGFSM_STATUS__UVDIR_PWR_STATUS__SHIFT |2 <<UVD_PGFSM_STATUS__UVDTD_PWR_STATUS__SHIFT |2 <<UVD_PGFSM_STATUS__UVDTE_PWR_STATUS__SHIFT - |2 <<UVD_PGFSM_STATUS__UVDE_PWR_STATUS__SHIFT - | 2 << UVD_PGFSM_STATUS__UVDW_PWR_STATUS__SHIFT); -SOC15_WAIT_ON_RREG (VCN ,0 , mmUVD_PGFSM_STATUS, data,0xFFFFFFFF , ret); + | 2 << UVD_PGFSM_STATUS__UVDE_PWR_STATUS__SHIFT); +SOC15_WAIT_ON_RREG (VCN ,0 , mmUVD_PGFSM_STATUS, data,0xFFFFF , ret); } }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 222/459 drm/amd/powerplay: disable uclk dpm by default
In reply to a message not in the archiveFrom: tiancyin <[email protected]>
[why]
The uclk dpm feature is not supported by some certain navi10 board like 18202, while supported by some board like 18201. It causes modprobe failure on 18202 board.
[how]
Disabled this feature by default, it can be enabled by module parameter uclk_dpm_support=1.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +4 -2
@@ -273,8 +273,10 @@ navi10_get_allowed_feature_mask(struct smu_context *smu, | FEATURE_MASK(FEATURE_LED_DISPLAY_BIT) |FEATURE_MASK (FEATURE_MMHUB_PG_BIT ) |FEATURE_MASK (FEATURE_ATHUB_PG_BIT ) - |FEATURE_MASK (FEATURE_DPM_DCEFCLK_BIT ) - |FEATURE_MASK (FEATURE_DPM_UCLK_BIT ) + |FEATURE_MASK (FEATURE_DPM_DCEFCLK_BIT ); + +if (adev->pm.pp_feature &PP_MCLK_DPM_MASK ) + *(uint64_t *)feature_mask |=FEATURE_MASK (FEATURE_DPM_UCLK_BIT ) |FEATURE_MASK (FEATURE_MEM_VDDCI_SCALING_BIT ) |FEATURE_MASK (FEATURE_MEM_MVDD_SCALING_BIT );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 223/459 drm/amd/powerplay/smu11: disable PLL shutdown when gfxoff enabled
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
MP1 cannot access clock IP during MP1 FW reload, disable PLL shutdown as a workaround.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +5 -1
@@ -383,10 +383,14 @@ static int navi10_append_powerplay_table(struct smu_context *smu)/* Mvdd Svi2 Div Ratio Setting */ smc_pptable->MvddRatio = smc_dpm_table->MvddRatio; -if (adev->pm.pp_feature &PP_GFXOFF_MASK ) +if (adev->pm.pp_feature &PP_GFXOFF_MASK ) { *(uint64_t *)smc_pptable->FeaturesToRun |=FEATURE_MASK (FEATURE_GFX_SS_BIT ) |FEATURE_MASK (FEATURE_GFXOFF_BIT ); +/* TODO: remove it once SMU fw fix it */ + smc_pptable->DebugOverrides |=DPM_OVERRIDE_DISABLE_DFLL_PLL_SHUTDOWN ; + } +return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 224/459 drm/amdgpu: RLC must be disabled after SMU when S3 on navi
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
SMU requires to interact with RLC when disable all features, so RLC shouldn't be disabled ahead of SMU.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 +--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -3
@@ -1596,8 +1596,6 @@ void gfx_v10_0_rlc_stop(struct amdgpu_device *adev) tmp =REG_SET_FIELD (tmp,RLC_CNTL ,RLC_ENABLE_F32 ,0 );WREG32_SOC15 (GC ,0 , mmRLC_CNTL, tmp); - -gfx_v10_0_enable_gui_idle_interrupt (adev, false); }static void gfx_v10_0_rlc_reset (struct amdgpu_device *adev)
@@ -3630,7 +3628,7 @@ static int gfx_v10_0_hw_fini(void *handle)return 0 ; }gfx_v10_0_cp_enable (adev, false); -gfx_v10_0_rlc_stop (adev); +gfx_v10_0_enable_gui_idle_interrupt (adev, false);return 0 ; }
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -0
@@ -943,6 +943,10 @@ static int smu_suspend(void *handle) smu->watermarks_bitmap &= ~(WATERMARKS_LOADED ); +if (adev->asic_type >=CHIP_NAVI10 && + adev->gfx.rlc.funcs->stop) + adev->gfx.rlc.funcs->stop (adev); +return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 225/459 drm/amdgpu/gfx10: remove unnecessary waiting on gfx inactive
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
The following KIQ ring test could guarantee the previous unmap has been done.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 35 ++++---------------------- 1 file changed, 5 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5 -30
@@ -3564,9 +3564,8 @@ static int gfx_v10_0_hw_init(void *handle)static int gfx_v10_0_kiq_disable_kgq (struct amdgpu_device *adev) {struct amdgpu_kiq *kiq = &adev->gfx.kiq; -struct amdgpu_ring *ring, *kiq_ring = &kiq->ring; -struct v10_gfx_mqd *mqd; -int r, i, j; +struct amdgpu_ring *kiq_ring = &kiq->ring; +int i;if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)return -EINVAL ;
@@ -3575,33 +3574,9 @@ static int gfx_v10_0_kiq_disable_kgq(struct amdgpu_device *adev) adev->gfx.num_gfx_rings))return -ENOMEM ; -for (i =0 ; i < adev->gfx.num_gfx_rings; i++) { - ring = &adev->gfx.gfx_ring[i]; - - r =amdgpu_bo_reserve (ring->mqd_obj, false); -if (unlikely (r !=0 )) -return r; - - r =amdgpu_bo_kmap (ring->mqd_obj, (void **)&ring->mqd_ptr); -if (!r) { - kiq->pmf->kiq_unmap_queues (kiq_ring, ring, -PREEMPT_QUEUES ,0 ,0 ); - mqd = ring->mqd_ptr; - -for (j =0 ; j < adev->usec_timeout; j++) { -if (!mqd->cp_gfx_hqd_active) -break ; -udelay (1 ); - } - -if (j == adev->usec_timeout) -DRM_ERROR ("failed to wait for gfx inactive\n" ); - -amdgpu_bo_kunmap (ring->mqd_obj); - ring->mqd_ptr =NULL ; - } -amdgpu_bo_unreserve (ring->mqd_obj); - } +for (i =0 ; i < adev->gfx.num_gfx_rings; i++) + kiq->pmf->kiq_unmap_queues (kiq_ring, &adev->gfx.gfx_ring[i], +PREEMPT_QUEUES ,0 ,0 );return amdgpu_ring_test_ring (kiq_ring); }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 226/459 drm/amdgpu/gfx10: require to pin/unpin CSIB BO when suspend/resume
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
CSIB BO is required to be pinned down to guarantee bo is always valid when resume, and to be unpinned it so that its content can be saved during suspend.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +38 -0
@@ -813,6 +813,39 @@ static int gfx_v10_0_rlc_init(struct amdgpu_device *adev)return 0 ; } +static int gfx_v10_0_csb_vram_pin (struct amdgpu_device *adev) +{ +int r; + + r =amdgpu_bo_reserve (adev->gfx.rlc.clear_state_obj, false); +if (unlikely (r !=0 )) +return r; + + r =amdgpu_bo_pin (adev->gfx.rlc.clear_state_obj, +AMDGPU_GEM_DOMAIN_VRAM ); +if (!r) + adev->gfx.rlc.clear_state_gpu_addr = +amdgpu_bo_gpu_offset (adev->gfx.rlc.clear_state_obj); + +amdgpu_bo_unreserve (adev->gfx.rlc.clear_state_obj); + +return r; +} + +static void gfx_v10_0_csb_vram_unpin (struct amdgpu_device *adev) +{ +int r; + +if (!adev->gfx.rlc.clear_state_obj) +return ; + + r =amdgpu_bo_reserve (adev->gfx.rlc.clear_state_obj, true); +if (likely (r ==0 )) { +amdgpu_bo_unpin (adev->gfx.rlc.clear_state_obj); +amdgpu_bo_unreserve (adev->gfx.rlc.clear_state_obj); + } +} +static void gfx_v10_0_mec_fini (struct amdgpu_device *adev) {amdgpu_bo_free_kernel (&adev->gfx.mec.hpd_eop_obj,NULL ,NULL );
@@ -3517,6 +3550,10 @@ static int gfx_v10_0_hw_init(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; + r =gfx_v10_0_csb_vram_pin (adev); +if (r) +return r; +if (!amdgpu_emu_mode)gfx_v10_0_init_golden_registers (adev);
@@ -3604,6 +3641,7 @@ static int gfx_v10_0_hw_fini(void *handle) }gfx_v10_0_cp_enable (adev, false);gfx_v10_0_enable_gui_idle_interrupt (adev, false); +gfx_v10_0_csb_vram_unpin (adev);return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 227/459 drm/amd/powerplay: add function get current clock freq interface for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add function of get_current_clk_freq_by_table for navi10.
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 5 ++++ drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 24 +++++++++++++++++++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 4 ++++ 3 files changed, 33 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +5 -0
@@ -589,6 +589,9 @@ struct pptable_funcs { uint32_t *value);int (*set_watermarks_table)(struct smu_context *smu,void *watermarks,struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges); +int (*get_current_clk_freq_by_table)(struct smu_context *smu, +enum smu_clk_type clk_type, +uint32_t *value); };struct smu_funcs
@@ -881,6 +884,8 @@ struct smu_funcs ((smu)->ppt_funcs->get_ppfeature_status ? (smu)->ppt_funcs->get_ppfeature_status((smu), (buf)) : -EINVAL)#define smu_set_watermarks_table (smu, tab, clock_ranges) \ ((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0) +#define smu_get_current_clk_freq_by_table (smu, clk_type, value) \ + ((smu)->ppt_funcs->get_current_clk_freq_by_table ? (smu)->ppt_funcs->get_current_clk_freq_by_table((smu), (clk_type), (value)) : 0) extern int smu_get_atom_data_table(struct smu_context *smu, uint32_t table, uint16_t *size, uint8_t *frev, uint8_t *crev,
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +24 -0
@@ -500,6 +500,29 @@ static int navi10_dpm_set_uvd_enable(struct smu_context *smu, bool enable)return 0 ; } +static int navi10_get_current_clk_freq_by_table (struct smu_context *smu, +enum smu_clk_type clk_type, +uint32_t *value) +{ +static SmuMetrics_t metrics = {0 }; +int ret =0 , clk_id =0 ; + +if (!value) +return -EINVAL ; + + ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS , (void *)&metrics, false); +if (ret) +return ret; + + clk_id =smu_clk_get_index (smu, clk_type); +if (clk_id <0 ) +return clk_id; + + *value = metrics.CurrClock[clk_id]; + +return ret; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -514,6 +537,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_allowed_feature_mask = navi10_get_allowed_feature_mask, .set_default_dpm_table = navi10_set_default_dpm_table, .dpm_set_uvd_enable = navi10_dpm_set_uvd_enable, + .get_current_clk_freq_by_table = navi10_get_current_clk_freq_by_table, };void navi10_set_ppt_funcs (struct smu_context *smu)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +4 -0
@@ -1084,6 +1084,10 @@ static int smu_v11_0_get_current_clk_freq(struct smu_context *smu,if (clk_id >=SMU_CLK_COUNT || !value)return -EINVAL ; +/* if don't has GetDpmClockFreq Message, try get current clock by SmuMetrics_t */ +if (smu_msg_get_index (smu, SMU_MSG_GetDpmClockFreq) ==0 ) +return smu_get_current_clk_freq_by_table (smu, clk_id, value); + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_GetDpmClockFreq, (smu_clk_get_index (smu, clk_id) <<16 ));if (ret)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 228/459 drm/amd/powerplay: add helper function to get dpm freq informations
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
this function can help driver to get ppclk informations
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 37 +++++++++++++++++++ .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 4 ++ 2 files changed, 41 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +37 -0
@@ -60,6 +60,43 @@ int smu_get_smc_version(struct smu_context *smu, uint32_t *if_version, uint32_treturn ret; } +int smu_get_dpm_freq_by_index (struct smu_context *smu,enum smu_clk_type clk_type, +uint16_t level,uint32_t *value) +{ +int ret =0 , clk_id =0 ; +uint32_t param; + +if (!value) +return -EINVAL ; + + clk_id =smu_clk_get_index (smu, clk_type); +if (clk_id <0 ) +return clk_id; + + param = (uint32_t )(((clk_id &0xffff ) <<16 ) | (level &0xffff )); + + ret =smu_send_smc_msg_with_param (smu,SMU_MSG_GetDpmFreqByIndex, + param); +if (ret) +return ret; + + ret =smu_read_smc_arg (smu, ¶m); +if (ret) +return ret; + +/* BIT31: 0 - Fine grained DPM, 1 - Dicrete DPM +* now, we un-support it */ + *value = param &0x7fffffff ; + +return ret; +} + +int smu_get_dpm_level_count (struct smu_context *smu,enum smu_clk_type clk_type, +uint32_t *value) +{ +return smu_get_dpm_freq_by_index (smu, clk_type,0xff , value); +} +int smu_dpm_set_power_gate (struct smu_context *smu,uint32_t block_type,bool gate) {
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +4 -0
@@ -928,4 +928,8 @@ extern int smu_handle_task(struct smu_context *smu,enum amd_dpm_forced_level level, enum amd_pp_task task_id);int smu_get_smc_version (struct smu_context *smu,uint32_t *if_version,uint32_t *smu_version); +int smu_get_dpm_freq_by_index (struct smu_context *smu,enum smu_clk_type clk_type, +uint16_t level,uint32_t *value); +int smu_get_dpm_level_count (struct smu_context *smu,enum smu_clk_type clk_type, +uint32_t *value);#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 229/459 drm/amd/powerplay: add function print_clk_levels for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add sysfs interface of print_clk_levels sysfs for navi10.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 24 +++++----- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 13 ++++-- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 44 +++++++++++++++++++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 22 +++++----- 4 files changed, 77 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +12 -12
@@ -726,10 +726,10 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,uint32_t size =0 ;if (is_support_sw_smu (adev)) { - size =smu_print_clk_levels (&adev->smu,OD_SCLK , buf); - size +=smu_print_clk_levels (&adev->smu,OD_MCLK , buf+size); - size +=smu_print_clk_levels (&adev->smu,OD_VDDC_CURVE , buf+size); - size +=smu_print_clk_levels (&adev->smu,OD_RANGE , buf+size); + size =smu_print_clk_levels (&adev->smu,SMU_OD_SCLK , buf); + size +=smu_print_clk_levels (&adev->smu,SMU_OD_MCLK , buf+size); + size +=smu_print_clk_levels (&adev->smu,SMU_OD_VDDC_CURVE , buf+size); + size +=smu_print_clk_levels (&adev->smu,SMU_OD_RANGE , buf+size);return size; }else if (adev->powerplay.pp_funcs->print_clock_levels) { size =amdgpu_dpm_print_clock_levels (adev,OD_SCLK , buf);
@@ -840,7 +840,7 @@ static ssize_t amdgpu_get_pp_dpm_sclk(struct device *dev,return adev->virt.ops->get_pp_clk (adev,PP_SCLK , buf);if (is_support_sw_smu (adev)) -return smu_print_clk_levels (&adev->smu,PP_SCLK , buf); +return smu_print_clk_levels (&adev->smu,SMU_SCLK , buf);else if (adev->powerplay.pp_funcs->print_clock_levels)return amdgpu_dpm_print_clock_levels (adev,PP_SCLK , buf);else
@@ -923,7 +923,7 @@ static ssize_t amdgpu_get_pp_dpm_mclk(struct device *dev,return adev->virt.ops->get_pp_clk (adev,PP_MCLK ,buf);if (is_support_sw_smu (adev)) -return smu_print_clk_levels (&adev->smu,PP_MCLK , buf); +return smu_print_clk_levels (&adev->smu,SMU_MCLK , buf);else if (adev->powerplay.pp_funcs->print_clock_levels)return amdgpu_dpm_print_clock_levels (adev,PP_MCLK , buf);else
@@ -966,7 +966,7 @@ static ssize_t amdgpu_get_pp_dpm_socclk(struct device *dev,struct amdgpu_device *adev = ddev->dev_private;if (is_support_sw_smu (adev)) -return smu_print_clk_levels (&adev->smu,PP_SOCCLK , buf); +return smu_print_clk_levels (&adev->smu,SMU_SOCCLK , buf);else if (adev->powerplay.pp_funcs->print_clock_levels)return amdgpu_dpm_print_clock_levels (adev,PP_SOCCLK , buf);else
@@ -1006,7 +1006,7 @@ static ssize_t amdgpu_get_pp_dpm_fclk(struct device *dev,struct amdgpu_device *adev = ddev->dev_private;if (is_support_sw_smu (adev)) -return smu_print_clk_levels (&adev->smu,PP_FCLK , buf); +return smu_print_clk_levels (&adev->smu,SMU_FCLK , buf);else if (adev->powerplay.pp_funcs->print_clock_levels)return amdgpu_dpm_print_clock_levels (adev,PP_FCLK , buf);else
@@ -1046,7 +1046,7 @@ static ssize_t amdgpu_get_pp_dpm_dcefclk(struct device *dev,struct amdgpu_device *adev = ddev->dev_private;if (is_support_sw_smu (adev)) -return smu_print_clk_levels (&adev->smu,PP_DCEFCLK , buf); +return smu_print_clk_levels (&adev->smu,SMU_DCEFCLK , buf);else if (adev->powerplay.pp_funcs->print_clock_levels)return amdgpu_dpm_print_clock_levels (adev,PP_DCEFCLK , buf);else
@@ -1086,7 +1086,7 @@ static ssize_t amdgpu_get_pp_dpm_pcie(struct device *dev,struct amdgpu_device *adev = ddev->dev_private;if (is_support_sw_smu (adev)) -return smu_print_clk_levels (&adev->smu,PP_PCIE , buf); +return smu_print_clk_levels (&adev->smu,SMU_PCIE , buf);else if (adev->powerplay.pp_funcs->print_clock_levels)return amdgpu_dpm_print_clock_levels (adev,PP_PCIE , buf);else
@@ -1127,7 +1127,7 @@ static ssize_t amdgpu_get_pp_sclk_od(struct device *dev,uint32_t value =0 ;if (is_support_sw_smu (adev)) - value =smu_get_od_percentage (&(adev->smu),OD_SCLK ); + value =smu_get_od_percentage (&(adev->smu),SMU_OD_SCLK );else if (adev->powerplay.pp_funcs->get_sclk_od) value =amdgpu_dpm_get_sclk_od (adev);
@@ -1178,7 +1178,7 @@ static ssize_t amdgpu_get_pp_mclk_od(struct device *dev,uint32_t value =0 ;if (is_support_sw_smu (adev)) - value =smu_get_od_percentage (&(adev->smu),OD_MCLK ); + value =smu_get_od_percentage (&(adev->smu),SMU_OD_MCLK );else if (adev->powerplay.pp_funcs->get_mclk_od) value =amdgpu_dpm_get_mclk_od (adev);
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +10 -3
@@ -244,6 +244,13 @@ enum smu_clk_typeSMU_PIXCLK ,SMU_PHYCLK ,SMU_FCLK , +SMU_SCLK , +SMU_MCLK , +SMU_PCIE , +SMU_OD_SCLK , +SMU_OD_MCLK , +SMU_OD_VDDC_CURVE , +SMU_OD_RANGE , SMU_CLK_COUNT, };
@@ -531,7 +538,7 @@ struct pptable_funcs {int (*set_default_dpm_table)(struct smu_context *smu);int (*set_power_state)(struct smu_context *smu);int (*populate_umd_state_clk)(struct smu_context *smu); -int (*print_clk_levels)(struct smu_context *smu,enum pp_clock_type type,char *buf); +int (*print_clk_levels)(struct smu_context *smu,enum smu_clk_type clk_type,char *buf);int (*force_clk_levels)(struct smu_context *smu,enum pp_clock_type type,uint32_t mask);int (*set_default_od8_settings)(struct smu_context *smu); int (*update_specified_od8_value)(struct smu_context *smu,
@@ -767,8 +774,8 @@ struct smu_funcs ((smu)->funcs->set_power_limit ? (smu)->funcs->set_power_limit((smu), (limit)) : 0)#define smu_get_current_clk_freq (smu, clk_id, value) \ ((smu)->funcs->get_current_clk_freq? (smu)->funcs->get_current_clk_freq((smu), (clk_id), (value)) : 0) -#define smu_print_clk_levels (smu, type, buf) \ - ((smu)->ppt_funcs->print_clk_levels ? (smu)->ppt_funcs->print_clk_levels((smu), (type), (buf)) : 0) +#define smu_print_clk_levels (smu, clk_type, buf) \ + ((smu)->ppt_funcs->print_clk_levels ? (smu)->ppt_funcs->print_clk_levels((smu), (clk_type), (buf)) : 0)#define smu_force_clk_levels (smu, type, level) \ ((smu)->ppt_funcs->force_clk_levels ? (smu)->ppt_funcs->force_clk_levels((smu), (type), (level)) : 0)#define smu_get_od_percentage (smu, type) \
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +44 -0
64 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +11 -11
@@ -892,7 +892,7 @@ static int vega20_get_clk_table(struct smu_context *smu, }static int vega20_print_clk_levels (struct smu_context *smu, -enum pp_clock_type type,char *buf) +enum smu_clk_type type,char *buf) {int i, now, size =0 ;int ret =0 ;
@@ -912,7 +912,7 @@ static int vega20_print_clk_levels(struct smu_context *smu, dpm_table = smu_dpm->dpm_context;switch (type) { -case PP_SCLK : +case SMU_SCLK : ret =smu_get_current_clk_freq (smu,SMU_GFXCLK , &now);if (ret) {pr_err ("Attempt to get current gfx clk Failed!" );
@@ -933,7 +933,7 @@ static int vega20_print_clk_levels(struct smu_context *smu, ? "*" : "");break ; -case PP_MCLK : +case SMU_MCLK : ret =smu_get_current_clk_freq (smu,SMU_UCLK , &now);if (ret) {pr_err ("Attempt to get current mclk Failed!" );
@@ -954,7 +954,7 @@ static int vega20_print_clk_levels(struct smu_context *smu, ? "*" : "");break ; -case PP_SOCCLK : +case SMU_SOCCLK : ret =smu_get_current_clk_freq (smu,PPCLK_SOCCLK , &now);if (ret) {pr_err ("Attempt to get current socclk Failed!" );
@@ -975,7 +975,7 @@ static int vega20_print_clk_levels(struct smu_context *smu, ? "*" : "");break ; -case PP_FCLK : +case SMU_FCLK : ret =smu_get_current_clk_freq (smu,PPCLK_FCLK , &now);if (ret) {pr_err ("Attempt to get current fclk Failed!" );
@@ -990,7 +990,7 @@ static int vega20_print_clk_levels(struct smu_context *smu, ? "*" : "");break ; -case PP_DCEFCLK : +case SMU_DCEFCLK : ret =smu_get_current_clk_freq (smu,PPCLK_DCEFCLK , &now);if (ret) {pr_err ("Attempt to get current dcefclk Failed!" );
@@ -1010,7 +1010,7 @@ static int vega20_print_clk_levels(struct smu_context *smu, (clocks.data[i].clocks_in_khz == now * 10) ? "*" : "");break ; -case PP_PCIE : +case SMU_PCIE : gen_speed = (RREG32_PCIE (smnPCIE_LC_SPEED_CNTL) &PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK ) >>PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE__SHIFT ;
@@ -1035,7 +1035,7 @@ static int vega20_print_clk_levels(struct smu_context *smu, "*" : "");break ; -case OD_SCLK : +case SMU_OD_SCLK :if (od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FMIN ].feature_id && od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FMAX ].feature_id) { size =sprintf (buf,"%s:\n" ,"OD_SCLK" );
@@ -1047,7 +1047,7 @@ static int vega20_print_clk_levels(struct smu_context *smu,break ; -case OD_MCLK : +case SMU_OD_MCLK :if (od8_settings->od8_settings_array[OD8_SETTING_UCLK_FMAX ].feature_id) { size =sprintf (buf,"%s:\n" ,"OD_MCLK" ); size += sprintf(buf + size, "1: %10uMhz\n",
@@ -1056,7 +1056,7 @@ static int vega20_print_clk_levels(struct smu_context *smu,break ; -case OD_VDDC_CURVE : +case SMU_OD_VDDC_CURVE : if (od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FREQ1].feature_id && od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FREQ2].feature_id && od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FREQ3].feature_id &&
@@ -1077,7 +1077,7 @@ static int vega20_print_clk_levels(struct smu_context *smu,break ; -case OD_RANGE : +case SMU_OD_RANGE : size =sprintf (buf,"%s:\n" ,"OD_RANGE" ); if (od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FMIN].feature_id &&
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 230/459 drm/amd/powerplay: add helper function of smu_get_dpm_freq_range
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add this helper function to get dpm clk information (min, max);
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 36 +++++++++++++++++++ .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 2 ++ 2 files changed, 38 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +36 -0
@@ -60,6 +60,42 @@ int smu_get_smc_version(struct smu_context *smu, uint32_t *if_version, uint32_treturn ret; } +int smu_get_dpm_freq_range (struct smu_context *smu,enum smu_clk_type clk_type, +uint32_t *min,uint32_t *max) +{ +int ret =0 , clk_id =0 ; +uint32_t param =0 ; + +if (!min && !max) +return -EINVAL ; + + clk_id =smu_clk_get_index (smu, clk_type); +if (clk_id <0 ) +return clk_id; + + param = (clk_id &0xffff ) <<16 ; + +if (max) { + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_GetMaxDpmFreq, param); +if (ret) +return ret; + ret =smu_read_smc_arg (smu, max); +if (ret) +return ret; + } + +if (min) { + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_GetMinDpmFreq, param); +if (ret) +return ret; + ret =smu_read_smc_arg (smu, min); +if (ret) +return ret; + } + +return ret; +} +int smu_get_dpm_freq_by_index (struct smu_context *smu,enum smu_clk_type clk_type,uint16_t level,uint32_t *value) {
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -0
@@ -939,4 +939,6 @@ int smu_get_dpm_freq_by_index(struct smu_context *smu, enum smu_clk_type clk_typ uint16_t level, uint32_t *value);int smu_get_dpm_level_count (struct smu_context *smu,enum smu_clk_type clk_type,uint32_t *value); +int smu_get_dpm_freq_range (struct smu_context *smu,enum smu_clk_type clk_type, +uint32_t *min,uint32_t *max);#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 231/459 drm/amd/powerplay: add helper function of smu_set_soft_freq_range
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add this helper function to get dpm clk information.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 33 +++++++++++++++++++ .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 2 ++ 2 files changed, 35 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +33 -0
@@ -60,6 +60,39 @@ int smu_get_smc_version(struct smu_context *smu, uint32_t *if_version, uint32_treturn ret; } +int smu_set_soft_freq_range (struct smu_context *smu,enum smu_clk_type clk_type, +uint32_t min,uint32_t max) +{ +int ret =0 , clk_id =0 ; +uint32_t param; + +if (min <=0 && max <=0 ) +return -EINVAL ; + + clk_id =smu_clk_get_index (smu, clk_type); +if (clk_id <0 ) +return clk_id; + +if (max >0 ) { + param = (uint32_t )((clk_id <<16 ) | (max &0xffff )); + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetSoftMaxByFreq, + param); +if (ret) +return ret; + } + +if (min >0 ) { + param = (uint32_t )((clk_id <<16 ) | (min &0xffff )); + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetSoftMinByFreq, + param); +if (ret) +return ret; + } + + +return ret; +} +int smu_get_dpm_freq_range (struct smu_context *smu,enum smu_clk_type clk_type,uint32_t *min,uint32_t *max) {
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -0
@@ -941,4 +941,6 @@ int smu_get_dpm_level_count(struct smu_context *smu, enum smu_clk_type clk_type, uint32_t *value);int smu_get_dpm_freq_range (struct smu_context *smu,enum smu_clk_type clk_type,uint32_t *min,uint32_t *max); +int smu_set_soft_freq_range (struct smu_context *smu,enum smu_clk_type clk_type, +uint32_t min,uint32_t max);#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 232/459 drm/amd/powerplay: add helper function of smu_set_hard_freq_range
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add this function to get dpm clock information.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 33 +++++++++++++++++++ .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 2 ++ 2 files changed, 35 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +33 -0
@@ -93,6 +93,39 @@ int smu_set_soft_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,return ret; } +int smu_set_hard_freq_range (struct smu_context *smu,enum smu_clk_type clk_type, +uint32_t min,uint32_t max) +{ +int ret =0 , clk_id =0 ; +uint32_t param; + +if (min <=0 && max <=0 ) +return -EINVAL ; + + clk_id =smu_clk_get_index (smu, clk_type); +if (clk_id <0 ) +return clk_id; + +if (max >0 ) { + param = (uint32_t )((clk_id <<16 ) | (max &0xffff )); + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetHardMaxByFreq, + param); +if (ret) +return ret; + } + +if (min >0 ) { + param = (uint32_t )((clk_id <<16 ) | (min &0xffff )); + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetHardMinByFreq, + param); +if (ret) +return ret; + } + + +return ret; +} +int smu_get_dpm_freq_range (struct smu_context *smu,enum smu_clk_type clk_type,uint32_t *min,uint32_t *max) {
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -0
@@ -943,4 +943,6 @@ int smu_get_dpm_freq_range(struct smu_context *smu, enum smu_clk_type clk_type, uint32_t *min, uint32_t *max);int smu_set_soft_freq_range (struct smu_context *smu,enum smu_clk_type clk_type,uint32_t min,uint32_t max); +int smu_set_hard_freq_range (struct smu_context *smu,enum smu_clk_type clk_type, +uint32_t min,uint32_t max);#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 233/459 drm/amd/powerplay: add function force_clk_levels for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add sysfs interface of force_clk_levels sysfs for navi10.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 16 ++++---- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 6 +-- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 37 +++++++++++++++++++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 16 ++++---- 4 files changed, 56 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +8 -8
@@ -901,7 +901,7 @@ static ssize_t amdgpu_set_pp_dpm_sclk(struct device *dev,return ret;if (is_support_sw_smu (adev)) - ret =smu_force_clk_levels (&adev->smu,PP_SCLK , mask); + ret =smu_force_clk_levels (&adev->smu,SMU_SCLK , mask);else if (adev->powerplay.pp_funcs->force_clock_level) ret =amdgpu_dpm_force_clock_level (adev,PP_SCLK , mask);
@@ -948,7 +948,7 @@ static ssize_t amdgpu_set_pp_dpm_mclk(struct device *dev,return ret;if (is_support_sw_smu (adev)) - ret =smu_force_clk_levels (&adev->smu,PP_MCLK , mask); + ret =smu_force_clk_levels (&adev->smu,SMU_MCLK , mask);else if (adev->powerplay.pp_funcs->force_clock_level) ret =amdgpu_dpm_force_clock_level (adev,PP_MCLK , mask);
@@ -988,7 +988,7 @@ static ssize_t amdgpu_set_pp_dpm_socclk(struct device *dev,return ret;if (is_support_sw_smu (adev)) - ret =smu_force_clk_levels (&adev->smu,PP_SOCCLK , mask); + ret =smu_force_clk_levels (&adev->smu,SMU_SOCCLK , mask);else if (adev->powerplay.pp_funcs->force_clock_level) ret =amdgpu_dpm_force_clock_level (adev,PP_SOCCLK , mask);
@@ -1028,7 +1028,7 @@ static ssize_t amdgpu_set_pp_dpm_fclk(struct device *dev,return ret;if (is_support_sw_smu (adev)) - ret =smu_force_clk_levels (&adev->smu,PP_FCLK , mask); + ret =smu_force_clk_levels (&adev->smu,SMU_FCLK , mask);else if (adev->powerplay.pp_funcs->force_clock_level) ret =amdgpu_dpm_force_clock_level (adev,PP_FCLK , mask);
@@ -1068,7 +1068,7 @@ static ssize_t amdgpu_set_pp_dpm_dcefclk(struct device *dev,return ret;if (is_support_sw_smu (adev)) - ret =smu_force_clk_levels (&adev->smu,PP_DCEFCLK , mask); + ret =smu_force_clk_levels (&adev->smu,SMU_DCEFCLK , mask);else if (adev->powerplay.pp_funcs->force_clock_level) ret =amdgpu_dpm_force_clock_level (adev,PP_DCEFCLK , mask);
@@ -1108,7 +1108,7 @@ static ssize_t amdgpu_set_pp_dpm_pcie(struct device *dev,return ret;if (is_support_sw_smu (adev)) - ret =smu_force_clk_levels (&adev->smu,PP_PCIE , mask); + ret =smu_force_clk_levels (&adev->smu,SMU_PCIE , mask);else if (adev->powerplay.pp_funcs->force_clock_level) ret =amdgpu_dpm_force_clock_level (adev,PP_PCIE , mask);
@@ -1152,7 +1152,7 @@ static ssize_t amdgpu_set_pp_sclk_od(struct device *dev, }if (is_support_sw_smu (adev)) { - value =smu_set_od_percentage (&(adev->smu),OD_SCLK , (uint32_t )value); + value =smu_set_od_percentage (&(adev->smu),SMU_OD_SCLK , (uint32_t )value); }else {if (adev->powerplay.pp_funcs->set_sclk_od)amdgpu_dpm_set_sclk_od (adev, (uint32_t )value);
@@ -1203,7 +1203,7 @@ static ssize_t amdgpu_set_pp_mclk_od(struct device *dev, }if (is_support_sw_smu (adev)) { - value =smu_set_od_percentage (&(adev->smu),OD_MCLK , (uint32_t )value); + value =smu_set_od_percentage (&(adev->smu),SMU_OD_MCLK , (uint32_t )value); }else {if (adev->powerplay.pp_funcs->set_mclk_od)amdgpu_dpm_set_mclk_od (adev, (uint32_t )value);
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -3
@@ -539,7 +539,7 @@ struct pptable_funcs {int (*set_power_state)(struct smu_context *smu);int (*populate_umd_state_clk)(struct smu_context *smu);int (*print_clk_levels)(struct smu_context *smu,enum smu_clk_type clk_type,char *buf); -int (*force_clk_levels)(struct smu_context *smu,enum pp_clock_type type,uint32_t mask); +int (*force_clk_levels)(struct smu_context *smu,enum smu_clk_type clk_type,uint32_t mask);int (*set_default_od8_settings)(struct smu_context *smu); int (*update_specified_od8_value)(struct smu_context *smu, uint32_t index,
@@ -776,8 +776,8 @@ struct smu_funcs ((smu)->funcs->get_current_clk_freq? (smu)->funcs->get_current_clk_freq((smu), (clk_id), (value)) : 0)#define smu_print_clk_levels (smu, clk_type, buf) \ ((smu)->ppt_funcs->print_clk_levels ? (smu)->ppt_funcs->print_clk_levels((smu), (clk_type), (buf)) : 0) -#define smu_force_clk_levels (smu, type, level) \ - ((smu)->ppt_funcs->force_clk_levels ? (smu)->ppt_funcs->force_clk_levels((smu), (type), (level)) : 0) +#define smu_force_clk_levels (smu, clk_type, level) \ + ((smu)->ppt_funcs->force_clk_levels ? (smu)->ppt_funcs->force_clk_levels((smu), (clk_type), (level)) : 0)#define smu_get_od_percentage (smu, type) \ ((smu)->ppt_funcs->get_od_percentage ? (smu)->ppt_funcs->get_od_percentage((smu), (type)) : 0)#define smu_set_od_percentage (smu, type, value) \
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +37 -0
@@ -566,6 +566,42 @@ static int navi10_print_clk_levels(struct smu_context *smu,return size; } +static int navi10_force_clk_levels (struct smu_context *smu, +enum smu_clk_type clk_type,uint32_t mask) +{ + +int ret =0 , size =0 ; +uint32_t soft_min_level =0 , soft_max_level =0 , min_freq =0 , max_freq =0 ; + + soft_min_level = mask ? (ffs (mask) -1 ) :0 ; + soft_max_level = mask ? (fls (mask) -1 ) :0 ; + +switch (clk_type) { +case SMU_GFXCLK : +case SMU_SOCCLK : +case SMU_MCLK : +case SMU_UCLK : +case SMU_DCEFCLK : +case SMU_FCLK : + ret =smu_get_dpm_freq_by_index (smu, clk_type, soft_min_level, &min_freq); +if (ret) +return size; + + ret =smu_get_dpm_freq_by_index (smu, clk_type, soft_max_level, &max_freq); +if (ret) +return size; + + ret =smu_set_soft_freq_range (smu, clk_type, min_freq, max_freq); +if (ret) +return size; +break ; +default : +break ; + } + +return size; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -582,6 +618,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .dpm_set_uvd_enable = navi10_dpm_set_uvd_enable, .get_current_clk_freq_by_table = navi10_get_current_clk_freq_by_table, .print_clk_levels = navi10_print_clk_levels, + .force_clk_levels = navi10_force_clk_levels, };void navi10_set_ppt_funcs (struct smu_context *smu)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +8 -8
@@ -1223,7 +1223,7 @@ static int vega20_upload_dpm_level(struct smu_context *smu, bool max, }static int vega20_force_clk_levels (struct smu_context *smu, -enum pp_clock_type type,uint32_t mask) +enum smu_clk_type clk_type,uint32_t mask) {struct vega20_dpm_table *dpm_table;struct vega20_single_dpm_table *single_dpm_table;
@@ -1243,8 +1243,8 @@ static int vega20_force_clk_levels(struct smu_context *smu, dpm_table = smu->smu_dpm.dpm_context; -switch (type) { -case PP_SCLK : +switch (clk_type) { +case SMU_SCLK : single_dpm_table = &(dpm_table->gfx_table);if (soft_max_level >= single_dpm_table->count) {
@@ -1271,7 +1271,7 @@ static int vega20_force_clk_levels(struct smu_context *smu,break ; -case PP_MCLK : +case SMU_MCLK : single_dpm_table = &(dpm_table->mem_table);if (soft_max_level >= single_dpm_table->count) {
@@ -1298,7 +1298,7 @@ static int vega20_force_clk_levels(struct smu_context *smu,break ; -case PP_SOCCLK : +case SMU_SOCCLK : single_dpm_table = &(dpm_table->soc_table);if (soft_max_level >= single_dpm_table->count) {
@@ -1325,7 +1325,7 @@ static int vega20_force_clk_levels(struct smu_context *smu,break ; -case PP_FCLK : +case SMU_FCLK : single_dpm_table = &(dpm_table->fclk_table);if (soft_max_level >= single_dpm_table->count) {
@@ -1352,7 +1352,7 @@ static int vega20_force_clk_levels(struct smu_context *smu,break ; -case PP_DCEFCLK : +case SMU_DCEFCLK : hard_min_level = soft_min_level; single_dpm_table = &(dpm_table->dcef_table);
@@ -1372,7 +1372,7 @@ static int vega20_force_clk_levels(struct smu_context *smu,break ; -case PP_PCIE : +case SMU_PCIE :if (soft_min_level >=NUM_LINK_LEVELS || soft_max_level >=NUM_LINK_LEVELS ) { ret = -EINVAL ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 234/459 drm/amd/powerplay: add function populate_umd_state_clk for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function populate_umd_state_clk for navi10 asic
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +15 -0
@@ -602,6 +602,20 @@ static int navi10_force_clk_levels(struct smu_context *smu,return size; } +static int navi10_populate_umd_state_clk (struct smu_context *smu) +{ +int ret =0 ; +uint32_t min_sclk_freq =0 ; + + ret =smu_get_dpm_freq_range (smu,SMU_SCLK , &min_sclk_freq,NULL ); +if (ret) +return ret; + + smu->pstate_sclk = min_sclk_freq *100 ; + +return ret; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -619,6 +633,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_current_clk_freq_by_table = navi10_get_current_clk_freq_by_table, .print_clk_levels = navi10_print_clk_levels, .force_clk_levels = navi10_force_clk_levels, + .populate_umd_state_clk = navi10_populate_umd_state_clk, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 235/459 drm/amd/powerplay: add function get_clock_by_type_with_latency for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function get_clock_by_type_with_latency for navi10 asic
--- .../amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 19 +++++++++- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 6 ++-- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 35 +++++++++++++++++++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 12 +++---- 4 files changed, 62 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c +18 -1
@@ -149,6 +149,23 @@ static void get_default_clock_levels( } } +static enum smu_clk_type dc_to_smu_clock_type ( +enum dm_pp_clock_type dm_pp_clk_type) +{ +#define DCCLK_MAP_SMUCLK (dcclk, smuclk) \ + [dcclk] = smuclk + +static int dc_clk_type_map[] = { +DCCLK_MAP_SMUCLK (DM_PP_CLOCK_TYPE_DISPLAY_CLK ,SMU_DISPCLK ), +DCCLK_MAP_SMUCLK (DM_PP_CLOCK_TYPE_ENGINE_CLK ,SMU_GFXCLK ), +DCCLK_MAP_SMUCLK (DM_PP_CLOCK_TYPE_MEMORY_CLK ,SMU_MCLK ), +DCCLK_MAP_SMUCLK (DM_PP_CLOCK_TYPE_DCEFCLK ,SMU_DCEFCLK ), +DCCLK_MAP_SMUCLK (DM_PP_CLOCK_TYPE_SOCCLK ,SMU_SOCCLK ), + }; + +return dc_clk_type_map[dm_pp_clk_type]; +} +static enum amd_pp_clock_type dc_to_pp_clock_type (enum dm_pp_clock_type dm_pp_clk_type) {
@@ -317,7 +334,7 @@ bool dm_pp_get_clock_levels_by_type( } }else if (adev->smu.funcs && adev->smu.funcs->get_clock_by_type) {if (smu_get_clock_by_type (&adev->smu, -dc_to_pp_clock_type (clk_type), +dc_to_smu_clock_type (clk_type), &pp_clks)) {get_default_clock_levels (clk_type, dc_clks);return true;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -3
@@ -552,7 +552,7 @@ struct pptable_funcs {enum PP_OD_DPM_TABLE_COMMAND type, long *input, uint32_t size);int (*get_clock_by_type_with_latency)(struct smu_context *smu, -enum amd_pp_clock_type type, +enum smu_clk_type clk_type,struct pp_clock_levels_with_latency *clocks);
@@ -857,8 +857,8 @@ struct smu_funcs ((smu)->funcs->get_clock_by_type ? (smu)->funcs->get_clock_by_type((smu), (type), (clocks)) : 0)#define smu_get_max_high_clocks (smu, clocks) \ ((smu)->funcs->get_max_high_clocks ? (smu)->funcs->get_max_high_clocks((smu), (clocks)) : 0) -#define smu_get_clock_by_type_with_latency (smu, type, clocks) \ - ((smu)->ppt_funcs->get_clock_by_type_with_latency ? (smu)->ppt_funcs->get_clock_by_type_with_latency((smu), (type), (clocks)) : 0) +#define smu_get_clock_by_type_with_latency (smu, clk_type, clocks) \ + ((smu)->ppt_funcs->get_clock_by_type_with_latency ? (smu)->ppt_funcs->get_clock_by_type_with_latency((smu), (clk_type), (clocks)) : 0)#define smu_get_clock_by_type_with_voltage (smu, type, clocks) \ ((smu)->ppt_funcs->get_clock_by_type_with_voltage ? (smu)->ppt_funcs->get_clock_by_type_with_voltage((smu), (type), (clocks)) : 0)#define smu_display_clock_voltage_request (smu, clock_req) \
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +35 -0
@@ -616,6 +616,40 @@ static int navi10_populate_umd_state_clk(struct smu_context *smu)return ret; } +static int navi10_get_clock_by_type_with_latency (struct smu_context *smu, +enum smu_clk_type clk_type, +struct pp_clock_levels_with_latency *clocks) +{ +int ret =0 , i =0 ; +uint32_t level_count =0 , freq =0 ; + +switch (clk_type) { +case SMU_GFXCLK : +case SMU_DCEFCLK : +case SMU_SOCCLK : + ret =smu_get_dpm_level_count (smu, clk_type, &level_count); +if (ret) +return ret; + + level_count =min (level_count, (uint32_t )MAX_NUM_CLOCKS ); + clocks->num_levels = level_count; + +for (i =0 ; i < level_count; i++) { + ret =smu_get_dpm_freq_by_index (smu, clk_type, i, &freq); +if (ret) +return ret; + + clocks->data[i].clocks_in_khz = freq *1000 ; + clocks->data[i].latency_in_us =0 ; + } +break ; +default : +break ; + } + +return ret; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -634,6 +668,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .print_clk_levels = navi10_print_clk_levels, .force_clk_levels = navi10_force_clk_levels, .populate_umd_state_clk = navi10_populate_umd_state_clk, + .get_clock_by_type_with_latency = navi10_get_clock_by_type_with_latency, };void navi10_set_ppt_funcs (struct smu_context *smu)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +6 -6
@@ -1395,7 +1395,7 @@ static int vega20_force_clk_levels(struct smu_context *smu, }static int vega20_get_clock_by_type_with_latency (struct smu_context *smu, -enum amd_pp_clock_type type, +enum smu_clk_type clk_type,struct pp_clock_levels_with_latency *clocks) {int ret;
@@ -1407,20 +1407,20 @@ static int vega20_get_clock_by_type_with_latency(struct smu_context *smu,mutex_lock (&smu->mutex); -switch (type) { -case amd_pp_sys_clock: +switch (clk_type) { +case SMU_GFXCLK : single_dpm_table = &(dpm_table->gfx_table); ret =vega20_get_clk_table (smu, clocks, single_dpm_table);break ; -case amd_pp_mem_clock: +case SMU_MCLK : single_dpm_table = &(dpm_table->mem_table); ret =vega20_get_clk_table (smu, clocks, single_dpm_table);break ; -case amd_pp_dcef_clock: +case SMU_DCEFCLK : single_dpm_table = &(dpm_table->dcef_table); ret =vega20_get_clk_table (smu, clocks, single_dpm_table);break ; -case amd_pp_soc_clock: +case SMU_SOCCLK : single_dpm_table = &(dpm_table->soc_table); ret =vega20_get_clk_table (smu, clocks, single_dpm_table);break ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 236/459 drm/amd/powerplay: add function pre_display_config_changed for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function pre_display_config_changed for navi10 asic
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +22 -0
@@ -650,6 +650,27 @@ static int navi10_get_clock_by_type_with_latency(struct smu_context *smu,return ret; } +static int navi10_pre_display_config_changed (struct smu_context *smu) +{ +int ret =0 ; +uint32_t max_freq =0 ; + + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_NumOfDisplays,0 ); +if (ret) +return ret; + +if (smu_feature_is_enabled (smu,SMU_FEATURE_DPM_UCLK_BIT )) { + ret =smu_get_dpm_freq_range (smu,SMU_UCLK ,NULL , &max_freq); +if (ret) +return ret; + ret =smu_set_hard_freq_range (smu,SMU_UCLK ,0 , max_freq); +if (ret) +return ret; + } + +return ret; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -669,6 +690,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .force_clk_levels = navi10_force_clk_levels, .populate_umd_state_clk = navi10_populate_umd_state_clk, .get_clock_by_type_with_latency = navi10_get_clock_by_type_with_latency, + .pre_display_config_changed = navi10_pre_display_config_changed, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 237/459 drm/amd/powerplay: add function display_configuration_changed for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
1.add callback function to support navi10 asic. 2.Remove unnecessary logical code.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 25 ++++++++++++++++++++++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 16 ++++++++++++-- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 10 +-------- 3 files changed, 40 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +25 -0
@@ -671,6 +671,30 @@ static int navi10_pre_display_config_changed(struct smu_context *smu)return ret; } +static int navi10_display_config_changed (struct smu_context *smu) +{ +int ret =0 ; + +if ((smu->watermarks_bitmap &WATERMARKS_EXIST ) && + !(smu->watermarks_bitmap &WATERMARKS_LOADED )) { + ret =smu_write_watermarks_table (smu); +if (ret) +return ret; + + smu->watermarks_bitmap |=WATERMARKS_LOADED ; + } + +if ((smu->watermarks_bitmap &WATERMARKS_EXIST ) && +smu_feature_is_supported (smu,SMU_FEATURE_DPM_DCEFCLK_BIT ) && +smu_feature_is_supported (smu,SMU_FEATURE_DPM_SOCCLK_BIT )) { + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_NumOfDisplays, + smu->display_config->num_display); +if (ret) +return ret; + } + +return ret; +}static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -691,6 +715,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .populate_umd_state_clk = navi10_populate_umd_state_clk, .get_clock_by_type_with_latency = navi10_get_clock_by_type_with_latency, .pre_display_config_changed = navi10_pre_display_config_changed, + .display_config_changed = navi10_display_config_changed, };void navi10_set_ppt_funcs (struct smu_context *smu)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +14 -2
@@ -714,9 +714,21 @@ static int smu_v11_0_write_pptable(struct smu_context *smu)static int smu_v11_0_write_watermarks_table (struct smu_context *smu) { -return smu_update_table (smu,SMU_TABLE_WATERMARKS , - smu->smu_table.tables[SMU_TABLE_WATERMARKS ].cpu_addr, +int ret =0 ; +struct smu_table_context *smu_table = &smu->smu_table; +struct smu_table *table =NULL ; + + table = &smu_table->tables[SMU_TABLE_WATERMARKS ]; +if (!table) +return -EINVAL ; + +if (!table->cpu_addr) +return -EINVAL ; + + ret =smu_update_table (smu,SMU_TABLE_WATERMARKS , table->cpu_addr, true); + +return ret; }static int smu_v11_0_set_deep_sleep_dcefclk (struct smu_context *smu,uint32_t clk)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +1 -9
@@ -1992,17 +1992,9 @@ static int vega20_display_config_changed(struct smu_context *smu) {int ret =0 ; -if (!smu->funcs) -return -EINVAL ; - -if (!smu->smu_dpm.dpm_context || - !smu->smu_table.tables || - !smu->smu_table.tables[TABLE_WATERMARKS ].cpu_addr) -return -EINVAL ; -if ((smu->watermarks_bitmap &WATERMARKS_EXIST ) && !(smu->watermarks_bitmap &WATERMARKS_LOADED )) { - ret = smu->funcs->write_watermarks_table (smu); + ret =smu_write_watermarks_table (smu);if (ret) {pr_err ("Failed to update WMTABLE!" );return ret;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 238/459 drm/amd/powerplay: add funciton force_dpm_limit for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function force_dpm_limit for navi10 asic
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +29 -0
@@ -695,6 +695,34 @@ static int navi10_display_config_changed(struct smu_context *smu)return ret; } + +static int navi10_force_dpm_limit_value (struct smu_context *smu,bool highest) +{ +int ret =0 , i =0 ; +uint32_t min_freq, max_freq, force_freq; +enum smu_clk_type clk_type; + +enum smu_clk_type clks[] = { +SMU_GFXCLK , +SMU_MCLK , +SMU_SOCCLK , + }; + +for (i =0 ; i <ARRAY_SIZE (clks); i++) { + clk_type = clks[i]; + ret =smu_get_dpm_freq_range (smu, clk_type, &min_freq, &max_freq); +if (ret) +return ret; + + force_freq = highest ? max_freq : min_freq; + ret =smu_set_soft_freq_range (smu, clk_type, force_freq, force_freq); +if (ret) +return ret; + } + +return ret; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -716,6 +744,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_clock_by_type_with_latency = navi10_get_clock_by_type_with_latency, .pre_display_config_changed = navi10_pre_display_config_changed, .display_config_changed = navi10_display_config_changed, + .force_dpm_limit_value = navi10_force_dpm_limit_value, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 239/459 drm/amd/powerplay: add function unforce_dpm_levels for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function unforce_dpm_levels for navi10 asic
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +27 -0
@@ -723,6 +723,32 @@ static int navi10_force_dpm_limit_value(struct smu_context *smu, bool highest)return ret; } +static int navi10_unforce_dpm_levels (struct smu_context *smu) { + +int ret =0 , i =0 ; +uint32_t min_freq, max_freq; +enum smu_clk_type clk_type; + +enum smu_clk_type clks[] = { +SMU_GFXCLK , +SMU_MCLK , +SMU_SOCCLK , + }; + +for (i =0 ; i <ARRAY_SIZE (clks); i++) { + clk_type = clks[i]; + ret =smu_get_dpm_freq_range (smu, clk_type, &min_freq, &max_freq); +if (ret) +return ret; + + ret =smu_set_soft_freq_range (smu, clk_type, min_freq, max_freq); +if (ret) +return ret; + } + +return ret; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -745,6 +771,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .pre_display_config_changed = navi10_pre_display_config_changed, .display_config_changed = navi10_display_config_changed, .force_dpm_limit_value = navi10_force_dpm_limit_value, + .unforce_dpm_levels = navi10_unforce_dpm_levels, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 240/459 drm/amd/powerplay: add function get_gpu_power for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function get_gpu_power for navi10 asic
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +19 -0
@@ -749,6 +749,24 @@ static int navi10_unforce_dpm_levels(struct smu_context *smu) {return ret; } +static int navi10_get_gpu_power (struct smu_context *smu,uint32_t *value) +{ +int ret =0 ; +SmuMetrics_t metrics; + +if (!value) +return -EINVAL ; + + ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS , (void *)&metrics, + false); +if (ret) +return ret; + + *value = metrics.CurrSocketPower <<8 ; + +return 0 ; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -772,6 +790,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .display_config_changed = navi10_display_config_changed, .force_dpm_limit_value = navi10_force_dpm_limit_value, .unforce_dpm_levels = navi10_unforce_dpm_levels, + .get_gpu_power = navi10_get_gpu_power, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 241/459 drm/amd/powerplay: add function get_current_activity_percent for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function get_current_activity_percent for navi10 asic
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +20 -0
@@ -767,6 +767,25 @@ static int navi10_get_gpu_power(struct smu_context *smu, uint32_t *value)return 0 ; } +static int navi10_get_current_activity_percent (struct smu_context *smu, +uint32_t *value) +{ +int ret =0 ; +SmuMetrics_t metrics; + +if (!value) +return -EINVAL ; + + ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS , + (void *)&metrics, false); +if (ret) +return ret; + + *value = metrics.AverageGfxActivity; + +return 0 ; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -791,6 +810,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .force_dpm_limit_value = navi10_force_dpm_limit_value, .unforce_dpm_levels = navi10_unforce_dpm_levels, .get_gpu_power = navi10_get_gpu_power, + .get_current_activity_percent = navi10_get_current_activity_percent, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 242/459 drm/amd/powerplay: move read sensor of UVD[VCE]_POWER to amdgpu_smu file
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
This part of code is asic unrelated and moves to top code level.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 8 ++++++++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +8 -0
@@ -255,6 +255,14 @@ int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor, ret =smu_feature_get_enabled_mask (smu, (uint32_t *)data,2 ); *size =8 ;break ; +case AMDGPU_PP_SENSOR_UVD_POWER : + *(uint32_t *)data =smu_feature_is_enabled (smu,SMU_FEATURE_DPM_UVD_BIT ) ?1 :0 ; + *size =4 ; +break ; +case AMDGPU_PP_SENSOR_VCE_POWER : + *(uint32_t *)data =smu_feature_is_enabled (smu,SMU_FEATURE_DPM_VCE_BIT ) ?1 :0 ; + *size =4 ; +break ;default : ret = -EINVAL ;break ;
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -8
@@ -2946,14 +2946,6 @@ static int vega20_read_sensor(struct smu_context *smu,PPTable_t *pptable = table_context->driver_pptable;switch (sensor) { -case AMDGPU_PP_SENSOR_UVD_POWER : - *(uint32_t *)data =smu_feature_is_enabled (smu,SMU_FEATURE_DPM_UVD_BIT ) ?1 :0 ; - *size =4 ; -break ; -case AMDGPU_PP_SENSOR_VCE_POWER : - *(uint32_t *)data =smu_feature_is_enabled (smu,SMU_FEATURE_DPM_VCE_BIT ) ?1 :0 ; - *size =4 ; -break ;case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; *size =4 ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 243/459 drm/amd/powerplay: add function is_dpm_running for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function is_dpm_running for navi10 asic
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +23 -1
@@ -35,6 +35,17 @@#include "smu_v11_0_pptable.h" #include "smu_v11_0_ppsmc.h" +#define FEATURE_MASK (feature) (1UL << feature) +#define SMC_DPM_FEATURE ( \ + FEATURE_MASK(FEATURE_DPM_PREFETCHER_BIT) | \ + FEATURE_MASK(FEATURE_DPM_GFXCLK_BIT) | \ + FEATURE_MASK(FEATURE_DPM_GFX_PACE_BIT) | \ + FEATURE_MASK(FEATURE_DPM_UCLK_BIT) | \ + FEATURE_MASK(FEATURE_DPM_SOCCLK_BIT) | \ + FEATURE_MASK(FEATURE_DPM_MP0CLK_BIT) | \ + FEATURE_MASK(FEATURE_DPM_LINK_BIT) | \ + FEATURE_MASK(FEATURE_DPM_DCEFCLK_BIT)) +#define MSG_MAP (msg, index) \ [SMU_MSG_##msg] = index
@@ -248,7 +259,6 @@ static int navi10_get_pwr_src_index(struct smu_context *smc, uint32_t index)return val; } -#define FEATURE_MASK (feature) (1UL << feature)static int navi10_get_allowed_feature_mask (struct smu_context *smu,uint32_t *feature_mask,uint32_t num)
@@ -786,6 +796,17 @@ static int navi10_get_current_activity_percent(struct smu_context *smu,return 0 ; } +static bool navi10_is_dpm_running (struct smu_context *smu) +{ +int ret =0 ; +uint32_t feature_mask[2 ]; +unsigned long feature_enabled; + ret =smu_feature_get_enabled_mask (smu, feature_mask,2 ); + feature_enabled = (unsigned long )((uint64_t )feature_mask[0 ] | + ((uint64_t )feature_mask[1 ] <<32 )); +return !!(feature_enabled &SMC_DPM_FEATURE ); +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -811,6 +832,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .unforce_dpm_levels = navi10_unforce_dpm_levels, .get_gpu_power = navi10_get_gpu_power, .get_current_activity_percent = navi10_get_current_activity_percent, + .is_dpm_running = navi10_is_dpm_running, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 244/459 drm/amd/powerplay: add function set_thermal_fan_table for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function set_thermal_fan_table for navi10 asic
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +13 -0
@@ -807,6 +807,18 @@ static bool navi10_is_dpm_running(struct smu_context *smu)return !!(feature_enabled &SMC_DPM_FEATURE ); } +static int navi10_set_thermal_fan_table (struct smu_context *smu) +{ +int ret; +struct smu_table_context *table_context = &smu->smu_table; +PPTable_t *pptable = table_context->driver_pptable; + + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetFanTemperatureTarget, + (uint32_t )pptable->FanTargetTemperature); + +return ret; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -833,6 +845,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_gpu_power = navi10_get_gpu_power, .get_current_activity_percent = navi10_get_current_activity_percent, .is_dpm_running = navi10_is_dpm_running, + .set_thermal_fan_table = navi10_set_thermal_fan_table, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 245/459 drm/amd/powerplay: add function get_fan_speed_percent for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function get_fan_speed_percent for navi10 asic
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +19 -0
@@ -819,6 +819,24 @@ static int navi10_set_thermal_fan_table(struct smu_context *smu)return ret; } +static int navi10_get_fan_speed_percent (struct smu_context *smu, +uint32_t *speed) +{ +int ret =0 ; +uint32_t percent =0 ; +uint32_t current_rpm; +PPTable_t *pptable = smu->smu_table.driver_pptable; + + ret =smu_get_current_rpm (smu, ¤t_rpm); +if (ret) +return ret; + + percent = current_rpm *100 / pptable->FanMaximumRpm; + *speed = percent >100 ?100 : percent; + +return ret; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -846,6 +864,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_current_activity_percent = navi10_get_current_activity_percent, .is_dpm_running = navi10_is_dpm_running, .set_thermal_fan_table = navi10_set_thermal_fan_table, + .get_fan_speed_percent = navi10_get_fan_speed_percent, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 246/459 drm/amd/powerplay: remove upload_dpm_level function for vega20
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
the function upload_dpm_level is an internal function, so remove public interface.
--- drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 4 ---- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 5 ++--- 2 files changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -4
@@ -576,8 +576,6 @@ struct pptable_funcs {int (*notify_smc_dispaly_config)(struct smu_context *smu);int (*force_dpm_limit_value)(struct smu_context *smu,bool highest);int (*unforce_dpm_levels)(struct smu_context *smu); -int (*upload_dpm_level)(struct smu_context *smu,bool max, -uint32_t feature_mask); int (*get_profiling_clk_mask)(struct smu_context *smu, enum amd_dpm_forced_level level, uint32_t *sclk_mask,
@@ -814,8 +812,6 @@ struct smu_funcs ((smu)->ppt_funcs->force_dpm_limit_value ? (smu)->ppt_funcs->force_dpm_limit_value((smu), (highest)) : 0)#define smu_unforce_dpm_levels (smu) \ ((smu)->ppt_funcs->unforce_dpm_levels ? (smu)->ppt_funcs->unforce_dpm_levels((smu)) : 0) -#define smu_upload_dpm_level (smu, max, feature_mask) \ - ((smu)->ppt_funcs->upload_dpm_level ? (smu)->ppt_funcs->upload_dpm_level((smu), (max), (feature_mask)) : 0)#define smu_get_profiling_clk_mask (smu, level, sclk_mask, mclk_mask, soc_mask) \ ((smu)->ppt_funcs->get_profiling_clk_mask ? (smu)->ppt_funcs->get_profiling_clk_mask((smu), (level), (sclk_mask), (mclk_mask), (soc_mask)) : 0)#define smu_set_cpu_power_state (smu) \
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +2 -3
@@ -2329,13 +2329,13 @@ static int vega20_unforce_dpm_levels(struct smu_context *smu) dpm_table->soc_table.dpm_state.soft_max_level = dpm_table->soc_table.dpm_levels[soft_max_level].value; - ret =smu_upload_dpm_level (smu, false,0xFFFFFFFF ); + ret =vega20_upload_dpm_level (smu, false,0xFFFFFFFF );if (ret) {pr_err ("Failed to upload DPM Bootup Levels!" );return ret; } - ret =smu_upload_dpm_level (smu, true,0xFFFFFFFF ); + ret =vega20_upload_dpm_level (smu, true,0xFFFFFFFF );if (ret) {pr_err ("Failed to upload DPM Max Levels!" );return ret;
@@ -3142,7 +3142,6 @@ static const struct pptable_funcs vega20_ppt_funcs = { .notify_smc_dispaly_config = vega20_notify_smc_dispaly_config, .force_dpm_limit_value = vega20_force_dpm_limit_value, .unforce_dpm_levels = vega20_unforce_dpm_levels, - .upload_dpm_level = vega20_upload_dpm_level, .get_profiling_clk_mask = vega20_get_profiling_clk_mask, .set_ppfeature_status = vega20_set_ppfeature_status, .get_ppfeature_status = vega20_get_ppfeature_status,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 247/459 Revert "drm/amdgpu: mask some pm interfaces for navi10 because they are changed or not workable so far"
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
This reverts commit fd9c75d217d5b4ed72672722b6621e2635363dfe.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 156 +++++++++++------------- 2 files changed, 73 insertions(+), 85 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -1
@@ -690,7 +690,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file dev_info.num_shader_arrays_per_engine = adev->gfx.config.max_sh_per_se;/* return all clocks in KHz */ dev_info.gpu_counter_freq =amdgpu_asic_get_xclk (adev) *10 ; -if (adev->pm.dpm_enabled && adev->asic_type !=CHIP_NAVI10 ) { +if (adev->pm.dpm_enabled) { dev_info.max_engine_clock =amdgpu_dpm_get_sclk (adev, false) *10 ; dev_info.max_memory_clock =amdgpu_dpm_get_mclk (adev, false) *10 ; } else if (amdgpu_sriov_vf(adev) && amdgim_is_hwperf(adev) &&
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +72 -84
195 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20190617193106.18231-48-alexander.deucher-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 247/459] Revert "drm/amdgpu: mask some pm interfaces for navi10 because they are changed or not workable so far"
Am 17.06.19 um 21:30 schrieb Alex Deucher:
Quoted 7 lines
From: Kevin Wang <[email protected]>
This reverts commit
fd9c75d217d5b4ed72672722b6621e2635363dfe.Signed-off-by Kevin Wang <[email protected]>Reviewed-by Huang Rui <[email protected]>Signed-off-by Alex Deucher <[email protected]>
Would it be possible to squash that into the original commit which disabled things?
Christian.
Quoted 211 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 156 +++++++++++------------- 2 files changed, 73 insertions(+), 85 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-1@@ -690,7 +690,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file dev_info.num_shader_arrays_per_engine = adev->gfx.config.max_sh_per_se;/* return all clocks in KHz */ dev_info.gpu_counter_freq =amdgpu_asic_get_xclk (adev) *10 ; -if (adev->pm.dpm_enabled && adev->asic_type !=CHIP_NAVI10 ) { +if (adev->pm.dpm_enabled) { dev_info.max_engine_clock =amdgpu_dpm_get_sclk (adev, false) *10 ; dev_info.max_memory_clock =amdgpu_dpm_get_mclk (adev, false) *10 ; } else if (amdgpu_sriov_vf(adev) && amdgim_is_hwperf(adev) &&drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +72
-80@@ -2793,33 +2793,32 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)return ret; } -if (adev->asic_type !=CHIP_NAVI10 ) { - ret =device_create_file (adev->dev, &dev_attr_power_dpm_state); -if (ret) { -DRM_ERROR ("failed to create device file for dpm state\n" ); -return ret; - } - ret =device_create_file (adev->dev, &dev_attr_power_dpm_force_performance_level); -if (ret) { -DRM_ERROR ("failed to create device file for dpm state\n" ); -return ret; - } + ret =device_create_file (adev->dev, &dev_attr_power_dpm_state); +if (ret) { +DRM_ERROR ("failed to create device file for dpm state\n" ); +return ret; + } + ret =device_create_file (adev->dev, &dev_attr_power_dpm_force_performance_level); +if (ret) { +DRM_ERROR ("failed to create device file for dpm state\n" ); +return ret; + } - ret =device_create_file (adev->dev, &dev_attr_pp_num_states); -if (ret) { -DRM_ERROR ("failed to create device file pp_num_states\n" ); -return ret; - } - ret =device_create_file (adev->dev, &dev_attr_pp_cur_state); -if (ret) { -DRM_ERROR ("failed to create device file pp_cur_state\n" ); -return ret; - } - ret =device_create_file (adev->dev, &dev_attr_pp_force_state); -if (ret) { -DRM_ERROR ("failed to create device file pp_force_state\n" ); -return ret; - } + + ret =device_create_file (adev->dev, &dev_attr_pp_num_states); +if (ret) { +DRM_ERROR ("failed to create device file pp_num_states\n" ); +return ret; + } + ret =device_create_file (adev->dev, &dev_attr_pp_cur_state); +if (ret) { +DRM_ERROR ("failed to create device file pp_cur_state\n" ); +return ret; + } + ret =device_create_file (adev->dev, &dev_attr_pp_force_state); +if (ret) { +DRM_ERROR ("failed to create device file pp_force_state\n" ); +return ret; } ret =device_create_file (adev->dev, &dev_attr_pp_table);if (ret) {@@ -2832,55 +2831,52 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)DRM_ERROR ("failed to create device file pp_dpm_sclk\n" );return ret; } - -if (adev->asic_type !=CHIP_NAVI10 ) { - ret =device_create_file (adev->dev, &dev_attr_pp_dpm_mclk); -if (ret) { -DRM_ERROR ("failed to create device file pp_dpm_mclk\n" ); -return ret; - } -if (adev->asic_type >=CHIP_VEGA10 ) { - ret =device_create_file (adev->dev, &dev_attr_pp_dpm_socclk); -if (ret) { -DRM_ERROR ("failed to create device file pp_dpm_socclk\n" ); -return ret; - } - ret =device_create_file (adev->dev, &dev_attr_pp_dpm_dcefclk); -if (ret) { -DRM_ERROR ("failed to create device file pp_dpm_dcefclk\n" ); -return ret; - } - } -if (adev->asic_type >=CHIP_VEGA20 ) { - ret =device_create_file (adev->dev, &dev_attr_pp_dpm_fclk); -if (ret) { -DRM_ERROR ("failed to create device file pp_dpm_fclk\n" ); -return ret; - } - } - ret =device_create_file (adev->dev, &dev_attr_pp_dpm_pcie); -if (ret) { -DRM_ERROR ("failed to create device file pp_dpm_pcie\n" ); -return ret; - } - ret =device_create_file (adev->dev, &dev_attr_pp_sclk_od); + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_mclk); +if (ret) { +DRM_ERROR ("failed to create device file pp_dpm_mclk\n" ); +return ret; + } +if (adev->asic_type >=CHIP_VEGA10 ) { + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_socclk);if (ret) { -DRM_ERROR ("failed to create device file pp_sclk_od\n" ); +DRM_ERROR ("failed to create device file pp_dpm_socclk\n" );return ret; } - ret =device_create_file (adev->dev, &dev_attr_pp_mclk_od); + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_dcefclk);if (ret) { -DRM_ERROR ("failed to create device file pp_mclk_od\n" ); +DRM_ERROR ("failed to create device file pp_dpm_dcefclk\n" );return ret; } - ret =device_create_file (adev->dev, - &dev_attr_pp_power_profile_mode); + } +if (adev->asic_type >=CHIP_VEGA20 ) { + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_fclk);if (ret) { -DRM_ERROR ("failed to create device file " -"pp_power_profile_mode\n" ); +DRM_ERROR ("failed to create device file pp_dpm_fclk\n" );return ret; } } + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_pcie); +if (ret) { +DRM_ERROR ("failed to create device file pp_dpm_pcie\n" ); +return ret; + } + ret =device_create_file (adev->dev, &dev_attr_pp_sclk_od); +if (ret) { +DRM_ERROR ("failed to create device file pp_sclk_od\n" ); +return ret; + } + ret =device_create_file (adev->dev, &dev_attr_pp_mclk_od); +if (ret) { +DRM_ERROR ("failed to create device file pp_mclk_od\n" ); +return ret; + } + ret =device_create_file (adev->dev, + &dev_attr_pp_power_profile_mode); +if (ret) { +DRM_ERROR ("failed to create device file " +"pp_power_profile_mode\n" ); +return ret; + }if ((is_support_sw_smu (adev) && adev->smu.od_enabled) || (!is_support_sw_smu (adev) && hwmgr->od_enabled)) { ret = device_create_file(adev->dev,@@ -3056,25 +3052,21 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a/* GPU Clocks */ size =sizeof (value);seq_printf (m,"GFX Clocks and Power:\n" ); -if (adev->asic_type !=CHIP_NAVI10 ) { -if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GFX_MCLK , (void *)&value, &size)) -seq_printf (m,"\t%u MHz (MCLK)\n" , value/100 ); -if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GFX_SCLK , (void *)&value, &size)) -seq_printf (m,"\t%u MHz (SCLK)\n" , value/100 ); -if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK , (void *)&value, &size)) -seq_printf (m,"\t%u MHz (PSTATE_SCLK)\n" , value/100 ); -if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK , (void *)&value, &size)) -seq_printf (m,"\t%u MHz (PSTATE_MCLK)\n" , value/100 ); - } +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GFX_MCLK , (void *)&value, &size)) +seq_printf (m,"\t%u MHz (MCLK)\n" , value/100 ); +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GFX_SCLK , (void *)&value, &size)) +seq_printf (m,"\t%u MHz (SCLK)\n" , value/100 ); +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK , (void *)&value, &size)) +seq_printf (m,"\t%u MHz (PSTATE_SCLK)\n" , value/100 ); +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK , (void *)&value, &size)) +seq_printf (m,"\t%u MHz (PSTATE_MCLK)\n" , value/100 );if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_VDDGFX , (void *)&value, &size))seq_printf (m,"\t%u mV (VDDGFX)\n" , value);if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_VDDNB , (void *)&value, &size))seq_printf (m,"\t%u mV (VDDNB)\n" , value); -if (adev->asic_type !=CHIP_NAVI10 ) { - size =sizeof (uint32_t ); -if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GPU_POWER , (void *)&query, &size)) -seq_printf (m,"\t%u.%u W (average GPU)\n" , query >>8 , query &0xff ); - } + size =sizeof (uint32_t ); +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GPU_POWER , (void *)&query, &size)) +seq_printf (m,"\t%u.%u W (average GPU)\n" , query >>8 , query &0xff ); size =sizeof (value);seq_printf (m,"\n" );
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a · line 3079
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-4@@ -3082,10 +3074,6 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *aif (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GPU_TEMP , (void *)&value, &size))seq_printf (m,"GPU Temperature: %u C\n" , value/1000 ); -/* TODO: will be removed after gpu load, feature mask, uvd/vce clocks enabled on navi10 */ -if (adev->asic_type ==CHIP_NAVI10 ) -return 0 ; -/* GPU Load */ if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GPU_LOAD , (void *)&value, &size))seq_printf (m,"GPU Load: %u %%\n" , value);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 693bbb9c-2ff2-f25b-2d32-7729b1a46d84-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 247/459] Revert "drm/amdgpu: mask some pm interfaces for navi10 because they are changed or not workable so far"
i think should be drop this patch from git tree,
this patch only for bringing up stage.
thanks.
Best Regards,
Kevin
________________________________
From: Christian K?nig <[email protected]>
Sent: Tuesday, June 18, 2019 3:58:28 PM
To: Alex Deucher; [email protected]
Cc: Deucher, Alexander; Wang, Kevin(Yang); Huang, Ray
Subject: Re: [PATCH 247/459] Revert "drm/amdgpu: mask some pm interfaces for navi10 because they are changed or not workable so far"
Am 17.06.19 um 21:30 schrieb Alex Deucher:
Quoted 7 lines
From: Kevin Wang <[email protected]>
This reverts commit
fd9c75d217d5b4ed72672722b6621e2635363dfe.Signed-off-by Kevin Wang <[email protected]>Reviewed-by Huang Rui <[email protected]>Signed-off-by Alex Deucher <[email protected]>
Would it be possible to squash that into the original commit which disabled things?
Christian.
Quoted 211 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 156 +++++++++++------------- 2 files changed, 73 insertions(+), 85 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-1@@ -690,7 +690,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file dev_info.num_shader_arrays_per_engine = adev->gfx.config.max_sh_per_se;/* return all clocks in KHz */ dev_info.gpu_counter_freq =amdgpu_asic_get_xclk (adev) *10 ; -if (adev->pm.dpm_enabled && adev->asic_type !=CHIP_NAVI10 ) { +if (adev->pm.dpm_enabled) { dev_info.max_engine_clock =amdgpu_dpm_get_sclk (adev, false) *10 ; dev_info.max_memory_clock =amdgpu_dpm_get_mclk (adev, false) *10 ; } else if (amdgpu_sriov_vf(adev) && amdgim_is_hwperf(adev) &&drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +72
-80@@ -2793,33 +2793,32 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)return ret; } -if (adev->asic_type !=CHIP_NAVI10 ) { - ret =device_create_file (adev->dev, &dev_attr_power_dpm_state); -if (ret) { -DRM_ERROR ("failed to create device file for dpm state\n" ); -return ret; - } - ret =device_create_file (adev->dev, &dev_attr_power_dpm_force_performance_level); -if (ret) { -DRM_ERROR ("failed to create device file for dpm state\n" ); -return ret; - } + ret =device_create_file (adev->dev, &dev_attr_power_dpm_state); +if (ret) { +DRM_ERROR ("failed to create device file for dpm state\n" ); +return ret; + } + ret =device_create_file (adev->dev, &dev_attr_power_dpm_force_performance_level); +if (ret) { +DRM_ERROR ("failed to create device file for dpm state\n" ); +return ret; + } - ret =device_create_file (adev->dev, &dev_attr_pp_num_states); -if (ret) { -DRM_ERROR ("failed to create device file pp_num_states\n" ); -return ret; - } - ret =device_create_file (adev->dev, &dev_attr_pp_cur_state); -if (ret) { -DRM_ERROR ("failed to create device file pp_cur_state\n" ); -return ret; - } - ret =device_create_file (adev->dev, &dev_attr_pp_force_state); -if (ret) { -DRM_ERROR ("failed to create device file pp_force_state\n" ); -return ret; - } + + ret =device_create_file (adev->dev, &dev_attr_pp_num_states); +if (ret) { +DRM_ERROR ("failed to create device file pp_num_states\n" ); +return ret; + } + ret =device_create_file (adev->dev, &dev_attr_pp_cur_state); +if (ret) { +DRM_ERROR ("failed to create device file pp_cur_state\n" ); +return ret; + } + ret =device_create_file (adev->dev, &dev_attr_pp_force_state); +if (ret) { +DRM_ERROR ("failed to create device file pp_force_state\n" ); +return ret; } ret =device_create_file (adev->dev, &dev_attr_pp_table);if (ret) {@@ -2832,55 +2831,52 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)DRM_ERROR ("failed to create device file pp_dpm_sclk\n" );return ret; } - -if (adev->asic_type !=CHIP_NAVI10 ) { - ret =device_create_file (adev->dev, &dev_attr_pp_dpm_mclk); -if (ret) { -DRM_ERROR ("failed to create device file pp_dpm_mclk\n" ); -return ret; - } -if (adev->asic_type >=CHIP_VEGA10 ) { - ret =device_create_file (adev->dev, &dev_attr_pp_dpm_socclk); -if (ret) { -DRM_ERROR ("failed to create device file pp_dpm_socclk\n" ); -return ret; - } - ret =device_create_file (adev->dev, &dev_attr_pp_dpm_dcefclk); -if (ret) { -DRM_ERROR ("failed to create device file pp_dpm_dcefclk\n" ); -return ret; - } - } -if (adev->asic_type >=CHIP_VEGA20 ) { - ret =device_create_file (adev->dev, &dev_attr_pp_dpm_fclk); -if (ret) { -DRM_ERROR ("failed to create device file pp_dpm_fclk\n" ); -return ret; - } - } - ret =device_create_file (adev->dev, &dev_attr_pp_dpm_pcie); -if (ret) { -DRM_ERROR ("failed to create device file pp_dpm_pcie\n" ); -return ret; - } - ret =device_create_file (adev->dev, &dev_attr_pp_sclk_od); + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_mclk); +if (ret) { +DRM_ERROR ("failed to create device file pp_dpm_mclk\n" ); +return ret; + } +if (adev->asic_type >=CHIP_VEGA10 ) { + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_socclk);if (ret) { -DRM_ERROR ("failed to create device file pp_sclk_od\n" ); +DRM_ERROR ("failed to create device file pp_dpm_socclk\n" );return ret; } - ret =device_create_file (adev->dev, &dev_attr_pp_mclk_od); + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_dcefclk);if (ret) { -DRM_ERROR ("failed to create device file pp_mclk_od\n" ); +DRM_ERROR ("failed to create device file pp_dpm_dcefclk\n" );return ret; } - ret =device_create_file (adev->dev, - &dev_attr_pp_power_profile_mode); + } +if (adev->asic_type >=CHIP_VEGA20 ) { + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_fclk);if (ret) { -DRM_ERROR ("failed to create device file " -"pp_power_profile_mode\n" ); +DRM_ERROR ("failed to create device file pp_dpm_fclk\n" );return ret; } } + ret =device_create_file (adev->dev, &dev_attr_pp_dpm_pcie); +if (ret) { +DRM_ERROR ("failed to create device file pp_dpm_pcie\n" ); +return ret; + } + ret =device_create_file (adev->dev, &dev_attr_pp_sclk_od); +if (ret) { +DRM_ERROR ("failed to create device file pp_sclk_od\n" ); +return ret; + } + ret =device_create_file (adev->dev, &dev_attr_pp_mclk_od); +if (ret) { +DRM_ERROR ("failed to create device file pp_mclk_od\n" ); +return ret; + } + ret =device_create_file (adev->dev, + &dev_attr_pp_power_profile_mode); +if (ret) { +DRM_ERROR ("failed to create device file " +"pp_power_profile_mode\n" ); +return ret; + }if ((is_support_sw_smu (adev) && adev->smu.od_enabled) || (!is_support_sw_smu (adev) && hwmgr->od_enabled)) { ret = device_create_file(adev->dev,@@ -3056,25 +3052,21 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a/* GPU Clocks */ size =sizeof (value);seq_printf (m,"GFX Clocks and Power:\n" ); -if (adev->asic_type !=CHIP_NAVI10 ) { -if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GFX_MCLK , (void *)&value, &size)) -seq_printf (m,"\t%u MHz (MCLK)\n" , value/100 ); -if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GFX_SCLK , (void *)&value, &size)) -seq_printf (m,"\t%u MHz (SCLK)\n" , value/100 ); -if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK , (void *)&value, &size)) -seq_printf (m,"\t%u MHz (PSTATE_SCLK)\n" , value/100 ); -if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK , (void *)&value, &size)) -seq_printf (m,"\t%u MHz (PSTATE_MCLK)\n" , value/100 ); - } +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GFX_MCLK , (void *)&value, &size)) +seq_printf (m,"\t%u MHz (MCLK)\n" , value/100 ); +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GFX_SCLK , (void *)&value, &size)) +seq_printf (m,"\t%u MHz (SCLK)\n" , value/100 ); +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK , (void *)&value, &size)) +seq_printf (m,"\t%u MHz (PSTATE_SCLK)\n" , value/100 ); +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK , (void *)&value, &size)) +seq_printf (m,"\t%u MHz (PSTATE_MCLK)\n" , value/100 );if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_VDDGFX , (void *)&value, &size))seq_printf (m,"\t%u mV (VDDGFX)\n" , value);if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_VDDNB , (void *)&value, &size))seq_printf (m,"\t%u mV (VDDNB)\n" , value); -if (adev->asic_type !=CHIP_NAVI10 ) { - size =sizeof (uint32_t ); -if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GPU_POWER , (void *)&query, &size)) -seq_printf (m,"\t%u.%u W (average GPU)\n" , query >>8 , query &0xff ); - } + size =sizeof (uint32_t ); +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GPU_POWER , (void *)&query, &size)) +seq_printf (m,"\t%u.%u W (average GPU)\n" , query >>8 , query &0xff ); size =sizeof (value);seq_printf (m,"\n" );
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a · line 3079
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0
-4@@ -3082,10 +3074,6 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *aif (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GPU_TEMP , (void *)&value, &size))seq_printf (m,"GPU Temperature: %u C\n" , value/1000 ); -/* TODO: will be removed after gpu load, feature mask, uvd/vce clocks enabled on navi10 */ -if (adev->asic_type ==CHIP_NAVI10 ) -return 0 ; -/* GPU Load */ if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GPU_LOAD , (void *)&value, &size))seq_printf (m,"GPU Load: %u %%\n" , value);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 248/459 drm/amd/powerplay: add function get_workload_type_map for swsmu
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
1.add new callback function get_workload_byte for smu 2.remove old workload map function
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 6 +- drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h | 3 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 23 ++++++++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 58 ++++++++----------- 4 files changed, 53 insertions(+), 37 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -3
@@ -532,6 +532,7 @@ struct pptable_funcs {int (*get_smu_feature_index)(struct smu_context *smu,uint32_t index);int (*get_smu_table_index)(struct smu_context *smu,uint32_t index);int (*get_smu_power_index)(struct smu_context *smu,uint32_t index); +int (*get_workload_type)(struct smu_context *smu,enum PP_SMC_POWER_PROFILE profile);int (*run_afll_btc)(struct smu_context *smu);int (*get_allowed_feature_mask)(struct smu_context *smu,uint32_t *feature_mask,uint32_t num);enum amd_pm_state_type (*get_current_power_state)(struct smu_context *smu);
@@ -563,7 +564,6 @@ struct pptable_funcs { *clocks);int (*get_power_profile_mode)(struct smu_context *smu,char *buf);int (*set_power_profile_mode)(struct smu_context *smu,long *input,uint32_t size); -int (*conv_profile_to_workload )(struct smu_context *smu,int power_profile);enum amd_dpm_forced_level (*get_performance_level)(struct smu_context *smu);int (*force_performance_level)(struct smu_context *smu,enum amd_dpm_forced_level level);int (*dpm_set_uvd_enable)(struct smu_context *smu,bool enable);
@@ -839,6 +839,8 @@ struct smu_funcs ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_table_index? (smu)->ppt_funcs->get_smu_table_index((smu), (tab)) : -EINVAL) : -EINVAL)#define smu_power_get_index (smu, src) \ ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_power_index? (smu)->ppt_funcs->get_smu_power_index((smu), (src)) : -EINVAL) : -EINVAL) +#define smu_workload_get_type (smu, profile) \ + ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_workload_type? (smu)->ppt_funcs->get_workload_type((smu), (profile)) : -EINVAL) : -EINVAL)#define smu_run_afll_btc (smu) \ ((smu)->ppt_funcs? ((smu)->ppt_funcs->run_afll_btc? (smu)->ppt_funcs->run_afll_btc((smu)) : 0) : 0)#define smu_get_allowed_feature_mask (smu, feature_mask, num) \
@@ -869,8 +871,6 @@ struct smu_funcs ((smu)->funcs->notify_smu_enable_pwe ? (smu)->funcs->notify_smu_enable_pwe((smu)) : 0)#define smu_set_watermarks_for_clock_ranges (smu, clock_ranges) \ ((smu)->funcs->set_watermarks_for_clock_ranges ? (smu)->funcs->set_watermarks_for_clock_ranges((smu), (clock_ranges)) : 0) -#define smu_conv_profile_to_workload (smu, type) \ - ((smu)->ppt_funcs->conv_profile_to_workload ? (smu)->ppt_funcs->conv_profile_to_workload((smu), (type)) : 0)#define smu_dpm_set_uvd_enable (smu, enable) \ ((smu)->ppt_funcs->dpm_set_uvd_enable ? (smu)->ppt_funcs->dpm_set_uvd_enable((smu), (enable)) : 0)#define smu_dpm_set_vce_enable (smu, enable) \
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +3 -0
@@ -54,6 +54,9 @@#define PWR_MAP (tab) \ [SMU_POWER_SOURCE_##tab] = POWER_SOURCE_##tab +#define WORKLOAD_MAP (profile, workload) \ + [profile] = workload +struct smu_11_0_max_sustainable_clocks {uint32_t display_clock;uint32_t phy_clock;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +23 -0
@@ -194,6 +194,16 @@ static int navi10_pwr_src_map[SMU_POWER_SOURCE_COUNT] = { PWR_MAP(DC), }; +static int navi10_workload_map[] = { +WORKLOAD_MAP (PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ,WORKLOAD_PPLIB_DEFAULT_BIT ), +WORKLOAD_MAP (PP_SMC_POWER_PROFILE_FULLSCREEN3D ,WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT ), +WORKLOAD_MAP (PP_SMC_POWER_PROFILE_POWERSAVING ,WORKLOAD_PPLIB_POWER_SAVING_BIT ), +WORKLOAD_MAP (PP_SMC_POWER_PROFILE_VIDEO ,WORKLOAD_PPLIB_VIDEO_BIT ), +WORKLOAD_MAP (PP_SMC_POWER_PROFILE_VR ,WORKLOAD_PPLIB_VR_BIT ), +WORKLOAD_MAP (PP_SMC_POWER_PROFILE_COMPUTE ,WORKLOAD_PPLIB_CUSTOM_BIT ), +WORKLOAD_MAP (PP_SMC_POWER_PROFILE_CUSTOM ,WORKLOAD_PPLIB_CUSTOM_BIT ), +}; +static int navi10_get_smu_msg_index (struct smu_context *smc,uint32_t index) {int val;
@@ -259,6 +269,18 @@ static int navi10_get_pwr_src_index(struct smu_context *smc, uint32_t index)return val; } + +static int navi10_get_workload_type (struct smu_context *smu,enum PP_SMC_POWER_PROFILE profile) +{ +int val; +if (profile >PP_SMC_POWER_PROFILE_CUSTOM ) +return -EINVAL ; + + val = navi10_workload_map[profile]; + +return val; +} +static int navi10_get_allowed_feature_mask (struct smu_context *smu,uint32_t *feature_mask,uint32_t num)
@@ -848,6 +870,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_smu_feature_index = navi10_get_smu_feature_index, .get_smu_table_index = navi10_get_smu_table_index, .get_smu_power_index= navi10_get_pwr_src_index, + .get_workload_type = navi10_get_workload_type, .get_allowed_feature_mask = navi10_get_allowed_feature_mask, .set_default_dpm_table = navi10_set_default_dpm_table, .dpm_set_uvd_enable = navi10_dpm_set_uvd_enable,
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +24 -34
100 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 249/459 drm/amd/powerplay: add funciton get[set]_power_profile_mode for navi10 (v2)
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function get[set]_power_profile_mode for navi10 asic
v2: fix smu_update_table for rebase (Alex)
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 173 +++++++++++++++++++++ 1 file changed, 173 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +173 -0
@@ -859,6 +859,177 @@ static int navi10_get_fan_speed_percent(struct smu_context *smu,return ret; } +static int navi10_get_power_profile_mode (struct smu_context *smu,char *buf) +{ +DpmActivityMonitorCoeffInt_t activity_monitor; +uint32_t i, size =0 ; +uint16_t workload_type =0 ; +static const char *profile_name[] = { +"BOOTUP_DEFAULT" , +"3D_FULL_SCREEN" , +"POWER_SAVING" , +"VIDEO" , +"VR" , +"COMPUTE" , +"CUSTOM" }; +static const char *title[] = { +"PROFILE_INDEX(NAME)" , +"CLOCK_TYPE(NAME)" , +"FPS" , +"MinFreqType" , +"MinActiveFreqType" , +"MinActiveFreq" , +"BoosterFreqType" , +"BoosterFreq" , +"PD_Data_limit_c" , +"PD_Data_error_coeff" , +"PD_Data_error_rate_coeff" }; +int result =0 ; + +if (!buf) +return -EINVAL ; + + size +=sprintf (buf + size,"%16s %s %s %s %s %s %s %s %s %s %s\n" , + title[0 ], title[1 ], title[2 ], title[3 ], title[4 ], title[5 ], + title[6 ], title[7 ], title[8 ], title[9 ], title[10 ]); + +for (i =0 ; i <=PP_SMC_POWER_PROFILE_CUSTOM ; i++) { +/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */ + workload_type =smu_workload_get_type (smu, i); + result =smu_update_table (smu, +SMU_TABLE_ACTIVITY_MONITOR_COEFF | workload_type <<16 , + (void *)(&activity_monitor), false); +if (result) { +pr_err ("[%s] Failed to get activity monitor!" , __func__); +return result; + } + + size +=sprintf (buf + size,"%2d %14s%s:\n" , + i, profile_name[i], (i == smu->power_profile_mode) ?"*" :" " ); + + size +=sprintf (buf + size,"%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n" , +" " , +0 , +"GFXCLK" , + activity_monitor.Gfx_FPS, + activity_monitor.Gfx_MinFreqStep, + activity_monitor.Gfx_MinActiveFreqType, + activity_monitor.Gfx_MinActiveFreq, + activity_monitor.Gfx_BoosterFreqType, + activity_monitor.Gfx_BoosterFreq, + activity_monitor.Gfx_PD_Data_limit_c, + activity_monitor.Gfx_PD_Data_error_coeff, + activity_monitor.Gfx_PD_Data_error_rate_coeff); + + size +=sprintf (buf + size,"%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n" , +" " , +1 , +"SOCCLK" , + activity_monitor.Soc_FPS, + activity_monitor.Soc_MinFreqStep, + activity_monitor.Soc_MinActiveFreqType, + activity_monitor.Soc_MinActiveFreq, + activity_monitor.Soc_BoosterFreqType, + activity_monitor.Soc_BoosterFreq, + activity_monitor.Soc_PD_Data_limit_c, + activity_monitor.Soc_PD_Data_error_coeff, + activity_monitor.Soc_PD_Data_error_rate_coeff); + + size +=sprintf (buf + size,"%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n" , +" " , +2 , +"MEMLK" , + activity_monitor.Mem_FPS, + activity_monitor.Mem_MinFreqStep, + activity_monitor.Mem_MinActiveFreqType, + activity_monitor.Mem_MinActiveFreq, + activity_monitor.Mem_BoosterFreqType, + activity_monitor.Mem_BoosterFreq, + activity_monitor.Mem_PD_Data_limit_c, + activity_monitor.Mem_PD_Data_error_coeff, + activity_monitor.Mem_PD_Data_error_rate_coeff); + } + +return size; +} + +static int navi10_set_power_profile_mode (struct smu_context *smu,long *input,uint32_t size) +{ +DpmActivityMonitorCoeffInt_t activity_monitor; +int workload_type, ret =0 ; + + smu->power_profile_mode = input[size]; + +if (smu->power_profile_mode >PP_SMC_POWER_PROFILE_CUSTOM ) { +pr_err ("Invalid power profile mode %d\n" , smu->power_profile_mode); +return -EINVAL ; + } + +if (smu->power_profile_mode ==PP_SMC_POWER_PROFILE_CUSTOM ) { +if (size <0 ) +return -EINVAL ; + + ret =smu_update_table (smu, +SMU_TABLE_ACTIVITY_MONITOR_COEFF |WORKLOAD_PPLIB_CUSTOM_BIT <<16 , + (void *)(&activity_monitor), false); +if (ret) { +pr_err ("[%s] Failed to get activity monitor!" , __func__); +return ret; + } + +switch (input[0 ]) { +case 0 :/* Gfxclk */ + activity_monitor.Gfx_FPS = input[1 ]; + activity_monitor.Gfx_MinFreqStep = input[2 ]; + activity_monitor.Gfx_MinActiveFreqType = input[3 ]; + activity_monitor.Gfx_MinActiveFreq = input[4 ]; + activity_monitor.Gfx_BoosterFreqType = input[5 ]; + activity_monitor.Gfx_BoosterFreq = input[6 ]; + activity_monitor.Gfx_PD_Data_limit_c = input[7 ]; + activity_monitor.Gfx_PD_Data_error_coeff = input[8 ]; + activity_monitor.Gfx_PD_Data_error_rate_coeff = input[9 ]; +break ; +case 1 :/* Socclk */ + activity_monitor.Soc_FPS = input[1 ]; + activity_monitor.Soc_MinFreqStep = input[2 ]; + activity_monitor.Soc_MinActiveFreqType = input[3 ]; + activity_monitor.Soc_MinActiveFreq = input[4 ]; + activity_monitor.Soc_BoosterFreqType = input[5 ]; + activity_monitor.Soc_BoosterFreq = input[6 ]; + activity_monitor.Soc_PD_Data_limit_c = input[7 ]; + activity_monitor.Soc_PD_Data_error_coeff = input[8 ]; + activity_monitor.Soc_PD_Data_error_rate_coeff = input[9 ]; +break ; +case 2 :/* Memlk */ + activity_monitor.Mem_FPS = input[1 ]; + activity_monitor.Mem_MinFreqStep = input[2 ]; + activity_monitor.Mem_MinActiveFreqType = input[3 ]; + activity_monitor.Mem_MinActiveFreq = input[4 ]; + activity_monitor.Mem_BoosterFreqType = input[5 ]; + activity_monitor.Mem_BoosterFreq = input[6 ]; + activity_monitor.Mem_PD_Data_limit_c = input[7 ]; + activity_monitor.Mem_PD_Data_error_coeff = input[8 ]; + activity_monitor.Mem_PD_Data_error_rate_coeff = input[9 ]; +break ; + } + + ret =smu_update_table (smu, +SMU_TABLE_ACTIVITY_MONITOR_COEFF |WORKLOAD_PPLIB_CUSTOM_BIT <<16 , + (void *)(&activity_monitor), true); +if (ret) { +pr_err ("[%s] Failed to set activity monitor!" , __func__); +return ret; + } + } + +/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */ + workload_type =smu_workload_get_type (smu, smu->power_profile_mode); +smu_send_smc_msg_with_param (smu, SMU_MSG_SetWorkloadMask, +1 << workload_type); + +return ret; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -888,6 +1059,8 @@ static const struct pptable_funcs navi10_ppt_funcs = { .is_dpm_running = navi10_is_dpm_running, .set_thermal_fan_table = navi10_set_thermal_fan_table, .get_fan_speed_percent = navi10_get_fan_speed_percent, + .get_power_profile_mode = navi10_get_power_profile_mode, + .set_power_profile_mode = navi10_set_power_profile_mode, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 250/459 drm/amd/powerplay: add function get_profiling_clk_mask for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function get_profiling_clk_mask for navi10 asic
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +42 -0
@@ -1030,6 +1030,47 @@ static int navi10_set_power_profile_mode(struct smu_context *smu, long *input, ureturn ret; } +static int navi10_get_profiling_clk_mask (struct smu_context *smu, +enum amd_dpm_forced_level level, +uint32_t *sclk_mask, +uint32_t *mclk_mask, +uint32_t *soc_mask) +{ +int ret =0 ; +uint32_t level_count =0 ; + +if (level ==AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK ) { +if (sclk_mask) + *sclk_mask =0 ; + }else if (level ==AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK ) { +if (mclk_mask) + *mclk_mask =0 ; + }else if (level ==AMD_DPM_FORCED_LEVEL_PROFILE_PEAK ) { +if (sclk_mask) { + ret =smu_get_dpm_level_count (smu,SMU_SCLK , &level_count); +if (ret) +return ret; + *sclk_mask = level_count -1 ; + } + +if (mclk_mask) { + ret =smu_get_dpm_level_count (smu,SMU_MCLK , &level_count); +if (ret) +return ret; + *sclk_mask = level_count -1 ; + } + +if (soc_mask) { + ret =smu_get_dpm_level_count (smu,SMU_SOCCLK , &level_count); +if (ret) +return ret; + *sclk_mask = level_count -1 ; + } + } + +return ret; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -1061,6 +1102,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_fan_speed_percent = navi10_get_fan_speed_percent, .get_power_profile_mode = navi10_get_power_profile_mode, .set_power_profile_mode = navi10_set_power_profile_mode, + .get_profiling_clk_mask = navi10_get_profiling_clk_mask, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 251/459 drm/amd/powerplay: add function notify_smc_display_config_change for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function notify_smc_display_config_change for navi10 asic
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +40 -0
@@ -1071,6 +1071,45 @@ static int navi10_get_profiling_clk_mask(struct smu_context *smu,return ret; } +static int navi10_notify_smc_dispaly_config (struct smu_context *smu) +{ +struct smu_clocks min_clocks = {0 }; +struct pp_display_clock_request clock_req; +int ret =0 ; + + min_clocks.dcef_clock = smu->display_config->min_dcef_set_clk; + min_clocks.dcef_clock_in_sr = smu->display_config->min_dcef_deep_sleep_set_clk; + min_clocks.memory_clock = smu->display_config->min_mem_set_clock; + +if (smu_feature_is_supported (smu,SMU_FEATURE_DPM_DCEFCLK_BIT )) { + clock_req.clock_type = amd_pp_dcef_clock; + clock_req.clock_freq_in_khz = min_clocks.dcef_clock *10 ; +if (!smu_display_clock_voltage_request (smu, &clock_req)) { +if (smu_feature_is_supported (smu,SMU_FEATURE_DS_DCEFCLK_BIT )) { + ret =smu_send_smc_msg_with_param (smu, + SMU_MSG_SetMinDeepSleepDcefclk, + min_clocks.dcef_clock_in_sr/100 ); +if (ret) { +pr_err ("Attempt to set divider for DCEFCLK Failed!" ); +return ret; + } + } + }else { +pr_info ("Attempt to set Hard Min for DCEFCLK Failed!" ); + } + } + +if (smu_feature_is_enabled (smu,SMU_FEATURE_DPM_UCLK_BIT )) { + ret =smu_set_hard_freq_range (smu,SMU_UCLK , min_clocks.memory_clock/100 ,0 ); +if (ret) { +pr_err ("[%s] Set hard min uclk failed!" , __func__); +return ret; + } + } + +return 0 ; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -1093,6 +1132,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_clock_by_type_with_latency = navi10_get_clock_by_type_with_latency, .pre_display_config_changed = navi10_pre_display_config_changed, .display_config_changed = navi10_display_config_changed, + .notify_smc_dispaly_config = navi10_notify_smc_dispaly_config, .force_dpm_limit_value = navi10_force_dpm_limit_value, .unforce_dpm_levels = navi10_unforce_dpm_levels, .get_gpu_power = navi10_get_gpu_power,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 252/459 drm/amd/powerplay: add function set_watermarks_table function for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function set_watermarks_table for navi10 asic
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +61 -0
@@ -1110,6 +1110,66 @@ static int navi10_notify_smc_dispaly_config(struct smu_context *smu)return 0 ; } +static int navi10_set_watermarks_table (struct smu_context *smu, +void *watermarks,struct +dm_pp_wm_sets_with_clock_ranges_soc15 + *clock_ranges) +{ +int i; +Watermarks_t *table = watermarks; + +if (!table || !clock_ranges) +return -EINVAL ; + +if (clock_ranges->num_wm_dmif_sets >4 || + clock_ranges->num_wm_mcif_sets >4 ) +return -EINVAL ; + +for (i =0 ; i < clock_ranges->num_wm_dmif_sets; i++) { + table->WatermarkRow[1 ][i].MinClock = +cpu_to_le16 ((uint16_t ) + (clock_ranges->wm_dmif_clocks_ranges[i].wm_min_dcfclk_clk_in_khz / +1000 )); + table->WatermarkRow[1 ][i].MaxClock = +cpu_to_le16 ((uint16_t ) + (clock_ranges->wm_dmif_clocks_ranges[i].wm_max_dcfclk_clk_in_khz / +1000 )); + table->WatermarkRow[1 ][i].MinUclk = +cpu_to_le16 ((uint16_t ) + (clock_ranges->wm_dmif_clocks_ranges[i].wm_min_mem_clk_in_khz / +1000 )); + table->WatermarkRow[1 ][i].MaxUclk = +cpu_to_le16 ((uint16_t ) + (clock_ranges->wm_dmif_clocks_ranges[i].wm_max_mem_clk_in_khz / +1000 )); + table->WatermarkRow[1 ][i].WmSetting = (uint8_t ) + clock_ranges->wm_dmif_clocks_ranges[i].wm_set_id; + } + +for (i =0 ; i < clock_ranges->num_wm_mcif_sets; i++) { + table->WatermarkRow[0 ][i].MinClock = +cpu_to_le16 ((uint16_t ) + (clock_ranges->wm_mcif_clocks_ranges[i].wm_min_socclk_clk_in_khz / +1000 )); + table->WatermarkRow[0 ][i].MaxClock = +cpu_to_le16 ((uint16_t ) + (clock_ranges->wm_mcif_clocks_ranges[i].wm_max_socclk_clk_in_khz / +1000 )); + table->WatermarkRow[0 ][i].MinUclk = +cpu_to_le16 ((uint16_t ) + (clock_ranges->wm_mcif_clocks_ranges[i].wm_min_mem_clk_in_khz / +1000 )); + table->WatermarkRow[0 ][i].MaxUclk = +cpu_to_le16 ((uint16_t ) + (clock_ranges->wm_mcif_clocks_ranges[i].wm_max_mem_clk_in_khz / +1000 )); + table->WatermarkRow[0 ][i].WmSetting = (uint8_t ) + clock_ranges->wm_mcif_clocks_ranges[i].wm_set_id; + } + +return 0 ; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -1143,6 +1203,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_power_profile_mode = navi10_get_power_profile_mode, .set_power_profile_mode = navi10_set_power_profile_mode, .get_profiling_clk_mask = navi10_get_profiling_clk_mask, + .set_watermarks_table = navi10_set_watermarks_table, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 253/459 drm/amd/powerplay: add function read_sensor for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add callback function read_sensor for navi10 asic
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +21 -0
@@ -1170,6 +1170,26 @@ static int navi10_set_watermarks_table(struct smu_context *smu,return 0 ; } +static int navi10_read_sensor (struct smu_context *smu, +enum amd_pp_sensors sensor, +void *data,uint32_t *size) +{ +int ret =0 ; +struct smu_table_context *table_context = &smu->smu_table; +PPTable_t *pptable = table_context->driver_pptable; + +switch (sensor) { +case AMDGPU_PP_SENSOR_MAX_FAN_RPM : + *(uint32_t *)data = pptable->FanMaximumRpm; + *size =4 ; +break ; +default : +return -EINVAL ; + } + +return ret; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -1204,6 +1224,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .set_power_profile_mode = navi10_set_power_profile_mode, .get_profiling_clk_mask = navi10_get_profiling_clk_mask, .set_watermarks_table = navi10_set_watermarks_table, + .read_sensor = navi10_read_sensor, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 254/459 amd/powerplay: update the vcn pg
In reply to a message not in the archiveFrom: Kenneth Feng <[email protected]>
update the vcn pg function in navi10.
--- drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 6 ++++++ drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +6 -0
@@ -439,9 +439,15 @@ struct smu_dpm_context {struct mclock_latency_table *mclk_latency_table; }; +struct smu_power_gate { +bool uvd_gated; +bool vce_gated; +}; +struct smu_power_context {void *power_context;uint32_t power_context_size; +struct smu_power_gate power_gate; };
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +10 -4
@@ -521,15 +521,21 @@ static int navi10_set_default_dpm_table(struct smu_context *smu)static int navi10_dpm_set_uvd_enable (struct smu_context *smu,bool enable) {int ret =0 ; +struct smu_power_context *smu_power = &smu->smu_power; +struct smu_power_gate *power_gate = &smu_power->power_gate; -if (enable) { +if (enable && power_gate->uvd_gated) { ret =smu_send_smc_msg_with_param (smu, SMU_MSG_PowerUpVcn,1 );if (ret)return ret; + power_gate->uvd_gated = false; }else { - ret =smu_send_smc_msg (smu, SMU_MSG_PowerDownVcn); -if (ret) -return ret; +if (!enable && !power_gate->uvd_gated) { + ret =smu_send_smc_msg (smu, SMU_MSG_PowerDownVcn); +if (ret) +return ret; + power_gate->uvd_gated = true; + } }return 0 ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 255/459 drm/amd/powerplay: fix dpm freq unit error (10KHz -> Mhz)
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
the interface smu_v11_0_get_current_clk_freq should be return 10Khz not Mhz unit to adapt vega20 and navi10 asic at the same time.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -0
@@ -581,6 +581,8 @@ static int navi10_print_clk_levels(struct smu_context *smu, ret =smu_get_current_clk_freq (smu, clk_type, &cur_value);if (ret)return size; +/* 10KHz -> MHz */ + cur_value = cur_value /100 ; size +=sprintf (buf,"current clk: %uMhz\n" , cur_value);
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +10 -9
@@ -1098,16 +1098,17 @@ static int smu_v11_0_get_current_clk_freq(struct smu_context *smu,/* if don't has GetDpmClockFreq Message, try get current clock by SmuMetrics_t */ if (smu_msg_get_index (smu, SMU_MSG_GetDpmClockFreq) ==0 ) -return smu_get_current_clk_freq_by_table (smu, clk_id, value); - - ret =smu_send_smc_msg_with_param (smu, SMU_MSG_GetDpmClockFreq, - (smu_clk_get_index (smu, clk_id) <<16 )); -if (ret) -return ret; + ret =smu_get_current_clk_freq_by_table (smu, clk_id, &freq); +else { + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_GetDpmClockFreq, + (smu_clk_get_index (smu, clk_id) <<16 )); +if (ret) +return ret; - ret =smu_read_smc_arg (smu, &freq); -if (ret) -return ret; + ret =smu_read_smc_arg (smu, &freq); +if (ret) +return ret; + } freq *=100 ; *value = freq;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 256/459 drm/amd/powerplay: simplify the interface of get_current_activity_percent
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
this callback function is only call in read_sensor in smu_v11_0.c, so move this code to {asic}_ppt.c to implement as asic related function.
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 5 -- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 5 +- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 7 --- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 48 +++++++++++-------- 4 files changed, 31 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -5
@@ -595,9 +595,6 @@ struct pptable_funcs {int (*set_thermal_fan_table)(struct smu_context *smu);int (*get_fan_speed_percent)(struct smu_context *smu,uint32_t *speed);int (*get_gpu_power)(struct smu_context *smu,uint32_t *value); -int (*get_current_activity_percent)(struct smu_context *smu, -enum amd_pp_sensors sensor, -uint32_t *value);int (*set_watermarks_table)(struct smu_context *smu,void *watermarks,struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges); int (*get_current_clk_freq_by_table)(struct smu_context *smu,
@@ -830,8 +827,6 @@ struct smu_funcs ((smu)->ppt_funcs->get_fan_speed_percent ? (smu)->ppt_funcs->get_fan_speed_percent((smu), (speed)) : 0)#define smu_get_gpu_power (smu, val) \ ((smu)->ppt_funcs->get_gpu_power ? (smu)->ppt_funcs->get_gpu_power((smu), (val)) : 0) -#define smu_get_current_activity_percent (smu, val) \ - ((smu)->ppt_funcs->get_current_activity_percent ? (smu)->ppt_funcs->get_current_activity_percent((smu), (sensor), (val)) : 0)#define smu_set_fan_speed_percent (smu, speed) \ ((smu)->funcs->set_fan_speed_percent ? (smu)->funcs->set_fan_speed_percent((smu), (speed)) : 0)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +4 -1
@@ -1191,6 +1191,10 @@ static int navi10_read_sensor(struct smu_context *smu, *(uint32_t *)data = pptable->FanMaximumRpm; *size =4 ;break ; +case AMDGPU_PP_SENSOR_GPU_LOAD : + ret =navi10_get_current_activity_percent (smu, (uint32_t *)data); + *size =4 ; +break ;default :return -EINVAL ; }
@@ -1224,7 +1228,6 @@ static const struct pptable_funcs navi10_ppt_funcs = { .force_dpm_limit_value = navi10_force_dpm_limit_value, .unforce_dpm_levels = navi10_unforce_dpm_levels, .get_gpu_power = navi10_get_gpu_power, - .get_current_activity_percent = navi10_get_current_activity_percent, .is_dpm_running = navi10_is_dpm_running, .set_thermal_fan_table = navi10_set_thermal_fan_table, .get_fan_speed_percent = navi10_get_fan_speed_percent,
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -7
@@ -1320,13 +1320,6 @@ static int smu_v11_0_read_sensor(struct smu_context *smu, {int ret =0 ;switch (sensor) { -case AMDGPU_PP_SENSOR_GPU_LOAD : -case AMDGPU_PP_SENSOR_MEM_LOAD : - ret =smu_get_current_activity_percent (smu, - sensor, - (uint32_t *)data); - *size =4 ; -break ;case AMDGPU_PP_SENSOR_GFX_MCLK : ret =smu_get_current_clk_freq (smu,SMU_UCLK , (uint32_t *)data); *size =4 ;
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +27 -21
66 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 257/459 drm/amd/powerplay: simplify the interface of get_gpu_power
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
this callback function is only call in read_sensor in smu_v11_0.c, so move this code to {asic}_ppt.c to implement as asic related function.
--- drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 3 --- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 5 ++++- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 4 ---- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 5 ++++- 4 files changed, 8 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -3
@@ -594,7 +594,6 @@ struct pptable_funcs {void (*tables_init)(struct smu_context *smu,struct smu_table *tables);int (*set_thermal_fan_table)(struct smu_context *smu);int (*get_fan_speed_percent)(struct smu_context *smu,uint32_t *speed); -int (*get_gpu_power)(struct smu_context *smu,uint32_t *value);int (*set_watermarks_table)(struct smu_context *smu,void *watermarks,struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges); int (*get_current_clk_freq_by_table)(struct smu_context *smu,
@@ -825,8 +824,6 @@ struct smu_funcs ((smu)->funcs->set_fan_control_mode ? (smu)->funcs->set_fan_control_mode((smu), (value)) : 0)#define smu_get_fan_speed_percent (smu, speed) \ ((smu)->ppt_funcs->get_fan_speed_percent ? (smu)->ppt_funcs->get_fan_speed_percent((smu), (speed)) : 0) -#define smu_get_gpu_power (smu, val) \ - ((smu)->ppt_funcs->get_gpu_power ? (smu)->ppt_funcs->get_gpu_power((smu), (val)) : 0)#define smu_set_fan_speed_percent (smu, speed) \ ((smu)->funcs->set_fan_speed_percent ? (smu)->funcs->set_fan_speed_percent((smu), (speed)) : 0)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +4 -1
@@ -1195,6 +1195,10 @@ static int navi10_read_sensor(struct smu_context *smu, ret =navi10_get_current_activity_percent (smu, (uint32_t *)data); *size =4 ;break ; +case AMDGPU_PP_SENSOR_GPU_POWER : + ret =navi10_get_gpu_power (smu, (uint32_t *)data); + *size =4 ; +break ;default :return -EINVAL ; }
@@ -1227,7 +1231,6 @@ static const struct pptable_funcs navi10_ppt_funcs = { .notify_smc_dispaly_config = navi10_notify_smc_dispaly_config, .force_dpm_limit_value = navi10_force_dpm_limit_value, .unforce_dpm_levels = navi10_unforce_dpm_levels, - .get_gpu_power = navi10_get_gpu_power, .is_dpm_running = navi10_is_dpm_running, .set_thermal_fan_table = navi10_set_thermal_fan_table, .get_fan_speed_percent = navi10_get_fan_speed_percent,
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -4
@@ -1334,10 +1334,6 @@ static int smu_v11_0_read_sensor(struct smu_context *smu, ret =smu_v11_0_thermal_get_temperature (smu, sensor, (uint32_t *)data); *size =4 ;break ; -case AMDGPU_PP_SENSOR_GPU_POWER : - ret =smu_get_gpu_power (smu, (uint32_t *)data); - *size =4 ; -break ;case AMDGPU_PP_SENSOR_VDDGFX : ret =smu_v11_0_get_gfx_vdd (smu, (uint32_t *)data); *size =4 ;
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +4 -1
@@ -3033,6 +3033,10 @@ static int vega20_read_sensor(struct smu_context *smu, (uint32_t *)data); *size =4 ;break ; +case AMDGPU_PP_SENSOR_GPU_POWER : + ret =vega20_get_gpu_power (smu, (uint32_t *)data); + *size =4 ; +break ;default :return -EINVAL ; }
@@ -3145,7 +3149,6 @@ static const struct pptable_funcs vega20_ppt_funcs = { .is_dpm_running = vega20_is_dpm_running, .set_thermal_fan_table = vega20_set_thermal_fan_table, .get_fan_speed_percent = vega20_get_fan_speed_percent, - .get_gpu_power= vega20_get_gpu_power, .set_watermarks_table = vega20_set_watermarks_table, };
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 258/459 drm/amd/powerplay: fix amdgpu_pm_info show gpu load error
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
due to the smu dma/RTOS restriction, the interval of catching smu metric table should be more than 1ms. otherwise it will cause the gpu activity data corruption.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -0
@@ -816,6 +816,8 @@ static int navi10_get_current_activity_percent(struct smu_context *smu,if (!value)return -EINVAL ; +msleep (1 ); + ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS , (void *)&metrics, false);if (ret)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 259/459 drm/amd/powerplay/smu11: enable ds socclk by default
In reply to a message not in the archiveFrom: Tao Zhou <[email protected]>
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -0
@@ -299,6 +299,7 @@ navi10_get_allowed_feature_mask(struct smu_context *smu, | FEATURE_MASK(FEATURE_DPM_LINK_BIT) |FEATURE_MASK (FEATURE_GFX_ULV_BIT ) |FEATURE_MASK (FEATURE_RSMU_SMN_CG_BIT ) + |FEATURE_MASK (FEATURE_DS_SOCCLK_BIT ) |FEATURE_MASK (FEATURE_PPT_BIT ) |FEATURE_MASK (FEATURE_TDC_BIT ) |FEATURE_MASK (FEATURE_GFX_EDC_BIT )
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 260/459 drm/amd/powerplay/smu11: add secure board check function (v2)
In reply to a message not in the archiveFrom: Tao Zhou <[email protected]>
To determine whether the board is secure or not.
v2: rebase (Alex)
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +17 -0
@@ -35,6 +35,8 @@#include "smu_v11_0_pptable.h" #include "smu_v11_0_ppsmc.h" +#include "asic_reg/mp/mp_11_0_sh_mask.h" +#define FEATURE_MASK (feature) (1UL << feature)#define SMC_DPM_FEATURE ( \ FEATURE_MASK(FEATURE_DPM_PREFETCHER_BIT) | \
@@ -281,6 +283,21 @@ static int navi10_get_workload_type(struct smu_context *smu, enum PP_SMC_POWER_Preturn val; } +static bool is_asic_secure (struct smu_context *smu) +{ +struct amdgpu_device *adev = smu->adev; +bool is_secure = true; +uint32_t mp0_fw_intf; + + mp0_fw_intf =RREG32_PCIE (MP0_Public | + (smnMP0_FW_INTF &0xffffffff )); + +if (!(mp0_fw_intf & (1 <<19 ))) + is_secure = false; + +return is_secure; +} +static int navi10_get_allowed_feature_mask (struct smu_context *smu,uint32_t *feature_mask,uint32_t num)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 261/459 drm/amd/powerplay/smu11: disable some pp features on navi10 A0 secure board
In reply to a message not in the archiveFrom: Tao Zhou <[email protected]>
disable DPM UCLK and SOC DS on A0 secure board
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +12 -0
@@ -340,6 +340,18 @@ navi10_get_allowed_feature_mask(struct smu_context *smu,if (smu->adev->pg_flags &AMD_PG_SUPPORT_VCN ) *(uint64_t *)feature_mask |=FEATURE_MASK (FEATURE_VCN_PG_BIT ); +/* disable DPM UCLK and DS SOCCLK on navi10 A0 secure board */ +if (is_asic_secure (smu)) { +/* only for navi10 A0 */ +if ((adev->asic_type ==CHIP_NAVI10 ) && + (adev->rev_id ==0 )) { + *(uint64_t *)feature_mask &= + ~FEATURE_MASK (FEATURE_DPM_UCLK_BIT ); + *(uint64_t *)feature_mask &= + ~FEATURE_MASK (FEATURE_DS_SOCCLK_BIT ); + } + } +return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 262/459 drm/amdgpu: correct reference clock value on navi10
In reply to a message not in the archiveFrom: Tao Zhou <[email protected]>
remove the divisor 4
--- drivers/gpu/drm/amd/amdgpu/nv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/nv.c +1 -1
@@ -122,7 +122,7 @@ static u32 nv_get_config_memsize(struct amdgpu_device *adev)static u32 nv_get_xclk (struct amdgpu_device *adev) { -return adev->clock.spll.reference_freq /4 ; +return adev->clock.spll.reference_freq; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 263/459 drm/amd/powerplay: add sclk sysfs interface support for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
miss sclk support in force_clk_levels function
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -0
@@ -648,6 +648,7 @@ static int navi10_force_clk_levels(struct smu_context *smu,switch (clk_type) {case SMU_GFXCLK : +case SMU_SCLK :case SMU_SOCCLK :case SMU_MCLK :case SMU_UCLK :
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 264/459 drm/amd/powerplay: enable gfxclk ds, dcefclk ds and fw dstate on navi10
In reply to a message not in the archiveFrom: Kenneth Feng <[email protected]>
on navi10, by default the below four features are enabled.
gfxclk deep sleep: enabled and verified
fw dstate: enabled and then soc ulv is verified
dcefclk deep sleep: enabled and verified. notice that on different boards, due to the minimum dcefclk deep sleep setting in VBIOS, we may not see dcefclk deep sleep kicking in.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +4 -1
@@ -326,7 +326,10 @@ navi10_get_allowed_feature_mask(struct smu_context *smu, | FEATURE_MASK(FEATURE_LED_DISPLAY_BIT) |FEATURE_MASK (FEATURE_MMHUB_PG_BIT ) |FEATURE_MASK (FEATURE_ATHUB_PG_BIT ) - |FEATURE_MASK (FEATURE_DPM_DCEFCLK_BIT ); + |FEATURE_MASK (FEATURE_DPM_DCEFCLK_BIT ) + |FEATURE_MASK (FEATURE_DS_GFXCLK_BIT ) + |FEATURE_MASK (FEATURE_DS_DCEFCLK_BIT ) + |FEATURE_MASK (FEATURE_FW_DSTATE_BIT );if (adev->pm.pp_feature &PP_MCLK_DPM_MASK ) *(uint64_t *)feature_mask |=FEATURE_MASK (FEATURE_DPM_UCLK_BIT )
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 265/459 drm/amd/powerplay: enable ac/dc feature on navi10
In reply to a message not in the archiveFrom: Kenneth Feng <[email protected]>
enable ac/dc feature on navi10. currently we don't have the case to verify it.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -1
@@ -329,7 +329,8 @@ navi10_get_allowed_feature_mask(struct smu_context *smu, | FEATURE_MASK(FEATURE_DPM_DCEFCLK_BIT) |FEATURE_MASK (FEATURE_DS_GFXCLK_BIT ) |FEATURE_MASK (FEATURE_DS_DCEFCLK_BIT ) - |FEATURE_MASK (FEATURE_FW_DSTATE_BIT ); + |FEATURE_MASK (FEATURE_FW_DSTATE_BIT ) + |FEATURE_MASK (FEATURE_ACDC_BIT );if (adev->pm.pp_feature &PP_MCLK_DPM_MASK ) *(uint64_t *)feature_mask |=FEATURE_MASK (FEATURE_DPM_UCLK_BIT )
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 266/459 drm/amd/powerplay: enable uclk dpm default on navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
enable uclk (mclk) dpm by default on navi10
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +6 -6
@@ -314,6 +314,9 @@ navi10_get_allowed_feature_mask(struct smu_context *smu, | FEATURE_MASK(FEATURE_DPM_SOCCLK_BIT) |FEATURE_MASK (FEATURE_DPM_MP0CLK_BIT ) |FEATURE_MASK (FEATURE_DPM_LINK_BIT ) + |FEATURE_MASK (FEATURE_DPM_UCLK_BIT ) + |FEATURE_MASK (FEATURE_MEM_VDDCI_SCALING_BIT ) + |FEATURE_MASK (FEATURE_MEM_MVDD_SCALING_BIT ) |FEATURE_MASK (FEATURE_GFX_ULV_BIT ) |FEATURE_MASK (FEATURE_RSMU_SMN_CG_BIT ) |FEATURE_MASK (FEATURE_DS_SOCCLK_BIT )
@@ -332,11 +335,6 @@ navi10_get_allowed_feature_mask(struct smu_context *smu, | FEATURE_MASK(FEATURE_FW_DSTATE_BIT) |FEATURE_MASK (FEATURE_ACDC_BIT ); -if (adev->pm.pp_feature &PP_MCLK_DPM_MASK ) - *(uint64_t *)feature_mask |=FEATURE_MASK (FEATURE_DPM_UCLK_BIT ) - |FEATURE_MASK (FEATURE_MEM_VDDCI_SCALING_BIT ) - |FEATURE_MASK (FEATURE_MEM_MVDD_SCALING_BIT ); -if (adev->pm.pp_feature &PP_GFXOFF_MASK ) *(uint64_t *)feature_mask |=FEATURE_MASK (FEATURE_GFX_SS_BIT ) |FEATURE_MASK (FEATURE_GFXOFF_BIT );
@@ -350,7 +348,9 @@ navi10_get_allowed_feature_mask(struct smu_context *smu,if ((adev->asic_type ==CHIP_NAVI10 ) && (adev->rev_id ==0 )) { *(uint64_t *)feature_mask &= - ~FEATURE_MASK (FEATURE_DPM_UCLK_BIT ); + ~(FEATURE_MASK (FEATURE_DPM_UCLK_BIT ) + |FEATURE_MASK (FEATURE_MEM_VDDCI_SCALING_BIT ) + |FEATURE_MASK (FEATURE_MEM_MVDD_SCALING_BIT )); *(uint64_t *)feature_mask &= ~FEATURE_MASK (FEATURE_DS_SOCCLK_BIT ); }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 267/459 drm/amd/powerplay: move power_dpm_force_performance_level to amdgpu_smu file
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
because this callback is not asic related function, so move it to top code level to support more asic (eg: navi10)
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 41 ++++++++++++++++++ .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 8 +--- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 42 ------------------- 3 files changed, 43 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +41 -0
@@ -1404,6 +1404,47 @@ int smu_handle_task(struct smu_context *smu,return ret; } +enum amd_dpm_forced_level smu_get_performance_level (struct smu_context *smu) +{ +struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm); + +if (!smu_dpm_ctx->dpm_context) +return -EINVAL ; + +mutex_lock (&(smu->mutex)); +if (smu_dpm_ctx->dpm_level != smu_dpm_ctx->saved_dpm_level) { + smu_dpm_ctx->saved_dpm_level = smu_dpm_ctx->dpm_level; + } +mutex_unlock (&(smu->mutex)); + +return smu_dpm_ctx->dpm_level; +} + +int smu_force_performance_level (struct smu_context *smu,enum amd_dpm_forced_level level) +{ +int ret =0 ; +int i; +struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm); + +if (!smu_dpm_ctx->dpm_context) +return -EINVAL ; + +for (i =0 ; i < smu->adev->num_ip_blocks; i++) { +if (smu->adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_SMC ) +break ; + } + +mutex_lock (&smu->mutex); + + smu->adev->ip_blocks[i].version->funcs->enable_umd_pstate (smu, &level); + ret =smu_handle_task (smu, level, +AMD_PP_TASK_READJUST_POWER_STATE ); + +mutex_unlock (&smu->mutex); + +return ret; +} +const struct amd_ip_funcs smu_ip_funcs = { .name ="smu" , .early_init = smu_early_init,
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -6
@@ -570,8 +570,6 @@ struct pptable_funcs { *clocks);int (*get_power_profile_mode)(struct smu_context *smu,char *buf);int (*set_power_profile_mode)(struct smu_context *smu,long *input,uint32_t size); -enum amd_dpm_forced_level (*get_performance_level)(struct smu_context *smu); -int (*force_performance_level)(struct smu_context *smu,enum amd_dpm_forced_level level);int (*dpm_set_uvd_enable)(struct smu_context *smu,bool enable);int (*dpm_set_vce_enable)(struct smu_context *smu,bool enable); int (*read_sensor)(struct smu_context *smu, enum amd_pp_sensors sensor,
@@ -798,10 +796,6 @@ struct smu_funcs ((smu)->ppt_funcs->get_power_profile_mode ? (smu)->ppt_funcs->get_power_profile_mode((smu), buf) : 0)#define smu_set_power_profile_mode (smu, param, param_size) \ ((smu)->ppt_funcs->set_power_profile_mode ? (smu)->ppt_funcs->set_power_profile_mode((smu), (param), (param_size)) : 0) -#define smu_get_performance_level (smu) \ - ((smu)->ppt_funcs->get_performance_level ? (smu)->ppt_funcs->get_performance_level((smu)) : 0) -#define smu_force_performance_level (smu, level) \ - ((smu)->ppt_funcs->force_performance_level ? (smu)->ppt_funcs->force_performance_level((smu), (level)) : 0)#define smu_pre_display_config_changed (smu) \ ((smu)->ppt_funcs->pre_display_config_changed ? (smu)->ppt_funcs->pre_display_config_changed((smu)) : 0)#define smu_display_config_changed (smu) \
@@ -939,4 +933,6 @@ int smu_set_soft_freq_range(struct smu_context *smu, enum smu_clk_type clk_type, uint32_t min, uint32_t max);int smu_set_hard_freq_range (struct smu_context *smu,enum smu_clk_type clk_type,uint32_t min,uint32_t max); +enum amd_dpm_forced_level smu_get_performance_level (struct smu_context *smu); +int smu_force_performance_level (struct smu_context *smu,enum amd_dpm_forced_level level);#endif
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -42
54 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 268/459 drm/amdgpu/gfx10: remove static GDS, GWS and OA allcoation
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 57 +++++--------------------- 1 file changed, 11 insertions(+), 46 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +11 -46
@@ -1232,25 +1232,6 @@ static int gfx_v10_0_sw_init(void *handle)if (r)return r; -/* reserve GDS, GWS and OA resource for gfx */ - r =amdgpu_bo_create_kernel (adev, adev->gds.mem.gfx_partition_size, -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_GDS , - &adev->gds.gds_gfx_bo,NULL ,NULL ); -if (r) -return r; - - r =amdgpu_bo_create_kernel (adev, adev->gds.gws.gfx_partition_size, -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_GWS , - &adev->gds.gws_gfx_bo,NULL ,NULL ); -if (r) -return r; - - r =amdgpu_bo_create_kernel (adev, adev->gds.oa.gfx_partition_size, -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_OA , - &adev->gds.oa_gfx_bo,NULL ,NULL ); -if (r) -return r; -/* allocate visible FB for rlc auto-loading fw */ if (adev->firmware.load_type ==AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO ) { r =gfx_v10_0_rlc_backdoor_autoload_buffer_init (adev);
@@ -1291,10 +1272,6 @@ static int gfx_v10_0_sw_fini(void *handle)int i;struct amdgpu_device *adev = (struct amdgpu_device *)handle; -amdgpu_bo_free_kernel (&adev->gds.oa_gfx_bo,NULL ,NULL ); -amdgpu_bo_free_kernel (&adev->gds.gws_gfx_bo,NULL ,NULL ); -amdgpu_bo_free_kernel (&adev->gds.gds_gfx_bo,NULL ,NULL ); -for (i =0 ; i < adev->gfx.num_gfx_rings; i++)amdgpu_ring_fini (&adev->gfx.gfx_ring[i]);for (i =0 ; i < adev->gfx.num_compute_rings; i++)
@@ -4526,7 +4503,7 @@ static void gfx_v10_0_ring_emit_de_meta(struct amdgpu_ring *ring, bool resume)int cnt; csa_addr =amdgpu_csa_vaddr (ring->adev); - gds_addr =ALIGN (csa_addr +AMDGPU_CSA_SIZE - adev->gds.mem.total_size, + gds_addr =ALIGN (csa_addr +AMDGPU_CSA_SIZE - adev->gds.gds_size,PAGE_SIZE ); de_payload.gds_backup_addrlo =lower_32_bits (gds_addr); de_payload.gds_backup_addrhi =upper_32_bits (gds_addr);
@@ -5119,29 +5096,17 @@ static void gfx_v10_0_set_rlc_funcs(struct amdgpu_device *adev)static void gfx_v10_0_set_gds_init (struct amdgpu_device *adev) {/* init asic gds info */ - adev->gds.mem.total_size =RREG32_SOC15 (GC ,0 , mmGDS_VMID0_SIZE); - adev->gds.gws.total_size =64 ; - adev->gds.oa.total_size =16 ; - -if (adev->gds.mem.total_size ==64 *1024 ) { - adev->gds.mem.gfx_partition_size =4096 ; - adev->gds.mem.cs_partition_size =4096 ; - - adev->gds.gws.gfx_partition_size =4 ; - adev->gds.gws.cs_partition_size =4 ; - - adev->gds.oa.gfx_partition_size =4 ; - adev->gds.oa.cs_partition_size =1 ; - }else { - adev->gds.mem.gfx_partition_size =1024 ; - adev->gds.mem.cs_partition_size =1024 ; - - adev->gds.gws.gfx_partition_size =16 ; - adev->gds.gws.cs_partition_size =16 ; - - adev->gds.oa.gfx_partition_size =4 ; - adev->gds.oa.cs_partition_size =4 ; +switch (adev->asic_type) { +case CHIP_NAVI10 : + adev->gds.gds_size =0x10000 ; +break ; +default : + adev->gds.gds_size =0x10000 ; +break ; } + + adev->gds.gws_size =64 ; + adev->gds.oa_size =16 ; } static void gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(struct amdgpu_device *adev,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20190617193106.18231-69-alexander.deucher-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 268/459] drm/amdgpu/gfx10: remove static GDS, GWS and OA allcoation
Am 17.06.19 um 21:30 schrieb Alex Deucher:
Quoted 4 lines
From: Hawking Zhang <[email protected]>
Signed-off-by Hawking Zhang <[email protected]>Signed-off-by Alex Deucher <[email protected]>
Since the fields where removed this should most likely be squashed into the original commit adding the code, or otherwise everything in between won't compile any more.
Christian.
Quoted 84 lines
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 57 +++++--------------------- 1 file changed, 11 insertions(+), 46 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5
-46@@ -1232,25 +1232,6 @@ static int gfx_v10_0_sw_init(void *handle)if (r)return r; -/* reserve GDS, GWS and OA resource for gfx */ - r =amdgpu_bo_create_kernel (adev, adev->gds.mem.gfx_partition_size, -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_GDS , - &adev->gds.gds_gfx_bo,NULL ,NULL ); -if (r) -return r; - - r =amdgpu_bo_create_kernel (adev, adev->gds.gws.gfx_partition_size, -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_GWS , - &adev->gds.gws_gfx_bo,NULL ,NULL ); -if (r) -return r; - - r =amdgpu_bo_create_kernel (adev, adev->gds.oa.gfx_partition_size, -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_OA , - &adev->gds.oa_gfx_bo,NULL ,NULL ); -if (r) -return r; -/* allocate visible FB for rlc auto-loading fw */ if (adev->firmware.load_type ==AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO ) { r =gfx_v10_0_rlc_backdoor_autoload_buffer_init (adev);@@ -1291,10 +1272,6 @@ static int gfx_v10_0_sw_fini(void *handle)int i;struct amdgpu_device *adev = (struct amdgpu_device *)handle; -amdgpu_bo_free_kernel (&adev->gds.oa_gfx_bo,NULL ,NULL ); -amdgpu_bo_free_kernel (&adev->gds.gws_gfx_bo,NULL ,NULL ); -amdgpu_bo_free_kernel (&adev->gds.gds_gfx_bo,NULL ,NULL ); -for (i =0 ; i < adev->gfx.num_gfx_rings; i++)amdgpu_ring_fini (&adev->gfx.gfx_ring[i]);for (i =0 ; i < adev->gfx.num_compute_rings; i++)@@ -4526,7 +4503,7 @@ static void gfx_v10_0_ring_emit_de_meta(struct amdgpu_ring *ring, bool resume)int cnt; csa_addr =amdgpu_csa_vaddr (ring->adev); - gds_addr =ALIGN (csa_addr +AMDGPU_CSA_SIZE - adev->gds.mem.total_size, + gds_addr =ALIGN (csa_addr +AMDGPU_CSA_SIZE - adev->gds.gds_size,PAGE_SIZE ); de_payload.gds_backup_addrlo =lower_32_bits (gds_addr); de_payload.gds_backup_addrhi =upper_32_bits (gds_addr);@@ -5119,29 +5096,17 @@ static void gfx_v10_0_set_rlc_funcs(struct amdgpu_device *adev)static void gfx_v10_0_set_gds_init (struct amdgpu_device *adev) {/* init asic gds info */ - adev->gds.mem.total_size =RREG32_SOC15 (GC ,0 , mmGDS_VMID0_SIZE); - adev->gds.gws.total_size =64 ; - adev->gds.oa.total_size =16 ; - -if (adev->gds.mem.total_size ==64 *1024 ) { - adev->gds.mem.gfx_partition_size =4096 ; - adev->gds.mem.cs_partition_size =4096 ; - - adev->gds.gws.gfx_partition_size =4 ; - adev->gds.gws.cs_partition_size =4 ; - - adev->gds.oa.gfx_partition_size =4 ; - adev->gds.oa.cs_partition_size =1 ; - }else { - adev->gds.mem.gfx_partition_size =1024 ; - adev->gds.mem.cs_partition_size =1024 ; - - adev->gds.gws.gfx_partition_size =16 ; - adev->gds.gws.cs_partition_size =16 ; - - adev->gds.oa.gfx_partition_size =4 ; - adev->gds.oa.cs_partition_size =4 ; +switch (adev->asic_type) { +case CHIP_NAVI10 : + adev->gds.gds_size =0x10000 ; +break ;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_set_rlc_funcs(struct amdgpu_device *adev) · line 5112
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +6
-0+default : + adev->gds.gds_size =0x10000 ; +break ; } + + adev->gds.gws_size =64 ; + adev->gds.oa_size =16 ; } static void gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(struct amdgpu_device *adev,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 269/459 drm/amd/powerplay: move function get_metrics_table to vega20_ppt
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
the SmuMetrics_t table is asic related data structure. so move vega20_ppt file to implement.
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 6 +-- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 +- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 36 +++--------------- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 37 ++++++++++++++++--- 4 files changed, 42 insertions(+), 39 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -3
@@ -406,6 +406,8 @@ struct smu_table_contextvoid *power_play_table;uint32_t power_play_table_size;void *hardcode_pptable; +unsigned long metrics_time; +void *metrics_table;void *max_sustainable_clocks;struct smu_bios_boot_up_values boot_values;
@@ -524,8 +526,6 @@ struct smu_contextuint32_t smc_if_version; -unsigned long metrics_time; -void *metrics_table; };struct pptable_funcs {
@@ -589,7 +589,7 @@ struct pptable_funcs {int (*set_ppfeature_status)(struct smu_context *smu,uint64_t ppfeatures);int (*get_ppfeature_status)(struct smu_context *smu,char *buf);bool (*is_dpm_running)(struct smu_context *smu); -void (*tables_init)(struct smu_context *smu,struct smu_table *tables); +int (*tables_init)(struct smu_context *smu,struct smu_table *tables);int (*set_thermal_fan_table)(struct smu_context *smu);int (*get_fan_speed_percent)(struct smu_context *smu,uint32_t *speed); int (*set_watermarks_table)(struct smu_context *smu, void *watermarks,
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -1
@@ -479,7 +479,7 @@ static int navi10_store_powerplay_table(struct smu_context *smu)return 0 ; } -static void navi10_tables_init (struct smu_context *smu,struct smu_table *tables) +static int navi10_tables_init (struct smu_context *smu,struct smu_table *tables) {SMU_TABLE_INIT (tables,SMU_TABLE_PPTABLE ,sizeof (PPTable_t),PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM );
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +6 -30
@@ -407,7 +407,9 @@ static int smu_v11_0_init_smc_tables(struct smu_context *smu) smu_table->tables = tables; -smu_tables_init (smu, tables); + ret =smu_tables_init (smu, tables); +if (ret) +return ret; ret =smu_v11_0_init_dpm_context (smu);if (ret)
@@ -425,8 +427,11 @@ static int smu_v11_0_fini_smc_tables(struct smu_context *smu)return -EINVAL ;kfree (smu_table->tables); +kfree (smu_table->metrics_table); smu_table->tables =NULL ; smu_table->table_count =0 ; + smu_table->metrics_table =NULL ; + smu_table->metrics_time =0 ; ret =smu_v11_0_fini_dpm_context (smu);if (ret)
@@ -449,13 +454,6 @@ static int smu_v11_0_init_power(struct smu_context *smu)return -ENOMEM ; smu_power->power_context_size =sizeof (struct smu_11_0_dpm_context ); - smu->metrics_time =0 ; - smu->metrics_table =kzalloc (sizeof (SmuMetrics_t),GFP_KERNEL ); -if (!smu->metrics_table) { -kfree (smu_power->power_context); -return -ENOMEM ; - } -return 0 ; }
@@ -468,9 +466,7 @@ static int smu_v11_0_fini_power(struct smu_context *smu)if (!smu_power->power_context || smu_power->power_context_size ==0 )return -EINVAL ; -kfree (smu->metrics_table);kfree (smu_power->power_context); - smu->metrics_table =NULL ; smu_power->power_context =NULL ; smu_power->power_context_size =0 ;
@@ -1227,26 +1223,6 @@ static int smu_v11_0_start_thermal_control(struct smu_context *smu)return ret; } -static int smu_v11_0_get_metrics_table (struct smu_context *smu, -SmuMetrics_t *metrics_table) -{ -int ret =0 ; - -if (!smu->metrics_time ||time_after (jiffies, smu->metrics_time +HZ /1000 )) { - ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS , - (void *)metrics_table, false); -if (ret) { -pr_info ("Failed to export SMU metrics table!\n" ); -return ret; - } -memcpy (smu->metrics_table, metrics_table,sizeof (SmuMetrics_t)); - smu->metrics_time = jiffies; - }else -memcpy (metrics_table, smu->metrics_table,sizeof (SmuMetrics_t)); - -return ret; -} -static int smu_v11_0_thermal_get_temperature (struct smu_context *smu,enum amd_pp_sensors sensor,uint32_t *value)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +32 -5
@@ -294,8 +294,10 @@ static int vega20_get_workload_type(struct smu_context *smu, enum PP_SMC_POWER_Preturn val; } -static void vega20_tables_init (struct smu_context *smu,struct smu_table *tables) +static int vega20_tables_init (struct smu_context *smu,struct smu_table *tables) { +struct smu_table_context *smu_table = &smu->smu_table; +SMU_TABLE_INIT (tables,SMU_TABLE_PPTABLE ,sizeof (PPTable_t),PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); SMU_TABLE_INIT(tables, SMU_TABLE_WATERMARKS, sizeof(Watermarks_t),
@@ -309,6 +311,13 @@ static void vega20_tables_init(struct smu_context *smu, struct smu_table *tablesSMU_TABLE_INIT (tables,SMU_TABLE_ACTIVITY_MONITOR_COEFF ,sizeof (DpmActivityMonitorCoeffInt_t),PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); + + smu_table->metrics_table =kzalloc (sizeof (SmuMetrics_t),GFP_KERNEL ); +if (smu_table->metrics_table) +return -ENOMEM ; + smu_table->metrics_time =0 ; + +return 0 ; }static int vega20_allocate_dpm_context (struct smu_context *smu)
@@ -1654,6 +1663,26 @@ static int vega20_set_default_od8_setttings(struct smu_context *smu)return 0 ; } +static int vega20_get_metrics_table (struct smu_context *smu, +SmuMetrics_t *metrics_table) +{ +struct smu_table_context *smu_table= &smu->smu_table; +int ret =0 ; + +if (!smu_table->metrics_time ||time_after (jiffies, smu_table->metrics_time +HZ /1000 )) { + ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS , + (void *)smu_table->metrics_table, false); +if (ret) { +pr_info ("Failed to export SMU metrics table!\n" ); +return ret; + } + smu_table->metrics_time = jiffies; + } + +memcpy (metrics_table, smu_table->metrics_table,sizeof (SmuMetrics_t)); + +return ret; +}static int vega20_get_od_percentage (struct smu_context *smu,enum pp_clock_type type) {
@@ -2933,8 +2962,7 @@ static int vega20_get_gpu_power(struct smu_context *smu, uint32_t *value)if (!value)return -EINVAL ; - ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS , (void *)&metrics, - false); + ret =vega20_get_metrics_table (smu, &metrics);if (ret)return ret;
@@ -2953,8 +2981,7 @@ static int vega20_get_current_activity_percent(struct smu_context *smu,if (!value)return -EINVAL ; - ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS , - (void *)&metrics, false); + ret =vega20_get_metrics_table (smu, &metrics);if (ret)return ret;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 270/459 drm/amd/powerplay: move function thermal_get_temperature to veag20_ppt
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
the fcuntion thermal_get_temperature will be access SmuMetrics_t data, the data structure is asic related, so move vega20_ppt to implement.
--- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 7 ---- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 48 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -7
@@ -1265,7 +1265,6 @@ static int smu_v11_0_thermal_get_temperature(struct smu_context *smu,return 0 ; } -static uint16_t convert_to_vddc (uint8_t vid) {return (uint16_t ) ((6200 - (vid *25 )) /SMU11_VOLTAGE_SCALE );
@@ -1304,12 +1303,6 @@ static int smu_v11_0_read_sensor(struct smu_context *smu, ret =smu_get_current_clk_freq (smu,SMU_GFXCLK , (uint32_t *)data); *size =4 ;break ; -case AMDGPU_PP_SENSOR_HOTSPOT_TEMP : -case AMDGPU_PP_SENSOR_EDGE_TEMP : -case AMDGPU_PP_SENSOR_MEM_TEMP : - ret =smu_v11_0_thermal_get_temperature (smu, sensor, (uint32_t *)data); - *size =4 ; -break ;case AMDGPU_PP_SENSOR_VDDGFX : ret =smu_v11_0_get_gfx_vdd (smu, (uint32_t *)data); *size =4 ;
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +48 -0
60 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 271/459 drm/amd/powerplay: move get_thermal_temperature_range to ppt funcs
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
The thermal policy could be ASIC specific ones and depends on structures in pptable. As a result, get_thermal_temperature_range should be implemented as ppt funcs instead of smu funcs
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 14 +++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 90 +++---------------- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 47 +++++++++- 3 files changed, 70 insertions(+), 81 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +14 -0
@@ -26,6 +26,10 @@#include "kgd_pp_interface.h" #include "dm_pp_interface.h" +#define SMU_THERMAL_MINIMUM_ALERT_TEMP 0 +#define SMU_THERMAL_MAXIMUM_ALERT_TEMP 255 +#define SMU_TEMPERATURE_UNITS_PER_CENTIGRADES 1000 +struct smu_hw_power_state {unsigned int magic; };
@@ -106,6 +110,13 @@ struct smu_state_software_algorithm_block {struct smu_temperature_range {int min;int max; +int edge_emergency_max; +int hotspot_min; +int hotspot_crit_max; +int hotspot_emergency_max; +int mem_min; +int mem_crit_max; +int mem_emergency_max; };struct smu_state_validation_block {
@@ -597,6 +608,7 @@ struct pptable_funcs {int (*get_current_clk_freq_by_table)(struct smu_context *smu,enum smu_clk_type clk_type,uint32_t *value); +int (*get_thermal_temperature_range)(struct smu_context *smu,struct smu_temperature_range *range); };struct smu_funcs
@@ -881,6 +893,8 @@ struct smu_funcs ((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0)#define smu_get_current_clk_freq_by_table (smu, clk_type, value) \ ((smu)->ppt_funcs->get_current_clk_freq_by_table ? (smu)->ppt_funcs->get_current_clk_freq_by_table((smu), (clk_type), (value)) : 0) +#define smu_get_thermal_temperature_range (smu, range) \ + ((smu)->ppt_funcs->get_thermal_temperature_range? (smu)->ppt_funcs->get_thermal_temperature_range((smu), (range)) : 0) extern int smu_get_atom_data_table(struct smu_context *smu, uint32_t table, uint16_t *size, uint8_t *frev, uint8_t *crev,
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +12 -78
137 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +44 -3
83 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 272/459 drm/amd/powerplay: fix no statements in fucntion returning non-void
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -0
@@ -494,6 +494,8 @@ static int navi10_tables_init(struct smu_context *smu, struct smu_table *tables)SMU_TABLE_INIT (tables,SMU_TABLE_ACTIVITY_MONITOR_COEFF ,sizeof (DpmActivityMonitorCoeffInt_t),PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); + +return 0 ; }static int navi10_allocate_dpm_context (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 273/459 drm/amd/powerplay: add thermal ctf support for navi10
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
add sw-CTF support for navi10
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 7 ++ .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 4 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 + drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 78 +++++++++++++++++++ 4 files changed, 91 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +7 -0
@@ -1007,6 +1007,10 @@ static int smu_hw_init(void *handle)if (ret) goto failed; + ret =smu_register_irq_handler (smu); +if (ret) + goto failed; +mutex_unlock (&smu->mutex);if (!smu->pm_enabled)
@@ -1051,6 +1055,9 @@ static int smu_hw_fini(void *handle)kfree (table_context->od8_settings); table_context->od8_settings =NULL ; +kfree (smu->irq_source); + smu->irq_source =NULL ; + ret =smu_fini_fb_allocations (smu);if (ret)return ret;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +4 -0
@@ -497,6 +497,7 @@ struct mclock_latency_table {struct smu_context {struct amdgpu_device *adev; +struct amdgpu_irq_src *irq_source;const struct smu_funcs *funcs;const struct pptable_funcs *ppt_funcs;
@@ -687,6 +688,7 @@ struct smu_funcsint (*set_fan_speed_rpm)(struct smu_context *smu,uint32_t speed);int (*set_xgmi_pstate)(struct smu_context *smu,uint32_t pstate);int (*gfx_off_control)(struct smu_context *smu,bool enable); +int (*register_irq_handler)(struct smu_context *smu); };#define smu_init_microcode (smu) \
@@ -895,6 +897,8 @@ struct smu_funcs ((smu)->ppt_funcs->get_current_clk_freq_by_table ? (smu)->ppt_funcs->get_current_clk_freq_by_table((smu), (clk_type), (value)) : 0)#define smu_get_thermal_temperature_range (smu, range) \ ((smu)->ppt_funcs->get_thermal_temperature_range? (smu)->ppt_funcs->get_thermal_temperature_range((smu), (range)) : 0) +#define smu_register_irq_handler (smu) \ + ((smu)->funcs->register_irq_handler ? (smu)->funcs->register_irq_handler(smu) : 0) extern int smu_get_atom_data_table(struct smu_context *smu, uint32_t table, uint16_t *size, uint8_t *frev, uint8_t *crev,
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -0
@@ -476,6 +476,8 @@ static int navi10_store_powerplay_table(struct smu_context *smu)memcpy (table_context->driver_pptable, &powerplay_table->smc_pptable,sizeof (PPTable_t)); + table_context->thermal_controller_type = powerplay_table->thermal_controller_type; +return 0 ; }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +78 -0
102 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 274/459 drm/amd/powerplay: remove smu mutex lock in smu_hw_init
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
the smu mutex lock is unnecessary in smu hw init.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -4
@@ -981,8 +981,6 @@ static int smu_hw_init(void *handle) } } -mutex_lock (&smu->mutex); - ret =smu_feature_init_dpm (smu);if (ret) goto failed;
@@ -1011,8 +1009,6 @@ static int smu_hw_init(void *handle)if (ret) goto failed; -mutex_unlock (&smu->mutex); -if (!smu->pm_enabled) adev->pm.dpm_enabled = false;else
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 275/459 drm/amd/powerplay: remove smu callback funciton get_mclk(get_sclk)
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
remove smu callback: get_mclk, get_sclk.
because the function smu_get_dpm_freq_range has the same function.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c | 32 +++++-- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 34 ++++++-- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 6 -- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 85 ------------------- 4 files changed, 54 insertions(+), 103 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c +26 -6
@@ -907,18 +907,38 @@ amdgpu_get_vce_clock_state(void *handle, u32 idx)int amdgpu_dpm_get_sclk (struct amdgpu_device *adev,bool low) { -if (is_support_sw_smu (adev)) -return smu_get_sclk (&adev->smu, low); -else +uint32_t clk_freq; +int ret =0 ; +if (is_support_sw_smu (adev)) { + ret =smu_get_dpm_freq_range (&adev->smu,SMU_GFXCLK , + low ? &clk_freq :NULL , + !low ? &clk_freq :NULL ); +if (ret) +return 0 ; +return clk_freq *100 ; + + } +else {return (adev)->powerplay.pp_funcs->get_sclk ((adev)->powerplay.pp_handle, (low)); + } }int amdgpu_dpm_get_mclk (struct amdgpu_device *adev,bool low) { -if (is_support_sw_smu (adev)) -return smu_get_mclk (&adev->smu, low); -else +uint32_t clk_freq; +int ret =0 ; +if (is_support_sw_smu (adev)) { + ret =smu_get_dpm_freq_range (&adev->smu,SMU_UCLK , + low ? &clk_freq :NULL , + !low ? &clk_freq :NULL ); +if (ret) +return 0 ; +return clk_freq *100 ; + + } +else {return (adev)->powerplay.pp_funcs->get_mclk ((adev)->powerplay.pp_handle, (low)); + } }int amdgpu_dpm_set_powergating_by_smu (struct amdgpu_device *adev,uint32_t block_type,bool gate)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +28 -6
@@ -135,30 +135,52 @@ int smu_get_dpm_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,if (!min && !max)return -EINVAL ; +switch (clk_type) { +case SMU_UCLK : +if (!smu_feature_is_enabled (smu,SMU_FEATURE_DPM_UCLK_BIT )) { +pr_warn ("uclk dpm is not enabled\n" ); +return 0 ; + } +break ; +case SMU_GFXCLK : +if (!smu_feature_is_enabled (smu,SMU_FEATURE_DPM_GFXCLK_BIT )) { +pr_warn ("gfxclk dpm is not enabled\n" ); +return 0 ; + } +break ; +default : +break ; + } + +mutex_lock (&smu->mutex); clk_id =smu_clk_get_index (smu, clk_type); -if (clk_id <0 ) -return clk_id; +if (clk_id <0 ) { + ret = -EINVAL ; + goto failed; + } param = (clk_id &0xffff ) <<16 ;if (max) { ret =smu_send_smc_msg_with_param (smu, SMU_MSG_GetMaxDpmFreq, param);if (ret) -return ret; + goto failed; ret =smu_read_smc_arg (smu, max);if (ret) -return ret; + goto failed; }if (min) { ret =smu_send_smc_msg_with_param (smu, SMU_MSG_GetMinDpmFreq, param);if (ret) -return ret; + goto failed; ret =smu_read_smc_arg (smu, min);if (ret) -return ret; + goto failed; } +failed: +mutex_unlock (&smu->mutex);return ret; }
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -6
@@ -679,8 +679,6 @@ struct smu_funcsint (*update_od8_settings)(struct smu_context *smu,uint32_t index,uint32_t value); -uint32_t (*get_sclk)(struct smu_context *smu,bool low); -uint32_t (*get_mclk)(struct smu_context *smu,bool low);int (*get_current_rpm)(struct smu_context *smu,uint32_t *speed);uint32_t (*get_fan_control_mode)(struct smu_context *smu);int (*set_fan_control_mode)(struct smu_context *smu,uint32_t mode);
@@ -881,10 +879,6 @@ struct smu_funcs ((smu)->ppt_funcs->dpm_set_uvd_enable ? (smu)->ppt_funcs->dpm_set_uvd_enable((smu), (enable)) : 0)#define smu_dpm_set_vce_enable (smu, enable) \ ((smu)->ppt_funcs->dpm_set_vce_enable ? (smu)->ppt_funcs->dpm_set_vce_enable((smu), (enable)) : 0) -#define smu_get_sclk (smu, low) \ - ((smu)->funcs->get_sclk ? (smu)->funcs->get_sclk((smu), (low)) : 0) -#define smu_get_mclk (smu, low) \ - ((smu)->funcs->get_mclk ? (smu)->funcs->get_mclk((smu), (low)) : 0)#define smu_set_xgmi_pstate (smu, pstate) \ ((smu)->funcs->set_xgmi_pstate ? (smu)->funcs->set_xgmi_pstate((smu), (pstate)) : 0)#define smu_set_ppfeature_status (smu, ppfeatures) \
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -85
97 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 276/459 drm/amd/powerplay: allow dc request uclk change
In reply to a message not in the archiveFrom: hersen wu <[email protected]>
when dc set mode or color format in frame buffer change, it may request clock changes, like dispclk, dcfclk, uclk. after smu get clock requests, smu will make decision.
--- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +7 -1
@@ -1275,7 +1275,8 @@ smu_v11_0_display_clock_voltage_request(struct smu_context *smu,if (!smu->pm_enabled)return -EINVAL ; -if (smu_feature_is_enabled (smu,SMU_FEATURE_DPM_DCEFCLK_BIT )) { +if (smu_feature_is_enabled (smu,SMU_FEATURE_DPM_DCEFCLK_BIT ) || +smu_feature_is_enabled (smu,SMU_FEATURE_DPM_UCLK_BIT )) {switch (clk_type) {case amd_pp_dcef_clock: clk_select =SMU_DCEFCLK ;
@@ -1289,6 +1290,9 @@ smu_v11_0_display_clock_voltage_request(struct smu_context *smu,case amd_pp_phy_clock: clk_select =SMU_PHYCLK ;break ; +case amd_pp_mem_clock: + clk_select =SMU_UCLK ; +break ;default :pr_info ("[%s] Invalid Clock Type!" , __func__); ret = -EINVAL ;
@@ -1298,8 +1302,10 @@ smu_v11_0_display_clock_voltage_request(struct smu_context *smu,if (ret) goto failed; +mutex_lock (&smu->mutex); ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetHardMinByFreq, (smu_clk_get_index (smu, clk_select) <<16 ) | clk_freq); +mutex_unlock (&smu->mutex); } failed:
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 277/459 drm/amd/powerplay: notify smu with active display count
In reply to a message not in the archiveFrom: hersen wu <[email protected]>
when dc update clocks via smu, smu needs to know how many displays active. this interface is for dc notify number of active displays to smu.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 13 ++++++++++++- drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 8 +++++--- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 6 +++--- 3 files changed, 20 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +12 -1
@@ -802,7 +802,7 @@ static int smu_smc_table_hw_init(struct smu_context *smu,return 0 ; } - ret =smu_init_display (smu); + ret =smu_init_display_count (smu,0 );if (ret)return ret;
@@ -1470,6 +1470,17 @@ int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_levreturn ret; } +int smu_set_display_count (struct smu_context *smu,uint32_t count) +{ +int ret =0 ; + +mutex_lock (&smu->mutex); + ret =smu_init_display_count (smu, count); +mutex_unlock (&smu->mutex); + +return ret; +} +const struct amd_ip_funcs smu_ip_funcs = { .name ="smu" , .early_init = smu_early_init,
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +5 -3
@@ -638,7 +638,7 @@ struct smu_funcsint (*send_smc_msg)(struct smu_context *smu,uint16_t msg);int (*send_smc_msg_with_param)(struct smu_context *smu,uint16_t msg,uint32_t param);int (*read_smc_arg)(struct smu_context *smu,uint32_t *arg); -int (*init_display)(struct smu_context *smu); +int (*init_display_count)(struct smu_context *smu,uint32_t count);int (*set_allowed_mask)(struct smu_context *smu);int (*get_enabled_mask)(struct smu_context *smu,uint32_t *feature_mask,uint32_t num);int (*update_feature_enable_state)(struct smu_context *smu,uint32_t feature_id,bool enabled);
@@ -752,8 +752,8 @@ struct smu_funcs ((smu)->funcs->read_smc_arg? (smu)->funcs->read_smc_arg((smu), (arg)) : 0)#define smu_alloc_dpm_context (smu) \ ((smu)->ppt_funcs->alloc_dpm_context ? (smu)->ppt_funcs->alloc_dpm_context((smu)) : 0) -#define smu_init_display (smu) \ - ((smu)->funcs->init_display ? (smu)->funcs->init_display((smu)) : 0) +#define smu_init_display_count (smu, count) \ + ((smu)->funcs->init_display_count ? (smu)->funcs->init_display_count((smu), (count)) : 0)#define smu_feature_set_allowed_mask (smu) \ ((smu)->funcs->set_allowed_mask? (smu)->funcs->set_allowed_mask((smu)) : 0)#define smu_feature_get_enabled_mask (smu, mask, num) \
@@ -947,4 +947,6 @@ int smu_set_hard_freq_range(struct smu_context *smu, enum smu_clk_type clk_type, uint32_t min, uint32_t max);enum amd_dpm_forced_level smu_get_performance_level (struct smu_context *smu);int smu_force_performance_level (struct smu_context *smu,enum amd_dpm_forced_level level); +int smu_set_display_count (struct smu_context *smu,uint32_t count); +#endif
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +3 -3
@@ -765,13 +765,13 @@ static int smu_v11_0_set_tool_table_location(struct smu_context *smu)return ret; } -static int smu_v11_0_init_display (struct smu_context *smu) +static int smu_v11_0_init_display_count (struct smu_context *smu,uint32_t count) {int ret =0 ;if (!smu->pm_enabled)return ret; - ret =smu_send_smc_msg_with_param (smu, SMU_MSG_NumOfDisplays,0 ); + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_NumOfDisplays, count);return ret; }
@@ -1685,7 +1685,7 @@ static const struct smu_funcs smu_v11_0_funcs = { .write_watermarks_table = smu_v11_0_write_watermarks_table, .set_min_dcef_deep_sleep = smu_v11_0_set_min_dcef_deep_sleep, .set_tool_table_location = smu_v11_0_set_tool_table_location, - .init_display = smu_v11_0_init_display, + .init_display_count = smu_v11_0_init_display_count, .set_allowed_mask = smu_v11_0_set_allowed_mask, .get_enabled_mask = smu_v11_0_get_enabled_mask, .system_features_control = smu_v11_0_system_features_control,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 278/459 drm/amd/powerplay: wake up azalia from d3 by sending smu message
In reply to a message not in the archiveFrom: hersen wu <[email protected]>
this is hw workaround to wake up azalia from d3. display asic and azalia are two different pci devices. while display asic wake from d3, current hw does not send signal to azalia.
workaround: display driver ask smu send message to azalia device to let azalia wake up.
Defintion of SMU message, like PPSMC_MSG_BacroAudioD3PME, is per asic. It is shared by different OS.
--- drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 4 ++++ drivers/gpu/drm/amd/powerplay/inc/smu_v11_0_ppsmc.h | 3 ++- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 1 + drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 12 ++++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +4 -0
@@ -239,6 +239,7 @@ enum smu_message_type SMU_MSG_PowerDownVcn, SMU_MSG_PowerUpJpeg, SMU_MSG_PowerDownJpeg, + SMU_MSG_BacoAudioD3PME, SMU_MSG_MAX_COUNT, };
@@ -687,6 +688,7 @@ struct smu_funcsint (*set_xgmi_pstate)(struct smu_context *smu,uint32_t pstate);int (*gfx_off_control)(struct smu_context *smu,bool enable);int (*register_irq_handler)(struct smu_context *smu); +int (*set_azalia_d3_pme)(struct smu_context *smu); };#define smu_init_microcode (smu) \
@@ -893,6 +895,8 @@ struct smu_funcs ((smu)->ppt_funcs->get_thermal_temperature_range? (smu)->ppt_funcs->get_thermal_temperature_range((smu), (range)) : 0)#define smu_register_irq_handler (smu) \ ((smu)->funcs->register_irq_handler ? (smu)->funcs->register_irq_handler(smu) : 0) +#define smu_set_azalia_d3_pme (smu) \ + ((smu)->funcs->set_azalia_d3_pme ? (smu)->funcs->set_azalia_d3_pme((smu)) : 0) extern int smu_get_atom_data_table(struct smu_context *smu, uint32_t table, uint16_t *size, uint8_t *frev, uint8_t *crev,
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0_ppsmc.h +2 -1
@@ -118,8 +118,9 @@#define PPSMC_MSG_SetGeminiApertureLow 0x44#define PPSMC_MSG_GetVoltageByDpmOverdrive 0x45 +#define PPSMC_MSG_BacoAudioD3PME 0x48 -#define PPSMC_Message_Count 0x47 +#define PPSMC_Message_Count 0x49typedef uint32_t PPSMC_Result ;typedef uint32_t PPSMC_Msg ;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -0
@@ -114,6 +114,7 @@ static int navi10_message_map[SMU_MSG_MAX_COUNT] = {MSG_MAP (PowerDownVcn, PPSMC_MSG_PowerDownVcn),MSG_MAP (PowerUpJpeg, PPSMC_MSG_PowerUpJpeg),MSG_MAP (PowerDownJpeg, PPSMC_MSG_PowerDownJpeg), + MSG_MAP(BacoAudioD3PME, PPSMC_MSG_BacoAudioD3PME), }; static int navi10_clk_map[SMU_CLK_COUNT] = {
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +12 -0
@@ -1662,6 +1662,17 @@ static int smu_v11_0_register_irq_handler(struct smu_context *smu)return ret; } +static int smu_v11_0_set_azalia_d3_pme (struct smu_context *smu) +{ +int ret =0 ; + +mutex_lock (&smu->mutex); + ret =smu_send_smc_msg (smu, SMU_MSG_BacoAudioD3PME); +mutex_unlock (&smu->mutex); + +return ret; +} +static const struct smu_funcs smu_v11_0_funcs = { .init_microcode = smu_v11_0_init_microcode, .load_microcode = smu_v11_0_load_microcode,
@@ -1710,6 +1721,7 @@ static const struct smu_funcs smu_v11_0_funcs = { .set_xgmi_pstate = smu_v11_0_set_xgmi_pstate, .gfx_off_control = smu_v11_0_gfx_off_control, .register_irq_handler = smu_v11_0_register_irq_handler, + .set_azalia_d3_pme = smu_v11_0_set_azalia_d3_pme, };void smu_v11_0_set_smu_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 279/459 drm/amd/powerplay: add interface to get uclk dpm table
In reply to a message not in the archiveFrom: hersen wu <[email protected]>
dc needs get uclk dpm table for bandwidth calculation
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 3 ++ drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -0
@@ -611,6 +611,7 @@ struct pptable_funcs {enum smu_clk_type clk_type, uint32_t *value);int (*get_thermal_temperature_range)(struct smu_context *smu,struct smu_temperature_range *range); +int (*get_uclk_dpm_states)(struct smu_context *smu,uint32_t *clocks_in_khz,uint32_t *num_states); };struct smu_funcs
@@ -897,6 +898,8 @@ struct smu_funcs ((smu)->funcs->register_irq_handler ? (smu)->funcs->register_irq_handler(smu) : 0)#define smu_set_azalia_d3_pme (smu) \ ((smu)->funcs->set_azalia_d3_pme ? (smu)->funcs->set_azalia_d3_pme((smu)) : 0) +#define smu_get_uclk_dpm_states (smu, clocks_in_khz, num_states) \ + ((smu)->ppt_funcs->get_uclk_dpm_states ? (smu)->ppt_funcs->get_uclk_dpm_states((smu), (clocks_in_khz), (num_states)) : 0) extern int smu_get_atom_data_table(struct smu_context *smu, uint32_t table, uint16_t *size, uint8_t *frev, uint8_t *crev,
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +30 -0
@@ -1248,6 +1248,35 @@ static int navi10_read_sensor(struct smu_context *smu,return ret; } +static int navi10_get_uclk_dpm_states (struct smu_context *smu,uint32_t *clocks_in_khz,uint32_t *num_states) +{ +uint32_t num_discrete_levels =0 ; +uint16_t *dpm_levels =NULL ; +uint16_t i =0 ; +struct smu_table_context *table_context = &smu->smu_table; +PPTable_t *driver_ppt =NULL ; + +if (!clocks_in_khz || ! num_states || !table_context->driver_pptable) +return -EINVAL ; + + driver_ppt = table_context->driver_pptable; + num_discrete_levels = driver_ppt->DpmDescriptor[PPCLK_UCLK ].NumDiscreteLevels; + dpm_levels = driver_ppt->FreqTableUclk; + +if (num_discrete_levels ==0 || dpm_levels ==NULL ) +return -EINVAL ; + + *num_states = num_discrete_levels; +for (i =0 ; i < num_discrete_levels; i++) { +/* convert to khz */ + *clocks_in_khz = (*dpm_levels) *1000 ; + clocks_in_khz++; + dpm_levels++; + } + +return 0 ; +} +static const struct pptable_funcs navi10_ppt_funcs = { .tables_init = navi10_tables_init, .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -1281,6 +1310,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_profiling_clk_mask = navi10_get_profiling_clk_mask, .set_watermarks_table = navi10_set_watermarks_table, .read_sensor = navi10_read_sensor, + .get_uclk_dpm_states = navi10_get_uclk_dpm_states, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 280/459 drm/amdgpu/powerplay: add license to smu11 header
In reply to a message not in the archive--- .../powerplay/inc/smu11_driver_if_navi10.h | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if_navi10.h +22 -0
@@ -1,3 +1,25 @@ +/* +* Copyright 2019 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ #ifndef __SMU11_DRIVER_IF_NAVI10_H__#define __SMU11_DRIVER_IF_NAVI10_H__
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 281/459 drm/amdgpu/gfx10: update gfx golden settings
In reply to a message not in the archiveFrom: tiancyin <[email protected]>
add new registers: mmPA_SC_ENHANCE_1, mmTCP_CNTL,
update registers: mmDB_DEBUG4, mmUTCL1_CTRL
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -2
@@ -78,7 +78,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_1[] =SOC15_REG_GOLDEN_VALUE (GC ,0 , mmDB_DEBUG,0x20000000 ,0x20000000 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmDB_DEBUG2,0xffffffff ,0x00000420 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmDB_DEBUG3,0x00000200 ,0x00000200 ), -SOC15_REG_GOLDEN_VALUE (GC ,0 , mmDB_DEBUG4,0x07800000 ,0x04800000 ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , mmDB_DEBUG4,0x07900000 ,0x04900000 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmDB_DFSM_TILES_IN_FLIGHT,0x0000ffff ,0x0000003f ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmDB_LAST_OF_BURST_CONFIG,0xffffffff ,0x03860204 ), SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCR_GENERAL_CNTL, 0x1ff0ffff, 0x00000500),
@@ -92,14 +92,16 @@ static const struct soc15_reg_golden golden_settings_gc_10_1[] =SOC15_REG_GOLDEN_VALUE (GC ,0 , mmGL2C_CTRL2,0xffffffff ,0x1402002f ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmGL2C_CTRL3,0xffff9fff ,0x00001188 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmPA_SC_ENHANCE,0x3fffffff ,0x08000009 ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , mmPA_SC_ENHANCE_1,0x00400000 ,0x04440000 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmPA_SC_LINE_STIPPLE_STATE,0x0000ff0f ,0x00000000 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmRMI_SPARE,0xffffffff ,0xffff3101 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmSQ_ALU_CLK_CTRL,0xffffffff ,0xffffffff ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmSQ_ARB_CONFIG,0x00000100 ,0x00000130 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmSQ_LDS_CLK_CTRL,0xffffffff ,0xffffffff ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmTA_CNTL_AUX,0xfff7ffff ,0x01030000 ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , mmTCP_CNTL,0x60000010 ,0x479c0010 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmUTCL1_CGTT_CLK_CTRL,0x40000ff0 ,0x40000100 ), -SOC15_REG_GOLDEN_VALUE (GC ,0 , mmUTCL1_CTRL,0xffffffff ,0x00000000 ) +SOC15_REG_GOLDEN_VALUE (GC ,0 , mmUTCL1_CTRL,0x00800000 ,0x00800000 ) }; static const struct soc15_reg_golden golden_settings_gc_10_0_nv10[] =
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 282/459 drm/amd: the data retured from PRT is expected to be 0
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
The dummy page for returning from PRT resides inside system memory, need set system flag bit in VM_L2_CNTL.
--- drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c | 3 ++- drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c +2 -1
@@ -135,7 +135,8 @@ static void gfxhub_v2_0_init_cache_regs(struct amdgpu_device *adev) tmp =RREG32_SOC15 (GC ,0 , mmGCVM_L2_CNTL); tmp =REG_SET_FIELD (tmp,GCVM_L2_CNTL ,ENABLE_L2_CACHE ,1 ); tmp =REG_SET_FIELD (tmp,GCVM_L2_CNTL ,ENABLE_L2_FRAGMENT_PROCESSING ,0 ); - + tmp =REG_SET_FIELD (tmp,GCVM_L2_CNTL , +ENABLE_DEFAULT_PAGE_OUT_TO_SYSTEM_MEMORY ,1 );/* XXX for emulation, Refer to closed source code.*/ tmp =REG_SET_FIELD (tmp,GCVM_L2_CNTL ,L2_PDE0_CACHE_TAG_GENERATION_MODE ,0 );
drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c +2 -0
@@ -121,6 +121,8 @@ static void mmhub_v2_0_init_cache_regs(struct amdgpu_device *adev) tmp =RREG32_SOC15 (MMHUB ,0 , mmMMVM_L2_CNTL); tmp =REG_SET_FIELD (tmp,MMVM_L2_CNTL ,ENABLE_L2_CACHE ,1 ); tmp =REG_SET_FIELD (tmp,MMVM_L2_CNTL ,ENABLE_L2_FRAGMENT_PROCESSING ,0 ); + tmp =REG_SET_FIELD (tmp,MMVM_L2_CNTL , +ENABLE_DEFAULT_PAGE_OUT_TO_SYSTEM_MEMORY ,1 );/* XXX for emulation, Refer to closed source code.*/ tmp =REG_SET_FIELD (tmp,MMVM_L2_CNTL ,L2_PDE0_CACHE_TAG_GENERATION_MODE ,0 );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 283/459 drm/amd/powerplay: fix deadlock issue for smu_force_performance_level
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
the smu->mutex is internal lock resource in sw-smu, some functions will use it at the same time, so it maybe will cause deadlock issue. this patch fix this issue in smu_force_performance_level function.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 --------- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 5 ++++- 2 files changed, 4 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -9
@@ -370,18 +370,9 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev, }if (is_support_sw_smu (adev)) { -mutex_lock (&adev->pm.mutex); -if (adev->pm.dpm.thermal_active) { - count = -EINVAL ; -mutex_unlock (&adev->pm.mutex); - goto fail; - } ret =smu_force_performance_level (&adev->smu, level);if (ret) count = -EINVAL ; -else - adev->pm.dpm.forced_level = level; -mutex_unlock (&adev->pm.mutex); }else if (adev->powerplay.pp_funcs->force_performance_level) {mutex_lock (&adev->pm.mutex);if (adev->pm.dpm.thermal_active) {
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -1
@@ -1459,12 +1459,15 @@ int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_levbreak ; } -mutex_lock (&smu->mutex); smu->adev->ip_blocks[i].version->funcs->enable_umd_pstate (smu, &level); ret =smu_handle_task (smu, level,AMD_PP_TASK_READJUST_POWER_STATE ); +if (ret) +return ret; +mutex_lock (&smu->mutex); + smu_dpm_ctx->dpm_level = level;mutex_unlock (&smu->mutex);return ret;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 284/459 drm/amd/powerplay: fix clk type name error OD_SCLK OD_MCLK
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
use sw-smu clk type name to replace legacy clk type name
--- drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 4 ++-- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -2
@@ -564,9 +564,9 @@ struct pptable_funcs {int (*update_specified_od8_value)(struct smu_context *smu,uint32_t index,uint32_t value); -int (*get_od_percentage)(struct smu_context *smu,enum pp_clock_type type); +int (*get_od_percentage)(struct smu_context *smu,enum smu_clk_type clk_type);int (*set_od_percentage)(struct smu_context *smu, -enum pp_clock_type type, +enum smu_clk_type clk_type,uint32_t value); int (*od_edit_dpm_table)(struct smu_context *smu, enum PP_OD_DPM_TABLE_COMMAND type,
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +8 -8
@@ -1690,7 +1690,7 @@ static int vega20_get_metrics_table(struct smu_context *smu,return ret; }static int vega20_get_od_percentage (struct smu_context *smu, -enum pp_clock_type type) +enum smu_clk_type clk_type) {struct smu_dpm_context *smu_dpm = &smu->smu_dpm;struct vega20_dpm_table *dpm_table =NULL ;
@@ -1702,12 +1702,12 @@ static int vega20_get_od_percentage(struct smu_context *smu, dpm_table = smu_dpm->dpm_context; golden_table = smu_dpm->golden_dpm_context; -switch (type) { -case OD_SCLK : +switch (clk_type) { +case SMU_OD_SCLK : single_dpm_table = &(dpm_table->gfx_table); golden_dpm_table = &(golden_table->gfx_table);break ; -case OD_MCLK : +case SMU_OD_MCLK : single_dpm_table = &(dpm_table->mem_table); golden_dpm_table = &(golden_table->mem_table);break ;
@@ -2447,7 +2447,7 @@ static int vega20_update_specified_od8_value(struct smu_context *smu, }static int vega20_set_od_percentage (struct smu_context *smu, -enum pp_clock_type type, +enum smu_clk_type clk_type,uint32_t value) {struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
@@ -2465,15 +2465,15 @@ static int vega20_set_od_percentage(struct smu_context *smu, dpm_table = smu_dpm->dpm_context; golden_table = smu_dpm->golden_dpm_context; -switch (type) { -case OD_SCLK : +switch (clk_type) { +case SMU_OD_SCLK : single_dpm_table = &(dpm_table->gfx_table); golden_dpm_table = &(golden_table->gfx_table); feature_enabled =smu_feature_is_enabled (smu,SMU_FEATURE_DPM_GFXCLK_BIT ); clk_id =PPCLK_GFXCLK ; index =OD8_SETTING_GFXCLK_FMAX ;break ; -case OD_MCLK : +case SMU_OD_MCLK : single_dpm_table = &(dpm_table->mem_table); golden_dpm_table = &(golden_table->mem_table); feature_enabled =smu_feature_is_enabled (smu,SMU_FEATURE_DPM_UCLK_BIT );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 285/459 drm/amd/powerplay: move od8_setting helper function to vega20_ppt
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
these callback functions is only used for vega20 asic, to be compatible other asics,need to move this code to vega20_ppt file
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 10 ------ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 27 ---------------- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 31 +++++++++++++++++-- 3 files changed, 29 insertions(+), 39 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -10
@@ -561,9 +561,6 @@ struct pptable_funcs {int (*print_clk_levels)(struct smu_context *smu,enum smu_clk_type clk_type,char *buf);int (*force_clk_levels)(struct smu_context *smu,enum smu_clk_type clk_type,uint32_t mask);int (*set_default_od8_settings)(struct smu_context *smu); -int (*update_specified_od8_value)(struct smu_context *smu, -uint32_t index, -uint32_t value);int (*get_od_percentage)(struct smu_context *smu,enum smu_clk_type clk_type); int (*set_od_percentage)(struct smu_context *smu, enum smu_clk_type clk_type,
@@ -678,9 +675,6 @@ struct smu_funcsint (*set_od8_default_settings)(struct smu_context *smu,bool initialize);int (*conv_power_profile_to_pplib_workload)(int power_profile); -int (*update_od8_settings)(struct smu_context *smu, -uint32_t index, -uint32_t value);int (*get_current_rpm)(struct smu_context *smu,uint32_t *speed);uint32_t (*get_fan_control_mode)(struct smu_context *smu);int (*set_fan_control_mode)(struct smu_context *smu,uint32_t mode);
@@ -741,8 +735,6 @@ struct smu_funcs ((smu)->funcs->init_max_sustainable_clocks ? (smu)->funcs->init_max_sustainable_clocks((smu)) : 0)#define smu_set_od8_default_settings (smu, initialize) \ ((smu)->funcs->set_od8_default_settings ? (smu)->funcs->set_od8_default_settings((smu), (initialize)) : 0) -#define smu_update_od8_settings (smu, index, value) \ - ((smu)->funcs->update_od8_settings ? (smu)->funcs->update_od8_settings((smu), (index), (value)) : 0)#define smu_get_current_rpm (smu, speed) \ ((smu)->funcs->get_current_rpm ? (smu)->funcs->get_current_rpm((smu), (speed)) : 0)#define smu_set_fan_speed_rpm (smu, speed) \
@@ -779,8 +771,6 @@ struct smu_funcs ((smu)->ppt_funcs->populate_umd_state_clk ? (smu)->ppt_funcs->populate_umd_state_clk((smu)) : 0)#define smu_set_default_od8_settings (smu) \ ((smu)->ppt_funcs->set_default_od8_settings ? (smu)->ppt_funcs->set_default_od8_settings((smu)) : 0) -#define smu_update_specified_od8_value (smu, index, value) \ - ((smu)->ppt_funcs->update_specified_od8_value ? (smu)->ppt_funcs->update_specified_od8_value((smu), (index), (value)) : 0)#define smu_get_power_limit (smu, limit, def) \ ((smu)->funcs->get_power_limit ? (smu)->funcs->get_power_limit((smu), (limit), (def)) : 0)#define smu_set_power_limit (smu, limit) \
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -27
@@ -1400,32 +1400,6 @@ static int smu_v11_0_set_od8_default_settings(struct smu_context *smu,return 0 ; } -static int smu_v11_0_update_od8_settings (struct smu_context *smu, -uint32_t index, -uint32_t value) -{ -struct smu_table_context *table_context = &smu->smu_table; -int ret; - - ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE , - table_context->overdrive_table, false); -if (ret) { -pr_err ("Failed to export over drive table!\n" ); -return ret; - } - -smu_update_specified_od8_value (smu, index, value); - - ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE , - table_context->overdrive_table, true); -if (ret) { -pr_err ("Failed to import over drive table!\n" ); -return ret; - } - -return 0 ; -} -static int smu_v11_0_get_current_rpm (struct smu_context *smu,uint32_t *current_rpm) {
@@ -1712,7 +1686,6 @@ static const struct smu_funcs smu_v11_0_funcs = { .display_clock_voltage_request = smu_v11_0_display_clock_voltage_request, .set_watermarks_for_clock_ranges = smu_v11_0_set_watermarks_for_clock_ranges, .set_od8_default_settings = smu_v11_0_set_od8_default_settings, - .update_od8_settings = smu_v11_0_update_od8_settings, .get_current_rpm = smu_v11_0_get_current_rpm, .get_fan_control_mode = smu_v11_0_get_fan_control_mode, .set_fan_control_mode = smu_v11_0_set_fan_control_mode,
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +29 -2
@@ -2446,6 +2446,34 @@ static int vega20_update_specified_od8_value(struct smu_context *smu,return 0 ; } +static int vega20_update_od8_settings (struct smu_context *smu, +uint32_t index, +uint32_t value) +{ +struct smu_table_context *table_context = &smu->smu_table; +int ret; + + ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE , + table_context->overdrive_table, false); +if (ret) { +pr_err ("Failed to export over drive table!\n" ); +return ret; + } + + ret =vega20_update_specified_od8_value (smu, index, value); +if (ret) +return ret; + + ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE , + table_context->overdrive_table, true); +if (ret) { +pr_err ("Failed to import over drive table!\n" ); +return ret; + } + +return 0 ; +} +static int vega20_set_od_percentage (struct smu_context *smu,enum smu_clk_type clk_type,uint32_t value)
@@ -2492,7 +2520,7 @@ static int vega20_set_od_percentage(struct smu_context *smu, od_clk /=100 ; od_clk += golden_dpm_table->dpm_levels[golden_dpm_table->count -1 ].value; - ret =smu_update_od8_settings (smu, index, od_clk); + ret =vega20_update_od8_settings (smu, index, od_clk);if (ret) {pr_err ("[Setoverdrive] failed to set od clk!\n" ); goto set_od_failed;
@@ -3204,7 +3232,6 @@ static const struct pptable_funcs vega20_ppt_funcs = { .get_od_percentage = vega20_get_od_percentage, .get_power_profile_mode = vega20_get_power_profile_mode, .set_power_profile_mode = vega20_set_power_profile_mode, - .update_specified_od8_value = vega20_update_specified_od8_value, .set_od_percentage = vega20_set_od_percentage, .od_edit_dpm_table = vega20_odn_edit_dpm_table, .dpm_set_uvd_enable = vega20_dpm_set_uvd_enable,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 286/459 drm/amd/powerplay: move od_default_setting callback to asic file
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
the set default od_setting is asic related function, so move thic code to vega20_ppt file.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 +- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 7 ++- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 44 ------------------- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 40 ++++++++++++++++- 4 files changed, 43 insertions(+), 50 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -1
@@ -901,7 +901,7 @@ static int smu_smc_table_hw_init(struct smu_context *smu,return ret; } - ret =smu_set_od8_default_settings (smu, initialize); + ret =smu_set_default_od_settings (smu, initialize);if (ret)return ret;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -4
@@ -609,6 +609,7 @@ struct pptable_funcs { uint32_t *value);int (*get_thermal_temperature_range)(struct smu_context *smu,struct smu_temperature_range *range);int (*get_uclk_dpm_states)(struct smu_context *smu,uint32_t *clocks_in_khz,uint32_t *num_states); +int (*set_default_od_settings)(struct smu_context *smu,bool initialize); };struct smu_funcs
@@ -672,8 +673,6 @@ struct smu_funcsint (*notify_smu_enable_pwe)(struct smu_context *smu);int (*set_watermarks_for_clock_ranges)(struct smu_context *smu,struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges); -int (*set_od8_default_settings)(struct smu_context *smu, -bool initialize);int (*conv_power_profile_to_pplib_workload)(int power_profile);int (*get_current_rpm)(struct smu_context *smu,uint32_t *speed);uint32_t (*get_fan_control_mode)(struct smu_context *smu);
@@ -733,8 +732,8 @@ struct smu_funcs ((smu)->funcs->system_features_control ? (smu)->funcs->system_features_control((smu), (en)) : 0)#define smu_init_max_sustainable_clocks (smu) \ ((smu)->funcs->init_max_sustainable_clocks ? (smu)->funcs->init_max_sustainable_clocks((smu)) : 0) -#define smu_set_od8_default_settings (smu, initialize) \ - ((smu)->funcs->set_od8_default_settings ? (smu)->funcs->set_od8_default_settings((smu), (initialize)) : 0) +#define smu_set_default_od_settings (smu, initialize) \ + ((smu)->ppt_funcs->set_default_od_settings ? (smu)->ppt_funcs->set_default_od_settings((smu), (initialize)) : 0)#define smu_get_current_rpm (smu, speed) \ ((smu)->funcs->get_current_rpm ? (smu)->funcs->get_current_rpm((smu), (speed)) : 0)#define smu_set_fan_speed_rpm (smu, speed) \
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -44
56 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +39 -1
@@ -1689,6 +1689,44 @@ static int vega20_get_metrics_table(struct smu_context *smu,return ret; } + +static int vega20_set_default_od_settings (struct smu_context *smu, +bool initialize) +{ +struct smu_table_context *table_context = &smu->smu_table; +int ret; + +if (initialize) { +if (table_context->overdrive_table) +return -EINVAL ; + + table_context->overdrive_table =kzalloc (sizeof (OverDriveTable_t),GFP_KERNEL ); + +if (!table_context->overdrive_table) +return -ENOMEM ; + + ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE , + table_context->overdrive_table, false); +if (ret) { +pr_err ("Failed to export over drive table!\n" ); +return ret; + } + + ret =vega20_set_default_od8_setttings (smu); +if (ret) +return ret; + } + + ret =smu_update_table (smu,SMU_TABLE_OVERDRIVE , + table_context->overdrive_table, true); +if (ret) { +pr_err ("Failed to import over drive table!\n" ); +return ret; + } + +return 0 ; +} +static int vega20_get_od_percentage (struct smu_context *smu,enum smu_clk_type clk_type) {
@@ -3228,11 +3266,11 @@ static const struct pptable_funcs vega20_ppt_funcs = { .print_clk_levels = vega20_print_clk_levels, .force_clk_levels = vega20_force_clk_levels, .get_clock_by_type_with_latency = vega20_get_clock_by_type_with_latency, - .set_default_od8_settings = vega20_set_default_od8_setttings, .get_od_percentage = vega20_get_od_percentage, .get_power_profile_mode = vega20_get_power_profile_mode, .set_power_profile_mode = vega20_set_power_profile_mode, .set_od_percentage = vega20_set_od_percentage, + .set_default_od_settings = vega20_set_default_od_settings, .od_edit_dpm_table = vega20_odn_edit_dpm_table, .dpm_set_uvd_enable = vega20_dpm_set_uvd_enable, .dpm_set_vce_enable = vega20_dpm_set_vce_enable,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 287/459 drm/amd/powerplay: simplified od_settings for each asic
In reply to a message not in the archiveFrom: Kevin Wang <[email protected]>
the od_settings is asic related data, so move it to asic file.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 12 -- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 7 +- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 139 +++++++++--------- drivers/gpu/drm/amd/powerplay/vega20_ppt.h | 6 + 4 files changed, 77 insertions(+), 87 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -12
@@ -1058,21 +1058,9 @@ static int smu_hw_fini(void *handle)kfree (table_context->max_sustainable_clocks); table_context->max_sustainable_clocks =NULL ; -kfree (table_context->od_feature_capabilities); - table_context->od_feature_capabilities =NULL ; - -kfree (table_context->od_settings_max); - table_context->od_settings_max =NULL ; - -kfree (table_context->od_settings_min); - table_context->od_settings_min =NULL ; -kfree (table_context->overdrive_table); table_context->overdrive_table =NULL ; -kfree (table_context->od8_settings); - table_context->od8_settings =NULL ; -kfree (smu->irq_source); smu->irq_source =NULL ;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -6
@@ -431,13 +431,7 @@ struct smu_table_contextuint8_t thermal_controller_type;uint16_t TDPODLimit; -uint8_t *od_feature_capabilities; -uint32_t *od_settings_max; -uint32_t *od_settings_min;void *overdrive_table; -void *od8_settings; -bool od_gfxclk_update; -bool od_memclk_update; };struct smu_dpm_context {
@@ -510,6 +504,7 @@ struct smu_contextstruct smu_power_context smu_power;struct smu_feature smu_feature;struct amd_pp_display_configuration *display_config; +void *od_settings;uint32_t pstate_sclk;uint32_t pstate_mclk;
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +70 -69
276 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/vega20_ppt.h +6 -0
@@ -166,6 +166,12 @@ struct vega20_od8_single_setting {struct vega20_od8_settings {struct vega20_od8_single_setting od8_settings_array[OD8_SETTING_COUNT ]; +uint8_t *od_feature_capabilities; +uint32_t *od_settings_max; +uint32_t *od_settings_min; +void *od8_settings; +bool od_gfxclk_update; +bool od_memclk_update; };extern void vega20_set_ppt_funcs (struct smu_context *smu);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 288/459 drm/amdgpu/VCN2.0 remove unused Macro and declaration
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
Just for cleanup
--- drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -2
@@ -45,7 +45,6 @@#define mmUVD_LMI_RBC_IB_64BIT_BAR_HIGH_INTERNAL_OFFSET 0x5a6#define mmUVD_LMI_RBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET 0x5a7#define mmUVD_RBC_IB_SIZE_INTERNAL_OFFSET 0x1e2 -#define mmUVD_GPCOM_SYS_CMD_INTERNAL_OFFSET 0x1bF#define mmUVD_JRBC_EXTERNAL_REG_INTERNAL_OFFSET 0x1bfff#define mmUVD_JPEG_GPCOM_CMD_INTERNAL_OFFSET 0x4029
@@ -67,7 +66,6 @@#define JRBC_DEC_EXTERNAL_REG_WRITE_ADDR 0x18000 -static int vcn_v2_0_stop (struct amdgpu_device *adev);static void vcn_v2_0_set_dec_ring_funcs (struct amdgpu_device *adev);static void vcn_v2_0_set_enc_ring_funcs (struct amdgpu_device *adev);static void vcn_v2_0_set_jpeg_ring_funcs (struct amdgpu_device *adev);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 289/459 drm/amdgpu/VCN2.0: add direct SRAM read and write
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
This will be the basic and used for DPG mode
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +48 -0
@@ -45,6 +45,11 @@#define VCN_ENC_CMD_REG_WRITE 0x0000000b#define VCN_ENC_CMD_REG_WAIT 0x0000000c +#define VCN_VID_SOC_ADDRESS_2_0 0x1fa00 +#define VCN_AON_SOC_ADDRESS_2_0 0x1f800 +#define VCN_VID_IP_ADDRESS_2_0 0x0 +#define VCN_AON_IP_ADDRESS_2_0 0x30000 +#define RREG32_SOC15_DPG_MODE (ip, inst, reg, mask, sram_sel) \ ({ WREG32_SOC15(ip, inst, mmUVD_DPG_LMA_MASK, mask); \ WREG32_SOC15(ip, inst, mmUVD_DPG_LMA_CTL, \
@@ -66,6 +71,49 @@ (sram_sel << UVD_DPG_LMA_CTL__SRAM_SEL__SHIFT)); \ } while (0) +#define SOC15_DPG_MODE_OFFSET_2_0 (ip, inst, reg) \ + ({ \ + uint32_t internal_reg_offset, addr; \ + bool video_range, aon_range; \ + \ + addr = (adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg); \ + addr <<= 2; \ + video_range = ((((0xFFFFF & addr) >= (VCN_VID_SOC_ADDRESS_2_0)) && \ + ((0xFFFFF & addr) < ((VCN_VID_SOC_ADDRESS_2_0 + 0x2600))))); \ + aon_range = ((((0xFFFFF & addr) >= (VCN_AON_SOC_ADDRESS_2_0)) && \ + ((0xFFFFF & addr) < ((VCN_AON_SOC_ADDRESS_2_0 + 0x600))))); \ + if (video_range) \ + internal_reg_offset = ((0xFFFFF & addr) - (VCN_VID_SOC_ADDRESS_2_0) + \ + (VCN_VID_IP_ADDRESS_2_0)); \ + else if (aon_range) \ + internal_reg_offset = ((0xFFFFF & addr) - (VCN_AON_SOC_ADDRESS_2_0) + \ + (VCN_AON_IP_ADDRESS_2_0)); \ + else \ + internal_reg_offset = (0xFFFFF & addr); \ + \ + internal_reg_offset >>= 2; \ + }) + +#define RREG32_SOC15_DPG_MODE_2_0 (offset, mask_en) \ + ({ \ + WREG32_SOC15(VCN, 0, mmUVD_DPG_LMA_CTL, \ + (0x0 << UVD_DPG_LMA_CTL__READ_WRITE__SHIFT | \ + mask_en << UVD_DPG_LMA_CTL__MASK_EN__SHIFT | \ + offset << UVD_DPG_LMA_CTL__READ_WRITE_ADDR__SHIFT)); \ + RREG32_SOC15(VCN, 0, mmUVD_DPG_LMA_DATA); \ + }) + +#define WREG32_SOC15_DPG_MODE_2_0 (offset, value, mask_en, indirect) \ + do { \ + if (!indirect) { \ + WREG32_SOC15(VCN, 0, mmUVD_DPG_LMA_DATA, value); \ + WREG32_SOC15(VCN, 0, mmUVD_DPG_LMA_CTL, \ + (0x1 << UVD_DPG_LMA_CTL__READ_WRITE__SHIFT | \ + mask_en << UVD_DPG_LMA_CTL__MASK_EN__SHIFT | \ + offset << UVD_DPG_LMA_CTL__READ_WRITE_ADDR__SHIFT)); \ + } \ + } while (0) +enum engine_status_constants {UVD_PGFSM_STATUS__UVDM_UVDU_PWR_ON =0x2AAAA0 ,UVD_PGFSM_STATUS__UVDM_UVDU_PWR_ON_2_0 =0xAAAA0 ,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 290/459 drm/amdgpu/VCN2.0: add DPG mode start and stop (v2)
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
This is for using SRAM directly
v2: rebase (Alex)
--- drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 299 +++++++++++++++++++++++++- 1 file changed, 296 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +296 -3
@@ -66,6 +66,11 @@#define JRBC_DEC_EXTERNAL_REG_WRITE_ADDR 0x18000 +#define mmUVD_RBC_XX_IB_REG_CHECK 0x026b +#define mmUVD_RBC_XX_IB_REG_CHECK_BASE_IDX 1 +#define mmUVD_REG_XX_MASK 0x026c +#define mmUVD_REG_XX_MASK_BASE_IDX 1 +static void vcn_v2_0_set_dec_ring_funcs (struct amdgpu_device *adev);static void vcn_v2_0_set_enc_ring_funcs (struct amdgpu_device *adev);static void vcn_v2_0_set_jpeg_ring_funcs (struct amdgpu_device *adev);
@@ -257,7 +262,8 @@ static int vcn_v2_0_hw_init(void *handle) done:if (!r) -DRM_INFO ("VCN decode and encode initialized successfully.\n" ); +DRM_INFO ("VCN decode and encode initialized successfully(under %s).\n" , + (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )?"DPG Mode" :"SPG Mode" );return r; }
@@ -275,8 +281,9 @@ static int vcn_v2_0_hw_fini(void *handle)struct amdgpu_ring *ring = &adev->vcn.ring_dec;int i; -if (adev->vcn.cur_state !=AMD_PG_STATE_GATE && -RREG32_SOC15 (VCN ,0 , mmUVD_STATUS)) +if ((adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG ) || + (adev->vcn.cur_state !=AMD_PG_STATE_GATE && +RREG32_SOC15 (VCN ,0 , mmUVD_STATUS)))vcn_v2_0_set_powergating_state (adev,AMD_PG_STATE_GATE ); ring->sched.ready = false;
@@ -389,6 +396,77 @@ static void vcn_v2_0_mc_resume(struct amdgpu_device *adev)WREG32_SOC15 (UVD ,0 , mmJPEG_DEC_GFX10_ADDR_CONFIG, adev->gfx.config.gb_addr_config); } +static void vcn_v2_0_mc_resume_dpg_mode (struct amdgpu_device *adev,bool indirect) +{ +uint32_t size =AMDGPU_GPU_PAGE_ALIGN (adev->vcn.fw->size +4 ); +uint32_t offset; + +/* cache window 0: fw */ +if (adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) { +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW), + (adev->firmware.ucode[AMDGPU_UCODE_ID_VCN ].tmr_mc_addr_lo),0 , indirect); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH), + (adev->firmware.ucode[AMDGPU_UCODE_ID_VCN ].tmr_mc_addr_hi),0 , indirect); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_VCPU_CACHE_OFFSET0),0 ,0 , indirect); + offset =0 ; + }else { +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW), +lower_32_bits (adev->vcn.gpu_addr),0 , indirect); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH), +upper_32_bits (adev->vcn.gpu_addr),0 , indirect); + offset = size; +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_VCPU_CACHE_OFFSET0), +AMDGPU_UVD_FIRMWARE_OFFSET >>3 ,0 , indirect); + } + +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_VCPU_CACHE_SIZE0), size,0 , indirect); + +/* cache window 1: stack */ +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_LOW), +lower_32_bits (adev->vcn.gpu_addr + offset),0 , indirect); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_HIGH), +upper_32_bits (adev->vcn.gpu_addr + offset),0 , indirect); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_VCPU_CACHE_OFFSET1),0 ,0 , indirect); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_VCPU_CACHE_SIZE1),AMDGPU_VCN_STACK_SIZE ,0 , indirect); + +/* cache window 2: context */ +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_LMI_VCPU_CACHE2_64BIT_BAR_LOW), +lower_32_bits (adev->vcn.gpu_addr + offset +AMDGPU_VCN_STACK_SIZE ),0 , indirect); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_LMI_VCPU_CACHE2_64BIT_BAR_HIGH), +upper_32_bits (adev->vcn.gpu_addr + offset +AMDGPU_VCN_STACK_SIZE ),0 , indirect); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_VCPU_CACHE_OFFSET2),0 ,0 , indirect); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_VCPU_CACHE_SIZE2),AMDGPU_VCN_CONTEXT_SIZE ,0 , indirect); + +/* non-cache window */ +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_LMI_VCPU_NC0_64BIT_BAR_LOW),0 ,0 , indirect); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_LMI_VCPU_NC0_64BIT_BAR_HIGH),0 ,0 , indirect); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_VCPU_NONCACHE_OFFSET0),0 ,0 , indirect); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_VCPU_NONCACHE_SIZE0),0 ,0 , indirect); + +/* VCN global tiling registers */ +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_GFX10_ADDR_CONFIG), adev->gfx.config.gb_addr_config,0 , indirect); +} +/** * vcn_v2_0_disable_clock_gating - disable VCN clock gating *
@@ -499,6 +577,54 @@ static void vcn_v2_0_disable_clock_gating(struct amdgpu_device *adev)WREG32_SOC15 (VCN ,0 , mmUVD_SUVD_CGC_CTRL, data); } +static void vcn_v2_0_clock_gating_dpg_mode (struct amdgpu_device *adev, +uint8_t sram_sel,uint8_t indirect) +{ +uint32_t reg_data =0 ; + +/* enable sw clock gating control */ +if (adev->cg_flags &AMD_CG_SUPPORT_VCN_MGCG ) + reg_data =1 <<UVD_CGC_CTRL__DYN_CLOCK_MODE__SHIFT ; +else + reg_data =0 <<UVD_CGC_CTRL__DYN_CLOCK_MODE__SHIFT ; + reg_data |=1 <<UVD_CGC_CTRL__CLK_GATE_DLY_TIMER__SHIFT ; + reg_data |=4 <<UVD_CGC_CTRL__CLK_OFF_DELAY__SHIFT ; + reg_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__SCPU_MODE_MASK ); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_CGC_CTRL), reg_data, sram_sel, indirect); + +/* turn off clock gating */ +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_CGC_GATE),0 , sram_sel, indirect); + +/* turn on SUVD clock gating */ +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_SUVD_CGC_GATE),1 , sram_sel, indirect); + +/* turn on sw mode in UVD_SUVD_CGC_CTRL */ +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_SUVD_CGC_CTRL),0 , sram_sel, indirect); +} +/** * jpeg_v2_0_start - start JPEG block *
@@ -768,6 +894,124 @@ static void vcn_v2_0_enable_static_power_gating(struct amdgpu_device *adev) } } +static int vcn_v2_0_start_dpg_mode (struct amdgpu_device *adev,bool indirect) +{ +struct amdgpu_ring *ring = &adev->vcn.ring_dec; +uint32_t rb_bufsz, tmp; + +vcn_v2_0_enable_static_power_gating (adev); + +/* enable dynamic power gating mode */ + tmp =RREG32_SOC15 (UVD ,0 , mmUVD_POWER_STATUS); + tmp |=UVD_POWER_STATUS__UVD_PG_MODE_MASK ; + tmp |=UVD_POWER_STATUS__UVD_PG_EN_MASK ; +WREG32_SOC15 (UVD ,0 , mmUVD_POWER_STATUS, tmp); + +/* enable clock gating */ +vcn_v2_0_clock_gating_dpg_mode (adev,0 , indirect); + +/* enable VCPU clock */ + tmp = (0xFF <<UVD_VCPU_CNTL__PRB_TIMEOUT_VAL__SHIFT ); + tmp |=UVD_VCPU_CNTL__CLK_EN_MASK ; + tmp |=UVD_VCPU_CNTL__MIF_WR_LOW_THRESHOLD_BP_MASK ; +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_VCPU_CNTL), tmp,0 , indirect); + +/* disable master interupt */ +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_MASTINT_EN),0 ,0 , indirect); + +/* setup mmUVD_LMI_CTRL */ + tmp = (UVD_LMI_CTRL__WRITE_CLEAN_TIMER_EN_MASK | +UVD_LMI_CTRL__REQ_MODE_MASK | +UVD_LMI_CTRL__CRC_RESET_MASK | +UVD_LMI_CTRL__MASK_MC_URGENT_MASK | +UVD_LMI_CTRL__DATA_COHERENCY_EN_MASK | +UVD_LMI_CTRL__VCPU_DATA_COHERENCY_EN_MASK | + (8 <<UVD_LMI_CTRL__WRITE_CLEAN_TIMER__SHIFT ) | +0x00100000L ); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_LMI_CTRL), tmp,0 , indirect); + +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_MPC_CNTL), +0x2 <<UVD_MPC_CNTL__REPLACEMENT_MODE__SHIFT ,0 , indirect); + +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_MPC_SET_MUXA0), + ((0x1 <<UVD_MPC_SET_MUXA0__VARA_1__SHIFT ) | + (0x2 <<UVD_MPC_SET_MUXA0__VARA_2__SHIFT ) | + (0x3 <<UVD_MPC_SET_MUXA0__VARA_3__SHIFT ) | + (0x4 <<UVD_MPC_SET_MUXA0__VARA_4__SHIFT )),0 , indirect); + +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_MPC_SET_MUXB0), + ((0x1 <<UVD_MPC_SET_MUXB0__VARB_1__SHIFT ) | + (0x2 <<UVD_MPC_SET_MUXB0__VARB_2__SHIFT ) | + (0x3 <<UVD_MPC_SET_MUXB0__VARB_3__SHIFT ) | + (0x4 <<UVD_MPC_SET_MUXB0__VARB_4__SHIFT )),0 , indirect); + +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_MPC_SET_MUX), + ((0x0 <<UVD_MPC_SET_MUX__SET_0__SHIFT ) | + (0x1 <<UVD_MPC_SET_MUX__SET_1__SHIFT ) | + (0x2 <<UVD_MPC_SET_MUX__SET_2__SHIFT )),0 , indirect); + +vcn_v2_0_mc_resume_dpg_mode (adev, indirect); + +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_REG_XX_MASK),0x10 ,0 , indirect); +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_RBC_XX_IB_REG_CHECK),0x3 ,0 , indirect); + +/* release VCPU reset to boot */ +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_SOFT_RESET),0 ,0 , indirect); + +/* enable LMI MC and UMC channels */ +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_LMI_CTRL2), +0x1F <<UVD_LMI_CTRL2__RE_OFLD_MIF_WR_REQ_NUM__SHIFT ,0 , indirect); + +/* enable master interrupt */ +WREG32_SOC15_DPG_MODE_2_0 (SOC15_DPG_MODE_OFFSET_2_0 ( +UVD ,0 , mmUVD_MASTINT_EN), +UVD_MASTINT_EN__VCPU_EN_MASK ,0 , indirect); + +/* force RBC into idle state */ + rb_bufsz =order_base_2 (ring->ring_size); + tmp =REG_SET_FIELD (0 ,UVD_RBC_RB_CNTL ,RB_BUFSZ , rb_bufsz); + tmp =REG_SET_FIELD (tmp,UVD_RBC_RB_CNTL ,RB_BLKSZ ,1 ); + tmp =REG_SET_FIELD (tmp,UVD_RBC_RB_CNTL ,RB_NO_FETCH ,1 ); + tmp =REG_SET_FIELD (tmp,UVD_RBC_RB_CNTL ,RB_NO_UPDATE ,1 ); + tmp =REG_SET_FIELD (tmp,UVD_RBC_RB_CNTL ,RB_RPTR_WR_EN ,1 ); +WREG32_SOC15 (UVD ,0 , mmUVD_RBC_RB_CNTL, tmp); + +/* set the write pointer delay */ +WREG32_SOC15 (UVD ,0 , mmUVD_RBC_RB_WPTR_CNTL,0 ); + +/* set the wb address */ +WREG32_SOC15 (UVD ,0 , mmUVD_RBC_RB_RPTR_ADDR, + (upper_32_bits (ring->gpu_addr) >>2 )); + +/* programm the RB_BASE for ring buffer */ +WREG32_SOC15 (UVD ,0 , mmUVD_LMI_RBC_RB_64BIT_BAR_LOW, +lower_32_bits (ring->gpu_addr)); +WREG32_SOC15 (UVD ,0 , mmUVD_LMI_RBC_RB_64BIT_BAR_HIGH, +upper_32_bits (ring->gpu_addr)); + +/* Initialize the ring buffer's read and write pointers */ +WREG32_SOC15 (UVD ,0 , mmUVD_RBC_RB_RPTR,0 ); + +WREG32_SOC15 (UVD ,0 , mmUVD_SCRATCH2,0 ); + + ring->wptr =RREG32_SOC15 (UVD ,0 , mmUVD_RBC_RB_RPTR); +WREG32_SOC15 (UVD ,0 , mmUVD_RBC_RB_WPTR, +lower_32_bits (ring->wptr)); + +return 0 ; +} +static int vcn_v2_0_start (struct amdgpu_device *adev) {struct amdgpu_ring *ring = &adev->vcn.ring_dec;
@@ -778,6 +1022,13 @@ static int vcn_v2_0_start(struct amdgpu_device *adev)if (adev->pm.dpm_enabled)amdgpu_dpm_enable_uvd (adev, true); +if (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG ) { + r =vcn_v2_0_start_dpg_mode (adev,0 ); +if (r) +return r; + goto jpeg; + } +vcn_v2_0_disable_static_power_gating (adev);/* set uvd status busy */
@@ -928,11 +1179,44 @@ static int vcn_v2_0_start(struct amdgpu_device *adev)WREG32_SOC15 (UVD ,0 , mmUVD_RB_BASE_HI2,upper_32_bits (ring->gpu_addr));WREG32_SOC15 (UVD ,0 , mmUVD_RB_SIZE2, ring->ring_size /4 ); +jpeg: r =jpeg_v2_0_start (adev);return r; } +static int vcn_v2_0_stop_dpg_mode (struct amdgpu_device *adev) +{ +int ret_code =0 ; +uint32_t tmp; + +/* Wait for power status to be 1 */ +SOC15_WAIT_ON_RREG (UVD ,0 , mmUVD_POWER_STATUS,1 , +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK , ret_code); + +/* wait for read ptr to be equal to write ptr */ + tmp =RREG32_SOC15 (UVD ,0 , mmUVD_RB_WPTR); +SOC15_WAIT_ON_RREG (UVD ,0 , mmUVD_RB_RPTR, tmp,0xFFFFFFFF , ret_code); + + tmp =RREG32_SOC15 (UVD ,0 , mmUVD_RB_WPTR2); +SOC15_WAIT_ON_RREG (UVD ,0 , mmUVD_RB_RPTR2, tmp,0xFFFFFFFF , ret_code); + + tmp =RREG32_SOC15 (UVD ,0 , mmUVD_JRBC_RB_WPTR); +SOC15_WAIT_ON_RREG (UVD ,0 , mmUVD_JRBC_RB_RPTR, tmp,0xFFFFFFFF , ret_code); + + tmp =RREG32_SOC15 (UVD ,0 , mmUVD_RBC_RB_WPTR) &0x7FFFFFFF ; +SOC15_WAIT_ON_RREG (UVD ,0 , mmUVD_RBC_RB_RPTR, tmp,0xFFFFFFFF , ret_code); + +SOC15_WAIT_ON_RREG (UVD ,0 , mmUVD_POWER_STATUS,1 , +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK , ret_code); + +/* disable dynamic power gating mode */ +WREG32_P (SOC15_REG_OFFSET (UVD ,0 , mmUVD_POWER_STATUS),0 , + ~UVD_POWER_STATUS__UVD_PG_MODE_MASK ); + +return 0 ; +} +static int vcn_v2_0_stop (struct amdgpu_device *adev) {uint32_t tmp;
@@ -941,6 +1225,14 @@ static int vcn_v2_0_stop(struct amdgpu_device *adev) r =jpeg_v2_0_stop (adev);if (r)return r; + +if (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG ) { + r =vcn_v2_0_stop_dpg_mode (adev); +if (r) +return r; + goto power_off; + } +/* wait for uvd idle */ SOC15_WAIT_ON_RREG (VCN ,0 , mmUVD_STATUS,UVD_STATUS__IDLE ,0x7 , r);if (r)
@@ -990,6 +1282,7 @@ static int vcn_v2_0_stop(struct amdgpu_device *adev)vcn_v2_0_enable_clock_gating (adev);vcn_v2_0_enable_static_power_gating (adev); +power_off:if (adev->pm.dpm_enabled)amdgpu_dpm_enable_uvd (adev, false);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 291/459 drm/amdgpu/VCN2.0: add DPG pause mode
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
Pause the DPG when not doing decode
--- drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 70 +++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +70 -0
@@ -77,6 +77,8 @@ static void vcn_v2_0_set_jpeg_ring_funcs(struct amdgpu_device *adev);static void vcn_v2_0_set_irq_funcs (struct amdgpu_device *adev);static int vcn_v2_0_set_powergating_state (void *handle,enum amd_powergating_state state); +static int vcn_v2_0_pause_dpg_mode (struct amdgpu_device *adev, +struct dpg_pause_state *new_state);/** * vcn_v2_0_early_init - set function pointers
@@ -192,6 +194,8 @@ static int vcn_v2_0_sw_init(void *handle)if (r)return r; + adev->vcn.pause_dpg_mode = vcn_v2_0_pause_dpg_mode; + adev->vcn.internal.jpeg_pitch = mmUVD_JPEG_PITCH_INTERNAL_OFFSET; adev->vcn.external.jpeg_pitch =SOC15_REG_OFFSET (UVD ,0 , mmUVD_JPEG_PITCH);
@@ -1289,6 +1293,68 @@ static int vcn_v2_0_stop(struct amdgpu_device *adev)return 0 ; } +static int vcn_v2_0_pause_dpg_mode (struct amdgpu_device *adev, +struct dpg_pause_state *new_state) +{ +struct amdgpu_ring *ring; +uint32_t reg_data =0 ; +int ret_code; + +/* pause/unpause if state is changed */ +if (adev->vcn.pause_state.fw_based != new_state->fw_based) { +DRM_DEBUG ("dpg pause state changed %d -> %d" , + adev->vcn.pause_state.fw_based, new_state->fw_based); + reg_data =RREG32_SOC15 (UVD ,0 , mmUVD_DPG_PAUSE) & + (~UVD_DPG_PAUSE__NJ_PAUSE_DPG_ACK_MASK ); + +if (new_state->fw_based ==VCN_DPG_STATE__PAUSE ) { + ret_code =0 ; +SOC15_WAIT_ON_RREG (UVD ,0 , mmUVD_POWER_STATUS,0x1 , +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK , ret_code); + +if (!ret_code) { +/* pause DPG */ + reg_data |=UVD_DPG_PAUSE__NJ_PAUSE_DPG_REQ_MASK ; +WREG32_SOC15 (UVD ,0 , mmUVD_DPG_PAUSE, reg_data); + +/* wait for ACK */ +SOC15_WAIT_ON_RREG (UVD ,0 , mmUVD_DPG_PAUSE, +UVD_DPG_PAUSE__NJ_PAUSE_DPG_ACK_MASK , +UVD_DPG_PAUSE__NJ_PAUSE_DPG_ACK_MASK , ret_code); + +/* Restore */ + ring = &adev->vcn.ring_enc[0 ]; +WREG32_SOC15 (UVD ,0 , mmUVD_RB_BASE_LO, ring->gpu_addr); +WREG32_SOC15 (UVD ,0 , mmUVD_RB_BASE_HI,upper_32_bits (ring->gpu_addr)); +WREG32_SOC15 (UVD ,0 , mmUVD_RB_SIZE, ring->ring_size /4 ); +WREG32_SOC15 (UVD ,0 , mmUVD_RB_RPTR,lower_32_bits (ring->wptr)); +WREG32_SOC15 (UVD ,0 , mmUVD_RB_WPTR,lower_32_bits (ring->wptr)); + + ring = &adev->vcn.ring_enc[1 ]; +WREG32_SOC15 (UVD ,0 , mmUVD_RB_BASE_LO2, ring->gpu_addr); +WREG32_SOC15 (UVD ,0 , mmUVD_RB_BASE_HI2,upper_32_bits (ring->gpu_addr)); +WREG32_SOC15 (UVD ,0 , mmUVD_RB_SIZE2, ring->ring_size /4 ); +WREG32_SOC15 (UVD ,0 , mmUVD_RB_RPTR2,lower_32_bits (ring->wptr)); +WREG32_SOC15 (UVD ,0 , mmUVD_RB_WPTR2,lower_32_bits (ring->wptr)); + +WREG32_SOC15 (UVD ,0 , mmUVD_RBC_RB_WPTR, +RREG32_SOC15 (UVD ,0 , mmUVD_SCRATCH2) &0x7FFFFFFF ); + +SOC15_WAIT_ON_RREG (UVD ,0 , mmUVD_POWER_STATUS, +UVD_PGFSM_CONFIG__UVDM_UVDU_PWR_ON , +UVD_POWER_STATUS__UVD_POWER_STATUS_MASK , ret_code); + } + }else { +/* unpause dpg, no need to wait */ + reg_data &= ~UVD_DPG_PAUSE__NJ_PAUSE_DPG_REQ_MASK ; +WREG32_SOC15 (UVD ,0 , mmUVD_DPG_PAUSE, reg_data); + } + adev->vcn.pause_state.fw_based = new_state->fw_based; + } + +return 0 ; +} +static bool vcn_v2_0_is_idle (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1367,6 +1433,10 @@ static void vcn_v2_0_dec_ring_set_wptr(struct amdgpu_ring *ring) {struct amdgpu_device *adev = ring->adev; +if (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG ) +WREG32_SOC15 (UVD ,0 , mmUVD_SCRATCH2, +lower_32_bits (ring->wptr) |0x80000000 ); +if (ring->use_doorbell) { adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr));
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 292/459 drm/amdgpu: enable VCN2.0 DPG mode
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
It will be the default for VCN2.x family
--- drivers/gpu/drm/amd/amdgpu/nv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/nv.c +2 -1
@@ -505,7 +505,8 @@ static int nv_common_early_init(void *handle)AMD_CG_SUPPORT_VCN_MGCG |AMD_CG_SUPPORT_BIF_MGCG |AMD_CG_SUPPORT_BIF_LS ; - adev->pg_flags =AMD_PG_SUPPORT_VCN ; + adev->pg_flags =AMD_PG_SUPPORT_VCN | +AMD_PG_SUPPORT_VCN_DPG ; adev->external_rev_id = adev->rev_id +0x1 ;break ;default :
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 293/459 drm/amdgpu/psp: add new VCN RAM ucode id to psp
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
PSP supports to program vcn sram by ucode loading interface.
--- drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h +2 -0
@@ -233,6 +233,8 @@ enum psp_gfx_fw_type {GFX_FW_TYPE_RLCP_CAM =46 ,/* RLCP CAM NV */ GFX_FW_TYPE_RLC_SPP_CAM_EXT =47 ,/* RLC SPP CAM EXT NV */ GFX_FW_TYPE_RLX6_DRAM_BOOT =48 ,/* RLX6 DRAM BOOT NV */ +GFX_FW_TYPE_VCN0_RAM =49 ,/* VCN_RAM NV */ +GFX_FW_TYPE_VCN1_RAM =50 ,/* VCN_RAM NV */ GFX_FW_TYPE_MAX };
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 294/459 drm/amdgpu: add corresponding vcn ram ucode id
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
Add VCN RAM ucode id in corresponding to psp ucode id.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +2 -0
@@ -271,6 +271,8 @@ enum AMDGPU_UCODE_ID {AMDGPU_UCODE_ID_VCN ,AMDGPU_UCODE_ID_DMCU_ERAM ,AMDGPU_UCODE_ID_DMCU_INTV , +AMDGPU_UCODE_ID_VCN0_RAM , +AMDGPU_UCODE_ID_VCN1_RAM , AMDGPU_UCODE_ID_MAXIMUM, };
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 295/459 drm/amdgpu/psp: convert ucode id to psp ucode id
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
Convert ucode id to the corresponding psp ucode id.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +6 -0
@@ -891,6 +891,12 @@ static int psp_get_fw_type(struct amdgpu_firmware_info *ucode,case AMDGPU_UCODE_ID_DMCU_INTV : *type =GFX_FW_TYPE_DMCU_ISR ;break ; +case AMDGPU_UCODE_ID_VCN0_RAM : + *type =GFX_FW_TYPE_VCN0_RAM ; +break ; +case AMDGPU_UCODE_ID_VCN1_RAM : + *type =GFX_FW_TYPE_VCN1_RAM ; +break ;case AMDGPU_UCODE_ID_MAXIMUM :default :return -EINVAL ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 296/459 drm/amdgpu/psp: add new psp interface for vcn updating sram
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
PSP leverages the existing fw loading function for vcn updating sram.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 13 +++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 3 +++ 2 files changed, 16 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +13 -0
@@ -1214,6 +1214,19 @@ int psp_rlc_autoload_start(struct psp_context *psp)return ret; } +int psp_update_vcn_sram (struct amdgpu_device *adev,int inst_idx, +uint64_t cmd_gpu_addr,int cmd_size) +{ +struct amdgpu_firmware_info ucode = {0 }; + + ucode.ucode_id = inst_idx ?AMDGPU_UCODE_ID_VCN1_RAM : +AMDGPU_UCODE_ID_VCN0_RAM ; + ucode.mc_addr = cmd_gpu_addr; + ucode.ucode_size = cmd_size; + +return psp_execute_np_fw_load (&adev->psp, &ucode); +} +static bool psp_check_fw_loading_status (struct amdgpu_device *adev,enum AMDGPU_UCODE_ID ucode_type) {
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +3 -0
@@ -260,6 +260,9 @@ extern int psp_wait_for(struct psp_context *psp, uint32_t reg_index,extern const struct amdgpu_ip_block_version psp_v10_0_ip_block;int psp_gpu_reset (struct amdgpu_device *adev); +int psp_update_vcn_sram (struct amdgpu_device *adev,int inst_idx, +uint64_t cmd_gpu_addr,int cmd_size); +int psp_xgmi_invoke (struct psp_context *psp,uint32_t ta_cmd_id);int psp_ras_invoke (struct psp_context *psp,uint32_t ta_cmd_id);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx