drivers/accel/ivpu/ivpu_mmu.c

Source file repositories/reference/linux-study-clean/drivers/accel/ivpu/ivpu_mmu.c

File Facts

System
Linux kernel
Corpus path
drivers/accel/ivpu/ivpu_mmu.c
Extension
.c
Size
29942 bytes
Lines
1031
Domain
Driver Families
Bucket
drivers/accel
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (file_priv) {
			if (!READ_ONCE(file_priv->has_mmu_faults)) {
				atomic_set(&vdev->faults_detected, 1);
				ivpu_mmu_dump_event(vdev, event);
				WRITE_ONCE(file_priv->has_mmu_faults, true);
			}
		}
	}

	queue_work(system_percpu_wq, &vdev->context_abort_work);
}

void ivpu_mmu_evtq_dump(struct ivpu_device *vdev)
{
	u32 *event;

	while ((event = ivpu_mmu_get_event(vdev)) != NULL)
		ivpu_mmu_dump_event(vdev, event);
}

void ivpu_mmu_irq_gerr_handler(struct ivpu_device *vdev)
{
	u32 gerror_val, gerrorn_val, active;

	ivpu_dbg(vdev, IRQ, "MMU error\n");

	gerror_val = REGV_RD32(IVPU_MMU_REG_GERROR);
	gerrorn_val = REGV_RD32(IVPU_MMU_REG_GERRORN);

	active = gerror_val ^ gerrorn_val;
	if (!(active & IVPU_MMU_GERROR_ERR_MASK))
		return;

	if (REG_TEST_FLD(IVPU_MMU_REG_GERROR, MSI_ABT, active))
		ivpu_warn_ratelimited(vdev, "MMU MSI ABT write aborted\n");

	if (REG_TEST_FLD(IVPU_MMU_REG_GERROR, MSI_PRIQ_ABT, active))
		ivpu_warn_ratelimited(vdev, "MMU PRIQ MSI ABT write aborted\n");

	if (REG_TEST_FLD(IVPU_MMU_REG_GERROR, MSI_EVTQ_ABT, active))
		ivpu_warn_ratelimited(vdev, "MMU EVTQ MSI ABT write aborted\n");

	if (REG_TEST_FLD(IVPU_MMU_REG_GERROR, MSI_CMDQ_ABT, active))
		ivpu_warn_ratelimited(vdev, "MMU CMDQ MSI ABT write aborted\n");

	if (REG_TEST_FLD(IVPU_MMU_REG_GERROR, PRIQ_ABT, active))
		ivpu_err_ratelimited(vdev, "MMU PRIQ write aborted\n");

	if (REG_TEST_FLD(IVPU_MMU_REG_GERROR, EVTQ_ABT, active))
		ivpu_err_ratelimited(vdev, "MMU EVTQ write aborted\n");

	if (REG_TEST_FLD(IVPU_MMU_REG_GERROR, CMDQ, active))
		ivpu_err_ratelimited(vdev, "MMU CMDQ write aborted\n");

	REGV_WR32(IVPU_MMU_REG_GERRORN, gerror_val);
}

int ivpu_mmu_cd_set(struct ivpu_device *vdev, int ssid, struct ivpu_mmu_pgtable *pgtable)
{
	return ivpu_mmu_cdtab_entry_set(vdev, ssid, pgtable->pgd_dma, true);
}

void ivpu_mmu_cd_clear(struct ivpu_device *vdev, int ssid)
{
	ivpu_mmu_cdtab_entry_set(vdev, ssid, 0, false);
}

Annotation

Implementation Notes