From: Shawn Lin <shawn.lin@rock-chips.com>
To: Simon Xue <xxm@rock-chips.com>, Joerg Roedel <joro@8bytes.org>,
Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Heiko Stuebner <heiko@sntech.de>
Cc: shawn.lin@rock-chips.com, iommu@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/rockchip: Drop global rk_ops in favor of per-device ops
Date: Tue, 10 Mar 2026 17:33:18 +0800 [thread overview]
Message-ID: <a2719902-e5cb-bd4d-4eb4-a01371a57aed@rock-chips.com> (raw)
In-Reply-To: <20260310084812.126082-1-xxm@rock-chips.com>
Hi Simon,
在 2026/03/10 星期二 16:48, Simon Xue 写道:
> The driver currently uses a global rk_ops pointer, forcing all IOMMU
> instances to share the same operations. This restricts the driver from
> supporting SoCs that might integrate different versions of IOMMU hardware.
>
> Since the IOMMU framework passes the master device information to
> iommu_paging_domain_alloc(), the global variable is no longer needed.
>
> Fix this by moving rk_ops into struct rk_iommu and struct rk_iommu_domain.
> Initialize it per-device during probe via of_device_get_match_data(),
> and replace all global references with the instance-specific pointers.
>
> Signed-off-by: Simon Xue <xxm@rock-chips.com>
> ---
...
> SPAGE_SIZE, DMA_TO_DEVICE);
> @@ -1212,15 +1215,7 @@ static int rk_iommu_probe(struct platform_device *pdev)
> iommu->num_mmu = 0;
>
> ops = of_device_get_match_data(dev);
Could you remove this one-time-used ops variable and use iommu->rk_ops
directly. The other parts make sense to me.
> - if (!rk_ops)
> - rk_ops = ops;
> -
> - /*
> - * That should not happen unless different versions of the
> - * hardware block are embedded the same SoC
> - */
> - if (WARN_ON(rk_ops != ops))
> - return -EINVAL;
> + iommu->rk_ops = ops;
>
> iommu->bases = devm_kcalloc(dev, num_res, sizeof(*iommu->bases),
> GFP_KERNEL);
> @@ -1286,7 +1281,7 @@ static int rk_iommu_probe(struct platform_device *pdev)
> goto err_pm_disable;
> }
>
> - dma_set_mask_and_coherent(dev, rk_ops->dma_bit_mask);
> + dma_set_mask_and_coherent(dev, iommu->rk_ops->dma_bit_mask);
>
> err = iommu_device_sysfs_add(&iommu->iommu, dev, NULL, dev_name(dev));
> if (err)
>
next prev parent reply other threads:[~2026-03-10 9:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 8:48 [PATCH] iommu/rockchip: Drop global rk_ops in favor of per-device ops Simon Xue
2026-03-10 9:33 ` Shawn Lin [this message]
2026-03-10 10:53 ` [PATCH v2] " Simon Xue
2026-03-13 9:32 ` Shawn Lin
2026-04-01 7:59 ` Simon Xue
2026-04-01 8:25 ` Jonas Karlman
2026-04-01 9:26 ` Simon Xue
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=a2719902-e5cb-bd4d-4eb4-a01371a57aed@rock-chips.com \
--to=shawn.lin@rock-chips.com \
--cc=heiko@sntech.de \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
--cc=xxm@rock-chips.com \
/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