Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic move DWCGMAC_MPSAFE into dwc_gmac_var.h and intro...



details:   https://anonhg.NetBSD.org/src/rev/de2ccbf2e94d
branches:  trunk
changeset: 962418:de2ccbf2e94d
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Jul 21 08:24:32 2019 +0000

description:
move DWCGMAC_MPSAFE into dwc_gmac_var.h and introduce an
additional define that is 0 or FDT_INTR_MPSAFE that the
frontends can use when passing to fdtbus_intr_establish().

with NET_MPSAFE enabled, this avoids hangs seen on rock64,
as well as finishing the MPSAFE port for this driver.

XXX: still don't know why the existing hangs occur.

diffstat:

 sys/arch/arm/altera/cycv_gmac.c    |   6 +++---
 sys/arch/arm/amlogic/meson_dwmac.c |   7 ++++---
 sys/arch/arm/rockchip/rk_gmac.c    |   7 ++++---
 sys/arch/arm/sunxi/sunxi_gmac.c    |   7 ++++---
 sys/dev/ic/dwc_gmac.c              |  10 +++-------
 sys/dev/ic/dwc_gmac_var.h          |  16 +++++++++++++++-
 6 files changed, 33 insertions(+), 20 deletions(-)

diffs (179 lines):

diff -r 7da55a1fbf84 -r de2ccbf2e94d sys/arch/arm/altera/cycv_gmac.c
--- a/sys/arch/arm/altera/cycv_gmac.c   Sat Jul 20 20:59:05 2019 +0000
+++ b/sys/arch/arm/altera/cycv_gmac.c   Sun Jul 21 08:24:32 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cycv_gmac.c,v 1.3 2019/07/08 03:22:38 msaitoh Exp $ */
+/* $NetBSD: cycv_gmac.c,v 1.4 2019/07/21 08:24:32 mrg Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: cycv_gmac.c,v 1.3 2019/07/08 03:22:38 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cycv_gmac.c,v 1.4 2019/07/21 08:24:32 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -129,7 +129,7 @@
        aprint_naive("\n");
        aprint_normal(": GMAC\n");
 
-       if (fdtbus_intr_establish(phandle, 0, IPL_NET, 0,
+       if (fdtbus_intr_establish(phandle, 0, IPL_NET, DWCGMAC_FDT_INTR_MPSAFE,
                                  cycv_gmac_intr, sc) == NULL) {
                aprint_error_dev(self, "failed to establish interrupt on %s\n",
                                 intrstr);
diff -r 7da55a1fbf84 -r de2ccbf2e94d sys/arch/arm/amlogic/meson_dwmac.c
--- a/sys/arch/arm/amlogic/meson_dwmac.c        Sat Jul 20 20:59:05 2019 +0000
+++ b/sys/arch/arm/amlogic/meson_dwmac.c        Sun Jul 21 08:24:32 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_dwmac.c,v 1.6 2019/07/08 03:22:38 msaitoh Exp $ */
+/* $NetBSD: meson_dwmac.c,v 1.7 2019/07/21 08:24:32 mrg Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.6 2019/07/08 03:22:38 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.7 2019/07/21 08:24:32 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -218,7 +218,8 @@
        aprint_naive("\n");
        aprint_normal(": Gigabit Ethernet Controller\n");
 
-       if (fdtbus_intr_establish(phandle, 0, IPL_NET, 0, meson_dwmac_intr, sc) == NULL) {
+       if (fdtbus_intr_establish(phandle, 0, IPL_NET, DWCGMAC_FDT_INTR_MPSAFE,
+           meson_dwmac_intr, sc) == NULL) {
                aprint_error_dev(self, "failed to establish interrupt on %s\n", intrstr);
                return;
        }
diff -r 7da55a1fbf84 -r de2ccbf2e94d sys/arch/arm/rockchip/rk_gmac.c
--- a/sys/arch/arm/rockchip/rk_gmac.c   Sat Jul 20 20:59:05 2019 +0000
+++ b/sys/arch/arm/rockchip/rk_gmac.c   Sun Jul 21 08:24:32 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_gmac.c,v 1.13 2019/07/08 03:22:38 msaitoh Exp $ */
+/* $NetBSD: rk_gmac.c,v 1.14 2019/07/21 08:24:32 mrg Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.13 2019/07/08 03:22:38 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.14 2019/07/21 08:24:32 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -421,7 +421,8 @@
        if (dwc_gmac_attach(sc, MII_PHY_ANY, GMAC_MII_CLK_150_250M_DIV102) != 0)
                return;
 
-       if (fdtbus_intr_establish(phandle, 0, IPL_NET, 0, rk_gmac_intr, sc) == NULL) {
+       if (fdtbus_intr_establish(phandle, 0, IPL_NET, DWCGMAC_FDT_INTR_MPSAFE,
+           rk_gmac_intr, sc) == NULL) {
                aprint_error_dev(self, "failed to establish interrupt on %s\n", intrstr);
                return;
        }
diff -r 7da55a1fbf84 -r de2ccbf2e94d sys/arch/arm/sunxi/sunxi_gmac.c
--- a/sys/arch/arm/sunxi/sunxi_gmac.c   Sat Jul 20 20:59:05 2019 +0000
+++ b/sys/arch/arm/sunxi/sunxi_gmac.c   Sun Jul 21 08:24:32 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_gmac.c,v 1.5 2019/07/08 03:22:38 msaitoh Exp $ */
+/* $NetBSD: sunxi_gmac.c,v 1.6 2019/07/21 08:24:32 mrg Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_gmac.c,v 1.5 2019/07/08 03:22:38 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_gmac.c,v 1.6 2019/07/21 08:24:32 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -182,7 +182,8 @@
        aprint_naive("\n");
        aprint_normal(": GMAC\n");
 
-       if (fdtbus_intr_establish(phandle, 0, IPL_NET, 0, sunxi_gmac_intr, sc) == NULL) {
+       if (fdtbus_intr_establish(phandle, 0, IPL_NET, DWCGMAC_FDT_INTR_MPSAFE,
+           sunxi_gmac_intr, sc) == NULL) {
                aprint_error_dev(self, "failed to establish interrupt on %s\n", intrstr);
                return;
        }
diff -r 7da55a1fbf84 -r de2ccbf2e94d sys/dev/ic/dwc_gmac.c
--- a/sys/dev/ic/dwc_gmac.c     Sat Jul 20 20:59:05 2019 +0000
+++ b/sys/dev/ic/dwc_gmac.c     Sun Jul 21 08:24:32 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.63 2019/07/08 03:22:38 msaitoh Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.64 2019/07/21 08:24:32 mrg Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.63 2019/07/08 03:22:38 msaitoh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.64 2019/07/21 08:24:32 mrg Exp $");
 
 /* #define     DWC_GMAC_DEBUG  1 */
 
