Skip to contentSkip to conversation

drm/amdgpu: Read PSPv13 OS version from register

PATCH In review Lijo Lazar 2 participants 2 messages Oct 11, 2023

Subsystems (2)
lore
Share & tools
lore

Lijo Lazar

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Read PSPv13 OS version from register

PSP OS updates the version information in register. On APUs with PSPv13, PSP OS will already be loaded with SBIOS. Hence use the version register instead of using information in driver binary header.

---
 drivers/gpu/drm/amd/amdgpu/psp_v13_0.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c +12 -1
index b7bc00d4c696..573046702861 100644
@@ -263,6 +263,12 @@ 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 inline void psp_v13_0_init_sos_version(struct psp_context *psp)
+{
+	struct amdgpu_device *adev = psp->adev;
+
+	psp->sos.fw_version = RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_58);
+}
 
 static int psp_v13_0_bootloader_load_sos(struct psp_context *psp)
 {
@@ -273,8 +279,10 @@ static int psp_v13_0_bootloader_load_sos(struct psp_context *psp)
 	/* Check sOS sign of life register to confirm sys driver and sOS
 	 * are already been loaded.
 	 */
-	if (psp_v13_0_is_sos_alive(psp))
+	if (psp_v13_0_is_sos_alive(psp)) {
+		psp_v13_0_init_sos_version(psp);
 		return 0;
+	}
 
 	ret = psp_v13_0_wait_for_bootloader(psp);
 	if (ret)
@@ -298,6 +306,9 @@ static int psp_v13_0_bootloader_load_sos(struct psp_context *psp)
 			   RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_81),
 			   0, true);
 
+	if (!ret)
+		psp_v13_0_init_sos_version(psp);
+
 	return ret;
 }
 
Signature · 1 line
2.25.1
Reviewed-by Reviewed-by Yang Wang on v1 1/1
#1 lore raw

[AMD Official Use Only - General]

Regards,
Hawking
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, October 11, 2023 14:51
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: [PATCH] drm/amdgpu: Read PSPv13 OS version from register

PSP OS updates the version information in register. On APUs with PSPv13, PSP OS will already be loaded with SBIOS. Hence use the version register instead of using information in driver binary header.

---
 drivers/gpu/drm/amd/amdgpu/psp_v13_0.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c +5 -0
index b7bc00d4c696..573046702861 100644
@@ -263,6 +263,12 @@ 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 inline void psp_v13_0_init_sos_version(struct psp_context *psp)
+{
+       struct amdgpu_device *adev = psp->adev;
+
+       psp->sos.fw_version = RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_58); }
 
 static int psp_v13_0_bootloader_load_sos(struct psp_context *psp)  { @@ -273,8 +279,10 @@ static int psp_v13_0_bootloader_load_sos(struct psp_context *psp)
        /* Check sOS sign of life register to confirm sys driver and sOS
         * are already been loaded.
         */
-       if (psp_v13_0_is_sos_alive(psp))
+       if (psp_v13_0_is_sos_alive(psp)) {
+               psp_v13_0_init_sos_version(psp);
                return 0;

+ }

        ret = psp_v13_0_wait_for_bootloader(psp);
        if (ret)
@@ -298,6 +306,9 @@ static int psp_v13_0_bootloader_load_sos(struct psp_context *psp)
                           RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_81),
                           0, true);

+ if (!ret)
+ psp_v13_0_init_sos_version(psp);
+

        return ret;

}

--
2.25.1