Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5deeba0 authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

iommu: io-pgtable-arm: Only suppress map failures during map tests



We're currently suppressing all map failures during the entirety of the
selftests.  We really only want to suppress those failures during
individual negative map test cases to avoid logspam, but we *do* want to
see other map failures during the selftests.  Fix this by only
suppressing map failures during negative map test cases.

Change-Id: If51a95dd4d8c5b756cfa4597a5bdd7c75afe2637
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent 8794e625
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -196,7 +196,7 @@ struct arm_lpae_io_pgtable {

typedef u64 arm_lpae_iopte;

static bool selftest_running = false;
static bool suppress_map_failures;

static int arm_lpae_init_pte(struct arm_lpae_io_pgtable *data,
			     unsigned long iova, phys_addr_t paddr,
@@ -207,7 +207,7 @@ static int arm_lpae_init_pte(struct arm_lpae_io_pgtable *data,

	/* We require an unmap first */
	if (iopte_leaf(*ptep, lvl)) {
		if (!selftest_running) {
		if (!suppress_map_failures) {
			*ptep = 0;
			data->iop.cfg.tlb->tlb_flush_all(data->iop.cookie);
		} else {
@@ -949,7 +949,7 @@ static void __init arm_lpae_dump_ops(struct io_pgtable_ops *ops)
#define __FAIL(ops, i)	({						\
		WARN(1, "selftest: test failed for fmt idx %d\n", (i));	\
		arm_lpae_dump_ops(ops);					\
		selftest_running = false;				\
		suppress_map_failures = false;				\
		-EFAULT;						\
})

@@ -1001,7 +1001,6 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
	unsigned long iova;
	size_t size;
	struct io_pgtable_ops *ops;
	selftest_running = true;

	for (i = 0; i < ARRAY_SIZE(fmts); ++i) {
		unsigned long test_sg_sizes[] = { SZ_4K, SZ_64K, SZ_2M,
@@ -1036,10 +1035,12 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
							    IOMMU_CACHE))
				return __FAIL(ops, i);

			suppress_map_failures = true;
			/* Overlapping mappings */
			if (!ops->map(ops, iova, iova + size, size,
				      IOMMU_READ | IOMMU_NOEXEC))
				return __FAIL(ops, i);
			suppress_map_failures = false;

			if (!arm_lpae_range_has_specific_mapping(ops, iova,
								 iova, size))
@@ -1184,7 +1185,7 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
		free_io_pgtable_ops(ops);
	}

	selftest_running = false;
	suppress_map_failures = false;
	return 0;
}