Skip to content

Commit 79daf69

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amdgpu: Add support to load P2S tables
Add support to load P2S tables through PSP. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Yang Wang <kevinyang.wang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent cd21cb1 commit 79daf69

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,6 +2412,9 @@ static int psp_get_fw_type(struct amdgpu_firmware_info *ucode,
24122412
case AMDGPU_UCODE_ID_UMSCH_MM_CMD_BUFFER:
24132413
*type = GFX_FW_TYPE_UMSCH_CMD_BUFFER;
24142414
break;
2415+
case AMDGPU_UCODE_ID_P2S_TABLE:
2416+
*type = GFX_FW_TYPE_P2S_TABLE;
2417+
break;
24152418
case AMDGPU_UCODE_ID_MAXIMUM:
24162419
default:
24172420
return -EINVAL;
@@ -2503,6 +2506,24 @@ int psp_execute_ip_fw_load(struct psp_context *psp,
25032506
return ret;
25042507
}
25052508

2509+
static int psp_load_p2s_table(struct psp_context *psp)
2510+
{
2511+
int ret;
2512+
struct amdgpu_device *adev = psp->adev;
2513+
struct amdgpu_firmware_info *ucode =
2514+
&adev->firmware.ucode[AMDGPU_UCODE_ID_P2S_TABLE];
2515+
2516+
if (adev->in_runpm && (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO))
2517+
return 0;
2518+
2519+
if (!ucode->fw || amdgpu_sriov_vf(psp->adev))
2520+
return 0;
2521+
2522+
ret = psp_execute_ip_fw_load(psp, ucode);
2523+
2524+
return ret;
2525+
}
2526+
25062527
static int psp_load_smu_fw(struct psp_context *psp)
25072528
{
25082529
int ret;
@@ -2543,6 +2564,9 @@ static bool fw_load_skip_check(struct psp_context *psp,
25432564
if (!ucode->fw || !ucode->ucode_size)
25442565
return true;
25452566

2567+
if (ucode->ucode_id == AMDGPU_UCODE_ID_P2S_TABLE)
2568+
return true;
2569+
25462570
if (ucode->ucode_id == AMDGPU_UCODE_ID_SMC &&
25472571
(psp_smu_reload_quirk(psp) ||
25482572
psp->autoload_supported ||
@@ -2591,6 +2615,9 @@ static int psp_load_non_psp_fw(struct psp_context *psp)
25912615
return ret;
25922616
}
25932617

2618+
/* Load P2S table first if it's available */
2619+
psp_load_p2s_table(psp);
2620+
25942621
for (i = 0; i < adev->firmware.max_ucodes; i++) {
25952622
ucode = &adev->firmware.ucode[i];
25962623

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,8 @@ const char *amdgpu_ucode_name(enum AMDGPU_UCODE_ID ucode_id)
642642
return "SMC";
643643
case AMDGPU_UCODE_ID_PPTABLE:
644644
return "PPTABLE";
645+
case AMDGPU_UCODE_ID_P2S_TABLE:
646+
return "P2STABLE";
645647
case AMDGPU_UCODE_ID_UVD:
646648
return "UVD";
647649
case AMDGPU_UCODE_ID_UVD1:
@@ -922,6 +924,10 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev,
922924
ucode->ucode_size = ucode->fw->size;
923925
ucode_addr = (u8 *)ucode->fw->data;
924926
break;
927+
case AMDGPU_UCODE_ID_P2S_TABLE:
928+
ucode->ucode_size = ucode->fw->size;
929+
ucode_addr = (u8 *)ucode->fw->data;
930+
break;
925931
case AMDGPU_UCODE_ID_IMU_I:
926932
ucode->ucode_size = le32_to_cpu(imu_hdr->imu_iram_ucode_size_bytes);
927933
ucode_addr = (u8 *)ucode->fw->data +

drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ enum AMDGPU_UCODE_ID {
510510
AMDGPU_UCODE_ID_UMSCH_MM_UCODE,
511511
AMDGPU_UCODE_ID_UMSCH_MM_DATA,
512512
AMDGPU_UCODE_ID_UMSCH_MM_CMD_BUFFER,
513+
AMDGPU_UCODE_ID_P2S_TABLE,
513514
AMDGPU_UCODE_ID_MAXIMUM,
514515
};
515516

0 commit comments

Comments
 (0)