drm/amdgpu: Add new members for sdma v7_0 fw
Subsystems (2)
Alex Deucher
maintainerPATCH 1/7 drm/amdgpu: Add new members for sdma v7_0 fw
From: Likun Gao <[email protected]>
Add new members in sdma instance structure for sdma v7_0 firmware.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +4 -0
@@ -60,6 +60,10 @@ struct amdgpu_sdma_instance {struct amdgpu_ring page;bool burst_nop;uint32_t aid_id; + +struct amdgpu_bo *sdma_fw_obj; +uint64_t sdma_fw_gpu_addr; +uint32_t *sdma_fw_ptr; };enum amdgpu_sdma_ras_memory_id {
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 2/7 drm/amdgpu: Add sdma fw v3 structure
From: Likun Gao <[email protected]>
Add sdma firmware struct version 3 to support
sdma v7_0 firmware.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 9 +++++++++ 2 files changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +6 -0
@@ -323,6 +323,12 @@ void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr)DRM_DEBUG ("ctl_ucode_offset: %u\n" ,le32_to_cpu (sdma_hdr->ctl_ucode_offset));DRM_DEBUG ("ctl_jt_offset: %u\n" ,le32_to_cpu (sdma_hdr->ctl_jt_offset));DRM_DEBUG ("ctl_jt_size: %u\n" ,le32_to_cpu (sdma_hdr->ctl_jt_size)); + }else if (version_major ==3 ) { +const struct sdma_firmware_header_v3_0 *sdma_hdr = + container_of(hdr, struct sdma_firmware_header_v3_0, header); + +DRM_DEBUG ("ucode_reversion: %u\n" , +le32_to_cpu (sdma_hdr->ucode_feature_version)); }else {DRM_ERROR ("Unknown SDMA ucode version: %u.%u\n" , version_major, version_minor);
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +9 -0
@@ -346,6 +346,14 @@ struct umsch_mm_firmware_header_v1_0 {uint32_t umsch_mm_data_start_addr_hi; }; +/* version_major=3, version_minor=0 */ +struct sdma_firmware_header_v3_0 { +struct common_firmware_header header; +uint32_t ucode_feature_version; +uint32_t ucode_offset_bytes; +uint32_t ucode_size_bytes; +}; +/* gpu info payload */ struct gpu_info_firmware_v1_0 {uint32_t gc_num_se;
@@ -431,6 +439,7 @@ union amdgpu_firmware_header {struct sdma_firmware_header_v1_0 sdma;struct sdma_firmware_header_v1_1 sdma_v1_1;struct sdma_firmware_header_v2_0 sdma_v2_0; +struct sdma_firmware_header_v3_0 sdma_v3_0;struct gpu_info_firmware_header_v1_0 gpu_info;struct dmcu_firmware_header_v1_0 dmcu;struct dmcub_firmware_header_v1_0 dmcub;
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 3/7 drm/amdgpu: Add sdma v7_0 ip block support (v7)
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
v1: Add sdma v7_0 ip block support. (Likun)
v2: Move vmhub from ring_funcs to ring. (Hawking)
v3: Switch to AMDGPU_GFXHUB(0). (Hawking)
v4: Move microcode init into early_init. (Likun)
v5: Fix warnings (Alex)
v6: Squash in various fixes (Alex)
v7: Rebase (Alex)
v8: Rebase (Alex)
--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 6 + drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 1630 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/sdma_v7_0.h | 30 + 4 files changed, 1668 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c create mode 100644 drivers/gpu/drm/amd/amdgpu/sdma_v7_0.h
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
@@ -179,7 +179,8 @@ amdgpu-y += \ sdma_v4_4_2.o \ sdma_v5_0.o \ sdma_v5_2.o \ - sdma_v6_0.o + sdma_v6_0.o \ + sdma_v7_0.o # add MES block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +6 -0
@@ -158,6 +158,7 @@ static int amdgpu_sdma_init_inst_ctx(struct amdgpu_sdma_instance *sdma_inst)const struct common_firmware_header *header =NULL ;const struct sdma_firmware_header_v1_0 *hdr;const struct sdma_firmware_header_v2_0 *hdr_v2; +const struct sdma_firmware_header_v3_0 *hdr_v3; header = (const struct common_firmware_header *) sdma_inst->fw->data;
@@ -174,6 +175,11 @@ static int amdgpu_sdma_init_inst_ctx(struct amdgpu_sdma_instance *sdma_inst) sdma_inst->fw_version =le32_to_cpu (hdr_v2->header.ucode_version); sdma_inst->feature_version =le32_to_cpu (hdr_v2->ucode_feature_version);break ; +case 3 : + hdr_v3 = (const struct sdma_firmware_header_v3_0 *)sdma_inst->fw->data; + sdma_inst->fw_version =le32_to_cpu (hdr_v3->header.ucode_version); + sdma_inst->feature_version =le32_to_cpu (hdr_v3->ucode_feature_version); +break ;default :return -EINVAL ; }
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c new file +1630 -0
1,630 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* 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 __SDMA_V7_0_H__ +#define __SDMA_V7_0_H__ + +extern const struct amd_ip_funcs sdma_v7_0_ip_funcs; +extern const struct amdgpu_ip_block_version sdma_v7_0_ip_block; + +#endif /* __SDMA_V7_0_H__ */
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 4/7 drm/amdgpu/sdma7: set sdma hang watchdog
In reply to Alex DeucherFrom: Jack Xiao <[email protected]>
Set SDMAx_WATCHDOG_CNTL.QUEUE_HANG_COUNT registers to improve SDMA reliability.
--- drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +7 -0
@@ -527,6 +527,13 @@ static int sdma_v7_0_gfx_resume(struct amdgpu_device *adev)/* set minor_ptr_update to 0 after wptr programed */ WREG32_SOC15_IP (GC ,sdma_v7_0_get_reg_offset (adev, i, regSDMA0_QUEUE0_MINOR_PTR_UPDATE),0 ); +/* Set up sdma hang watchdog */ + tmp =RREG32_SOC15_IP (GC ,sdma_v7_0_get_reg_offset (adev, i, regSDMA0_WATCHDOG_CNTL)); +/* 100ms per unit */ + tmp =REG_SET_FIELD (tmp,SDMA0_WATCHDOG_CNTL ,QUEUE_HANG_COUNT , +max (adev->usec_timeout/100000 ,1 )); +WREG32_SOC15_IP (GC ,sdma_v7_0_get_reg_offset (adev, i, regSDMA0_WATCHDOG_CNTL), tmp); +/* Set up RESP_MODE to non-copy addresses */ tmp =RREG32_SOC15_IP (GC ,sdma_v7_0_get_reg_offset (adev, i, regSDMA0_UTCL1_CNTL)); tmp =REG_SET_FIELD (tmp,SDMA0_UTCL1_CNTL ,RESP_MODE ,3 );
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 5/7 drm/amdgpu: support SDMA v3 struct fw front door load
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Add support for new SDMA firmware struct (V3) with PSP front door load type.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 7 +++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 + 4 files changed, 19 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
@@ -2464,6 +2464,7 @@ static int psp_get_fw_type(struct amdgpu_firmware_info *ucode, *type =GFX_FW_TYPE_DMUB ;break ;case AMDGPU_UCODE_ID_SDMA_UCODE_TH0 : +case AMDGPU_UCODE_ID_SDMA_RS64 : *type =GFX_FW_TYPE_SDMA_UCODE_TH0 ;break ;case AMDGPU_UCODE_ID_SDMA_UCODE_TH1 :
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +10 -0
@@ -212,6 +212,7 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,const struct common_firmware_header *header =NULL ;int err, i;const struct sdma_firmware_header_v2_0 *sdma_hdr; +const struct sdma_firmware_header_v3_0 *sdma_hv3;uint16_t version_major;char ucode_prefix[30 ];char fw_name[52 ];
@@ -287,6 +288,15 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev, adev->firmware.fw_size +=ALIGN (le32_to_cpu (sdma_hdr->ctl_ucode_size_bytes),PAGE_SIZE );break ; +case 3 : + sdma_hv3 = (const struct sdma_firmware_header_v3_0 *) + adev->sdma.instance[0 ].fw->data; + info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA_RS64 ]; + info->ucode_id =AMDGPU_UCODE_ID_SDMA_RS64 ; + info->fw = adev->sdma.instance[0 ].fw; + adev->firmware.fw_size += +ALIGN (le32_to_cpu (sdma_hv3->ucode_size_bytes),PAGE_SIZE ); +break ;default : err = -EINVAL ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +7 -0
@@ -797,6 +797,7 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev,const struct dmcub_firmware_header_v1_0 *dmcub_hdr =NULL ;const struct mes_firmware_header_v1_0 *mes_hdr =NULL ;const struct sdma_firmware_header_v2_0 *sdma_hdr =NULL ; +const struct sdma_firmware_header_v3_0 *sdmav3_hdr =NULL ;const struct imu_firmware_header_v1_0 *imu_hdr =NULL ;const struct vpe_firmware_header_v1_0 *vpe_hdr =NULL ;const struct umsch_mm_firmware_header_v1_0 *umsch_mm_hdr =NULL ;
@@ -818,6 +819,7 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev, dmcub_hdr = (const struct dmcub_firmware_header_v1_0 *)ucode->fw->data; mes_hdr = (const struct mes_firmware_header_v1_0 *)ucode->fw->data; sdma_hdr = (const struct sdma_firmware_header_v2_0 *)ucode->fw->data; + sdmav3_hdr = (const struct sdma_firmware_header_v3_0 *)ucode->fw->data; imu_hdr = (const struct imu_firmware_header_v1_0 *)ucode->fw->data; vpe_hdr = (const struct vpe_firmware_header_v1_0 *)ucode->fw->data; umsch_mm_hdr = (const struct umsch_mm_firmware_header_v1_0 *)ucode->fw->data;
@@ -834,6 +836,11 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev, ucode_addr = (u8 *)ucode->fw->data +le32_to_cpu (sdma_hdr->ctl_ucode_offset);break ; +case AMDGPU_UCODE_ID_SDMA_RS64 : + ucode->ucode_size =le32_to_cpu (sdmav3_hdr->ucode_size_bytes); + ucode_addr = (u8 *)ucode->fw->data + +le32_to_cpu (sdmav3_hdr->header.ucode_array_offset_bytes); +break ;case AMDGPU_UCODE_ID_CP_MEC1 :case AMDGPU_UCODE_ID_CP_MEC2 : ucode->ucode_size = le32_to_cpu(header->ucode_size_bytes) -
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +1 -0
@@ -464,6 +464,7 @@ enum AMDGPU_UCODE_ID {AMDGPU_UCODE_ID_SDMA7 ,AMDGPU_UCODE_ID_SDMA_UCODE_TH0 ,AMDGPU_UCODE_ID_SDMA_UCODE_TH1 , +AMDGPU_UCODE_ID_SDMA_RS64 ,AMDGPU_UCODE_ID_CP_CE ,AMDGPU_UCODE_ID_CP_PFP , AMDGPU_UCODE_ID_CP_ME,
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 6/7 drm/amdgpu: provide more ucode name shown via id
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Provide some lost ucode name shown via firmware ID.
v2: fix whitespace (Alex)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +24 -0
@@ -688,6 +688,30 @@ const char *amdgpu_ucode_name(enum AMDGPU_UCODE_ID ucode_id)return "UMSCH_MM_CMD_BUFFER" ;case AMDGPU_UCODE_ID_JPEG_RAM :return "JPEG" ; +case AMDGPU_UCODE_ID_SDMA_RS64 : +return "RS64_SDMA" ; +case AMDGPU_UCODE_ID_CP_RS64_PFP : +return "RS64_PFP" ; +case AMDGPU_UCODE_ID_CP_RS64_ME : +return "RS64_ME" ; +case AMDGPU_UCODE_ID_CP_RS64_MEC : +return "RS64_MEC" ; +case AMDGPU_UCODE_ID_CP_RS64_PFP_P0_STACK : +return "RS64_PFP_P0_STACK" ; +case AMDGPU_UCODE_ID_CP_RS64_PFP_P1_STACK : +return "RS64_PFP_P1_STACK" ; +case AMDGPU_UCODE_ID_CP_RS64_ME_P0_STACK : +return "RS64_ME_P0_STACK" ; +case AMDGPU_UCODE_ID_CP_RS64_ME_P1_STACK : +return "RS64_ME_P1_STACK" ; +case AMDGPU_UCODE_ID_CP_RS64_MEC_P0_STACK : +return "RS64_MEC_P0_STACK" ; +case AMDGPU_UCODE_ID_CP_RS64_MEC_P1_STACK : +return "RS64_MEC_P1_STACK" ; +case AMDGPU_UCODE_ID_CP_RS64_MEC_P2_STACK : +return "RS64_MEC_P2_STACK" ; +case AMDGPU_UCODE_ID_CP_RS64_MEC_P3_STACK : +return "RS64_MEC_P3_STACK" ;default :return "UNKNOWN UCODE" ; }
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 7/7 drm/amdgpu/discovery: add sdma v7_0 ip block
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Add sdma v7_0 ip block.
v2: squash in updates (Alex)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +5 -0
@@ -79,6 +79,7 @@#include "sdma_v5_0.h" #include "sdma_v5_2.h" #include "sdma_v6_0.h" +#include "sdma_v7_0.h" #include "lsdma_v6_0.h" #include "lsdma_v7_0.h" #include "vcn_v2_0.h"
@@ -2084,6 +2085,10 @@ static int amdgpu_discovery_set_sdma_ip_blocks(struct amdgpu_device *adev)case IP_VERSION (6 ,1 ,1 ):amdgpu_device_ip_block_add (adev, &sdma_v6_0_ip_block);break ; +case IP_VERSION (7 ,0 ,0 ): +case IP_VERSION (7 ,0 ,1 ): +amdgpu_device_ip_block_add (adev, &sdma_v7_0_ip_block); +break ;default : dev_err(adev->dev, "Failed to add sdma ip block(SDMA0_HWIP:0x%x)\n",
Signature · 1 line
2.44.0