drivers/gpu/drm/amd/amdgpu/nv.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/nv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/nv.c- Extension
.c- Size
- 34275 bytes
- Lines
- 1071
- 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
linux/firmware.hlinux/slab.hlinux/module.hlinux/pci.hdrm/amdgpu_drm.hamdgpu.hamdgpu_atombios.hamdgpu_ih.hamdgpu_uvd.hamdgpu_vce.hamdgpu_ucode.hamdgpu_psp.hatom.hamd_pcie.hgc/gc_10_1_0_offset.hgc/gc_10_1_0_sh_mask.hmp/mp_11_0_offset.hsoc15.hsoc15_common.hgmc_v10_0.hgfxhub_v2_0.hmmhub_v2_0.hnbio_v2_3.hnbio_v7_2.hhdp_v5_0.hnv.hnavi10_ih.hgfx_v10_0.hsdma_v5_0.hsdma_v5_2.hvcn_v2_0.hjpeg_v2_0.h
Detected Declarations
function nv_query_video_codecsfunction nv_didt_rregfunction nv_didt_wregfunction nv_get_config_memsizefunction nv_get_xclkfunction nv_grbm_selectfunction nv_read_disabled_biosfunction nv_get_register_valuefunction nv_read_registerfunction nv_asic_mode2_resetfunction nv_asic_reset_methodfunction nv_asic_resetfunction nv_set_uvd_clocksfunction nv_set_vce_clocksfunction nv_set_virt_opsfunction nv_need_full_resetfunction nv_need_reset_on_initfunction nv_init_doorbell_indexfunction nv_update_umd_stable_pstatefunction nv_common_early_initfunction nv_common_late_initfunction nv_common_sw_initfunction nv_common_hw_initfunction nv_common_hw_finifunction nv_common_suspendfunction nv_common_resumefunction nv_common_is_idlefunction nv_common_set_clockgating_statefunction nv_common_set_powergating_statefunction nv_common_get_clockgating_state
Annotated Snippet
if (amdgpu_sriov_vf(adev)) {
if (adev->vcn.harvest_config & AMDGPU_VCN_HARVEST_VCN0) {
if (encode)
*codecs = &sriov_sc_video_codecs_encode;
else
*codecs = &sriov_sc_video_codecs_decode_vcn1;
} else {
if (encode)
*codecs = &sriov_sc_video_codecs_encode;
else
*codecs = &sriov_sc_video_codecs_decode_vcn0;
}
} else {
if (adev->vcn.harvest_config & AMDGPU_VCN_HARVEST_VCN0) {
if (encode)
*codecs = &sc_video_codecs_encode;
else
*codecs = &sc_video_codecs_decode_vcn1;
} else {
if (encode)
*codecs = &sc_video_codecs_encode;
else
*codecs = &sc_video_codecs_decode_vcn0;
}
}
return 0;
case IP_VERSION(3, 0, 16):
case IP_VERSION(3, 0, 2):
if (encode)
*codecs = &sc_video_codecs_encode;
else
*codecs = &sc_video_codecs_decode_vcn0;
return 0;
case IP_VERSION(3, 1, 1):
case IP_VERSION(3, 1, 2):
if (encode)
*codecs = &sc_video_codecs_encode;
else
*codecs = &yc_video_codecs_decode;
return 0;
case IP_VERSION(3, 0, 33):
if (encode)
*codecs = &bg_video_codecs_encode;
else
*codecs = &bg_video_codecs_decode;
return 0;
case IP_VERSION(2, 0, 0):
case IP_VERSION(2, 0, 2):
if (encode)
*codecs = &nv_video_codecs_encode;
else
*codecs = &nv_video_codecs_decode;
return 0;
default:
return -EINVAL;
}
}
static u32 nv_didt_rreg(struct amdgpu_device *adev, u32 reg)
{
unsigned long flags, address, data;
u32 r;
address = SOC15_REG_OFFSET(GC, 0, mmDIDT_IND_INDEX);
data = SOC15_REG_OFFSET(GC, 0, mmDIDT_IND_DATA);
spin_lock_irqsave(&adev->reg.didt.lock, flags);
WREG32(address, (reg));
r = RREG32(data);
spin_unlock_irqrestore(&adev->reg.didt.lock, flags);
return r;
}
static void nv_didt_wreg(struct amdgpu_device *adev, u32 reg, u32 v)
{
unsigned long flags, address, data;
address = SOC15_REG_OFFSET(GC, 0, mmDIDT_IND_INDEX);
data = SOC15_REG_OFFSET(GC, 0, mmDIDT_IND_DATA);
spin_lock_irqsave(&adev->reg.didt.lock, flags);
WREG32(address, (reg));
WREG32(data, (v));
spin_unlock_irqrestore(&adev->reg.didt.lock, flags);
}
static u32 nv_get_config_memsize(struct amdgpu_device *adev)
{
return adev->nbio.funcs->get_memsize(adev);
}
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/slab.h`, `linux/module.h`, `linux/pci.h`, `drm/amdgpu_drm.h`, `amdgpu.h`, `amdgpu_atombios.h`, `amdgpu_ih.h`.
- Detected declarations: `function nv_query_video_codecs`, `function nv_didt_rreg`, `function nv_didt_wreg`, `function nv_get_config_memsize`, `function nv_get_xclk`, `function nv_grbm_select`, `function nv_read_disabled_bios`, `function nv_get_register_value`, `function nv_read_register`, `function nv_asic_mode2_reset`.
- 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.