summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2021-03-29 17:04:00 +0000
committerkettenis <kettenis@openbsd.org>2021-03-29 17:04:00 +0000
commit14edd68e6a4948d2244829bbd092d21a09e8127c (patch)
treee1b59a4c7d7deacaf8a0e99fba240cbf2499559e
parentRemove pointless assignment in SSL_get0_alpn_selected(). (diff)
downloadwireguard-openbsd-14edd68e6a4948d2244829bbd092d21a09e8127c.tar.xz
wireguard-openbsd-14edd68e6a4948d2244829bbd092d21a09e8127c.zip
Turns out the PCIe DARTs support a full 32-bit device virtual address space.
Adjust the region managed by the extend accordingly but avoid the first and last page. The last page collides with the MSI address used by the PCIe controller and not using the first page helps finding bugs. ok patrick@
-rw-r--r--sys/arch/arm64/dev/apldart.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/arch/arm64/dev/apldart.c b/sys/arch/arm64/dev/apldart.c
index 2397fbbb13b..4e52e47c9d5 100644
--- a/sys/arch/arm64/dev/apldart.c
+++ b/sys/arch/arm64/dev/apldart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apldart.c,v 1.1 2021/02/27 16:19:14 kettenis Exp $ */
+/* $OpenBSD: apldart.c,v 1.2 2021/03/29 17:04:00 kettenis Exp $ */
/*
* Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org>
*
@@ -190,9 +190,14 @@ apldart_attach(struct device *parent, struct device *self, void *aux)
sc->sc_sid_mask = OF_getpropint(faa->fa_node, "sid-mask", 0xffff);
sc->sc_nsid = fls(sc->sc_sid_mask);
- /* Default aperture for PCIe DART. */
- sc->sc_dvabase = 0x00100000UL;
- sc->sc_dvaend = 0x3fefffffUL;
+ /*
+ * Skip the first page to help catching bugs where a device is
+ * doing DMA to/from address zero because we didn't properly
+ * set up the DMA transfer. Skip the last page to avoid using
+ * the address reserved for MSIs.
+ */
+ sc->sc_dvabase = DART_PAGE_SIZE;
+ sc->sc_dvaend = 0xffffffff - DART_PAGE_SIZE;
/* Disable translations. */
for (sid = 0; sid < sc->sc_nsid; sid++)