drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c- Extension
.c- Size
- 32383 bytes
- Lines
- 1174
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hlinux/module.hlinux/pci.hdrm/drm_cache.hamdgpu.hgmc_v6_0.hamdgpu_ucode.hamdgpu_gem.hbif/bif_3_0_d.hbif/bif_3_0_sh_mask.hoss/oss_1_0_d.hoss/oss_1_0_sh_mask.hgmc/gmc_6_0_d.hgmc/gmc_6_0_sh_mask.hdce/dce_6_0_d.hdce/dce_6_0_sh_mask.hsi_enums.h
Detected Declarations
function gmc_v6_0_mc_stopfunction gmc_v6_0_mc_resumefunction gmc_v6_0_init_microcodefunction gmc_v6_0_mc_load_microcodefunction gmc_v6_0_vram_gtt_locationfunction gmc_v6_0_mc_programfunction gmc_v6_0_mc_initfunction gmc_v6_0_flush_gpu_tlbfunction gmc_v6_0_emit_flush_gpu_tlbfunction gmc_v6_0_get_vm_pdefunction gmc_v6_0_get_vm_ptefunction gmc_v6_0_set_fault_enable_defaultfunction gmc_v8_0_set_prtfunction gmc_v6_0_gart_enablefunction gmc_v6_0_gart_initfunction gmc_v6_0_gart_disablefunction gmc_v6_0_vm_decode_faultfunction gmc_v6_0_enable_mc_lsfunction gmc_v6_0_enable_mc_mgcgfunction gmc_v6_0_enable_bif_mglsfunction gmc_v6_0_enable_hdp_mgcgfunction gmc_v6_0_enable_hdp_lsfunction gmc_v6_0_convert_vram_typefunction gmc_v6_0_early_initfunction gmc_v6_0_late_initfunction gmc_v6_0_get_vbios_fb_sizefunction gmc_v6_0_sw_initfunction gmc_v6_0_sw_finifunction gmc_v6_0_hw_initfunction gmc_v6_0_hw_finifunction gmc_v6_0_suspendfunction gmc_v6_0_resumefunction gmc_v6_0_is_idlefunction gmc_v6_0_wait_for_idlefunction gmc_v6_0_soft_resetfunction gmc_v6_0_vm_fault_interrupt_statefunction gmc_v6_0_process_interruptfunction gmc_v6_0_set_clockgating_statefunction gmc_v6_0_set_powergating_statefunction gmc_v6_0_set_gmc_funcsfunction gmc_v6_0_set_irq_funcs
Annotated Snippet
if (r) {
dev_err(adev->dev, "Failed to load MC firmware!\n");
return r;
}
}
r = gmc_v6_0_gart_enable(adev);
if (r)
return r;
if (amdgpu_emu_mode == 1)
return amdgpu_gmc_vram_checking(adev);
return 0;
}
static int gmc_v6_0_hw_fini(struct amdgpu_ip_block *ip_block)
{
struct amdgpu_device *adev = ip_block->adev;
amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
gmc_v6_0_gart_disable(adev);
return 0;
}
static int gmc_v6_0_suspend(struct amdgpu_ip_block *ip_block)
{
gmc_v6_0_hw_fini(ip_block);
return 0;
}
static int gmc_v6_0_resume(struct amdgpu_ip_block *ip_block)
{
int r;
struct amdgpu_device *adev = ip_block->adev;
r = gmc_v6_0_hw_init(ip_block);
if (r)
return r;
amdgpu_vmid_reset_all(adev);
return 0;
}
static bool gmc_v6_0_is_idle(struct amdgpu_ip_block *ip_block)
{
struct amdgpu_device *adev = ip_block->adev;
u32 tmp = RREG32(mmSRBM_STATUS);
if (tmp & (SRBM_STATUS__MCB_BUSY_MASK | SRBM_STATUS__MCB_NON_DISPLAY_BUSY_MASK |
SRBM_STATUS__MCC_BUSY_MASK | SRBM_STATUS__MCD_BUSY_MASK | SRBM_STATUS__VMC_BUSY_MASK))
return false;
return true;
}
static int gmc_v6_0_wait_for_idle(struct amdgpu_ip_block *ip_block)
{
unsigned int i;
struct amdgpu_device *adev = ip_block->adev;
for (i = 0; i < adev->usec_timeout; i++) {
if (gmc_v6_0_is_idle(ip_block))
return 0;
udelay(1);
}
return -ETIMEDOUT;
}
static int gmc_v6_0_soft_reset(struct amdgpu_ip_block *ip_block)
{
struct amdgpu_device *adev = ip_block->adev;
u32 srbm_soft_reset = 0;
u32 tmp = RREG32(mmSRBM_STATUS);
if (tmp & SRBM_STATUS__VMC_BUSY_MASK)
srbm_soft_reset = REG_SET_FIELD(srbm_soft_reset,
SRBM_SOFT_RESET, SOFT_RESET_VMC, 1);
if (tmp & (SRBM_STATUS__MCB_BUSY_MASK | SRBM_STATUS__MCB_NON_DISPLAY_BUSY_MASK |
SRBM_STATUS__MCC_BUSY_MASK | SRBM_STATUS__MCD_BUSY_MASK)) {
if (!(adev->flags & AMD_IS_APU))
srbm_soft_reset = REG_SET_FIELD(srbm_soft_reset,
SRBM_SOFT_RESET, SOFT_RESET_MC, 1);
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/module.h`, `linux/pci.h`, `drm/drm_cache.h`, `amdgpu.h`, `gmc_v6_0.h`, `amdgpu_ucode.h`, `amdgpu_gem.h`.
- Detected declarations: `function gmc_v6_0_mc_stop`, `function gmc_v6_0_mc_resume`, `function gmc_v6_0_init_microcode`, `function gmc_v6_0_mc_load_microcode`, `function gmc_v6_0_vram_gtt_location`, `function gmc_v6_0_mc_program`, `function gmc_v6_0_mc_init`, `function gmc_v6_0_flush_gpu_tlb`, `function gmc_v6_0_emit_flush_gpu_tlb`, `function gmc_v6_0_get_vm_pde`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.