]> Gentwo Git Trees - linux/.git/commitdiff
iommu/io-pgtable-arm: Remove arm_lpae_dump_ops()
authorMostafa Saleh <smostafa@google.com>
Mon, 3 Nov 2025 12:33:49 +0000 (12:33 +0000)
committerJoerg Roedel <joerg.roedel@amd.com>
Thu, 13 Nov 2025 15:25:31 +0000 (16:25 +0100)
At the moment, if the selftest fails it prints a lot of information
about the page table (size, levels...) this requires access to many
internals, which has to be exposed in the next patch moving the
tests out.

Instead, we can simplify the print to only print the fmt and
for each test ias, oas and pgsize_bitmap are already printed.
That is enough to identify the failed case, and the rest can
be deduced from the code.

Signed-off-by: Mostafa Saleh <smostafa@google.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/io-pgtable-arm.c

index 7e8e2216c294a93f2ebe7739a311e99406a0894c..7d6d7221f5407e3234cc33a31978dcdbedf375c4 100644 (file)
@@ -1297,21 +1297,8 @@ static const struct iommu_flush_ops dummy_tlb_ops __initconst = {
        .tlb_add_page   = dummy_tlb_add_page,
 };
 
-static void __init arm_lpae_dump_ops(struct io_pgtable_ops *ops)
-{
-       struct arm_lpae_io_pgtable *data = io_pgtable_ops_to_data(ops);
-       struct io_pgtable_cfg *cfg = &data->iop.cfg;
-
-       pr_err("cfg: pgsize_bitmap 0x%lx, ias %u-bit\n",
-               cfg->pgsize_bitmap, cfg->ias);
-       pr_err("data: %d levels, 0x%zx pgd_size, %u pg_shift, %u bits_per_level, pgd @ %p\n",
-               ARM_LPAE_MAX_LEVELS - data->start_level, ARM_LPAE_PGD_SIZE(data),
-               ilog2(ARM_LPAE_GRANULE(data)), data->bits_per_level, data->pgd);
-}
-
-#define __FAIL(ops, i) ({                                              \
+#define __FAIL(i) ({                                                   \
                WARN(1, "selftest: test failed for fmt idx %d\n", (i)); \
-               arm_lpae_dump_ops(ops);                                 \
                -EFAULT;                                                \
 })
 
@@ -1340,13 +1327,13 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
                 * Empty page tables shouldn't provide any translations.
                 */
                if (ops->iova_to_phys(ops, 42))
-                       return __FAIL(ops, i);
+                       return __FAIL(i);
 
                if (ops->iova_to_phys(ops, SZ_1G + 42))
-                       return __FAIL(ops, i);
+                       return __FAIL(i);
 
                if (ops->iova_to_phys(ops, SZ_2G + 42))
-                       return __FAIL(ops, i);
+                       return __FAIL(i);
 
                /*
                 * Distinct mappings of different granule sizes.
@@ -1359,16 +1346,16 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
                                           IOMMU_READ | IOMMU_WRITE |
                                           IOMMU_NOEXEC | IOMMU_CACHE,
                                           GFP_KERNEL, &mapped))
-                               return __FAIL(ops, i);
+                               return __FAIL(i);
 
                        /* Overlapping mappings */
                        if (!ops->map_pages(ops, iova, iova + size, size, 1,
                                            IOMMU_READ | IOMMU_NOEXEC,
                                            GFP_KERNEL, &mapped))
-                               return __FAIL(ops, i);
+                               return __FAIL(i);
 
                        if (ops->iova_to_phys(ops, iova + 42) != (iova + 42))
-                               return __FAIL(ops, i);
+                               return __FAIL(i);
 
                        iova += SZ_1G;
                }
@@ -1379,18 +1366,18 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
                        size = 1UL << j;
 
                        if (ops->unmap_pages(ops, iova, size, 1, NULL) != size)
-                               return __FAIL(ops, i);
+                               return __FAIL(i);
 
                        if (ops->iova_to_phys(ops, iova + 42))
-                               return __FAIL(ops, i);
+                               return __FAIL(i);
 
                        /* Remap full block */
                        if (ops->map_pages(ops, iova, iova, size, 1,
                                           IOMMU_WRITE, GFP_KERNEL, &mapped))
-                               return __FAIL(ops, i);
+                               return __FAIL(i);
 
                        if (ops->iova_to_phys(ops, iova + 42) != (iova + 42))
-                               return __FAIL(ops, i);
+                               return __FAIL(i);
 
                        iova += SZ_1G;
                }
@@ -1406,11 +1393,11 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
                                   IOMMU_READ | IOMMU_WRITE |
                                   IOMMU_NOEXEC | IOMMU_CACHE,
                                   GFP_KERNEL, &mapped))
-                       return __FAIL(ops, i);
+                       return __FAIL(i);
                if (mapped != size)
-                       return __FAIL(ops, i);
+                       return __FAIL(i);
                if (ops->unmap_pages(ops, iova, size, 1, NULL) != size)
-                       return __FAIL(ops, i);
+                       return __FAIL(i);
 
                free_io_pgtable_ops(ops);
        }