[PATCH v6 24/25] iommu: Convert simple drivers with DOMAIN_DMA to domain_alloc_paging()
Baolu Lu
baolu.lu at linux.intel.com
Sun Aug 13 23:58:14 PDT 2023
On 2023/8/3 8:08, Jason Gunthorpe wrote:
> These drivers are all trivially converted since the function is only
> called if the domain type is going to be
> IOMMU_DOMAIN_UNMANAGED/DMA.
>
> Tested-by: Heiko Stuebner <heiko at sntech.de>
> Tested-by: Steven Price <steven.price at arm.com>
> Tested-by: Marek Szyprowski <m.szyprowski at samsung.com>
> Tested-by: Nicolin Chen <nicolinc at nvidia.com>
> Signed-off-by: Jason Gunthorpe <jgg at nvidia.com>
> ---
> drivers/iommu/arm/arm-smmu/qcom_iommu.c | 6 ++----
> drivers/iommu/exynos-iommu.c | 7 ++-----
> drivers/iommu/ipmmu-vmsa.c | 7 ++-----
> drivers/iommu/mtk_iommu.c | 7 ++-----
> drivers/iommu/rockchip-iommu.c | 7 ++-----
> drivers/iommu/sprd-iommu.c | 7 ++-----
> drivers/iommu/sun50i-iommu.c | 9 +++------
> drivers/iommu/tegra-smmu.c | 7 ++-----
> 8 files changed, 17 insertions(+), 40 deletions(-)
[...]
> diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c
> index 0bf08b120cf105..056832a367c2af 100644
> --- a/drivers/iommu/sun50i-iommu.c
> +++ b/drivers/iommu/sun50i-iommu.c
> @@ -667,14 +667,11 @@ static phys_addr_t sun50i_iommu_iova_to_phys(struct iommu_domain *domain,
> sun50i_iova_get_page_offset(iova);
> }
>
> -static struct iommu_domain *sun50i_iommu_domain_alloc(unsigned type)
> +static struct iommu_domain *
> +sun50i_iommu_domain_alloc_paging(struct device *paging)
Why not "struct device *dev"?
Typo? Or anything I missed?
> {
> struct sun50i_iommu_domain *sun50i_domain;
>
> - if (type != IOMMU_DOMAIN_DMA &&
> - type != IOMMU_DOMAIN_UNMANAGED)
> - return NULL;
> -
> sun50i_domain = kzalloc(sizeof(*sun50i_domain), GFP_KERNEL);
> if (!sun50i_domain)
> return NULL;
> @@ -840,7 +837,7 @@ static const struct iommu_ops sun50i_iommu_ops = {
> .identity_domain = &sun50i_iommu_identity_domain,
> .pgsize_bitmap = SZ_4K,
> .device_group = sun50i_iommu_device_group,
> - .domain_alloc = sun50i_iommu_domain_alloc,
> + .domain_alloc_paging = sun50i_iommu_domain_alloc_paging,
> .of_xlate = sun50i_iommu_of_xlate,
> .probe_device = sun50i_iommu_probe_device,
> .default_domain_ops = &(const struct iommu_domain_ops) {
> diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
> index 6cba034905edbf..69c40c191ce4f0 100644
> --- a/drivers/iommu/tegra-smmu.c
> +++ b/drivers/iommu/tegra-smmu.c
> @@ -272,13 +272,10 @@ static void tegra_smmu_free_asid(struct tegra_smmu *smmu, unsigned int id)
> clear_bit(id, smmu->asids);
> }
>
> -static struct iommu_domain *tegra_smmu_domain_alloc(unsigned type)
> +static struct iommu_domain *tegra_smmu_domain_alloc_paging(struct device *dev)
> {
> struct tegra_smmu_as *as;
>
> - if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_DMA)
> - return NULL;
> -
> as = kzalloc(sizeof(*as), GFP_KERNEL);
> if (!as)
> return NULL;
> @@ -997,7 +994,7 @@ static const struct iommu_ops tegra_smmu_ops = {
> .default_domain = &tegra_smmu_identity_domain,
> .identity_domain = &tegra_smmu_identity_domain,
> .def_domain_type = &tegra_smmu_def_domain_type,
> - .domain_alloc = tegra_smmu_domain_alloc,
> + .domain_alloc_paging = tegra_smmu_domain_alloc_paging,
> .probe_device = tegra_smmu_probe_device,
> .device_group = tegra_smmu_device_group,
> .of_xlate = tegra_smmu_of_xlate,
Anyway,
Reviewed-by: Lu Baolu <baolu.lu at linux.intel.com>
Best regards,
baolu
More information about the linux-arm-kernel
mailing list