[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y2jUb3UNeEJVekYS@orome>
Date: Mon, 7 Nov 2022 10:48:31 +0100
From: Thierry Reding <thierry.reding@...il.com>
To: Robin Murphy <robin.murphy@....com>
Cc: Ulf Hansson <ulf.hansson@...aro.org>,
Prathamesh Shete <pshete@...dia.com>, joro@...tes.org,
adrian.hunter@...el.com, jonathanh@...dia.com,
p.zabel@...gutronix.de, linux-mmc@...r.kernel.org,
linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org,
will@...nel.org, iommu@...ts.linux.dev, anrao@...dia.com,
smangipudi@...dia.com, kyarlagadda@...dia.com,
Thierry Reding <treding@...dia.com>
Subject: Re: [PATCH v10 1/4] iommu: Always define struct iommu_fwspec
On Thu, Nov 03, 2022 at 05:35:19PM +0000, Robin Murphy wrote:
[...]
> Now, there does happen to be a tacit contract between the ACPI IORT code and
> the Arm SMMU drivers for how SMMU StreamIDs are encoded in their respective
> fwspecs, but it was never intended for wider consumption. If Tegra drivers
> want to have a special relationship with arm-smmu then fair enough, but they
> can do the same as MSM and formalise it somewhere that the SMMU driver
> maintainers are at least aware of, rather than holding the whole generic
> IOMMU API hostage.
Are you talking about qcom_adrena_smmu_is_gpu_device()? That's the only
place I can find where MSM uses iommu_fwspec directly and in a "special"
way.
> Since apparently it wasn't clear, what I was proposing is a driver helper at
> least something like this:
>
> int tegra_arm_smmu_streamid(struct device *dev)
> {
> #ifdef CONFIG_IOMMU_API
> struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev)
>
> if (fwspec && fwspec->num_ids == 1)
> return fwspec->ids[0] & 0xffff;
> #endif
> return -EINVAL;
> }
We actually also use this mechanism on devices that predate the ARM
SMMU, so it'd need to be even more generic. Also, since we need to
access this from a wide range of subsystems, it'd need to be in a
centralized place. Do you think iommu.h would be acceptable for this?
How about if I also add a comment to struct iommu_fwspec about the
intended use?
Thierry
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists