drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c- Extension
.c- Size
- 22683 bytes
- Lines
- 673
- 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_xcp.hgfxhub_v1_2.hgfxhub_v1_1.hgc/gc_9_4_3_offset.hgc/gc_9_4_3_sh_mask.hvega10_enum.hsoc15_common.h
Detected Declarations
function filesfunction gfxhub_v1_2_xcc_setup_vm_pt_regsfunction for_each_instfunction gfxhub_v1_2_setup_vm_pt_regsfunction gfxhub_v1_2_xcc_init_gart_aperture_regsfunction memoryfunction gfxhub_v1_2_xcc_init_system_aperture_regsfunction for_each_instfunction gfxhub_v1_2_xcc_init_tlb_regsfunction for_each_instfunction gfxhub_v1_2_xcc_init_cache_regsfunction for_each_instfunction gfxhub_v1_2_xcc_enable_system_domainfunction for_each_instfunction gfxhub_v1_2_xcc_disable_identity_aperturefunction for_each_instfunction gfxhub_v1_2_per_process_xnack_supportfunction gfxhub_v1_2_xcc_setup_vmid_configfunction for_each_instfunction gfxhub_v1_2_xcc_program_invalidationfunction for_each_instfunction gfxhub_v1_2_xcc_gart_enablefunction gfxhub_v1_2_gart_enablefunction gfxhub_v1_2_xcc_gart_disablefunction for_each_instfunction gfxhub_v1_2_gart_disablefunction gfxhub_v1_2_xcc_set_fault_enable_defaultfunction for_each_instfunction gfxhub_v1_2_set_fault_enable_defaultfunction gfxhub_v1_2_xcc_initfunction for_each_instfunction gfxhub_v1_2_initfunction gfxhub_v1_2_get_xgmi_infofunction gfxhub_v1_2_xcp_resumefunction gfxhub_v1_2_xcp_suspend
Annotated Snippet
if (adev->gmc.pdb0_bo) {
WREG32_SOC15(GC, GET_INST(GC, i),
regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32,
(u32)(gart_start >> 12));
WREG32_SOC15(GC, GET_INST(GC, i),
regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32,
(u32)(gart_start >> 44));
WREG32_SOC15(GC, GET_INST(GC, i),
regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,
(u32)(adev->gmc.gart_end >> 12));
WREG32_SOC15(GC, GET_INST(GC, i),
regVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32,
(u32)(adev->gmc.gart_end >> 44));
} else {
WREG32_SOC15(GC, GET_INST(GC, i),
regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32,
(u32)(adev->gmc.gart_start >> 12));
WREG32_SOC15(GC, GET_INST(GC, i),
regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32,
(u32)(adev->gmc.gart_start >> 44));
WREG32_SOC15(GC, GET_INST(GC, i),
regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,
(u32)(adev->gmc.gart_end >> 12));
WREG32_SOC15(GC, GET_INST(GC, i),
regVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32,
(u32)(adev->gmc.gart_end >> 44));
}
}
}
static void
gfxhub_v1_2_xcc_init_system_aperture_regs(struct amdgpu_device *adev,
uint32_t xcc_mask)
{
uint64_t value;
uint32_t tmp;
int i;
for_each_inst(i, xcc_mask) {
/* Program the AGP BAR */
WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_AGP_BASE, 0);
WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
if (!amdgpu_sriov_vf(adev) || adev->asic_type <= CHIP_VEGA10) {
/* Program the system aperture low logical page number. */
WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_SYSTEM_APERTURE_LOW_ADDR,
min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18);
if (adev->apu_flags & (AMD_APU_IS_RAVEN2 |
AMD_APU_IS_RENOIR |
AMD_APU_IS_GREEN_SARDINE))
/*
* Raven2 has a HW issue that it is unable to use the
* vram which is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR.
* So here is the workaround that increase system
* aperture high address (add 1) to get rid of the VM
* fault and hardware hang.
*/
WREG32_SOC15_RLC(GC, GET_INST(GC, i),
regMC_VM_SYSTEM_APERTURE_HIGH_ADDR,
max((adev->gmc.fb_end >> 18) + 0x1,
adev->gmc.agp_end >> 18));
else
WREG32_SOC15_RLC(GC, GET_INST(GC, i),
regMC_VM_SYSTEM_APERTURE_HIGH_ADDR,
max(adev->gmc.fb_end, adev->gmc.agp_end) >> 18);
/* Set default page address. */
value = amdgpu_gmc_vram_mc2pa(adev, adev->mem_scratch.gpu_addr);
WREG32_SOC15(GC, GET_INST(GC, i), regMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB,
(u32)(value >> 12));
WREG32_SOC15(GC, GET_INST(GC, i), regMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB,
(u32)(value >> 44));
/* Program "protection fault". */
WREG32_SOC15(GC, GET_INST(GC, i), regVM_L2_PROTECTION_FAULT_DEFAULT_ADDR_LO32,
(u32)(adev->dummy_page_addr >> 12));
WREG32_SOC15(GC, GET_INST(GC, i), regVM_L2_PROTECTION_FAULT_DEFAULT_ADDR_HI32,
(u32)((u64)adev->dummy_page_addr >> 44));
tmp = RREG32_SOC15(GC, GET_INST(GC, i), regVM_L2_PROTECTION_FAULT_CNTL2);
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL2,
ACTIVE_PAGE_MIGRATION_PTE_READ_RETRY, 1);
WREG32_SOC15(GC, GET_INST(GC, i), regVM_L2_PROTECTION_FAULT_CNTL2, tmp);
}
/* In the case squeezing vram into GART aperture, we don't use
Annotation
- Immediate include surface: `amdgpu.h`, `amdgpu_xcp.h`, `gfxhub_v1_2.h`, `gfxhub_v1_1.h`, `gc/gc_9_4_3_offset.h`, `gc/gc_9_4_3_sh_mask.h`, `vega10_enum.h`, `soc15_common.h`.
- Detected declarations: `function files`, `function gfxhub_v1_2_xcc_setup_vm_pt_regs`, `function for_each_inst`, `function gfxhub_v1_2_setup_vm_pt_regs`, `function gfxhub_v1_2_xcc_init_gart_aperture_regs`, `function memory`, `function gfxhub_v1_2_xcc_init_system_aperture_regs`, `function for_each_inst`, `function gfxhub_v1_2_xcc_init_tlb_regs`, `function for_each_inst`.
- 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.