Re: [PATCH] drm/amdgpu: added support for ras driver loading

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[AMD Official Use Only - General]


Reviewed-by: Hawking Zhang <Hawking.Zhang@xxxxxxx>

 

Regards,
Hawking

From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> on behalf of Candice Li <Candice.Li@xxxxxxx>
Date: Saturday, September 10, 2022 at 07:00
To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>
Cc: Li, Candice <Candice.Li@xxxxxxx>, Clements, John <John.Clements@xxxxxxx>
Subject: [PATCH] drm/amdgpu: added support for ras driver loading

From: John Clements <john.clements@xxxxxxx>

copy ras driver to psp if present

Signed-off-by: John Clements <john.clements@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c   | 15 +++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h   |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h |  1 +
 drivers/gpu/drm/amd/amdgpu/psp_v13_0.c    |  7 +++++++
 4 files changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index cfcaf890a6a122..218666f6203a9f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -2055,6 +2055,15 @@ static int psp_hw_start(struct psp_context *psp)
                         }
                 }
 
+               if ((is_psp_fw_valid(psp->ras_drv)) &&
+                   (psp->funcs->bootloader_load_ras_drv != NULL)) {
+                       ret = psp_bootloader_load_ras_drv(psp);
+                       if (ret) {
+                               DRM_ERROR("PSP load ras_drv failed!\n");
+                               return ret;
+                       }
+               }
+
                 if ((is_psp_fw_valid(psp->sos)) &&
                     (psp->funcs->bootloader_load_sos != NULL)) {
                         ret = psp_bootloader_load_sos(psp);
@@ -3040,6 +3049,12 @@ static int parse_sos_bin_descriptor(struct psp_context *psp,
                 psp->dbg_drv.size_bytes         = le32_to_cpu(desc->size_bytes);
                 psp->dbg_drv.start_addr         = ucode_start_addr;
                 break;
+       case PSP_FW_TYPE_PSP_RAS_DRV:
+               psp->ras_drv.fw_version         = le32_to_cpu(desc->fw_version);
+               psp->ras_drv.feature_version    = le32_to_cpu(desc->fw_version);
+               psp->ras_drv.size_bytes         = le32_to_cpu(desc->size_bytes);
+               psp->ras_drv.start_addr         = ucode_start_addr;
+               break;
         default:
                 dev_warn(psp->adev->dev, "Unsupported PSP FW type: %d\n", desc->fw_type);
                 break;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index c32b74bd970fc5..d7a5ff4660cf9e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -71,6 +71,7 @@ enum psp_bootloader_cmd {
         PSP_BL__LOAD_SOCDRV             = 0xB0000,
         PSP_BL__LOAD_DBGDRV             = 0xC0000,
         PSP_BL__LOAD_INTFDRV            = 0xD0000,
+       PSP_BL__LOAD_RASDRV                 = 0xE0000,
         PSP_BL__DRAM_LONG_TRAIN         = 0x100000,
         PSP_BL__DRAM_SHORT_TRAIN        = 0x200000,
         PSP_BL__LOAD_TOS_SPL_TABLE      = 0x10000000,
@@ -114,6 +115,7 @@ struct psp_funcs
         int (*bootloader_load_soc_drv)(struct psp_context *psp);
         int (*bootloader_load_intf_drv)(struct psp_context *psp);
         int (*bootloader_load_dbg_drv)(struct psp_context *psp);
+       int (*bootloader_load_ras_drv)(struct psp_context *psp);
         int (*bootloader_load_sos)(struct psp_context *psp);
         int (*ring_init)(struct psp_context *psp, enum psp_ring_type ring_type);
         int (*ring_create)(struct psp_context *psp,
@@ -323,6 +325,7 @@ struct psp_context
         struct psp_bin_desc             soc_drv;
         struct psp_bin_desc             intf_drv;
         struct psp_bin_desc             dbg_drv;
+       struct psp_bin_desc             ras_drv;
 
         /* tmr buffer */
         struct amdgpu_bo                *tmr_bo;
@@ -403,6 +406,9 @@ struct amdgpu_psp_funcs {
                 ((psp)->funcs->bootloader_load_intf_drv ? (psp)->funcs->bootloader_load_intf_drv((psp)) : 0)
 #define psp_bootloader_load_dbg_drv(psp) \
                 ((psp)->funcs->bootloader_load_dbg_drv ? (psp)->funcs->bootloader_load_dbg_drv((psp)) : 0)
+#define psp_bootloader_load_ras_drv(psp) \
+               ((psp)->funcs->bootloader_load_ras_drv ? \
+               (psp)->funcs->bootloader_load_ras_drv((psp)) : 0)
 #define psp_bootloader_load_sos(psp) \
                 ((psp)->funcs->bootloader_load_sos ? (psp)->funcs->bootloader_load_sos((psp)) : 0)
 #define psp_smu_reload_quirk(psp) \
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
index 96b6cf4c4d54f8..3975bcaa2c8997 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
@@ -124,6 +124,7 @@ enum psp_fw_type {
         PSP_FW_TYPE_PSP_SOC_DRV,
         PSP_FW_TYPE_PSP_INTF_DRV,
         PSP_FW_TYPE_PSP_DBG_DRV,
+       PSP_FW_TYPE_PSP_RAS_DRV,
 };
 
 /* version_major=2, version_minor=0 */
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c
index eac33d5c93e74f..262dcd7513a6fb 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c
@@ -223,6 +223,12 @@ static int psp_v13_0_bootloader_load_dbg_drv(struct psp_context *psp)
         return psp_v13_0_bootloader_load_component(psp, &psp->dbg_drv, PSP_BL__LOAD_DBGDRV);
 }
 
+static int psp_v13_0_bootloader_load_ras_drv(struct psp_context *psp)
+{
+       return psp_v13_0_bootloader_load_component(psp, &psp->ras_drv, PSP_BL__LOAD_RASDRV);
+}
+
+
 static int psp_v13_0_bootloader_load_sos(struct psp_context *psp)
 {
         int ret;
@@ -719,6 +725,7 @@ static const struct psp_funcs psp_v13_0_funcs = {
         .bootloader_load_soc_drv = psp_v13_0_bootloader_load_soc_drv,
         .bootloader_load_intf_drv = psp_v13_0_bootloader_load_intf_drv,
         .bootloader_load_dbg_drv = psp_v13_0_bootloader_load_dbg_drv,
+       .bootloader_load_ras_drv = psp_v13_0_bootloader_load_ras_drv,
         .bootloader_load_sos = psp_v13_0_bootloader_load_sos,
         .ring_init = psp_v13_0_ring_init,
         .ring_create = psp_v13_0_ring_create,
--
2.17.1


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux