drivers/gpu/drm/v3d/v3d_irq.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/v3d/v3d_irq.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/v3d/v3d_irq.c
Extension
.c
Size
9016 bytes
Lines
349
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (v3d->ver >= V3D_GEN_71) {
			size_t i;

			axi_id = axi_id & 0x7F;
			for (i = 0; i < ARRAY_SIZE(v3d71_axi_ids); i++) {
				if (axi_id >= v3d71_axi_ids[i].begin &&
				    axi_id < v3d71_axi_ids[i].end) {
					client = v3d71_axi_ids[i].client;
					break;
				}
			}
		} else if (v3d->ver >= V3D_GEN_41) {
			size_t i;

			axi_id = axi_id & 0xFF;
			for (i = 0; i < ARRAY_SIZE(v3d41_axi_ids); i++) {
				if (axi_id >= v3d41_axi_ids[i].begin &&
				    axi_id < v3d41_axi_ids[i].end) {
					client = v3d41_axi_ids[i].client;
					break;
				}
			}
		}

		drm_dbg(&v3d->drm, "MMU error from client %s (0x%x) at 0x%llx%s%s%s\n",
			client, axi_id, (long long)vio_addr,
			((intsts & V3D_HUB_INT_MMU_WRV) ?
			 ", write violation" : ""),
			((intsts & V3D_HUB_INT_MMU_PTI) ?
			 ", pte invalid" : ""),
			((intsts & V3D_HUB_INT_MMU_CAP) ?
			 ", cap exceeded" : ""));
		status = IRQ_HANDLED;
	}

	if (v3d->ver >= V3D_GEN_71 && (intsts & V3D_V7_HUB_INT_GMPV)) {
		drm_err(&v3d->drm, "GMP Violation\n");
		status = IRQ_HANDLED;
	}

	return status;
}

int
v3d_irq_init(struct v3d_dev *v3d)
{
	int irq, ret;

	INIT_WORK(&v3d->overflow_mem_work, v3d_overflow_mem_work);

	irq = platform_get_irq_optional(v3d_to_pdev(v3d), 1);
	if (irq == -EPROBE_DEFER)
		return irq;
	if (irq > 0) {
		v3d->irq[V3D_CORE_IRQ] = irq;

		ret = devm_request_irq(v3d->drm.dev, v3d->irq[V3D_CORE_IRQ],
				       v3d_irq, IRQF_SHARED,
				       "v3d_core0", v3d);
		if (ret)
			goto fail;

		irq = platform_get_irq(v3d_to_pdev(v3d), 0);
		if (irq < 0)
			return irq;
		v3d->irq[V3D_HUB_IRQ] = irq;

		ret = devm_request_irq(v3d->drm.dev, v3d->irq[V3D_HUB_IRQ],
				       v3d_hub_irq, IRQF_SHARED,
				       "v3d_hub", v3d);
		if (ret)
			goto fail;
	} else {
		v3d->single_irq_line = true;

		irq = platform_get_irq(v3d_to_pdev(v3d), 0);
		if (irq < 0)
			return irq;
		v3d->irq[V3D_CORE_IRQ] = irq;

		ret = devm_request_irq(v3d->drm.dev, v3d->irq[V3D_CORE_IRQ],
				       v3d_irq, IRQF_SHARED,
				       "v3d", v3d);
		if (ret)
			goto fail;
	}

	return 0;

fail:

Annotation

Implementation Notes