[PATCH RESEND v4 02/20] iommu/arm-smmu: Add interconnect bandwidth voting support

From: Bibek Kumar Patro

Date: Fri Nov 20 2026 - 08:42:51 EST


On Qualcomm SoCs using the ARM MMU-500 as the adreno SMMU, the GPU TCU
sits on GEM_NOC as an independent AXI master and requires an active
interconnect bandwidth vote for its registers to be accessible. While
other clients typically satisfy this requirement implicitly, certain
corner cases (e.g. during sleep/wakeup transitions) can leave the SMMU
without a vote, causing intermittent register access failures.

Add support for an optional interconnect path to the arm-smmu
driver and vote for bandwidth while the SMMU is active. The path
is acquired from DT if present and ignored otherwise.

The bandwidth vote is enabled before accessing SMMU registers
during probe and runtime resume, and released during runtime
suspend and on error paths.

Generally, from an architectural perspective, GEM_NOC and DDR are
expected to have an active vote whenever the adreno_smmu block is
powered on. In most common use cases, this requirement is implicitly
satisfied because other GPU-related clients (for example, the GMU
device) already hold a GEM_NOC vote when adreno_smmu is enabled.

However, there are certain corner cases, such as during sleep/wakeup
transitions, where the GEM_NOC vote can be removed before adreno_smmu
is powered down. If adreno_smmu is then accessed while the interconnect
vote is missing, it can lead to the observed failures. Because of the
precise ordering involved, this scenario is difficult to reproduce
consistently. Additionally, GDSC power state transitions in adreno use
cases can independently drop the interconnect vote, further contributing
to this race.

The design difference between QSMMU (SMMU-v2) and SMMU-500 explains
why an explicit ICC vote is needed only for the latter:

QSMMU (SMMU-v2) — SM6250 / SDM845 era: The TCU is NOT a separate
hardware master. It is integrated INSIDE the SMMU-v2 block itself.

GPU SS
+----------------------------------+
| QSMMU (SMMU-v2 @ 0x5040000) |
| +----------------------------+ |
| | TCU (integrated, no | |
| | separate AXI master port) | |
| +------------+---------------+ |
| | page table walk |
| | issued on same |
| | AXI port as GPU |
+---------------+------------------+
|
| qxm_gpu0 / qxm_gpu1
| (GPU data + TCU walks share same NOC master)
v
GEM_NOC -> LLCC -> MC -> DDR

On SMMU-v2 platforms the TCU never needs an independent vote because
it physically cannot be active without the GPU data path also being
active.

SMMU-500 — SM8150+ / SA8775P / SC7280 etc.: The TCU is a SEPARATE
hardware block with its OWN AXI master.

GPU SS
+----------------------------------+
| +-------------+ +-----------+ |
| | GPU Core | | GPU TCU | | <- distinct HW block
| | (rendering)| | + DVM | |
| +------+------+ +-----+-----+ |
+---------+---------------+--------+
| |
qnm_gpu0/1 alm_gpu_tcu <- separate NOC master port
| |
+-------+-------+
v
GEM_NOC -> LLCC -> MC -> DDR

On SMMU-500 the TCU has its own master port — it can be active (e.g.
page table walks during wakeup) while the GPU data path is idle,
leaving GEM_NOC without any other voter. Hence the explicit
MASTER_GPU_TCU -> SLAVE_EBI1 vote is required.

Signed-off-by: Bibek Kumar Patro <bibek.patro@xxxxxxxxxxxxxxxx>
Tested-by: Val Packett <val@xxxxxxxxxxxx> # sm7325-motorola-dubai
---
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 50 ++++++++++++++++++++++++++++++
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h | 4 +++
drivers/iommu/arm/arm-smmu/arm-smmu.c | 29 +++++++++++++++--
drivers/iommu/arm/arm-smmu/arm-smmu.h | 2 ++
4 files changed, 82 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
index 795e8ec7e8fa..eee20811eede 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
@@ -6,6 +6,7 @@
#include <linux/acpi.h>
#include <linux/adreno-smmu-priv.h>
#include <linux/delay.h>
+#include <linux/interconnect.h>
#include <linux/of_device.h>
#include <linux/firmware/qcom/qcom_scm.h>
#include <linux/platform_device.h>
@@ -608,6 +609,45 @@ static int qcom_sdm845_smmu500_reset(struct arm_smmu_device *smmu)
return ret;
}

