summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorskrll <skrll@NetBSD.org>2020-10-24 07:21:01 +0000
committerskrll <skrll@NetBSD.org>2020-10-24 07:21:01 +0000
commitb05d19ccb0e5ec3a9d4fbcf74a8f8bfd84bf467e (patch)
treeb9497bfae5b14abff5e9afabc57b052e14a184b9 /sys/dev
parentd1c7a51dbc4495f09e6fd121b6ec87ce7fb76fbc (diff)
Use the 64bit DMA tag if its valid.
There appears to be a bug in virtio / ld_virtio and bounce buffers that was triggered when the bus_dmatag_subregion code on arm64 was fixed to correctly create a new tag for the 32bit tag vs the system (64bit) tag. This change avoids the bug. PR/55737: Apparent bug in evbarm64 DMA code causes filesystem corruption
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/virtio_acpi.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/dev/acpi/virtio_acpi.c b/sys/dev/acpi/virtio_acpi.c
index 951742e4435..c10d60c60ed 100644
--- a/sys/dev/acpi/virtio_acpi.c
+++ b/sys/dev/acpi/virtio_acpi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_acpi.c,v 1.2 2018/11/16 23:18:17 jmcneill Exp $ */
+/* $NetBSD: virtio_acpi.c,v 1.3 2020/10/24 07:21:01 skrll Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio_acpi.c,v 1.2 2018/11/16 23:18:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_acpi.c,v 1.3 2020/10/24 07:21:01 skrll Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -95,7 +95,14 @@ virtio_acpi_attach(device_t parent, device_t self, void *aux)
sc->sc_handle = aa->aa_node->ad_handle;
msc->sc_iot = aa->aa_memt;
vsc->sc_dev = self;
- vsc->sc_dmat = aa->aa_dmat;
+
+ if (BUS_DMA_TAG_VALID(aa->aa_dmat64)) {
+ aprint_verbose(": using 64-bit DMA");
+ vsc->sc_dmat = aa->aa_dmat64;
+ } else {
+ aprint_verbose(": using 32-bit DMA");
+ vsc->sc_dmat = aa->aa_dmat;
+ }
rv = acpi_resource_parse(self, aa->aa_node->ad_handle, "_CRS",
&res, &acpi_resource_parse_ops_default);