public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Vasant Hegde <vasant.hegde@amd.com>
To: Yi Liu <yi.l.liu@intel.com>,
	joro@8bytes.org, jgg@nvidia.com, kevin.tian@intel.com,
	baolu.lu@linux.intel.com
Cc: alex.williamson@redhat.com, eric.auger@redhat.com,
	nicolinc@nvidia.com, kvm@vger.kernel.org,
	chao.p.peng@linux.intel.com, iommu@lists.linux.dev,
	zhenzhong.duan@intel.com, will@kernel.org
Subject: Re: [PATCH v3 2/7] iommu: Consolidate the ops->remove_dev_pasid usage into a helper
Date: Wed, 6 Nov 2024 15:03:53 +0530	[thread overview]
Message-ID: <56ff3976-ae80-41b2-b3d1-589499e463d7@amd.com> (raw)
In-Reply-To: <20241104132033.14027-3-yi.l.liu@intel.com>



On 11/4/2024 6:50 PM, Yi Liu wrote:
> Add a wrapper for the ops->remove_dev_pasid, this consolidates the iommu_ops
> fetching and callback invoking. It is also a preparation for starting the
> transition from using remove_dev_pasid op to detach pasid to the way using
> blocked_domain to detach pasid.
> 
> Signed-off-by: Yi Liu <yi.l.liu@intel.com>

Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>



> ---
>  drivers/iommu/iommu.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 866559bbc4e4..21320578d801 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -3400,6 +3400,14 @@ bool iommu_group_dma_owner_claimed(struct iommu_group *group)
>  }
>  EXPORT_SYMBOL_GPL(iommu_group_dma_owner_claimed);
>  
> +static void iommu_remove_dev_pasid(struct device *dev, ioasid_t pasid,
> +				   struct iommu_domain *domain)
> +{
> +	const struct iommu_ops *ops = dev_iommu_ops(dev);
> +
> +	ops->remove_dev_pasid(dev, pasid, domain);
> +}
> +
>  static int __iommu_set_group_pasid(struct iommu_domain *domain,
>  				   struct iommu_group *group, ioasid_t pasid)
>  {
> @@ -3418,11 +3426,9 @@ static int __iommu_set_group_pasid(struct iommu_domain *domain,
>  err_revert:
>  	last_gdev = device;
>  	for_each_group_device(group, device) {
> -		const struct iommu_ops *ops = dev_iommu_ops(device->dev);
> -
>  		if (device == last_gdev)
>  			break;
> -		ops->remove_dev_pasid(device->dev, pasid, domain);
> +		iommu_remove_dev_pasid(device->dev, pasid, domain);
>  	}
>  	return ret;
>  }
> @@ -3432,11 +3438,9 @@ static void __iommu_remove_group_pasid(struct iommu_group *group,
>  				       struct iommu_domain *domain)
>  {
>  	struct group_device *device;
> -	const struct iommu_ops *ops;
>  
>  	for_each_group_device(group, device) {
> -		ops = dev_iommu_ops(device->dev);
> -		ops->remove_dev_pasid(device->dev, pasid, domain);
> +		iommu_remove_dev_pasid(device->dev, pasid, domain);
>  	}

Now its single statement inside loop. We don't need braces.

-Vasant

  parent reply	other threads:[~2024-11-06  9:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04 13:20 [PATCH v3 0/7] Support attaching PASID to the blocked_domain Yi Liu
2024-11-04 13:20 ` [PATCH v3 1/7] iommu: Prevent pasid attach if no ops->remove_dev_pasid Yi Liu
2024-11-05 15:42   ` Jason Gunthorpe
2024-11-07  9:33     ` Tian, Kevin
2024-11-07 10:02       ` Yi Liu
2024-11-04 13:20 ` [PATCH v3 2/7] iommu: Consolidate the ops->remove_dev_pasid usage into a helper Yi Liu
2024-11-05 15:42   ` Jason Gunthorpe
2024-11-06  9:33   ` Vasant Hegde [this message]
2024-11-07  9:34   ` Tian, Kevin
2024-11-04 13:20 ` [PATCH v3 3/7] iommu: Detaching pasid by attaching to the blocked_domain Yi Liu
2024-11-05 15:42   ` Jason Gunthorpe
2024-11-06  9:37   ` Vasant Hegde
2024-11-07  9:35   ` Tian, Kevin
2024-11-07 10:04     ` Yi Liu
2024-11-04 13:20 ` [PATCH v3 4/7] iommu/arm-smmu-v3: Make the blocked domain support PASID Yi Liu
2024-11-04 13:20 ` [PATCH v3 5/7] iommu/vt-d: " Yi Liu
2024-11-05  3:46   ` Baolu Lu
2024-11-05  5:11     ` Yi Liu
2024-11-05  5:45       ` Baolu Lu
2024-11-05 15:43   ` Jason Gunthorpe
2024-11-04 13:20 ` [PATCH v3 6/7] iommu/amd: " Yi Liu
2024-11-05 15:44   ` Jason Gunthorpe
2024-11-06  9:27   ` Vasant Hegde
2024-11-07  9:36   ` Tian, Kevin
2024-11-04 13:20 ` [PATCH v3 7/7] iommu: Remove the remove_dev_pasid op Yi Liu
2024-11-05 15:44   ` Jason Gunthorpe
2024-11-06  9:39   ` Vasant Hegde
2024-11-07  9:37   ` Tian, Kevin

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=56ff3976-ae80-41b2-b3d1-589499e463d7@amd.com \
    --to=vasant.hegde@amd.com \
    --cc=alex.williamson@redhat.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=chao.p.peng@linux.intel.com \
    --cc=eric.auger@redhat.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=nicolinc@nvidia.com \
    --cc=will@kernel.org \
    --cc=yi.l.liu@intel.com \
    --cc=zhenzhong.duan@intel.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