Re: [PATCH] iommu: arm-smmu-qcom: Ensure smmu is powered up in set_ttbr0_cfg

From: Will Deacon

Date: Tue Mar 10 2026 - 12:51:10 EST


On Tue, Feb 10, 2026 at 05:17:38PM +0100, Anna Maniscalco wrote:
> Previously the device was being accessed while potentially in a
> suspended state.
>
> Signed-off-by: Anna Maniscalco <anna.maniscalco2000@xxxxxxxxx>
> ---
> drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 27 +++++++++++++++++++++------
> 1 file changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> index 573085349df3..ca34b7a141e6 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> @@ -231,16 +231,27 @@ static int qcom_adreno_smmu_set_ttbr0_cfg(const void *cookie,
> struct io_pgtable *pgtable = io_pgtable_ops_to_pgtable(smmu_domain->pgtbl_ops);
> struct arm_smmu_cfg *cfg = &smmu_domain->cfg;
> struct arm_smmu_cb *cb = &smmu_domain->smmu->cbs[cfg->cbndx];
> + int ret;
> +
> + ret = pm_runtime_resume_and_get(smmu_domain->smmu->dev);
> + if (ret < 0) {
> + dev_err(smmu_domain->smmu->dev, "failed to get runtime PM: %d\n", ret);
> + return -ENODEV;
> + }
>
> /* The domain must have split pagetables already enabled */
> - if (cb->tcr[0] & ARM_SMMU_TCR_EPD1)
> - return -EINVAL;
> + if (cb->tcr[0] & ARM_SMMU_TCR_EPD1) {
> + ret = -EINVAL;
> + goto out;
> + }

Presumably, you only need to stabilise the power state across the call
to arm_smmu_write_context_bank(), in which case why not defer that until
you've gone past all these early exits?

Will