drm/amdgpu/psp: move PSP memory alloc from hw_init to sw_init
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 21 Apr 2022 05:21:52 +0000 (01:21 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:22:35 +0000 (10:22 +0200)
commita2c87348acebd9bacedfe20cf82341928751ff91
tree8894b8b43f7aa0badbec1c6014d66dc7d76804d9
parentda3b69a564547b9262daf1c49c0302721d7a4500
drm/amdgpu/psp: move PSP memory alloc from hw_init to sw_init

[ Upstream commit b95b5391684b39695887afb4a13cccee7820f5d6 ]

Memory allocations should be done in sw_init.  hw_init should
just be hardware programming needed to initialize the IP block.
This is how most other IP blocks work.  Move the GPU memory
allocations from psp hw_init to psp sw_init and move the memory
free to sw_fini.  This also fixes a potential GPU memory leak
if psp hw_init fails.

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c