drm/amdgpu: Add gfx v12_0_0 family id
Subsystems (3)
Alex Deucher
maintainerPATCH 1/31 drm/amdgpu: Add gfx v12_0_0 family id
From: Likun Gao <[email protected]>
Add gfx v12_0_0 family id
--- include/uapi/drm/amdgpu_drm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -1
@@ -1279,7 +1279,7 @@ struct drm_amdgpu_info_gpuvm_fault {#define AMDGPU_FAMILY_GC_10_3_6 149/* GC 10.3.6 */ #define AMDGPU_FAMILY_GC_10_3_7 151/* GC 10.3.7 */ #define AMDGPU_FAMILY_GC_11_5_0 150/* GC 11.5.0 */ -#define AMDGPU_FAMILY_GC_12_0_0 152/* GC 12.0.0 */ +#define AMDGPU_FAMILY_GC_12_0_0 152/* GC 12.0.0 */ #if defined(__cplusplus) }
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 2/31 drm/amdgpu/discovery: Set GC family for GC 12.0 IP
From: Likun Gao <[email protected]>
Set GC family for GC 12.0 IPs.
v2: squash in updates (Alex)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +4 -0
@@ -2503,6 +2503,10 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)case IP_VERSION (11 ,5 ,1 ): adev->family =AMDGPU_FAMILY_GC_11_5_0 ;break ; +case IP_VERSION (12 ,0 ,0 ): +case IP_VERSION (12 ,0 ,1 ): + adev->family =AMDGPU_FAMILY_GC_12_0_0 ; +break ;default :return -EINVAL ; }
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 3/31 drm/amdgpu: add gfx12 clearstate header
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Add gfx12 clearstate register arrays.
--- drivers/gpu/drm/amd/amdgpu/clearstate_gfx12.h | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/clearstate_gfx12.h
drivers/gpu/drm/amd/amdgpu/clearstate_gfx12.h new file +121 -0
@@ -0,0 +1,121 @@ +/* +* Copyright 2023 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 __CLEARSTATE_GFX12_H_ +#define __CLEARSTATE_GFX12_H_ + +static const unsigned int gfx12_SECT_CONTEXT_def_1[] = { +0x00000000 ,//mmSC_MEM_TEMPORAL +0x00000000 ,//mmSC_MEM_SPEC_READ +0x00000000 ,//mmPA_SC_VPORT_0_TL +0x00000000 ,//mmPA_SC_VPORT_0_BR +0x00000000 ,//mmPA_SC_VPORT_1_TL +0x00000000 ,//mmPA_SC_VPORT_1_BR +0x00000000 ,//mmPA_SC_VPORT_2_TL +0x00000000 ,//mmPA_SC_VPORT_2_BR +0x00000000 ,//mmPA_SC_VPORT_3_TL +0x00000000 ,//mmPA_SC_VPORT_3_BR +0x00000000 ,//mmPA_SC_VPORT_4_TL +0x00000000 ,//mmPA_SC_VPORT_4_BR +0x00000000 ,//mmPA_SC_VPORT_5_TL +0x00000000 ,//mmPA_SC_VPORT_5_BR +0x00000000 ,//mmPA_SC_VPORT_6_TL +0x00000000 ,//mmPA_SC_VPORT_6_BR +0x00000000 ,//mmPA_SC_VPORT_7_TL +0x00000000 ,//mmPA_SC_VPORT_7_BR +0x00000000 ,//mmPA_SC_VPORT_8_TL +0x00000000 ,//mmPA_SC_VPORT_8_BR +0x00000000 ,//mmPA_SC_VPORT_9_TL +0x00000000 ,//mmPA_SC_VPORT_9_BR +0x00000000 ,//mmPA_SC_VPORT_10_TL +0x00000000 ,//mmPA_SC_VPORT_10_BR +0x00000000 ,//mmPA_SC_VPORT_11_TL +0x00000000 ,//mmPA_SC_VPORT_11_BR +0x00000000 ,//mmPA_SC_VPORT_12_TL +0x00000000 ,//mmPA_SC_VPORT_12_BR +0x00000000 ,//mmPA_SC_VPORT_13_TL +0x00000000 ,//mmPA_SC_VPORT_13_BR +0x00000000 ,//mmPA_SC_VPORT_14_TL +0x00000000 ,//mmPA_SC_VPORT_14_BR +0x00000000 ,//mmPA_SC_VPORT_15_TL +0x00000000 ,//mmPA_SC_VPORT_15_BR +}; + +static const unsigned int gfx12_SECT_CONTEXT_def_2[] = { +0x00000000 ,//mmPA_CL_PROG_NEAR_CLIP_Z +0x00000000 ,//mmPA_RATE_CNTL +}; + +static const unsigned int gfx12_SECT_CONTEXT_def_3[] = { +0x00000000 ,//mmCP_PERFMON_CNTX_CNTL +}; + +static const unsigned int gfx12_SECT_CONTEXT_def_4[] = { +0x00000000 ,//mmCONTEXT_RESERVED_REG0 +0x00000000 ,//mmCONTEXT_RESERVED_REG1 +0x00000000 ,//mmPA_SC_CLIPRECT_0_EXT +0x00000000 ,//mmPA_SC_CLIPRECT_1_EXT +0x00000000 ,//mmPA_SC_CLIPRECT_2_EXT +0x00000000 ,//mmPA_SC_CLIPRECT_3_EXT +}; + +static const unsigned int gfx12_SECT_CONTEXT_def_5[] = { +0x00000000 ,//mmPA_SC_HIZ_INFO +0x00000000 ,//mmPA_SC_HIS_INFO +0x00000000 ,//mmPA_SC_HIZ_BASE +0x00000000 ,//mmPA_SC_HIZ_BASE_EXT +0x00000000 ,//mmPA_SC_HIZ_SIZE_XY +0x00000000 ,//mmPA_SC_HIS_BASE +0x00000000 ,//mmPA_SC_HIS_BASE_EXT +0x00000000 ,//mmPA_SC_HIS_SIZE_XY +0x00000000 ,//mmPA_SC_BINNER_OUTPUT_TIMEOUT_CNTL +0x00000000 ,//mmPA_SC_BINNER_DYNAMIC_BATCH_LIMIT +0x00000000 ,//mmPA_SC_HISZ_CONTROL +}; + +static const unsigned int gfx12_SECT_CONTEXT_def_6[] = { +0x00000000 ,//mmCB_MEM0_INFO +0x00000000 ,//mmCB_MEM1_INFO +0x00000000 ,//mmCB_MEM2_INFO +0x00000000 ,//mmCB_MEM3_INFO +0x00000000 ,//mmCB_MEM4_INFO +0x00000000 ,//mmCB_MEM5_INFO +0x00000000 ,//mmCB_MEM6_INFO +0x00000000 ,//mmCB_MEM7_INFO +}; + +static const struct cs_extent_def gfx12_SECT_CONTEXT_defs[] = { + {gfx12_SECT_CONTEXT_def_1,0x0000a03e ,34 }, + {gfx12_SECT_CONTEXT_def_2,0x0000a0cc ,2 }, + {gfx12_SECT_CONTEXT_def_3,0x0000a0d8 ,1 }, + {gfx12_SECT_CONTEXT_def_4,0x0000a0db ,6 }, + {gfx12_SECT_CONTEXT_def_5,0x0000a2e5 ,11 }, + {gfx12_SECT_CONTEXT_def_6,0x0000a3c0 ,8 }, + {0 ,0 ,0 } +}; + +static const struct cs_section_def gfx12_cs_data[] = { + { gfx12_SECT_CONTEXT_defs,SECT_CONTEXT }, + {0 ,SECT_NONE } +}; + +#endif /* __CLEARSTATE_GFX12_H_ */
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 4/31 drm/amdgpu: add new TOC structure
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Add new RLC_TABLE_OF_CONTENT structure definition.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h +27 -0
@@ -155,6 +155,33 @@ typedef struct _RLC_TABLE_OF_CONTENT { }; }RLC_TABLE_OF_CONTENT ; +typedef struct _RLC_TABLE_OF_CONTENT_V2 { +union { +unsigned int DW0; +struct { +uint32_t offset :25 ; +uint32_t id :7 ; + }; + }; + +union { +unsigned int DW1; +struct { +uint32_t reserved0 :1 ; +uint32_t reserved1 :1 ; +uint32_t reserved2 :1 ; +uint32_t memory_destination :2 ; +uint32_t vfflr_image_code :4 ; +uint32_t reserved9 :1 ; +uint32_t reserved10 :1 ; +uint32_t reserved11 :1 ; +uint32_t size_x16 :1 ; +uint32_t reserved13 :1 ; +uint32_t size :18 ; + }; + }; +}RLC_TABLE_OF_CONTENT_V2 ; +#define RLC_TOC_MAX_SIZE 64struct amdgpu_rlc_funcs {
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 5/31 drm/amdgpu: add rlc TOC header file for soc24
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Add RLC autoload TOC header file for soc24 ASIC.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h | 47 +++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h +47 -0
@@ -112,6 +112,53 @@ typedef enum _SOC21_FIRMWARE_ID_ { SOC21_FIRMWARE_ID_MAX = 37 }SOC21_FIRMWARE_ID ; +typedef enum _SOC24_FIRMWARE_ID_ { +SOC24_FIRMWARE_ID_INVALID =0 , +SOC24_FIRMWARE_ID_RLC_G_UCODE =1 , +SOC24_FIRMWARE_ID_RLC_TOC =2 , +SOC24_FIRMWARE_ID_RLCG_SCRATCH =3 , +SOC24_FIRMWARE_ID_RLC_SRM_ARAM =4 , +SOC24_FIRMWARE_ID_RLC_P_UCODE =5 , +SOC24_FIRMWARE_ID_RLC_V_UCODE =6 , +SOC24_FIRMWARE_ID_RLX6_UCODE =7 , +SOC24_FIRMWARE_ID_RLX6_UCODE_CORE1 =8 , +SOC24_FIRMWARE_ID_RLX6_DRAM_BOOT =9 , +SOC24_FIRMWARE_ID_RLX6_DRAM_BOOT_CORE1 =10 , +SOC24_FIRMWARE_ID_SDMA_UCODE_TH0 =11 , +SOC24_FIRMWARE_ID_SDMA_UCODE_TH1 =12 , +SOC24_FIRMWARE_ID_CP_PFP =13 , +SOC24_FIRMWARE_ID_CP_ME =14 , +SOC24_FIRMWARE_ID_CP_MEC =15 , +SOC24_FIRMWARE_ID_RS64_MES_P0 =16 , +SOC24_FIRMWARE_ID_RS64_MES_P1 =17 , +SOC24_FIRMWARE_ID_RS64_PFP =18 , +SOC24_FIRMWARE_ID_RS64_ME =19 , +SOC24_FIRMWARE_ID_RS64_MEC =20 , +SOC24_FIRMWARE_ID_RS64_MES_P0_STACK =21 , +SOC24_FIRMWARE_ID_RS64_MES_P1_STACK =22 , +SOC24_FIRMWARE_ID_RS64_PFP_P0_STACK =23 , +SOC24_FIRMWARE_ID_RS64_PFP_P1_STACK =24 , +SOC24_FIRMWARE_ID_RS64_ME_P0_STACK =25 , +SOC24_FIRMWARE_ID_RS64_ME_P1_STACK =26 , +SOC24_FIRMWARE_ID_RS64_MEC_P0_STACK =27 , +SOC24_FIRMWARE_ID_RS64_MEC_P1_STACK =28 , +SOC24_FIRMWARE_ID_RS64_MEC_P2_STACK =29 , +SOC24_FIRMWARE_ID_RS64_MEC_P3_STACK =30 , +SOC24_FIRMWARE_ID_RLC_SRM_DRAM_SR =31 , +SOC24_FIRMWARE_ID_RLCG_SCRATCH_SR =32 , +SOC24_FIRMWARE_ID_RLCP_SCRATCH_SR =33 , +SOC24_FIRMWARE_ID_RLCV_SCRATCH_SR =34 , +SOC24_FIRMWARE_ID_RLX6_DRAM_SR =35 , +SOC24_FIRMWARE_ID_RLX6_DRAM_SR_CORE1 =36 , +SOC24_FIRMWARE_ID_RLCDEBUGLOG =37 , +SOC24_FIRMWARE_ID_SRIOV_DEBUG =38 , +SOC24_FIRMWARE_ID_SRIOV_CSA_RLC =39 , +SOC24_FIRMWARE_ID_SRIOV_CSA_SDMA =40 , +SOC24_FIRMWARE_ID_SRIOV_CSA_CP =41 , +SOC24_FIRMWARE_ID_UMF_ZONE_PAD =42 , +SOC24_FIRMWARE_ID_MAX =43 +}SOC24_FIRMWARE_ID ; + typedef struct _RLC_TABLE_OF_CONTENT { union { unsigned int DW0;
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 6/31 drm/amdgpu: Add mes_v12_api_def.h for gfx12
In reply to Alex DeucherFrom: Harish Kasiviswanathan <[email protected]>
Add MES_v12 header definition for gfx12
v2: Modify SET_SHADER_DEBUGGER to match mes_v11 definition. This doesn't change the structure layout
v3: Removed unncessary comment and spaces
--- drivers/gpu/drm/amd/include/mes_v12_api_def.h | 775 ++++++++++++++++++ 1 file changed, 775 insertions(+) create mode 100644 drivers/gpu/drm/amd/include/mes_v12_api_def.h
drivers/gpu/drm/amd/include/mes_v12_api_def.h new file +775 -0
@@ -0,0 +1,775 @@ +/* +* Copyright 2023 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 __MES_API_DEF_H__ +#define __MES_API_DEF_H__ + +#pragma pack(push, 8) + +#define MES_API_VERSION 0x14 + +/* Driver submits one API(cmd) as a single Frame and this command size is same for all API +* to ease the debugging and parsing of ring buffer. +*/ +enum {API_FRAME_SIZE_IN_DWORDS =64 }; + +/* To avoid command in scheduler context to be overwritten whenenver mutilple interrupts come in, +* this creates another queue +*/ +enum {API_NUMBER_OF_COMMAND_MAX =32 }; + +enum MES_API_TYPE { +MES_API_TYPE_SCHEDULER =1 , +MES_API_TYPE_MAX +}; + +enum MES_SCH_API_OPCODE { +MES_SCH_API_SET_HW_RSRC =0 , +MES_SCH_API_SET_SCHEDULING_CONFIG =1 ,/* agreegated db, quantums, etc */ +MES_SCH_API_ADD_QUEUE =2 , +MES_SCH_API_REMOVE_QUEUE =3 , +MES_SCH_API_PERFORM_YIELD =4 , +MES_SCH_API_SET_GANG_PRIORITY_LEVEL =5 ,/* For windows GANG = Context */ +MES_SCH_API_SUSPEND =6 , +MES_SCH_API_RESUME =7 , +MES_SCH_API_RESET =8 , +MES_SCH_API_SET_LOG_BUFFER =9 , +MES_SCH_API_CHANGE_GANG_PRORITY =10 , +MES_SCH_API_QUERY_SCHEDULER_STATUS =11 , +MES_SCH_API_SET_DEBUG_VMID =13 , +MES_SCH_API_MISC =14 , +MES_SCH_API_UPDATE_ROOT_PAGE_TABLE =15 , +MES_SCH_API_AMD_LOG =16 , +MES_SCH_API_SET_SE_MODE =17 , +MES_SCH_API_SET_GANG_SUBMIT =18 , + +MES_SCH_API_MAX =0xFF +}; + +union MES_API_HEADER { +struct { +uint32_t type :4 ;/* 0 - Invalid; 1 - Scheduling; 2 - TBD */ +uint32_t opcode :8 ; +uint32_t dwsize :8 ;/* including header */ +uint32_t reserved :12 ; + }; + +uint32_t u32All; +}; + +enum MES_AMD_PRIORITY_LEVEL { +AMD_PRIORITY_LEVEL_LOW =0 , +AMD_PRIORITY_LEVEL_NORMAL =1 , +AMD_PRIORITY_LEVEL_MEDIUM =2 , +AMD_PRIORITY_LEVEL_HIGH =3 , +AMD_PRIORITY_LEVEL_REALTIME =4 , + +AMD_PRIORITY_NUM_LEVELS +}; + +enum MES_QUEUE_TYPE { +MES_QUEUE_TYPE_GFX , +MES_QUEUE_TYPE_COMPUTE , +MES_QUEUE_TYPE_SDMA , + +MES_QUEUE_TYPE_MAX , +}; + +struct MES_API_STATUS { +uint64_t api_completion_fence_addr; +uint64_t api_completion_fence_value; +}; + + +enum {MAX_COMPUTE_PIPES =8 }; +enum {MAX_GFX_PIPES =2 }; +enum {MAX_SDMA_PIPES =2 }; + +enum {MAX_COMPUTE_HQD_PER_PIPE =8 }; +enum {MAX_GFX_HQD_PER_PIPE =8 }; +enum {MAX_SDMA_HQD_PER_PIPE =10 }; +enum {MAX_SDMA_HQD_PER_PIPE_11_0 =8 }; + + +enum {MAX_QUEUES_IN_A_GANG =8 }; + +enum VM_HUB_TYPE { +VM_HUB_TYPE_GC =0 , +VM_HUB_TYPE_MM =1 , + +VM_HUB_TYPE_MAX , +}; + +enum {VMID_INVALID =0xffff }; + +enum {MAX_VMID_GCHUB =16 }; +enum {MAX_VMID_MMHUB =16 }; + +enum SET_DEBUG_VMID_OPERATIONS { +DEBUG_VMID_OP_PROGRAM =0 , +DEBUG_VMID_OP_ALLOCATE =1 , +DEBUG_VMID_OP_RELEASE =2 , +DEBUG_VMID_OP_VM_SETUP =3 // used to set up the debug vmid page table in the kernel queue case (mode 1) +}; + +enum MES_MS_LOG_CONTEXT_STATE { +MES_LOG_CONTEXT_STATE_IDLE =0 , +MES_LOG_CONTEXT_STATE_RUNNING =1 , +MES_LOG_CONTEXT_STATE_READY =2 , +MES_LOG_CONTEXT_STATE_READY_STANDBY =3 , +MES_LOG_CONTEXT_STATE_INVALID =0xF , +}; + +enum MES_MS_LOG_OPERATION { +MES_LOG_OPERATION_CONTEXT_STATE_CHANGE =0 , +MES_LOG_OPERATION_QUEUE_NEW_WORK =1 , +MES_LOG_OPERATION_QUEUE_UNWAIT_SYNC_OBJECT =2 , +MES_LOG_OPERATION_QUEUE_NO_MORE_WORK =3 , +MES_LOG_OPERATION_QUEUE_WAIT_SYNC_OBJECT =4 , +MES_LOG_OPERATION_QUEUE_INVALID =0xF , +}; + +struct MES_LOG_CONTEXT_STATE_CHANGE { +uint64_t h_context; +enum MES_MS_LOG_CONTEXT_STATE new_context_state; +}; + +struct MES_LOG_QUEUE_NEW_WORK { +uint64_t h_queue; +uint64_t reserved; +}; + +struct MES_LOG_QUEUE_UNWAIT_SYNC_OBJECT { +uint64_t h_queue; +uint64_t h_sync_object; +}; + +struct MES_LOG_QUEUE_NO_MORE_WORK { +uint64_t h_queue; +uint64_t reserved; +}; + +struct MES_LOG_QUEUE_WAIT_SYNC_OBJECT { +uint64_t h_queue; +uint64_t h_sync_object; +}; + +struct MES_LOG_ENTRY_HEADER { +uint32_t first_free_entry_index; +uint32_t wraparound_count; +uint64_t number_of_entries; +uint64_t reserved[2 ]; +}; + +struct MES_LOG_ENTRY_DATA { +uint64_t gpu_time_stamp; +uint32_t operation_type;/* operation_type is of MES_LOG_OPERATION type */ +uint32_t reserved_operation_type_bits; +union { +struct MES_LOG_CONTEXT_STATE_CHANGE context_state_change; +struct MES_LOG_QUEUE_NEW_WORK queue_new_work; +struct MES_LOG_QUEUE_UNWAIT_SYNC_OBJECT queue_unwait_sync_object; +struct MES_LOG_QUEUE_NO_MORE_WORK queue_no_more_work; +struct MES_LOG_QUEUE_WAIT_SYNC_OBJECT queue_wait_sync_object; +uint64_t all[2 ]; + }; +}; + +struct MES_LOG_BUFFER { +struct MES_LOG_ENTRY_HEADER header; +struct MES_LOG_ENTRY_DATA entries[]; +}; + +enum MES_SWIP_TO_HWIP_DEF { +MES_MAX_HWIP_SEGMENT =8 , +}; + +union MESAPI_SET_HW_RESOURCES { +struct { +union MES_API_HEADER header; +uint32_t vmid_mask_mmhub; +uint32_t vmid_mask_gfxhub; +uint32_t gds_size; +uint32_t paging_vmid; +uint32_t compute_hqd_mask[MAX_COMPUTE_PIPES ]; +uint32_t gfx_hqd_mask[MAX_GFX_PIPES ]; +uint32_t sdma_hqd_mask[MAX_SDMA_PIPES ]; +uint32_t aggregated_doorbells[AMD_PRIORITY_NUM_LEVELS ]; +uint64_t g_sch_ctx_gpu_mc_ptr; +uint64_t query_status_fence_gpu_mc_ptr; +uint32_t gc_base[MES_MAX_HWIP_SEGMENT ]; +uint32_t mmhub_base[MES_MAX_HWIP_SEGMENT ]; +uint32_t osssys_base[MES_MAX_HWIP_SEGMENT ]; +struct MES_API_STATUS api_status; +union { +struct { +uint32_t disable_reset :1 ; +uint32_t use_different_vmid_compute :1 ; +uint32_t disable_mes_log :1 ; +uint32_t apply_mmhub_pgvm_invalidate_ack_loss_wa :1 ; +uint32_t apply_grbm_remote_register_dummy_read_wa :1 ; +uint32_t second_gfx_pipe_enabled :1 ; +uint32_t enable_level_process_quantum_check :1 ; +uint32_t legacy_sch_mode :1 ; +uint32_t disable_add_queue_wptr_mc_addr :1 ; +uint32_t enable_mes_event_int_logging :1 ; +uint32_t enable_reg_active_poll :1 ; +uint32_t use_disable_queue_in_legacy_uq_preemption :1 ; +uint32_t send_write_data :1 ; +uint32_t os_tdr_timeout_override :1 ; +uint32_t use_rs64mem_for_proc_gang_ctx :1 ; +uint32_t reserved :17 ; + }; +uint32_t uint32_all; + }; +uint32_t oversubscription_timer; +uint64_t doorbell_info; +uint64_t event_intr_history_gpu_mc_ptr; +uint64_t timestamp; +uint32_t os_tdr_timeout_in_sec; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +union MESAPI__ADD_QUEUE { +struct { +union MES_API_HEADER header; +uint32_t process_id; +uint64_t page_table_base_addr; +uint64_t process_va_start; +uint64_t process_va_end; +uint64_t process_quantum; +uint64_t process_context_addr; +uint64_t gang_quantum; +uint64_t gang_context_addr; +uint32_t inprocess_gang_priority; +enum MES_AMD_PRIORITY_LEVEL gang_global_priority_level; +uint32_t doorbell_offset; +uint64_t mqd_addr; +/* From MES_API_VERSION 2, mc addr is expected for wptr_addr */ +uint64_t wptr_addr; +uint64_t h_context; +uint64_t h_queue; +enum MES_QUEUE_TYPE queue_type; +uint32_t gds_base; +union { +/* backwards compatibility with Linux, remove union once they use kfd_queue_size */ +uint32_t gds_size; +uint32_t kfd_queue_size; + }; +uint32_t gws_base; +uint32_t gws_size; +uint32_t oa_mask; +uint64_t trap_handler_addr; +uint32_t vm_context_cntl; + +struct { +uint32_t paging :1 ; +uint32_t debug_vmid :4 ; +uint32_t program_gds :1 ; +uint32_t is_gang_suspended :1 ; +uint32_t is_tmz_queue :1 ; +uint32_t map_kiq_utility_queue :1 ; +uint32_t is_kfd_process :1 ; +uint32_t trap_en :1 ; +uint32_t is_aql_queue :1 ; +uint32_t skip_process_ctx_clear :1 ; +uint32_t map_legacy_kq :1 ; +uint32_t exclusively_scheduled :1 ; +uint32_t is_long_running :1 ; +uint32_t is_dwm_queue :1 ; +uint32_t reserved :15 ; + }; +struct MES_API_STATUS api_status; +uint64_t tma_addr; +uint32_t sch_id; +uint64_t timestamp; +uint32_t process_context_array_index; +uint32_t gang_context_array_index; +uint32_t pipe_id;//used for mapping legacy kernel queue +uint32_t queue_id; +uint32_t alignment_mode_setting; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +union MESAPI__REMOVE_QUEUE { +struct { +union MES_API_HEADER header; +uint32_t doorbell_offset; +uint64_t gang_context_addr; + +struct { +uint32_t reserved01 :1 ; +uint32_t unmap_kiq_utility_queue :1 ; +uint32_t preempt_legacy_gfx_queue :1 ; +uint32_t unmap_legacy_queue :1 ; +uint32_t reserved :28 ; + }; +struct MES_API_STATUS api_status; + +uint32_t pipe_id; +uint32_t queue_id; + +uint64_t tf_addr; +uint32_t tf_data; + +enum MES_QUEUE_TYPE queue_type; +uint64_t timestamp; +uint32_t gang_context_array_index; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +union MESAPI__SET_SCHEDULING_CONFIG { +struct { +union MES_API_HEADER header; +/* Grace period when preempting another priority band for this priority band. +* The value for idle priority band is ignored, as it never preempts other bands. +*/ +uint64_t grace_period_other_levels[AMD_PRIORITY_NUM_LEVELS ]; + +/* Default quantum for scheduling across processes within a priority band. */ +uint64_t process_quantum_for_level[AMD_PRIORITY_NUM_LEVELS ]; + +/* Default grace period for processes that preempt each other within a priority band.*/ +uint64_t process_grace_period_same_level[AMD_PRIORITY_NUM_LEVELS ]; + +/* For normal level this field specifies the target GPU percentage in situations when it's starved by the high level. +* Valid values are between 0 and 50, with the default being 10. +*/ +uint32_t normal_yield_percent; + +struct MES_API_STATUS api_status; +uint64_t timestamp; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +union MESAPI__PERFORM_YIELD { +struct { +union MES_API_HEADER header; +uint32_t dummy; +struct MES_API_STATUS api_status; +uint64_t timestamp; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +union MESAPI__CHANGE_GANG_PRIORITY_LEVEL { +struct { +union MES_API_HEADER header; +uint32_t inprocess_gang_priority; +enum MES_AMD_PRIORITY_LEVEL gang_global_priority_level; +uint64_t gang_quantum; +uint64_t gang_context_addr; +struct MES_API_STATUS api_status; +uint32_t doorbell_offset; +uint64_t timestamp; +uint32_t gang_context_array_index; +struct { +uint32_t queue_quantum_scale :2 ; +uint32_t queue_quantum_duration :8 ; +uint32_t apply_quantum_all_processes :1 ; +uint32_t reserved :21 ; + }; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +union MESAPI__SUSPEND { +struct { +union MES_API_HEADER header; +/* false - suspend all gangs; true - specific gang */ +struct { +uint32_t suspend_all_gangs :1 ; +uint32_t reserved :31 ; + }; +/* gang_context_addr is valid only if suspend_all = false */ + +uint64_t gang_context_addr; + +uint64_t suspend_fence_addr; +uint32_t suspend_fence_value; + +struct MES_API_STATUS api_status; + +union { +uint32_t return_value;// to be removed +uint32_t sch_id;//keep the old return_value temporarily for compatibility + }; +uint32_t doorbell_offset; +uint64_t timestamp; +enum MES_QUEUE_TYPE legacy_uq_type; +enum MES_AMD_PRIORITY_LEVEL legacy_uq_priority_level; +uint32_t gang_context_array_index; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +union MESAPI__RESUME { +struct { +union MES_API_HEADER header; +/* false - resume all gangs; true - specified gang */ +struct { +uint32_t resume_all_gangs :1 ; +uint32_t reserved :31 ; + }; +/* valid only if resume_all_gangs = false */ +uint64_t gang_context_addr; + +struct MES_API_STATUS api_status; +uint32_t doorbell_offset; +uint64_t timestamp; +uint32_t gang_context_array_index; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +union MESAPI__RESET { +struct { +union MES_API_HEADER header; + +struct { +/* Only reset the queue given by doorbell_offset (not entire gang) */ +uint32_t reset_queue_only :1 ; +/* Hang detection first then reset any queues that are hung */ +uint32_t hang_detect_then_reset :1 ; +/* Only do hang detection (no reset) */ +uint32_t hang_detect_only :1 ; +/* Reset HP and LP kernel queues not managed by MES */ +uint32_t reset_legacy_gfx :1 ; +/* Fallback to use conneceted queue index when CP_CNTX_STAT method fails (gfx pipe 0) */ +uint32_t use_connected_queue_index :1 ; +/* For gfx pipe 1 */ +uint32_t use_connected_queue_index_p1 :1 ; +uint32_t reserved :26 ; + }; + +uint64_t gang_context_addr; + +/* valid only if reset_queue_only = true */ +uint32_t doorbell_offset; + +/* valid only if hang_detect_then_reset = true */ +uint64_t doorbell_offset_addr; +enum MES_QUEUE_TYPE queue_type; + +/* valid only if reset_legacy_gfx = true */ +uint32_t pipe_id_lp; +uint32_t queue_id_lp; +uint32_t vmid_id_lp; +uint64_t mqd_mc_addr_lp; +uint32_t doorbell_offset_lp; +uint64_t wptr_addr_lp; + +uint32_t pipe_id_hp; +uint32_t queue_id_hp; +uint32_t vmid_id_hp; +uint64_t mqd_mc_addr_hp; +uint32_t doorbell_offset_hp; +uint64_t wptr_addr_hp; + +struct MES_API_STATUS api_status; +uint32_t active_vmids; +uint64_t timestamp; + +uint32_t gang_context_array_index; + +uint32_t connected_queue_index; +uint32_t connected_queue_index_p1; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +union MESAPI__SET_LOGGING_BUFFER { +struct { +union MES_API_HEADER header; +/* There are separate log buffers for each queue type */ +enum MES_QUEUE_TYPE log_type; +/* Log buffer GPU Address */ +uint64_t logging_buffer_addr; +/* number of entries in the log buffer */ +uint32_t number_of_entries; +/* Entry index at which CPU interrupt needs to be signalled */ +uint32_t interrupt_entry; + +struct MES_API_STATUS api_status; +uint64_t timestamp; +uint32_t vmid; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +enum MES_API_QUERY_MES_OPCODE { +MES_API_QUERY_MES__GET_CTX_ARRAY_SIZE , +MES_API_QUERY_MES__CHECK_HEALTHY , +MES_API_QUERY_MES__MAX , +}; + +enum {QUERY_MES_MAX_SIZE_IN_DWORDS =20 }; + +struct MES_API_QUERY_MES__CTX_ARRAY_SIZE { +uint64_t proc_ctx_array_size_addr; +uint64_t gang_ctx_array_size_addr; +}; + +struct MES_API_QUERY_MES__HEALTHY_CHECK { +uint64_t healthy_addr; +}; + +union MESAPI__QUERY_MES_STATUS { +struct { +union MES_API_HEADER header; +enum MES_API_QUERY_MES_OPCODE subopcode; +struct MES_API_STATUS api_status; +uint64_t timestamp; +union { +struct MES_API_QUERY_MES__CTX_ARRAY_SIZE ctx_array_size; +struct MES_API_QUERY_MES__HEALTHY_CHECK healthy_check; +uint32_t data[QUERY_MES_MAX_SIZE_IN_DWORDS ]; + }; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +union MESAPI__SET_DEBUG_VMID { +struct { +union MES_API_HEADER header; +struct MES_API_STATUS api_status; +union { +struct { +uint32_t use_gds :1 ; +uint32_t operation :2 ; +uint32_t reserved :29 ; + } flags; +uint32_t u32All; + }; +uint32_t reserved; +uint32_t debug_vmid; +uint64_t process_context_addr; +uint64_t page_table_base_addr; +uint64_t process_va_start; +uint64_t process_va_end; +uint32_t gds_base; +uint32_t gds_size; +uint32_t gws_base; +uint32_t gws_size; +uint32_t oa_mask; + +uint64_t output_addr;// output addr of the acquired vmid value + +uint64_t timestamp; + +uint32_t process_vm_cntl; +enum MES_QUEUE_TYPE queue_type; + +uint32_t process_context_array_index; + +uint32_t alignment_mode_setting; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +enum MESAPI_MISC_OPCODE { +MESAPI_MISC__WRITE_REG , +MESAPI_MISC__INV_GART , +MESAPI_MISC__QUERY_STATUS , +MESAPI_MISC__READ_REG , +MESAPI_MISC__WAIT_REG_MEM , +MESAPI_MISC__SET_SHADER_DEBUGGER , +MESAPI_MISC__NOTIFY_WORK_ON_UNMAPPED_QUEUE , +MESAPI_MISC__NOTIFY_TO_UNMAP_PROCESSES , + +MESAPI_MISC__MAX , +}; + +enum {MISC_DATA_MAX_SIZE_IN_DWORDS =20 }; + +struct WRITE_REG { +uint32_t reg_offset; +uint32_t reg_value; +}; + +struct READ_REG { +uint32_t reg_offset; +uint64_t buffer_addr; +union { +struct { +uint32_t read64Bits :1 ; +uint32_t reserved :31 ; + } bits; +uint32_t all; + } option; +}; + +struct INV_GART { +uint64_t inv_range_va_start; +uint64_t inv_range_size; +}; + +struct QUERY_STATUS { +uint32_t context_id; +}; + +enum WRM_OPERATION { +WRM_OPERATION__WAIT_REG_MEM , +WRM_OPERATION__WR_WAIT_WR_REG , + +WRM_OPERATION__MAX , +}; + +struct WAIT_REG_MEM { +enum WRM_OPERATION op; +/* only function = equal_to_the_reference_value and mem_space = register_space supported for now */ +uint32_t reference; +uint32_t mask; +uint32_t reg_offset1; +uint32_t reg_offset2; +}; + +struct SET_SHADER_DEBUGGER { +uint64_t process_context_addr; +union { +struct { +uint32_t single_memop :1 ;// SQ_DEBUG.single_memop +uint32_t single_alu_op :1 ;// SQ_DEBUG.single_alu_op +uint32_t reserved :30 ; + }; +uint32_t u32all; + } flags; +uint32_t spi_gdbg_per_vmid_cntl; +uint32_t tcp_watch_cntl[4 ];// TCP_WATCHx_CNTL +uint32_t trap_en; +}; + +struct SET_GANG_SUBMIT { +uint64_t gang_context_addr; +uint64_t slave_gang_context_addr; +uint32_t gang_context_array_index; +uint32_t slave_gang_context_array_index; +}; + +union MESAPI__MISC { +struct { +union MES_API_HEADER header; +enum MESAPI_MISC_OPCODE opcode; +struct MES_API_STATUS api_status; +union { +struct WRITE_REG write_reg; +struct INV_GART inv_gart; +struct QUERY_STATUS query_status; +struct READ_REG read_reg; +struct WAIT_REG_MEM wait_reg_mem; +struct SET_SHADER_DEBUGGER set_shader_debugger; +enum MES_AMD_PRIORITY_LEVEL queue_sch_level; + +uint32_t data[MISC_DATA_MAX_SIZE_IN_DWORDS ]; + }; +uint64_t timestamp; +uint32_t doorbell_offset; +uint32_t os_fence; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +union MESAPI__UPDATE_ROOT_PAGE_TABLE { +struct { +union MES_API_HEADER header; +uint64_t page_table_base_addr; +uint64_t process_context_addr; +struct MES_API_STATUS api_status; +uint64_t timestamp; +uint32_t process_context_array_index; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +union MESAPI_AMD_LOG { +struct { +union MES_API_HEADER header; +uint64_t p_buffer_memory; +uint64_t p_buffer_size_used; +struct MES_API_STATUS api_status; +uint64_t timestamp; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +enum MES_SE_MODE { +MES_SE_MODE_INVALID =0 , +MES_SE_MODE_SINGLE_SE =1 , +MES_SE_MODE_DUAL_SE =2 , +MES_SE_MODE_LOWER_POWER =3 , +}; + +union MESAPI__SET_SE_MODE { +struct { +union MES_API_HEADER header; +/* the new SE mode to apply*/ +enum MES_SE_MODE new_se_mode; +/* the fence to make sure the ItCpgCtxtSync packet is completed */ +uint64_t cpg_ctxt_sync_fence_addr; +uint32_t cpg_ctxt_sync_fence_value; +/* log_seq_time - Scheduler logs the switch seq start/end ts in the IH cookies */ +union { +struct { +uint32_t log_seq_time :1 ; +uint32_t reserved :31 ; + }; +uint32_t uint32_all; + }; +struct MES_API_STATUS api_status; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +union MESAPI__SET_GANG_SUBMIT { +struct { +union MES_API_HEADER header; +struct MES_API_STATUS api_status; +struct SET_GANG_SUBMIT set_gang_submit; + }; + +uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS ]; +}; + +#pragma pack(pop) + +#endif
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 7/31 drm/amdgpu: init mes ucode name for gfx v12
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Keep gfx v12 mes fw name to gc_12_x_x_mes.bin
and gc_12_x_x_mes1.bin.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +2 -1
@@ -1511,7 +1511,8 @@ int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe)amdgpu_ucode_ip_version_decode (adev,GC_HWIP , ucode_prefix,sizeof (ucode_prefix)); -if (amdgpu_ip_version (adev,GC_HWIP ,0 ) >=IP_VERSION (11 ,0 ,0 )) { +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) >=IP_VERSION (11 ,0 ,0 ) && +amdgpu_ip_version (adev,GC_HWIP ,0 ) <IP_VERSION (12 ,0 ,0 )) {snprintf (fw_name,sizeof (fw_name),"amdgpu/%s_mes%s.bin" , ucode_prefix, pipe ==AMDGPU_MES_SCHED_PIPE ?"_2" :"1" );
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 8/31 drm/amdgpu: Add mes v12_0 ip block support (v4)
In reply to Alex DeucherFrom: Jack Xiao <[email protected]>
v1: Add mes v12_0 ip block support. (Jack)
v2: Switch to gfx.kiq array. (Hawking)
v3: Switch to AMDGPU_GFXHUB(0). (Hawking)
v4: Rebase (Alex)
--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 1306 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/mes_v12_0.h | 29 + 3 files changed, 1337 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/mes_v12_0.c create mode 100644 drivers/gpu/drm/amd/amdgpu/mes_v12_0.h
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
@@ -186,7 +186,8 @@ amdgpu-y += \ amdgpu-y += \ amdgpu_mes.o \ mes_v10_1.o \ - mes_v11_0.o + mes_v11_0.o \ + mes_v12_0.o # add UVD block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c new file +1306 -0
1,306 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/mes_v12_0.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright 2021 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 __MES_V12_0_H__ +#define __MES_V12_0_H__ + +extern const struct amdgpu_ip_block_version mes_v12_0_ip_block; + +#endif
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 9/31 drm/amdgpu: set mes fw address for mes v12
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Split the function of mes fimrware address setting from mes firmware load for mes v12, as it's also needed for rlc autoload.
--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 37 +++++++++++++++++++------- 1 file changed, 28 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +28 -9
@@ -596,13 +596,36 @@ static void mes_v12_0_enable(struct amdgpu_device *adev, bool enable) } } +static void mes_v12_0_set_ucode_start_addr (struct amdgpu_device *adev) +{ +uint64_t ucode_addr; +int pipe; + +mes_v12_0_enable (adev, false); + +mutex_lock (&adev->srbm_mutex); +for (pipe =0 ; pipe <AMDGPU_MAX_MES_PIPES ; pipe++) { +/* me=3, queue=0 */ +soc21_grbm_select (adev,3 , pipe,0 ,0 ); + +/* set ucode start address */ + ucode_addr = adev->mes.uc_start_addr[pipe] >>2 ; +WREG32_SOC15 (GC ,0 , regCP_MES_PRGRM_CNTR_START, +lower_32_bits (ucode_addr)); +WREG32_SOC15 (GC ,0 , regCP_MES_PRGRM_CNTR_START_HI, +upper_32_bits (ucode_addr)); + +soc21_grbm_select (adev,0 ,0 ,0 ,0 ); + } +mutex_unlock (&adev->srbm_mutex); +} +/* This function is for backdoor MES firmware */ static int mes_v12_0_load_microcode (struct amdgpu_device *adev,enum admgpu_mes_pipe pipe,bool prime_icache) {int r;uint32_t data; -uint64_t ucode_addr;mes_v12_0_enable (adev, false);
@@ -625,13 +648,6 @@ static int mes_v12_0_load_microcode(struct amdgpu_device *adev,WREG32_SOC15 (GC ,0 , regCP_MES_IC_BASE_CNTL,0 ); -/* set ucode start address */ - ucode_addr = adev->mes.uc_start_addr[pipe] >>2 ; -WREG32_SOC15 (GC ,0 , regCP_MES_PRGRM_CNTR_START, -lower_32_bits (ucode_addr)); -WREG32_SOC15 (GC ,0 , regCP_MES_PRGRM_CNTR_START_HI, -upper_32_bits (ucode_addr)); -/* set ucode fimrware address */ WREG32_SOC15 (GC ,0 , regCP_MES_IC_BASE_LO,lower_32_bits (adev->mes.ucode_fw_gpu_addr[pipe]));
@@ -1158,7 +1174,10 @@ static int mes_v12_0_kiq_hw_init(struct amdgpu_device *adev)return r; } - } +mes_v12_0_set_ucode_start_addr (adev); + + }else if (adev->firmware.load_type ==AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO ) +mes_v12_0_set_ucode_start_addr (adev);mes_v12_0_enable (adev, true);
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 10/31 drm/amdgpu: enable mes v12 self test
In reply to Alex DeucherFrom: Jack Xiao <[email protected]>
1. fix available compute queue to use
2. enable mes v12 self test
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 2 +- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +1 -1
@@ -156,7 +156,7 @@ int amdgpu_mes_init(struct amdgpu_device *adev)for (i =0 ; i <AMDGPU_MES_MAX_COMPUTE_PIPES ; i++) {/* use only 1st MEC pipes */ -if (i >=4 ) +if (i >= adev->gfx.mec.num_pipe_per_mec)continue ; adev->mes.compute_hqd_mask[i] =0xc ; }
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +6 -0
@@ -1301,6 +1301,12 @@ static int mes_v12_0_early_init(void *handle)static int mes_v12_0_late_init (void *handle) { +struct amdgpu_device *adev = (struct amdgpu_device *)handle; + +/* it's only intended for use in mes_self_test case, not for s0ix and reset */ +if (!amdgpu_in_reset (adev) && !adev->in_s0ix && !adev->in_suspend) +amdgpu_mes_self_test (adev); +return 0 ; }
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 11/31 drm/amdgpu: Enable MES to handle doorbell ring on unmapped queue
In reply to Alex DeucherFrom: shaoyunl <[email protected]>
On MES12, HW can monitor up to 2048 doorbells that not be mapped currently and trigger the interrupt to MES when these unmapped doorbell been ringed.
--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +24 -0
@@ -454,6 +454,27 @@ static void mes_v12_0_init_aggregated_doorbell(struct amdgpu_mes *mes)WREG32_SOC15 (GC ,0 , regCP_HQD_GFX_CONTROL, data); } + +static void mes_v12_0_enable_unmapped_doorbell_handling ( +struct amdgpu_mes *mes,bool enable) +{ +struct amdgpu_device *adev = mes->adev; +uint32_t data =RREG32_SOC15 (GC ,0 , regCP_UNMAPPED_DOORBELL); + +/* +* The default PROC_LSB settng is 0xc which means doorbell +* addr[16:12] gives the doorbell page number. For kfd, each +* process will use 2 pages of doorbell, we need to change the +* setting to 0xd +*/ + data &= ~CP_UNMAPPED_DOORBELL__PROC_LSB_MASK ; + data |=0xd <<CP_UNMAPPED_DOORBELL__PROC_LSB__SHIFT ; + + data |= (enable ?1 :0 ) <<CP_UNMAPPED_DOORBELL__ENABLE__SHIFT ; + +WREG32_SOC15 (GC ,0 , regCP_UNMAPPED_DOORBELL, data); +} +static const struct amdgpu_mes_funcs mes_v12_0_funcs = { .add_hw_queue = mes_v12_0_add_hw_queue, .remove_hw_queue = mes_v12_0_remove_hw_queue,
@@ -1233,6 +1254,9 @@ static int mes_v12_0_hw_init(void *handle)mes_v12_0_init_aggregated_doorbell (&adev->mes); +/* Enable the MES to handle doorbell ring on unmapped queue */ +mes_v12_0_enable_unmapped_doorbell_handling (&adev->mes, true); + r =mes_v12_0_query_sched_status (&adev->mes);if (r) {DRM_ERROR ("MES is busy\n" );
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 12/31 drm/amdgpu: fix trap enablement for gfx12
In reply to Alex DeucherFrom: Jonathan Kim <[email protected]>
Fix request to MES to set SQ_SHADER_TBA_HI.trap_en for GFX12.
--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1 -0
@@ -336,6 +336,7 @@ static int mes_v12_0_misc_op(struct amdgpu_mes *mes,memcpy (misc_pkt.set_shader_debugger.tcp_watch_cntl, input->set_shader_debugger.tcp_watch_cntl,sizeof (misc_pkt.set_shader_debugger.tcp_watch_cntl)); + misc_pkt.set_shader_debugger.trap_en = input->set_shader_debugger.trap_en;break ;default :DRM_ERROR ("unsupported misc op (%d) \n" , input->op);
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 13/31 drm/amdgpu/mes12: update data cache boundary
In reply to Alex DeucherFrom: Jack Xiao <[email protected]>
Enlarge the data cache boundary.
v2: use the fix data cache boundary.
--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +2 -2
@@ -685,8 +685,8 @@ static int mes_v12_0_load_microcode(struct amdgpu_device *adev,WREG32_SOC15 (GC ,0 , regCP_MES_MDBASE_HI,upper_32_bits (adev->mes.data_fw_gpu_addr[pipe])); -/* Set 0x3FFFF (256K-1) to CP_MES_MDBOUND_LO */ -WREG32_SOC15 (GC ,0 , regCP_MES_MDBOUND_LO,0x3FFFF ); +/* Set data cache boundary CP_MES_MDBOUND_LO */ +WREG32_SOC15 (GC ,0 , regCP_MES_MDBOUND_LO,0x7FFFF );if (prime_icache) {/* invalidate ICACHE */
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 14/31 drm/amdgpu: Add gfx v12_0 ip block support (v6)
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Initial support for GFX 12.
v1: Add gfx v12_0 ip block support. (Likun)
v2: Switch to gfx.kiq array.
Move the vmhub from ring callback to ring. (Hawking)
v3: Update various callback function impl. (Hawking)
v4: Warning fixes (Alex)
v5: squash in imu fix, csb, rlc autoload implementations (Alex)
v6: Rebase (Alex)
--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 4602 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/gfx_v12_0.h | 29 + 3 files changed, 4633 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c create mode 100644 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.h
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
@@ -167,7 +167,8 @@ amdgpu-y += \ imu_v11_0.o \ gfx_v11_0.o \ gfx_v11_0_3.o \ - imu_v11_0_3.o + imu_v11_0_3.o \ + gfx_v12_0.o # add async DMA block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c new file +4602 -0
2,991 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.h new file +29 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.44.0
Part of the diff is not shown here. View the raw message.
Alex Deucher
maintainerPATCH 15/31 drm/amdgpu: set cp fw address set for gfx v12
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Split PFF/ME/MEC firmware address setting function from related load microcode funtion, as it's also needed for rlc autolad.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 186 ++++++++++++++++--------- 1 file changed, 122 insertions(+), 64 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +122 -64
@@ -1749,6 +1749,110 @@ static void gfx_v12_0_config_gfx_rs64(struct amdgpu_device *adev)WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, tmp); } +static void gfx_v12_0_set_pfp_ucode_start_addr (struct amdgpu_device *adev) +{ +const struct gfx_firmware_header_v2_0 *cp_hdr; +unsigned pipe_id, tmp; + + cp_hdr = (const struct gfx_firmware_header_v2_0 *) + adev->gfx.pfp_fw->data; +mutex_lock (&adev->srbm_mutex); +for (pipe_id =0 ; pipe_id < adev->gfx.me.num_pipe_per_me; pipe_id++) { +soc24_grbm_select (adev,0 , pipe_id,0 ,0 ); +WREG32_SOC15 (GC ,0 , regCP_PFP_PRGRM_CNTR_START, + (cp_hdr->ucode_start_addr_hi <<30 ) | + (cp_hdr->ucode_start_addr_lo >>2 )); +WREG32_SOC15 (GC ,0 , regCP_PFP_PRGRM_CNTR_START_HI, + cp_hdr->ucode_start_addr_hi>>2 ); + +/* +* Program CP_ME_CNTL to reset given PIPE to take +* effect of CP_PFP_PRGRM_CNTR_START. +*/ + tmp =RREG32_SOC15 (GC ,0 , regCP_ME_CNTL); +if (pipe_id ==0 ) + tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , +PFP_PIPE0_RESET ,1 ); +else + tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , +PFP_PIPE1_RESET ,1 ); +WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, tmp); + +/* Clear pfp pipe0 reset bit. */ +if (pipe_id ==0 ) + tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , +PFP_PIPE0_RESET ,0 ); +else + tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , +PFP_PIPE1_RESET ,0 ); +WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, tmp); + } +soc24_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +} + +static void gfx_v12_0_set_me_ucode_start_addr (struct amdgpu_device *adev) +{ +const struct gfx_firmware_header_v2_0 *cp_hdr; +unsigned pipe_id, tmp; + + cp_hdr = (const struct gfx_firmware_header_v2_0 *) + adev->gfx.me_fw->data; +mutex_lock (&adev->srbm_mutex); +for (pipe_id =0 ; pipe_id < adev->gfx.me.num_pipe_per_me; pipe_id++) { +soc24_grbm_select (adev,0 , pipe_id,0 ,0 ); +WREG32_SOC15 (GC ,0 , regCP_ME_PRGRM_CNTR_START, + (cp_hdr->ucode_start_addr_hi <<30 ) | + (cp_hdr->ucode_start_addr_lo >>2 ) ); +WREG32_SOC15 (GC ,0 , regCP_ME_PRGRM_CNTR_START_HI, + cp_hdr->ucode_start_addr_hi>>2 ); + +/* +* Program CP_ME_CNTL to reset given PIPE to take +* effect of CP_ME_PRGRM_CNTR_START. +*/ + tmp =RREG32_SOC15 (GC ,0 , regCP_ME_CNTL); +if (pipe_id ==0 ) + tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , +ME_PIPE0_RESET ,1 ); +else + tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , +ME_PIPE1_RESET ,1 ); +WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, tmp); + +/* Clear pfp pipe0 reset bit. */ +if (pipe_id ==0 ) + tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , +ME_PIPE0_RESET ,0 ); +else + tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , +ME_PIPE1_RESET ,0 ); +WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, tmp); + } +soc24_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +} + +static void gfx_v12_0_set_mec_ucode_start_addr (struct amdgpu_device *adev) +{ +const struct gfx_firmware_header_v2_0 *cp_hdr; +unsigned pipe_id; + + cp_hdr = (const struct gfx_firmware_header_v2_0 *) + adev->gfx.mec_fw->data; +mutex_lock (&adev->srbm_mutex); +for (pipe_id =0 ; pipe_id < adev->gfx.mec.num_pipe_per_mec; pipe_id++) { +soc24_grbm_select (adev,1 , pipe_id,0 ,0 ); +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_PRGRM_CNTR_START, + cp_hdr->ucode_start_addr_lo >>2 | + cp_hdr->ucode_start_addr_hi <<30 ); +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_PRGRM_CNTR_START_HI, + cp_hdr->ucode_start_addr_hi >>2 ); + } +soc24_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +} +static int gfx_v12_0_wait_for_rlc_autoload_complete (struct amdgpu_device *adev) {uint32_t cp_status;
@@ -1774,6 +1878,12 @@ static int gfx_v12_0_wait_for_rlc_autoload_complete(struct amdgpu_device *adev)return -ETIMEDOUT ; } +if (adev->firmware.load_type ==AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO ) { +gfx_v12_0_set_pfp_ucode_start_addr (adev); +gfx_v12_0_set_me_ucode_start_addr (adev); +gfx_v12_0_set_mec_ucode_start_addr (adev); + } +return 0 ; }
@@ -1905,33 +2015,6 @@ static int gfx_v12_0_cp_gfx_load_pfp_microcode_rs64(struct amdgpu_device *adev)mutex_lock (&adev->srbm_mutex);for (pipe_id =0 ; pipe_id < adev->gfx.me.num_pipe_per_me; pipe_id++) {soc24_grbm_select (adev,0 , pipe_id,0 ,0 ); -WREG32_SOC15 (GC ,0 , regCP_PFP_PRGRM_CNTR_START, - (pfp_hdr->ucode_start_addr_hi <<30 ) | - (pfp_hdr->ucode_start_addr_lo >>2 )); -WREG32_SOC15 (GC ,0 , regCP_PFP_PRGRM_CNTR_START_HI, - pfp_hdr->ucode_start_addr_hi>>2 ); - -/* -* Program CP_ME_CNTL to reset given PIPE to take -* effect of CP_PFP_PRGRM_CNTR_START. -*/ - tmp =RREG32_SOC15 (GC ,0 , regCP_ME_CNTL); -if (pipe_id ==0 ) - tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , -PFP_PIPE0_RESET ,1 ); -else - tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , -PFP_PIPE1_RESET ,1 ); -WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, tmp); - -/* Clear pfp pipe0 reset bit. */ -if (pipe_id ==0 ) - tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , -PFP_PIPE0_RESET ,0 ); -else - tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , -PFP_PIPE1_RESET ,0 ); -WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, tmp);WREG32_SOC15 (GC ,0 , regCP_GFX_RS64_DC_BASE0_LO,lower_32_bits (adev->gfx.pfp.pfp_fw_data_gpu_addr));
@@ -1964,6 +2047,8 @@ static int gfx_v12_0_cp_gfx_load_pfp_microcode_rs64(struct amdgpu_device *adev)return -EINVAL ; } +gfx_v12_0_set_pfp_ucode_start_addr (adev); +return 0 ; }
@@ -2075,33 +2160,6 @@ static int gfx_v12_0_cp_gfx_load_me_microcode_rs64(struct amdgpu_device *adev)mutex_lock (&adev->srbm_mutex);for (pipe_id =0 ; pipe_id < adev->gfx.me.num_pipe_per_me; pipe_id++) {soc24_grbm_select (adev,0 , pipe_id,0 ,0 ); -WREG32_SOC15 (GC ,0 , regCP_ME_PRGRM_CNTR_START, - (me_hdr->ucode_start_addr_hi <<30 ) | - (me_hdr->ucode_start_addr_lo >>2 )); -WREG32_SOC15 (GC ,0 , regCP_ME_PRGRM_CNTR_START_HI, - me_hdr->ucode_start_addr_hi>>2 ); - -/* -* Program CP_ME_CNTL to reset given PIPE to take -* effect of CP_PFP_PRGRM_CNTR_START. -*/ - tmp =RREG32_SOC15 (GC ,0 , regCP_ME_CNTL); -if (pipe_id ==0 ) - tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , -ME_PIPE0_RESET ,1 ); -else - tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , -ME_PIPE1_RESET ,1 ); -WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, tmp); - -/* Clear pfp pipe0 reset bit. */ -if (pipe_id ==0 ) - tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , -ME_PIPE0_RESET ,0 ); -else - tmp =REG_SET_FIELD (tmp,CP_ME_CNTL , -ME_PIPE1_RESET ,0 ); -WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, tmp);WREG32_SOC15 (GC ,0 , regCP_GFX_RS64_DC_BASE1_LO,lower_32_bits (adev->gfx.me.me_fw_data_gpu_addr));
@@ -2134,6 +2192,8 @@ static int gfx_v12_0_cp_gfx_load_me_microcode_rs64(struct amdgpu_device *adev)return -EINVAL ; } +gfx_v12_0_set_me_ucode_start_addr (adev); +return 0 ; }
@@ -2382,19 +2442,15 @@ static int gfx_v12_0_cp_compute_load_microcode_rs64(struct amdgpu_device *adev)for (i =0 ; i < adev->gfx.mec.num_pipe_per_mec; i++) {soc24_grbm_select (adev,1 , i,0 ,0 ); -WREG32_SOC15 (GC ,0 , regCP_MEC_MDBASE_LO, adev->gfx.mec.mec_fw_data_gpu_addr); +WREG32_SOC15 (GC ,0 , regCP_MEC_MDBASE_LO, +lower_32_bits (adev->gfx.mec.mec_fw_data_gpu_addr));WREG32_SOC15 (GC ,0 , regCP_MEC_MDBASE_HI, -upper_32_bits (adev->gfx.mec.mec_fw_data_gpu_addr)); +upper_32_bits (adev->gfx.mec.mec_fw_data_gpu_addr)); -WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_PRGRM_CNTR_START, - mec_hdr->ucode_start_addr_lo >>2 | - mec_hdr->ucode_start_addr_hi <<30 ); -WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_PRGRM_CNTR_START_HI, - mec_hdr->ucode_start_addr_hi >>2 ); - -WREG32_SOC15 (GC ,0 , regCP_CPC_IC_BASE_LO, adev->gfx.mec.mec_fw_gpu_addr); +WREG32_SOC15 (GC ,0 , regCP_CPC_IC_BASE_LO, +lower_32_bits (adev->gfx.mec.mec_fw_gpu_addr));WREG32_SOC15 (GC ,0 , regCP_CPC_IC_BASE_HI, -upper_32_bits (adev->gfx.mec.mec_fw_gpu_addr)); +upper_32_bits (adev->gfx.mec.mec_fw_gpu_addr)); }mutex_unlock (&adev->srbm_mutex);soc24_grbm_select (adev,0 ,0 ,0 ,0 );
@@ -2437,6 +2493,8 @@ static int gfx_v12_0_cp_compute_load_microcode_rs64(struct amdgpu_device *adev)return -EINVAL ; } +gfx_v12_0_set_mec_ucode_start_addr (adev); +return 0 ; }
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 16/31 drm/amd/amdgpu: imu fw loading support
In reply to Alex DeucherFrom: Kenneth Feng <[email protected]>
support imu related function for gfx v12.
--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 4 +- drivers/gpu/drm/amd/amdgpu/imu_v12_0.c | 303 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/imu_v12_0.h | 30 +++ 4 files changed, 337 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/imu_v12_0.c create mode 100644 drivers/gpu/drm/amd/amdgpu/imu_v12_0.h
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
@@ -168,7 +168,8 @@ amdgpu-y += \ gfx_v11_0.o \ gfx_v11_0_3.o \ imu_v11_0_3.o \ - gfx_v12_0.o + gfx_v12_0.o \ + imu_v12_0.o # add async DMA block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2 -2
@@ -30,6 +30,7 @@#include "amdgpu_psp.h" #include "amdgpu_smu.h" #include "amdgpu_atomfirmware.h" +#include "imu_v12_0.h" #include "soc24.h" #include "nvd.h"
@@ -4523,8 +4524,7 @@ static void gfx_v12_0_set_imu_funcs(struct amdgpu_device *adev)else adev->gfx.imu.mode =DEBUG_MODE ; -/* TODO */ -//adev->gfx.imu.funcs = &gfx_v12_0_imu_funcs; + adev->gfx.imu.funcs = &gfx_v12_0_imu_funcs; }static void gfx_v12_0_set_rlc_funcs (struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/imu_v12_0.c new file +303 -0
303 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/imu_v12_0.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright 2021 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 __IMU_V12_0_H__ +#define __IMU_V12_0_H__ + +extern const struct amdgpu_imu_funcs gfx_v12_0_imu_funcs; + +#endif +
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 17/31 drm/amdgpu: skip imu related function if dpm=0
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Only execute IMU related functions if dpm>0.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +3 -3
@@ -1076,7 +1076,7 @@ static int gfx_v12_0_rlc_backdoor_autoload_enable(struct amdgpu_device *adev)WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_BOOTLOADER_SIZE, rlc_g_size); -if (adev->gfx.imu.funcs) { +if (adev->gfx.imu.funcs && (amdgpu_dpm >0 )) {/* RLC autoload sequence 3: load IMU fw */ if (adev->gfx.imu.funcs->load_microcode) adev->gfx.imu.funcs->load_microcode (adev);
@@ -1149,7 +1149,7 @@ static int gfx_v12_0_sw_init(void *handle) adev->gfx.gfx_current_status =AMDGPU_GFX_NORMAL_MODE ; -if (adev->gfx.imu.funcs) { +if (adev->gfx.imu.funcs && (amdgpu_dpm >0 )) {if (adev->gfx.imu.funcs->init_microcode) { r = adev->gfx.imu.funcs->init_microcode (adev);if (r)
@@ -3215,7 +3215,7 @@ static int gfx_v12_0_hw_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;if (adev->firmware.load_type ==AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO ) { -if (adev->gfx.imu.funcs) { +if (adev->gfx.imu.funcs && (amdgpu_dpm >0 )) {/* RLC autoload sequence 1: Program rlc ram */ if (adev->gfx.imu.funcs->program_rlc_ram) adev->gfx.imu.funcs->program_rlc_ram (adev);
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 18/31 drm/amdgpu/gfx12: recalculate available compute rings to use
In reply to Alex DeucherFrom: Jack Xiao <[email protected]>
Recalculate the number of compute rings to use based on the gfx hardware configuration. As needed reserve half of compute rings for mes, kgd can't use up all compute rings.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +7 -0
@@ -1103,6 +1103,7 @@ static int gfx_v12_0_rlc_backdoor_autoload_enable(struct amdgpu_device *adev)static int gfx_v12_0_sw_init (void *handle) {int i, j, k, r, ring_id =0 ; +unsigned num_compute_rings;int xcc_id =0 ;struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1126,6 +1127,12 @@ static int gfx_v12_0_sw_init(void *handle)break ; } +/* recalculate compute rings to use based on hardware configuration */ + num_compute_rings = (adev->gfx.mec.num_pipe_per_mec * + adev->gfx.mec.num_queue_per_pipe) /2 ; + adev->gfx.num_compute_rings =min (adev->gfx.num_compute_rings, + num_compute_rings); +/* EOP Event */ r = amdgpu_irq_add_id(adev, SOC21_IH_CLIENTID_GRBM_CP, GFX_11_0_0__SRCID__CP_EOP_INTERRUPT,
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 19/31 drm/amdgpu: support S&R fw load for gfx v12
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Support Save & Restore related fw load with backdoor RLC autoload type on gfx v12.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +16 -0
@@ -915,6 +915,7 @@ gfx_v12_0_rlc_backdoor_autoload_copy_gfx_ucode(struct amdgpu_device *adev)uint32_t fw_size;const struct gfx_firmware_header_v2_0 *cpv2_hdr;const struct rlc_firmware_header_v2_0 *rlc_hdr; +const struct rlc_firmware_header_v2_1 *rlcv21_hdr;const struct rlc_firmware_header_v2_2 *rlcv22_hdr;uint16_t version_major, version_minor;
@@ -986,6 +987,21 @@ gfx_v12_0_rlc_backdoor_autoload_copy_gfx_ucode(struct amdgpu_device *adev) version_major =le16_to_cpu (rlc_hdr->header.header_version_major); version_minor =le16_to_cpu (rlc_hdr->header.header_version_minor);if (version_major ==2 ) { +if (version_minor >=1 ) { + rlcv21_hdr = (const struct rlc_firmware_header_v2_1 *)adev->gfx.rlc_fw->data; + + fw_data = (const __le32 *)(adev->gfx.rlc_fw->data + +le32_to_cpu (rlcv21_hdr->save_restore_list_gpm_offset_bytes)); + fw_size =le32_to_cpu (rlcv21_hdr->save_restore_list_gpm_size_bytes); +gfx_v12_0_rlc_backdoor_autoload_copy_ucode (adev,SOC24_FIRMWARE_ID_RLCG_SCRATCH , + fw_data, fw_size); + + fw_data = (const __le32 *)(adev->gfx.rlc_fw->data + +le32_to_cpu (rlcv21_hdr->save_restore_list_srm_offset_bytes)); + fw_size =le32_to_cpu (rlcv21_hdr->save_restore_list_srm_size_bytes); +gfx_v12_0_rlc_backdoor_autoload_copy_ucode (adev,SOC24_FIRMWARE_ID_RLC_SRM_ARAM , + fw_data, fw_size); + }if (version_minor >=2 ) { rlcv22_hdr = (const struct rlc_firmware_header_v2_2 *)adev->gfx.rlc_fw->data;
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 20/31 drm/amd: Move fw init from sw_init to early_init for imu v12
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Move microcode loading from sw_init to early_init to align with the perious version of imu init sequence.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +8 -8
@@ -461,6 +461,14 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)/* only one MEC for gfx 12 */ adev->gfx.mec2_fw =NULL ; +if (adev->gfx.imu.funcs && (amdgpu_dpm >0 )) { +if (adev->gfx.imu.funcs->init_microcode) { + err = adev->gfx.imu.funcs->init_microcode (adev); +if (err) +dev_err (adev->dev,"Failed to load imu firmware!\n" ); + } + } + out:if (err) {amdgpu_ucode_release (&adev->gfx.pfp_fw);
@@ -1172,14 +1180,6 @@ static int gfx_v12_0_sw_init(void *handle) adev->gfx.gfx_current_status =AMDGPU_GFX_NORMAL_MODE ; -if (adev->gfx.imu.funcs && (amdgpu_dpm >0 )) { -if (adev->gfx.imu.funcs->init_microcode) { - r = adev->gfx.imu.funcs->init_microcode (adev); -if (r) -dev_err (adev->dev,"Failed to load imu firmware!\n" ); - } - } -gfx_v12_0_me_init (adev); r =gfx_v12_0_rlc_init (adev);
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 21/31 drm/amd/amdgpu: workaround for the imu fw loading
In reply to Alex DeucherFrom: Kenneth Feng <[email protected]>
workaournd for the imu fw loading on gfx 12.0 without psp
--- drivers/gpu/drm/amd/amdgpu/imu_v12_0.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/imu_v12_0.c +5 -0
@@ -143,6 +143,11 @@ static void imu_v12_0_setup(struct amdgpu_device *adev) imu_reg_val =RREG32_SOC15 (GC ,0 , regGFX_IMU_C2PMSG_16); imu_reg_val |=0x1 ;WREG32_SOC15 (GC ,0 , regGFX_IMU_C2PMSG_16, imu_reg_val); + + imu_reg_val =RREG32_SOC15 (GC ,0 , regGFX_IMU_SCRATCH_10); + imu_reg_val |=0x20010007 ; +WREG32_SOC15 (GC ,0 , regGFX_IMU_SCRATCH_10, imu_reg_val); + } }
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 22/31 drm/amdgpu: set different fw data addr for mec pipe
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
For MEC fw data, different pipe should programed into different address.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +10 -4
@@ -2432,7 +2432,9 @@ static int gfx_v12_0_cp_compute_load_microcode_rs64(struct amdgpu_device *adev)return r; } - r = amdgpu_bo_create_reserved(adev, fw_data_size, + r = amdgpu_bo_create_reserved(adev, + ALIGN(fw_data_size, 64 * 1024) * + adev->gfx.mec.num_pipe_per_mec, 64 * 1024, AMDGPU_GEM_DOMAIN_VRAM, &adev->gfx.mec.mec_fw_data_obj, &adev->gfx.mec.mec_fw_data_gpu_addr,
@@ -2444,7 +2446,9 @@ static int gfx_v12_0_cp_compute_load_microcode_rs64(struct amdgpu_device *adev) }memcpy (fw_ucode_ptr, fw_ucode, fw_ucode_size); -memcpy (fw_data_ptr, fw_data, fw_data_size); +for (i =0 ; i < adev->gfx.mec.num_pipe_per_mec; i++) { +memcpy (fw_data_ptr + i *ALIGN (fw_data_size,64 *1024 ) /4 , fw_data, fw_data_size); + }amdgpu_bo_kunmap (adev->gfx.mec.mec_fw_obj);amdgpu_bo_kunmap (adev->gfx.mec.mec_fw_data_obj);
@@ -2467,9 +2471,11 @@ static int gfx_v12_0_cp_compute_load_microcode_rs64(struct amdgpu_device *adev)soc24_grbm_select (adev,1 , i,0 ,0 );WREG32_SOC15 (GC ,0 , regCP_MEC_MDBASE_LO, -lower_32_bits (adev->gfx.mec.mec_fw_data_gpu_addr)); +lower_32_bits (adev->gfx.mec.mec_fw_data_gpu_addr + + i *ALIGN (fw_data_size,64 *1024 )));WREG32_SOC15 (GC ,0 , regCP_MEC_MDBASE_HI, -upper_32_bits (adev->gfx.mec.mec_fw_data_gpu_addr)); +upper_32_bits (adev->gfx.mec.mec_fw_data_gpu_addr + + i *ALIGN (fw_data_size,64 *1024 )));WREG32_SOC15 (GC ,0 , regCP_CPC_IC_BASE_LO,lower_32_bits (adev->gfx.mec.mec_fw_gpu_addr));
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 23/31 drm/amd/amdgpu: update GFX12 wave data registers
In reply to Alex DeucherFrom: Tom St Denis <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +11 -2
@@ -659,8 +659,8 @@ static void gfx_v12_0_read_wave_data(struct amdgpu_device *adev,* zero here */ WARN_ON (simd !=0 ); -/* type 3 wave data */ - dst[(*no_fields)++] =3 ; +/* type 4 wave data */ + dst[(*no_fields)++] =4 ; dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_STATUS); dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_PC_LO); dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_PC_HI);
@@ -675,6 +675,15 @@ static void gfx_v12_0_read_wave_data(struct amdgpu_device *adev, dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_IB_DBG1); dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_M0); dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_MODE); + dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_STATE_PRIV); + dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_EXCP_FLAG_PRIV); + dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_EXCP_FLAG_USER); + dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_TRAP_CTRL); + dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_ACTIVE); + dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_VALID_AND_IDLE); + dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_DVGPR_ALLOC_LO); + dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_DVGPR_ALLOC_HI); + dst[(*no_fields)++] =wave_read_ind (adev, wave, ixSQ_WAVE_SCHED_MODE); } static void gfx_v12_0_read_wave_sgprs(struct amdgpu_device *adev,
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 24/31 drm/amd/amdgpu: add cgcg&cgls interface for gfx 12.0
In reply to Alex DeucherFrom: Kenneth Feng <[email protected]>
add cgcg&cgls interface for gfx 12.0
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 190 ++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/soc24.c | 3 + 2 files changed, 191 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +188 -2
@@ -1472,7 +1472,7 @@ static void gfx_v12_0_constants_init(struct amdgpu_device *adev) }static void gfx_v12_0_enable_gui_idle_interrupt (struct amdgpu_device *adev, -bool enable) +bool enable) {u32 tmp;
@@ -3594,10 +3594,196 @@ static int gfx_v12_0_set_powergating_state(void *handle,return 0 ; } +static void gfx_v12_0_update_coarse_grain_clock_gating (struct amdgpu_device *adev, +bool enable) +{ +uint32_t def, data; + +if (!(adev->cg_flags & + (AMD_CG_SUPPORT_GFX_CGCG | +AMD_CG_SUPPORT_GFX_CGLS | +AMD_CG_SUPPORT_GFX_3D_CGCG | +AMD_CG_SUPPORT_GFX_3D_CGLS ))) +return ; + +if (enable) { + def = data =RREG32_SOC15 (GC ,0 , regRLC_CGTT_MGCG_OVERRIDE); + +/* unset CGCG override */ +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_CGCG ) + data &= ~RLC_CGTT_MGCG_OVERRIDE__GFXIP_CGCG_OVERRIDE_MASK ; +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_CGLS ) + data &= ~RLC_CGTT_MGCG_OVERRIDE__GFXIP_CGLS_OVERRIDE_MASK ; +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_3D_CGCG || + adev->cg_flags &AMD_CG_SUPPORT_GFX_3D_CGLS ) + data &= ~RLC_CGTT_MGCG_OVERRIDE__GFXIP_GFX3D_CG_OVERRIDE_MASK ; + +/* update CGCG override bits */ +if (def != data) +WREG32_SOC15 (GC ,0 , regRLC_CGTT_MGCG_OVERRIDE, data); + +/* enable cgcg FSM(0x0000363F) */ + def = data =RREG32_SOC15 (GC ,0 , regRLC_CGCG_CGLS_CTRL); + +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_CGCG ) { + data &= ~RLC_CGCG_CGLS_CTRL__CGCG_GFX_IDLE_THRESHOLD_MASK ; + data |= (0x36 <<RLC_CGCG_CGLS_CTRL__CGCG_GFX_IDLE_THRESHOLD__SHIFT ) | +RLC_CGCG_CGLS_CTRL__CGCG_EN_MASK ; + } + +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_CGLS ) { + data &= ~RLC_CGCG_CGLS_CTRL__CGLS_REP_COMPANSAT_DELAY_MASK ; + data |= (0x000F <<RLC_CGCG_CGLS_CTRL__CGLS_REP_COMPANSAT_DELAY__SHIFT ) | +RLC_CGCG_CGLS_CTRL__CGLS_EN_MASK ; + } + +if (def != data) +WREG32_SOC15 (GC ,0 , regRLC_CGCG_CGLS_CTRL, data); + +/* Program RLC_CGCG_CGLS_CTRL_3D */ + def = data =RREG32_SOC15 (GC ,0 , regRLC_CGCG_CGLS_CTRL_3D); + +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_3D_CGCG ) { + data &= ~RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD_MASK ; + data |= (0x36 <<RLC_CGCG_CGLS_CTRL_3D__CGCG_GFX_IDLE_THRESHOLD__SHIFT ) | +RLC_CGCG_CGLS_CTRL_3D__CGCG_EN_MASK ; + } + +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_3D_CGLS ) { + data &= ~RLC_CGCG_CGLS_CTRL_3D__CGLS_REP_COMPANSAT_DELAY_MASK ; + data |= (0xf <<RLC_CGCG_CGLS_CTRL_3D__CGLS_REP_COMPANSAT_DELAY__SHIFT ) | +RLC_CGCG_CGLS_CTRL_3D__CGLS_EN_MASK ; + } + +if (def != data) +WREG32_SOC15 (GC ,0 , regRLC_CGCG_CGLS_CTRL_3D, data); + +/* set IDLE_POLL_COUNT(0x00900100) */ + def = data =RREG32_SOC15 (GC ,0 , regCP_RB_WPTR_POLL_CNTL); + + data &= ~(CP_RB_WPTR_POLL_CNTL__POLL_FREQUENCY_MASK |CP_RB_WPTR_POLL_CNTL__IDLE_POLL_COUNT_MASK ); + data |= (0x0100 <<CP_RB_WPTR_POLL_CNTL__POLL_FREQUENCY__SHIFT ) | + (0x0090 <<CP_RB_WPTR_POLL_CNTL__IDLE_POLL_COUNT__SHIFT ); + +if (def != data) +WREG32_SOC15 (GC ,0 , regCP_RB_WPTR_POLL_CNTL, data); + + data =RREG32_SOC15 (GC ,0 , regCP_INT_CNTL); + data =REG_SET_FIELD (data,CP_INT_CNTL ,CNTX_BUSY_INT_ENABLE ,1 ); + data =REG_SET_FIELD (data,CP_INT_CNTL ,CNTX_EMPTY_INT_ENABLE ,1 ); + data =REG_SET_FIELD (data,CP_INT_CNTL ,CMP_BUSY_INT_ENABLE ,1 ); + data =REG_SET_FIELD (data,CP_INT_CNTL ,GFX_IDLE_INT_ENABLE ,1 ); +WREG32_SOC15 (GC ,0 , regCP_INT_CNTL, data); + + data =RREG32_SOC15 (GC ,0 , regSDMA0_RLC_CGCG_CTRL); + data =REG_SET_FIELD (data,SDMA0_RLC_CGCG_CTRL ,CGCG_INT_ENABLE ,1 ); +WREG32_SOC15 (GC ,0 , regSDMA0_RLC_CGCG_CTRL, data); + +/* Some ASICs only have one SDMA instance, not need to configure SDMA1 */ +if (adev->sdma.num_instances >1 ) { + data =RREG32_SOC15 (GC ,0 , regSDMA1_RLC_CGCG_CTRL); + data =REG_SET_FIELD (data,SDMA1_RLC_CGCG_CTRL ,CGCG_INT_ENABLE ,1 ); +WREG32_SOC15 (GC ,0 , regSDMA1_RLC_CGCG_CTRL, data); + } + }else { +/* Program RLC_CGCG_CGLS_CTRL */ + def = data =RREG32_SOC15 (GC ,0 , regRLC_CGCG_CGLS_CTRL); + +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_CGCG ) + data &= ~RLC_CGCG_CGLS_CTRL__CGCG_EN_MASK ; + +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_CGLS ) + data &= ~RLC_CGCG_CGLS_CTRL__CGLS_EN_MASK ; + +if (def != data) +WREG32_SOC15 (GC ,0 , regRLC_CGCG_CGLS_CTRL, data); + +/* Program RLC_CGCG_CGLS_CTRL_3D */ + def = data =RREG32_SOC15 (GC ,0 , regRLC_CGCG_CGLS_CTRL_3D); + +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_3D_CGCG ) + data &= ~RLC_CGCG_CGLS_CTRL_3D__CGCG_EN_MASK ; +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_3D_CGLS ) + data &= ~RLC_CGCG_CGLS_CTRL_3D__CGLS_EN_MASK ; + +if (def != data) +WREG32_SOC15 (GC ,0 , regRLC_CGCG_CGLS_CTRL_3D, data); + + data =RREG32_SOC15 (GC ,0 , regSDMA0_RLC_CGCG_CTRL); + data &= ~SDMA0_RLC_CGCG_CTRL__CGCG_INT_ENABLE_MASK ; +WREG32_SOC15 (GC ,0 , regSDMA0_RLC_CGCG_CTRL, data); + +/* Some ASICs only have one SDMA instance, not need to configure SDMA1 */ +if (adev->sdma.num_instances >1 ) { + data =RREG32_SOC15 (GC ,0 , regSDMA1_RLC_CGCG_CTRL); + data &= ~SDMA1_RLC_CGCG_CTRL__CGCG_INT_ENABLE_MASK ; +WREG32_SOC15 (GC ,0 , regSDMA1_RLC_CGCG_CTRL, data); + } + } +} + +static void gfx_v12_0_update_medium_grain_clock_gating (struct amdgpu_device *adev, +bool enable) +{ +/* TODO */ +} + +static void gfx_v12_0_update_repeater_fgcg (struct amdgpu_device *adev, +bool enable) +{ +/* TODO */ +} + +static void gfx_v12_0_update_sram_fgcg (struct amdgpu_device *adev, +bool enable) +{ +/* TODO */ +} + +static int gfx_v12_0_update_gfx_clock_gating (struct amdgpu_device *adev, +bool enable) +{ +amdgpu_gfx_rlc_enter_safe_mode (adev,0 ); + +gfx_v12_0_update_coarse_grain_clock_gating (adev, enable); + +gfx_v12_0_update_medium_grain_clock_gating (adev, enable); + +gfx_v12_0_update_repeater_fgcg (adev, enable); + +gfx_v12_0_update_sram_fgcg (adev, enable); + +gfx_v12_0_update_perf_clk (adev, enable); + +if (adev->cg_flags & + (AMD_CG_SUPPORT_GFX_MGCG | +AMD_CG_SUPPORT_GFX_CGLS | +AMD_CG_SUPPORT_GFX_CGCG | +AMD_CG_SUPPORT_GFX_3D_CGCG | +AMD_CG_SUPPORT_GFX_3D_CGLS )) +gfx_v12_0_enable_gui_idle_interrupt (adev, enable); + +amdgpu_gfx_rlc_exit_safe_mode (adev,0 ); + +return 0 ; +} +static int gfx_v12_0_set_clockgating_state (void *handle,enum amd_clockgating_state state) { -/* TODO */ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; + +if (amdgpu_sriov_vf (adev)) +return 0 ; + +switch (adev->ip_versions[GC_HWIP ][0 ]) { +case IP_VERSION (12 ,0 ,1 ): +gfx_v12_0_update_gfx_clock_gating (adev, + state ==AMD_CG_STATE_GATE ); +break ; +default : +break ; + }return 0 ; }
drivers/gpu/drm/amd/amdgpu/soc24.c +3 -0
@@ -361,6 +361,9 @@ static int soc24_common_early_init(void *handle) adev->cg_flags =0 ; adev->pg_flags =0 ; adev->external_rev_id = adev->rev_id +0x50 ; + adev->cg_flags =AMD_CG_SUPPORT_GFX_CGCG | +AMD_CG_SUPPORT_GFX_CGLS ; +break ;default :/* FIXME: not supported yet */
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 25/31 drm/amdgpu: use new method to program rlc ram
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Program rlc ram with golden setting data instead. The old method (program_imu_rlc_ram_old) should be retired in the future.
--- drivers/gpu/drm/amd/amdgpu/imu_v12_0.c | 70 ++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/imu_v12_0.c +61 -9
@@ -33,6 +33,8 @@MODULE_FIRMWARE ("amdgpu/gc_12_0_1_imu.bin" ); +#define TRANSFER_RAM_MASK 0x001c0000 +static int imu_v12_0_init_microcode (struct amdgpu_device *adev) {char fw_name[40 ];
@@ -245,9 +247,9 @@ static const struct imu_rlc_ram_golden imu_rlc_ram_golden_12_0_1[] = { IMU_RLC_RAM_GOLDEN_VALUE(GC, 0, regGCMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB, 0, 0x1c0000) }; -static void program_imu_rlc_ram (struct amdgpu_device *adev, -const struct imu_rlc_ram_golden *regs, -const u32 array_size) +static void program_imu_rlc_ram_old (struct amdgpu_device *adev, +const struct imu_rlc_ram_golden *regs, +const u32 array_size) {const struct imu_rlc_ram_golden *entry;u32 reg, data;
@@ -271,21 +273,66 @@ static void program_imu_rlc_ram(struct amdgpu_device *adev,WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_ADDR_LOW, reg);WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_DATA, data); } -//Indicate the latest entry -WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_ADDR_HIGH,0 ); -WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_ADDR_LOW,0 ); -WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_DATA,0 ); +} + +static u32 imu_v12_0_grbm_gfx_index_remap (struct amdgpu_device *adev, +u32 data,bool high) +{ +u32 val, inst_index; + + inst_index =REG_GET_FIELD (data,GRBM_GFX_INDEX ,INSTANCE_INDEX ); + +if (high) + val = inst_index >>5 ; +else + val =REG_GET_FIELD (data,GRBM_GFX_INDEX ,SE_BROADCAST_WRITES ) <<18 | +REG_GET_FIELD (data,GRBM_GFX_INDEX ,SA_BROADCAST_WRITES ) <<19 | +REG_GET_FIELD (data,GRBM_GFX_INDEX ,INSTANCE_BROADCAST_WRITES ) <<20 | +REG_GET_FIELD (data,GRBM_GFX_INDEX ,SE_INDEX ) <<21 | +REG_GET_FIELD (data,GRBM_GFX_INDEX ,SA_INDEX ) <<25 | + (inst_index &0x1f ); + +return val; +} + +static void program_imu_rlc_ram (struct amdgpu_device *adev, +const u32 *regs, +const u32 array_size) +{ +u32 reg, data, val_h =0 , val_l =TRANSFER_RAM_MASK ; +int i; + +if (array_size %3 ) +return ; + +for (i =0 ; i < array_size; i +=3 ) { + reg = regs[i +0 ]; + data = regs[i +2 ]; +if (reg ==SOC15_REG_OFFSET (GC ,0 , regGRBM_GFX_INDEX)) { + val_l =imu_v12_0_grbm_gfx_index_remap (adev, data, false); + val_h =imu_v12_0_grbm_gfx_index_remap (adev, data, true); + }else { +WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_ADDR_HIGH, val_h); +WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_ADDR_LOW, reg | val_l); +WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_DATA, data); + } + } }static void imu_v12_0_program_rlc_ram (struct amdgpu_device *adev) { -u32 reg_data; +u32 reg_data, size; +const u32 *data; +int r = -EINVAL ;WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_INDEX,0x2 );switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (12 ,0 ,1 ): -program_imu_rlc_ram (adev, imu_rlc_ram_golden_12_0_1, +if (!r) +program_imu_rlc_ram (adev, data, (const u32 )size); +else +program_imu_rlc_ram_old (adev, imu_rlc_ram_golden_12_0_1, (const u32 )ARRAY_SIZE (imu_rlc_ram_golden_12_0_1));break ;default :
@@ -293,6 +340,11 @@ static void imu_v12_0_program_rlc_ram(struct amdgpu_device *adev)break ; } +//Indicate the latest entry +WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_ADDR_HIGH,0 ); +WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_ADDR_LOW,0 ); +WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_DATA,0 ); + reg_data =RREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_INDEX); reg_data |=GFX_IMU_RLC_RAM_INDEX__RAM_VALID_MASK ;WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_INDEX, reg_data);
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 26/31 drm/amdgpu: fix active rb and cu number for gfx12
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Correct the algorithm of active CU and RB to bypass the disabled SA for gfx12.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 81 +++++++++++++++++--------- 1 file changed, 55 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +55 -26
@@ -1354,44 +1354,70 @@ static void gfx_v12_0_select_se_sh(struct amdgpu_device *adev, u32 se_num,WREG32_SOC15 (GC ,0 , regGRBM_GFX_INDEX, data); } -static u32 gfx_v12_0_get_rb_active_bitmap (struct amdgpu_device *adev) +static u32 gfx_v12_0_get_sa_active_bitmap (struct amdgpu_device *adev) { -u32 data, mask; +u32 gc_disabled_sa_mask, gc_user_disabled_sa_mask, sa_mask; - data =RREG32_SOC15 (GC ,0 , regCC_RB_BACKEND_DISABLE); - data |=RREG32_SOC15 (GC ,0 , regGC_USER_RB_BACKEND_DISABLE); + gc_disabled_sa_mask =RREG32_SOC15 (GC ,0 , regGRBM_CC_GC_SA_UNIT_DISABLE); + gc_disabled_sa_mask =REG_GET_FIELD (gc_disabled_sa_mask, +GRBM_CC_GC_SA_UNIT_DISABLE , +SA_DISABLE ); + gc_user_disabled_sa_mask =RREG32_SOC15 (GC ,0 , regGRBM_GC_USER_SA_UNIT_DISABLE); + gc_user_disabled_sa_mask =REG_GET_FIELD (gc_user_disabled_sa_mask, +GRBM_GC_USER_SA_UNIT_DISABLE , +SA_DISABLE ); + sa_mask =amdgpu_gfx_create_bitmask (adev->gfx.config.max_sh_per_se * + adev->gfx.config.max_shader_engines); - data &=CC_RB_BACKEND_DISABLE__BACKEND_DISABLE_MASK ; - data >>=GC_USER_RB_BACKEND_DISABLE__BACKEND_DISABLE__SHIFT ; +return sa_mask & (~(gc_disabled_sa_mask | gc_user_disabled_sa_mask)); +} - mask =amdgpu_gfx_create_bitmask (adev->gfx.config.max_backends_per_se / - adev->gfx.config.max_sh_per_se); +static u32 gfx_v12_0_get_rb_active_bitmap (struct amdgpu_device *adev) +{ +u32 gc_disabled_rb_mask, gc_user_disabled_rb_mask; +u32 rb_mask; -return (~data) & mask; + gc_disabled_rb_mask =RREG32_SOC15 (GC ,0 , regCC_RB_BACKEND_DISABLE); + gc_disabled_rb_mask =REG_GET_FIELD (gc_disabled_rb_mask, +CC_RB_BACKEND_DISABLE , +BACKEND_DISABLE ); + gc_user_disabled_rb_mask =RREG32_SOC15 (GC ,0 , regGC_USER_RB_BACKEND_DISABLE); + gc_user_disabled_rb_mask =REG_GET_FIELD (gc_user_disabled_rb_mask, +GC_USER_RB_BACKEND_DISABLE , +BACKEND_DISABLE ); + rb_mask =amdgpu_gfx_create_bitmask (adev->gfx.config.max_backends_per_se * + adev->gfx.config.max_shader_engines); + +return rb_mask & (~(gc_disabled_rb_mask | gc_user_disabled_rb_mask)); }static void gfx_v12_0_setup_rb (struct amdgpu_device *adev) { -int i, j; -u32 data; -u32 active_rbs =0 ; -u32 rb_bitmap_width_per_sh = adev->gfx.config.max_backends_per_se / - adev->gfx.config.max_sh_per_se; +u32 rb_bitmap_width_per_sa; +u32 max_sa; +u32 active_sa_bitmap; +u32 global_active_rb_bitmap; +u32 active_rb_bitmap =0 ; +u32 i; -mutex_lock (&adev->grbm_idx_mutex); -for (i =0 ; i < adev->gfx.config.max_shader_engines; i++) { -for (j =0 ; j < adev->gfx.config.max_sh_per_se; j++) { -gfx_v12_0_select_se_sh (adev, i, j,0xffffffff ,0 ); - data =gfx_v12_0_get_rb_active_bitmap (adev); - active_rbs |= data << ((i * adev->gfx.config.max_sh_per_se + j) * - rb_bitmap_width_per_sh); - } +/* query sa bitmap from SA_UNIT_DISABLE registers */ + active_sa_bitmap =gfx_v12_0_get_sa_active_bitmap (adev); +/* query rb bitmap from RB_BACKEND_DISABLE registers */ + global_active_rb_bitmap =gfx_v12_0_get_rb_active_bitmap (adev); + +/* generate active rb bitmap according to active sa bitmap */ + max_sa = adev->gfx.config.max_shader_engines * + adev->gfx.config.max_sh_per_se; + rb_bitmap_width_per_sa = adev->gfx.config.max_backends_per_se / + adev->gfx.config.max_sh_per_se; +for (i =0 ; i < max_sa; i++) { +if (active_sa_bitmap & (1 << i)) + active_rb_bitmap |= (0x3 << (i * rb_bitmap_width_per_sa)); } -gfx_v12_0_select_se_sh (adev,0xffffffff ,0xffffffff ,0xffffffff ,0 ); -mutex_unlock (&adev->grbm_idx_mutex); - adev->gfx.config.backend_enable_mask = active_rbs; - adev->gfx.config.num_rbs =hweight32 (active_rbs); + active_rb_bitmap |= global_active_rb_bitmap; + adev->gfx.config.backend_enable_mask = active_rb_bitmap; + adev->gfx.config.num_rbs =hweight32 (active_rb_bitmap); }#define LDS_APP_BASE 0x1
@@ -4832,6 +4858,9 @@ static int gfx_v12_0_get_cu_info(struct amdgpu_device *adev,mutex_lock (&adev->grbm_idx_mutex);for (i =0 ; i < adev->gfx.config.max_shader_engines; i++) {for (j =0 ; j < adev->gfx.config.max_sh_per_se; j++) { + bitmap = i * adev->gfx.config.max_sh_per_se + j; +if (!((gfx_v12_0_get_sa_active_bitmap (adev) >> bitmap) &1 )) +continue ; mask =1 ; counter =0 ;gfx_v12_0_select_se_sh (adev, i, j,0xffffffff ,0 );
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 27/31 drm/amdgpu: skip dpm check to init imu fw
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Skip dpm check to init imu firmware for imu v12.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +1 -1
@@ -461,7 +461,7 @@ static int gfx_v12_0_init_microcode(struct amdgpu_device *adev)/* only one MEC for gfx 12 */ adev->gfx.mec2_fw =NULL ; -if (adev->gfx.imu.funcs && (amdgpu_dpm >0 )) { +if (adev->gfx.imu.funcs) {if (adev->gfx.imu.funcs->init_microcode) { err = adev->gfx.imu.funcs->init_microcode (adev);if (err)
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 28/31 drm/amdgpu: init gfxhub setting to align with mmhub
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Align gfxhub settings with mmhub when program rlc ram.
--- drivers/gpu/drm/amd/amdgpu/imu_v12_0.c | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
drivers/gpu/drm/amd/amdgpu/imu_v12_0.c +39 -0
@@ -30,6 +30,7 @@#include "gc/gc_12_0_0_offset.h" #include "gc/gc_12_0_0_sh_mask.h" +#include "mmhub/mmhub_4_1_0_offset.h" MODULE_FIRMWARE ("amdgpu/gc_12_0_1_imu.bin" );
@@ -295,6 +296,43 @@ static u32 imu_v12_0_grbm_gfx_index_remap(struct amdgpu_device *adev,return val; } +static u32 imu_v12_init_gfxhub_settings (struct amdgpu_device *adev, +u32 reg,u32 data) +{ +if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_FB_LOCATION_BASE)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_FB_LOCATION_BASE); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_FB_LOCATION_TOP)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_FB_LOCATION_TOP); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_FB_OFFSET)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_FB_OFFSET); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_AGP_BASE)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_BASE); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_AGP_BOT)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_BOT); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_AGP_TOP)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_TOP); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_MX_L1_TLB_CNTL)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_MX_L1_TLB_CNTL); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_SYSTEM_APERTURE_LOW_ADDR)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_SYSTEM_APERTURE_LOW_ADDR); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_SYSTEM_APERTURE_HIGH_ADDR)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_SYSTEM_APERTURE_HIGH_ADDR); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_LOCAL_FB_ADDRESS_START)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_LOCAL_FB_ADDRESS_START); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_LOCAL_FB_ADDRESS_END)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_LOCAL_FB_ADDRESS_END); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_LOCAL_SYSMEM_ADDRESS_START)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_LOCAL_SYSMEM_ADDRESS_START); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_LOCAL_SYSMEM_ADDRESS_END)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_LOCAL_SYSMEM_ADDRESS_END); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB); +else if (reg ==SOC15_REG_OFFSET (GC ,0 , regGCMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB)) +return RREG32_SOC15 (MMHUB ,0 , regMMMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB); +else +return data; +} +static void program_imu_rlc_ram (struct amdgpu_device *adev,const u32 *regs,const u32 array_size)
@@ -308,6 +346,7 @@ static void program_imu_rlc_ram(struct amdgpu_device *adev,for (i =0 ; i < array_size; i +=3 ) { reg = regs[i +0 ]; data = regs[i +2 ]; + data =imu_v12_init_gfxhub_settings (adev, reg, data);if (reg ==SOC15_REG_OFFSET (GC ,0 , regGRBM_GFX_INDEX)) { val_l =imu_v12_0_grbm_gfx_index_remap (adev, data, false); val_h =imu_v12_0_grbm_gfx_index_remap (adev, data, true);
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 29/31 drm/amdgpu: Switch to smuio func to get gpu clk counter
In reply to Alex DeucherFrom: Hawking Zhang <[email protected]>
Switch to smuio callback to query gpu clock counter
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +6 -8
@@ -36,8 +36,6 @@#include "gc/gc_12_0_0_offset.h" #include "gc/gc_12_0_0_sh_mask.h" -#include "smuio/smuio_14_0_2_offset.h" -#include "smuio/smuio_14_0_2_sh_mask.h" #include "soc24_enum.h" #include "ivsrcid/gfx/irqsrcs_gfx_11_0_0.h"
@@ -3469,12 +3467,12 @@ static uint64_t gfx_v12_0_get_gpu_clock_counter(struct amdgpu_device *adev) {uint64_t clock; -amdgpu_gfx_off_ctrl (adev, false); -mutex_lock (&adev->gfx.gpu_clock_mutex); - clock = (uint64_t )RREG32_SOC15 (SMUIO ,0 , regGOLDEN_TSC_COUNT_LOWER) | - ((uint64_t )RREG32_SOC15 (SMUIO ,0 , regGOLDEN_TSC_COUNT_UPPER) <<32ULL ); -mutex_unlock (&adev->gfx.gpu_clock_mutex); -amdgpu_gfx_off_ctrl (adev, true); +if (adev->smuio.funcs && + adev->smuio.funcs->get_gpu_clock_counter) + clock = adev->smuio.funcs->get_gpu_clock_counter (adev); +else +dev_warn (adev->dev,"query gpu clock counter is not supported\n" ); +return clock; }
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 30/31 drm/amdgpu: Enable unmapped doorbell handling basic mode on mes 12
In reply to Alex DeucherFrom: shaoyunl <[email protected]>
Enable basic mode handling for doorbell ring on unmapped CP queue. In this mode, MES can start schedule the queue mapping based on HW interrupt instead of timer.
--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 16 +++++++++++++++- drivers/gpu/drm/amd/include/mes_v12_api_def.h | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +15 -1
@@ -394,7 +394,14 @@ static int mes_v12_0_set_hw_resources(struct amdgpu_mes *mes) mes_set_hw_res_pkt.disable_mes_log =1 ; mes_set_hw_res_pkt.use_different_vmid_compute =1 ; mes_set_hw_res_pkt.enable_reg_active_poll =1 ; - mes_set_hw_res_pkt.oversubscription_timer =50 ; + +/* +* No need to enable oversubscribe timer when we have unmapped doorbell +* handling support. +* handling mode - 0: disabled; 1: basic version; 2: basic+ version +*/ + mes_set_hw_res_pkt.oversubscription_timer =0 ; + mes_set_hw_res_pkt.unmapped_doorbell_handling =1 ; return mes_v12_0_submit_pkt_and_poll_completion(mes, &mes_set_hw_res_pkt, sizeof(mes_set_hw_res_pkt),
@@ -831,6 +838,13 @@ static int mes_v12_0_mqd_init(struct amdgpu_ring *ring) mqd->cp_hqd_iq_timer = regCP_HQD_IQ_TIMER_DEFAULT; mqd->cp_hqd_quantum = regCP_HQD_QUANTUM_DEFAULT; +/* +* Set CP_HQD_GFX_CONTROL.DB_UPDATED_MSG_EN[15] to enable unmapped +* doorbell handling. This is a reserved CP internal register can +* not be accesss by others +*/ + mqd->reserved_184 =BIT (15 ); +return 0 ; }
drivers/gpu/drm/amd/include/mes_v12_api_def.h +2 -1
@@ -238,7 +238,8 @@ union MESAPI_SET_HW_RESOURCES { uint32_t send_write_data : 1; uint32_t os_tdr_timeout_override : 1; uint32_t use_rs64mem_for_proc_gang_ctx : 1; - uint32_t reserved : 17; + uint32_t unmapped_doorbell_handling: 2; + uint32_t reserved : 15; };uint32_t uint32_all; };
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 31/31 drm/amdgpu: Enable event log on MES 12
In reply to Alex DeucherFrom: shaoyunl <[email protected]>
Enable event log through the HW specific FW API
--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +4 -0
@@ -403,6 +403,10 @@ static int mes_v12_0_set_hw_resources(struct amdgpu_mes *mes) mes_set_hw_res_pkt.oversubscription_timer =0 ; mes_set_hw_res_pkt.unmapped_doorbell_handling =1 ; + + mes_set_hw_res_pkt.enable_mes_event_int_logging =1 ; + mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr = mes->event_log_gpu_addr; +return mes_v12_0_submit_pkt_and_poll_completion (mes, &mes_set_hw_res_pkt,sizeof (mes_set_hw_res_pkt), offsetof(union MESAPI_SET_HW_RESOURCES , api_status));
Signature · 1 line
2.44.0