@@ -180,10 +180,6 @@
 static void dwc_gmac_dump_ffilt(struct dwc_gmac_softc *, uint32_t);
 #endif
 
-#ifdef NET_MPSAFE
-#define DWCGMAC_MPSAFE 1
-#endif
-
 int
 dwc_gmac_attach(struct dwc_gmac_softc *sc, int phy_id, uint32_t mii_clk)
 {
@@ -698,7 +694,7 @@
 static void
 dwc_gmac_txdesc_sync(struct dwc_gmac_softc *sc, int start, int end, int ops)
 {
-       /* 'end' is pointing one descriptor beyound the last we want to sync */
+       /* 'end' is pointing one descriptor beyond the last we want to sync */
        if (end > start) {
                bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map,
                    TX_DESC_OFFSET(start),
diff -r 7da55a1fbf84 -r de2ccbf2e94d sys/dev/ic/dwc_gmac_var.h
--- a/sys/dev/ic/dwc_gmac_var.h Sat Jul 20 20:59:05 2019 +0000
+++ b/sys/dev/ic/dwc_gmac_var.h Sun Jul 21 08:24:32 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac_var.h,v 1.14 2019/07/08 03:22:38 msaitoh Exp $ */
+/* $NetBSD: dwc_gmac_var.h,v 1.15 2019/07/21 08:24:32 mrg Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -29,6 +29,20 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef _KERNEL_OPT
+#include "opt_net_mpsafe.h"
+#endif
+
+/* Use DWCGMAC_MPSAFE inside the front-ends for interrupt handlers.  */
+#ifdef NET_MPSAFE
+#define DWCGMAC_MPSAFE 1
+#endif
+
+#ifdef DWCGMAC_MPSAFE
+#define DWCGMAC_FDT_INTR_MPSAFE FDT_INTR_MPSAFE
+#else
+#define DWCGMAC_FDT_INTR_MPSAFE 0
+#endif
 
 /*
  * We could use 1024 DMA descriptors to fill up an 8k page (each is 16 byte).



Home | Main Index | Thread Index | Old Index