drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c- Extension
.c- Size
- 28710 bytes
- Lines
- 828
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
amdgpu.hnbio_v7_4.hamdgpu_ras.hnbio/nbio_7_4_offset.hnbio/nbio_7_4_sh_mask.hnbio/nbio_7_4_0_smn.hivsrcid/nbio/irqsrcs_nbif_7_4.huapi/linux/kfd_ioctl.h
Detected Declarations
function nbio_v7_4_remap_hdp_registersfunction nbio_v7_4_get_rev_idfunction nbio_v7_4_mc_access_enablefunction nbio_v7_4_get_memsizefunction nbio_v7_4_sdma_doorbell_rangefunction nbio_v7_4_vcn_doorbell_rangefunction nbio_v7_4_enable_doorbell_aperturefunction nbio_v7_4_enable_doorbell_selfring_aperturefunction nbio_v7_4_ih_doorbell_rangefunction nbio_v7_4_update_medium_grain_clock_gatingfunction nbio_v7_4_get_clockgating_statefunction nbio_v7_4_ih_controlfunction nbio_v7_4_get_hdp_flush_req_offsetfunction nbio_v7_4_get_hdp_flush_done_offsetfunction nbio_v7_4_get_pcie_index_offsetfunction nbio_v7_4_get_pcie_data_offsetfunction nbio_v7_4_init_registersfunction nbio_v7_4_handle_ras_controller_intr_no_bifringfunction nbio_v7_4_handle_ras_err_event_athub_intr_no_bifringfunction nbio_v7_4_set_ras_controller_irq_statefunction nbio_v7_4_process_ras_controller_irqfunction nbio_v7_4_set_ras_err_event_athub_irq_statefunction nbio_v7_4_process_err_event_athub_irqfunction nbio_v7_4_init_ras_controller_interruptfunction nbio_v7_4_init_ras_err_event_athub_interruptfunction nbio_v7_4_query_ras_error_countfunction nbio_v7_4_enable_doorbell_interruptfunction nbio_v7_4_program_ltrfunction nbio_v7_4_program_aspmfunction nbio_v7_4_set_reg_remap
Annotated Snippet
if (ras && !ras->disable_ras_err_cnt_harvest && obj) {
/*
* clear error status after ras_controller_intr
* according to hw team and count ue number
* for query
*/
nbio_v7_4_query_ras_error_count(adev, &err_data);
/* logging on error cnt and printing for awareness */
obj->err_data.ue_count += err_data.ue_count;
obj->err_data.ce_count += err_data.ce_count;
if (err_data.ce_count)
dev_info(adev->dev, "%ld correctable hardware "
"errors detected in %s block\n",
obj->err_data.ce_count,
get_ras_block_str(adev->nbio.ras_if));
if (err_data.ue_count)
dev_info(adev->dev, "%ld uncorrectable hardware "
"errors detected in %s block\n",
obj->err_data.ue_count,
get_ras_block_str(adev->nbio.ras_if));
}
dev_info(adev->dev, "RAS controller interrupt triggered "
"by NBIF error\n");
/* ras_controller_int is dedicated for nbif ras error,
* not the global interrupt for sync flood
*/
amdgpu_ras_global_ras_isr(adev);
}
amdgpu_ras_error_data_fini(&err_data);
}
static void nbio_v7_4_handle_ras_err_event_athub_intr_no_bifring(struct amdgpu_device *adev)
{
uint32_t bif_doorbell_intr_cntl;
if (adev->asic_type == CHIP_ALDEBARAN)
bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL_ALDE);
else
bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL);
if (REG_GET_FIELD(bif_doorbell_intr_cntl,
BIF_DOORBELL_INT_CNTL, RAS_ATHUB_ERR_EVENT_INTERRUPT_STATUS)) {
/* driver has to clear the interrupt status when bif ring is disabled */
bif_doorbell_intr_cntl = REG_SET_FIELD(bif_doorbell_intr_cntl,
BIF_DOORBELL_INT_CNTL,
RAS_ATHUB_ERR_EVENT_INTERRUPT_CLEAR, 1);
if (adev->asic_type == CHIP_ALDEBARAN)
WREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL_ALDE, bif_doorbell_intr_cntl);
else
WREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL, bif_doorbell_intr_cntl);
amdgpu_ras_global_ras_isr(adev);
}
}
static int nbio_v7_4_set_ras_controller_irq_state(struct amdgpu_device *adev,
struct amdgpu_irq_src *src,
unsigned type,
enum amdgpu_interrupt_state state)
{
/* The ras_controller_irq enablement should be done in psp bl when it
* tries to enable ras feature. Driver only need to set the correct interrupt
* vector for bare-metal and sriov use case respectively
*/
uint32_t bif_intr_cntl;
if (adev->asic_type == CHIP_ALDEBARAN)
bif_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_INTR_CNTL_ALDE);
else
bif_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_INTR_CNTL);
if (state == AMDGPU_IRQ_STATE_ENABLE) {
/* set interrupt vector select bit to 0 to select
* vetcor 1 for bare metal case */
bif_intr_cntl = REG_SET_FIELD(bif_intr_cntl,
BIF_INTR_CNTL,
RAS_INTR_VEC_SEL, 0);
if (adev->asic_type == CHIP_ALDEBARAN)
WREG32_SOC15(NBIO, 0, mmBIF_INTR_CNTL_ALDE, bif_intr_cntl);
else
WREG32_SOC15(NBIO, 0, mmBIF_INTR_CNTL, bif_intr_cntl);
Annotation
- Immediate include surface: `amdgpu.h`, `nbio_v7_4.h`, `amdgpu_ras.h`, `nbio/nbio_7_4_offset.h`, `nbio/nbio_7_4_sh_mask.h`, `nbio/nbio_7_4_0_smn.h`, `ivsrcid/nbio/irqsrcs_nbif_7_4.h`, `uapi/linux/kfd_ioctl.h`.
- Detected declarations: `function nbio_v7_4_remap_hdp_registers`, `function nbio_v7_4_get_rev_id`, `function nbio_v7_4_mc_access_enable`, `function nbio_v7_4_get_memsize`, `function nbio_v7_4_sdma_doorbell_range`, `function nbio_v7_4_vcn_doorbell_range`, `function nbio_v7_4_enable_doorbell_aperture`, `function nbio_v7_4_enable_doorbell_selfring_aperture`, `function nbio_v7_4_ih_doorbell_range`, `function nbio_v7_4_update_medium_grain_clock_gating`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- 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.