iommu/vt-d: Split intel_iommu_domain_alloc_paging_flags()
authorJason Gunthorpe <jgg@nvidia.com>
Mon, 14 Jul 2025 04:50:23 +0000 (12:50 +0800)
committerWill Deacon <will@kernel.org>
Mon, 14 Jul 2025 10:18:03 +0000 (11:18 +0100)
commitb9434ba97c44f5744ea537adfd1f9f3fe102681c
treee6d1e17f459e7ec8b6a70a7d1fc46d31fd662e78
parent5c3687d5789cfff8d285a2c76bceb47f145bf01f
iommu/vt-d: Split intel_iommu_domain_alloc_paging_flags()

Create stage specific functions that check the stage specific conditions
if each stage can be supported.

Have intel_iommu_domain_alloc_paging_flags() call both stages in sequence
until one does not return EOPNOTSUPP and prefer to use the first stage if
available and suitable for the requested flags.

Move second stage only operations like nested_parent and dirty_tracking
into the second stage function for clarity.

Move initialization of the iommu_domain members into paging_domain_alloc().

Drop initialization of domain->owner as the callers all do it.

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/4-v3-dbbe6f7e7ae3+124ffe-vtd_prep_jgg@nvidia.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20250714045028.958850-7-baolu.lu@linux.intel.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/intel/iommu.c