At suspend time if there is memory pressure then dynamically allocating memory will cause failures that don't clean up properly when trying suspend a second time. Move the bigger memory allocations into Linux PM prepare() callback and drop allocations that aren't really needed in DC code. v1: https://lore.kernel.org/amd-gfx/20230925143359.14932-1-mario.limonciello@xxxxxxx/ v2: https://lore.kernel.org/amd-gfx/20231002224449.95565-1-mario.limonciello@xxxxxxx/T/#mc800319a05df821cd1875234b09bf212e2e3282b v2->v3: * Handle adev->in_suspend in prepare() and complete() * Add missing scratch variable in dc_resource_state_destruct() * Revert error code propagation in same series v1->v2: * Handle DC code too * Add prepare callback rather than moving symbol calls Mario Limonciello (4): drm/amd: Add support for prepare() and complete() callbacks drm/amd: Move evict resources suspend step to prepare() drm/amd/display: Destroy DC context while keeping DML drm/amd/display: make dc_set_power_state() return type `void` again drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 46 ++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +++-- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 ++----- drivers/gpu/drm/amd/display/dc/core/dc.c | 31 +------------ .../gpu/drm/amd/display/dc/core/dc_resource.c | 12 +++++ drivers/gpu/drm/amd/display/dc/dc.h | 2 +- 7 files changed, 69 insertions(+), 52 deletions(-) -- 2.34.1