Re: [RFC PATCH v4 01/16] iommu/arm-smmu-v3: Discover RME support and realm IRQ topology
flat view
From: Nicolin Chen <hidden>
Date: 2026-08-29 18:22:22
Also in:
kvmarm, linux-arm-kernel, lkml
On Mon, Apr 27, 2026 at 02:23:29PM +0530, Aneesh Kumar K.V (Arm) wrote:
quoted hunk ↗ jump to hunk
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-realm.c@@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2026 ARM Ltd. + */ + +#include <linux/interrupt.h> +#include <asm/rmi_smc.h> +#include <asm/rmi_cmds.h> + +#include "arm-smmu-v3.h" + +#define RMI_PSMMU_IRQ_GERROR BIT(0) +#define RMI_PSMMU_IRQ_EVENTQ BIT(1) +#define RMI_PSMMU_IRQ_PRIQ BIT(2) +#define RMI_PSMMU_IRQ_CMDQ BIT(3)
[...]
quoted hunk ↗ jump to hunk
+ if (irq == smmu->realm_evtq_irq) + notify_flags = RMI_PSMMU_IRQ_EVENTQ; + else if (irq == smmu->realm_gerr_irq) + notify_flags = RMI_PSMMU_IRQ_GERROR; + else if (irq == smmu->realm_pri_irq) + notify_flags = RMI_PSMMU_IRQ_PRIQ;
These are defined as BIT(x)...
+ if (rmi_psmmu_irq_notify(smmu->base_phys,
+ notify_flags, &event)) {[...]
+ rmi_psmmu_event_consume(smmu->base_phys, notify_flags);
.. and passed to RMI_PSMMU_IRQ_NOTIFY and RMI_PSMMU_EVENT_CONSUME. RMI_PSMMU_IRQ_NOTIFY takes RmiPsmmuIrqSet type, which is a 4-bit field that has a range of [BIT(0), BIT(3)]. So this is correct. However, RMI_PSMMU_EVENT_CONSUME takes RmiPsmmuIrq type, which is a 2-bit field that has a range of [0x0, 0x3]. So this seems wrong.
quoted hunk ↗ jump to hunk
+void arm_smmu_setup_realm_irqs(struct arm_smmu_device *smmu) +{ + int irq, ret; + + irq = smmu->realm_evtq_irq; + if (irq) { + ret = devm_request_threaded_irq(smmu->dev, irq, NULL, + arm_smmu_realm_notify_thread, + IRQF_ONESHOT, + "arm-smmu-v3-realm-evtq", + smmu);
These IRQ numbers are raw numbers forwarded by firmware and then
returned by RMI_PSMMU_INFO:
+ if ((psmmu_info->flags & RMI_PSMMU_IRQCFG_MASK) ==
+ RMI_PSMMU_IRQCFG_IRQ_WIRED) {
+ smmu->realm_gerr_irq = psmmu_info->gerror_intr_num;
+ smmu->realm_evtq_irq = psmmu_info->eventq_intr_num;
+ smmu->realm_pri_irq = psmmu_info->priq_intr_num;
Should they be converted to Linux IRQ numbers before forwarded to
devm_request_threaded_irq?
quoted hunk ↗ jump to hunk
@@ -782,6 +787,9 @@ struct arm_smmu_device { int gerr_irq; int combined_irq; + int realm_gerr_irq; + int realm_evtq_irq; + int realm_pri_irq;
Nit: this series adds a few realm-specific things in the top SMMU structure. Maybe a "struct arm_realm_psmmu" can make them clearer. Thanks Nicolin