git: 0cb63dcac446 - main - Revert "dwc: re-rewrite barrier part"

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Mon, 16 Oct 2023 19:48:38 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=0cb63dcac446df85787cc0a77d4d38d01ff92913

commit 0cb63dcac446df85787cc0a77d4d38d01ff92913
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2023-10-16 19:43:36 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-10-16 19:48:19 +0000

    Revert "dwc: re-rewrite barrier part"
    
    Turns out we need all the barrier.
    The one before writing the OWN bit is needed so the DMA engine
    have coherent data, the second one (after the OWN bit is set) is
    also needed because the DMA buffers are allocated with VM_MEMATTR_DEFAULT
    whic equals to being cached.
    
    This reverts commit 2b4f615e7d4720b16007cfa8aaedf720f572067a.
    This reverts commit 4870346488051b9c4a1dc8b11cab55d4e5b7c230.
    
    Reported by:    mmel
---
 sys/dev/dwc/dwc1000_dma.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c
index c91036f5a714..f6baa0bd3e45 100644
--- a/sys/dev/dwc/dwc1000_dma.c
+++ b/sys/dev/dwc/dwc1000_dma.c
@@ -218,6 +218,7 @@ txdesc_setup(struct dwc_softc *sc, int idx, bus_addr_t paddr,
 	sc->txdesc_ring[idx].desc1 = desc1;
 	wmb();
 	sc->txdesc_ring[idx].desc0 |= TDESC0_OWN;
+	wmb();
 }
 
 inline static uint32_t
@@ -238,6 +239,7 @@ rxdesc_setup(struct dwc_softc *sc, int idx, bus_addr_t paddr)
 
 	wmb();
 	sc->rxdesc_ring[idx].desc0 = RDESC0_OWN;
+	wmb();
 	return (nidx);
 }
 
@@ -524,6 +526,7 @@ dma1000_rxfinish_locked(struct dwc_softc *sc)
 		if (m == NULL) {
 			wmb();
 			desc->desc0 = RDESC0_OWN;
+			wmb();
 		} else {
 			/* We cannot create hole in RX ring */
 			error = dma1000_setup_rxbuf(sc, idx, m);