[PATCH 2/2] irqchip: Add MediaTek SMMU wrapper driver

Thomas Gleixner tglx at kernel.org
Tue Dec 1 07:43:18 PST 2026


On Tue, Nov 17 2026 at 17:31, Alexandre Mergnat wrote:
> @@ -866,4 +866,15 @@ config IRQCHIP_XILINX_SMMU_CSR
>  	  ZynqMP-class platforms where a vendor CSR block mediates SMMU
>  	  interrupts.
>  
> +config MTK_SMMU_WP
> +	bool "MediaTek SMMU wrapper interrupt controller"
> +	depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST
> +	default ARCH_MEDIATEK && ARM64
> +	select IRQ_DOMAIN
> +	help
> +	  Support for the wrapper block that MediaTek integrates
> +	  with the multimedia SMMUv3 of MT8196.
> +	  The interrupts of that SMMU do not work without this
> +	  driver.

Please put this next to the existing MTK entry.

> +static void mtk_smmu_wp_ack_source(struct mtk_smmu_wp *wp, unsigned int src)
> +{
> +	writel_relaxed(BIT(src), wp->base + MTK_SMMU_WP_IRQ_ACK);
> +	/* Flush the posted ACK before the SMMU is read */
> +	readl(wp->base + MTK_SMMU_WP_IRQ_STA);
> +}
> +
> +static void mtk_smmu_wp_irq_ack(struct irq_data *d)
> +{
> +	mtk_smmu_wp_ack_source(irq_data_get_irq_chip_data(d), d->hwirq);
> +}
> +
> +static const struct irq_chip mtk_smmu_wp_chip = {
> +	.name		= "mtk-smmu-wp",
> +	.irq_ack	= mtk_smmu_wp_irq_ack,
> +};

How are interrupts in this domain masked?

> +static void mtk_smmu_wp_handler(struct irq_desc *desc)
> +{
> +	struct mtk_smmu_wp *wp = irq_desc_get_handler_data(desc);
> +	struct irq_chip *chip = irq_desc_get_chip(desc);
> +	unsigned long pending;
> +	unsigned int src;
> +
> +	chained_irq_enter(chip, desc);

	guard_chained_irq()

> +	pending = readl_relaxed(wp->base + MTK_SMMU_WP_IRQ_STA);
> +	for_each_set_bit(src, &pending, MTK_SMMU_WP_NR_IRQS) {
> +		if (generic_handle_domain_irq(wp->domain, src)) {
> +			/* Release an unused source, which would hold the line */
> +			mtk_smmu_wp_ack_source(wp, src);
> +			dev_warn_ratelimited(wp->dev, "unexpected source %u\n", src);
> +		}
> +	}
> +
> +	chained_irq_exit(chip, desc);
> +}

Thanks,

        tglx



More information about the linux-arm-kernel mailing list