All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tian, Kevin" <kevin.tian@intel.com>
To: Jason Gunthorpe <jgg@nvidia.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	Joerg Roedel <joro@8bytes.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Will Deacon <will@kernel.org>
Cc: Lu Baolu <baolu.lu@linux.intel.com>, Nicolin Chen <nicolinc@nvidia.com>
Subject: RE: [PATCH 5/9] iommu: Make iommu_group_do_dma_first_attach() simpler
Date: Fri, 24 Mar 2023 07:23:30 +0000	[thread overview]
Message-ID: <BN9PR11MB52766008E93EA1CBEFCE5DF78C849@BN9PR11MB5276.namprd11.prod.outlook.com> (raw)
In-Reply-To: <5-v1-20507a7e6b7e+2d6-iommu_err_unwind_jgg@nvidia.com>

> From: Jason Gunthorpe <jgg@nvidia.com>
> Sent: Wednesday, March 22, 2023 3:53 AM
> 
> -static int iommu_group_do_dma_first_attach(struct device *dev, void *data)
> +static int iommu_group_do_dma_first_attach(struct iommu_group *group,
> struct device *dev)
>  {
> -	struct iommu_domain *domain = data;
> -
> -	lockdep_assert_held(&dev->iommu_group->mutex);
> -
> -	if (iommu_is_attach_deferred(dev)) {
> -		dev->iommu->attach_deferred = 1;
> -		return 0;
> -	}
> -
> -	return __iommu_attach_device(domain, dev);
> +	return __iommu_device_set_domain(
> +		group, dev, group->domain,
> +		group->owner ? 0 : IOMMU_SET_DOMAIN_WITH_DEFERRED);
>  }

This changes semantics in iommu_group_add_device().

Previously it always does deferred attach no matter whether the group
has been claimed.

While this change makes sense given deferred attach only applies to
default domain, it's worthy of an explanation or probably even made
into a separate patch.

  reply	other threads:[~2023-03-24  7:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 19:53 [PATCH 0/9] Consolidate the error handling around device attachment Jason Gunthorpe
2023-03-21 19:53 ` [PATCH 1/9] iommu: Make __iommu_group_set_domain() handle error unwind Jason Gunthorpe
2023-03-24  7:17   ` Tian, Kevin
2023-03-24 15:17     ` Jason Gunthorpe
2023-03-21 19:53 ` [PATCH 2/9] iommu: Use __iommu_group_set_domain() for __iommu_attach_group() Jason Gunthorpe
2023-03-24  7:18   ` Tian, Kevin
2023-03-21 19:53 ` [PATCH 3/9] iommu: Use __iommu_group_set_domain() in iommu_change_dev_def_domain() Jason Gunthorpe
2023-03-24  7:19   ` Tian, Kevin
2023-03-24 13:17     ` Jason Gunthorpe
2023-03-21 19:53 ` [PATCH 4/9] iommu: Replace __iommu_group_dma_first_attach() with set_domain Jason Gunthorpe
2023-03-24  7:20   ` Tian, Kevin
2023-03-21 19:53 ` [PATCH 5/9] iommu: Make iommu_group_do_dma_first_attach() simpler Jason Gunthorpe
2023-03-24  7:23   ` Tian, Kevin [this message]
2023-03-24 15:23     ` Jason Gunthorpe
2023-03-21 19:53 ` [PATCH 6/9] iommu: Fix iommu_probe_device() to attach the right domain Jason Gunthorpe
2023-03-24  7:29   ` Tian, Kevin
2023-03-24 15:42     ` Jason Gunthorpe
2023-03-24 19:36     ` Jason Gunthorpe
2023-03-21 19:53 ` [PATCH 7/9] iommu: Remove the assignment of group->domain during default domain alloc Jason Gunthorpe
2023-03-24  7:30   ` Tian, Kevin
2023-03-21 19:53 ` [PATCH 8/9] iommu: Consolidate the default_domain setup to one function Jason Gunthorpe
2023-03-21 19:53 ` [PATCH 9/9] iommu: Remove __iommu_group_for_each_dev() Jason Gunthorpe
2023-03-22 13:08   ` Joerg Roedel
2023-03-22 13:41     ` Jason Gunthorpe

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=BN9PR11MB52766008E93EA1CBEFCE5DF78C849@BN9PR11MB5276.namprd11.prod.outlook.com \
    --to=kevin.tian@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=nicolinc@nvidia.com \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /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.