/* * Copyright 2021 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *
*/
for (i = adev->num_ip_blocks - 1; i >= 0; i--) { if (!(adev->ip_blocks[i].version->type ==
AMD_IP_BLOCK_TYPE_GFX ||
adev->ip_blocks[i].version->type ==
AMD_IP_BLOCK_TYPE_SDMA)) continue;
r = amdgpu_ip_block_suspend(&adev->ip_blocks[i]); if (r) return r;
}
return 0;
}
staticint
sienna_cichlid_mode2_prepare_hwcontext(struct amdgpu_reset_control *reset_ctl, struct amdgpu_reset_context *reset_context)
{ int r = 0; struct amdgpu_device *adev = (struct amdgpu_device *)reset_ctl->handle;
if (!amdgpu_sriov_vf(adev)) { if (adev->gfxhub.funcs->mode2_save_regs)
adev->gfxhub.funcs->mode2_save_regs(adev); if (adev->gfxhub.funcs->halt)
adev->gfxhub.funcs->halt(adev);
r = sienna_cichlid_mode2_suspend_ip(adev);
}
r = sienna_cichlid_mode2_reset(adev); if (r) {
dev_err(adev->dev, "ASIC reset failed with error, %d ", r);
} return r;
}
staticint sienna_cichlid_mode2_restore_ip(struct amdgpu_device *adev)
{ int i, r; struct psp_context *psp = &adev->psp;
r = psp_rlc_autoload_start(psp); if (r) {
dev_err(adev->dev, "Failed to start rlc autoload\n"); return r;
}
/* Reinit GFXHUB */ if (adev->gfxhub.funcs->mode2_restore_regs)
adev->gfxhub.funcs->mode2_restore_regs(adev);
adev->gfxhub.funcs->init(adev);
r = adev->gfxhub.funcs->gart_enable(adev); if (r) {
dev_err(adev->dev, "GFXHUB gart reenable failed after reset\n"); return r;
}
for (i = 0; i < adev->num_ip_blocks; i++) { if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH) {
r = amdgpu_ip_block_resume(&adev->ip_blocks[i]); if (r) return r;
}
}
for (i = 0; i < adev->num_ip_blocks; i++) { if (!(adev->ip_blocks[i].version->type ==
AMD_IP_BLOCK_TYPE_GFX ||
adev->ip_blocks[i].version->type ==
AMD_IP_BLOCK_TYPE_SDMA)) continue;
r = amdgpu_ip_block_resume(&adev->ip_blocks[i]); if (r) return r;
}
for (i = 0; i < adev->num_ip_blocks; i++) { if (!(adev->ip_blocks[i].version->type ==
AMD_IP_BLOCK_TYPE_GFX ||
adev->ip_blocks[i].version->type ==
AMD_IP_BLOCK_TYPE_SDMA)) continue;
if (adev->ip_blocks[i].version->funcs->late_init) {
r = adev->ip_blocks[i].version->funcs->late_init(
&adev->ip_blocks[i]); if (r) {
dev_err(adev->dev, "late_init of IP block <%s> failed %d after reset\n",
adev->ip_blocks[i].version->funcs->name,
r); return r;
}
}
adev->ip_blocks[i].status.late_initialized = true;
}
amdgpu_set_init_level(tmp_adev, AMDGPU_INIT_LEVEL_RESET_RECOVERY);
dev_info(tmp_adev->dev, "GPU reset succeeded, trying to resume\n");
r = sienna_cichlid_mode2_restore_ip(tmp_adev); if (r) goto end;
/* * Add this ASIC as tracked as reset was already * complete successfully.
*/
amdgpu_register_gpu_instance(tmp_adev);
/* Resume RAS */
amdgpu_ras_resume(tmp_adev);
amdgpu_irq_gpu_reset_resume_helper(tmp_adev);
amdgpu_set_init_level(tmp_adev, AMDGPU_INIT_LEVEL_DEFAULT);
r = amdgpu_ib_ring_tests(tmp_adev); if (r) {
dev_err(tmp_adev->dev, "ib ring test failed (%d).\n", r);
r = -EAGAIN; goto end;
}
INIT_WORK(&reset_ctl->reset_work, reset_ctl->async_reset); /* Only mode2 is handled through reset control now */
reset_ctl->reset_handlers = &sienna_cichlid_rst_handlers;
adev->reset_cntl = reset_ctl;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.