From: Baolu Lu <baolu.lu@linux.intel.com>
To: Jason Gunthorpe <jgg@ziepe.ca>, Robin Murphy <robin.murphy@arm.com>
Cc: baolu.lu@linux.intel.com, Joerg Roedel <joro@8bytes.org>,
Will Deacon <will@kernel.org>, Kevin Tian <kevin.tian@intel.com>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] iommu: Set owner token to sva and nested domains
Date: Fri, 8 Dec 2023 09:42:02 +0800 [thread overview]
Message-ID: <449c288c-0ab1-4287-814d-91b704fb3b46@linux.intel.com> (raw)
In-Reply-To: <20231207133630.GS1489931@ziepe.ca>
On 12/7/23 9:36 PM, Jason Gunthorpe wrote:
> On Thu, Dec 07, 2023 at 09:56:10AM +0000, Robin Murphy wrote:
>> On 2023-12-07 2:19 am, Lu Baolu wrote:
>>> Commit a9c362db3920 ("iommu: Validate that devices match domains") added
>>> an owner token to an iommu_domain. This token is checked during domain
>>> attachment to RID or PASID through the generic iommu interfaces.
>>>
>>> The sva and nested domains are attached to device or PASID through the
>>> generic iommu interfaces. Therefore, they require the owner token to be
>>> set during allocation. Otherwise, they fail to attach.
>> Oops, I missed that iommu_sva_domain_alloc() is a thing - when did we get
>> such a confusing proliferation of domain allocation paths? Sigh...
> We have alot of different kinds of domains now, APIs that are giant
> multiplexers are not good.
>
> What I've been wanting to do for a while is to have the drivers call a
> helper to allocate their domain struct and the helper would initialize
> the common iommu_domain instead of doing this after the op
> returns. This is more typical kernel pattern and avoids some of the
> confusion about when struct members are valid or not (notice some of
> driver code needs iommu_domain stuff set earlier and we confusingly
> initialize things twice :()
>
>> I think we should set the owner generically there, since presumably it's
>> being missed for SMMUv3/AMD/etc. SVA domains as well. Nested domains are
>> supposed to be OK since both ->domain_alloc_user callsites are covered, or
>> is there some other sneaky path I've also missed?
> Indeed, I also think the first hunk is not needed, the second hunk was
> missed.
Oh, yes! I overlooked that iommufd has already done that for nested
domain. I will update it with a v2.
Best regards,
baolu
prev parent reply other threads:[~2023-12-08 1:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-07 2:19 [PATCH 1/1] iommu: Set owner token to sva and nested domains Lu Baolu
2023-12-07 9:56 ` Robin Murphy
2023-12-07 13:36 ` Jason Gunthorpe
2023-12-08 1:42 ` Baolu Lu [this message]
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=449c288c-0ab1-4287-814d-91b704fb3b46@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox