From: Jason Gunthorpe <jgg@nvidia.com>
To: "Wang, Wei W" <wei.w.wang@intel.com>
Cc: Lu Baolu <baolu.lu@linux.intel.com>,
David Woodhouse <dwmw2@infradead.org>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
Joerg Roedel <joro@8bytes.org>,
Robin Murphy <robin.murphy@arm.com>,
Will Deacon <will@kernel.org>,
"patches@lists.linux.dev" <patches@lists.linux.dev>
Subject: Re: [PATCH 4/7] iommu/vtd: Split intel_iommu_domain_alloc_paging_flags()
Date: Tue, 10 Jun 2025 10:25:35 -0300 [thread overview]
Message-ID: <20250610132535.GE543171@nvidia.com> (raw)
In-Reply-To: <DS0PR11MB63735BADC131F8AF05B98B89DC6AA@DS0PR11MB6373.namprd11.prod.outlook.com>
On Tue, Jun 10, 2025 at 09:14:05AM +0000, Wang, Wei W wrote:
> > +static struct iommu_domain *
> > +intel_iommu_domain_alloc_paging_flags(struct device *dev, u32 flags,
> > + const struct iommu_user_data *user_data)
> > {
> > + struct device_domain_info *info = dev_iommu_priv_get(dev);
> > + struct intel_iommu *iommu = info->iommu;
> > + struct iommu_domain *domain;
> > +
> > + if (user_data)
>
> Curious how is this user_data used. I check all the drivers (intel/amd/arm/selftest),
> seems nobody supports it.
It is a stand in for drivers to allow userspace to customize the page
table format. Only nesting domain types use it right now and since
they were split out the paging ones became disused.
> It seems a bit confusing to have it everywhere without
> real usages. I had a plan to remove it from all the interfaces (not sure if any
> misunderstanding)
Please just leave it, it will get used at some point
> > +
> > + /* Prefer fist stage if possible by default. */
>
> fist --> first
Yep
> > + domain = intel_iommu_domain_alloc_first_stage(dev, iommu, flags);
> > + if (domain != ERR_PTR(-EOPNOTSUPP))
> > + return domain;
>
> Should be "if (!IS_ERR(domain))" here?
> paging_domain_alloc() could also return ERR_PTR(-ENOMEM)
If alloc_first_stage() returns -ENOMEM then the first stage was
supported and we ran out of memory, the entire function should fail
and we don't try the second stage (since first was supported).
If we changed it as you propse then we'd never try the second stage.
EOPNOTSUPP means the first stage is not supported and the second stage
should be tried.
Jason
next prev parent reply other threads:[~2025-06-10 13:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-09 19:58 [PATCH 0/7] Reorganize Intel VT-D to be ready for iommupt Jason Gunthorpe
2025-06-09 19:58 ` [PATCH 1/7] iommu/vtd: Lift the __pa to domain_setup_first_level/intel_svm_set_dev_pasid() Jason Gunthorpe
2025-06-10 18:34 ` Jason Gunthorpe
2025-06-09 19:58 ` [PATCH 2/7] iommu/vtd: Fold domain_exit() into intel_iommu_domain_free() Jason Gunthorpe
2025-06-10 9:15 ` Wang, Wei W
2025-06-10 13:29 ` Jason Gunthorpe
2025-06-09 19:58 ` [PATCH 3/7] iommu/vtd: Do not wipe out the page table NID when devices detach Jason Gunthorpe
2025-06-10 6:41 ` Baolu Lu
2025-06-10 13:18 ` Jason Gunthorpe
2025-06-10 9:14 ` Wang, Wei W
2025-06-09 19:58 ` [PATCH 4/7] iommu/vtd: Split intel_iommu_domain_alloc_paging_flags() Jason Gunthorpe
2025-06-10 9:14 ` Wang, Wei W
2025-06-10 13:25 ` Jason Gunthorpe [this message]
2025-06-09 19:58 ` [PATCH 5/7] iommu/vtd: Create unique domain ops for each stage Jason Gunthorpe
2025-06-10 9:14 ` Wang, Wei W
2025-06-10 13:26 ` Jason Gunthorpe
2025-06-09 19:58 ` [PATCH 6/7] iommu/vtd: Split intel_iommu_enforce_cache_coherency() Jason Gunthorpe
2025-06-09 19:58 ` [PATCH 7/7] iommu/vtd: Split paging_domain_compatible() Jason Gunthorpe
2025-06-10 7:12 ` Baolu Lu
2025-06-10 23:51 ` Jason Gunthorpe
2025-06-11 4:50 ` Baolu Lu
2025-06-12 13:47 ` Jason Gunthorpe
2025-06-13 3:15 ` Baolu Lu
2025-06-12 7:18 ` [PATCH 0/7] Reorganize Intel VT-D to be ready for iommupt Joerg Roedel
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=20250610132535.GE543171@nvidia.com \
--to=jgg@nvidia.com \
--cc=baolu.lu@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=patches@lists.linux.dev \
--cc=robin.murphy@arm.com \
--cc=wei.w.wang@intel.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).