Commit 53a5cf57 authored by Huang Rui's avatar Huang Rui Committed by Alex Deucher

drm/amdgpu: add psp firmware private memory

Needed for proper suspend support.
Signed-off-by: default avatarHuang Rui <ray.huang@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6f2b1fcc
...@@ -275,17 +275,25 @@ static int psp_load_fw(struct amdgpu_device *adev) ...@@ -275,17 +275,25 @@ static int psp_load_fw(struct amdgpu_device *adev)
if (!cmd) if (!cmd)
return -ENOMEM; return -ENOMEM;
ret = psp_bootloader_load_sysdrv(psp); ret = amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG,
AMDGPU_GEM_DOMAIN_GTT,
&psp->fw_pri_bo,
&psp->fw_pri_mc_addr,
&psp->fw_pri_buf);
if (ret) if (ret)
goto failed; goto failed;
ret = psp_bootloader_load_sysdrv(psp);
if (ret)
goto failed_mem1;
ret = psp_bootloader_load_sos(psp); ret = psp_bootloader_load_sos(psp);
if (ret) if (ret)
goto failed; goto failed_mem1;
ret = psp_ring_init(psp, PSP_RING_TYPE__KM); ret = psp_ring_init(psp, PSP_RING_TYPE__KM);
if (ret) if (ret)
goto failed; goto failed_mem1;
ret = amdgpu_bo_create_kernel(adev, PSP_FENCE_BUFFER_SIZE, PAGE_SIZE, ret = amdgpu_bo_create_kernel(adev, PSP_FENCE_BUFFER_SIZE, PAGE_SIZE,
AMDGPU_GEM_DOMAIN_VRAM, AMDGPU_GEM_DOMAIN_VRAM,
...@@ -293,7 +301,7 @@ static int psp_load_fw(struct amdgpu_device *adev) ...@@ -293,7 +301,7 @@ static int psp_load_fw(struct amdgpu_device *adev)
&psp->fence_buf_mc_addr, &psp->fence_buf_mc_addr,
&psp->fence_buf); &psp->fence_buf);
if (ret) if (ret)
goto failed; goto failed_mem1;
memset(psp->fence_buf, 0, PSP_FENCE_BUFFER_SIZE); memset(psp->fence_buf, 0, PSP_FENCE_BUFFER_SIZE);
...@@ -343,6 +351,9 @@ static int psp_load_fw(struct amdgpu_device *adev) ...@@ -343,6 +351,9 @@ static int psp_load_fw(struct amdgpu_device *adev)
failed_mem: failed_mem:
amdgpu_bo_free_kernel(&psp->fence_buf_bo, amdgpu_bo_free_kernel(&psp->fence_buf_bo,
&psp->fence_buf_mc_addr, &psp->fence_buf); &psp->fence_buf_mc_addr, &psp->fence_buf);
failed_mem1:
amdgpu_bo_free_kernel(&psp->fw_pri_bo,
&psp->fw_pri_mc_addr, &psp->fw_pri_buf);
failed: failed:
kfree(cmd); kfree(cmd);
return ret; return ret;
...@@ -392,6 +403,10 @@ static int psp_hw_fini(void *handle) ...@@ -392,6 +403,10 @@ static int psp_hw_fini(void *handle)
if (psp->tmr_buf) if (psp->tmr_buf)
amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf); amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
if (psp->fw_pri_buf)
amdgpu_bo_free_kernel(&psp->fw_pri_bo,
&psp->fw_pri_mc_addr, &psp->fw_pri_buf);
return 0; return 0;
} }
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#define PSP_CMD_BUFFER_SIZE 0x1000 #define PSP_CMD_BUFFER_SIZE 0x1000
#define PSP_ASD_BIN_SIZE 0x40000 #define PSP_ASD_BIN_SIZE 0x40000
#define PSP_ASD_SHARED_MEM_SIZE 0x4000 #define PSP_ASD_SHARED_MEM_SIZE 0x4000
#define PSP_1_MEG 0x100000
enum psp_ring_type enum psp_ring_type
{ {
...@@ -71,6 +72,11 @@ struct psp_context ...@@ -71,6 +72,11 @@ struct psp_context
enum AMDGPU_UCODE_ID ucode_type); enum AMDGPU_UCODE_ID ucode_type);
bool (*smu_reload_quirk)(struct psp_context *psp); bool (*smu_reload_quirk)(struct psp_context *psp);
/* fence buffer */
struct amdgpu_bo *fw_pri_bo;
uint64_t fw_pri_mc_addr;
void *fw_pri_buf;
/* sos firmware */ /* sos firmware */
const struct firmware *sos_fw; const struct firmware *sos_fw;
uint32_t sos_fw_version; uint32_t sos_fw_version;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment