[PATCH] drm/amd/amdgpu: add consistent PSP FW loading size checking

Clements, John John.Clements at amd.com
Wed Jul 21 13:08:55 UTC 2021


[Public]

Reviewed-by: John Clements <John.Clements at amd.com>

________________________________
From: Li, Candice <Candice.Li at amd.com>
Sent: Wednesday, July 21, 2021 8:24 PM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Li, Candice <Candice.Li at amd.com>; Clements, John <John.Clements at amd.com>
Subject: [PATCH] drm/amd/amdgpu: add consistent PSP FW loading size checking


[Public]


Signed-off-by: Candice Li candice.li at amd.com<mailto:candice.li at amd.com>

---

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c   |   8 +-

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c   | 108 ++++++++++++----------

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h   |  32 +++----

drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c |   2 +-

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c  |   2 +-

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c    |   4 +-

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c    |   8 +-

drivers/gpu/drm/amd/amdgpu/psp_v12_0.c    |   4 +-

drivers/gpu/drm/amd/amdgpu/psp_v13_0.c    |   6 +-

drivers/gpu/drm/amd/amdgpu/psp_v3_1.c     |   4 +-

drivers/gpu/drm/amd/amdgpu/soc15.c        |   4 +-

11 files changed, 96 insertions(+), 86 deletions(-)



diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

index 66bf8b0c56bb..c239de0ace4f 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

@@ -373,8 +373,8 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,

                            fw_info->feature = adev->sdma.instance[query_fw->index].feature_version;

                            break;

             case AMDGPU_INFO_FW_SOS:

-                           fw_info->ver = adev->psp.sos_fw_version;

-                           fw_info->feature = adev->psp.sos_feature_version;

+                           fw_info->ver = adev->psp.sos.fw_version;

+                           fw_info->feature = adev->psp.sos.feature_version;

                            break;

             case AMDGPU_INFO_FW_ASD:

                            fw_info->ver = adev->psp.asd_fw_version;

@@ -389,8 +389,8 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,

                            fw_info->feature = 0;

                            break;

             case AMDGPU_INFO_FW_TOC:

-                           fw_info->ver = adev->psp.toc_fw_version;

-                           fw_info->feature = adev->psp.toc_feature_version;

+                           fw_info->ver = adev->psp.toc.fw_version;

+                           fw_info->feature = adev->psp.toc.feature_version;

                            break;

             default:

                            return -EINVAL;

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

index bd079979d5a3..14ade5dfef75 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

