Re: [PATCH v2 09/12] iommu/amd: Add support for nest parent domain allocation

From: Jason Gunthorpe

Date: Mon Oct 06 2025 - 10:43:28 EST


On Thu, Oct 02, 2025 at 11:00:14AM -0700, Nicolin Chen wrote:

> > switch (flags & supported_flags) {
> > case IOMMU_HWPT_ALLOC_DIRTY_TRACKING:
> > - /* Allocate domain with v1 page table for dirty tracking */
> > - if (!amd_iommu_hd_support(iommu))
> > + case IOMMU_HWPT_ALLOC_NEST_PARENT:
> > + case IOMMU_HWPT_ALLOC_DIRTY_TRACKING | IOMMU_HWPT_ALLOC_NEST_PARENT:
> > + /*
> > + * Allocate domain with v1 page table for dirty tracking
> > + * and/or Nest parent.
> > + */
> > + if ((flags & IOMMU_HWPT_ALLOC_DIRTY_TRACKING) &&
> > + !amd_iommu_hd_support(iommu))
> > break;
>
> And add here:
> if ((flags & IOMMU_HWPT_ALLOC_NEST_PARENT)) &&
> !is_nest_parent_supported())
> break;

Yeah this looks better

On VT-D we have V1/V2 specific alloc functions and these tests were
put at the top of those functions in this form. This is close enough,
it is helpful to be consistent.

Jason