]> www.infradead.org Git - users/dwmw2/linux.git/commit
iommu/vt-d: Refactor first_level_by_default()
authorLu Baolu <baolu.lu@linux.intel.com>
Mon, 4 Nov 2024 01:40:26 +0000 (09:40 +0800)
committerJoerg Roedel <jroedel@suse.de>
Tue, 5 Nov 2024 12:32:18 +0000 (13:32 +0100)
commited56de8a9e90d9771c4517fb9f2daac8282269ba
tree1fa2986e25942b8fa9262d49db82a9d2117b5797
parent5bdd86ec5d19060f63c00fff3b081c887242a37a
iommu/vt-d: Refactor first_level_by_default()

The first stage page table is compatible across host and guest kernels.
Therefore, this driver uses the first stage page table as the default for
paging domains.

The helper first_level_by_default() determines the feasibility of using
the first stage page table based on a global policy. This policy requires
consistency in scalable mode and first stage translation capability among
all iommu units. However, this is unnecessary as domain allocation,
attachment, and removal operations are performed on a per-device basis.

The domain type (IOMMU_DOMAIN_DMA vs. IOMMU_DOMAIN_UNMANAGED) should not
be a factor in determining the first stage page table usage. Both types
are for paging domains, and there's no fundamental difference between them.
The driver should not be aware of this distinction unless the core
specifies allocation flags that require special handling.

Convert first_level_by_default() from global to per-iommu and remove the
'type' input.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20241021085125.192333-7-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel/iommu.c