From: Bibek Kumar Patro <bibek.patro@oss.qualcomm.com>
To: Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
"Joerg Roedel (AMD)" <joro@8bytes.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Rob Clark <robin.clark@oss.qualcomm.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Abel Vesa <abelvesa@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org,
Bibek Kumar Patro <bibek.patro@oss.qualcomm.com>,
Val Packett <val@packett.cool>
Subject: [PATCH v4 02/20] iommu/arm-smmu: Add interconnect bandwidth voting support
Date: Fri, 20 Nov 2026 16:35:43 +0530 [thread overview]
Message-ID: <20261120-smmu_interconnect_addition-v4-2-cab8ee8be0b3@oss.qualcomm.com> (raw)
In-Reply-To: <20261120-smmu_interconnect_addition-v4-0-cab8ee8be0b3@oss.qualcomm.com>
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@oss.qualcomm.com>
Tested-by: Val Packett <val@packett.cool> # 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
next prev parent reply other threads:[~2026-11-20 11:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 11:05 [PATCH v4 00/20] " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 01/20] dt-bindings: iommu: arm,smmu: Document interconnects property Bibek Kumar Patro
2026-11-20 11:05 ` Bibek Kumar Patro [this message]
2026-11-20 11:05 ` [PATCH v4 03/20] arm64: dts: qcom: kodiak: Add GEM_NOC interconnect for adreno SMMU Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 04/20] arm64: dts: qcom: lemans: " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 05/20] arm64: dts: qcom: monaco: " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 06/20] arm64: dts: qcom: talos: " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 07/20] arm64: dts: qcom: sm8150: " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 08/20] arm64: dts: qcom: sm8250: " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 09/20] arm64: dts: qcom: sm8350: " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 10/20] arm64: dts: qcom: sc8180x: " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 11/20] arm64: dts: qcom: sc8280xp: " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 12/20] arm64: dts: qcom: sm8450: " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 13/20] arm64: dts: qcom: sm8550: " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 14/20] arm64: dts: qcom: sm8650: " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 15/20] arm64: dts: qcom: hamoa: " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 16/20] arm64: dts: qcom: kaanapali: " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 17/20] arm64: dts: qcom: glymur: Add HSC_NOC " Bibek Kumar Patro
2026-11-20 11:05 ` [PATCH v4 18/20] arm64: dts: qcom: milos: Add GEM_NOC " Bibek Kumar Patro
2026-11-20 11:06 ` [PATCH v4 19/20] arm64: dts: qcom: hawi: " Bibek Kumar Patro
2026-11-20 11:06 ` [PATCH v4 20/20] arm64: dts: qcom: sar2130p: " Bibek Kumar Patro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261120-smmu_interconnect_addition-v4-2-cab8ee8be0b3@oss.qualcomm.com \
--to=bibek.patro@oss.qualcomm.com \
--cc=abelvesa@kernel.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=robin.clark@oss.qualcomm.com \
--cc=robin.murphy@arm.com \
--cc=val@packett.cool \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®