[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250616025628.25454-6-xueqi.zhang@mediatek.com>
Date: Mon, 16 Jun 2025 10:56:11 +0800
From: Xueqi Zhang <xueqi.zhang@...iatek.com>
To: Yong Wu <yong.wu@...iatek.com>, Will Deacon <will@...nel.org>, "Robin
Murphy" <robin.murphy@....com>, Joerg Roedel <joro@...tes.org>, Rob Herring
<robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
CC: <Project_Global_Chrome_Upstream_Group@...iatek.com>, Ning li
<ning.li@...iatek.com>, <linux-mediatek@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<devicetree@...r.kernel.org>, <iommu@...ts.linux.dev>, Xueqi Zhang
<xueqi.zhang@...iatek.com>
Subject: [RFC PATCH 5/8] iommu/arm-smmu-v3: Add IRQ handle for smmu impl
Add IRQ handle for smmu impl
Signed-off-by: Xueqi Zhang <xueqi.zhang@...iatek.com>
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 ++++++++-
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 8 ++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index d36124a6bb54..154417b380fa 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -1954,7 +1954,8 @@ static irqreturn_t arm_smmu_evtq_thread(int irq, void *dev)
arm_smmu_decode_event(smmu, evt, &event);
if (arm_smmu_handle_event(smmu, evt, &event))
arm_smmu_dump_event(smmu, evt, &event, &rs);
-
+ if (smmu->impl && smmu->impl->smmu_evt_handler)
+ smmu->impl->smmu_evt_handler(irq, smmu, evt, &rs);
put_device(event.dev);
cond_resched();
}
@@ -2091,7 +2092,13 @@ static irqreturn_t arm_smmu_combined_irq_thread(int irq, void *dev)
static irqreturn_t arm_smmu_combined_irq_handler(int irq, void *dev)
{
+ struct arm_smmu_device *smmu = dev;
+
arm_smmu_gerror_handler(irq, dev);
+
+ if (smmu->impl && smmu->impl->combined_irq_handle)
+ smmu->impl->combined_irq_handle(irq, smmu);
+
return IRQ_WAKE_THREAD;
}
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
index 99eeb6143c49..f45c4bf84bc1 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
@@ -792,6 +792,7 @@ struct arm_smmu_device {
struct rb_root streams;
struct mutex streams_mutex;
+ const struct arm_smmu_v3_impl *impl;
};
struct arm_smmu_stream {
@@ -998,6 +999,13 @@ int arm_smmu_cmdq_issue_cmdlist(struct arm_smmu_device *smmu,
struct arm_smmu_cmdq *cmdq, u64 *cmds, int n,
bool sync);
+/* Implementation details */
+struct arm_smmu_v3_impl {
+ int (*combined_irq_handle)(int irq, struct arm_smmu_device *smmu_dev);
+ int (*smmu_evt_handler)(int irq, struct arm_smmu_device *smmu_dev,
+ u64 *evt, struct ratelimit_state *rs);
+};
+
struct arm_smmu_device *arm_smmu_v3_impl_init(struct arm_smmu_device *smmu);
#if IS_ENABLED(CONFIG_ARM_SMMU_V3_MEDIATEK)
struct arm_smmu_device *arm_smmu_v3_impl_mtk_init(struct arm_smmu_device *smmu);
--
2.46.0
Powered by blists - more mailing lists