drivers/gpu/drm/amd/amdgpu/sienna_cichlid.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/sienna_cichlid.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/sienna_cichlid.c- Extension
.c- Size
- 8178 bytes
- Lines
- 299
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
sienna_cichlid.hamdgpu_reset.hamdgpu_amdkfd.hamdgpu_dpm.hamdgpu_job.hamdgpu_ring.hamdgpu_ras.hamdgpu_psp.hamdgpu_xgmi.h
Detected Declarations
function filesfunction sienna_cichlid_get_reset_handlerfunction sienna_cichlid_mode2_suspend_ipfunction sienna_cichlid_mode2_prepare_hwcontextfunction sienna_cichlid_async_resetfunction for_each_handlerfunction sienna_cichlid_mode2_resetfunction sienna_cichlid_mode2_perform_resetfunction sienna_cichlid_mode2_restore_ipfunction sienna_cichlid_mode2_restore_hwcontextfunction sienna_cichlid_reset_initfunction sienna_cichlid_reset_fini
Annotated Snippet
for_each_handler(i, handler, reset_ctl) {
if (handler->reset_method == reset_context->method)
return handler;
}
}
if (sienna_cichlid_is_mode2_default(reset_ctl)) {
for_each_handler(i, handler, reset_ctl) {
if (handler->reset_method == AMD_RESET_METHOD_MODE2)
return handler;
}
}
return NULL;
}
static int sienna_cichlid_mode2_suspend_ip(struct amdgpu_device *adev)
{
int r, i;
amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
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;
}
static int
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);
}
return r;
}
static void sienna_cichlid_async_reset(struct work_struct *work)
{
struct amdgpu_reset_handler *handler;
struct amdgpu_reset_control *reset_ctl =
container_of(work, struct amdgpu_reset_control, reset_work);
struct amdgpu_device *adev = (struct amdgpu_device *)reset_ctl->handle;
int i;
for_each_handler(i, handler, reset_ctl) {
if (handler->reset_method == reset_ctl->active_reset) {
dev_dbg(adev->dev, "Resetting device\n");
handler->do_reset(adev);
break;
}
}
}
static int sienna_cichlid_mode2_reset(struct amdgpu_device *adev)
{
/* disable BM */
pci_clear_master(adev->pdev);
return amdgpu_dpm_mode2_reset(adev);
}
static int
sienna_cichlid_mode2_perform_reset(struct amdgpu_reset_control *reset_ctl,
struct amdgpu_reset_context *reset_context)
{
struct amdgpu_device *adev = (struct amdgpu_device *)reset_ctl->handle;
int r;
r = sienna_cichlid_mode2_reset(adev);
if (r) {
dev_err(adev->dev,
Annotation
- Immediate include surface: `sienna_cichlid.h`, `amdgpu_reset.h`, `amdgpu_amdkfd.h`, `amdgpu_dpm.h`, `amdgpu_job.h`, `amdgpu_ring.h`, `amdgpu_ras.h`, `amdgpu_psp.h`.
- Detected declarations: `function files`, `function sienna_cichlid_get_reset_handler`, `function sienna_cichlid_mode2_suspend_ip`, `function sienna_cichlid_mode2_prepare_hwcontext`, `function sienna_cichlid_async_reset`, `function for_each_handler`, `function sienna_cichlid_mode2_reset`, `function sienna_cichlid_mode2_perform_reset`, `function sienna_cichlid_mode2_restore_ip`, `function sienna_cichlid_mode2_restore_hwcontext`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.