For PSP v15.0.8, PSP is initialized along with VBIOS. Query and keep the
version during early init.

Signed-off-by: Lijo Lazar <[email protected]>
---

On VF this register read doesn't work, skip reading it for VF (Asad)

 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c  |  3 +--
 drivers/gpu/drm/amd/amdgpu/psp_v15_0_8.c | 11 +++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index c0ed3e24b684..548e017311d4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -191,6 +191,7 @@ static int psp_early_init(struct amdgpu_ip_block *ip_block)
 
        psp->autoload_supported = true;
        psp->boot_time_tmr = true;
+       psp->adev = adev;
 
        switch (amdgpu_ip_version(adev, MP0_HWIP, 0)) {
        case IP_VERSION(9, 0, 0):
@@ -298,8 +299,6 @@ static int psp_early_init(struct amdgpu_ip_block *ip_block)
                return -EINVAL;
        }
 
-       psp->adev = adev;
-
        adev->psp_timeout = 20000;
 
        psp_check_pmfw_centralized_cstate_management(psp);
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v15_0_8.c 
b/drivers/gpu/drm/amd/amdgpu/psp_v15_0_8.c
index dcfc9be269b0..d64a32565d3e 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v15_0_8.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v15_0_8.c
@@ -36,6 +36,14 @@ MODULE_FIRMWARE("amdgpu/psp_15_0_8_toc_1.bin");
 MODULE_FIRMWARE("amdgpu/psp_15_0_8_rl.bin");
 MODULE_FIRMWARE("amdgpu/psp_15_0_8_ta.bin");
 
+static void psp_v15_0_8_init_sos_version(struct psp_context *psp)
+{
+       struct amdgpu_device *adev = psp->adev;
+       if (!amdgpu_sriov_vf(adev))
+               psp->sos.fw_version =
+                       RREG32_SOC15(MP0, 0, regMPASP_SMN_C2PMSG_58);
+}
+
 static int psp_v15_0_8_init_microcode(struct psp_context *psp)
 {
        struct amdgpu_device *adev = psp->adev;
@@ -507,4 +515,7 @@ static const struct psp_funcs psp_v15_0_8_funcs = {
 void psp_v15_0_8_set_psp_funcs(struct psp_context *psp)
 {
        psp->funcs = &psp_v15_0_8_funcs;
+
+       /* Initialize SOS version as well */
+       psp_v15_0_8_init_sos_version(psp);
 }
-- 
2.49.0

Reply via email to