+static int qcom_adreno_smmu_icc_init(struct arm_smmu_device *smmu)
+{
+ struct qcom_smmu *qsmmu = container_of(smmu, struct qcom_smmu, smmu);
+ int err;
+
+ qsmmu->icc_path = devm_of_icc_get(smmu->dev, NULL);
+ if (!IS_ERR(qsmmu->icc_path))
+ return 0;
+
+ err = PTR_ERR(qsmmu->icc_path);
+
+ if (err == -ENODEV) {
+ qsmmu->icc_path = NULL;
+ return 0;
+ }
+ return dev_err_probe(smmu->dev, err,
+ "failed to get interconnect path\n");
+}
+
+static int qcom_adreno_smmu_runtime_resume(struct arm_smmu_device *smmu)
+{
+ struct qcom_smmu *qsmmu = container_of(smmu, struct qcom_smmu, smmu);
+ int ret;
+
+ ret = icc_set_bw(qsmmu->icc_path, 0, 1);
+ WARN_ON_ONCE(ret);
+ return ret;
+}
+
+static int qcom_adreno_smmu_runtime_suspend(struct arm_smmu_device *smmu)
+{
+ struct qcom_smmu *qsmmu = container_of(smmu, struct qcom_smmu, smmu);
+ int ret;
+
+ ret = icc_set_bw(qsmmu->icc_path, 0, 0);
+ WARN_ON_ONCE(ret);
+ return ret;
+}
+
static const struct arm_smmu_impl qcom_smmu_v2_impl = {
.init_context = qcom_smmu_init_context,
.cfg_probe = qcom_smmu_cfg_probe,
@@ -659,6 +699,8 @@ static const struct arm_smmu_impl qcom_adreno_smmu_500_impl = {
.alloc_context_bank = qcom_adreno_smmu_alloc_context_bank,
.write_sctlr = qcom_adreno_smmu_write_sctlr,
.tlb_sync = qcom_smmu_tlb_sync,
+ .runtime_resume = qcom_adreno_smmu_runtime_resume,
+ .runtime_suspend = qcom_adreno_smmu_runtime_suspend,
.context_fault_needs_threaded_irq = true,
};

@@ -668,6 +710,7 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
const struct device_node *np = smmu->dev->of_node;
const struct arm_smmu_impl *impl;
struct qcom_smmu *qsmmu;
+ int ret;

if (!data)
return ERR_PTR(-EINVAL);
@@ -692,6 +735,12 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
qsmmu->smmu.impl = impl;
qsmmu->data = data;

+ if (data->icc_init) {
+ ret = data->icc_init(&qsmmu->smmu);
+ if (ret)
+ return ERR_PTR(ret);
+ }
+
return &qsmmu->smmu;
}

@@ -734,6 +783,7 @@ static const struct qcom_smmu_match_data qcom_smmu_500_impl0_data = {
.adreno_impl = &qcom_adreno_smmu_500_impl,
.cfg = &qcom_smmu_impl0_cfg,
.client_match = qcom_smmu_actlr_client_of_match,
+ .icc_init = qcom_adreno_smmu_icc_init,
};

/*
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
index 8addd453f5f1..12c3eda780dc 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h
@@ -6,12 +6,15 @@
#ifndef _ARM_SMMU_QCOM_H
#define _ARM_SMMU_QCOM_H

+struct icc_path;
+
struct qcom_smmu {
struct arm_smmu_device smmu;
const struct qcom_smmu_match_data *data;
bool bypass_quirk;
u8 bypass_cbndx;
u32 stall_enabled;
+ struct icc_path *icc_path;
};

enum qcom_smmu_impl_reg_offset {
@@ -29,6 +32,7 @@ struct qcom_smmu_match_data {
const struct arm_smmu_impl *impl;
const struct arm_smmu_impl *adreno_impl;
const struct of_device_id * const client_match;
+ int (*icc_init)(struct arm_smmu_device *smmu);
};

irqreturn_t qcom_smmu_context_fault(int irq, void *dev);
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
index 8d50a4ad221d..f015985cbb8e 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
@@ -2183,6 +2183,14 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
if (err)
return err;

+ if (smmu->impl && smmu->impl->runtime_resume) {
+ err = smmu->impl->runtime_resume(smmu);
+ if (err) {
+ clk_bulk_disable_unprepare(smmu->num_clks, smmu->clks);
+ return err;
+ }
+ }
+
err = arm_smmu_device_cfg_probe(smmu);
if (err)
return err;
@@ -2263,10 +2271,13 @@ static void arm_smmu_device_shutdown(struct platform_device *pdev)
arm_smmu_gr0_write(smmu, ARM_SMMU_GR0_sCR0, ARM_SMMU_sCR0_CLIENTPD);
arm_smmu_rpm_put(smmu);

- if (pm_runtime_enabled(smmu->dev))
+ if (pm_runtime_enabled(smmu->dev)) {
pm_runtime_force_suspend(smmu->dev);
- else
+ } else {
clk_bulk_disable(smmu->num_clks, smmu->clks);
+ if (smmu->impl && smmu->impl->runtime_suspend)
+ smmu->impl->runtime_suspend(smmu);
+ }

clk_bulk_unprepare(smmu->num_clks, smmu->clks);
}
@@ -2286,9 +2297,18 @@ static int __maybe_unused arm_smmu_runtime_resume(struct device *dev)
struct arm_smmu_device *smmu = dev_get_drvdata(dev);
int ret;

+ if (smmu->impl && smmu->impl->runtime_resume) {
+ ret = smmu->impl->runtime_resume(smmu);
+ if (ret)
+ return ret;
+ }
+
ret = clk_bulk_enable(smmu->num_clks, smmu->clks);
- if (ret)
+ if (ret) {
+ if (smmu->impl && smmu->impl->runtime_suspend)
+ smmu->impl->runtime_suspend(smmu);
return ret;
+ }

arm_smmu_device_reset(smmu);

@@ -2301,6 +2321,9 @@ static int __maybe_unused arm_smmu_runtime_suspend(struct device *dev)

clk_bulk_disable(smmu->num_clks, smmu->clks);

+ if (smmu->impl && smmu->impl->runtime_suspend)
+ return smmu->impl->runtime_suspend(smmu);
+
return 0;
}

diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.h b/drivers/iommu/arm/arm-smmu/arm-smmu.h
index 26d2e33cd328..ed08f86cf99d 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.h
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.h
@@ -455,6 +455,8 @@ struct arm_smmu_impl {
void (*write_s2cr)(struct arm_smmu_device *smmu, int idx);
void (*write_sctlr)(struct arm_smmu_device *smmu, int idx, u32 reg);
void (*probe_finalize)(struct arm_smmu_device *smmu, struct device *dev);
+ int (*runtime_resume)(struct arm_smmu_device *smmu);
+ int (*runtime_suspend)(struct arm_smmu_device *smmu);
};

#define INVALID_SMENDX -1

--
2.34.1