Module Name:    src
Committed By:   skrll
Date:           Sat Oct 24 07:21:01 UTC 2020

Modified Files:
        src/sys/dev/acpi: virtio_acpi.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/acpi/virtio_acpi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/virtio_acpi.c
diff -u src/sys/dev/acpi/virtio_acpi.c:1.2 src/sys/dev/acpi/virtio_acpi.c:1.3
--- src/sys/dev/acpi/virtio_acpi.c:1.2	Fri Nov 16 23:18:17 2018
+++ src/sys/dev/acpi/virtio_acpi.c	Sat Oct 24 07:21:01 2020
@@ -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, devi
 	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);

Reply via email to