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

Commit c5ea9950 authored by Vinayak Menon's avatar Vinayak Menon Committed by Gerrit - the friendly Code Review server
Browse files

iommu: io-pgtable-arm: make double-map non-fatal



There isn't a reason to kill the kernel on a double
map attempt. Warn once on such a scenario.

Change-Id: I84479e0a8aa6b24c2e85cf0705da034ebd3ca846
Signed-off-by: default avatarVinayak Menon <vinmenon@codeaurora.org>
parent 54f3590a
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -289,7 +289,6 @@ 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)
{
@@ -404,7 +403,7 @@ static int arm_lpae_init_pte(struct arm_lpae_io_pgtable *data,

	/* We require an unmap first */
	if (pte & ARM_LPAE_PTE_VALID) {
		BUG_ON(!suppress_map_failures);
		WARN_RATELIMIT(1, "map without unmap\n");
		return -EEXIST;
	}

@@ -1417,7 +1416,6 @@ 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;						\
})
@@ -1504,12 +1502,10 @@ 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))
@@ -1655,7 +1651,6 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
	}

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