All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	robin.murphy@arm.com, will@kernel.org, joro@8bytes.org,
	ryan.roberts@arm.com, kevin.tian@intel.com, nicolinc@nvidia.com,
	mshavit@google.com, eric.auger@redhat.com,
	joao.m.martins@oracle.com, jiangkunkun@huawei.com,
	zhukeqian1@huawei.com, linuxarm@huawei.com
Subject: Re: [PATCH v4 2/7] iommu/arm-smmu-v3: Factor out a common arm_smmu_domain_alloc()
Date: Sat, 1 Jun 2024 18:06:55 -0300	[thread overview]
Message-ID: <ZluNbvTNlABEz0QT@nvidia.com> (raw)
In-Reply-To: <20240528071831.17560-3-shameerali.kolothum.thodi@huawei.com>

On Tue, May 28, 2024 at 08:18:26AM +0100, Shameer Kolothum wrote:

> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
> @@ -648,7 +648,7 @@ static int arm_smmu_sva_set_dev_pasid(struct iommu_domain *domain,
>  
>  static void arm_smmu_sva_domain_free(struct iommu_domain *domain)
>  {
> -	kfree(domain);
> +	kfree(to_smmu_domain(domain));
>  }

  
> @@ -659,13 +659,16 @@ static const struct iommu_domain_ops arm_smmu_sva_domain_ops = {
>  struct iommu_domain *arm_smmu_sva_domain_alloc(struct device *dev,
>  					       struct mm_struct *mm)
>  {
> -	struct iommu_domain *domain;
> +	struct arm_smmu_master *master = dev_iommu_priv_get(dev);
> +	struct arm_smmu_device *smmu = master->smmu;
> +	struct arm_smmu_domain *smmu_domain;
>  
> -	domain = kzalloc(sizeof(*domain), GFP_KERNEL);
> -	if (!domain)
> -		return ERR_PTR(-ENOMEM);
> -	domain->type = IOMMU_DOMAIN_SVA;
> -	domain->ops = &arm_smmu_sva_domain_ops;
> +	smmu_domain = arm_smmu_domain_alloc();
> +	if (IS_ERR(smmu_domain))
> +		return ERR_CAST(smmu_domain);
> +	smmu_domain->domain.type = IOMMU_DOMAIN_SVA;
> +	smmu_domain->domain.ops = &arm_smmu_sva_domain_ops;
> +	smmu_domain->smmu = smmu;
>  
> -	return domain;
> +	return &smmu_domain->domain;
>  }

If you drop these two hunks you can drop the first patch as well. There
is no need to touch SVA in this series

Jason

WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@nvidia.com>
To: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	robin.murphy@arm.com, will@kernel.org, joro@8bytes.org,
	ryan.roberts@arm.com, kevin.tian@intel.com, nicolinc@nvidia.com,
	mshavit@google.com, eric.auger@redhat.com,
	joao.m.martins@oracle.com, jiangkunkun@huawei.com,
	zhukeqian1@huawei.com, linuxarm@huawei.com
Subject: Re: [PATCH v4 2/7] iommu/arm-smmu-v3: Factor out a common arm_smmu_domain_alloc()
Date: Sat, 1 Jun 2024 18:06:55 -0300	[thread overview]
Message-ID: <ZluNbvTNlABEz0QT@nvidia.com> (raw)
In-Reply-To: <20240528071831.17560-3-shameerali.kolothum.thodi@huawei.com>

On Tue, May 28, 2024 at 08:18:26AM +0100, Shameer Kolothum wrote:

> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
> @@ -648,7 +648,7 @@ static int arm_smmu_sva_set_dev_pasid(struct iommu_domain *domain,
>  
>  static void arm_smmu_sva_domain_free(struct iommu_domain *domain)
>  {
> -	kfree(domain);
> +	kfree(to_smmu_domain(domain));
>  }

  
> @@ -659,13 +659,16 @@ static const struct iommu_domain_ops arm_smmu_sva_domain_ops = {
>  struct iommu_domain *arm_smmu_sva_domain_alloc(struct device *dev,
>  					       struct mm_struct *mm)
>  {
> -	struct iommu_domain *domain;
> +	struct arm_smmu_master *master = dev_iommu_priv_get(dev);
> +	struct arm_smmu_device *smmu = master->smmu;
> +	struct arm_smmu_domain *smmu_domain;
>  
> -	domain = kzalloc(sizeof(*domain), GFP_KERNEL);
> -	if (!domain)
> -		return ERR_PTR(-ENOMEM);
> -	domain->type = IOMMU_DOMAIN_SVA;
> -	domain->ops = &arm_smmu_sva_domain_ops;
> +	smmu_domain = arm_smmu_domain_alloc();
> +	if (IS_ERR(smmu_domain))
> +		return ERR_CAST(smmu_domain);
> +	smmu_domain->domain.type = IOMMU_DOMAIN_SVA;
> +	smmu_domain->domain.ops = &arm_smmu_sva_domain_ops;
> +	smmu_domain->smmu = smmu;
>  
> -	return domain;
> +	return &smmu_domain->domain;
>  }

If you drop these two hunks you can drop the first patch as well. There
is no need to touch SVA in this series

Jason

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-06-01 21:07 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28  7:18 [PATCH v4 0/7] iommu/smmuv3: Add IOMMUFD dirty tracking support for SMMUv3 Shameer Kolothum
2024-05-28  7:18 ` Shameer Kolothum
2024-05-28  7:18 ` [PATCH v4 1/7] iommu/arm-smmu-v3: Convert to domain_alloc_sva() Shameer Kolothum
2024-05-28  7:18   ` Shameer Kolothum
2024-05-28  7:18 ` [PATCH v4 2/7] iommu/arm-smmu-v3: Factor out a common arm_smmu_domain_alloc() Shameer Kolothum
2024-05-28  7:18   ` Shameer Kolothum
2024-06-01 21:06   ` Jason Gunthorpe [this message]
2024-06-01 21:06     ` Jason Gunthorpe
2024-06-05 15:19     ` Shameerali Kolothum Thodi
2024-06-05 15:19       ` Shameerali Kolothum Thodi
2024-05-28  7:18 ` [PATCH v4 3/7] iommu/arm-smmu-v3: Add support for domain_alloc_user fn Shameer Kolothum
2024-05-28  7:18   ` Shameer Kolothum
2024-06-01 21:08   ` Jason Gunthorpe
2024-06-01 21:08     ` Jason Gunthorpe
2024-05-28  7:18 ` [PATCH v4 4/7] iommu/arm-smmu-v3: Add feature detection for HTTU Shameer Kolothum
2024-05-28  7:18   ` Shameer Kolothum
2024-05-28  7:18 ` [PATCH v4 5/7] iommu/io-pgtable-arm: Add read_and_clear_dirty() support Shameer Kolothum
2024-05-28  7:18   ` Shameer Kolothum
2024-06-01 21:17   ` Jason Gunthorpe
2024-06-01 21:17     ` Jason Gunthorpe
2024-05-28  7:18 ` [PATCH v4 6/7] iommu/arm-smmu-v3: Add support for dirty tracking in domain alloc Shameer Kolothum
2024-05-28  7:18   ` Shameer Kolothum
2024-05-28  7:18 ` [PATCH v4 7/7] iommu/arm-smmu-v3: Enable HTTU for stage1 with io-pgtable mapping Shameer Kolothum
2024-05-28  7:18   ` Shameer Kolothum

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=ZluNbvTNlABEz0QT@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=eric.auger@redhat.com \
    --cc=iommu@lists.linux.dev \
    --cc=jiangkunkun@huawei.com \
    --cc=joao.m.martins@oracle.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linuxarm@huawei.com \
    --cc=mshavit@google.com \
    --cc=nicolinc@nvidia.com \
    --cc=robin.murphy@arm.com \
    --cc=ryan.roberts@arm.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=will@kernel.org \
    --cc=zhukeqian1@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.