drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c- Extension
.c- Size
- 65757 bytes
- Lines
- 2369
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hlinux/pci.hdrm/drm_cache.hamdgpu.hgmc_v9_0.hamdgpu_atomfirmware.hamdgpu_gem.hgc/gc_9_0_sh_mask.hdce/dce_12_0_offset.hdce/dce_12_0_sh_mask.hvega10_enum.hmmhub/mmhub_1_0_offset.hathub/athub_1_0_sh_mask.hathub/athub_1_0_offset.hoss/osssys_4_0_offset.hsoc15.hsoc15d.hsoc15_common.humc/umc_6_0_sh_mask.hgfxhub_v1_0.hmmhub_v1_0.hathub_v1_0.hgfxhub_v1_1.hgfxhub_v1_2.hmmhub_v9_4.hmmhub_v1_7.hmmhub_v1_8.humc_v6_1.humc_v6_0.humc_v6_7.humc_v12_0.hhdp_v4_0.h
Detected Declarations
function gmc_v9_0_ecc_interrupt_statefunction gmc_v9_0_vm_fault_interrupt_statefunction for_each_set_bitfunction gmc_v9_0_process_interruptfunction gmc_v9_0_set_irq_funcsfunction gmc_v9_0_get_invalidate_reqfunction gmc_v9_0_use_invalidate_semaphorefunction gmc_v9_0_get_atc_vmid_pasid_mapping_infofunction gmc_v9_0_flush_gpu_tlbfunction gmc_v9_0_flush_gpu_tlb_pasidfunction gmc_v9_0_emit_flush_gpu_tlbfunction gmc_v9_0_emit_pasid_mappingfunction gmc_v9_0_get_vm_pdefunction gmc_v9_0_get_coherence_flagsfunction gmc_v9_0_get_vm_ptefunction gmc_v9_0_override_vm_pte_flagsfunction AMDGPU_PTE_MTYPE_VG10function gmc_v9_0_get_vbios_fb_sizefunction gmc_v9_0_need_reset_on_initfunction gmc_v9_0_set_gmc_funcsfunction gmc_v9_0_set_umc_funcsfunction gmc_v9_0_init_mmhub_client_infofunction gmc_v9_0_set_mmhub_funcsfunction gmc_v9_0_set_mmhub_ras_funcsfunction gmc_v9_0_set_gfxhub_funcsfunction gmc_v9_0_set_hdp_ras_funcsfunction gmc_v9_0_set_mca_ras_funcsfunction IP_VERSIONfunction gmc_v9_0_set_xgmi_ras_funcsfunction gmc_v9_0_init_nps_detailsfunction gmc_v9_0_early_initfunction gmc_v9_0_late_initfunction gmc_v9_0_vram_gtt_locationfunction gmc_v9_0_mc_initfunction Platformfunction gmc_v9_0_gart_initfunction gmc_v9_0_save_registersfunction gmc_v9_0_init_vram_infofunction gmc_v9_0_sw_initfunction gmc_v9_0_sw_finifunction gmc_v9_0_init_golden_registersfunction gmc_v9_0_restore_registersfunction gmc_v9_0_gart_enablefunction gmc_v9_0_hw_initfunction gmc_v9_0_gart_disablefunction gmc_v9_0_hw_finifunction gmc_v9_0_suspendfunction gmc_v9_0_resume
Annotated Snippet
for_each_set_bit(j, adev->vmhubs_mask, AMDGPU_MAX_VMHUBS) {
hub = &adev->vmhub[j];
for (i = 0; i < 16; i++) {
reg = hub->vm_context0_cntl + i;
/* This works because this interrupt is only
* enabled at init/resume and disabled in
* fini/suspend, so the overall state doesn't
* change over the course of suspend/resume.
*/
if (adev->in_s0ix && (j == AMDGPU_GFXHUB(0)))
continue;
if (j >= AMDGPU_MMHUB0(0))
tmp = RREG32_SOC15_IP(MMHUB, reg);
else
tmp = RREG32_XCC(reg, j);
tmp &= ~bits;
if (j >= AMDGPU_MMHUB0(0))
WREG32_SOC15_IP(MMHUB, reg, tmp);
else
WREG32_XCC(reg, tmp, j);
}
}
break;
case AMDGPU_IRQ_STATE_ENABLE:
for_each_set_bit(j, adev->vmhubs_mask, AMDGPU_MAX_VMHUBS) {
hub = &adev->vmhub[j];
for (i = 0; i < 16; i++) {
reg = hub->vm_context0_cntl + i;
/* This works because this interrupt is only
* enabled at init/resume and disabled in
* fini/suspend, so the overall state doesn't
* change over the course of suspend/resume.
*/
if (adev->in_s0ix && (j == AMDGPU_GFXHUB(0)))
continue;
if (j >= AMDGPU_MMHUB0(0))
tmp = RREG32_SOC15_IP(MMHUB, reg);
else
tmp = RREG32_XCC(reg, j);
tmp |= bits;
if (j >= AMDGPU_MMHUB0(0))
WREG32_SOC15_IP(MMHUB, reg, tmp);
else
WREG32_XCC(reg, tmp, j);
}
}
break;
default:
break;
}
return 0;
}
static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev,
struct amdgpu_irq_src *source,
struct amdgpu_iv_entry *entry)
{
bool retry_fault = !!(entry->src_data[1] &
AMDGPU_GMC9_FAULT_SOURCE_DATA_RETRY);
bool write_fault = !!(entry->src_data[1] &
AMDGPU_GMC9_FAULT_SOURCE_DATA_WRITE);
uint32_t status = 0, cid = 0, rw = 0, fed = 0;
struct amdgpu_task_info *task_info;
struct amdgpu_vmhub *hub;
const char *mmhub_cid;
const char *hub_name;
unsigned int vmhub;
u64 addr;
uint32_t cam_index = 0;
int ret, xcc_id = 0;
uint32_t node_id;
node_id = entry->node_id;
addr = (u64)entry->src_data[0] << 12;
addr |= ((u64)entry->src_data[1] & 0xf) << 44;
if (entry->client_id == SOC15_IH_CLIENTID_VMC) {
hub_name = "mmhub0";
vmhub = AMDGPU_MMHUB0(node_id / 4);
} else if (entry->client_id == SOC15_IH_CLIENTID_VMC1) {
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/pci.h`, `drm/drm_cache.h`, `amdgpu.h`, `gmc_v9_0.h`, `amdgpu_atomfirmware.h`, `amdgpu_gem.h`, `gc/gc_9_0_sh_mask.h`.
- Detected declarations: `function gmc_v9_0_ecc_interrupt_state`, `function gmc_v9_0_vm_fault_interrupt_state`, `function for_each_set_bit`, `function gmc_v9_0_process_interrupt`, `function gmc_v9_0_set_irq_funcs`, `function gmc_v9_0_get_invalidate_req`, `function gmc_v9_0_use_invalidate_semaphore`, `function gmc_v9_0_get_atc_vmid_pasid_mapping_info`, `function gmc_v9_0_flush_gpu_tlb`, `function gmc_v9_0_flush_gpu_tlb_pasid`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.