@@ -510,9 +510,9 @@ static int psp_load_toc(struct psp_context *psp,

                            return -ENOMEM;

             /* Copy toc to psp firmware private buffer */

             memset(psp->fw_pri_buf, 0, PSP_1_MEG);

-             memcpy(psp->fw_pri_buf, psp->toc_start_addr, psp->toc_bin_size);

+            memcpy(psp->fw_pri_buf, psp->toc.start_addr, psp->toc.size_bytes);

-             psp_prep_load_toc_cmd_buf(cmd, psp->fw_pri_mc_addr, psp->toc_bin_size);

+            psp_prep_load_toc_cmd_buf(cmd, psp->fw_pri_mc_addr, psp->toc.size_bytes);

              ret = psp_cmd_submit_buf(psp, NULL, cmd,

                                                          psp->fence_buf_mc_addr);

@@ -542,8 +542,8 @@ static int psp_tmr_init(struct psp_context *psp)

             /* For ASICs support RLC autoload, psp will parse the toc

              * and calculate the total size of TMR needed */

             if (!amdgpu_sriov_vf(psp->adev) &&

-                 psp->toc_start_addr &&

-                 psp->toc_bin_size &&

+                psp->toc.start_addr &&

+                psp->toc.size_bytes &&

                 psp->fw_pri_buf) {

                            ret = psp_load_toc(psp, &tmr_size);

                            if (ret) {

@@ -722,18 +722,18 @@ static int psp_rl_load(struct amdgpu_device *adev)

             struct psp_context *psp = &adev->psp;

             struct psp_gfx_cmd_resp *cmd = psp->cmd;

-             if (psp->rl_bin_size == 0)

+            if (!is_psp_fw_valid(psp->rl))

                            return 0;

              memset(psp->fw_pri_buf, 0, PSP_1_MEG);

-             memcpy(psp->fw_pri_buf, psp->rl_start_addr, psp->rl_bin_size);

+            memcpy(psp->fw_pri_buf, psp->rl.start_addr, psp->rl.size_bytes);

              memset(cmd, 0, sizeof(struct psp_gfx_cmd_resp));

              cmd->cmd_id = GFX_CMD_ID_LOAD_IP_FW;

             cmd->cmd.cmd_load_ip_fw.fw_phy_addr_lo = lower_32_bits(psp->fw_pri_mc_addr);

             cmd->cmd.cmd_load_ip_fw.fw_phy_addr_hi = upper_32_bits(psp->fw_pri_mc_addr);

-             cmd->cmd.cmd_load_ip_fw.fw_size = psp->rl_bin_size;

+            cmd->cmd.cmd_load_ip_fw.fw_size = psp->rl.size_bytes;

             cmd->cmd.cmd_load_ip_fw.fw_type = GFX_FW_TYPE_REG_LIST;

              return psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);

@@ -2129,7 +2129,7 @@ static int psp_hw_start(struct psp_context *psp)

             int ret;

              if (!amdgpu_sriov_vf(adev)) {

-                           if (psp->kdb_bin_size &&

+                           if ((is_psp_fw_valid(psp->kdb)) &&

                                (psp->funcs->bootloader_load_kdb != NULL)) {

                                          ret = psp_bootloader_load_kdb(psp);

                                          if (ret) {

@@ -2138,7 +2138,8 @@ static int psp_hw_start(struct psp_context *psp)

                                          }

                            }

-                           if (psp->spl_bin_size) {

+                           if ((is_psp_fw_valid(psp->spl)) &&

+                              (psp->funcs->bootloader_load_spl != NULL)) {

                                          ret = psp_bootloader_load_spl(psp);

                                          if (ret) {

                                                         DRM_ERROR("PSP load spl failed!\n");

@@ -2146,16 +2147,22 @@ static int psp_hw_start(struct psp_context *psp)

                                          }

                            }

-                           ret = psp_bootloader_load_sysdrv(psp);

-                           if (ret) {

-                                          DRM_ERROR("PSP load sysdrv failed!\n");

-                                          return ret;

+                           if ((is_psp_fw_valid(psp->sys)) &&

+                               (psp->funcs->bootloader_load_sysdrv != NULL)) {

+                                         ret = psp_bootloader_load_sysdrv(psp);

+                                         if (ret) {

+                                                       DRM_ERROR("PSP load sysdrv failed!\n");

+                                                       return ret;

+                                         }

                            }

-                           ret = psp_bootloader_load_sos(psp);

-                           if (ret) {

-                                          DRM_ERROR("PSP load sos failed!\n");

-                                          return ret;

+                           if ((is_psp_fw_valid(psp->sos)) &&

+                               (psp->funcs->bootloader_load_sos != NULL)) {

+                                         ret = psp_bootloader_load_sos(psp);

+                                         if (ret) {

+                                                       DRM_ERROR("PSP load sos failed!\n");

+                                                       return ret;

+                                         }

                            }

             }

@@ -2997,10 +3004,10 @@ int psp_init_toc_microcode(struct psp_context *psp,

                            goto out;

              toc_hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.toc_fw->data;

-             adev->psp.toc_fw_version = le32_to_cpu(toc_hdr->header.ucode_version);

-             adev->psp.toc_feature_version = le32_to_cpu(toc_hdr->sos.fw_version);

-             adev->psp.toc_bin_size = le32_to_cpu(toc_hdr->header.ucode_size_bytes);

-             adev->psp.toc_start_addr = (uint8_t *)toc_hdr +

+            adev->psp.toc.fw_version = le32_to_cpu(toc_hdr->header.ucode_version);

+            adev->psp.toc.feature_version = le32_to_cpu(toc_hdr->sos.fw_version);

+            adev->psp.toc.size_bytes = le32_to_cpu(toc_hdr->header.ucode_size_bytes);

+            adev->psp.toc.start_addr = (uint8_t *)toc_hdr +

                                                        le32_to_cpu(toc_hdr->header.ucode_array_offset_bytes);

             return 0;

out:

@@ -3021,32 +3028,32 @@ static int psp_init_sos_base_fw(struct amdgpu_device *adev)

                            le32_to_cpu(sos_hdr->header.ucode_array_offset_bytes);

              if (adev->gmc.xgmi.connected_to_cpu || (adev->asic_type != CHIP_ALDEBARAN)) {

-                           adev->psp.sos_fw_version = le32_to_cpu(sos_hdr->header.ucode_version);

-                           adev->psp.sos_feature_version = le32_to_cpu(sos_hdr->sos.fw_version);

+                           adev->psp.sos.fw_version = le32_to_cpu(sos_hdr->header.ucode_version);

+                           adev->psp.sos.feature_version = le32_to_cpu(sos_hdr->sos.fw_version);

-                           adev->psp.sys_bin_size = le32_to_cpu(sos_hdr->sos.offset_bytes);

-                           adev->psp.sys_start_addr = ucode_array_start_addr;

+                           adev->psp.sys.size_bytes = le32_to_cpu(sos_hdr->sos.offset_bytes);

+                           adev->psp.sys.start_addr = ucode_array_start_addr;

-                           adev->psp.sos_bin_size = le32_to_cpu(sos_hdr->sos.size_bytes);

-                           adev->psp.sos_start_addr = ucode_array_start_addr +

+                           adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr->sos.size_bytes);

+                           adev->psp.sos.start_addr = ucode_array_start_addr +

                                                         le32_to_cpu(sos_hdr->sos.offset_bytes);

             } else {

                            /* Load alternate PSP SOS FW */

                            sos_hdr_v1_3 = (const struct psp_firmware_header_v1_3 *)adev->psp.sos_fw->data;

-                           adev->psp.sos_fw_version = le32_to_cpu(sos_hdr_v1_3->sos_aux.fw_version);

-                           adev->psp.sos_feature_version = le32_to_cpu(sos_hdr_v1_3->sos_aux.fw_version);

+                           adev->psp.sos.fw_version = le32_to_cpu(sos_hdr_v1_3->sos_aux.fw_version);

+                           adev->psp.sos.feature_version = le32_to_cpu(sos_hdr_v1_3->sos_aux.fw_version);

-                           adev->psp.sys_bin_size = le32_to_cpu(sos_hdr_v1_3->sys_drv_aux.size_bytes);

-                           adev->psp.sys_start_addr = ucode_array_start_addr +

+                           adev->psp.sys.size_bytes = le32_to_cpu(sos_hdr_v1_3->sys_drv_aux.size_bytes);

+                           adev->psp.sys.start_addr = ucode_array_start_addr +

                                          le32_to_cpu(sos_hdr_v1_3->sys_drv_aux.offset_bytes);

-                           adev->psp.sos_bin_size = le32_to_cpu(sos_hdr_v1_3->sos_aux.size_bytes);

-                           adev->psp.sos_start_addr = ucode_array_start_addr +

+                           adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr_v1_3->sos_aux.size_bytes);

+                           adev->psp.sos.start_addr = ucode_array_start_addr +

                                          le32_to_cpu(sos_hdr_v1_3->sos_aux.offset_bytes);

             }

-             if ((adev->psp.sys_bin_size == 0) || (adev->psp.sos_bin_size == 0)) {

+            if ((adev->psp.sys.size_bytes == 0) || (adev->psp.sos.size_bytes == 0)) {

                            dev_warn(adev->dev, "PSP SOS FW not available");

                            return -EINVAL;

             }

@@ -3093,32 +3100,32 @@ int psp_init_sos_microcode(struct psp_context *psp,

                             if (sos_hdr->header.header_version_minor == 1) {

                                          sos_hdr_v1_1 = (const struct psp_firmware_header_v1_1 *)adev->psp.sos_fw->data;

-                                          adev->psp.toc_bin_size = le32_to_cpu(sos_hdr_v1_1->toc.size_bytes);

-                                          adev->psp.toc_start_addr = (uint8_t *)adev->psp.sys_start_addr +

+                                         adev->psp.toc.size_bytes = le32_to_cpu(sos_hdr_v1_1->toc.size_bytes);

+                                         adev->psp.toc.start_addr = (uint8_t *)adev->psp.sys.start_addr +

                                                                       le32_to_cpu(sos_hdr_v1_1->toc.offset_bytes);

-                                          adev->psp.kdb_bin_size = le32_to_cpu(sos_hdr_v1_1->kdb.size_bytes);

-                                          adev->psp.kdb_start_addr = (uint8_t *)adev->psp.sys_start_addr +

+                                         adev->psp.kdb.size_bytes = le32_to_cpu(sos_hdr_v1_1->kdb.size_bytes);

+                                         adev->psp.kdb.start_addr = (uint8_t *)adev->psp.sys.start_addr +

                                                                       le32_to_cpu(sos_hdr_v1_1->kdb.offset_bytes);

                            }

                            if (sos_hdr->header.header_version_minor == 2) {

                                          sos_hdr_v1_2 = (const struct psp_firmware_header_v1_2 *)adev->psp.sos_fw->data;

-                                          adev->psp.kdb_bin_size = le32_to_cpu(sos_hdr_v1_2->kdb.size_bytes);

-                                          adev->psp.kdb_start_addr = (uint8_t *)adev->psp.sys_start_addr +

+                                         adev->psp.kdb.size_bytes = le32_to_cpu(sos_hdr_v1_2->kdb.size_bytes);

+                                         adev->psp.kdb.start_addr = (uint8_t *)adev->psp.sys.start_addr +

                                                                                         le32_to_cpu(sos_hdr_v1_2->kdb.offset_bytes);

                            }

                            if (sos_hdr->header.header_version_minor == 3) {

                                          sos_hdr_v1_3 = (const struct psp_firmware_header_v1_3 *)adev->psp.sos_fw->data;

-                                          adev->psp.toc_bin_size = le32_to_cpu(sos_hdr_v1_3->v1_1.toc.size_bytes);

-                                          adev->psp.toc_start_addr = ucode_array_start_addr +

+                                         adev->psp.toc.size_bytes = le32_to_cpu(sos_hdr_v1_3->v1_1.toc.size_bytes);

+                                         adev->psp.toc.start_addr = ucode_array_start_addr +

                                                        le32_to_cpu(sos_hdr_v1_3->v1_1.toc.offset_bytes);

-                                          adev->psp.kdb_bin_size = le32_to_cpu(sos_hdr_v1_3->v1_1.kdb.size_bytes);

-                                          adev->psp.kdb_start_addr = ucode_array_start_addr +

+                                         adev->psp.kdb.size_bytes = le32_to_cpu(sos_hdr_v1_3->v1_1.kdb.size_bytes);

+                                         adev->psp.kdb.start_addr = ucode_array_start_addr +

                                                        le32_to_cpu(sos_hdr_v1_3->v1_1.kdb.offset_bytes);

-                                          adev->psp.spl_bin_size = le32_to_cpu(sos_hdr_v1_3->spl.size_bytes);

-                                          adev->psp.spl_start_addr = ucode_array_start_addr +

+                                         adev->psp.spl.size_bytes = le32_to_cpu(sos_hdr_v1_3->spl.size_bytes);

+                                         adev->psp.spl.start_addr = ucode_array_start_addr +

                                                        le32_to_cpu(sos_hdr_v1_3->spl.offset_bytes);

-                                          adev->psp.rl_bin_size = le32_to_cpu(sos_hdr_v1_3->rl.size_bytes);

-                                          adev->psp.rl_start_addr = ucode_array_start_addr +

+                                         adev->psp.rl.size_bytes = le32_to_cpu(sos_hdr_v1_3->rl.size_bytes);

+                                         adev->psp.rl.start_addr = ucode_array_start_addr +

                                                        le32_to_cpu(sos_hdr_v1_3->rl.offset_bytes);

                            }

                            break;

@@ -3345,7 +3352,10 @@ static DEVICE_ATTR(usbc_pd_fw, S_IRUGO | S_IWUSR,

                               psp_usbc_pd_fw_sysfs_read,

                               psp_usbc_pd_fw_sysfs_write);

-

+int is_psp_fw_valid(struct psp_bin_desc bin)

+{

+            return bin.size_bytes;

+}

 const struct amd_ip_funcs psp_ip_funcs = {

             .name = "psp",

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h

index f5b967b18e3f..fbbb1abf639f 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h

@@ -48,6 +48,7 @@

struct psp_context;

struct psp_xgmi_node_info;

struct psp_xgmi_topology_info;

+struct psp_bin_desc;

 enum psp_bootloader_cmd {

             PSP_BL__LOAD_SYSDRV                            = 0x10000,

@@ -283,6 +284,13 @@ struct psp_runtime_boot_cfg_entry {

             uint32_t reserved;

};

+struct psp_bin_desc {

+            uint32_t fw_version;

+            uint32_t feature_version;

+            uint32_t size_bytes;

+            uint8_t *start_addr;

+};

+

struct psp_context

{

             struct amdgpu_device            *adev;

@@ -298,20 +306,12 @@ struct psp_context

              /* sos firmware */

             const struct firmware                   *sos_fw;

-             uint32_t                                          sos_fw_version;

-             uint32_t                                          sos_feature_version;

-             uint32_t                                          sys_bin_size;

-             uint32_t                                          sos_bin_size;

-             uint32_t                                          toc_bin_size;

-             uint32_t                                          kdb_bin_size;

-             uint32_t                                          spl_bin_size;

-             uint32_t                                          rl_bin_size;

-             uint8_t                                             *sys_start_addr;

-             uint8_t                                             *sos_start_addr;

-             uint8_t                                             *toc_start_addr;

-             uint8_t                                             *kdb_start_addr;

-             uint8_t                                             *spl_start_addr;

-             uint8_t                                             *rl_start_addr;

+            struct psp_bin_desc                                    sys;

+            struct psp_bin_desc                                    sos;

+            struct psp_bin_desc                                    toc;

+            struct psp_bin_desc                                    kdb;

+            struct psp_bin_desc                                    spl;

+            struct psp_bin_desc                                    rl;

              /* tmr buffer */

             struct amdgpu_bo                        *tmr_bo;

@@ -326,8 +326,6 @@ struct psp_context

              /* toc firmware */

             const struct firmware                   *toc_fw;

-             uint32_t                                          toc_fw_version;

-             uint32_t                                          toc_feature_version;

              /* fence buffer */

             struct amdgpu_bo                        *fence_buf_bo;

@@ -482,4 +480,6 @@ int psp_get_fw_attestation_records_addr(struct psp_context *psp,

 int psp_load_fw_list(struct psp_context *psp,

                                 struct amdgpu_firmware_info **ucode_list, int ucode_count);

+

+int is_psp_fw_valid(struct psp_bin_desc bin);

#endif

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c

index fe601f67d3a7..8e9b1f9fa34f 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c

@@ -518,7 +518,7 @@ FW_VERSION_ATTR(rlc_srlg_fw_version, 0444, gfx.rlc_srlg_fw_version);

FW_VERSION_ATTR(rlc_srls_fw_version, 0444, gfx.rlc_srls_fw_version);

FW_VERSION_ATTR(mec_fw_version, 0444, gfx.mec_fw_version);

FW_VERSION_ATTR(mec2_fw_version, 0444, gfx.mec2_fw_version);

-FW_VERSION_ATTR(sos_fw_version, 0444, psp.sos_fw_version);

+FW_VERSION_ATTR(sos_fw_version, 0444, psp.sos.fw_version);

FW_VERSION_ATTR(asd_fw_version, 0444, psp.asd_fw_version);

FW_VERSION_ATTR(ta_ras_fw_version, 0444, psp.ta_ras_ucode_version);

FW_VERSION_ATTR(ta_xgmi_fw_version, 0444, psp.ta_xgmi_ucode_version);

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c

index b71dd1deeb2d..12a7cc2f01cd 100644

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c

@@ -531,7 +531,7 @@ static void amdgpu_virt_populate_vf2pf_ucode_info(struct amdgpu_device *adev)

             POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_RLC_SRLS, adev->gfx.rlc_srls_fw_version);

             POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_MEC,      adev->gfx.mec_fw_version);

             POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_MEC2,     adev->gfx.mec2_fw_version);

-             POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_SOS,      adev->psp.sos_fw_version);

+            POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_SOS,      adev->psp.sos.fw_version);

             POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_ASD,      adev->psp.asd_fw_version);

             POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_TA_RAS,   adev->psp.ta_ras_ucode_version);

             POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_TA_XGMI,  adev->psp.ta_xgmi_ucode_version);

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c

index 38738ca56786..479a57eaba8e 100644

--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c

+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c

@@ -5401,7 +5401,7 @@ static int gfx_v10_0_parse_rlc_toc(struct amdgpu_device *adev)

             int ret;

             RLC_TABLE_OF_CONTENT *rlc_toc;

-             ret = amdgpu_bo_create_reserved(adev, adev->psp.toc_bin_size, PAGE_SIZE,

+            ret = amdgpu_bo_create_reserved(adev, adev->psp.toc.size_bytes, PAGE_SIZE,

                                                                       AMDGPU_GEM_DOMAIN_GTT,

                                                                       &adev->gfx.rlc.rlc_toc_bo,

                                                                       &adev->gfx.rlc.rlc_toc_gpu_addr,

@@ -5412,7 +5412,7 @@ static int gfx_v10_0_parse_rlc_toc(struct amdgpu_device *adev)

             }

              /* Copy toc from psp sos fw to rlc toc buffer */

-             memcpy(adev->gfx.rlc.rlc_toc_buf, adev->psp.toc_start_addr, adev->psp.toc_bin_size);

+            memcpy(adev->gfx.rlc.rlc_toc_buf, adev->psp.toc.start_addr, adev->psp.toc.size_bytes);

              rlc_toc = (RLC_TABLE_OF_CONTENT *)adev->gfx.rlc.rlc_toc_buf;

             while (rlc_toc && (rlc_toc->id > FIRMWARE_ID_INVALID) &&

diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c

index 21b8b6d48d8f..3eb14f7e3322 100644

--- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c

+++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c

@@ -288,7 +288,7 @@ static int psp_v11_0_bootloader_load_kdb(struct psp_context *psp)

             memset(psp->fw_pri_buf, 0, PSP_1_MEG);

              /* Copy PSP KDB binary to memory */

-             memcpy(psp->fw_pri_buf, psp->kdb_start_addr, psp->kdb_bin_size);

+            memcpy(psp->fw_pri_buf, psp->kdb.start_addr, psp->kdb.size_bytes);

              /* Provide the PSP KDB to bootloader */

             WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,

@@ -321,7 +321,7 @@ static int psp_v11_0_bootloader_load_spl(struct psp_context *psp)

             memset(psp->fw_pri_buf, 0, PSP_1_MEG);

              /* Copy PSP SPL binary to memory */

-             memcpy(psp->fw_pri_buf, psp->spl_start_addr, psp->spl_bin_size);

+            memcpy(psp->fw_pri_buf, psp->spl.start_addr, psp->spl.size_bytes);

              /* Provide the PSP SPL to bootloader */

             WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,

@@ -354,7 +354,7 @@ static int psp_v11_0_bootloader_load_sysdrv(struct psp_context *psp)

             memset(psp->fw_pri_buf, 0, PSP_1_MEG);

              /* Copy PSP System Driver binary to memory */

-             memcpy(psp->fw_pri_buf, psp->sys_start_addr, psp->sys_bin_size);

+            memcpy(psp->fw_pri_buf, psp->sys.start_addr, psp->sys.size_bytes);

              /* Provide the sys driver to bootloader */

             WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,

@@ -390,7 +390,7 @@ static int psp_v11_0_bootloader_load_sos(struct psp_context *psp)

             memset(psp->fw_pri_buf, 0, PSP_1_MEG);

              /* Copy Secure OS binary to PSP memory */

-             memcpy(psp->fw_pri_buf, psp->sos_start_addr, psp->sos_bin_size);

+            memcpy(psp->fw_pri_buf, psp->sos.start_addr, psp->sos.size_bytes);

              /* Provide the PSP secure OS to bootloader */

             WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,

diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c

index b0ee77ee80b9..32413c059bee 100644

--- a/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c

+++ b/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c

@@ -140,7 +140,7 @@ static int psp_v12_0_bootloader_load_sysdrv(struct psp_context *psp)

             memset(psp->fw_pri_buf, 0, PSP_1_MEG);

              /* Copy PSP System Driver binary to memory */

-             memcpy(psp->fw_pri_buf, psp->sys_start_addr, psp->sys_bin_size);

+            memcpy(psp->fw_pri_buf, psp->sys.start_addr, psp->sys.size_bytes);

              /* Provide the sys driver to bootloader */

             WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,

@@ -181,7 +181,7 @@ static int psp_v12_0_bootloader_load_sos(struct psp_context *psp)

             memset(psp->fw_pri_buf, 0, PSP_1_MEG);

              /* Copy Secure OS binary to PSP memory */

-             memcpy(psp->fw_pri_buf, psp->sos_start_addr, psp->sos_bin_size);

+            memcpy(psp->fw_pri_buf, psp->sos.start_addr, psp->sos.size_bytes);

              /* Provide the PSP secure OS to bootloader */

             WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,

diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c

index e1046bb3bab0..d017da3ceadb 100644

--- a/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c

+++ b/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c

@@ -136,7 +136,7 @@ static int psp_v13_0_bootloader_load_kdb(struct psp_context *psp)

             memset(psp->fw_pri_buf, 0, PSP_1_MEG);

              /* Copy PSP KDB binary to memory */

-             memcpy(psp->fw_pri_buf, psp->kdb_start_addr, psp->kdb_bin_size);

+            memcpy(psp->fw_pri_buf, psp->kdb.start_addr, psp->kdb.size_bytes);

              /* Provide the PSP KDB to bootloader */

             WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36,

@@ -169,7 +169,7 @@ static int psp_v13_0_bootloader_load_sysdrv(struct psp_context *psp)

             memset(psp->fw_pri_buf, 0, PSP_1_MEG);

              /* Copy PSP System Driver binary to memory */

-             memcpy(psp->fw_pri_buf, psp->sys_start_addr, psp->sys_bin_size);

+            memcpy(psp->fw_pri_buf, psp->sys.start_addr, psp->sys.size_bytes);

              /* Provide the sys driver to bootloader */

             WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36,

@@ -205,7 +205,7 @@ static int psp_v13_0_bootloader_load_sos(struct psp_context *psp)

             memset(psp->fw_pri_buf, 0, PSP_1_MEG);

              /* Copy Secure OS binary to PSP memory */

-             memcpy(psp->fw_pri_buf, psp->sos_start_addr, psp->sos_bin_size);

+            memcpy(psp->fw_pri_buf, psp->sos.start_addr, psp->sos.size_bytes);

              /* Provide the PSP secure OS to bootloader */

             WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36,

diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c

index be05d9cbd41e..29aac7b793f4 100644

--- a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c

+++ b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c

@@ -105,7 +105,7 @@ static int psp_v3_1_bootloader_load_sysdrv(struct psp_context *psp)

             memset(psp->fw_pri_buf, 0, PSP_1_MEG);

              /* Copy PSP System Driver binary to memory */

-             memcpy(psp->fw_pri_buf, psp->sys_start_addr, psp->sys_bin_size);

+            memcpy(psp->fw_pri_buf, psp->sys.start_addr, psp->sys.size_bytes);

              /* Provide the sys driver to bootloader */

             WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,

@@ -146,7 +146,7 @@ static int psp_v3_1_bootloader_load_sos(struct psp_context *psp)

             memset(psp->fw_pri_buf, 0, PSP_1_MEG);

              /* Copy Secure OS binary to PSP memory */

-             memcpy(psp->fw_pri_buf, psp->sos_start_addr, psp->sos_bin_size);

+            memcpy(psp->fw_pri_buf, psp->sos.start_addr, psp->sos.size_bytes);

              /* Provide the PSP secure OS to bootloader */

             WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,

diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c

index b7d350be8050..a5e085e570f7 100644

--- a/drivers/gpu/drm/amd/amdgpu/soc15.c

+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c

@@ -575,7 +575,7 @@ soc15_asic_reset_method(struct amdgpu_device *adev)

                            baco_reset = amdgpu_dpm_is_baco_supported(adev);

                            break;

             case CHIP_VEGA20:

-                           if (adev->psp.sos_fw_version >= 0x80067)

+                           if (adev->psp.sos.fw_version >= 0x80067)

                                          baco_reset = amdgpu_dpm_is_baco_supported(adev);

                             /*

@@ -635,7 +635,7 @@ static bool soc15_supports_baco(struct amdgpu_device *adev)

             case CHIP_ARCTURUS:

                            return amdgpu_dpm_is_baco_supported(adev);

             case CHIP_VEGA20:

-                           if (adev->psp.sos_fw_version >= 0x80067)

+                           if (adev->psp.sos.fw_version >= 0x80067)

                                          return amdgpu_dpm_is_baco_supported(adev);

                            return false;

             default:

--

2.17.1









Thanks,

Candice


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20210721/57173ddc/attachment-0001.htm>


More information about the amd-gfx mailing list