Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Use the 64bit DMA tag if its valid.



details:   https://anonhg.NetBSD.org/src/rev/6d4ad5886f76
branches:  trunk
changeset: 945227:6d4ad5886f76
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Oct 24 07:21:01 2020 +0000

description:
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:

 sys/dev/acpi/virtio_acpi.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 454f7eb30ed0 -r 6d4ad5886f76 sys/dev/acpi/virtio_acpi.c
--- a/sys/dev/acpi/virtio_acpi.c        Sat Oct 24 07:14:29 2020 +0000
+++ b/sys/dev/acpi/virtio_acpi.c        Sat Oct 24 07:21:01 2020 +0000
@@ -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 @@
        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);



Home | Main Index | Thread Index | Old Index