CVS commit: src/sys/net
Module Name:src Committed By: ozaki-r Date: Mon Sep 25 04:15:33 UTC 2017 Modified Files: src/sys/net: route.c Log Message: Synchronize on rtcache_generation with rtlock It's racy if NET_MPSAFE is enabled. Pointed out by joerg@ To generate a diff of this commit: cvs rdiff -u -r1.200 -r1.201 src/sys/net/route.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/net/route.c diff -u src/sys/net/route.c:1.200 src/sys/net/route.c:1.201 --- src/sys/net/route.c:1.200 Fri Sep 22 05:05:32 2017 +++ src/sys/net/route.c Mon Sep 25 04:15:33 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: route.c,v 1.200 2017/09/22 05:05:32 ozaki-r Exp $ */ +/* $NetBSD: route.c,v 1.201 2017/09/25 04:15:33 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.200 2017/09/22 05:05:32 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.201 2017/09/25 04:15:33 ozaki-r Exp $"); #include #ifdef RTFLUSH_DEBUG @@ -484,6 +484,8 @@ static void rtcache_invalidate(void) { + RT_ASSERT_WLOCK(); + if (rtcache_debug()) printf("%s: enter\n", __func__); @@ -1199,10 +1201,10 @@ rtrequest1(int req, struct rt_addrinfo * rt_ref(rt); RT_REFCNT_TRACE(rt); } + rtcache_invalidate(); RT_UNLOCK(); need_unlock = false; rt_timer_remove_all(rt); - rtcache_invalidate(); #if defined(INET) || defined(INET6) if (netmask != NULL) lltable_prefix_free(dst->sa_family, dst, netmask, 0); @@ -1295,9 +1297,9 @@ rtrequest1(int req, struct rt_addrinfo * rt_ref(rt); RT_REFCNT_TRACE(rt); } + rtcache_invalidate(); RT_UNLOCK(); need_unlock = false; - rtcache_invalidate(); break; case RTM_GET: if (netmask != NULL) { @@ -1898,8 +1900,10 @@ rtcache_copy(struct route *new_ro, struc if (ret != 0) goto out; + RT_RLOCK(); new_ro->_ro_rt = rt; new_ro->ro_rtcache_generation = rtcache_generation; + RT_UNLOCK(); rtcache_invariants(new_ro); out: rtcache_unref(rt, old_ro); @@ -1957,16 +1961,17 @@ rtcache_validate(struct route *ro) retry: #endif rtcache_invariants(ro); + RT_RLOCK(); if (ro->ro_rtcache_generation != rtcache_generation) { /* The cache is invalidated */ - return NULL; + rt = NULL; + goto out; } rt = ro->_ro_rt; if (rt == NULL) - return NULL; + goto out; - RT_RLOCK(); if ((rt->rt_flags & RTF_UP) == 0) { rt = NULL; goto out;
CVS commit: src/sys/net
Module Name:src Committed By: ozaki-r Date: Mon Sep 25 01:57:54 UTC 2017 Modified Files: src/sys/net: raw_usrreq.c rtsock.c Log Message: Use a dedicated mutex for rt_rawcb instead of softnet_lock if NET_MPSAFE To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/net/raw_usrreq.c cvs rdiff -u -r1.228 -r1.229 src/sys/net/rtsock.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/net/raw_usrreq.c diff -u src/sys/net/raw_usrreq.c:1.57 src/sys/net/raw_usrreq.c:1.58 --- src/sys/net/raw_usrreq.c:1.57 Mon Sep 25 01:56:22 2017 +++ src/sys/net/raw_usrreq.c Mon Sep 25 01:57:54 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: raw_usrreq.c,v 1.57 2017/09/25 01:56:22 ozaki-r Exp $ */ +/* $NetBSD: raw_usrreq.c,v 1.58 2017/09/25 01:57:54 ozaki-r Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.57 2017/09/25 01:56:22 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.58 2017/09/25 01:57:54 ozaki-r Exp $"); #include #include @@ -75,8 +75,6 @@ raw_input(struct mbuf *m0, ...) struct sockaddr *src, *dst; struct rawcbhead *rawcbhead; - KASSERT(mutex_owned(softnet_lock)); - va_start(ap, m0); proto = va_arg(ap, struct sockproto *); src = va_arg(ap, struct sockaddr *); Index: src/sys/net/rtsock.c diff -u src/sys/net/rtsock.c:1.228 src/sys/net/rtsock.c:1.229 --- src/sys/net/rtsock.c:1.228 Mon Sep 25 01:56:22 2017 +++ src/sys/net/rtsock.c Mon Sep 25 01:57:54 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rtsock.c,v 1.228 2017/09/25 01:56:22 ozaki-r Exp $ */ +/* $NetBSD: rtsock.c,v 1.229 2017/09/25 01:57:54 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.228 2017/09/25 01:56:22 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.229 2017/09/25 01:57:54 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -184,6 +184,11 @@ struct routecb { }; #define sotoroutecb(so) ((struct routecb *)(so)->so_pcb) +static struct rawcbhead rt_rawcb; +#ifdef NET_MPSAFE +static kmutex_t *rt_so_mtx; +#endif + static void rt_adjustcount(int af, int cnt) { @@ -260,6 +265,14 @@ COMPATNAME(route_attach)(struct socket * so->so_pcb = rp; s = splsoftnet(); + +#ifdef NET_MPSAFE + KASSERT(so->so_lock == NULL); + mutex_obj_hold(rt_so_mtx); + so->so_lock = rt_so_mtx; + solock(so); +#endif + if ((error = raw_attach(so, proto, _rawcb)) == 0) { rt_adjustcount(rp->rcb_proto.sp_protocol, 1); rp->rcb_laddr = (route_info).ri_src; @@ -2025,8 +2038,10 @@ COMPATNAME(route_intr)(void *cookie) struct route_info * const ri = (route_info); struct mbuf *m; +#ifndef NET_MPSAFE mutex_enter(softnet_lock); KERNEL_LOCK(1, NULL); +#endif for (;;) { IFQ_LOCK(>ri_intrq); IF_DEQUEUE(>ri_intrq, m); @@ -2034,10 +2049,18 @@ COMPATNAME(route_intr)(void *cookie) if (m == NULL) break; proto.sp_protocol = M_GETCTX(m, uintptr_t); +#ifdef NET_MPSAFE + mutex_enter(rt_so_mtx); +#endif raw_input(m, , >ri_src, >ri_dst, _rawcb); +#ifdef NET_MPSAFE + mutex_exit(rt_so_mtx); +#endif } +#ifndef NET_MPSAFE KERNEL_UNLOCK_ONE(NULL); mutex_exit(softnet_lock); +#endif } /* @@ -2075,6 +2098,9 @@ COMPATNAME(route_init)(void) #ifndef COMPAT_RTSOCK rt_init(); #endif +#ifdef NET_MPSAFE + rt_so_mtx = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE); +#endif sysctl_net_route_setup(NULL); ri->ri_intrq.ifq_maxlen = ri->ri_maxqlen;
CVS commit: src/sys
Module Name:src Committed By: ozaki-r Date: Mon Sep 25 01:56:22 UTC 2017 Modified Files: src/sys/net: raw_cb.c raw_cb.h raw_usrreq.c rtsock.c src/sys/netipsec: keysock.c Log Message: Fix race condition on the rawcb list shared by rtsock and keysock keysock now protects itself by its own mutex, which means that the rawcb list is protected by two different mutexes (keysock's one and softnet_lock for rtsock), of course it's useless. Fix the situation by having a discrete rawcb list for each. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/net/raw_cb.c cvs rdiff -u -r1.27 -r1.28 src/sys/net/raw_cb.h cvs rdiff -u -r1.56 -r1.57 src/sys/net/raw_usrreq.c cvs rdiff -u -r1.227 -r1.228 src/sys/net/rtsock.c cvs rdiff -u -r1.60 -r1.61 src/sys/netipsec/keysock.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/net/raw_cb.c diff -u src/sys/net/raw_cb.c:1.23 src/sys/net/raw_cb.c:1.24 --- src/sys/net/raw_cb.c:1.23 Thu Jul 27 09:53:57 2017 +++ src/sys/net/raw_cb.c Mon Sep 25 01:56:22 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: raw_cb.c,v 1.23 2017/07/27 09:53:57 ozaki-r Exp $ */ +/* $NetBSD: raw_cb.c,v 1.24 2017/09/25 01:56:22 ozaki-r Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: raw_cb.c,v 1.23 2017/07/27 09:53:57 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: raw_cb.c,v 1.24 2017/09/25 01:56:22 ozaki-r Exp $"); #include #include @@ -57,8 +57,6 @@ __KERNEL_RCSID(0, "$NetBSD: raw_cb.c,v 1 * redo address binding to allow wildcards */ -struct rawcbhead rawcb = LIST_HEAD_INITIALIZER(rawcb); - static u_long raw_sendspace = RAWSNDQ; static u_long raw_recvspace = RAWRCVQ; @@ -66,7 +64,7 @@ static u_long raw_recvspace = RAWRCVQ; * Allocate a nominal amount of buffer space for the socket. */ int -raw_attach(struct socket *so, int proto) +raw_attach(struct socket *so, int proto, struct rawcbhead *rawcbhead) { struct rawcb *rp; int error; @@ -87,7 +85,7 @@ raw_attach(struct socket *so, int proto) rp->rcb_socket = so; rp->rcb_proto.sp_family = so->so_proto->pr_domain->dom_family; rp->rcb_proto.sp_protocol = proto; - LIST_INSERT_HEAD(, rp, rcb_list); + LIST_INSERT_HEAD(rawcbhead, rp, rcb_list); KASSERT(solocked(so)); return 0; Index: src/sys/net/raw_cb.h diff -u src/sys/net/raw_cb.h:1.27 src/sys/net/raw_cb.h:1.28 --- src/sys/net/raw_cb.h:1.27 Tue Apr 11 13:55:54 2017 +++ src/sys/net/raw_cb.h Mon Sep 25 01:56:22 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: raw_cb.h,v 1.27 2017/04/11 13:55:54 roy Exp $ */ +/* $NetBSD: raw_cb.h,v 1.28 2017/09/25 01:56:22 ozaki-r Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -60,13 +60,11 @@ struct rawcb { #define RAWRCVQ 8192 LIST_HEAD(rawcbhead, rawcb); -extern struct rawcbhead rawcb; /* head of list */ -int raw_attach(struct socket *, int); +int raw_attach(struct socket *, int, struct rawcbhead *); void *raw_ctlinput(int, const struct sockaddr *, void *); void raw_detach(struct socket *); void raw_disconnect(struct rawcb *); -void raw_init(void); void raw_input(struct mbuf *, ...); int raw_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *); Index: src/sys/net/raw_usrreq.c diff -u src/sys/net/raw_usrreq.c:1.56 src/sys/net/raw_usrreq.c:1.57 --- src/sys/net/raw_usrreq.c:1.56 Tue Apr 11 13:55:54 2017 +++ src/sys/net/raw_usrreq.c Mon Sep 25 01:56:22 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: raw_usrreq.c,v 1.56 2017/04/11 13:55:54 roy Exp $ */ +/* $NetBSD: raw_usrreq.c,v 1.57 2017/09/25 01:56:22 ozaki-r Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.56 2017/04/11 13:55:54 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.57 2017/09/25 01:56:22 ozaki-r Exp $"); #include #include @@ -54,12 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c #include #include -void -raw_init(void) -{ - LIST_INIT(); -} - static inline int equal(const struct sockaddr *a1, const struct sockaddr *a2) { @@ -79,6 +73,7 @@ raw_input(struct mbuf *m0, ...) va_list ap; struct sockproto *proto; struct sockaddr *src, *dst; + struct rawcbhead *rawcbhead; KASSERT(mutex_owned(softnet_lock)); @@ -86,10 +81,11 @@ raw_input(struct mbuf *m0, ...) proto = va_arg(ap, struct sockproto *); src = va_arg(ap, struct sockaddr *); dst = va_arg(ap, struct sockaddr *); + rawcbhead = va_arg(ap, struct rawcbhead *); va_end(ap); last = NULL; - LIST_FOREACH(rp, , rcb_list) { + LIST_FOREACH(rp, rawcbhead, rcb_list) { if (rp->rcb_proto.sp_family != proto->sp_family) continue; if (rp->rcb_proto.sp_protocol && Index: src/sys/net/rtsock.c diff -u src/sys/net/rtsock.c:1.227 src/sys/net/rtsock.c:1.228 --- src/sys/net/rtsock.c:1.227 Sat Jul 1 16:59:12 2017 +++ src/sys/net/rtsock.c Mon Sep 25 01:56:22 2017 @@ -1,4 +1,4 @@ -/*
CVS commit: src/sys/arch/arm/nvidia
Module Name:src Committed By: jmcneill Date: Mon Sep 25 00:12:21 UTC 2017 Modified Files: src/sys/arch/arm/nvidia: tegra210_car.c Log Message: Disable debug again To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/nvidia/tegra210_car.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/arch/arm/nvidia/tegra210_car.c diff -u src/sys/arch/arm/nvidia/tegra210_car.c:1.11 src/sys/arch/arm/nvidia/tegra210_car.c:1.12 --- src/sys/arch/arm/nvidia/tegra210_car.c:1.11 Mon Sep 25 00:03:34 2017 +++ src/sys/arch/arm/nvidia/tegra210_car.c Mon Sep 25 00:12:21 2017 @@ -1,5 +1,4 @@ -/* $NetBSD: tegra210_car.c,v 1.11 2017/09/25 00:03:34 jmcneill Exp $ */ -#define TEGRA210_CAR_DEBUG +/* $NetBSD: tegra210_car.c,v 1.12 2017/09/25 00:12:21 jmcneill Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill@@ -28,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.11 2017/09/25 00:03:34 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.12 2017/09/25 00:12:21 jmcneill Exp $"); #include #include
CVS commit: src/sys/arch/arm/nvidia
Module Name:src Committed By: jmcneill Date: Mon Sep 25 00:03:34 UTC 2017 Modified Files: src/sys/arch/arm/nvidia: tegra210_car.c tegra210_xusbpad.c tegra_xusb.c Log Message: USB works on Tegra X1 now. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/nvidia/tegra210_car.c \ src/sys/arch/arm/nvidia/tegra_xusb.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/nvidia/tegra210_xusbpad.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/arch/arm/nvidia/tegra210_car.c diff -u src/sys/arch/arm/nvidia/tegra210_car.c:1.10 src/sys/arch/arm/nvidia/tegra210_car.c:1.11 --- src/sys/arch/arm/nvidia/tegra210_car.c:1.10 Sun Sep 24 20:09:53 2017 +++ src/sys/arch/arm/nvidia/tegra210_car.c Mon Sep 25 00:03:34 2017 @@ -1,4 +1,5 @@ -/* $NetBSD: tegra210_car.c,v 1.10 2017/09/24 20:09:53 jmcneill Exp $ */ +/* $NetBSD: tegra210_car.c,v 1.11 2017/09/25 00:03:34 jmcneill Exp $ */ +#define TEGRA210_CAR_DEBUG /*- * Copyright (c) 2015-2017 Jared McNeill@@ -27,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.10 2017/09/24 20:09:53 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.11 2017/09/25 00:03:34 jmcneill Exp $"); #include #include @@ -538,6 +539,15 @@ static struct tegra_clk tegra210_car_clo CAR_CLKSRC_XUSB_FALCON_REG, CAR_CLKSRC_XUSB_FALCON_DIV), CLK_DIV("USB2_HSIC_TRK", "CLK_M", CAR_CLKSRC_USB2_HSIC_TRK_REG, CAR_CLKSRC_USB2_HSIC_TRK_DIV), + CLK_DIV("DIV_PLL_U_OUT1", "PLL_U", + CAR_PLLU_OUTA_REG, CAR_PLLU_OUTA_OUT1_RATIO), + CLK_DIV("DIV_PLL_U_OUT2", "PLL_U", + CAR_PLLU_OUTA_REG, CAR_PLLU_OUTA_OUT2_RATIO), + + CLK_GATE("PLL_U_OUT1", "DIV_PLL_U_OUT1", + CAR_PLLU_OUTA_REG, CAR_PLLU_OUTA_REG, CAR_PLLU_OUTA_OUT1_CLKEN), + CLK_GATE("PLL_U_OUT2", "DIV_PLL_U_OUT2", + CAR_PLLU_OUTA_REG, CAR_PLLU_OUTA_REG, CAR_PLLU_OUTA_OUT2_CLKEN), CLK_GATE_L("UARTA", "DIV_UARTA", CAR_DEV_L_UARTA), CLK_GATE_L("UARTB", "DIV_UARTB", CAR_DEV_L_UARTB), @@ -553,10 +563,11 @@ static struct tegra_clk tegra210_car_clo CLK_GATE_V("I2C4", "DIV_I2C4", CAR_DEV_V_I2C4), CLK_GATE_H("I2C5", "DIV_I2C5", CAR_DEV_H_I2C5), CLK_GATE_X("I2C6", "DIV_I2C6", CAR_DEV_X_I2C6), + CLK_GATE_W("XUSB_GATE", "CLK_M", CAR_DEV_W_XUSB), CLK_GATE_U("XUSB_HOST", "XUSB_HOST_SRC", CAR_DEV_U_XUSB_HOST), CLK_GATE_W("XUSB_SS", "XUSB_SS_SRC", CAR_DEV_W_XUSB_SS), CLK_GATE_H("FUSE", "CLK_M", CAR_DEV_H_FUSE), - CLK_GATE_Y("USB2_TRK", "UBS2_HSIC_TRK", CAR_DEV_Y_USB2_TRK), + CLK_GATE_Y("USB2_TRK", "USB2_HSIC_TRK", CAR_DEV_Y_USB2_TRK), CLK_GATE_Y("HSIC_TRK", "USB2_HSIC_TRK", CAR_DEV_Y_HSIC_TRK), CLK_GATE_H("APBDMA", "CLK_M", CAR_DEV_H_APBDMA), CLK_GATE_L("USBD", "PLL_U_480M", CAR_DEV_L_USBD), @@ -566,15 +577,20 @@ static struct tegra_clk tegra210_car_clo struct tegra210_init_parent { const char *clock; const char *parent; + u_int rate; + u_int enable; } tegra210_init_parents[] = { - { "SDMMC1", "PLL_P" }, - { "SDMMC2", "PLL_P" }, - { "SDMMC3", "PLL_P" }, - { "SDMMC4", "PLL_P" }, - { "XUSB_HOST_SRC", "PLL_P" }, - { "XUSB_FALCON_SRC", "PLL_P" }, - { "XUSB_SS_SRC", "PLL_U_480M" }, - { "XUSB_FS_SRC", "PLL_U_48M" }, + { "SDMMC1", "PLL_P", 0, 0 }, + { "SDMMC2", "PLL_P", 0, 0 }, + { "SDMMC3", "PLL_P", 0, 0 }, + { "SDMMC4", "PLL_P", 0, 0 }, + { "XUSB_GATE", NULL, 0, 1 }, + { "XUSB_HOST_SRC", "PLL_P", 10200, 0 }, + { "XUSB_FALCON_SRC", "PLL_P", 20400, 0 }, + { "XUSB_SS_SRC", "PLL_U_480M", 12000, 0 }, + { "XUSB_FS_SRC", "PLL_U_48M", 4800, 0 }, + { "PLL_U_OUT1", NULL, 4800, 1 }, + { "PLL_U_OUT2", NULL, 6000, 1 }, }; struct tegra210_car_rst { @@ -719,18 +735,38 @@ tegra210_car_parent_init(struct tegra210 for (n = 0; n < __arraycount(tegra210_init_parents); n++) { clk = clk_get(>sc_clkdom, tegra210_init_parents[n].clock); - KASSERT(clk != NULL); - clk_parent = clk_get(>sc_clkdom, - tegra210_init_parents[n].parent); - KASSERT(clk_parent != NULL); - - error = clk_set_parent(clk, clk_parent); - if (error) { - aprint_error_dev(sc->sc_dev, - "couldn't set '%s' parent to '%s': %d\n", - clk->name, clk_parent->name, error); + KASSERTMSG(clk != NULL, "tegra210 clock %s not found", tegra210_init_parents[n].clock); + + if (tegra210_init_parents[n].parent != NULL) { + clk_parent = clk_get(>sc_clkdom, + tegra210_init_parents[n].parent); + KASSERT(clk_parent != NULL); + + error = clk_set_parent(clk, clk_parent); + if (error) { +aprint_error_dev(sc->sc_dev, +"couldn't set '%s' parent to '%s': %d\n", +clk->name, clk_parent->name, error); + } + clk_put(clk_parent); + } + if (tegra210_init_parents[n].rate != 0) { + error = clk_set_rate(clk, tegra210_init_parents[n].rate); + if (error) { +aprint_error_dev(sc->sc_dev, +"couldn't set '%s' rate to %u Hz: %d\n", +clk->name, tegra210_init_parents[n].rate, +error); + } +
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jmcneill Date: Mon Sep 25 00:03:11 UTC 2017 Modified Files: src/sys/dev/usb: xhci.c xhcivar.h Log Message: If the bus glue calls xhci_init with interrupts enabled, there is a window between when xhci interrupts are enabled and the usb bus driver is attached. If an irq occurs in this window, xhci will attempt to schedule a softint with an invalid softint handle. Add a quirk flag, XHCI_DEFERRED_START, that when set skips starting the controller at the end of xhci_init. Bus glue that sets this is responsible to call xhci_start after attaching the child usb devices. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/dev/usb/xhci.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/xhcivar.h 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/usb/xhci.c diff -u src/sys/dev/usb/xhci.c:1.73 src/sys/dev/usb/xhci.c:1.74 --- src/sys/dev/usb/xhci.c:1.73 Tue Aug 22 16:57:00 2017 +++ src/sys/dev/usb/xhci.c Mon Sep 25 00:03:10 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: xhci.c,v 1.73 2017/08/22 16:57:00 skrll Exp $ */ +/* $NetBSD: xhci.c,v 1.74 2017/09/25 00:03:10 jmcneill Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.73 2017/08/22 16:57:00 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.74 2017/09/25 00:03:10 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -891,6 +891,23 @@ xhci_ecp(struct xhci_softc *sc, uint32_t "b\0AC64\0" \ "\0" +void +xhci_start(struct xhci_softc *sc) +{ + xhci_rt_write_4(sc, XHCI_IMAN(0), XHCI_IMAN_INTR_ENA); + if ((sc->sc_quirks & XHCI_QUIRK_INTEL) != 0) + /* Intel xhci needs interrupt rate moderated. */ + xhci_rt_write_4(sc, XHCI_IMOD(0), XHCI_IMOD_DEFAULT_LP); + else + xhci_rt_write_4(sc, XHCI_IMOD(0), 0); + aprint_debug_dev(sc->sc_dev, "current IMOD %u\n", + xhci_rt_read_4(sc, XHCI_IMOD(0))); + + xhci_op_write_4(sc, XHCI_USBCMD, XHCI_CMD_INTE|XHCI_CMD_RS); /* Go! */ + aprint_debug_dev(sc->sc_dev, "USBCMD %08"PRIx32"\n", + xhci_op_read_4(sc, XHCI_USBCMD)); +} + int xhci_init(struct xhci_softc *sc) { @@ -1168,18 +1185,8 @@ xhci_init(struct xhci_softc *sc) XHCI_ERSTE_SIZE * XHCI_EVENT_RING_SEGMENTS); #endif - xhci_rt_write_4(sc, XHCI_IMAN(0), XHCI_IMAN_INTR_ENA); - if ((sc->sc_quirks & XHCI_QUIRK_INTEL) != 0) - /* Intel xhci needs interrupt rate moderated. */ - xhci_rt_write_4(sc, XHCI_IMOD(0), XHCI_IMOD_DEFAULT_LP); - else - xhci_rt_write_4(sc, XHCI_IMOD(0), 0); - aprint_debug_dev(sc->sc_dev, "current IMOD %u\n", - xhci_rt_read_4(sc, XHCI_IMOD(0))); - - xhci_op_write_4(sc, XHCI_USBCMD, XHCI_CMD_INTE|XHCI_CMD_RS); /* Go! */ - aprint_debug_dev(sc->sc_dev, "USBCMD %08"PRIx32"\n", - xhci_op_read_4(sc, XHCI_USBCMD)); + if ((sc->sc_quirks & XHCI_DEFERRED_START) == 0) + xhci_start(sc); return 0; Index: src/sys/dev/usb/xhcivar.h diff -u src/sys/dev/usb/xhcivar.h:1.7 src/sys/dev/usb/xhcivar.h:1.8 --- src/sys/dev/usb/xhcivar.h:1.7 Thu Jan 19 16:05:00 2017 +++ src/sys/dev/usb/xhcivar.h Mon Sep 25 00:03:11 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: xhcivar.h,v 1.7 2017/01/19 16:05:00 skrll Exp $ */ +/* $NetBSD: xhcivar.h,v 1.8 2017/09/25 00:03:11 jmcneill Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -135,9 +135,11 @@ struct xhci_softc { int sc_quirks; #define XHCI_QUIRK_INTEL __BIT(0) /* Intel xhci chip */ +#define XHCI_DEFERRED_START __BIT(1) }; int xhci_init(struct xhci_softc *); +void xhci_start(struct xhci_softc *); int xhci_intr(void *); int xhci_detach(struct xhci_softc *, int); int xhci_activate(device_t, enum devact);
CVS commit: src/sys/dev
Module Name:src Committed By: nat Date: Sun Sep 24 23:40:41 UTC 2017 Modified Files: src/sys/dev: audio.c audiovar.h Log Message: Move play/rec mix ring buffers into a virtual channel sc_mixring. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.406 -r1.407 src/sys/dev/audio.c cvs rdiff -u -r1.64 -r1.65 src/sys/dev/audiovar.h 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/audio.c diff -u src/sys/dev/audio.c:1.406 src/sys/dev/audio.c:1.407 --- src/sys/dev/audio.c:1.406 Sat Sep 2 15:26:43 2017 +++ src/sys/dev/audio.c Sun Sep 24 23:40:41 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.406 2017/09/02 15:26:43 isaki Exp $ */ +/* $NetBSD: audio.c,v 1.407 2017/09/24 23:40:41 nat Exp $ */ /*- * Copyright (c) 2016 Nathanial Sloss@@ -148,7 +148,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.406 2017/09/02 15:26:43 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.407 2017/09/24 23:40:41 nat Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -930,8 +930,8 @@ audiodetach(device_t self, int flags) } audio_free_ring(sc, >sc_hwvc->sc_mpr); audio_free_ring(sc, >sc_hwvc->sc_mrr); - audio_free_ring(sc, >sc_pr); - audio_free_ring(sc, >sc_rr); + audio_free_ring(sc, >sc_mixring.sc_mpr); + audio_free_ring(sc, >sc_mixring.sc_mrr); SIMPLEQ_FOREACH(chan, >sc_audiochan, entries) { audio_destroy_pfilters(chan->vc); audio_destroy_rfilters(chan->vc); @@ -1114,13 +1114,13 @@ audio_allocbufs(struct audio_softc *sc) vc = sc->sc_hwvc; - sc->sc_pr.s.start = NULL; + sc->sc_mixring.sc_mpr.s.start = NULL; vc->sc_mpr.s.start = NULL; - sc->sc_rr.s.start = NULL; + sc->sc_mixring.sc_mrr.s.start = NULL; vc->sc_mrr.s.start = NULL; if (audio_can_playback(sc)) { - error = audio_alloc_ring(sc, >sc_pr, + error = audio_alloc_ring(sc, >sc_mixring.sc_mpr, AUMODE_PLAY, AU_RING_SIZE); if (error) goto bad_play1; @@ -1131,7 +1131,7 @@ audio_allocbufs(struct audio_softc *sc) goto bad_play2; } if (audio_can_capture(sc)) { - error = audio_alloc_ring(sc, >sc_rr, + error = audio_alloc_ring(sc, >sc_mixring.sc_mrr, AUMODE_RECORD, AU_RING_SIZE); if (error) goto bad_rec1; @@ -1144,14 +1144,14 @@ audio_allocbufs(struct audio_softc *sc) return 0; bad_rec2: - if (sc->sc_rr.s.start != NULL) - audio_free_ring(sc, >sc_rr); + if (sc->sc_mixring.sc_mrr.s.start != NULL) + audio_free_ring(sc, >sc_mixring.sc_mrr); bad_rec1: if (vc->sc_mpr.s.start != NULL) audio_free_ring(sc, >sc_mpr); bad_play2: - if (sc->sc_pr.s.start != NULL) - audio_free_ring(sc, >sc_pr); + if (sc->sc_mixring.sc_mpr.s.start != NULL) + audio_free_ring(sc, >sc_mixring.sc_mpr); bad_play1: return error; } @@ -2166,9 +2166,11 @@ audio_open(dev_t dev, struct audio_softc } audio_initbufs(sc, NULL); if (audio_can_playback(sc)) - audio_init_ringbuffer(sc, >sc_pr, AUMODE_PLAY); + audio_init_ringbuffer(sc, >sc_mixring.sc_mpr, + AUMODE_PLAY); if (audio_can_capture(sc)) - audio_init_ringbuffer(sc, >sc_rr, AUMODE_RECORD); + audio_init_ringbuffer(sc, >sc_mixring.sc_mrr, + AUMODE_RECORD); sc->schedule_wih = false; sc->schedule_rih = false; sc->sc_last_drops = 0; @@ -2202,8 +2204,8 @@ audio_open(dev_t dev, struct audio_softc mode |= AUMODE_PLAY | AUMODE_PLAY_ALL; } - vc->sc_mpr.blksize = sc->sc_pr.blksize; - vc->sc_mrr.blksize = sc->sc_rr.blksize; + vc->sc_mpr.blksize = sc->sc_mixring.sc_mpr.blksize; + vc->sc_mrr.blksize = sc->sc_mixring.sc_mrr.blksize; /* * Multiplex device: /dev/audio (MU-Law) and /dev/sound (linear) @@ -2328,7 +2330,7 @@ audio_drain(struct audio_softc *sc, stru used = audio_stream_get_used(>s); if (vc == sc->sc_hwvc) { hw = true; - used += audio_stream_get_used(>sc_pr.s); + used += audio_stream_get_used(>sc_mixring.sc_mpr.s); } for (i = 0; i < vc->sc_npfilters; i++) used += audio_stream_get_used(>sc_pstreams[i]); @@ -2350,15 +2352,18 @@ audio_drain(struct audio_softc *sc, stru if (error) return error; } else if (hw == true) { - used = cb->blksize - (sc->sc_pr.s.inp - sc->sc_pr.s.start) - % cb->blksize; + used = cb->blksize - (sc->sc_mixring.sc_mpr.s.inp - + sc->sc_mixring.sc_mpr.s.start) % cb->blksize; while (used > 0) { - cc = sc->sc_pr.s.end - sc->sc_pr.s.inp; + cc = sc->sc_mixring.sc_mpr.s.end - + sc->sc_mixring.sc_mpr.s.inp; if (cc > used) cc = used; - audio_fill_silence(>s.param, sc->sc_pr.s.inp, cc); - sc->sc_pr.s.inp = audio_stream_add_inp(>sc_pr.s, - sc->sc_pr.s.inp, cc); + audio_fill_silence(>s.param, + sc->sc_mixring.sc_mpr.s.inp, cc); + sc->sc_mixring.sc_mpr.s.inp = + audio_stream_add_inp(>sc_mixring.sc_mpr.s, +sc->sc_mixring.sc_mpr.s.inp, cc); used -= cc; } mix_write(sc); @@ -3389,7 +3394,7 @@ audio_mmap(struct audio_softc *sc, off_t (void)audiostartp(sc,
CVS commit: [netbsd-7-1] src/doc
Module Name:src Committed By: snj Date: Sun Sep 24 20:14:07 UTC 2017 Modified Files: src/doc [netbsd-7-1]: CHANGES-7.1.1 Log Message: 1500 To generate a diff of this commit: cvs rdiff -u -r1.1.2.32 -r1.1.2.33 src/doc/CHANGES-7.1.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-7.1.1 diff -u src/doc/CHANGES-7.1.1:1.1.2.32 src/doc/CHANGES-7.1.1:1.1.2.33 --- src/doc/CHANGES-7.1.1:1.1.2.32 Mon Sep 11 04:56:02 2017 +++ src/doc/CHANGES-7.1.1 Sun Sep 24 20:14:07 2017 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-7.1.1,v 1.1.2.32 2017/09/11 04:56:02 snj Exp $ +# $NetBSD: CHANGES-7.1.1,v 1.1.2.33 2017/09/24 20:14:07 snj Exp $ A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.1.1 release: @@ -3665,3 +3665,11 @@ crypto/external/bsd/heimdal/include/roke getpw*() internal buffers. [mlelstv, ticket #1509] +sys/arch/evbmips/conf/MALTA 1.88 +sys/arch/evbmips/conf/MALTA32 1.4 +sys/arch/evbmips/conf/MALTA64 1.8 +sys/arch/mips/mips/bds_emul.S 1.9 + + Make Malta work on real hardware again. + [mrg, ticket #1500] +
CVS commit: [netbsd-7-0] src/doc
Module Name:src Committed By: snj Date: Sun Sep 24 20:13:59 UTC 2017 Modified Files: src/doc [netbsd-7-0]: CHANGES-7.0.3 Log Message: 1500 To generate a diff of this commit: cvs rdiff -u -r1.1.2.64 -r1.1.2.65 src/doc/CHANGES-7.0.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-7.0.3 diff -u src/doc/CHANGES-7.0.3:1.1.2.64 src/doc/CHANGES-7.0.3:1.1.2.65 --- src/doc/CHANGES-7.0.3:1.1.2.64 Mon Sep 11 04:56:12 2017 +++ src/doc/CHANGES-7.0.3 Sun Sep 24 20:13:59 2017 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-7.0.3,v 1.1.2.64 2017/09/11 04:56:12 snj Exp $ +# $NetBSD: CHANGES-7.0.3,v 1.1.2.65 2017/09/24 20:13:59 snj Exp $ A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3 release: @@ -4967,3 +4967,11 @@ crypto/external/bsd/heimdal/include/roke getpw*() internal buffers. [mlelstv, ticket #1509] +sys/arch/evbmips/conf/MALTA 1.88 +sys/arch/evbmips/conf/MALTA32 1.4 +sys/arch/evbmips/conf/MALTA64 1.8 +sys/arch/mips/mips/bds_emul.S 1.9 + + Make Malta work on real hardware again. + [mrg, ticket #1500] +
CVS commit: [netbsd-7] src/doc
Module Name:src Committed By: snj Date: Sun Sep 24 20:13:48 UTC 2017 Modified Files: src/doc [netbsd-7]: CHANGES-7.2 Log Message: 1409, 1500 To generate a diff of this commit: cvs rdiff -u -r1.1.2.47 -r1.1.2.48 src/doc/CHANGES-7.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-7.2 diff -u src/doc/CHANGES-7.2:1.1.2.47 src/doc/CHANGES-7.2:1.1.2.48 --- src/doc/CHANGES-7.2:1.1.2.47 Mon Sep 11 05:59:06 2017 +++ src/doc/CHANGES-7.2 Sun Sep 24 20:13:48 2017 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-7.2,v 1.1.2.47 2017/09/11 05:59:06 snj Exp $ +# $NetBSD: CHANGES-7.2,v 1.1.2.48 2017/09/24 20:13:48 snj Exp $ A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2 release: @@ -4670,3 +4670,23 @@ sys/arch/x86/x86/procfs_machdep.c 1.15- character. Fixes PR#52352. [msaitoh, ticket #1505] +sys/arch/xen/xen/if_xennet_xenbus.c 1.65 +sys/arch/xen/xen/xennetback_xenbus.c 1.53, 1.56 via patch +sys/net/if_bridge.c1.105 +sys/net/if_ether.h1.65 +sys/net/if_ethersubr.c1.215, 1.235 +sys/net/if_vlan.c1.76, 1.77, 1.83, 1.88, 1.94 + + Add handling of VLAN packets in if_bridge where the parent + interface supports them Factor out the vlan_mtu enabling + and disabling code. + [manu, ticket #1409] + +sys/arch/evbmips/conf/MALTA 1.88 +sys/arch/evbmips/conf/MALTA32 1.4 +sys/arch/evbmips/conf/MALTA64 1.8 +sys/arch/mips/mips/bds_emul.S 1.9 + + Make Malta work on real hardware again. + [mrg, ticket #1500] +
CVS commit: [netbsd-7] src/sys/arch
Module Name:src Committed By: snj Date: Sun Sep 24 20:12:57 UTC 2017 Modified Files: src/sys/arch/evbmips/conf [netbsd-7]: MALTA MALTA32 MALTA64 src/sys/arch/mips/mips [netbsd-7]: bds_emul.S Log Message: Pull up following revision(s) (requested by mrg in ticket #1500): sys/arch/evbmips/conf/MALTA64: revision 1.8 sys/arch/evbmips/conf/MALTA32: revision 1.4 sys/arch/mips/mips/bds_emul.S: revision 1.9 sys/arch/evbmips/conf/MALTA: revision 1.88 Re-enable the NOFPU and (renamed) FPEMUL options. None of the Malta CPU daughter cards currently supported by NetBSD have an FPU. Detected on real hardware. gxemul wrongly supports an FPU on the 4Kc and 5Kc CPUs. -- Remove the NOFPU option. The main MALTA config file has this now. -- mips_emul_daddi and mips_emul_daddiu don't exist, but there are bcemul_daddi and bcemul_daddiu here that should be used. however, bcemul_daddi needed to be changed to use dadd not daddui. fixes FPEMUL and N64 kernels. ok simonb. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.78.2.1 src/sys/arch/evbmips/conf/MALTA cvs rdiff -u -r1.3 -r1.3.22.1 src/sys/arch/evbmips/conf/MALTA32 cvs rdiff -u -r1.6 -r1.6.12.1 src/sys/arch/evbmips/conf/MALTA64 cvs rdiff -u -r1.6 -r1.6.22.1 src/sys/arch/mips/mips/bds_emul.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbmips/conf/MALTA diff -u src/sys/arch/evbmips/conf/MALTA:1.78 src/sys/arch/evbmips/conf/MALTA:1.78.2.1 --- src/sys/arch/evbmips/conf/MALTA:1.78 Sun Jul 20 10:06:11 2014 +++ src/sys/arch/evbmips/conf/MALTA Sun Sep 24 20:12:57 2017 @@ -1,17 +1,18 @@ -# $NetBSD: MALTA,v 1.78 2014/07/20 10:06:11 alnsn Exp $ +# $NetBSD: MALTA,v 1.78.2.1 2017/09/24 20:12:57 snj Exp $ include "arch/evbmips/conf/std.malta" #options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "MALTA-$Revision: 1.78 $" +#ident "MALTA-$Revision: 1.78.2.1 $" maxusers 32 options MIPS32 options MIPS64 -#options NOFPU # No FPU -#options FPEMUL # emulate FPU insn + +options NOFPU # No FPU +options FPEMUL # emulate FPU insn # Options for necessary to use MD # options MEMORY_DISK_HOOKS Index: src/sys/arch/evbmips/conf/MALTA32 diff -u src/sys/arch/evbmips/conf/MALTA32:1.3 src/sys/arch/evbmips/conf/MALTA32:1.3.22.1 --- src/sys/arch/evbmips/conf/MALTA32:1.3 Thu Feb 9 18:58:44 2012 +++ src/sys/arch/evbmips/conf/MALTA32 Sun Sep 24 20:12:57 2017 @@ -1,11 +1,10 @@ -# $NetBSD: MALTA32,v 1.3 2012/02/09 18:58:44 matt Exp $ +# $NetBSD: MALTA32,v 1.3.22.1 2017/09/24 20:12:57 snj Exp $ # include "arch/evbmips/conf/MALTA" makeoptions LP64="no" no options MIPS32 -options NOFPU # No FPU #options EXEC_ELF64 no ath* Index: src/sys/arch/evbmips/conf/MALTA64 diff -u src/sys/arch/evbmips/conf/MALTA64:1.6 src/sys/arch/evbmips/conf/MALTA64:1.6.12.1 --- src/sys/arch/evbmips/conf/MALTA64:1.6 Sat Oct 13 06:08:11 2012 +++ src/sys/arch/evbmips/conf/MALTA64 Sun Sep 24 20:12:57 2017 @@ -1,11 +1,10 @@ -# $NetBSD: MALTA64,v 1.6 2012/10/13 06:08:11 riz Exp $ +# $NetBSD: MALTA64,v 1.6.12.1 2017/09/24 20:12:57 snj Exp $ # include "arch/evbmips/conf/MALTA" makeoptions LP64="yes" no options MIPS32 -options NOFPU # No FPU options EXEC_ELF64 options COMPAT_NETBSD32 no options SYMTAB_SPACE Index: src/sys/arch/mips/mips/bds_emul.S diff -u src/sys/arch/mips/mips/bds_emul.S:1.6 src/sys/arch/mips/mips/bds_emul.S:1.6.22.1 --- src/sys/arch/mips/mips/bds_emul.S:1.6 Sun Dec 25 11:51:15 2011 +++ src/sys/arch/mips/mips/bds_emul.S Sun Sep 24 20:12:57 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: bds_emul.S,v 1.6 2011/12/25 11:51:15 kiyohara Exp $ */ +/* $NetBSD: bds_emul.S,v 1.6.22.1 2017/09/24 20:12:57 snj Exp $ */ /* * Copyright (c) 1992, 1993 @@ -101,8 +101,8 @@ bcemul_optbl: PTR_WORD bcemul_sigill # 030 LDL (*) PTR_WORD bcemul_sigill # 031 LDR (*) #else - PTR_WORD _C_LABEL(mips_emul_daddi) # 030 DADDI (*) - PTR_WORD _C_LABEL(mips_emul_daddiu) # 031 DADDIU (*) + PTR_WORD bcemul_daddi # 030 DADDI (*) + PTR_WORD bcemul_daddiu # 031 DADDIU (*) PTR_WORD _C_LABEL(mips_emul_ldl) # 032 LDL (*) PTR_WORD _C_LABEL(mips_emul_ldr) # 033 LDR (*) #endif @@ -191,7 +191,7 @@ bcemul_uimmed_prologue: #ifndef __mips_o32 bcemul_daddi: bal bcemul_immed_prologue - daddiu t0, v0, v1 + dadd t0, v0, v1 b bcemul_check_add_overflow #endif
CVS commit: [netbsd-7-1] src/sys/arch
Module Name:src Committed By: snj Date: Sun Sep 24 20:12:55 UTC 2017 Modified Files: src/sys/arch/evbmips/conf [netbsd-7-1]: MALTA MALTA32 MALTA64 src/sys/arch/mips/mips [netbsd-7-1]: bds_emul.S Log Message: Pull up following revision(s) (requested by mrg in ticket #1500): sys/arch/evbmips/conf/MALTA64: revision 1.8 sys/arch/evbmips/conf/MALTA32: revision 1.4 sys/arch/mips/mips/bds_emul.S: revision 1.9 sys/arch/evbmips/conf/MALTA: revision 1.88 Re-enable the NOFPU and (renamed) FPEMUL options. None of the Malta CPU daughter cards currently supported by NetBSD have an FPU. Detected on real hardware. gxemul wrongly supports an FPU on the 4Kc and 5Kc CPUs. -- Remove the NOFPU option. The main MALTA config file has this now. -- mips_emul_daddi and mips_emul_daddiu don't exist, but there are bcemul_daddi and bcemul_daddiu here that should be used. however, bcemul_daddi needed to be changed to use dadd not daddui. fixes FPEMUL and N64 kernels. ok simonb. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.78.8.1 src/sys/arch/evbmips/conf/MALTA cvs rdiff -u -r1.3 -r1.3.34.1 src/sys/arch/evbmips/conf/MALTA32 cvs rdiff -u -r1.6 -r1.6.18.1 src/sys/arch/evbmips/conf/MALTA64 cvs rdiff -u -r1.6 -r1.6.30.1 src/sys/arch/mips/mips/bds_emul.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbmips/conf/MALTA diff -u src/sys/arch/evbmips/conf/MALTA:1.78 src/sys/arch/evbmips/conf/MALTA:1.78.8.1 --- src/sys/arch/evbmips/conf/MALTA:1.78 Sun Jul 20 10:06:11 2014 +++ src/sys/arch/evbmips/conf/MALTA Sun Sep 24 20:12:55 2017 @@ -1,17 +1,18 @@ -# $NetBSD: MALTA,v 1.78 2014/07/20 10:06:11 alnsn Exp $ +# $NetBSD: MALTA,v 1.78.8.1 2017/09/24 20:12:55 snj Exp $ include "arch/evbmips/conf/std.malta" #options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "MALTA-$Revision: 1.78 $" +#ident "MALTA-$Revision: 1.78.8.1 $" maxusers 32 options MIPS32 options MIPS64 -#options NOFPU # No FPU -#options FPEMUL # emulate FPU insn + +options NOFPU # No FPU +options FPEMUL # emulate FPU insn # Options for necessary to use MD # options MEMORY_DISK_HOOKS Index: src/sys/arch/evbmips/conf/MALTA32 diff -u src/sys/arch/evbmips/conf/MALTA32:1.3 src/sys/arch/evbmips/conf/MALTA32:1.3.34.1 --- src/sys/arch/evbmips/conf/MALTA32:1.3 Thu Feb 9 18:58:44 2012 +++ src/sys/arch/evbmips/conf/MALTA32 Sun Sep 24 20:12:55 2017 @@ -1,11 +1,10 @@ -# $NetBSD: MALTA32,v 1.3 2012/02/09 18:58:44 matt Exp $ +# $NetBSD: MALTA32,v 1.3.34.1 2017/09/24 20:12:55 snj Exp $ # include "arch/evbmips/conf/MALTA" makeoptions LP64="no" no options MIPS32 -options NOFPU # No FPU #options EXEC_ELF64 no ath* Index: src/sys/arch/evbmips/conf/MALTA64 diff -u src/sys/arch/evbmips/conf/MALTA64:1.6 src/sys/arch/evbmips/conf/MALTA64:1.6.18.1 --- src/sys/arch/evbmips/conf/MALTA64:1.6 Sat Oct 13 06:08:11 2012 +++ src/sys/arch/evbmips/conf/MALTA64 Sun Sep 24 20:12:55 2017 @@ -1,11 +1,10 @@ -# $NetBSD: MALTA64,v 1.6 2012/10/13 06:08:11 riz Exp $ +# $NetBSD: MALTA64,v 1.6.18.1 2017/09/24 20:12:55 snj Exp $ # include "arch/evbmips/conf/MALTA" makeoptions LP64="yes" no options MIPS32 -options NOFPU # No FPU options EXEC_ELF64 options COMPAT_NETBSD32 no options SYMTAB_SPACE Index: src/sys/arch/mips/mips/bds_emul.S diff -u src/sys/arch/mips/mips/bds_emul.S:1.6 src/sys/arch/mips/mips/bds_emul.S:1.6.30.1 --- src/sys/arch/mips/mips/bds_emul.S:1.6 Sun Dec 25 11:51:15 2011 +++ src/sys/arch/mips/mips/bds_emul.S Sun Sep 24 20:12:55 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: bds_emul.S,v 1.6 2011/12/25 11:51:15 kiyohara Exp $ */ +/* $NetBSD: bds_emul.S,v 1.6.30.1 2017/09/24 20:12:55 snj Exp $ */ /* * Copyright (c) 1992, 1993 @@ -101,8 +101,8 @@ bcemul_optbl: PTR_WORD bcemul_sigill # 030 LDL (*) PTR_WORD bcemul_sigill # 031 LDR (*) #else - PTR_WORD _C_LABEL(mips_emul_daddi) # 030 DADDI (*) - PTR_WORD _C_LABEL(mips_emul_daddiu) # 031 DADDIU (*) + PTR_WORD bcemul_daddi # 030 DADDI (*) + PTR_WORD bcemul_daddiu # 031 DADDIU (*) PTR_WORD _C_LABEL(mips_emul_ldl) # 032 LDL (*) PTR_WORD _C_LABEL(mips_emul_ldr) # 033 LDR (*) #endif @@ -191,7 +191,7 @@ bcemul_uimmed_prologue: #ifndef __mips_o32 bcemul_daddi: bal bcemul_immed_prologue - daddiu t0, v0, v1 + dadd t0, v0, v1 b bcemul_check_add_overflow #endif
CVS commit: [netbsd-7-0] src/sys/arch
Module Name:src Committed By: snj Date: Sun Sep 24 20:12:53 UTC 2017 Modified Files: src/sys/arch/evbmips/conf [netbsd-7-0]: MALTA MALTA32 MALTA64 src/sys/arch/mips/mips [netbsd-7-0]: bds_emul.S Log Message: Pull up following revision(s) (requested by mrg in ticket #1500): sys/arch/evbmips/conf/MALTA64: revision 1.8 sys/arch/evbmips/conf/MALTA32: revision 1.4 sys/arch/mips/mips/bds_emul.S: revision 1.9 sys/arch/evbmips/conf/MALTA: revision 1.88 Re-enable the NOFPU and (renamed) FPEMUL options. None of the Malta CPU daughter cards currently supported by NetBSD have an FPU. Detected on real hardware. gxemul wrongly supports an FPU on the 4Kc and 5Kc CPUs. -- Remove the NOFPU option. The main MALTA config file has this now. -- mips_emul_daddi and mips_emul_daddiu don't exist, but there are bcemul_daddi and bcemul_daddiu here that should be used. however, bcemul_daddi needed to be changed to use dadd not daddui. fixes FPEMUL and N64 kernels. ok simonb. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.78.4.1 src/sys/arch/evbmips/conf/MALTA cvs rdiff -u -r1.3 -r1.3.26.1 src/sys/arch/evbmips/conf/MALTA32 cvs rdiff -u -r1.6 -r1.6.14.1 src/sys/arch/evbmips/conf/MALTA64 cvs rdiff -u -r1.6 -r1.6.26.1 src/sys/arch/mips/mips/bds_emul.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbmips/conf/MALTA diff -u src/sys/arch/evbmips/conf/MALTA:1.78 src/sys/arch/evbmips/conf/MALTA:1.78.4.1 --- src/sys/arch/evbmips/conf/MALTA:1.78 Sun Jul 20 10:06:11 2014 +++ src/sys/arch/evbmips/conf/MALTA Sun Sep 24 20:12:53 2017 @@ -1,17 +1,18 @@ -# $NetBSD: MALTA,v 1.78 2014/07/20 10:06:11 alnsn Exp $ +# $NetBSD: MALTA,v 1.78.4.1 2017/09/24 20:12:53 snj Exp $ include "arch/evbmips/conf/std.malta" #options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "MALTA-$Revision: 1.78 $" +#ident "MALTA-$Revision: 1.78.4.1 $" maxusers 32 options MIPS32 options MIPS64 -#options NOFPU # No FPU -#options FPEMUL # emulate FPU insn + +options NOFPU # No FPU +options FPEMUL # emulate FPU insn # Options for necessary to use MD # options MEMORY_DISK_HOOKS Index: src/sys/arch/evbmips/conf/MALTA32 diff -u src/sys/arch/evbmips/conf/MALTA32:1.3 src/sys/arch/evbmips/conf/MALTA32:1.3.26.1 --- src/sys/arch/evbmips/conf/MALTA32:1.3 Thu Feb 9 18:58:44 2012 +++ src/sys/arch/evbmips/conf/MALTA32 Sun Sep 24 20:12:53 2017 @@ -1,11 +1,10 @@ -# $NetBSD: MALTA32,v 1.3 2012/02/09 18:58:44 matt Exp $ +# $NetBSD: MALTA32,v 1.3.26.1 2017/09/24 20:12:53 snj Exp $ # include "arch/evbmips/conf/MALTA" makeoptions LP64="no" no options MIPS32 -options NOFPU # No FPU #options EXEC_ELF64 no ath* Index: src/sys/arch/evbmips/conf/MALTA64 diff -u src/sys/arch/evbmips/conf/MALTA64:1.6 src/sys/arch/evbmips/conf/MALTA64:1.6.14.1 --- src/sys/arch/evbmips/conf/MALTA64:1.6 Sat Oct 13 06:08:11 2012 +++ src/sys/arch/evbmips/conf/MALTA64 Sun Sep 24 20:12:53 2017 @@ -1,11 +1,10 @@ -# $NetBSD: MALTA64,v 1.6 2012/10/13 06:08:11 riz Exp $ +# $NetBSD: MALTA64,v 1.6.14.1 2017/09/24 20:12:53 snj Exp $ # include "arch/evbmips/conf/MALTA" makeoptions LP64="yes" no options MIPS32 -options NOFPU # No FPU options EXEC_ELF64 options COMPAT_NETBSD32 no options SYMTAB_SPACE Index: src/sys/arch/mips/mips/bds_emul.S diff -u src/sys/arch/mips/mips/bds_emul.S:1.6 src/sys/arch/mips/mips/bds_emul.S:1.6.26.1 --- src/sys/arch/mips/mips/bds_emul.S:1.6 Sun Dec 25 11:51:15 2011 +++ src/sys/arch/mips/mips/bds_emul.S Sun Sep 24 20:12:53 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: bds_emul.S,v 1.6 2011/12/25 11:51:15 kiyohara Exp $ */ +/* $NetBSD: bds_emul.S,v 1.6.26.1 2017/09/24 20:12:53 snj Exp $ */ /* * Copyright (c) 1992, 1993 @@ -101,8 +101,8 @@ bcemul_optbl: PTR_WORD bcemul_sigill # 030 LDL (*) PTR_WORD bcemul_sigill # 031 LDR (*) #else - PTR_WORD _C_LABEL(mips_emul_daddi) # 030 DADDI (*) - PTR_WORD _C_LABEL(mips_emul_daddiu) # 031 DADDIU (*) + PTR_WORD bcemul_daddi # 030 DADDI (*) + PTR_WORD bcemul_daddiu # 031 DADDIU (*) PTR_WORD _C_LABEL(mips_emul_ldl) # 032 LDL (*) PTR_WORD _C_LABEL(mips_emul_ldr) # 033 LDR (*) #endif @@ -191,7 +191,7 @@ bcemul_uimmed_prologue: #ifndef __mips_o32 bcemul_daddi: bal bcemul_immed_prologue - daddiu t0, v0, v1 + dadd t0, v0, v1 b bcemul_check_add_overflow #endif
CVS commit: src/sys/arch/arm/nvidia
Module Name:src Committed By: jmcneill Date: Sun Sep 24 20:09:53 UTC 2017 Modified Files: src/sys/arch/arm/nvidia: tegra210_car.c tegra210_carreg.h tegra210_xusbpad.c tegra_var.h Log Message: More XUSB init. A USB3 memory stick seems to work now. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/nvidia/tegra210_car.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/nvidia/tegra210_carreg.h cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/nvidia/tegra210_xusbpad.c cvs rdiff -u -r1.41 -r1.42 src/sys/arch/arm/nvidia/tegra_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/nvidia/tegra210_car.c diff -u src/sys/arch/arm/nvidia/tegra210_car.c:1.9 src/sys/arch/arm/nvidia/tegra210_car.c:1.10 --- src/sys/arch/arm/nvidia/tegra210_car.c:1.9 Sat Sep 23 23:58:31 2017 +++ src/sys/arch/arm/nvidia/tegra210_car.c Sun Sep 24 20:09:53 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: tegra210_car.c,v 1.9 2017/09/23 23:58:31 jmcneill Exp $ */ +/* $NetBSD: tegra210_car.c,v 1.10 2017/09/24 20:09:53 jmcneill Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill@@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.9 2017/09/23 23:58:31 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.10 2017/09/24 20:09:53 jmcneill Exp $"); #include #include @@ -559,6 +559,8 @@ static struct tegra_clk tegra210_car_clo CLK_GATE_Y("USB2_TRK", "UBS2_HSIC_TRK", CAR_DEV_Y_USB2_TRK), CLK_GATE_Y("HSIC_TRK", "USB2_HSIC_TRK", CAR_DEV_Y_HSIC_TRK), CLK_GATE_H("APBDMA", "CLK_M", CAR_DEV_H_APBDMA), + CLK_GATE_L("USBD", "PLL_U_480M", CAR_DEV_L_USBD), + CLK_GATE_H("USB2", "PLL_U_480M", CAR_DEV_H_USB2), }; struct tegra210_init_parent { @@ -761,6 +763,8 @@ tegra210_car_utmip_init(struct tegra210_ tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG1_REG, 0x3, CAR_UTMIP_PLL_CFG1_XTAL_FREQ_COUNT); + bus_space_write_4(bst, bsh, CAR_RST_DEV_L_CLR_REG, CAR_DEV_L_USBD); + bus_space_write_4(bst, bsh, CAR_RST_DEV_H_CLR_REG, CAR_DEV_H_USB2); bus_space_write_4(bst, bsh, CAR_RST_DEV_W_CLR_REG, CAR_DEV_W_XUSB); bus_space_write_4(bst, bsh, CAR_RST_DEV_Y_CLR_REG, CAR_DEV_Y_PEX_USB_UPHY); bus_space_write_4(bst, bsh, CAR_RST_DEV_Y_CLR_REG, CAR_DEV_Y_SATA_USB_UPHY); @@ -827,6 +831,24 @@ tegra210_car_xusb_init(struct tegra210_c delay(2); /* + * Now switch PLLU to hw controlled mode. + */ + tegra_reg_set_clear(bst, bsh, CAR_PLLU_BASE_REG, 0, CAR_PLLU_BASE_OVERRIDE); + tegra_reg_set_clear(bst, bsh, CLK_RST_CONTROLLER_PLLU_HW_PWRDN_CFG0_REG, + CLK_RST_CONTROLLER_PLLU_HW_PWRDN_CFG0_IDDQ_PD_INCLUDE | + CLK_RST_CONTROLLER_PLLU_HW_PWRDN_CFG0_USE_SWITCH_DETECT | + CLK_RST_CONTROLLER_PLLU_HW_PWRDN_CFG0_USE_LOCKDET, + CLK_RST_CONTROLLER_PLLU_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL | + CLK_RST_CONTROLLER_PLLU_HW_PWRDN_CFG0_CLK_SWITCH_SWCTL); + tegra_reg_set_clear(bst, bsh, CLK_RST_CONTROLLER_XUSB_PLL_CFG0_REG, 0, + CLK_RST_CONTROLLER_XUSB_PLL_CFG0_PLLU_LOCK_DLY); + delay(1); + tegra_reg_set_clear(bst, bsh, CLK_RST_CONTROLLER_PLLU_HW_PWRDN_CFG0_REG, + CLK_RST_CONTROLLER_PLLU_HW_PWRDN_CFG0_SEQ_ENABLE, 0); + delay(1); + tegra_reg_set_clear(bst, bsh, CAR_PLLU_BASE_REG, 0, CAR_PLLU_BASE_CLKENABLE_USB); + + /* * Set up PLLREFE */ tegra_reg_set_clear(bst, bsh, CAR_PLLREFE_MISC_REG, @@ -1510,3 +1532,35 @@ tegra210_car_reset_deassert(device_t dev return 0; } + +void +tegra210_car_xusbio_enable_hw_control(void) +{ + device_t dev = device_find_by_driver_unit("tegra210car", 0); + KASSERT(dev != NULL); + struct tegra210_car_softc * const sc = device_private(dev); + bus_space_tag_t bst = sc->sc_bst; + bus_space_handle_t bsh = sc->sc_bsh; + + tegra_reg_set_clear(bst, bsh, CAR_XUSBIO_PLL_CFG0_REG, + 0, + CAR_XUSBIO_PLL_CFG0_CLK_ENABLE_SWCTL | + CAR_XUSBIO_PLL_CFG0_PADPLL_RESET_SWCTL); + tegra_reg_set_clear(bst, bsh, CAR_XUSBIO_PLL_CFG0_REG, + CAR_XUSBIO_PLL_CFG0_PADPLL_SLEEP_IDDQ | + CAR_XUSBIO_PLL_CFG0_PADPLL_USE_LOCKDET, + 0); +} + +void +tegra210_car_xusbio_enable_hw_seq(void) +{ + device_t dev = device_find_by_driver_unit("tegra210car", 0); + KASSERT(dev != NULL); + struct tegra210_car_softc * const sc = device_private(dev); + bus_space_tag_t bst = sc->sc_bst; + bus_space_handle_t bsh = sc->sc_bsh; + + tegra_reg_set_clear(bst, bsh, CAR_XUSBIO_PLL_CFG0_REG, + CAR_XUSBIO_PLL_CFG0_SEQ_ENABLE, 0); +} Index: src/sys/arch/arm/nvidia/tegra210_carreg.h diff -u src/sys/arch/arm/nvidia/tegra210_carreg.h:1.6 src/sys/arch/arm/nvidia/tegra210_carreg.h:1.7 --- src/sys/arch/arm/nvidia/tegra210_carreg.h:1.6 Sat Sep 23 23:21:35 2017 +++ src/sys/arch/arm/nvidia/tegra210_carreg.h Sun Sep 24 20:09:53 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: tegra210_carreg.h,v 1.6 2017/09/23 23:21:35 jmcneill Exp $ */ +/* $NetBSD: tegra210_carreg.h,v 1.7 2017/09/24 20:09:53 jmcneill Exp $ */ /*- * Copyright (c) 2017 Jared
CVS commit: src/sys/arch/arm/nvidia
Module Name:src Committed By: jmcneill Date: Sun Sep 24 20:09:22 UTC 2017 Modified Files: src/sys/arch/arm/nvidia: tegra_xusb.c Log Message: Enable XUSB power rails at attach To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/nvidia/tegra_xusb.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/arch/arm/nvidia/tegra_xusb.c diff -u src/sys/arch/arm/nvidia/tegra_xusb.c:1.9 src/sys/arch/arm/nvidia/tegra_xusb.c:1.10 --- src/sys/arch/arm/nvidia/tegra_xusb.c:1.9 Fri Sep 22 18:13:36 2017 +++ src/sys/arch/arm/nvidia/tegra_xusb.c Sun Sep 24 20:09:22 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: tegra_xusb.c,v 1.9 2017/09/22 18:13:36 jmcneill Exp $ */ +/* $NetBSD: tegra_xusb.c,v 1.10 2017/09/24 20:09:22 jmcneill Exp $ */ /* * Copyright (c) 2016 Jonathan A. Kollasch @@ -30,7 +30,7 @@ #include "opt_tegra.h" #include -__KERNEL_RCSID(0, "$NetBSD: tegra_xusb.c,v 1.9 2017/09/22 18:13:36 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra_xusb.c,v 1.10 2017/09/24 20:09:22 jmcneill Exp $"); #include #include @@ -42,8 +42,9 @@ __KERNEL_RCSID(0, "$NetBSD: tegra_xusb.c #include #include #include - #include +#include + #include #include @@ -231,6 +232,13 @@ tegra_xusb_attach(device_t parent, devic } aprint_normal_dev(self, "interrupting on %s\n", intrstr); + /* Enable XUSB power rails */ + + tegra_pmc_power(PMC_PARTID_XUSBC, true); /* Host/USB2.0 */ + tegra_pmc_power(PMC_PARTID_XUSBA, true); /* SuperSpeed */ + + /* Enable XUSB clocks */ + clk = fdtbus_clock_get(faa->faa_phandle, "pll_e"); rate = clk_get_rate(clk); error = clk_enable(clk); /* XXX set frequency */
CVS commit: [netbsd-7] src/sys
Module Name:src Committed By: snj Date: Sun Sep 24 20:05:03 UTC 2017 Modified Files: src/sys/arch/xen/xen [netbsd-7]: if_xennet_xenbus.c xennetback_xenbus.c src/sys/net [netbsd-7]: if_bridge.c if_ether.h if_ethersubr.c if_vlan.c Log Message: Pull up following revision(s) (requested by manu in ticket #1409): sys/arch/xen/xen/if_xennet_xenbus.c: 1.65 sys/arch/xen/xen/xennetback_xenbus.c: 1.53, 1.56 via patch sys/net/if_bridge.c: 1.105 sys/net/if_ether.h: 1.65 sys/net/if_ethersubr.c: 1.215, 1.235 sys/net/if_vlan.c: 1.76, 1.77, 1.83, 1.88, 1.94 Protect vlan_unconfig with a mutex It is not thread-safe but is likely to be executed in concurrent. See PR 49264 for more detail. -- Tweak vlan_unconfig No functional change. -- Add handling of VLAN packets in if_bridge where the parent interface supports them (Jean-Jacques.Puig%espci.fr@localhost). Factor out the vlan_mtu enabling and disabling code. -- Enable the VLAN mtu capability and check for the adjusted packet size (Jean-Jacques.Puig at espci.fr). Factor out the packet-size checking function for clarity. -- Don't increment the reference count only when it was 0... >From Jean-Jacques.Puig -- Account for the CRC len (Jean-Jacques.Puig) -- Fix a bug that the parent interface's callback wasn't called when the vlan interface is configured. A callback function uses VLAN_ATTACHED() function which check ec->ec_nvlans, the value should be incremented before calling the callback. This bug was added in if_vlan.c rev. 1.83 (2015/11/19). To generate a diff of this commit: cvs rdiff -u -r1.63.2.2 -r1.63.2.3 src/sys/arch/xen/xen/if_xennet_xenbus.c cvs rdiff -u -r1.52.4.1 -r1.52.4.2 src/sys/arch/xen/xen/xennetback_xenbus.c cvs rdiff -u -r1.90 -r1.90.2.1 src/sys/net/if_bridge.c cvs rdiff -u -r1.64 -r1.64.2.1 src/sys/net/if_ether.h cvs rdiff -u -r1.204.2.1 -r1.204.2.2 src/sys/net/if_ethersubr.c cvs rdiff -u -r1.70.2.4 -r1.70.2.5 src/sys/net/if_vlan.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/arch/xen/xen/if_xennet_xenbus.c diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.63.2.2 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.63.2.3 --- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.63.2.2 Sun Mar 26 16:08:12 2017 +++ src/sys/arch/xen/xen/if_xennet_xenbus.c Sun Sep 24 20:05:03 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: if_xennet_xenbus.c,v 1.63.2.2 2017/03/26 16:08:12 snj Exp $ */ +/* $NetBSD: if_xennet_xenbus.c,v 1.63.2.3 2017/09/24 20:05:03 snj Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -85,7 +85,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.63.2.2 2017/03/26 16:08:12 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.63.2.3 2017/09/24 20:05:03 snj Exp $"); #include "opt_xen.h" #include "opt_nfs_boot.h" @@ -362,6 +362,7 @@ xennet_xenbus_attach(device_t parent, de ether_sprintf(sc->sc_enaddr)); /* Initialize ifnet structure and attach interface */ strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ); + sc->sc_ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU; ifp->if_softc = sc; ifp->if_start = xennet_start; ifp->if_ioctl = xennet_ioctl; Index: src/sys/arch/xen/xen/xennetback_xenbus.c diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.52.4.1 src/sys/arch/xen/xen/xennetback_xenbus.c:1.52.4.2 --- src/sys/arch/xen/xen/xennetback_xenbus.c:1.52.4.1 Fri Jan 8 21:05:14 2016 +++ src/sys/arch/xen/xen/xennetback_xenbus.c Sun Sep 24 20:05:03 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: xennetback_xenbus.c,v 1.52.4.1 2016/01/08 21:05:14 snj Exp $ */ +/* $NetBSD: xennetback_xenbus.c,v 1.52.4.2 2017/09/24 20:05:03 snj Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.52.4.1 2016/01/08 21:05:14 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.52.4.2 2017/09/24 20:05:03 snj Exp $"); #include "opt_xen.h" @@ -301,6 +301,7 @@ xennetback_xenbus_create(struct xenbus_d /* create pseudo-interface */ aprint_verbose_ifnet(ifp, "Ethernet address %s\n", ether_sprintf(xneti->xni_enaddr)); + xneti->xni_ec.ec_capabilities |= ETHERCAP_VLAN_MTU; ifp->if_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_NOTRAILERS|IFF_MULTICAST; ifp->if_snd.ifq_maxlen = @@ -710,6 +711,24 @@ xennetback_tx_response(struct xnetback_i } } +static inline const char * +xennetback_tx_check_packet(const netif_tx_request_t *txreq, int vlan) +{ + if (__predict_false(txreq->size < ETHER_HDR_LEN)) + return "too small"; + + if (__predict_false(txreq->offset + txreq->size > PAGE_SIZE)) + return "crossing a page boundary"; + + int maxlen = ETHER_MAX_LEN - ETHER_CRC_LEN; + if (vlan) + maxlen += ETHER_VLAN_ENCAP_LEN; + if (__predict_false(txreq->size > maxlen)) + return "too big"; + + return NULL; +} + static int xennetback_evthandler(void *arg)
CVS commit: src/usr.bin/cvslatest
Module Name:src Committed By: joerg Date: Sun Sep 24 09:43:27 UTC 2017 Modified Files: src/usr.bin/cvslatest: cvslatest.c Log Message: Force _GNU_SOURCE on Linux, otherwise strptime is not defined and more restrictive macros result in even nastier fallout. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/cvslatest/cvslatest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/cvslatest/cvslatest.c diff -u src/usr.bin/cvslatest/cvslatest.c:1.5 src/usr.bin/cvslatest/cvslatest.c:1.6 --- src/usr.bin/cvslatest/cvslatest.c:1.5 Thu Jan 12 14:27:14 2017 +++ src/usr.bin/cvslatest/cvslatest.c Sun Sep 24 09:43:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: cvslatest.c,v 1.5 2017/01/12 14:27:14 christos Exp $ */ +/* $NetBSD: cvslatest.c,v 1.6 2017/09/24 09:43:27 joerg Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -29,12 +29,16 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef __linux__ +#define _GNU_SOURCE +#endif + #ifdef HAVE_NBTOOL_CONFIG_H #include "nbtool_config.h" #endif #include -__RCSID("$NetBSD: cvslatest.c,v 1.5 2017/01/12 14:27:14 christos Exp $"); +__RCSID("$NetBSD: cvslatest.c,v 1.6 2017/09/24 09:43:27 joerg Exp $"); /* * Find the latest timestamp in a set of CVS trees, by examining the
CVS commit: src/sys/arch/hppa/include
Module Name:src Committed By: christos Date: Sun Sep 24 07:39:28 UTC 2017 Modified Files: src/sys/arch/hppa/include: mutex.h Log Message: const me harder. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hppa/include/mutex.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/hppa/include/mutex.h diff -u src/sys/arch/hppa/include/mutex.h:1.11 src/sys/arch/hppa/include/mutex.h:1.12 --- src/sys/arch/hppa/include/mutex.h:1.11 Tue Nov 16 04:35:14 2010 +++ src/sys/arch/hppa/include/mutex.h Sun Sep 24 03:39:28 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mutex.h,v 1.11 2010/11/16 09:35:14 uebayasi Exp $ */ +/* $NetBSD: mutex.h,v 1.12 2017/09/24 07:39:28 christos Exp $ */ /*- * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. @@ -106,7 +106,7 @@ MUTEX_SET_WAITERS(struct kmutex *mtx, ui } static inline int -MUTEX_HAS_WAITERS(volatile struct kmutex *mtx) +MUTEX_HAS_WAITERS(const volatile struct kmutex *mtx) { return mtx->mtx_waiters != 0; } @@ -135,7 +135,7 @@ MUTEX_DESTROY(struct kmutex *mtx) } static inline bool -MUTEX_DEBUG_P(struct kmutex *mtx) +MUTEX_DEBUG_P(const volatile struct kmutex *mtx) { return mtx->mtx_dodebug != 0; }