drivers/gpu/drm/amd/amdgpu/gfxhub_v12_1.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/gfxhub_v12_1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/gfxhub_v12_1.c- Extension
.c- Size
- 28314 bytes
- Lines
- 865
- 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_v12_1.hgc/gc_12_1_0_offset.hgc/gc_12_1_0_sh_mask.hsoc_v1_0_enum.hsoc15_common.h
Detected Declarations
function filesfunction gfxhub_v12_1_get_mc_fb_offsetfunction gfxhub_v12_1_xcc_setup_vm_pt_regsfunction for_each_instfunction gfxhub_v12_1_setup_vm_pt_regsfunction gfxhub_v12_1_xcc_init_gart_aperture_regsfunction memoryfunction gfxhub_v12_1_xcc_init_system_aperture_regsfunction for_each_instfunction gfxhub_v12_1_xcc_init_tlb_regsfunction for_each_instfunction gfxhub_v12_1_xcc_init_cache_regsfunction for_each_instfunction gfxhub_v12_1_xcc_enable_system_domainfunction for_each_instfunction gfxhub_v12_1_xcc_disable_identity_aperturefunction for_each_instfunction gfxhub_v12_1_xcc_setup_vmid_configfunction for_each_instfunction gfxhub_v12_1_xcc_program_invalidationfunction for_each_instfunction gfxhub_v12_1_xcc_gart_enablefunction gfxhub_v12_1_gart_enablefunction gfxhub_v12_1_xcc_gart_disablefunction for_each_instfunction gfxhub_v12_1_gart_disablefunction gfxhub_v12_1_xcc_set_fault_enable_defaultfunction for_each_instfunction gfxhub_v12_1_set_fault_enable_defaultfunction gfxhub_v12_1_get_invalidate_reqfunction gfxhub_v12_1_print_l2_protection_fault_statusfunction gfxhub_v12_1_xcc_initfunction for_each_instfunction gfxhub_v12_1_initfunction gfxhub_v12_1_xcp_resumefunction gfxhub_v12_1_xcp_suspend
Annotated Snippet
if (adev->gmc.pdb0_bo) {
WREG32_SOC15(GC, GET_INST(GC, i),
regGCVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32,
(u32)(adev->gmc.fb_start >> 12));
WREG32_SOC15(GC, GET_INST(GC, i),
regGCVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32,
(u32)(adev->gmc.fb_start >> 44));
WREG32_SOC15(GC, GET_INST(GC, i),
regGCVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,
(u32)(adev->gmc.gart_end >> 12));
WREG32_SOC15(GC, GET_INST(GC, i),
regGCVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32,
(u32)(adev->gmc.gart_end >> 44));
} else {
WREG32_SOC15(GC, GET_INST(GC, i),
regGCVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32,
(u32)(adev->gmc.gart_start >> 12));
WREG32_SOC15(GC, GET_INST(GC, i),
regGCVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32,
(u32)(adev->gmc.gart_start >> 44));
WREG32_SOC15(GC, GET_INST(GC, i),
regGCVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,
(u32)(adev->gmc.gart_end >> 12));
WREG32_SOC15(GC, GET_INST(GC, i),
regGCVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32,
(u32)(adev->gmc.gart_end >> 44));
}
}
}
static void gfxhub_v12_1_xcc_init_system_aperture_regs(struct amdgpu_device *adev,
uint32_t xcc_mask)
{
uint64_t value;
uint32_t tmp;
int i;
/*TODO: revisit whether the SRIOV guest access to theseregisters
* is blocked by security policy or not */
if (amdgpu_sriov_vf(adev))
return;
for_each_inst(i, xcc_mask) {
if (adev->gmc.pdb0_bo) {
/* Disable agp and system aperture
* when vmid0 page table is enabled */
WREG32_SOC15(GC, GET_INST(GC, i),
regGCMC_VM_FB_LOCATION_TOP_LO32, 0);
WREG32_SOC15(GC, GET_INST(GC, i),
regGCMC_VM_FB_LOCATION_TOP_HI32, 0);
WREG32_SOC15(GC, GET_INST(GC, i),
regGCMC_VM_FB_LOCATION_BASE_LO32,
0xFFFFFFFF);
WREG32_SOC15(GC, GET_INST(GC, i),
regGCMC_VM_FB_LOCATION_BASE_HI32, 1);
WREG32_SOC15(GC, GET_INST(GC, i),
regGCMC_VM_AGP_TOP_LO32, 0);
WREG32_SOC15(GC, GET_INST(GC, i),
regGCMC_VM_AGP_TOP_HI32, 0);
WREG32_SOC15(GC, GET_INST(GC, i),
regGCMC_VM_AGP_BOT_LO32,
0xFFFFFFFF);
WREG32_SOC15(GC, GET_INST(GC, i),
regGCMC_VM_AGP_BOT_HI32, 1);
WREG32_SOC15(GC, GET_INST(GC, i),
regGCMC_VM_SYSTEM_APERTURE_LOW_ADDR_LO32,
0xFFFFFFFF);
WREG32_SOC15(GC, GET_INST(GC, i),
regGCMC_VM_SYSTEM_APERTURE_LOW_ADDR_HI32,
0x7F);
WREG32_SOC15(GC, GET_INST(GC, i),
regGCMC_VM_SYSTEM_APERTURE_HIGH_ADDR_LO32, 0);
WREG32_SOC15(GC, GET_INST(GC, i),
regGCMC_VM_SYSTEM_APERTURE_HIGH_ADDR_HI32, 0);
} else {
/* Program the AGP BAR */
WREG32_SOC15_RLC(GC, GET_INST(GC, i),
regGCMC_VM_AGP_BASE_LO32, 0);
WREG32_SOC15_RLC(GC, GET_INST(GC, i),
regGCMC_VM_AGP_BASE_HI32, 0);
WREG32_SOC15_RLC(GC, GET_INST(GC, i),
regGCMC_VM_AGP_BOT_LO32,
lower_32_bits(adev->gmc.agp_start >> 24));
WREG32_SOC15_RLC(GC, GET_INST(GC, i),
regGCMC_VM_AGP_BOT_HI32,
upper_32_bits(adev->gmc.agp_start >> 24));
WREG32_SOC15_RLC(GC, GET_INST(GC, i),
regGCMC_VM_AGP_TOP_LO32,
Annotation
- Immediate include surface: `amdgpu.h`, `amdgpu_xcp.h`, `gfxhub_v12_1.h`, `gc/gc_12_1_0_offset.h`, `gc/gc_12_1_0_sh_mask.h`, `soc_v1_0_enum.h`, `soc15_common.h`.
- Detected declarations: `function files`, `function gfxhub_v12_1_get_mc_fb_offset`, `function gfxhub_v12_1_xcc_setup_vm_pt_regs`, `function for_each_inst`, `function gfxhub_v12_1_setup_vm_pt_regs`, `function gfxhub_v12_1_xcc_init_gart_aperture_regs`, `function memory`, `function gfxhub_v12_1_xcc_init_system_aperture_regs`, `function for_each_inst`, `function gfxhub_v12_1_xcc_init_tlb_regs`.
- 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.