drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_process.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_process.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_process.c- Extension
.c- Size
- 6079 bytes
- Lines
- 201
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
amdgpu.hamdgpu_reset.hamdgpu_xgmi.hras_sys.hamdgpu_ras_mgr.hamdgpu_ras_process.h
Detected Declarations
function Copyrightfunction amdgpu_ras_process_initfunction amdgpu_ras_process_finifunction amdgpu_ras_process_handle_umc_interruptfunction amdgpu_ras_process_handle_unexpected_interruptfunction amdgpu_ras_process_handle_consumption_interruptfunction amdgpu_ras_process_beginfunction amdgpu_ras_process_endfunction amdgpu_ras_process_pre_resetfunction amdgpu_ras_process_post_reset
Annotated Snippet
// SPDX-License-Identifier: MIT
/*
* Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved.
*
* 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
* AUTHORS OR COPYRIGHT HOLDERS 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.
*/
#include "amdgpu.h"
#include "amdgpu_reset.h"
#include "amdgpu_xgmi.h"
#include "ras_sys.h"
#include "amdgpu_ras_mgr.h"
#include "amdgpu_ras_process.h"
#define RAS_MGR_RETIRE_PAGE_INTERVAL 100
#define RAS_EVENT_PROCESS_TIMEOUT 1200
static void ras_process_retire_page_dwork(struct work_struct *work)
{
struct amdgpu_ras_mgr *ras_mgr =
container_of(work, struct amdgpu_ras_mgr, retire_page_dwork.work);
struct amdgpu_device *adev = ras_mgr->adev;
int ret;
if (amdgpu_ras_is_rma(adev))
return;
/* If gpu reset is ongoing, delay retiring the bad pages */
if (amdgpu_in_reset(adev) || amdgpu_ras_in_recovery(adev)) {
schedule_delayed_work(&ras_mgr->retire_page_dwork,
msecs_to_jiffies(RAS_MGR_RETIRE_PAGE_INTERVAL * 3));
return;
}
ret = ras_umc_handle_bad_pages(ras_mgr->ras_core, NULL);
if (!ret)
schedule_delayed_work(&ras_mgr->retire_page_dwork,
msecs_to_jiffies(RAS_MGR_RETIRE_PAGE_INTERVAL));
}
int amdgpu_ras_process_init(struct amdgpu_device *adev)
{
struct amdgpu_ras_mgr *ras_mgr = amdgpu_ras_mgr_get_context(adev);
ras_mgr->is_paused = false;
init_completion(&ras_mgr->ras_event_done);
INIT_DELAYED_WORK(&ras_mgr->retire_page_dwork, ras_process_retire_page_dwork);
return 0;
}
int amdgpu_ras_process_fini(struct amdgpu_device *adev)
{
struct amdgpu_ras_mgr *ras_mgr = amdgpu_ras_mgr_get_context(adev);
ras_mgr->is_paused = false;
/* Save all cached bad pages to eeprom */
flush_delayed_work(&ras_mgr->retire_page_dwork);
cancel_delayed_work_sync(&ras_mgr->retire_page_dwork);
return 0;
}
int amdgpu_ras_process_handle_umc_interrupt(struct amdgpu_device *adev, void *data)
{
struct amdgpu_ras_mgr *ras_mgr = amdgpu_ras_mgr_get_context(adev);
if (!ras_mgr->ras_core)
return -EINVAL;
return ras_process_add_interrupt_req(ras_mgr->ras_core, NULL, true);
}
int amdgpu_ras_process_handle_unexpected_interrupt(struct amdgpu_device *adev, void *data)
Annotation
- Immediate include surface: `amdgpu.h`, `amdgpu_reset.h`, `amdgpu_xgmi.h`, `ras_sys.h`, `amdgpu_ras_mgr.h`, `amdgpu_ras_process.h`.
- Detected declarations: `function Copyright`, `function amdgpu_ras_process_init`, `function amdgpu_ras_process_fini`, `function amdgpu_ras_process_handle_umc_interrupt`, `function amdgpu_ras_process_handle_unexpected_interrupt`, `function amdgpu_ras_process_handle_consumption_interrupt`, `function amdgpu_ras_process_begin`, `function amdgpu_ras_process_end`, `function amdgpu_ras_process_pre_reset`, `function amdgpu_ras_process_post_reset`.
- 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.