diff options
author | 2021-01-14 13:52:27 +0000 | |
---|---|---|
committer | 2021-01-14 13:52:27 +0000 | |
commit | ead4e6b33f365da3cf07263b89f73b27e3471414 (patch) | |
tree | 2d77d8c9d92c8bf6e61ce852d18766a7dc51205c | |
parent | IPv6 link-local addresses are broken in pf(4) as scope ID is used (diff) | |
download | wireguard-openbsd-ead4e6b33f365da3cf07263b89f73b27e3471414.tar.xz wireguard-openbsd-ead4e6b33f365da3cf07263b89f73b27e3471414.zip |
Some BIOS seem to provide memory regions <16M in their reserved memory
region reporting table. Since the extent only covered memory starting
at 16M, these regions could not be reserved and would in turn cause a
panic. Make the extent start at 0 and immediately reserve the first
16M right away, so that we can change the reserved memory allocator to
EX_CONFLICTOK to make allocations succeed if they are already reserved.
ok kettenis@
-rw-r--r-- | sys/dev/acpi/acpidmar.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/acpi/acpidmar.c b/sys/dev/acpi/acpidmar.c index be4c68732dd..93228d76286 100644 --- a/sys/dev/acpi/acpidmar.c +++ b/sys/dev/acpi/acpidmar.c @@ -1438,10 +1438,11 @@ domain_create(struct iommu_softc *iommu, int did) /* Setup IOMMU address map */ gaw = min(iommu->agaw, iommu->mgaw); - dom->iovamap = extent_create(dom->exname, 1024*1024*16, - (1LL << gaw)-1, - M_DEVBUF, NULL, 0, - EX_WAITOK|EX_NOCOALESCE); + dom->iovamap = extent_create(dom->exname, 0, (1LL << gaw)-1, + M_DEVBUF, NULL, 0, EX_WAITOK | EX_NOCOALESCE); + + /* Reserve the first 16M */ + extent_alloc_region(dom->iovamap, 0, 16*1024*1024, EX_WAITOK); /* Zero out MSI Interrupt region */ extent_alloc_region(dom->iovamap, MSI_BASE_ADDRESS, MSI_BASE_SIZE, @@ -1897,7 +1898,8 @@ acpidmar_init(struct acpidmar_softc *sc, struct acpi_dmar *dmar) dom_bdf(dom), rmrr->start, rmrr->end); domain_map_pthru(dom, rmrr->start, rmrr->end); rc = extent_alloc_region(dom->iovamap, - rmrr->start, rmrr->end, EX_WAITOK); + rmrr->start, rmrr->end, + EX_WAITOK | EX_CONFLICTOK); } } } |