]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iommu/amd: Use protection_domain.flags to check page table mode
authorVasant Hegde <vasant.hegde@amd.com>
Mon, 5 Feb 2024 11:56:04 +0000 (11:56 +0000)
committerJoerg Roedel <jroedel@suse.de>
Fri, 9 Feb 2024 12:16:24 +0000 (13:16 +0100)
Page table mode (v1, v2 or pt) is per domain property. Recently we have
enhanced protection_domain.pd_mode to track per domain page table mode.
Use that variable to check the page table mode instead of global
'amd_iommu_pgtable' in {map/unmap}_pages path.

Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20240205115615.6053-7-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/iommu.c

index a3c8f8ea926e2c5f29c6ca308b9fa1c47605ffa3..498323930892c54322b0e6f008dc8f8da7376cf2 100644 (file)
@@ -2310,7 +2310,7 @@ static int amd_iommu_map_pages(struct iommu_domain *dom, unsigned long iova,
        int prot = 0;
        int ret = -EINVAL;
 
-       if ((amd_iommu_pgtable == AMD_IOMMU_V1) &&
+       if ((domain->pd_mode == PD_MODE_V1) &&
            (domain->iop.mode == PAGE_MODE_NONE))
                return -EINVAL;
 
@@ -2356,7 +2356,7 @@ static size_t amd_iommu_unmap_pages(struct iommu_domain *dom, unsigned long iova
        struct io_pgtable_ops *ops = &domain->iop.iop.ops;
        size_t r;
 
-       if ((amd_iommu_pgtable == AMD_IOMMU_V1) &&
+       if ((domain->pd_mode == PD_MODE_V1) &&
            (domain->iop.mode == PAGE_MODE_NONE))
                return 0;