drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c- Extension
.c- Size
- 39639 bytes
- Lines
- 1398
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
linux/firmware.hlinux/module.hlinux/pci.hdrm/drm_cache.hamdgpu.hcikd.hcik.hgmc_v7_0.hamdgpu_ucode.hamdgpu_amdkfd.hamdgpu_gem.hbif/bif_4_1_d.hbif/bif_4_1_sh_mask.hgmc/gmc_7_1_d.hgmc/gmc_7_1_sh_mask.hoss/oss_2_0_d.hoss/oss_2_0_sh_mask.hdce/dce_8_0_d.hdce/dce_8_0_sh_mask.hamdgpu_atombios.hivsrcid/ivsrcid_vislands30.h
Detected Declarations
function gmc_v7_0_init_golden_registersfunction gmc_v7_0_mc_stopfunction gmc_v7_0_mc_resumefunction driverfunction hwfunction gmc_v7_0_vram_gtt_locationfunction spacefunction gmc_v7_0_mc_initfunction gmc_v7_0_flush_gpu_tlb_pasidfunction tablefunction gmc_v7_0_emit_flush_gpu_tlbfunction gmc_v7_0_emit_pasid_mappingfunction gmc_v7_0_get_vm_pdefunction gmc_v7_0_get_vm_ptefunction gmc_v7_0_set_fault_enable_defaultfunction gmc_v7_0_set_prtfunction clientsfunction gmc_v7_0_gart_initfunction tablefunction informationfunction gmc_v7_0_enable_mc_lsfunction gmc_v7_0_enable_mc_mgcgfunction gmc_v7_0_enable_bif_mglsfunction gmc_v7_0_enable_hdp_mgcgfunction gmc_v7_0_enable_hdp_lsfunction gmc_v7_0_convert_vram_typefunction gmc_v7_0_early_initfunction gmc_v7_0_late_initfunction gmc_v7_0_get_vbios_fb_sizefunction gmc_v7_0_sw_initfunction gmc_v7_0_sw_finifunction gmc_v7_0_hw_initfunction gmc_v7_0_hw_finifunction gmc_v7_0_suspendfunction gmc_v7_0_resumefunction gmc_v7_0_is_idlefunction gmc_v7_0_wait_for_idlefunction gmc_v7_0_soft_resetfunction gmc_v7_0_vm_fault_interrupt_statefunction gmc_v7_0_process_interruptfunction gmc_v7_0_set_clockgating_statefunction gmc_v7_0_set_powergating_statefunction gmc_v7_0_set_gmc_funcsfunction gmc_v7_0_set_irq_funcs
Annotated Snippet
switch (REG_GET_FIELD(tmp, MC_SHARED_CHMAP, NOOFCHAN)) {
case 0:
default:
numchan = 1;
break;
case 1:
numchan = 2;
break;
case 2:
numchan = 4;
break;
case 3:
numchan = 8;
break;
case 4:
numchan = 3;
break;
case 5:
numchan = 6;
break;
case 6:
numchan = 10;
break;
case 7:
numchan = 12;
break;
case 8:
numchan = 16;
break;
}
adev->gmc.vram_width = numchan * chansize;
}
/* size in MB on si */
adev->gmc.mc_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL;
adev->gmc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL;
if (!(adev->flags & AMD_IS_APU)) {
r = amdgpu_device_resize_fb_bar(adev);
if (r)
return r;
}
adev->gmc.aper_base = pci_resource_start(adev->pdev, 0);
adev->gmc.aper_size = pci_resource_len(adev->pdev, 0);
#ifdef CONFIG_X86_64
if ((adev->flags & AMD_IS_APU) &&
adev->gmc.real_vram_size > adev->gmc.aper_size &&
!amdgpu_passthrough(adev)) {
adev->gmc.aper_base = ((u64)RREG32(mmMC_VM_FB_OFFSET)) << 22;
adev->gmc.aper_size = adev->gmc.real_vram_size;
}
#endif
adev->gmc.visible_vram_size = adev->gmc.aper_size;
/* set the gart size */
switch (adev->asic_type) {
#ifdef CONFIG_DRM_AMDGPU_CIK
case CHIP_BONAIRE: /* UVD, VCE do not support GPUVM */
case CHIP_HAWAII: /* UVD, VCE do not support GPUVM */
case CHIP_KAVERI: /* UVD, VCE do not support GPUVM */
case CHIP_KABINI: /* UVD, VCE do not support GPUVM */
case CHIP_MULLINS: /* UVD, VCE do not support GPUVM */
amdgpu_gmc_set_gart_size(adev, SZ_1G);
break;
#endif
case CHIP_TOPAZ: /* no MM engines */
default:
amdgpu_gmc_set_gart_size(adev, SZ_256M);
break;
}
gmc_v7_0_vram_gtt_location(adev, &adev->gmc);
return 0;
}
/**
* gmc_v7_0_flush_gpu_tlb_pasid - tlb flush via pasid
*
* @adev: amdgpu_device pointer
* @pasid: pasid to be flush
* @flush_type: type of flush
* @all_hub: flush all hubs
* @inst: is used to select which instance of KIQ to use for the invalidation
*
* Flush the TLB for the requested pasid.
*/
static void gmc_v7_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev,
uint16_t pasid, uint32_t flush_type,
bool all_hub, uint32_t inst)
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/module.h`, `linux/pci.h`, `drm/drm_cache.h`, `amdgpu.h`, `cikd.h`, `cik.h`, `gmc_v7_0.h`.
- Detected declarations: `function gmc_v7_0_init_golden_registers`, `function gmc_v7_0_mc_stop`, `function gmc_v7_0_mc_resume`, `function driver`, `function hw`, `function gmc_v7_0_vram_gtt_location`, `function space`, `function gmc_v7_0_mc_init`, `function gmc_v7_0_flush_gpu_tlb_pasid`, `function table`.
- 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.
- 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.