drm/amdgpu: Add smuio v15_0_8 support v4
Subsystems (2)
Alex Deucher
maintainerPATCH 2/5 drm/amdgpu: Add smuio v15_0_8 support v4
From: Hawking Zhang <[email protected]>
v15_0_8 is a new generation smuio ip block
v2: Add smuio callbacks for interface id
v3: Add smuio callback to identify custom hbm
v4: comment out unused functions (Alex)
--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h | 3 + drivers/gpu/drm/amd/amdgpu/smuio_v15_0_8.c | 213 +++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/smuio_v15_0_8.h | 30 +++ 4 files changed, 248 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/smuio_v15_0_8.c create mode 100644 drivers/gpu/drm/amd/amdgpu/smuio_v15_0_8.h
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
@@ -244,7 +244,8 @@ amdgpu-y += \ smuio_v13_0.o \ smuio_v13_0_3.o \ smuio_v13_0_6.o \ - smuio_v14_0_2.o + smuio_v14_0_2.o \ + smuio_v15_0_8.o # add reset block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h +3 -0
@@ -27,6 +27,7 @@ enum amdgpu_pkg_type {AMDGPU_PKG_TYPE_APU =2 ,AMDGPU_PKG_TYPE_CEM =3 ,AMDGPU_PKG_TYPE_OAM =4 , +AMDGPU_PKG_TYPE_BB =5 , AMDGPU_PKG_TYPE_UNKNOWN, };
@@ -44,6 +45,8 @@ struct amdgpu_smuio_funcs {u32 (*get_socket_id)(struct amdgpu_device *adev);enum amdgpu_pkg_type (*get_pkg_type)(struct amdgpu_device *adev);bool (*is_host_gpu_xgmi_supported)(struct amdgpu_device *adev); +bool (*is_connected_with_ethernet_switch)(struct amdgpu_device *adev); +bool (*is_custom_hbm_supported)(struct amdgpu_device *adev);u64 (*get_gpu_clock_counter)(struct amdgpu_device *adev); };
drivers/gpu/drm/amd/amdgpu/smuio_v15_0_8.c new file +213 -0
213 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/smuio_v15_0_8.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright 2025 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 __SMUIO_V15_0_8_H__ +#define __SMUIO_V15_0_8_H__ + +#include "soc15_common.h" + +extern const struct amdgpu_smuio_funcs smuio_v15_0_8_funcs; + +#endif /* __SMUIO_V15_0_8_H__ */
Signature · 1 line
2.51.1
Alex Deucher
maintainerPATCH 3/5 drm/amdgpu: Initialize smuio functions for smuio v15_0_8
From: Hawking Zhang <[email protected]>
Add initialization for smuio funcs specific to v15.0.8
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +4 -0
@@ -103,6 +103,7 @@#include "smuio_v13_0_3.h" #include "smuio_v13_0_6.h" #include "smuio_v14_0_2.h" +#include "smuio_v15_0_8.h" #include "vcn_v5_0_0.h" #include "vcn_v5_0_1.h" #include "jpeg_v5_0_0.h"
@@ -3143,6 +3144,9 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)case IP_VERSION (14 ,0 ,2 ): adev->smuio.funcs = &smuio_v14_0_2_funcs;break ; +case IP_VERSION (15 ,0 ,8 ): + adev->smuio.funcs = &smuio_v15_0_8_funcs; +break ;default :break ; }
Signature · 1 line
2.51.1
Alex Deucher
maintainerPATCH 4/5 drm/amdgpu: Add rlcv firmware for frontdoor loading.
In reply to Alex DeucherFrom: Feifei Xu <[email protected]>
Rlcv is required to be loaded for frontdoor.
1. Add 2 rlcv ucode ids:
AMDGPU_UCODE_RLC_IRAM_1 and AMDGPU_UCODE_RLC_DRAM_1
2. Add rlc_firmware_header_v2_5 for above 2 rlcv headers.
3. Add 2 types in psp_fw_gfx_if interface interacting with asp:
GFX_FW_TYPE_RLX6_UCODE_CORE1 - RLCV IRAM GFX_FW_TYPE_RLX6_DRAM_BOOT_CORE1 - RLCV DRAM BOOT
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 8 +++++ drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c | 37 ++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h | 4 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 34 +++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 12 ++++++++ drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h | 2 ++ 6 files changed, 96 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +8 -0
@@ -2719,6 +2719,12 @@ static int psp_get_fw_type(struct amdgpu_firmware_info *ucode,case AMDGPU_UCODE_ID_RLC_DRAM : *type =GFX_FW_TYPE_RLC_DRAM_BOOT ;break ; +case AMDGPU_UCODE_ID_RLC_IRAM_1 : + *type =GFX_FW_TYPE_RLX6_UCODE_CORE1 ; +break ; +case AMDGPU_UCODE_ID_RLC_DRAM_1 : + *type =GFX_FW_TYPE_RLX6_DRAM_BOOT_CORE1 ; +break ;case AMDGPU_UCODE_ID_GLOBAL_TAP_DELAYS : *type =GFX_FW_TYPE_GLOBAL_TAP_DELAYS ;break ;
@@ -2887,6 +2893,8 @@ static void psp_print_fw_hdr(struct psp_context *psp,amdgpu_ucode_print_gfx_hdr (hdr);break ;case AMDGPU_UCODE_ID_RLC_G : +case AMDGPU_UCODE_ID_RLC_DRAM_1 : +case AMDGPU_UCODE_ID_RLC_IRAM_1 : hdr = (struct common_firmware_header *)adev->gfx.rlc_fw->data;amdgpu_ucode_print_rlc_hdr (hdr);break ;
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c +36 -1
@@ -515,6 +515,40 @@ static void amdgpu_gfx_rlc_init_microcode_v2_4(struct amdgpu_device *adev) } } +static void amdgpu_gfx_rlc_init_microcode_v2_5 (struct amdgpu_device *adev) +{ +const struct rlc_firmware_header_v2_5 *rlc_hdr; +struct amdgpu_firmware_info *info; + + rlc_hdr = (const struct rlc_firmware_header_v2_5 *)adev->gfx.rlc_fw->data; + adev->gfx.rlc.rlc_1_iram_ucode_size_bytes = +le32_to_cpu (rlc_hdr->rlc_1_iram_ucode_size_bytes); + adev->gfx.rlc.rlc_1_iram_ucode = (u8 *)rlc_hdr + +le32_to_cpu (rlc_hdr->rlc_1_iram_ucode_offset_bytes); + adev->gfx.rlc.rlc_1_dram_ucode_size_bytes = +le32_to_cpu (rlc_hdr->rlc_1_dram_ucode_size_bytes); + adev->gfx.rlc.rlc_1_dram_ucode = (u8 *)rlc_hdr + +le32_to_cpu (rlc_hdr->rlc_1_dram_ucode_offset_bytes); + +if (adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) { +if (adev->gfx.rlc.rlc_1_iram_ucode_size_bytes) { + info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_IRAM_1 ]; + info->ucode_id =AMDGPU_UCODE_ID_RLC_IRAM_1 ; + info->fw = adev->gfx.rlc_fw; + adev->firmware.fw_size += +ALIGN (adev->gfx.rlc.rlc_1_iram_ucode_size_bytes,PAGE_SIZE ); + } + +if (adev->gfx.rlc.rlc_1_dram_ucode_size_bytes) { + info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_DRAM_1 ]; + info->ucode_id =AMDGPU_UCODE_ID_RLC_DRAM_1 ; + info->fw = adev->gfx.rlc_fw; + adev->firmware.fw_size += +ALIGN (adev->gfx.rlc.rlc_1_dram_ucode_size_bytes,PAGE_SIZE ); + } + } +} +int amdgpu_gfx_rlc_init_microcode (struct amdgpu_device *adev,uint16_t version_major,uint16_t version_minor)
@@ -545,6 +579,7 @@ int amdgpu_gfx_rlc_init_microcode(struct amdgpu_device *adev,amdgpu_gfx_rlc_init_microcode_v2_3 (adev);if (version_minor ==4 )amdgpu_gfx_rlc_init_microcode_v2_4 (adev); - +if (version_minor ==5 ) +amdgpu_gfx_rlc_init_microcode_v2_5 (adev);return 0 ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h +4 -0
@@ -311,6 +311,8 @@ struct amdgpu_rlc {u32 save_restore_list_srm_size_bytes;u32 rlc_iram_ucode_size_bytes;u32 rlc_dram_ucode_size_bytes; +u32 rlc_1_iram_ucode_size_bytes; +u32 rlc_1_dram_ucode_size_bytes;u32 rlcp_ucode_size_bytes;u32 rlcv_ucode_size_bytes;u32 global_tap_delays_ucode_size_bytes;
@@ -326,6 +328,8 @@ struct amdgpu_rlc {u8 *save_restore_list_srm;u8 *rlc_iram_ucode;u8 *rlc_dram_ucode; +u8 *rlc_1_iram_ucode; +u8 *rlc_1_dram_ucode;u8 *rlcp_ucode;u8 *rlcv_ucode;u8 *global_tap_delays_ucode;
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +34 -0
@@ -166,6 +166,8 @@ void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr) container_of(rlc_hdr_v2_2, struct rlc_firmware_header_v2_3, v2_2);const struct rlc_firmware_header_v2_4 *rlc_hdr_v2_4 = container_of(rlc_hdr_v2_3, struct rlc_firmware_header_v2_4, v2_3); +const struct rlc_firmware_header_v2_5 *rlc_hdr_v2_5 = + container_of(rlc_hdr_v2_2, struct rlc_firmware_header_v2_5, v2_2);switch (version_minor) {case 0 :
@@ -287,6 +289,26 @@ void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr)DRM_DEBUG ("se3_tap_delays_ucode_offset_bytes: %u\n" ,le32_to_cpu (rlc_hdr_v2_4->se3_tap_delays_ucode_offset_bytes));break ; +case 5 : +/* rlc_hdr v2_5 */ +DRM_INFO ("rlc_iram_ucode_size_bytes: %u\n" , +le32_to_cpu (rlc_hdr_v2_5->v2_2.rlc_iram_ucode_size_bytes)); +DRM_INFO ("rlc_iram_ucode_offset_bytes: %u\n" , +le32_to_cpu (rlc_hdr_v2_5->v2_2.rlc_iram_ucode_offset_bytes)); +DRM_INFO ("rlc_dram_ucode_size_bytes: %u\n" , +le32_to_cpu (rlc_hdr_v2_5->v2_2.rlc_dram_ucode_size_bytes)); +DRM_INFO ("rlc_dram_ucode_offset_bytes: %u\n" , +le32_to_cpu (rlc_hdr_v2_5->v2_2.rlc_dram_ucode_offset_bytes)); +/* rlc_hdr v2_5 */ +DRM_INFO ("rlc_1_iram_ucode_size_bytes: %u\n" , +le32_to_cpu (rlc_hdr_v2_5->rlc_1_iram_ucode_size_bytes)); +DRM_INFO ("rlc_1_iram_ucode_offset_bytes: %u\n" , +le32_to_cpu (rlc_hdr_v2_5->rlc_1_iram_ucode_offset_bytes)); +DRM_INFO ("rlc_1_dram_ucode_size_bytes: %u\n" , +le32_to_cpu (rlc_hdr_v2_5->rlc_1_dram_ucode_size_bytes)); +DRM_INFO ("rlc_1_dram_ucode_offset_bytes: %u\n" , +le32_to_cpu (rlc_hdr_v2_5->rlc_1_dram_ucode_offset_bytes)); +break ;default :DRM_ERROR ("Unknown RLC v2 ucode: v2.%u\n" , version_minor);break ;
@@ -631,6 +653,10 @@ const char *amdgpu_ucode_name(enum AMDGPU_UCODE_ID ucode_id)return "RLC_IRAM" ;case AMDGPU_UCODE_ID_RLC_DRAM :return "RLC_DRAM" ; +case AMDGPU_UCODE_ID_RLC_IRAM_1 : +return "RLC_IRAM_1" ; +case AMDGPU_UCODE_ID_RLC_DRAM_1 : +return "RLC_DRAM_1" ;case AMDGPU_UCODE_ID_RLC_G :return "RLC_G" ;case AMDGPU_UCODE_ID_RLC_P :
@@ -911,6 +937,14 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev, ucode->ucode_size = adev->gfx.rlc.rlc_dram_ucode_size_bytes; ucode_addr = adev->gfx.rlc.rlc_dram_ucode;break ; +case AMDGPU_UCODE_ID_RLC_IRAM_1 : + ucode->ucode_size = adev->gfx.rlc.rlc_1_iram_ucode_size_bytes; + ucode_addr = adev->gfx.rlc.rlc_1_iram_ucode; +break ; +case AMDGPU_UCODE_ID_RLC_DRAM_1 : + ucode->ucode_size = adev->gfx.rlc.rlc_1_dram_ucode_size_bytes; + ucode_addr = adev->gfx.rlc.rlc_1_dram_ucode; +break ;case AMDGPU_UCODE_ID_RLC_P : ucode->ucode_size = adev->gfx.rlc.rlcp_ucode_size_bytes; ucode_addr = adev->gfx.rlc.rlcp_ucode;
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +12 -0
@@ -300,6 +300,15 @@ struct rlc_firmware_header_v2_4 {uint32_t se3_tap_delays_ucode_offset_bytes; }; +/* version_major=2, version_minor=5 */ +struct rlc_firmware_header_v2_5 { +struct rlc_firmware_header_v2_2 v2_2; +uint32_t rlc_1_iram_ucode_size_bytes; +uint32_t rlc_1_iram_ucode_offset_bytes; +uint32_t rlc_1_dram_ucode_size_bytes; +uint32_t rlc_1_dram_ucode_offset_bytes; +}; +/* version_major=1, version_minor=0 */ struct sdma_firmware_header_v1_0 {struct common_firmware_header header;
@@ -449,6 +458,7 @@ union amdgpu_firmware_header {struct rlc_firmware_header_v2_2 rlc_v2_2;struct rlc_firmware_header_v2_3 rlc_v2_3;struct rlc_firmware_header_v2_4 rlc_v2_4; +struct rlc_firmware_header_v2_5 rlc_v2_5;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;
@@ -512,6 +522,8 @@ enum AMDGPU_UCODE_ID {AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM ,AMDGPU_UCODE_ID_RLC_IRAM ,AMDGPU_UCODE_ID_RLC_DRAM , +AMDGPU_UCODE_ID_RLC_IRAM_1 , +AMDGPU_UCODE_ID_RLC_DRAM_1 ,AMDGPU_UCODE_ID_RLC_P ,AMDGPU_UCODE_ID_RLC_V , AMDGPU_UCODE_ID_RLC_G,
drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h +2 -0
@@ -299,6 +299,8 @@ enum psp_gfx_fw_type {GFX_FW_TYPE_RS64_MEC_P1_STACK =95 ,/* RS64 MEC stack P1 SOC21 */ GFX_FW_TYPE_RS64_MEC_P2_STACK =96 ,/* RS64 MEC stack P2 SOC21 */ GFX_FW_TYPE_RS64_MEC_P3_STACK =97 ,/* RS64 MEC stack P3 SOC21 */ +GFX_FW_TYPE_RLX6_UCODE_CORE1 =98 ,/* RLCV_IRAM MI */ +GFX_FW_TYPE_RLX6_DRAM_BOOT_CORE1 =99 ,/* RLCV DRAM BOOT MI */ GFX_FW_TYPE_VPEC_FW1 =100 ,/* VPEC FW1 To Save VPE */ GFX_FW_TYPE_VPEC_FW2 =101 ,/* VPEC FW2 To Save VPE */ GFX_FW_TYPE_VPE = 102,
Signature · 1 line
2.51.1
Alex Deucher
maintainerPATCH 5/5 drm/amdgpu: update psp_get_fw_type() function
In reply to Alex DeucherFrom: Feifei Xu <[email protected]>
In psp 14.0.7, mes and sdma GFX_FW_TYPE have been changed.
Define a psp common function: psp_get_fw_type().
Hide the GFX_FW_TYPE Changes in each ip's psp->funcs_get_fw_type callback. (like psp_v14_0_7_get_fw_type()).
If no GFX_FW_TYPE change, reuse the amdgpu_psp_get_fw_type().
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 5 ++--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 8 ++++++++ 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -3
@@ -2631,7 +2631,7 @@ static int psp_hw_start(struct psp_context *psp)return 0 ; } -static int psp_get_fw_type (struct amdgpu_firmware_info *ucode, +int amdgpu_psp_get_fw_type (struct amdgpu_firmware_info *ucode,enum psp_gfx_fw_type *type) {switch (ucode->ucode_id) {
@@ -2919,10 +2919,9 @@ static int psp_prep_load_ip_fw_cmd_buf(struct psp_context *psp, cmd->cmd.cmd_load_ip_fw.fw_phy_addr_hi =upper_32_bits (fw_mem_mc_addr); cmd->cmd.cmd_load_ip_fw.fw_size = ucode->ucode_size; - ret =psp_get_fw_type (ucode, &cmd->cmd.cmd_load_ip_fw.fw_type); + ret =psp_get_fw_type (psp, ucode, &cmd->cmd.cmd_load_ip_fw.fw_type);if (ret)dev_err (psp->adev->dev,"Unknown firmware type\n" ); -return ret; }
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +8 -0
@@ -172,6 +172,8 @@ struct psp_funcs {bool (*is_reload_needed)(struct psp_context *psp);int (*reg_program_no_ring)(struct psp_context *psp,uint32_t val,enum psp_reg_prog_id id); +int (*get_fw_type)(struct amdgpu_firmware_info *ucode, +enum psp_gfx_fw_type *type); };struct ta_funcs {
@@ -524,6 +526,10 @@ struct amdgpu_psp_funcs { ((psp)->funcs->reg_program_no_ring ? \ (psp)->funcs->reg_program_no_ring((psp), val, id) : -EINVAL) +#define psp_get_fw_type (psp, ucode, type) \ + ((psp)->funcs->get_fw_type ? \ + (psp)->funcs->get_fw_type(ucode, type):amdgpu_psp_get_fw_type(ucode, type)) +extern const struct amd_ip_funcs psp_ip_funcs;extern const struct amdgpu_ip_block_version psp_v3_1_ip_block;
@@ -621,6 +627,8 @@ bool amdgpu_psp_tos_reload_needed(struct amdgpu_device *adev);int amdgpu_psp_reg_program_no_ring (struct psp_context *psp,uint32_t val,enum psp_reg_prog_id id);void amdgpu_psp_debugfs_init (struct amdgpu_device *adev); +int amdgpu_psp_get_fw_type (struct amdgpu_firmware_info *ucode, +enum psp_gfx_fw_type *type);#endif
Signature · 1 line
2.51.1