drivers/gpu/drm/amd/amdgpu/gfxhub_v11_5_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/gfxhub_v11_5_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/gfxhub_v11_5_0.c- Extension
.c- Size
- 18724 bytes
- Lines
- 515
- 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.hgfxhub_v11_5_0.hgc/gc_11_5_0_offset.hgc/gc_11_5_0_sh_mask.hnavi10_enum.hsoc15_common.h
Detected Declarations
function gfxhub_v11_5_0_get_invalidate_reqfunction gfxhub_v11_5_0_print_l2_protection_fault_statusfunction gfxhub_v11_5_0_get_fb_locationfunction gfxhub_v11_5_0_get_mc_fb_offsetfunction gfxhub_v11_5_0_setup_vm_pt_regsfunction gfxhub_v11_5_0_init_gart_aperture_regsfunction gfxhub_v11_5_0_init_system_aperture_regsfunction gfxhub_v11_5_0_init_tlb_regsfunction gfxhub_v11_5_0_init_cache_regsfunction gfxhub_v11_5_0_enable_system_domainfunction gfxhub_v11_5_0_disable_identity_aperturefunction gfxhub_v11_5_0_setup_vmid_configfunction gfxhub_v11_5_0_program_invalidationfunction gfxhub_v11_5_0_gart_enablefunction gfxhub_v11_5_0_gart_disablefunction gfxhub_v11_5_0_set_fault_enable_defaultfunction gfxhub_v11_5_0_init
Annotated Snippet
#include "amdgpu.h"
#include "gfxhub_v11_5_0.h"
#include "gc/gc_11_5_0_offset.h"
#include "gc/gc_11_5_0_sh_mask.h"
#include "navi10_enum.h"
#include "soc15_common.h"
#define regGCVM_L2_CNTL3_DEFAULT 0x80100007
#define regGCVM_L2_CNTL4_DEFAULT 0x000000c1
#define regGCVM_L2_CNTL5_DEFAULT 0x00003fe0
static const char *gfxhub_client_ids[] = {
"CB/DB",
"Reserved",
"GE1",
"GE2",
"CPF",
"CPC",
"CPG",
"RLC",
"TCP",
"SQC (inst)",
"SQC (data)",
"SQG",
"Reserved",
"SDMA0",
"SDMA1",
"GCR",
"SDMA2",
"SDMA3",
};
static uint32_t gfxhub_v11_5_0_get_invalidate_req(unsigned int vmid,
uint32_t flush_type)
{
u32 req = 0;
/* invalidate using legacy mode on vmid*/
req = REG_SET_FIELD(req, GCVM_INVALIDATE_ENG0_REQ,
PER_VMID_INVALIDATE_REQ, 1 << vmid);
req = REG_SET_FIELD(req, GCVM_INVALIDATE_ENG0_REQ, FLUSH_TYPE, flush_type);
req = REG_SET_FIELD(req, GCVM_INVALIDATE_ENG0_REQ, INVALIDATE_L2_PTES, 1);
req = REG_SET_FIELD(req, GCVM_INVALIDATE_ENG0_REQ, INVALIDATE_L2_PDE0, 1);
req = REG_SET_FIELD(req, GCVM_INVALIDATE_ENG0_REQ, INVALIDATE_L2_PDE1, 1);
req = REG_SET_FIELD(req, GCVM_INVALIDATE_ENG0_REQ, INVALIDATE_L2_PDE2, 1);
req = REG_SET_FIELD(req, GCVM_INVALIDATE_ENG0_REQ, INVALIDATE_L1_PTES, 1);
req = REG_SET_FIELD(req, GCVM_INVALIDATE_ENG0_REQ,
CLEAR_PROTECTION_FAULT_STATUS_ADDR, 0);
return req;
}
static void
gfxhub_v11_5_0_print_l2_protection_fault_status(struct amdgpu_device *adev,
uint32_t status)
{
u32 cid = REG_GET_FIELD(status,
GCVM_L2_PROTECTION_FAULT_STATUS, CID);
dev_err(adev->dev,
"GCVM_L2_PROTECTION_FAULT_STATUS:0x%08X\n",
status);
dev_err(adev->dev, "\t Faulty UTCL2 client ID: %s (0x%x)\n",
cid >= ARRAY_SIZE(gfxhub_client_ids) ? "unknown" : gfxhub_client_ids[cid],
cid);
dev_err(adev->dev, "\t MORE_FAULTS: 0x%lx\n",
REG_GET_FIELD(status,
GCVM_L2_PROTECTION_FAULT_STATUS, MORE_FAULTS));
dev_err(adev->dev, "\t WALKER_ERROR: 0x%lx\n",
REG_GET_FIELD(status,
GCVM_L2_PROTECTION_FAULT_STATUS, WALKER_ERROR));
dev_err(adev->dev, "\t PERMISSION_FAULTS: 0x%lx\n",
REG_GET_FIELD(status,
GCVM_L2_PROTECTION_FAULT_STATUS, PERMISSION_FAULTS));
dev_err(adev->dev, "\t MAPPING_ERROR: 0x%lx\n",
REG_GET_FIELD(status,
GCVM_L2_PROTECTION_FAULT_STATUS, MAPPING_ERROR));
dev_err(adev->dev, "\t RW: 0x%lx\n",
REG_GET_FIELD(status,
GCVM_L2_PROTECTION_FAULT_STATUS, RW));
}
static u64 gfxhub_v11_5_0_get_fb_location(struct amdgpu_device *adev)
{
u64 base = RREG32_SOC15(GC, 0, regGCMC_VM_FB_LOCATION_BASE);
base &= GCMC_VM_FB_LOCATION_BASE__FB_BASE_MASK;
Annotation
- Immediate include surface: `amdgpu.h`, `gfxhub_v11_5_0.h`, `gc/gc_11_5_0_offset.h`, `gc/gc_11_5_0_sh_mask.h`, `navi10_enum.h`, `soc15_common.h`.
- Detected declarations: `function gfxhub_v11_5_0_get_invalidate_req`, `function gfxhub_v11_5_0_print_l2_protection_fault_status`, `function gfxhub_v11_5_0_get_fb_location`, `function gfxhub_v11_5_0_get_mc_fb_offset`, `function gfxhub_v11_5_0_setup_vm_pt_regs`, `function gfxhub_v11_5_0_init_gart_aperture_regs`, `function gfxhub_v11_5_0_init_system_aperture_regs`, `function gfxhub_v11_5_0_init_tlb_regs`, `function gfxhub_v11_5_0_init_cache_regs`, `function gfxhub_v11_5_0_enable_system_domain`.
- 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.