[PATCH v2 2/5] iommu/arm-smmu: Convert to a global static identity domain

Will Deacon will at kernel.org
Tue Dec 12 05:27:08 PST 2023


On Tue, Oct 17, 2023 at 03:11:41PM -0300, Jason Gunthorpe wrote:
> Create a global static identity domain with it's own
> arm_smmu_attach_dev_identity() that simply calls
> arm_smmu_master_install_s2crs() with the identity parameters.
> 
> This is done by giving the attach path for identity its own unique
> implementation that simply calls arm_smmu_master_install_s2crs().
> 
> Remove ARM_SMMU_DOMAIN_BYPASS and all checks of IOMMU_DOMAIN_IDENTITY.
> 
> Signed-off-by: Jason Gunthorpe <jgg at nvidia.com>
> ---
>  drivers/iommu/arm/arm-smmu/arm-smmu.c | 50 ++++++++++++++++++++-------
>  drivers/iommu/arm/arm-smmu/arm-smmu.h |  1 -
>  2 files changed, 37 insertions(+), 14 deletions(-)

[...]

> +static int arm_smmu_attach_dev_identity(struct iommu_domain *domain,
> +					struct device *dev)
> +{
> +	struct arm_smmu_master_cfg *cfg = dev_iommu_priv_get(dev);
> +	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
> +	struct arm_smmu_device *smmu;
> +	int ret;
> +
> +	if (!cfg)
> +		return -ENODEV;
> +	smmu = cfg->smmu;
> +
> +	ret = arm_smmu_rpm_get(smmu);
> +	if (ret < 0)
> +		return ret;
> +
> +	arm_smmu_master_install_s2crs(cfg, S2CR_TYPE_BYPASS, 0, fwspec);
> +
> +	pm_runtime_set_autosuspend_delay(smmu->dev, 20);
> +	pm_runtime_use_autosuspend(smmu->dev);

This is cargo-culted from arm_smmu_attach_dev() with the comments dropped
and it's not clear at all to me that the autosuspend delay makes any sense
for the identity domain.

So I think it would be better to either drop the call to
pm_runtime_set_autosuspend_delay() or move the two autosuspend calls into
a helper which is used by both of the attach routines so that the comment
is maintained.

Will



More information about the linux-arm-kernel mailing list