Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Sep 2021 14:24:15 GMT
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 22e68eadc50d - stable/12 - bcm2835_sdhci: don't use DMA for kernel dumps
Message-ID:  <202109281424.18SEOFBD035706@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=22e68eadc50d7e750e0108688ad7ddaadc115a6b

commit 22e68eadc50d7e750e0108688ad7ddaadc115a6b
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2021-09-09 18:07:06 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2021-09-28 14:23:50 +0000

    bcm2835_sdhci: don't use DMA for kernel dumps
    
    When handling a data irq, the sdhci driver calls the
    sdhci_platform_will_handle() method, to determine if it should allow the
    platform driver to handle the transfer or fall back to programmed I/O.
    While dumping, the data irq path may be invoked directly (not from an
    interrupt context), which the bcm2835_sdhci DMA code is not prepared to
    handle. Return early in this case, to force the fallback to PIO.
    
    Otherwise, the KASSERT that follows will be triggered, and the dump will
    fail. On non-INVARIANTS kernels, the system will hang, waiting for a DMA
    interrupt that will never arrive.
    
    Reviewed by:    kevans
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D31893
    
    (cherry picked from commit 806ebc9eba2a45638d63ae8a2ed20e6fb44dd06e)
---
 sys/arm/broadcom/bcm2835/bcm2835_sdhci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
index 621b3291bf12..4b0255d3fac8 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/bus.h>
+#include <sys/conf.h>
 #include <sys/kernel.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
@@ -722,6 +723,13 @@ bcm_sdhci_will_handle_transfer(device_t dev, struct sdhci_slot *slot)
 	struct bcm_sdhci_softc *sc = device_get_softc(slot->bus);
 #endif
 
+	/*
+	 * We don't want to perform DMA in this context -- interrupts are
+	 * disabled, and a transaction may already be in progress.
+	 */
+	if (dumping)
+		return (0);
+
 	/*
 	 * This indicates that we somehow let a data interrupt slip by into the
 	 * SDHCI framework, when it should not have.  This really needs to be



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109281424.18SEOFBD035706>