drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c- Extension
.c- Size
- 18248 bytes
- Lines
- 660
- 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
amdgpu.hgmc_v12_1.hsoc15_common.hsoc_v1_0_enum.hoss/osssys_7_1_0_offset.hoss/osssys_7_1_0_sh_mask.hivsrcid/vmc/irqsrcs_vmc_1_0.h
Detected Declarations
function filesfunction for_each_set_bitfunction gmc_v12_1_process_interruptfunction gmc_v12_1_get_vmid_pasid_mapping_infofunction gmc_v12_1_flush_vm_hubfunction gmc_v12_1_flush_gpu_tlbfunction gmc_v12_1_flush_gpu_tlb_pasidfunction gmc_v12_1_emit_flush_gpu_tlbfunction gmc_v12_1_emit_pasid_mappingfunction gmc_v12_1_get_vm_pdefunction gmc_v12_1_get_coherence_flagsfunction gmc_v12_1_get_vm_ptefunction gmc_v12_1_set_gmc_funcsfunction gmc_v12_1_set_irq_funcsfunction gmc_v12_1_init_vram_info
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 &= ~hub->vm_cntx_cntl_vm_fault;
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 |= hub->vm_cntx_cntl_vm_fault;
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_v12_1_process_interrupt(struct amdgpu_device *adev,
struct amdgpu_irq_src *source,
struct amdgpu_iv_entry *entry)
{
struct amdgpu_task_info *task_info;
bool retry_fault = false, write_fault = false;
unsigned int vmhub, node_id;
struct amdgpu_vmhub *hub;
uint32_t cam_index = 0;
const char *hub_name;
int ret, xcc_id = 0;
uint32_t status = 0;
const char *die_name;
char die_name_buf[32];
u64 addr;
node_id = entry->node_id;
addr = (u64)entry->src_data[0] << 12;
addr |= ((u64)entry->src_data[1] & 0x1fff) << 44;
if (entry->src_id == UTCL2_1_0__SRCID__RETRY) {
retry_fault = true;
write_fault = !!(entry->src_data[1] & AMDGPU_GMC121_FAULT_SOURCE_DATA_WRITE);
}
if (entry->client_id == SOC_V1_0_IH_CLIENTID_VMC) {
hub_name = "mmhub0";
Annotation
- Immediate include surface: `amdgpu.h`, `gmc_v12_1.h`, `soc15_common.h`, `soc_v1_0_enum.h`, `oss/osssys_7_1_0_offset.h`, `oss/osssys_7_1_0_sh_mask.h`, `ivsrcid/vmc/irqsrcs_vmc_1_0.h`.
- Detected declarations: `function files`, `function for_each_set_bit`, `function gmc_v12_1_process_interrupt`, `function gmc_v12_1_get_vmid_pasid_mapping_info`, `function gmc_v12_1_flush_vm_hub`, `function gmc_v12_1_flush_gpu_tlb`, `function gmc_v12_1_flush_gpu_tlb_pasid`, `function gmc_v12_1_emit_flush_gpu_tlb`, `function gmc_v12_1_emit_pasid_mapping`, `function gmc_v12_1_get_vm_pde`.
- 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.