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

Commit 9739d9b3 authored by Mitchel Humpherys's avatar Mitchel Humpherys Committed by Patrick Daly
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>
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent e4012a64
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -274,6 +274,7 @@ static void iopte_tblcnt_add(arm_lpae_iopte *table_ptep, int cnt)
}

static bool selftest_running = false;
static bool suppress_map_failures;

static dma_addr_t __arm_lpae_dma_addr(void *pages)
{
@@ -343,7 +344,7 @@ static int arm_lpae_init_pte(struct arm_lpae_io_pgtable *data,

	/* We require an unmap first */
	if (*ptep & ARM_LPAE_PTE_VALID) {
		BUG_ON(!selftest_running);
		BUG_ON(!suppress_map_failures);
		return -EEXIST;
	}

@@ -1123,6 +1124,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);					\
		suppress_map_failures = false;				\
		selftest_running = false;				\
		-EFAULT;						\
})
@@ -1210,10 +1212,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))
@@ -1360,6 +1364,7 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
	}

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