From: Jason Gunthorpe <jgg@nvidia.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
llvm@lists.linux.dev, Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Miguel Ojeda <ojeda@kernel.org>, Tom Rix <trix@redhat.com>,
Will Deacon <will@kernel.org>,
Lu Baolu <baolu.lu@linux.intel.com>,
Kevin Tian <kevin.tian@intel.com>,
Nicolin Chen <nicolinc@nvidia.com>
Subject: Re: [PATCH v3 08/17] iommu: Make iommu_group_do_dma_first_attach() work with owned groups
Date: Thu, 6 Apr 2023 16:34:45 -0300 [thread overview]
Message-ID: <ZC8e1QKO64pDdPfk@nvidia.com> (raw)
In-Reply-To: <db92f18c-e2ed-78d0-db7e-83d8ee8a4dce@arm.com>
On Thu, Apr 06, 2023 at 05:37:57PM +0100, Robin Murphy wrote:
> I don't have a particularly strong opinion on changing this behaviour, but I
> guess what's nagging me is that we could do a better job of calling out that
> it *is* a behaviour change, and its implications.
This patch got dropped with your other suggestion.
Instead this distinction is handled inside __iommu_device_set_domain():
if (dev->iommu->attach_deferred) {
if (new_domain == group->default_domain)
return 0;
dev->iommu->attach_deferred = 0;
}
Relying on the owned means group->domain != default_domain thinking we
used elsewhere.
> slightly better if the device binds to the same owner, in that it could rely
> use the current domain straight off without the risk of being in ACS limbo,
> but also slightly worse in that if the attach fails for any reason, it will
> now trash aliased RIDs of devices that *were* working OK.
The functional issue is that iommufd uses iommu_attach_group() - so
conceivably it is possible to hot plug in a new group member, add a
vfio driver to it and then hot add it to an existing iommufd. In this
case it is required that the core code set the iommu_domain properly
since iommufd won't call iommu_attach_group() again.
On the alias RID side, I would say a driver should be checking if the
acutal RID is already set and not disturb anything..
> the device could bind to any *other* driver with driver_managed_dma and have
> a much better guarantee of having access to the other owner's
> domain,
Right, this is what the 'owner' argument to
iommu_device_claim_dma_owner() is supposed to allow.
I added the above note about iommufd to the patch "iommu: Fix
iommu_probe_device() to attach the right domain"
Jason
next prev parent reply other threads:[~2023-04-06 19:34 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 23:38 [PATCH v3 00/17] Consolidate the error handling around device attachment Jason Gunthorpe
2023-04-05 23:38 ` [PATCH v3 01/17] iommu: Replace iommu_group_device_count() with list_count_nodes() Jason Gunthorpe
2023-04-05 23:38 ` [PATCH v3 02/17] iommu: Add for_each_group_device() Jason Gunthorpe
2023-04-05 23:38 ` [PATCH v3 03/17] iommu: Make __iommu_group_set_domain() handle error unwind Jason Gunthorpe
2023-04-06 18:08 ` Robin Murphy
2023-04-06 19:09 ` Jason Gunthorpe
2023-04-13 16:47 ` Robin Murphy
2023-04-13 18:39 ` Jason Gunthorpe
2023-04-05 23:38 ` [PATCH v3 04/17] iommu: Use __iommu_group_set_domain() for __iommu_attach_group() Jason Gunthorpe
2023-04-05 23:38 ` [PATCH v3 05/17] iommu: Use __iommu_group_set_domain() in iommu_change_dev_def_domain() Jason Gunthorpe
2023-04-05 23:38 ` [PATCH v3 06/17] iommu: Replace __iommu_group_dma_first_attach() with set_domain Jason Gunthorpe
2023-04-06 15:58 ` Robin Murphy
2023-04-06 19:17 ` Jason Gunthorpe
2023-04-05 23:38 ` [PATCH v3 07/17] iommu: Make iommu_group_do_dma_first_attach() simpler Jason Gunthorpe
2023-04-06 3:28 ` Baolu Lu
2023-04-06 15:44 ` Robin Murphy
2023-04-06 16:09 ` Jason Gunthorpe
2023-04-06 19:05 ` Robin Murphy
2023-04-05 23:38 ` [PATCH v3 08/17] iommu: Make iommu_group_do_dma_first_attach() work with owned groups Jason Gunthorpe
2023-04-06 16:37 ` Robin Murphy
2023-04-06 19:34 ` Jason Gunthorpe [this message]
2023-04-05 23:38 ` [PATCH v3 09/17] iommu: Fix iommu_probe_device() to attach the right domain Jason Gunthorpe
2023-04-05 23:38 ` [PATCH v3 10/17] iommu: Do iommu_group_create_direct_mappings() before attach Jason Gunthorpe
2023-04-06 3:14 ` Baolu Lu
2023-04-05 23:38 ` [PATCH v3 11/17] iommu: Remove the assignment of group->domain during default domain alloc Jason Gunthorpe
2023-04-05 23:38 ` [PATCH v3 12/17] iommu: Consolidate the code to calculate the target default domain type Jason Gunthorpe
2023-04-05 23:38 ` [PATCH v3 13/17] iommu: Revise iommu_group_alloc_default_domain() Jason Gunthorpe
2023-04-06 3:40 ` Baolu Lu
2023-04-06 11:34 ` Jason Gunthorpe
2023-04-05 23:38 ` [PATCH v3 14/17] iommu: Consolidate the default_domain setup to one function Jason Gunthorpe
2023-04-06 4:43 ` Baolu Lu
2023-04-05 23:38 ` [PATCH v3 15/17] iommu: Allow IOMMU_RESV_DIRECT to work on ARM Jason Gunthorpe
2023-04-06 3:53 ` Baolu Lu
2023-04-05 23:38 ` [PATCH v3 16/17] iommu: Remove __iommu_group_for_each_dev() Jason Gunthorpe
2023-04-05 23:38 ` [PATCH v3 17/17] iommu: Tidy the control flow in iommu_group_store_type() Jason Gunthorpe
2023-04-07 11:02 ` [PATCH v3 00/17] Consolidate the error handling around device attachment Naresh Kamboju
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=ZC8e1QKO64pDdPfk@nvidia.com \
--to=jgg@nvidia.com \
--cc=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolinc@nvidia.com \
--cc=ojeda@kernel.org \
--cc=robin.murphy@arm.com \
--cc=trix@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).