drm/amdgpu: Enable/disable NPA address translation using PSP

Enable or disable NPA address translation using PSP during accelerator
state transitions in and out of READY state.

Signed-off-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Mukul Joshi <mukul.joshi@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Felix Kuehling 2026-04-07 17:47:00 -04:00 committed by Alex Deucher
parent 698ed831fe
commit c337facc20

View File

@ -663,10 +663,16 @@ static bool check_local_vpod_integrity(struct amdgpu_device *adev)
static void activate_accelerator(struct amdgpu_device *adev)
{
int r;
if (adev->ualink.info->accel_state >= AMDGPU_UALINK_ACCEL_STATE_READY)
return;
adev->ualink.info->accel_state = AMDGPU_UALINK_ACCEL_STATE_READY;
/* Enable incoming NPA address translation with VMID15 */
r = psp_ual_set_npa_config(&adev->psp, adev->ualink.psp_if_ver,
15, true);
if (!r)
adev->ualink.info->accel_state = AMDGPU_UALINK_ACCEL_STATE_READY;
}
static void deactivate_accelerator(struct amdgpu_device *adev)
@ -674,6 +680,10 @@ static void deactivate_accelerator(struct amdgpu_device *adev)
if (adev->ualink.info->accel_state < AMDGPU_UALINK_ACCEL_STATE_READY)
return;
/* Disable incoming NPA address translation with VMID15 */
psp_ual_set_npa_config(&adev->psp, adev->ualink.psp_if_ver,
15, false);
/* ignore return value */
adev->ualink.info->accel_state = AMDGPU_UALINK_ACCEL_STATE_CONFIGURED;
}