From ab86b9020dc7a7e0f5e6f0a183513a03d13d2e53 Mon Sep 17 00:00:00 2001 From: patrick Date: Sat, 3 Apr 2021 15:10:58 +0000 Subject: [PATCH] Exclude the first page from I/O virtual address space, which is the NULL pointer address. Not allowing this one to be allocated might help find driver bugs, where the device is programmed with a NULL pointer. We have plenty of address space anyway, so excluding this single page does not hurt at all and can only have positive effects. Idea from kettenis@ --- sys/arch/arm64/dev/smmu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/arch/arm64/dev/smmu.c b/sys/arch/arm64/dev/smmu.c index 344e0b92f3f..565e9df3a9f 100644 --- a/sys/arch/arm64/dev/smmu.c +++ b/sys/arch/arm64/dev/smmu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smmu.c,v 1.11 2021/03/22 20:34:45 patrick Exp $ */ +/* $OpenBSD: smmu.c,v 1.12 2021/04/03 15:10:58 patrick Exp $ */ /* * Copyright (c) 2008-2009,2014-2016 Dale Rahn * Copyright (c) 2021 Patrick Wildt @@ -750,8 +750,9 @@ smmu_domain_create(struct smmu_softc *sc, uint32_t sid) snprintf(dom->sd_exname, sizeof(dom->sd_exname), "%s:%x", sc->sc_dev.dv_xname, sid); - dom->sd_iovamap = extent_create(dom->sd_exname, 0, (1LL << iovabits)-1, - M_DEVBUF, NULL, 0, EX_WAITOK | EX_NOCOALESCE); + dom->sd_iovamap = extent_create(dom->sd_exname, PAGE_SIZE, + (1LL << iovabits) - 1, M_DEVBUF, NULL, 0, EX_WAITOK | + EX_NOCOALESCE); #if 0 /* FIXME PCIe address space */ -- 2.20.1