svn commit: r354111 - in stable: 11/contrib/ipfilter/tools 12/contrib/ipfilter/tools

2019-10-25 Thread Cy Schubert
Author: cy
Date: Sat Oct 26 03:07:28 2019
New Revision: 354111
URL: https://svnweb.freebsd.org/changeset/base/354111

Log:
  MFC r352738:
  
  Teach the ippool parser about address families. This is a precursor
  to implementing IPv6 support within ippool which requires reworking
  radix_ipf.c.

Modified:
  stable/11/contrib/ipfilter/tools/ippool_y.y
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/contrib/ipfilter/tools/ippool_y.y
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/contrib/ipfilter/tools/ippool_y.y
==
--- stable/11/contrib/ipfilter/tools/ippool_y.y Fri Oct 25 22:39:26 2019
(r354110)
+++ stable/11/contrib/ipfilter/tools/ippool_y.y Sat Oct 26 03:07:28 2019
(r354111)
@@ -309,11 +309,27 @@ range:addrmask{ $$ = 
calloc(1, sizeof(*$$));
  $$->ipn_info = 0;
  $$->ipn_addr = $1[0];
  $$->ipn_mask = $1[1];
+#ifdef USE_INET6
+ if (use_inet6)
+   $$->ipn_addr.adf_family =
+   AF_INET6;
+ else
+#endif
+   $$->ipn_addr.adf_family =
+   AF_INET;
}
| '!' addrmask  { $$ = calloc(1, sizeof(*$$));
  $$->ipn_info = 1;
  $$->ipn_addr = $2[0];
  $$->ipn_mask = $2[1];
+#ifdef USE_INET6
+ if (use_inet6)
+   $$->ipn_addr.adf_family =
+   AF_INET6;
+ else
+#endif
+   $$->ipn_addr.adf_family =
+   AF_INET;
}
| YY_STR{ $$ = add_poolhosts($1);
  free($1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354111 - in stable: 11/contrib/ipfilter/tools 12/contrib/ipfilter/tools

2019-10-25 Thread Cy Schubert
Author: cy
Date: Sat Oct 26 03:07:28 2019
New Revision: 354111
URL: https://svnweb.freebsd.org/changeset/base/354111

Log:
  MFC r352738:
  
  Teach the ippool parser about address families. This is a precursor
  to implementing IPv6 support within ippool which requires reworking
  radix_ipf.c.

Modified:
  stable/12/contrib/ipfilter/tools/ippool_y.y
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/ipfilter/tools/ippool_y.y
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/contrib/ipfilter/tools/ippool_y.y
==
--- stable/12/contrib/ipfilter/tools/ippool_y.y Fri Oct 25 22:39:26 2019
(r354110)
+++ stable/12/contrib/ipfilter/tools/ippool_y.y Sat Oct 26 03:07:28 2019
(r354111)
@@ -309,11 +309,27 @@ range:addrmask{ $$ = 
calloc(1, sizeof(*$$));
  $$->ipn_info = 0;
  $$->ipn_addr = $1[0];
  $$->ipn_mask = $1[1];
+#ifdef USE_INET6
+ if (use_inet6)
+   $$->ipn_addr.adf_family =
+   AF_INET6;
+ else
+#endif
+   $$->ipn_addr.adf_family =
+   AF_INET;
}
| '!' addrmask  { $$ = calloc(1, sizeof(*$$));
  $$->ipn_info = 1;
  $$->ipn_addr = $2[0];
  $$->ipn_mask = $2[1];
+#ifdef USE_INET6
+ if (use_inet6)
+   $$->ipn_addr.adf_family =
+   AF_INET6;
+ else
+#endif
+   $$->ipn_addr.adf_family =
+   AF_INET;
}
| YY_STR{ $$ = add_poolhosts($1);
  free($1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354076 - head/sys/dev/ow

2019-10-25 Thread Warner Losh
On Fri, Oct 25, 2019, 6:51 PM Rodney W. Grimes 
wrote:

> > On Fri, 2019-10-25 at 19:03 +0300, Andriy Gapon wrote:
> > > On 25/10/2019 18:56, Ian Lepore wrote:
> > > > On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote:
> > > > > On 25/10/2019 18:46, Ian Lepore wrote:
> > > > > > On Fri, 2019-10-25 at 15:38 +, Andriy Gapon wrote:
> > > > > > > Author: avg
> > > > > > > Date: Fri Oct 25 15:38:09 2019
> > > > > > > New Revision: 354076
> > > > > > > URL: https://svnweb.freebsd.org/changeset/base/354076
> > > > > > >
> > > > > > > Log:
> > > > > > >   owc_gpiobus_read_data: compare times in sbintime_t units
> > > > > > >
> > > > > > >   Previously the code used sbttous() before microseconds
> > > > > > > comparison
> > > > > > > in one
> > > > > > >   place, sbttons() and nanoseconds in another, division by
> > > > > > > SBT_1US
> > > > > > > and
> > > > > > >   microseconds in yet another.
> > > > > > >
> > > > > > >   Now the code consistently uses multiplication by SBT_1US to
> > > > > > > convert
> > > > > > >   microseconds to sbintime_t before comparing them with
> > > > > > > periods
> > > > > > > between
> > > > > > >   calls to sbinuptime().  This is fast, this is precise
> > > > > > > enough
> > > > > > > (below
> > > > > > >   0.03%) and the periods defined by the protocol cannot
> > > > > > > overflow.
> > > > > > >
> > > > > > >   Reviewed by:  imp (D22108)
> > > > > > >   MFC after:2 weeks
> > > > > > >
> > > > > > > Modified:
> > > > > > >   head/sys/dev/ow/owc_gpiobus.c
> > > > > > >
> > > > > > > Modified: head/sys/dev/ow/owc_gpiobus.c
> > > > > > > =
> > > > > > > 
> > > > > > > 
> > > > > > > =
> > > > > > > --- head/sys/dev/ow/owc_gpiobus.c   Fri Oct 25 15:02:50
> > > > > > > 2019(
> > > > > > > r354
> > > > > > > 075)
> > > > > > > +++ head/sys/dev/ow/owc_gpiobus.c   Fri Oct 25 15:38:09
> > > > > > > 2019(
> > > > > > > r354
> > > > > > > 076)
> > > > > > > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev,
> > > > > > > struct
> > > > > > > ow_timing *
> > > > > > > do {
> > > > > > > now = sbinuptime();
> > > > > > > GETPIN(sc, );
> > > > > > > -   } while (sbttous(now - then) < t->t_rdv + 2 && sample
> > > > > > > == 0);
> > > > > > > +   } while (now - then < (t->t_rdv + 2) * SBT_1US &&
> > > > > > > sample == 0);
> > > > > > > critical_exit();
> > > > > > >
> > > > > > > -   if (sbttons(now - then) < t->t_rdv * 1000)
> > > > > > > +   if (now - then < t->t_rdv * SBT_1US)
> > > > > > > *bit = 1;
> > > > > > > else
> > > > > > > *bit = 0;
> > > > > > > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev,
> > > > > > > struct
> > > > > > > ow_timing *
> > > > > > > /* Wait out the rest of t_slot */
> > > > > > > do {
> > > > > > > now = sbinuptime();
> > > > > > > -   } while ((now - then) / SBT_1US < t->t_slot);
> > > > > > > +   } while (now - then < t->t_slot * SBT_1US);
> > > > > > >
> > > > > > > RELBUS(sc);
> > > > > > >
> > > > > >
> > > > > > Unit conversions with sbt times should be done using the macros
> > > > > > that
> > > > > > carefully avoid roundoff errors.  I don't understand why you've
> > > > > > changed
> > > > > > the code that correctly did use those macros to inline math.
> > > > >
> > > > > I think that the commit message explains it:
> > > > > This is fast, this is precise enough (below 0.03%) and the
> > > > > periods
> > > > > defined by
> > > > > the protocol cannot overflow.
> > > > >
> > > > > Do you disagree?
> > > > > Could you please explain in which of the three lines changed the
> > > > > new
> > > > > code is
> > > > > worse and why?
> > > > >
> > > >
> > > > I absolutely disagree (or I wouldn't have replied).  Unit
> > > > conversions
> > > > using sbt times should use the predefined macros, NOT incline
> > > > multiplication and division.  I don't know how to say it more
> > > > clearly
> > > > than that.  The conversion macros are idiomatic (at least, they
> > > > would
> > > > be if people stopped writing inline conversion expressions).
> > >
> > > I can agree that I should have used ustosbt() instead of
> > > multiplication by
> > > SBT_1US, but I don't agree with your original message that I changed
> > > the code
> > > that correctly used the macros.
> > >
> > > But again, I know the times being converted, they are fixed by the
> > > protocol and
> > > I do not see why I have to use this:
> > >
> > > static __inline sbintime_t
> > > ustosbt(int64_t _us)
> > > {
> > > sbintime_t sb = 0;
> > >
> > > #ifdef KASSERT
> > > KASSERT(_us >= 0, ("Negative values illegal for ustosbt:
> > > %jd", _us));
> > > #endif
> > > if (_us >= SBT_1S) {
> > > sb = (_us / 100) * SBT_1S;
> > > _us = _us % 100;
> > > }
> > > /* 9223372036855 = ceil(2^63 / 100) */
> > > sb += 

Re: svn commit: r354076 - head/sys/dev/ow

2019-10-25 Thread Rodney W. Grimes
> On Fri, 2019-10-25 at 19:03 +0300, Andriy Gapon wrote:
> > On 25/10/2019 18:56, Ian Lepore wrote:
> > > On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote:
> > > > On 25/10/2019 18:46, Ian Lepore wrote:
> > > > > On Fri, 2019-10-25 at 15:38 +, Andriy Gapon wrote:
> > > > > > Author: avg
> > > > > > Date: Fri Oct 25 15:38:09 2019
> > > > > > New Revision: 354076
> > > > > > URL: https://svnweb.freebsd.org/changeset/base/354076
> > > > > > 
> > > > > > Log:
> > > > > >   owc_gpiobus_read_data: compare times in sbintime_t units
> > > > > >   
> > > > > >   Previously the code used sbttous() before microseconds
> > > > > > comparison
> > > > > > in one
> > > > > >   place, sbttons() and nanoseconds in another, division by
> > > > > > SBT_1US
> > > > > > and
> > > > > >   microseconds in yet another.
> > > > > >   
> > > > > >   Now the code consistently uses multiplication by SBT_1US to
> > > > > > convert
> > > > > >   microseconds to sbintime_t before comparing them with
> > > > > > periods
> > > > > > between
> > > > > >   calls to sbinuptime().  This is fast, this is precise
> > > > > > enough
> > > > > > (below
> > > > > >   0.03%) and the periods defined by the protocol cannot
> > > > > > overflow.
> > > > > >   
> > > > > >   Reviewed by:  imp (D22108)
> > > > > >   MFC after:2 weeks
> > > > > > 
> > > > > > Modified:
> > > > > >   head/sys/dev/ow/owc_gpiobus.c
> > > > > > 
> > > > > > Modified: head/sys/dev/ow/owc_gpiobus.c
> > > > > > =
> > > > > > 
> > > > > > 
> > > > > > =
> > > > > > --- head/sys/dev/ow/owc_gpiobus.c   Fri Oct 25 15:02:50
> > > > > > 2019(
> > > > > > r354
> > > > > > 075)
> > > > > > +++ head/sys/dev/ow/owc_gpiobus.c   Fri Oct 25 15:38:09
> > > > > > 2019(
> > > > > > r354
> > > > > > 076)
> > > > > > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev,
> > > > > > struct
> > > > > > ow_timing *
> > > > > > do {
> > > > > > now = sbinuptime();
> > > > > > GETPIN(sc, );
> > > > > > -   } while (sbttous(now - then) < t->t_rdv + 2 && sample
> > > > > > == 0);
> > > > > > +   } while (now - then < (t->t_rdv + 2) * SBT_1US &&
> > > > > > sample == 0);
> > > > > > critical_exit();
> > > > > >  
> > > > > > -   if (sbttons(now - then) < t->t_rdv * 1000)
> > > > > > +   if (now - then < t->t_rdv * SBT_1US)
> > > > > > *bit = 1;
> > > > > > else
> > > > > > *bit = 0;
> > > > > > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev,
> > > > > > struct
> > > > > > ow_timing *
> > > > > > /* Wait out the rest of t_slot */
> > > > > > do {
> > > > > > now = sbinuptime();
> > > > > > -   } while ((now - then) / SBT_1US < t->t_slot);
> > > > > > +   } while (now - then < t->t_slot * SBT_1US);
> > > > > >  
> > > > > > RELBUS(sc);
> > > > > >  
> > > > > 
> > > > > Unit conversions with sbt times should be done using the macros
> > > > > that
> > > > > carefully avoid roundoff errors.  I don't understand why you've
> > > > > changed
> > > > > the code that correctly did use those macros to inline math.
> > > > 
> > > > I think that the commit message explains it:
> > > > This is fast, this is precise enough (below 0.03%) and the
> > > > periods
> > > > defined by
> > > > the protocol cannot overflow.
> > > > 
> > > > Do you disagree?
> > > > Could you please explain in which of the three lines changed the
> > > > new
> > > > code is
> > > > worse and why?
> > > > 
> > > 
> > > I absolutely disagree (or I wouldn't have replied).  Unit
> > > conversions
> > > using sbt times should use the predefined macros, NOT incline
> > > multiplication and division.  I don't know how to say it more
> > > clearly
> > > than that.  The conversion macros are idiomatic (at least, they
> > > would
> > > be if people stopped writing inline conversion expressions).
> > 
> > I can agree that I should have used ustosbt() instead of
> > multiplication by
> > SBT_1US, but I don't agree with your original message that I changed
> > the code
> > that correctly used the macros.
> > 
> > But again, I know the times being converted, they are fixed by the
> > protocol and
> > I do not see why I have to use this:
> > 
> > static __inline sbintime_t
> > ustosbt(int64_t _us)
> > {
> > sbintime_t sb = 0;
> > 
> > #ifdef KASSERT
> > KASSERT(_us >= 0, ("Negative values illegal for ustosbt:
> > %jd", _us));
> > #endif
> > if (_us >= SBT_1S) {
> > sb = (_us / 100) * SBT_1S;
> > _us = _us % 100;
> > }
> > /* 9223372036855 = ceil(2^63 / 100) */
> > sb += ((_us * 9223372036855ull) + 0x7fff) >> 31;
> > return (sb);
> > }
> > 
> > instead of this
> > x * (((sbintime_t)1 << 32) / 100)
> > 
> > The times:
> > static struct ow_timing timing_regular = {
> > .t_slot = 60,   /* 60 to 120 */
> > .t_low0 = 60,   

svn commit: r354110 - head/share/man/man4

2019-10-25 Thread Navdeep Parhar
Author: np
Date: Fri Oct 25 22:39:26 2019
New Revision: 354110
URL: https://svnweb.freebsd.org/changeset/base/354110

Log:
  Fix typo in cxgbe.4.
  
  MFC after:1 week

Modified:
  head/share/man/man4/cxgbe.4

Modified: head/share/man/man4/cxgbe.4
==
--- head/share/man/man4/cxgbe.4 Fri Oct 25 22:17:24 2019(r354109)
+++ head/share/man/man4/cxgbe.4 Fri Oct 25 22:39:26 2019(r354110)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Sep 24, 2018
+.Dd Oct 25, 2019
 .Dt CXGBE 4
 .Os
 .Sh NAME
@@ -292,7 +292,7 @@ Settings can be displayed and controlled on a per-port
 dev..X.pause_settings sysctl.
 .It Va hw.cxgbe.fec
 FEC (Forward Error Correction) settings.
-0 diables FEC.
+0 disables FEC.
 Bit 0 enables RS FEC, bit 1 enables BASE-R FEC (aka Firecode FEC).
 The default is -1 which lets the driver pick a value.
 This tunable establishes the default FEC settings for all ports.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354109 - in stable: 11/sys/conf 12/sys/conf

2019-10-25 Thread John Baldwin
Author: jhb
Date: Fri Oct 25 22:17:24 2019
New Revision: 354109
URL: https://svnweb.freebsd.org/changeset/base/354109

Log:
  MFC 353023: Fix the EMBEDFS_FORMAT helper variable for riscv64.
  
  It was defined with the wrong MACHINE_ARCH previously.  This permits
  using an MFS image without defining MD_ROOT_SIZE which has various
  benefits (one being that the build is able to treat the MFS image as
  a dependency and properly re-link the kernel with the new image when
  building with NO_CLEAN).

Modified:
  stable/11/sys/conf/kern.pre.mk
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/conf/kern.pre.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/conf/kern.pre.mk
==
--- stable/11/sys/conf/kern.pre.mk  Fri Oct 25 22:15:20 2019
(r354108)
+++ stable/11/sys/conf/kern.pre.mk  Fri Oct 25 22:17:24 2019
(r354109)
@@ -265,7 +265,7 @@ EMBEDFS_FORMAT.mips?=   elf32-tradbigmips
 EMBEDFS_FORMAT.mipsel?=elf32-tradlittlemips
 EMBEDFS_FORMAT.mips64?=elf64-tradbigmips
 EMBEDFS_FORMAT.mips64el?=  elf64-tradlittlemips
-EMBEDFS_FORMAT.riscv?= elf64-littleriscv
+EMBEDFS_FORMAT.riscv64?=   elf64-littleriscv
 .endif
 .endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354109 - in stable: 11/sys/conf 12/sys/conf

2019-10-25 Thread John Baldwin
Author: jhb
Date: Fri Oct 25 22:17:24 2019
New Revision: 354109
URL: https://svnweb.freebsd.org/changeset/base/354109

Log:
  MFC 353023: Fix the EMBEDFS_FORMAT helper variable for riscv64.
  
  It was defined with the wrong MACHINE_ARCH previously.  This permits
  using an MFS image without defining MD_ROOT_SIZE which has various
  benefits (one being that the build is able to treat the MFS image as
  a dependency and properly re-link the kernel with the new image when
  building with NO_CLEAN).

Modified:
  stable/12/sys/conf/kern.pre.mk
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/conf/kern.pre.mk
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/conf/kern.pre.mk
==
--- stable/12/sys/conf/kern.pre.mk  Fri Oct 25 22:15:20 2019
(r354108)
+++ stable/12/sys/conf/kern.pre.mk  Fri Oct 25 22:17:24 2019
(r354109)
@@ -288,7 +288,7 @@ EMBEDFS_FORMAT.mips?=   elf32-tradbigmips
 EMBEDFS_FORMAT.mipsel?=elf32-tradlittlemips
 EMBEDFS_FORMAT.mips64?=elf64-tradbigmips
 EMBEDFS_FORMAT.mips64el?=  elf64-tradlittlemips
-EMBEDFS_FORMAT.riscv?= elf64-littleriscv
+EMBEDFS_FORMAT.riscv64?=   elf64-littleriscv
 .endif
 .endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354108 - in stable: 11/usr.bin/netstat 12/usr.bin/netstat

2019-10-25 Thread John Baldwin
Author: jhb
Date: Fri Oct 25 22:15:20 2019
New Revision: 354108
URL: https://svnweb.freebsd.org/changeset/base/354108

Log:
  MFC 353059: Restore description of packets dropped due to full reassembly 
queue.
  
  r265408 renamed tcps_rcvmemdrop to tcps_rcvreassfull and gave it a more
  specific description.  r279122 (libxo-ification) reverted that change.
  This commit brings it back, but with a small tweak to the description.

Modified:
  stable/12/usr.bin/netstat/inet.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/usr.bin/netstat/inet.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/usr.bin/netstat/inet.c
==
--- stable/12/usr.bin/netstat/inet.cFri Oct 25 22:04:05 2019
(r354107)
+++ stable/12/usr.bin/netstat/inet.cFri Oct 25 22:15:20 2019
(r354108)
@@ -640,8 +640,8 @@ tcp_stats(u_long off, const char *name, int af1 __unus
"{N:/discarded for bad header offset field%s}\n");
p1a(tcps_rcvshort, "\t\t{:discard-too-short/%ju} "
"{N:discarded because packet too short}\n");
-   p1a(tcps_rcvmemdrop, "\t\t{:discard-memory-problems/%ju} "
-   "{N:discarded due to memory problems}\n");
+   p1a(tcps_rcvreassfull, "\t\t{:discard-reassembly-queue-full/%ju} "
+   "{N:discarded due to full reassembly queue}\n");
p(tcps_connattempt, "\t{:connection-requests/%ju} "
"{N:/connection request%s}\n");
p(tcps_accepts, "\t{:connections-accepts/%ju} "
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354108 - in stable: 11/usr.bin/netstat 12/usr.bin/netstat

2019-10-25 Thread John Baldwin
Author: jhb
Date: Fri Oct 25 22:15:20 2019
New Revision: 354108
URL: https://svnweb.freebsd.org/changeset/base/354108

Log:
  MFC 353059: Restore description of packets dropped due to full reassembly 
queue.
  
  r265408 renamed tcps_rcvmemdrop to tcps_rcvreassfull and gave it a more
  specific description.  r279122 (libxo-ification) reverted that change.
  This commit brings it back, but with a small tweak to the description.

Modified:
  stable/11/usr.bin/netstat/inet.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/usr.bin/netstat/inet.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/usr.bin/netstat/inet.c
==
--- stable/11/usr.bin/netstat/inet.cFri Oct 25 22:04:05 2019
(r354107)
+++ stable/11/usr.bin/netstat/inet.cFri Oct 25 22:15:20 2019
(r354108)
@@ -753,8 +753,8 @@ tcp_stats(u_long off, const char *name, int af1 __unus
"{N:/discarded for bad header offset field%s}\n");
p1a(tcps_rcvshort, "\t\t{:discard-too-short/%ju} "
"{N:discarded because packet too short}\n");
-   p1a(tcps_rcvmemdrop, "\t\t{:discard-memory-problems/%ju} "
-   "{N:discarded due to memory problems}\n");
+   p1a(tcps_rcvreassfull, "\t\t{:discard-reassembly-queue-full/%ju} "
+   "{N:discarded due to full reassembly queue}\n");
p(tcps_connattempt, "\t{:connection-requests/%ju} "
"{N:/connection request%s}\n");
p(tcps_accepts, "\t{:connections-accepts/%ju} "
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354094 - head/sys/arm64/rockchip

2019-10-25 Thread Peter Jeremy
Author: peterj
Date: Fri Oct 25 19:38:02 2019
New Revision: 354094
URL: https://svnweb.freebsd.org/changeset/base/354094

Log:
  Fix use of uninitialised variable.
  
  The RK805 regs array was being allocated before it's required size was
  known, causing the driver to use memory it didn't own.  That memory
  was subsequently allocated and used elsewhere causing later fatal data
  aborts in rk805_map().
  
  Whilst I'm here, add a sanity check to catch unsupported PMICs (this
  shouldn't ever get hit because the probe should have failed).
  
  Reviewed by:  manu
  MFC after:1 week
  Sponsored by: Google

Modified:
  head/sys/arm64/rockchip/rk805.c

Modified: head/sys/arm64/rockchip/rk805.c
==
--- head/sys/arm64/rockchip/rk805.c Fri Oct 25 18:56:46 2019
(r354093)
+++ head/sys/arm64/rockchip/rk805.c Fri Oct 25 19:38:02 2019
(r354094)
@@ -467,9 +467,6 @@ rk805_attach(device_t dev)
if (config_intrhook_establish(>intr_hook) != 0)
return (ENOMEM);
 
-   sc->regs = malloc(sizeof(struct rk805_reg_sc *) * sc->nregs,
-   M_RK805_REG, M_WAITOK | M_ZERO);
-
sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
switch (sc->type) {
case RK805:
@@ -480,7 +477,13 @@ rk805_attach(device_t dev)
regdefs = rk808_regdefs;
sc->nregs = nitems(rk808_regdefs);
break;
+   default:
+   device_printf(dev, "Unknown type %d\n", sc->type);
+   return (ENXIO);
}
+
+   sc->regs = malloc(sizeof(struct rk805_reg_sc *) * sc->nregs,
+   M_RK805_REG, M_WAITOK | M_ZERO);
 
rnode = ofw_bus_find_child(ofw_bus_get_node(dev), "regulators");
if (rnode > 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354100 - head/sys/arm64/rockchip/clk

2019-10-25 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Oct 25 21:21:21 2019
New Revision: 354100
URL: https://svnweb.freebsd.org/changeset/base/354100

Log:
  arm64: rk3399: Add clock and gate for SPI clocks
  
  MFC after:1 month

Modified:
  head/sys/arm64/rockchip/clk/rk3399_cru.c

Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c
==
--- head/sys/arm64/rockchip/clk/rk3399_cru.cFri Oct 25 21:20:04 2019
(r354099)
+++ head/sys/arm64/rockchip/clk/rk3399_cru.cFri Oct 25 21:21:21 2019
(r354100)
@@ -75,6 +75,11 @@ __FBSDID("$FreeBSD$");
 #definePCLK_I2C5   344
 #definePCLK_I2C6   345
 #definePCLK_I2C7   346
+#definePCLK_SPI0   347
+#definePCLK_SPI1   348
+#definePCLK_SPI2   349
+#definePCLK_SPI4   350
+#definePCLK_SPI5   351
 #defineHCLK_HOST0  456
 #defineHCLK_HOST0_ARB  457
 #defineHCLK_HOST1  458
@@ -132,6 +137,12 @@ static struct rk_cru_gate rk3399_gates[] = {
CRU_GATE(PCLK_I2C2, "pclk_rki2c2", "pclk_perilp1", 0x358, 9)
CRU_GATE(PCLK_I2C3, "pclk_rki2c3", "pclk_perilp1", 0x358, 10)
 
+   /* CRU_CLKGATE_CON23 */
+   CRU_GATE(PCLK_SPI0, "pclk_spi0", "pclk_perilp1", 0x35C, 10)
+   CRU_GATE(PCLK_SPI1, "pclk_spi1", "pclk_perilp1", 0x35C, 11)
+   CRU_GATE(PCLK_SPI2, "pclk_spi2", "pclk_perilp1", 0x35C, 12)
+   CRU_GATE(PCLK_SPI4, "pclk_spi4", "pclk_perilp1", 0x35C, 13)
+
/* CRU_CLKGATE_CON30 */
CRU_GATE(ACLK_USB3_NOC, "aclk_usb3_noc", "aclk_usb3", 0x378, 0)
CRU_GATE(ACLK_USB3OTG0, "aclk_usb3otg0", "aclk_usb3", 0x378, 1)
@@ -151,6 +162,9 @@ static struct rk_cru_gate rk3399_gates[] = {
 
/* CRU_CLKGATE_CON33 */
CRU_GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_sd", 0x384, 8)
+
+   /* CRU_CLKGATE_CON34 */
+   CRU_GATE(PCLK_SPI4, "pclk_spi5", "pclk_perilp1", 0x388, 5)
 };
 
 
@@ -1367,6 +1381,127 @@ static struct rk_clk_composite_def uphy1_tcpdcore = {
 };
 
 /*
+ * spi
+ */
+static const char *spi_parents[] = {"cpll", "gpll"};
+
+#defineSCLK_SPI0   71
+#defineSCLK_SPI1   72
+#defineSCLK_SPI2   73
+#defineSCLK_SPI4   74
+#defineSCLK_SPI5   75
+
+static struct rk_clk_composite_def spi0 = {
+   .clkdef = {
+   .id = SCLK_SPI0,
+   .name = "clk_spi0",
+   .parent_names = spi_parents,
+   .parent_cnt = nitems(spi_parents),
+   },
+   /* CRU_CLKSEL_CON59 */
+   .muxdiv_offset = 0x01ec,
+   .mux_shift = 7,
+   .mux_width = 1,
+
+   .div_shift = 0,
+   .div_width = 7,
+
+   /* CRU_CLKGATE_CON9 */
+   .gate_offset = 0x0324,
+   .gate_shift = 12,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
+};
+
+static struct rk_clk_composite_def spi1 = {
+   .clkdef = {
+   .id = SCLK_SPI1,
+   .name = "clk_spi1",
+   .parent_names = spi_parents,
+   .parent_cnt = nitems(spi_parents),
+   },
+   /* CRU_CLKSEL_CON59 */
+   .muxdiv_offset = 0x01ec,
+   .mux_shift = 15,
+   .mux_width = 1,
+
+   .div_shift = 8,
+   .div_width = 7,
+
+   /* CRU_CLKGATE_CON9 */
+   .gate_offset = 0x0324,
+   .gate_shift = 13,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
+};
+
+static struct rk_clk_composite_def spi2 = {
+   .clkdef = {
+   .id = SCLK_SPI2,
+   .name = "clk_spi2",
+   .parent_names = spi_parents,
+   .parent_cnt = nitems(spi_parents),
+   },
+   /* CRU_CLKSEL_CON60 */
+   .muxdiv_offset = 0x01f0,
+   .mux_shift = 7,
+   .mux_width = 1,
+
+   .div_shift = 0,
+   .div_width = 7,
+
+   /* CRU_CLKGATE_CON9 */
+   .gate_offset = 0x0324,
+   .gate_shift = 14,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
+};
+
+static struct rk_clk_composite_def spi4 = {
+   .clkdef = {
+   .id = SCLK_SPI4,
+   .name = "clk_spi4",
+   .parent_names = spi_parents,
+   .parent_cnt = nitems(spi_parents),
+   },
+   /* CRU_CLKSEL_CON60 */
+   .muxdiv_offset = 0x01f0,
+   .mux_shift = 15,
+   .mux_width = 1,
+
+   .div_shift = 8,
+   .div_width = 7,
+
+   /* CRU_CLKGATE_CON9 */
+   .gate_offset = 0x0324,
+   .gate_shift = 15,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
+};
+
+static struct rk_clk_composite_def spi5 = {
+   .clkdef = {
+   .id = SCLK_SPI5,
+   .name = "clk_spi5",
+   .parent_names = spi_parents,
+   .parent_cnt = nitems(spi_parents),
+   },
+   /* CRU_CLKSEL_CON58 */
+   .muxdiv_offset = 0x01e8,
+   

svn commit: r354098 - in stable: 11/sys/dev/cxgbe/crypto 12/sys/dev/cxgbe/crypto

2019-10-25 Thread John Baldwin
Author: jhb
Date: Fri Oct 25 21:14:43 2019
New Revision: 354098
URL: https://svnweb.freebsd.org/changeset/base/354098

Log:
  MFC 353323: Set the FID field in lookaside crypto requests to the rx queue ID.
  
  The PCI block in the adapter requires this field to be set to a valid
  queue ID.  It is not clear why it did not fail on all machines, but
  the effect was that crypto operations reading input data via DMA
  failed with an internal PCI read error on machines with 128G or more
  of RAM.

Modified:
  stable/12/sys/dev/cxgbe/crypto/t4_crypto.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/dev/cxgbe/crypto/t4_crypto.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/dev/cxgbe/crypto/t4_crypto.c
==
--- stable/12/sys/dev/cxgbe/crypto/t4_crypto.c  Fri Oct 25 21:00:49 2019
(r354097)
+++ stable/12/sys/dev/cxgbe/crypto/t4_crypto.c  Fri Oct 25 21:14:43 2019
(r354098)
@@ -419,7 +419,7 @@ ccr_populate_wreq(struct ccr_softc *sc, struct chcr_wr
crwr->ulptx.cmd_dest = htobe32(V_ULPTX_CMD(ULP_TX_PKT) |
V_ULP_TXPKT_DATAMODIFY(0) |
V_ULP_TXPKT_CHANNELID(sc->tx_channel_id) | V_ULP_TXPKT_DEST(0) |
-   V_ULP_TXPKT_FID(0) | V_ULP_TXPKT_RO(1));
+   V_ULP_TXPKT_FID(sc->rxq->iq.abs_id) | V_ULP_TXPKT_RO(1));
crwr->ulptx.len = htobe32(
((wr_len - sizeof(struct fw_crypto_lookaside_wr)) / 16));
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354104 - head/sys/riscv/riscv

2019-10-25 Thread Mitchell Horne
Author: mhorne
Date: Fri Oct 25 21:39:29 2019
New Revision: 354104
URL: https://svnweb.freebsd.org/changeset/base/354104

Log:
  RISC-V: skip cpu-map when parsing elf_hwcap
  
  The fill_elf_hwcap() function expects to find only cpu nodes under the
  /cpus entry of the device tree. Newer versions of QEMU insert a cpu-map
  node which describes the CPU topology, breaking this function. To fix
  this, simply skip any non-cpu entries.
  
  Reviewed by:  markj, kp, jhb
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D22151

Modified:
  head/sys/riscv/riscv/identcpu.c

Modified: head/sys/riscv/riscv/identcpu.c
==
--- head/sys/riscv/riscv/identcpu.c Fri Oct 25 21:38:38 2019
(r354103)
+++ head/sys/riscv/riscv/identcpu.c Fri Oct 25 21:39:29 2019
(r354104)
@@ -142,11 +142,9 @@ fill_elf_hwcap(void *dummy __unused)
 * ISAs, keep only the extension bits that are common to all harts.
 */
for (node = OF_child(node); node > 0; node = OF_peer(node)) {
-   if (!ofw_bus_node_is_compatible(node, "riscv")) {
-   if (bootverbose)
-   printf("fill_elf_hwcap: Can't find cpu\n");
-   return;
-   }
+   /* Skip any non-CPU nodes, such as cpu-map. */
+   if (!ofw_bus_node_is_compatible(node, "riscv"))
+   continue;
 
len = OF_getprop(node, "riscv,isa", isa, sizeof(isa));
KASSERT(len <= ISA_NAME_MAXLEN, ("ISA string truncated"));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354099 - in stable: 11/sys/dev/cxgbe 12/sys/dev/cxgbe

2019-10-25 Thread John Baldwin
Author: jhb
Date: Fri Oct 25 21:20:04 2019
New Revision: 354099
URL: https://svnweb.freebsd.org/changeset/base/354099

Log:
  MFC 353369: Remove adapters from t4_list earlier during detach.
  
  This ensures the clip task won't race with t4_destroy_clip_table.
  
  While here, make some mutex destroys unconditional since attach always
  initializes them.
  
  Sponsored by: Chelsio Communications

Modified:
  stable/12/sys/dev/cxgbe/t4_main.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/dev/cxgbe/t4_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/dev/cxgbe/t4_main.c
==
--- stable/12/sys/dev/cxgbe/t4_main.c   Fri Oct 25 21:14:43 2019
(r354098)
+++ stable/12/sys/dev/cxgbe/t4_main.c   Fri Oct 25 21:20:04 2019
(r354099)
@@ -1475,6 +1475,10 @@ t4_detach_common(device_t dev)
sc->cdev = NULL;
}
 
+   sx_xlock(_list_lock);
+   SLIST_REMOVE(_list, sc, adapter, link);
+   sx_xunlock(_list_lock);
+
sc->flags &= ~CHK_MBOX_ACCESS;
if (sc->flags & FULL_INIT_DONE) {
if (!(sc->flags & IS_VF))
@@ -1568,12 +1572,6 @@ t4_detach_common(device_t dev)
free(sc->tids.tid_tab, M_CXGBE);
free(sc->tt.tls_rx_ports, M_CXGBE);
t4_destroy_dma_tag(sc);
-   if (mtx_initialized(>sc_lock)) {
-   sx_xlock(_list_lock);
-   SLIST_REMOVE(_list, sc, adapter, link);
-   sx_xunlock(_list_lock);
-   mtx_destroy(>sc_lock);
-   }
 
callout_drain(>sfl_callout);
if (mtx_initialized(>tids.ftid_lock)) {
@@ -1582,12 +1580,8 @@ t4_detach_common(device_t dev)
}
if (mtx_initialized(>tids.atid_lock))
mtx_destroy(>tids.atid_lock);
-   if (mtx_initialized(>sfl_lock))
-   mtx_destroy(>sfl_lock);
if (mtx_initialized(>ifp_lock))
mtx_destroy(>ifp_lock);
-   if (mtx_initialized(>reg_lock))
-   mtx_destroy(>reg_lock);
 
if (rw_initialized(>policy_lock)) {
rw_destroy(>policy_lock);
@@ -1603,6 +1597,10 @@ t4_detach_common(device_t dev)
if (rw_initialized(>mw_lock))
rw_destroy(>mw_lock);
}
+
+   mtx_destroy(>sfl_lock);
+   mtx_destroy(>reg_lock);
+   mtx_destroy(>sc_lock);
 
bzero(sc, sizeof(*sc));
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern

2019-10-25 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 25 20:09:42 2019
New Revision: 354095
URL: https://svnweb.freebsd.org/changeset/base/354095

Log:
  amd64: move pcb out of kstack to struct thread.
  
  This saves 320 bytes of the precious stack space.
  
  The only negative aspect of the change I can think of is that the
  struct thread increased by 320 bytes obviously, and that 320 bytes are
  not swapped out anymore. I believe the freed stack space is much more
  important than that.  Also, current struct thread size is 1392 bytes
  on amd64, so UMA will allocate two thread structures per (4KB) slab,
  which leaves a space for pcb without increasing zone memory use.
  
  Reviewed by:  alc, markj
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D22138

Modified:
  head/sys/amd64/amd64/cpu_switch.S
  head/sys/amd64/amd64/genassym.c
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/amd64/vm_machdep.c
  head/sys/amd64/include/md_var.h
  head/sys/amd64/include/pcpu_aux.h
  head/sys/amd64/include/proc.h
  head/sys/kern/kern_thread.c

Modified: head/sys/amd64/amd64/cpu_switch.S
==
--- head/sys/amd64/amd64/cpu_switch.S   Fri Oct 25 19:38:02 2019
(r354094)
+++ head/sys/amd64/amd64/cpu_switch.S   Fri Oct 25 20:09:42 2019
(r354095)
@@ -74,7 +74,7 @@ END(cpu_throw)
  */
 ENTRY(cpu_switch)
/* Switch to new thread.  First, save context. */
-   movqTD_PCB(%rdi),%r8
+   leaqTD_MD_PCB(%rdi),%r8
 
movq(%rsp),%rax /* Hardware registers */
movq%r15,PCB_R15(%r8)
@@ -140,7 +140,7 @@ ctx_switch_xsave:
callq   pmap_activate_sw
movq%r15,TD_LOCK(%r13)  /* Release the old thread */
 sw1:
-   movqTD_PCB(%r12),%r8
+   leaqTD_MD_PCB(%r12),%r8
 #if defined(SCHED_ULE) && defined(SMP)
movq$blocked_lock, %rdx
movqTD_LOCK(%r12),%rcx
@@ -193,11 +193,12 @@ do_kthread:
cmpq%rax,%rdx
jne do_tss
 done_tss:
-   movq%r8,PCPU(RSP0)
+   movqTD_MD_STACK_BASE(%r12),%r9
+   movq%r9,PCPU(RSP0)
movq%r8,PCPU(CURPCB)
movqPCPU(PTI_RSP0),%rax
cmpq$~0,PCPU(UCR3)
-   cmove   %r8,%rax
+   cmove   %r9,%rax
movq%rax,TSS_RSP0(%rdx)
movq%r12,PCPU(CURTHREAD)/* into next thread */
 

Modified: head/sys/amd64/amd64/genassym.c
==
--- head/sys/amd64/amd64/genassym.c Fri Oct 25 19:38:02 2019
(r354094)
+++ head/sys/amd64/amd64/genassym.c Fri Oct 25 20:09:42 2019
(r354095)
@@ -87,6 +87,8 @@ ASSYM(TD_PFLAGS, offsetof(struct thread, td_pflags));
 ASSYM(TD_PROC, offsetof(struct thread, td_proc));
 ASSYM(TD_FRAME, offsetof(struct thread, td_frame));
 ASSYM(TD_MD, offsetof(struct thread, td_md));
+ASSYM(TD_MD_PCB, offsetof(struct thread, td_md.md_pcb));
+ASSYM(TD_MD_STACK_BASE, offsetof(struct thread, td_md.md_stack_base));
 
 ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
 ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Fri Oct 25 19:38:02 2019
(r354094)
+++ head/sys/amd64/amd64/machdep.c  Fri Oct 25 20:09:42 2019
(r354095)
@@ -1789,12 +1789,12 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
amd64_conf_fast_syscall();
 
/*
-* Temporary forge some valid pointer to PCB, for exception
-* handlers.  It is reinitialized properly below after FPU is
-* set up.  Also set up td_critnest to short-cut the page
-* fault handler.
+* We initialize the PCB pointer early so that exception
+* handlers will work.  Also set up td_critnest to short-cut
+* the page fault handler.
 */
cpu_max_ext_state_size = sizeof(struct savefpu);
+   set_top_of_stack_td();
thread0.td_pcb = get_pcb_td();
thread0.td_critnest = 1;
 
@@ -1850,11 +1850,10 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
fpuinit();
 
/*
-* Set up thread0 pcb after fpuinit calculated pcb + fpu save
+* Set up thread0 pcb save area after fpuinit calculated fpu save
 * area size.  Zero out the extended state header in fpu save
 * area.
 */
-   thread0.td_pcb = get_pcb_td();
thread0.td_pcb->pcb_save = get_pcb_user_save_td();
bzero(get_pcb_user_save_td(), cpu_max_ext_state_size);
if (use_xsave) {
@@ -1863,7 +1862,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
xhdr->xstate_bv = xsave_mask;
}
/* make an initial tss so cpu can get interrupt stack on syscall! */
-   rsp0 = (vm_offset_t)thread0.td_pcb;
+   rsp0 

svn commit: r354098 - in stable: 11/sys/dev/cxgbe/crypto 12/sys/dev/cxgbe/crypto

2019-10-25 Thread John Baldwin
Author: jhb
Date: Fri Oct 25 21:14:43 2019
New Revision: 354098
URL: https://svnweb.freebsd.org/changeset/base/354098

Log:
  MFC 353323: Set the FID field in lookaside crypto requests to the rx queue ID.
  
  The PCI block in the adapter requires this field to be set to a valid
  queue ID.  It is not clear why it did not fail on all machines, but
  the effect was that crypto operations reading input data via DMA
  failed with an internal PCI read error on machines with 128G or more
  of RAM.

Modified:
  stable/11/sys/dev/cxgbe/crypto/t4_crypto.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/dev/cxgbe/crypto/t4_crypto.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/dev/cxgbe/crypto/t4_crypto.c
==
--- stable/11/sys/dev/cxgbe/crypto/t4_crypto.c  Fri Oct 25 21:00:49 2019
(r354097)
+++ stable/11/sys/dev/cxgbe/crypto/t4_crypto.c  Fri Oct 25 21:14:43 2019
(r354098)
@@ -411,7 +411,7 @@ ccr_populate_wreq(struct ccr_softc *sc, struct chcr_wr
crwr->ulptx.cmd_dest = htobe32(V_ULPTX_CMD(ULP_TX_PKT) |
V_ULP_TXPKT_DATAMODIFY(0) |
V_ULP_TXPKT_CHANNELID(sc->tx_channel_id) | V_ULP_TXPKT_DEST(0) |
-   V_ULP_TXPKT_FID(0) | V_ULP_TXPKT_RO(1));
+   V_ULP_TXPKT_FID(sc->rxq->iq.abs_id) | V_ULP_TXPKT_RO(1));
crwr->ulptx.len = htobe32(
((wr_len - sizeof(struct fw_crypto_lookaside_wr)) / 16));
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354103 - in head/sys: arm64/conf arm64/rockchip conf

2019-10-25 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Oct 25 21:38:38 2019
New Revision: 354103
URL: https://svnweb.freebsd.org/changeset/base/354103

Log:
  arm64: rk3399: add SPI driver and include it in GENERIC config
  
  SPI driver for Rockchip's RK3399 SoC. Implements PIO mode, CS selection,
  SPI mode and frequency configuration.
  
  Reviewed by:  manu
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D22148

Added:
  head/sys/arm64/rockchip/rk_spi.c   (contents, props changed)
Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files.arm64

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Fri Oct 25 21:32:28 2019(r354102)
+++ head/sys/arm64/conf/GENERIC Fri Oct 25 21:38:38 2019(r354103)
@@ -286,6 +286,7 @@ device  mv_thermal  # Marvell Thermal 
Sensor Controller
 # SPI
 device spibus
 device bcm2835_spi # Broadcom BCM283x SPI bus
+device rk_spi  # RockChip SPI controller
 
 # PWM
 device pwm

Added: head/sys/arm64/rockchip/rk_spi.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/rockchip/rk_spi.cFri Oct 25 21:38:38 2019
(r354103)
@@ -0,0 +1,483 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 Oleksandr Tymoshenko 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "spibus_if.h"
+
+#defineRK_SPI_CTRLR0   0x
+#defineCTRLR0_OPM_MASTER   (0 << 20)
+#defineCTRLR0_XFM_TR   (0 << 18)
+#defineCTRLR0_FRF_MOTO (0 << 16)
+#defineCTRLR0_BHT_8BIT (1 << 13)
+#defineCTRLR0_EM_BIG   (1 << 11)
+#defineCTRLR0_SSD_ONE  (1 << 10)
+#defineCTRLR0_SCPOL(1 <<  7)
+#defineCTRLR0_SCPH (1 <<  6)
+#defineCTRLR0_DFS_8BIT (1 <<  0)
+#defineRK_SPI_CTRLR1   0x0004
+#defineRK_SPI_ENR  0x0008
+#defineRK_SPI_SER  0x000c
+#defineRK_SPI_BAUDR0x0010
+#defineRK_SPI_TXFTLR   0x0014
+#defineRK_SPI_RXFTLR   0x0018
+#defineRK_SPI_TXFLR0x001c
+#defineRK_SPI_RXFLR0x0020
+#defineRK_SPI_SR   0x0024
+#defineSR_BUSY (1 <<  0)
+#defineRK_SPI_IPR  0x0028
+#defineRK_SPI_IMR  0x002c
+#defineIMR_RFFIM   (1 <<  4)
+#defineIMR_TFEIM   (1 <<  0)
+#defineRK_SPI_ISR  0x0030
+#defineISR_RFFIS   (1 <<  4)
+#defineISR_TFEIS   (1 <<  0)
+#defineRK_SPI_RISR 0x0034
+#defineRK_SPI_ICR  0x0038
+#defineRK_SPI_DMACR0x003c
+#defineRK_SPI_DMATDLR  0x0040
+#defineRK_SPI_DMARDLR  0x0044
+#defineRK_SPI_TXDR 0x0400
+#defineRK_SPI_RXDR 0x0800
+
+#defineCS_MAX  1
+
+static struct ofw_compat_data compat_data[] = {
+   { "rockchip,rk3399-spi",1 },
+   { NULL, 0 }
+};
+

svn commit: r354107 - in stable: 11/sys/dev/acpica 11/sys/dev/pci 12/sys/dev/acpica 12/sys/dev/pci

2019-10-25 Thread John Baldwin
Author: jhb
Date: Fri Oct 25 22:04:05 2019
New Revision: 354107
URL: https://svnweb.freebsd.org/changeset/base/354107

Log:
  MFC 353585,353586: Support hot insertion and removal of PCI devices on EC2.
  
  353585:
  Export pci_attach() and pci_detach().
  
  353586:
  Support hot insertion and removal of PCI devices on EC2.
  
  Install ACPI notify handlers on PCI devices with an _EJ0 method.  This
  handler is invoked when devices are added or removed.
  
  - When an ACPI_NOTIFY_DEVICE_CHECK event posts, rescan the parent bus
device.  Note that strictly speaking we only need to rescan the
specified device, but BUS_RESCAN is what is available, so we rescan
the entire bus.
  - When an ACPI_NOTIFY_EJECT_REQUEST event posts, detach the device
associated with the ACPI handle, invoke the _EJ0 method, and then
delete the device.
  
  Eventually this might be changed to vector notify events to devd in
  userspace where devctl can be used instead to permit more complex
  actions such as graceful unmounting of filesystems.

Modified:
  stable/12/sys/dev/acpica/acpi_pci.c
  stable/12/sys/dev/pci/pci.c
  stable/12/sys/dev/pci/pci_private.h
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/dev/acpica/acpi_pci.c
  stable/11/sys/dev/pci/pci.c
  stable/11/sys/dev/pci/pci_private.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/dev/acpica/acpi_pci.c
==
--- stable/12/sys/dev/acpica/acpi_pci.c Fri Oct 25 21:53:05 2019
(r354106)
+++ stable/12/sys/dev/acpica/acpi_pci.c Fri Oct 25 22:04:05 2019
(r354107)
@@ -71,9 +71,11 @@ CTASSERT(ACPI_STATE_D2 == PCI_POWERSTATE_D2);
 CTASSERT(ACPI_STATE_D3 == PCI_POWERSTATE_D3);
 
 static struct pci_devinfo *acpi_pci_alloc_devinfo(device_t dev);
+static int acpi_pci_attach(device_t dev);
 static voidacpi_pci_child_deleted(device_t dev, device_t child);
 static int acpi_pci_child_location_str_method(device_t cbdev,
device_t child, char *buf, size_t buflen);
+static int acpi_pci_detach(device_t dev);
 static int acpi_pci_probe(device_t dev);
 static int acpi_pci_read_ivar(device_t dev, device_t child, int which,
uintptr_t *result);
@@ -89,6 +91,8 @@ static bus_dma_tag_t acpi_pci_get_dma_tag(device_t bus
 static device_method_t acpi_pci_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, acpi_pci_probe),
+   DEVMETHOD(device_attach,acpi_pci_attach),
+   DEVMETHOD(device_detach,acpi_pci_detach),
 
/* Bus interface */
DEVMETHOD(bus_read_ivar,acpi_pci_read_ivar),
@@ -324,6 +328,108 @@ acpi_pci_probe(device_t dev)
return (ENXIO);
device_set_desc(dev, "ACPI PCI bus");
return (BUS_PROBE_DEFAULT);
+}
+
+static void
+acpi_pci_device_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
+{
+   device_t child, dev;
+   ACPI_STATUS status;
+   int error;
+
+   dev = context;
+
+   switch (notify) {
+   case ACPI_NOTIFY_DEVICE_CHECK:
+   mtx_lock();
+   BUS_RESCAN(dev);
+   mtx_unlock();
+   break;
+   case ACPI_NOTIFY_EJECT_REQUEST:
+   child = acpi_get_device(h);
+   if (child == NULL) {
+   device_printf(dev, "no device to eject for %s\n",
+   acpi_name(h));
+   return;
+   }
+   mtx_lock();
+   error = device_detach(child);
+   if (error) {
+   mtx_unlock();
+   device_printf(dev, "failed to detach %s: %d\n",
+   device_get_nameunit(child), error);
+   return;
+   }
+   status = acpi_SetInteger(h, "_EJ0", 1);
+   if (ACPI_FAILURE(status)) {
+   mtx_unlock();
+   device_printf(dev, "failed to eject %s: %s\n",
+   acpi_name(h), AcpiFormatException(status));
+   return;
+   }
+   BUS_RESCAN(dev);
+   mtx_unlock();
+   break;
+   default:
+   device_printf(dev, "unknown notify %#x for %s\n", notify,
+   acpi_name(h));
+   break;
+   }
+}
+
+static ACPI_STATUS
+acpi_pci_install_device_notify_handler(ACPI_HANDLE handle, UINT32 level,
+void *context, void **status)
+{
+   ACPI_HANDLE h;
+
+   ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
+
+   if (ACPI_FAILURE(AcpiGetHandle(handle, "_EJ0", )))
+   return_ACPI_STATUS (AE_OK);
+
+   AcpiInstallNotifyHandler(handle, ACPI_SYSTEM_NOTIFY,
+   acpi_pci_device_notify_handler, context);
+   return_ACPI_STATUS (AE_OK);
+}
+

svn commit: r354107 - in stable: 11/sys/dev/acpica 11/sys/dev/pci 12/sys/dev/acpica 12/sys/dev/pci

2019-10-25 Thread John Baldwin
Author: jhb
Date: Fri Oct 25 22:04:05 2019
New Revision: 354107
URL: https://svnweb.freebsd.org/changeset/base/354107

Log:
  MFC 353585,353586: Support hot insertion and removal of PCI devices on EC2.
  
  353585:
  Export pci_attach() and pci_detach().
  
  353586:
  Support hot insertion and removal of PCI devices on EC2.
  
  Install ACPI notify handlers on PCI devices with an _EJ0 method.  This
  handler is invoked when devices are added or removed.
  
  - When an ACPI_NOTIFY_DEVICE_CHECK event posts, rescan the parent bus
device.  Note that strictly speaking we only need to rescan the
specified device, but BUS_RESCAN is what is available, so we rescan
the entire bus.
  - When an ACPI_NOTIFY_EJECT_REQUEST event posts, detach the device
associated with the ACPI handle, invoke the _EJ0 method, and then
delete the device.
  
  Eventually this might be changed to vector notify events to devd in
  userspace where devctl can be used instead to permit more complex
  actions such as graceful unmounting of filesystems.

Modified:
  stable/11/sys/dev/acpica/acpi_pci.c
  stable/11/sys/dev/pci/pci.c
  stable/11/sys/dev/pci/pci_private.h
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/dev/acpica/acpi_pci.c
  stable/12/sys/dev/pci/pci.c
  stable/12/sys/dev/pci/pci_private.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/dev/acpica/acpi_pci.c
==
--- stable/11/sys/dev/acpica/acpi_pci.c Fri Oct 25 21:53:05 2019
(r354106)
+++ stable/11/sys/dev/acpica/acpi_pci.c Fri Oct 25 22:04:05 2019
(r354107)
@@ -71,9 +71,11 @@ CTASSERT(ACPI_STATE_D2 == PCI_POWERSTATE_D2);
 CTASSERT(ACPI_STATE_D3 == PCI_POWERSTATE_D3);
 
 static struct pci_devinfo *acpi_pci_alloc_devinfo(device_t dev);
+static int acpi_pci_attach(device_t dev);
 static voidacpi_pci_child_deleted(device_t dev, device_t child);
 static int acpi_pci_child_location_str_method(device_t cbdev,
device_t child, char *buf, size_t buflen);
+static int acpi_pci_detach(device_t dev);
 static int acpi_pci_probe(device_t dev);
 static int acpi_pci_read_ivar(device_t dev, device_t child, int which,
uintptr_t *result);
@@ -89,6 +91,8 @@ static bus_dma_tag_t acpi_pci_get_dma_tag(device_t bus
 static device_method_t acpi_pci_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, acpi_pci_probe),
+   DEVMETHOD(device_attach,acpi_pci_attach),
+   DEVMETHOD(device_detach,acpi_pci_detach),
 
/* Bus interface */
DEVMETHOD(bus_read_ivar,acpi_pci_read_ivar),
@@ -324,6 +328,108 @@ acpi_pci_probe(device_t dev)
return (ENXIO);
device_set_desc(dev, "ACPI PCI bus");
return (BUS_PROBE_DEFAULT);
+}
+
+static void
+acpi_pci_device_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
+{
+   device_t child, dev;
+   ACPI_STATUS status;
+   int error;
+
+   dev = context;
+
+   switch (notify) {
+   case ACPI_NOTIFY_DEVICE_CHECK:
+   mtx_lock();
+   BUS_RESCAN(dev);
+   mtx_unlock();
+   break;
+   case ACPI_NOTIFY_EJECT_REQUEST:
+   child = acpi_get_device(h);
+   if (child == NULL) {
+   device_printf(dev, "no device to eject for %s\n",
+   acpi_name(h));
+   return;
+   }
+   mtx_lock();
+   error = device_detach(child);
+   if (error) {
+   mtx_unlock();
+   device_printf(dev, "failed to detach %s: %d\n",
+   device_get_nameunit(child), error);
+   return;
+   }
+   status = acpi_SetInteger(h, "_EJ0", 1);
+   if (ACPI_FAILURE(status)) {
+   mtx_unlock();
+   device_printf(dev, "failed to eject %s: %s\n",
+   acpi_name(h), AcpiFormatException(status));
+   return;
+   }
+   BUS_RESCAN(dev);
+   mtx_unlock();
+   break;
+   default:
+   device_printf(dev, "unknown notify %#x for %s\n", notify,
+   acpi_name(h));
+   break;
+   }
+}
+
+static ACPI_STATUS
+acpi_pci_install_device_notify_handler(ACPI_HANDLE handle, UINT32 level,
+void *context, void **status)
+{
+   ACPI_HANDLE h;
+
+   ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
+
+   if (ACPI_FAILURE(AcpiGetHandle(handle, "_EJ0", )))
+   return_ACPI_STATUS (AE_OK);
+
+   AcpiInstallNotifyHandler(handle, ACPI_SYSTEM_NOTIFY,
+   acpi_pci_device_notify_handler, context);
+   return_ACPI_STATUS (AE_OK);
+}
+

svn commit: r354106 - in head/sys/dev/cxgbe: . common iw_cxgbe

2019-10-25 Thread Navdeep Parhar
Author: np
Date: Fri Oct 25 21:53:05 2019
New Revision: 354106
URL: https://svnweb.freebsd.org/changeset/base/354106

Log:
  cxgbe(4): Use correct FetchBurstMin values for T6.
  
  MFC after:1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/common/t4_regs_values.h
  head/sys/dev/cxgbe/iw_cxgbe/qp.c
  head/sys/dev/cxgbe/t4_netmap.c
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/common/t4_regs_values.h
==
--- head/sys/dev/cxgbe/common/t4_regs_values.h  Fri Oct 25 21:52:02 2019
(r354105)
+++ head/sys/dev/cxgbe/common/t4_regs_values.h  Fri Oct 25 21:53:05 2019
(r354106)
@@ -147,6 +147,11 @@
 #define X_FETCHBURSTMIN_64B2
 #define X_FETCHBURSTMIN_128B   3
 
+/* T6 and later use a single-bit encoding for FetchBurstMin */
+#define X_FETCHBURSTMIN_SHIFT_T6   6
+#define X_FETCHBURSTMIN_64B_T6 0
+#define X_FETCHBURSTMIN_128B_T61
+
 #define X_FETCHBURSTMAX_SHIFT  6
 #define X_FETCHBURSTMAX_64B0
 #define X_FETCHBURSTMAX_128B   1

Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/qp.cFri Oct 25 21:52:02 2019
(r354105)
+++ head/sys/dev/cxgbe/iw_cxgbe/qp.cFri Oct 25 21:53:05 2019
(r354106)
@@ -266,7 +266,8 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4
res->u.sqrq.dcaen_to_eqsize = cpu_to_be32(
V_FW_RI_RES_WR_DCAEN(0) |
V_FW_RI_RES_WR_DCACPU(0) |
-   V_FW_RI_RES_WR_FBMIN(2) |
+   V_FW_RI_RES_WR_FBMIN(chip_id(sc) <= CHELSIO_T5 ?
+   X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) |
V_FW_RI_RES_WR_FBMAX(3) |
V_FW_RI_RES_WR_CIDXFTHRESHO(0) |
V_FW_RI_RES_WR_CIDXFTHRESH(0) |
@@ -288,7 +289,8 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4
res->u.sqrq.dcaen_to_eqsize = cpu_to_be32(
V_FW_RI_RES_WR_DCAEN(0) |
V_FW_RI_RES_WR_DCACPU(0) |
-   V_FW_RI_RES_WR_FBMIN(2) |
+   V_FW_RI_RES_WR_FBMIN(chip_id(sc) <= CHELSIO_T5 ?
+   X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) |
V_FW_RI_RES_WR_FBMAX(3) |
V_FW_RI_RES_WR_CIDXFTHRESHO(0) |
V_FW_RI_RES_WR_CIDXFTHRESH(0) |

Modified: head/sys/dev/cxgbe/t4_netmap.c
==
--- head/sys/dev/cxgbe/t4_netmap.c  Fri Oct 25 21:52:02 2019
(r354105)
+++ head/sys/dev/cxgbe/t4_netmap.c  Fri Oct 25 21:53:05 2019
(r354106)
@@ -159,7 +159,7 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq
(black_hole == 2 ? F_FW_IQ_CMD_FL0PACKEN : 0));
c.fl0dcaen_to_fl0cidxfthresh =
htobe16(V_FW_IQ_CMD_FL0FBMIN(chip_id(sc) <= CHELSIO_T5 ?
-   X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B) |
+   X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B_T6) |
V_FW_IQ_CMD_FL0FBMAX(chip_id(sc) <= CHELSIO_T5 ?
X_FETCHBURSTMAX_512B : X_FETCHBURSTMAX_256B));
c.fl0size = htobe16(na->num_rx_desc / 8 + sp->spg_len / EQ_ESIZE);
@@ -274,9 +274,11 @@ alloc_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq
htobe32(V_FW_EQ_ETH_CMD_HOSTFCMODE(X_HOSTFCMODE_NONE) |
V_FW_EQ_ETH_CMD_PCIECHN(vi->pi->tx_chan) | 
F_FW_EQ_ETH_CMD_FETCHRO |

V_FW_EQ_ETH_CMD_IQID(sc->sge.nm_rxq[nm_txq->iqidx].iq_cntxt_id));
-   c.dcaen_to_eqsize = htobe32(V_FW_EQ_ETH_CMD_FBMIN(X_FETCHBURSTMIN_64B) |
- V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) |
- V_FW_EQ_ETH_CMD_EQSIZE(len / EQ_ESIZE));
+   c.dcaen_to_eqsize =
+   htobe32(V_FW_EQ_ETH_CMD_FBMIN(chip_id(sc) <= CHELSIO_T5 ?
+   X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) |
+   V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) |
+   V_FW_EQ_ETH_CMD_EQSIZE(len / EQ_ESIZE));
c.eqaddr = htobe64(nm_txq->ba);
 
rc = -t4_wr_mbox(sc, sc->mbox, , sizeof(c), );

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Fri Oct 25 21:52:02 2019(r354105)
+++ head/sys/dev/cxgbe/t4_sge.c Fri Oct 25 21:53:05 2019(r354106)
@@ -3212,7 +3212,7 @@ alloc_iq_fl(struct vi_info *vi, struct sge_iq *iq, str
}
c.fl0dcaen_to_fl0cidxfthresh =
htobe16(V_FW_IQ_CMD_FL0FBMIN(chip_id(sc) <= CHELSIO_T5 ?
-   X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B) |
+   X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B_T6) |
V_FW_IQ_CMD_FL0FBMAX(chip_id(sc) <= CHELSIO_T5 ?
X_FETCHBURSTMAX_512B : 

svn commit: r354105 - stable/12/tests/sys/kern

2019-10-25 Thread Li-Wen Hsu
Author: lwhsu
Date: Fri Oct 25 21:52:02 2019
New Revision: 354105
URL: https://svnweb.freebsd.org/changeset/base/354105

Log:
  MFC r350211, r350220, r350235, r350238-r350239, r350295, r350512, r350700, 
r352219
  
  r350211:
  Temporarily skip flakey test case
  sys.kern.ptrace_test.ptrace__follow_fork_child_detached_unrelated_debugger
  
  PR:   239292
  Sponsored by: The FreeBSD Foundation
  
  r350220:
  Fix URL.
  
  Sponsored by: The FreeBSD Foundation
  
  r350235:
  Temporarily skip flakey test case
  sys.kern.ptrace_test.ptrace__PT_KILL_competing_stop
  
  PR:   220841
  Sponsored by: The FreeBSD Foundation
  
  r350238:
  Temporarily skip flakey test case
  sys.kern.ptrace_test.ptrace__follow_fork_both_attached_unrelated_debugger
  
  PR:   239397
  Sponsored by: The FreeBSD Foundation
  
  r350239:
  Temporarily skip flakey test case
  sys.kern.ptrace_test.ptrace__parent_sees_exit_after_child_debugger
  
  PR:   239399
  Sponsored by: The FreeBSD Foundation
  
  r350295:
  Temporarily skip flakey test case
  sys.kern.ptrace_test.ptrace__follow_fork_parent_detached_unrelated_debugger
  
  PR:   239425
  Sponsored by: The FreeBSD Foundation
  
  r350512:
  Only skip test cases sometimes failing in CI when they are running in CI
  
  Suggested by: jhb
  Sponsored by: The FreeBSD Foundation
  
  r350700:
  Get configuration variable with default value for not breaking default setting
  
  Reported by:  markj
  Sponsored by: The FreeBSD Foundation
  
  r352219:
  Temporarily skip flakey test case sys.kern.ptrace_test.ptrace__getppid
  
  PR:   240510
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/tests/sys/kern/ptrace_test.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/tests/sys/kern/ptrace_test.c
==
--- stable/12/tests/sys/kern/ptrace_test.c  Fri Oct 25 21:39:29 2019
(r354104)
+++ stable/12/tests/sys/kern/ptrace_test.c  Fri Oct 25 21:52:02 2019
(r354105)
@@ -261,6 +261,9 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debug
int cpipe[2], dpipe[2], status;
char c;
 
+   if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
+   atf_tc_skip("https://bugs.freebsd.org/239399;);
+
ATF_REQUIRE(pipe(cpipe) == 0);
ATF_REQUIRE((child = fork()) != -1);
 
@@ -802,6 +805,9 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelate
pid_t children[2], fpid, wpid;
int cpipe[2], status;
 
+   if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
+   atf_tc_skip("https://bugs.freebsd.org/239397;);
+
ATF_REQUIRE(pipe(cpipe) == 0);
ATF_REQUIRE((fpid = fork()) != -1);
if (fpid == 0) {
@@ -870,6 +876,9 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelat
pid_t children[2], fpid, wpid;
int cpipe[2], status;
 
+   if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
+   atf_tc_skip("https://bugs.freebsd.org/239292;);
+
ATF_REQUIRE(pipe(cpipe) == 0);
ATF_REQUIRE((fpid = fork()) != -1);
if (fpid == 0) {
@@ -933,6 +942,9 @@ ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrela
pid_t children[2], fpid, wpid;
int cpipe[2], status;
 
+   if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
+   atf_tc_skip("https://bugs.freebsd.org/239425;);
+
ATF_REQUIRE(pipe(cpipe) == 0);
ATF_REQUIRE((fpid = fork()) != -1);
if (fpid == 0) {
@@ -995,6 +1007,10 @@ ATF_TC_BODY(ptrace__getppid, tc)
int cpipe[2], dpipe[2], status;
char c;
 
+   if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
+   atf_tc_skip("https://bugs.freebsd.org/240510;);
+
+
ATF_REQUIRE(pipe(cpipe) == 0);
ATF_REQUIRE((child = fork()) != -1);
 
@@ -2078,6 +2094,9 @@ ATF_TC_BODY(ptrace__PT_KILL_competing_stop, tc)
lwpid_t main_lwp;
struct ptrace_lwpinfo pl;
struct sched_param sched_param;
+
+   if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
+   atf_tc_skip("https://bugs.freebsd.org/220841;);
 
ATF_REQUIRE((fpid = fork()) != -1);
if (fpid == 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354097 - in head/contrib/llvm: lib/Object lib/Support lib/Target/ARM lib/Target/ARM/AsmParser lib/Target/ARM/MCTargetDesc tools/clang/lib/Basic/Targets tools/clang/lib/Driver/ToolChain...

2019-10-25 Thread Dimitry Andric
Author: dim
Date: Fri Oct 25 21:00:49 2019
New Revision: 354097
URL: https://svnweb.freebsd.org/changeset/base/354097

Log:
  Pull in r372186 from upstream llvm trunk (by Eli Friedman):
  
[ARM] VFPv2 only supports 16 D registers.
  
r361845 changed the way we handle "D16" vs. "D32" targets; there used
to be a negative "d16" which removed instructions from the
instruction set, and now there's a "d32" feature which adds
instructions to the instruction set.  This is good, but there was an
oversight in the implementation: the behavior of VFPv2 was changed.
In particular, the "vfp2" feature was changed to imply "d32". This is
wrong: VFPv2 only supports 16 D registers.
  
In practice, this means if you specify -mfpu=vfpv2, the compiler will
generate illegal instructions.
  
This patch gets rid of "vfp2d16" and "vfp2d16sp", and fixes "vfp2"
and "vfp2sp" so they don't imply "d32".
  
Differential Revision: https://reviews.llvm.org/D67375
  
  Pull in r372187 from upstream clang trunk (by Eli Friedman):
  
[ARM] Update clang for removal of vfp2d16 and vfp2d16sp
  
Matching fix for https://reviews.llvm.org/D67375 (r372186).
  
Differential Revision: https://reviews.llvm.org/D67467
  
  This should fix clang generating invalid opcodes for floating point
  operations on armv6.
  
  Requested by: mmel
  MFC after:3 days

Modified:
  head/contrib/llvm/lib/Object/ELFObjectFile.cpp
  head/contrib/llvm/lib/Support/ARMTargetParser.cpp
  head/contrib/llvm/lib/Target/ARM/ARM.td
  head/contrib/llvm/lib/Target/ARM/ARMPredicates.td
  head/contrib/llvm/lib/Target/ARM/ARMSubtarget.h
  head/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp
  head/contrib/llvm/tools/clang/lib/Basic/Targets/ARM.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/ARM.cpp

Modified: head/contrib/llvm/lib/Object/ELFObjectFile.cpp
==
--- head/contrib/llvm/lib/Object/ELFObjectFile.cpp  Fri Oct 25 20:15:04 
2019(r354096)
+++ head/contrib/llvm/lib/Object/ELFObjectFile.cpp  Fri Oct 25 21:00:49 
2019(r354097)
@@ -194,7 +194,7 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() 
 default:
   break;
 case ARMBuildAttrs::Not_Allowed:
-  Features.AddFeature("vfp2d16sp", false);
+  Features.AddFeature("vfp2sp", false);
   Features.AddFeature("vfp3d16sp", false);
   Features.AddFeature("vfp4d16sp", false);
   break;

Modified: head/contrib/llvm/lib/Support/ARMTargetParser.cpp
==
--- head/contrib/llvm/lib/Support/ARMTargetParser.cpp   Fri Oct 25 20:15:04 
2019(r354096)
+++ head/contrib/llvm/lib/Support/ARMTargetParser.cpp   Fri Oct 25 21:00:49 
2019(r354097)
@@ -176,10 +176,8 @@ bool ARM::getFPUFeatures(unsigned FPUKind, std::vector
 // exist).
 
 {"+fpregs", "-fpregs", FPUVersion::VFPV2, FPURestriction::SP_D16},
-{"+vfp2", "-vfp2", FPUVersion::VFPV2, FPURestriction::None},
-{"+vfp2d16", "-vfp2d16", FPUVersion::VFPV2, FPURestriction::D16},
-{"+vfp2d16sp", "-vfp2d16sp", FPUVersion::VFPV2, FPURestriction::SP_D16},
-{"+vfp2sp", "-vfp2sp", FPUVersion::VFPV2, FPURestriction::None},
+{"+vfp2", "-vfp2", FPUVersion::VFPV2, FPURestriction::D16},
+{"+vfp2sp", "-vfp2sp", FPUVersion::VFPV2, FPURestriction::SP_D16},
 {"+vfp3", "-vfp3", FPUVersion::VFPV3, FPURestriction::None},
 {"+vfp3d16", "-vfp3d16", FPUVersion::VFPV3, FPURestriction::D16},
 {"+vfp3d16sp", "-vfp3d16sp", FPUVersion::VFPV3, FPURestriction::SP_D16},
@@ -195,7 +193,7 @@ bool ARM::getFPUFeatures(unsigned FPUKind, std::vector
 {"+fp-armv8sp", "-fp-armv8sp", FPUVersion::VFPV5, FPURestriction::None},
 {"+fullfp16", "-fullfp16", FPUVersion::VFPV5_FULLFP16, 
FPURestriction::SP_D16},
 {"+fp64", "-fp64", FPUVersion::VFPV2, FPURestriction::D16},
-{"+d32", "-d32", FPUVersion::VFPV2, FPURestriction::None},
+{"+d32", "-d32", FPUVersion::VFPV3, FPURestriction::None},
   };
 
   for (const auto : FPUFeatureInfoList) {

Modified: head/contrib/llvm/lib/Target/ARM/ARM.td
==
--- head/contrib/llvm/lib/Target/ARM/ARM.td Fri Oct 25 20:15:04 2019
(r354096)
+++ head/contrib/llvm/lib/Target/ARM/ARM.td Fri Oct 25 21:00:49 2019
(r354097)
@@ -57,12 +57,15 @@ def FeatureD32: SubtargetFeature<"d32", "H
  "Extend FP to 32 double 
registers">;
 
 multiclass VFPver prev = [],
-  list otherimplies = []> {
+  list prev,
+  list otherimplies,
+  list vfp2prev = []> {
   def _D16_SP: SubtargetFeature<
 name#"d16sp", query#"D16SP", "true",
 description#" with only 16 d-registers and no 

svn commit: r354102 - head/sys/sys

2019-10-25 Thread Ravi Pokala
Author: rpokala
Date: Fri Oct 25 21:32:28 2019
New Revision: 354102
URL: https://svnweb.freebsd.org/changeset/base/354102

Log:
  Args for buf_track() might be unused
  
  If neither FULL_BUF_TRACKING nor BUF_TRACKING are defined, then the body of
  buf_track() becomes empty. Mark the arguments with "__unused" so the
  compiler doesn't complain about unused arguments in that case.
  
  Reported by:  Bruce Leverett (Panasas)
  Reviewed by:  cem (on IRC)
  MFC after:1 month
  Sponsored by: Panasas

Modified:
  head/sys/sys/buf.h

Modified: head/sys/sys/buf.h
==
--- head/sys/sys/buf.h  Fri Oct 25 21:23:44 2019(r354101)
+++ head/sys/sys/buf.h  Fri Oct 25 21:32:28 2019(r354102)
@@ -457,7 +457,7 @@ buf_countdeps(struct buf *bp, int i)
 }
 
 static __inline void
-buf_track(struct buf *bp, const char *location)
+buf_track(struct buf *bp __unused, const char *location __unused)
 {
 
 #if defined(FULL_BUF_TRACKING)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354101 - stable/12/sys/kern

2019-10-25 Thread John Baldwin
Author: jhb
Date: Fri Oct 25 21:23:44 2019
New Revision: 354101
URL: https://svnweb.freebsd.org/changeset/base/354101

Log:
  MFC 353371: Don't free the cursor boundary tag during vmem_destroy().
  
  The cursor boundary tag is statically allocated in the vmem instead of
  from the vmem_bt_zone.  Explicitly remove it from the vmem's segment
  list in vmem_destroy before freeing all the segments from the vmem.

Modified:
  stable/12/sys/kern/subr_vmem.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/subr_vmem.c
==
--- stable/12/sys/kern/subr_vmem.c  Fri Oct 25 21:21:21 2019
(r354100)
+++ stable/12/sys/kern/subr_vmem.c  Fri Oct 25 21:23:44 2019
(r354101)
@@ -466,6 +466,7 @@ static void
 bt_remseg(vmem_t *vm, bt_t *bt)
 {
 
+   MPASS(bt->bt_type != BT_TYPE_CURSOR);
TAILQ_REMOVE(>vm_seglist, bt, bt_seglist);
bt_free(vm, bt);
 }
@@ -843,6 +844,7 @@ vmem_destroy1(vmem_t *vm)
VMEM_LOCK(vm);
MPASS(vm->vm_nbusytag == 0);
 
+   TAILQ_REMOVE(>vm_seglist, >vm_cursor, bt_seglist);
while ((bt = TAILQ_FIRST(>vm_seglist)) != NULL)
bt_remseg(vm, bt);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354099 - in stable: 11/sys/dev/cxgbe 12/sys/dev/cxgbe

2019-10-25 Thread John Baldwin
Author: jhb
Date: Fri Oct 25 21:20:04 2019
New Revision: 354099
URL: https://svnweb.freebsd.org/changeset/base/354099

Log:
  MFC 353369: Remove adapters from t4_list earlier during detach.
  
  This ensures the clip task won't race with t4_destroy_clip_table.
  
  While here, make some mutex destroys unconditional since attach always
  initializes them.
  
  Sponsored by: Chelsio Communications

Modified:
  stable/11/sys/dev/cxgbe/t4_main.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/dev/cxgbe/t4_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/dev/cxgbe/t4_main.c
==
--- stable/11/sys/dev/cxgbe/t4_main.c   Fri Oct 25 21:14:43 2019
(r354098)
+++ stable/11/sys/dev/cxgbe/t4_main.c   Fri Oct 25 21:20:04 2019
(r354099)
@@ -1452,6 +1452,10 @@ t4_detach_common(device_t dev)
sc->cdev = NULL;
}
 
+   sx_xlock(_list_lock);
+   SLIST_REMOVE(_list, sc, adapter, link);
+   sx_xunlock(_list_lock);
+
sc->flags &= ~CHK_MBOX_ACCESS;
if (sc->flags & FULL_INIT_DONE) {
if (!(sc->flags & IS_VF))
@@ -1540,12 +1544,6 @@ t4_detach_common(device_t dev)
free(sc->tids.tid_tab, M_CXGBE);
free(sc->tt.tls_rx_ports, M_CXGBE);
t4_destroy_dma_tag(sc);
-   if (mtx_initialized(>sc_lock)) {
-   sx_xlock(_list_lock);
-   SLIST_REMOVE(_list, sc, adapter, link);
-   sx_xunlock(_list_lock);
-   mtx_destroy(>sc_lock);
-   }
 
callout_drain(>sfl_callout);
if (mtx_initialized(>tids.ftid_lock)) {
@@ -1554,12 +1552,8 @@ t4_detach_common(device_t dev)
}
if (mtx_initialized(>tids.atid_lock))
mtx_destroy(>tids.atid_lock);
-   if (mtx_initialized(>sfl_lock))
-   mtx_destroy(>sfl_lock);
if (mtx_initialized(>ifp_lock))
mtx_destroy(>ifp_lock);
-   if (mtx_initialized(>reg_lock))
-   mtx_destroy(>reg_lock);
 
if (rw_initialized(>policy_lock)) {
rw_destroy(>policy_lock);
@@ -1575,6 +1569,10 @@ t4_detach_common(device_t dev)
if (rw_initialized(>mw_lock))
rw_destroy(>mw_lock);
}
+
+   mtx_destroy(>sfl_lock);
+   mtx_destroy(>reg_lock);
+   mtx_destroy(>sc_lock);
 
bzero(sc, sizeof(*sc));
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354096 - head/sys/conf

2019-10-25 Thread Mark Johnston
Author: markj
Date: Fri Oct 25 20:15:04 2019
New Revision: 354096
URL: https://svnweb.freebsd.org/changeset/base/354096

Log:
  Apply kernel module linker scripts to firmware files.
  
  Use a separate make variable to specify the linker script so that it is
  only applied at link time and not during intermediate generation of .fwo
  files.
  
  This ensures that the .text padding inserted by the amd64 linker script
  is applied to the stub module load handlers embedded in firmware
  modules.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D22125

Modified:
  head/sys/conf/kmod.mk

Modified: head/sys/conf/kmod.mk
==
--- head/sys/conf/kmod.mk   Fri Oct 25 20:09:42 2019(r354095)
+++ head/sys/conf/kmod.mk   Fri Oct 25 20:15:04 2019(r354096)
@@ -242,8 +242,8 @@ EXPORT_SYMS?=   NO
 CLEANFILES+=   export_syms
 .endif
 
-.if !defined(FIRMWS) && exists(${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH})
-_LDFLAGS+=-T ${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH}
+.if exists(${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH})
+LDSCRIPT_FLAGS?= -T ${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH}
 .endif
 
 .if ${__KLD_SHARED} == yes
@@ -251,7 +251,8 @@ ${KMOD}.kld: ${OBJS}
 .else
 ${FULLPROG}: ${OBJS}
 .endif
-   ${LD} -m ${LD_EMULATION} ${_LDFLAGS} -r -d -o ${.TARGET} ${OBJS}
+   ${LD} -m ${LD_EMULATION} ${_LDFLAGS} ${LDSCRIPT_FLAGS} -r -d \
+   -o ${.TARGET} ${OBJS}
 .if ${MK_CTF} != "no"
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
 .endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354093 - in stable/12/sys: amd64/amd64 amd64/include arm/arm arm/include arm64/arm64 arm64/include i386/i386 i386/include mips/include powerpc/include powerpc/powerpc riscv/include ris...

2019-10-25 Thread Alexander Motin
Author: mav
Date: Fri Oct 25 18:56:46 2019
New Revision: 354093
URL: https://svnweb.freebsd.org/changeset/base/354093

Log:
  MFC r351594 (by kib): Centralize __pcpu definitions.
  
  Many extern struct pcpu __pcpu declarations were
  copied/pasted in sources.  The issue is that the definition is MD, but
  it cannot be provided by machine/pcpu.h due to actual struct pcpu
  defined in sys/pcpu.h later than the inclusion of machine/pcpu.h.
  This forced the copying when other code needed direct access to
  __pcpu.  There is no way around it, due to machine/pcpu.h supplying
  part of struct pcpu fields.
  
  To work around the problem, add a new machine/pcpu_aux.h header, which
  should fill any needed MD definitions after struct pcpu definition is
  completed. This allows to remove copies of __pcpu spread around the
  source.  Also on x86 it makes it possible to remove work arounds like
  OFFSETOF_CURTHREAD or clang specific warnings supressions.

Added:
  stable/12/sys/amd64/include/pcpu_aux.h
 - copied unchanged from r351594, head/sys/amd64/include/pcpu_aux.h
  stable/12/sys/arm/include/pcpu_aux.h
 - copied unchanged from r351594, head/sys/arm/include/pcpu_aux.h
  stable/12/sys/arm64/include/pcpu_aux.h
 - copied unchanged from r351594, head/sys/arm64/include/pcpu_aux.h
  stable/12/sys/i386/include/pcpu_aux.h
 - copied unchanged from r351594, head/sys/i386/include/pcpu_aux.h
  stable/12/sys/mips/include/pcpu_aux.h
 - copied unchanged from r351594, head/sys/mips/include/pcpu_aux.h
  stable/12/sys/powerpc/include/pcpu_aux.h
 - copied unchanged from r351594, head/sys/powerpc/include/pcpu_aux.h
  stable/12/sys/riscv/include/pcpu_aux.h
 - copied unchanged from r351594, head/sys/riscv/include/pcpu_aux.h
  stable/12/sys/sparc64/include/pcpu_aux.h
 - copied unchanged from r351594, head/sys/sparc64/include/pcpu_aux.h
Modified:
  stable/12/sys/amd64/amd64/mp_machdep.c
  stable/12/sys/amd64/amd64/pmap.c
  stable/12/sys/amd64/amd64/vm_machdep.c
  stable/12/sys/amd64/include/counter.h
  stable/12/sys/amd64/include/pcpu.h
  stable/12/sys/arm/arm/mp_machdep.c
  stable/12/sys/arm/include/counter.h
  stable/12/sys/arm64/arm64/mp_machdep.c
  stable/12/sys/arm64/include/counter.h
  stable/12/sys/i386/i386/mp_machdep.c
  stable/12/sys/i386/i386/vm_machdep.c
  stable/12/sys/i386/include/counter.h
  stable/12/sys/i386/include/pcpu.h
  stable/12/sys/powerpc/include/counter.h
  stable/12/sys/powerpc/powerpc/mp_machdep.c
  stable/12/sys/riscv/include/counter.h
  stable/12/sys/riscv/riscv/mp_machdep.c
  stable/12/sys/sys/pcpu.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/amd64/mp_machdep.c
==
--- stable/12/sys/amd64/amd64/mp_machdep.c  Fri Oct 25 18:54:06 2019
(r354092)
+++ stable/12/sys/amd64/amd64/mp_machdep.c  Fri Oct 25 18:56:46 2019
(r354093)
@@ -94,8 +94,6 @@ __FBSDID("$FreeBSD$");
 
 #defineAP_BOOTPT_SZ(PAGE_SIZE * 3)
 
-extern struct pcpu *__pcpu;
-
 /* Temporary variables for init_secondary()  */
 char *doublefault_stack;
 char *mce_stack;

Modified: stable/12/sys/amd64/amd64/pmap.c
==
--- stable/12/sys/amd64/amd64/pmap.cFri Oct 25 18:54:06 2019
(r354092)
+++ stable/12/sys/amd64/amd64/pmap.cFri Oct 25 18:56:46 2019
(r354093)
@@ -446,10 +446,6 @@ static pml4_entry_t *pti_pml4;
 static vm_pindex_t pti_pg_idx;
 static bool pti_finalized;
 
-extern struct pcpu *__pcpu;
-extern struct pcpu temp_bsp_pcpu;
-extern pt_entry_t *pcpu_pte;
-
 struct pmap_pkru_range {
struct rs_elpkru_rs_el;
u_int   pkru_keyidx;

Modified: stable/12/sys/amd64/amd64/vm_machdep.c
==
--- stable/12/sys/amd64/amd64/vm_machdep.c  Fri Oct 25 18:54:06 2019
(r354092)
+++ stable/12/sys/amd64/amd64/vm_machdep.c  Fri Oct 25 18:56:46 2019
(r354093)
@@ -84,10 +84,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-_Static_assert(OFFSETOF_CURTHREAD == offsetof(struct pcpu, pc_curthread),
-"OFFSETOF_CURTHREAD does not correspond with offset of pc_curthread.");
-_Static_assert(OFFSETOF_CURPCB == offsetof(struct pcpu, pc_curpcb),
-"OFFSETOF_CURPCB does not correspond with offset of pc_curpcb.");
 _Static_assert(OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf),
 "OFFSETOF_MONITORBUF does not correspond with offset of pc_monitorbuf.");
 

Modified: stable/12/sys/amd64/include/counter.h
==
--- stable/12/sys/amd64/include/counter.h   Fri Oct 25 18:54:06 2019
(r354092)
+++ stable/12/sys/amd64/include/counter.h   Fri Oct 25 18:56:46 2019
(r354093)
@@ -33,9 +33,6 @@
 
 #include 
 
-extern struct pcpu *__pcpu;
-extern struct pcpu 

svn commit: r354092 - in head/sys: netinet netinet6

2019-10-25 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Oct 25 18:54:06 2019
New Revision: 354092
URL: https://svnweb.freebsd.org/changeset/base/354092

Log:
  Properly set VNET when nuking recvif from fragment queues.
  
  In theory the eventhandler invoke should be in the same VNET as
  the the current interface. We however cannot guarantee that for
  all cases in the future.
  
  So before checking if the fragmentation handling for this VNET
  is active, switch the VNET to the VNET of the interface to always
  get the one we want.
  
  Reviewed by:  hselasky
  MFC after:3 weeks
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D22153

Modified:
  head/sys/netinet/ip_reass.c
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet/ip_reass.c
==
--- head/sys/netinet/ip_reass.c Fri Oct 25 18:46:53 2019(r354091)
+++ head/sys/netinet/ip_reass.c Fri Oct 25 18:54:06 2019(r354092)
@@ -632,14 +632,17 @@ ipreass_cleanup(void *arg __unused, struct ifnet *ifp)
 
KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__));
 
+   CURVNET_SET_QUIET(ifp->if_vnet);
+
/*
 * Skip processing if IPv4 reassembly is not initialised or
 * torn down by ipreass_destroy().
 */ 
-   if (V_ipq_zone == NULL)
+   if (V_ipq_zone == NULL) {
+   CURVNET_RESTORE();
return;
+   }
 
-   CURVNET_SET_QUIET(ifp->if_vnet);
for (i = 0; i < IPREASS_NHASH; i++) {
IPQ_LOCK(i);
/* Scan fragment list. */

Modified: head/sys/netinet6/frag6.c
==
--- head/sys/netinet6/frag6.c   Fri Oct 25 18:46:53 2019(r354091)
+++ head/sys/netinet6/frag6.c   Fri Oct 25 18:54:06 2019(r354092)
@@ -307,16 +307,18 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp)
 
KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__));
 
+   CURVNET_SET_QUIET(ifp->if_vnet);
 #ifdef VIMAGE
/*
 * Skip processing if IPv6 reassembly is not initialised or
 * torn down by frag6_destroy().
 */
-   if (!V_frag6_on)
+   if (!V_frag6_on) {
+   CURVNET_RESTORE();
return;
+   }
 #endif
 
-   CURVNET_SET_QUIET(ifp->if_vnet);
for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) {
IP6QB_LOCK(bucket);
head = IP6QB_HEAD(bucket);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354091 - in releng/12.1/sys: netinet netinet6

2019-10-25 Thread Michael Tuexen
Author: tuexen
Date: Fri Oct 25 18:46:53 2019
New Revision: 354091
URL: https://svnweb.freebsd.org/changeset/base/354091

Log:
  MFS r354090:
  
  Ensure that the flags indicating IPv4/IPv6 are not changed by failing
  bind() calls. This would lead to inconsistent state resulting in a panic.
  A fix for stable/11 was committed in
  https://svnweb.freebsd.org/base?view=revision=338986
  
  Reported by:  syzbot+2609a378d89264ff5...@syzkaller.appspotmail.com
  Obtained from:jtl@
  Sponsored by: Netflix, Inc.
  Approved by:  re (gjb@)

Modified:
  releng/12.1/sys/netinet/tcp_usrreq.c
  releng/12.1/sys/netinet6/sctp6_usrreq.c
  releng/12.1/sys/netinet6/udp6_usrreq.c
Directory Properties:
  releng/12.1/   (props changed)

Modified: releng/12.1/sys/netinet/tcp_usrreq.c
==
--- releng/12.1/sys/netinet/tcp_usrreq.cFri Oct 25 18:17:56 2019
(r354090)
+++ releng/12.1/sys/netinet/tcp_usrreq.cFri Oct 25 18:46:53 2019
(r354091)
@@ -345,6 +345,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam,
struct inpcb *inp;
struct tcpcb *tp = NULL;
struct sockaddr_in6 *sin6p;
+   u_char vflagsav;
 
sin6p = (struct sockaddr_in6 *)nam;
if (nam->sa_len != sizeof (*sin6p))
@@ -361,6 +362,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam,
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL"));
INP_WLOCK(inp);
+   vflagsav = inp->inp_vflag;
if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
error = EINVAL;
goto out;
@@ -395,6 +397,8 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam,
error = in6_pcbbind(inp, nam, td->td_ucred);
INP_HASH_WUNLOCK(_tcbinfo);
 out:
+   if (error != 0)
+   inp->inp_vflag = vflagsav;
TCPDEBUG2(PRU_BIND);
TCP_PROBE2(debug__user, tp, PRU_BIND);
INP_WUNLOCK(inp);
@@ -457,6 +461,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct
int error = 0;
struct inpcb *inp;
struct tcpcb *tp = NULL;
+   u_char vflagsav;
 
TCPDEBUG0;
inp = sotoinpcb(so);
@@ -466,6 +471,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct
error = EINVAL;
goto out;
}
+   vflagsav = inp->inp_vflag;
tp = intotcpcb(inp);
TCPDEBUG1();
SOCK_LOCK(so);
@@ -491,6 +497,9 @@ tcp6_usr_listen(struct socket *so, int backlog, struct
if (IS_FASTOPEN(tp->t_flags))
tp->t_tfo_pending = tcp_fastopen_alloc_counter();
 
+   if (error != 0)
+   inp->inp_vflag = vflagsav;
+
 out:
TCPDEBUG2(PRU_LISTEN);
TCP_PROBE2(debug__user, tp, PRU_LISTEN);
@@ -567,6 +576,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
struct inpcb *inp;
struct tcpcb *tp = NULL;
struct sockaddr_in6 *sin6p;
+   u_int8_t incflagsav;
+   u_char vflagsav;
 
TCPDEBUG0;
 
@@ -583,6 +594,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL"));
INP_WLOCK(inp);
+   vflagsav = inp->inp_vflag;
+   incflagsav = inp->inp_inc.inc_flags;
if (inp->inp_flags & INP_TIMEWAIT) {
error = EADDRINUSE;
goto out;
@@ -616,11 +629,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
error = EAFNOSUPPORT;
goto out;
}
-   inp->inp_vflag |= INP_IPV4;
-   inp->inp_vflag &= ~INP_IPV6;
if ((error = prison_remote_ip4(td->td_ucred,
_addr)) != 0)
goto out;
+   inp->inp_vflag |= INP_IPV4;
+   inp->inp_vflag &= ~INP_IPV6;
if ((error = tcp_connect(tp, (struct sockaddr *), td)) != 0)
goto out;
 #ifdef TCP_OFFLOAD
@@ -638,11 +651,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
}
}
 #endif
+   if ((error = prison_remote_ip6(td->td_ucred, >sin6_addr)) != 0)
+   goto out;
inp->inp_vflag &= ~INP_IPV4;
inp->inp_vflag |= INP_IPV6;
inp->inp_inc.inc_flags |= INC_ISIPV6;
-   if ((error = prison_remote_ip6(td->td_ucred, >sin6_addr)) != 0)
-   goto out;
if ((error = tcp6_connect(tp, nam, td)) != 0)
goto out;
 #ifdef TCP_OFFLOAD
@@ -655,6 +668,15 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
error = tp->t_fb->tfb_tcp_output(tp);
 
 out:
+   /*
+* If the implicit bind in the connect call fails, restore
+* the flags we modified.
+*/
+   if (error != 0 && inp->inp_lport == 0) {
+   inp->inp_vflag = vflagsav;
+   

svn commit: r354090 - in stable/12/sys: netinet netinet6

2019-10-25 Thread Michael Tuexen
Author: tuexen
Date: Fri Oct 25 18:17:56 2019
New Revision: 354090
URL: https://svnweb.freebsd.org/changeset/base/354090

Log:
  MFC r354044:
  
  Ensure that the flags indicating IPv4/IPv6 are not changed by failing
  bind() calls. This would lead to inconsistent state resulting in a panic.
  A fix for stable/11 was committed in
  https://svnweb.freebsd.org/base?view=revision=338986
  
  Reported by:  syzbot+2609a378d89264ff5...@syzkaller.appspotmail.com
  Obtained from:jtl@
  Sponsored by: Netflix, Inc.

Modified:
  stable/12/sys/netinet/tcp_usrreq.c
  stable/12/sys/netinet6/sctp6_usrreq.c
  stable/12/sys/netinet6/udp6_usrreq.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/tcp_usrreq.c
==
--- stable/12/sys/netinet/tcp_usrreq.c  Fri Oct 25 18:10:02 2019
(r354089)
+++ stable/12/sys/netinet/tcp_usrreq.c  Fri Oct 25 18:17:56 2019
(r354090)
@@ -345,6 +345,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam,
struct inpcb *inp;
struct tcpcb *tp = NULL;
struct sockaddr_in6 *sin6p;
+   u_char vflagsav;
 
sin6p = (struct sockaddr_in6 *)nam;
if (nam->sa_len != sizeof (*sin6p))
@@ -361,6 +362,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam,
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL"));
INP_WLOCK(inp);
+   vflagsav = inp->inp_vflag;
if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
error = EINVAL;
goto out;
@@ -395,6 +397,8 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam,
error = in6_pcbbind(inp, nam, td->td_ucred);
INP_HASH_WUNLOCK(_tcbinfo);
 out:
+   if (error != 0)
+   inp->inp_vflag = vflagsav;
TCPDEBUG2(PRU_BIND);
TCP_PROBE2(debug__user, tp, PRU_BIND);
INP_WUNLOCK(inp);
@@ -457,6 +461,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct
int error = 0;
struct inpcb *inp;
struct tcpcb *tp = NULL;
+   u_char vflagsav;
 
TCPDEBUG0;
inp = sotoinpcb(so);
@@ -466,6 +471,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct
error = EINVAL;
goto out;
}
+   vflagsav = inp->inp_vflag;
tp = intotcpcb(inp);
TCPDEBUG1();
SOCK_LOCK(so);
@@ -491,6 +497,9 @@ tcp6_usr_listen(struct socket *so, int backlog, struct
if (IS_FASTOPEN(tp->t_flags))
tp->t_tfo_pending = tcp_fastopen_alloc_counter();
 
+   if (error != 0)
+   inp->inp_vflag = vflagsav;
+
 out:
TCPDEBUG2(PRU_LISTEN);
TCP_PROBE2(debug__user, tp, PRU_LISTEN);
@@ -567,6 +576,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
struct inpcb *inp;
struct tcpcb *tp = NULL;
struct sockaddr_in6 *sin6p;
+   u_int8_t incflagsav;
+   u_char vflagsav;
 
TCPDEBUG0;
 
@@ -583,6 +594,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL"));
INP_WLOCK(inp);
+   vflagsav = inp->inp_vflag;
+   incflagsav = inp->inp_inc.inc_flags;
if (inp->inp_flags & INP_TIMEWAIT) {
error = EADDRINUSE;
goto out;
@@ -616,11 +629,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
error = EAFNOSUPPORT;
goto out;
}
-   inp->inp_vflag |= INP_IPV4;
-   inp->inp_vflag &= ~INP_IPV6;
if ((error = prison_remote_ip4(td->td_ucred,
_addr)) != 0)
goto out;
+   inp->inp_vflag |= INP_IPV4;
+   inp->inp_vflag &= ~INP_IPV6;
if ((error = tcp_connect(tp, (struct sockaddr *), td)) != 0)
goto out;
 #ifdef TCP_OFFLOAD
@@ -638,11 +651,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
}
}
 #endif
+   if ((error = prison_remote_ip6(td->td_ucred, >sin6_addr)) != 0)
+   goto out;
inp->inp_vflag &= ~INP_IPV4;
inp->inp_vflag |= INP_IPV6;
inp->inp_inc.inc_flags |= INC_ISIPV6;
-   if ((error = prison_remote_ip6(td->td_ucred, >sin6_addr)) != 0)
-   goto out;
if ((error = tcp6_connect(tp, nam, td)) != 0)
goto out;
 #ifdef TCP_OFFLOAD
@@ -655,6 +668,15 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
error = tp->t_fb->tfb_tcp_output(tp);
 
 out:
+   /*
+* If the implicit bind in the connect call fails, restore
+* the flags we modified.
+*/
+   if (error != 0 && inp->inp_lport == 0) {
+   inp->inp_vflag = vflagsav;
+   inp->inp_inc.inc_flags = incflagsav;
+   }
+

svn commit: r354089 - in head/sys: arm64/conf arm64/rockchip conf

2019-10-25 Thread Emmanuel Vadot
Author: manu
Date: Fri Oct 25 18:10:02 2019
New Revision: 354089
URL: https://svnweb.freebsd.org/changeset/base/354089

Log:
  arm64: rockchip: Add RK3399 TypeC phy driver
  
  This is a driver for the USB3 PHY present in the RK3399.
  While the phy support DP (Display Port) the driver doesn't has we have
  no driver to test this with for now.
  All the lane and pll configuration is just magic values from rockchip.
  While the manual have some info on those registers it's really hard to
  understand how to calculate those values (if there is a way).
  
  MFC after:1 month

Added:
  head/sys/arm64/rockchip/rk_typec_phy.c   (contents, props changed)
Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files.arm64

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Fri Oct 25 18:08:59 2019(r354088)
+++ head/sys/arm64/conf/GENERIC Fri Oct 25 18:10:02 2019(r354089)
@@ -208,6 +208,7 @@ device  pl011
 # USB support
 device aw_usbphy   # Allwinner USB PHY
 device rk_usb2phy  # Rockchip USB2PHY
+device rk_typec_phy# Rockchip TypeC PHY
 device dwcotg  # DWC OTG controller
 device ohci# OHCI USB interface
 device ehci# EHCI USB interface (USB 2.0)

Added: head/sys/arm64/rockchip/rk_typec_phy.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/rockchip/rk_typec_phy.c  Fri Oct 25 18:10:02 2019
(r354089)
@@ -0,0 +1,474 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 Emmanuel Vadot 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Rockchip PHY TYPEC
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "syscon_if.h"
+
+#defineGRF_USB3OTG_BASE(x) (0x2430 + (0x10 * x))
+#defineGRF_USB3OTG_CON0(x) (GRF_USB3OTG_BASE(x) + 0x0)
+#defineGRF_USB3OTG_CON1(x) (GRF_USB3OTG_BASE(x) + 0x4)
+#define USB3OTG_CON1_U3_DIS(1 << 0)
+
+#defineGRF_USB3PHY_BASE(x) (0x0e580 + (0xc * (x)))
+#defineGRF_USB3PHY_CON0(x) (GRF_USB3PHY_BASE(x) + 0x0)
+#define USB3PHY_CON0_USB2_ONLY (1 << 3)
+#defineGRF_USB3PHY_CON1(x) (GRF_USB3PHY_BASE(x) + 0x4)
+#defineGRF_USB3PHY_CON2(x) (GRF_USB3PHY_BASE(x) + 0x8)
+#defineGRF_USB3PHY_STATUS0 0x0e5c0
+#defineGRF_USB3PHY_STATUS1 0x0e5c4
+
+#defineCMN_PLL0_VCOCAL_INIT(0x84 << 2)
+#defineCMN_PLL0_VCOCAL_ITER(0x85 << 2)
+#defineCMN_PLL0_INTDIV (0x94 << 2)
+#defineCMN_PLL0_FRACDIV(0x95 << 2)
+#defineCMN_PLL0_HIGH_THR   (0x96 << 2)
+#defineCMN_PLL0_DSM_DIAG   (0x97 << 2)
+#defineCMN_PLL0_SS_CTRL1   (0x98 << 2)
+#defineCMN_PLL0_SS_CTRL2   (0x99 << 2)
+#defineCMN_DIAG_PLL0_FBH_OVRD  (0x1c0 << 2)
+#defineCMN_DIAG_PLL0_FBL_OVRD  (0x1c1 << 2)
+#defineCMN_DIAG_PLL0_OVRD  (0x1c2 << 2)
+#defineCMN_DIAG_PLL0_V2I_TUNE  (0x1c5 << 2)
+#defineCMN_DIAG_PLL0_CP_TUNE   (0x1c6 << 2)
+#defineCMN_DIAG_PLL0_LF_PROG   (0x1c7 << 2)
+#defineCMN_DIAG_HSCLK_SEL  (0x1e0 << 2)

svn commit: r354088 - in head/sys: arm64/conf arm64/rockchip conf

2019-10-25 Thread Emmanuel Vadot
Author: manu
Date: Fri Oct 25 18:08:59 2019
New Revision: 354088
URL: https://svnweb.freebsd.org/changeset/base/354088

Log:
  arm64: rockchip: Add rk_dwc3 driver
  
  This is a simplebus like driver that attaches the dwc3 child node and
  enable the clocks needed for the module.
  
  MFC after:1 month

Added:
  head/sys/arm64/rockchip/rk_dwc3.c   (contents, props changed)
Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files.arm64

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Fri Oct 25 18:08:25 2019(r354087)
+++ head/sys/arm64/conf/GENERIC Fri Oct 25 18:08:59 2019(r354088)
@@ -215,6 +215,7 @@ device  ehci_mv # Marvell EHCI 
USB interface
 device xhci# XHCI USB interface (USB 3.0)
 device dwc3# Synopsys DWC controller
 device aw_dwc3 # Allwinner DWC3 controller
+device rk_dwc3 # Rockchip DWC3 controller
 device usb # USB Bus (required)
 device ukbd# Keyboard
 device umass   # Disks/Mass storage - Requires scbus 
and da

Added: head/sys/arm64/rockchip/rk_dwc3.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/rockchip/rk_dwc3.c   Fri Oct 25 18:08:59 2019
(r354088)
@@ -0,0 +1,201 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 Emmanuel Vadot 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Rockchip DWC3 glue
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+static struct ofw_compat_data compat_data[] = {
+   { "rockchip,rk3399-dwc3",   1 },
+   { NULL, 0 }
+};
+
+struct rk_dwc3_softc {
+   struct simplebus_softc  sc;
+   device_tdev;
+   clk_t   clk_ref;
+   clk_t   clk_suspend;
+   clk_t   clk_bus;
+   clk_t   clk_axi_perf;
+   clk_t   clk_usb3;
+   clk_t   clk_grf;
+   hwreset_t   rst_usb3;
+};
+
+static int
+rk_dwc3_probe(device_t dev)
+{
+   phandle_t node;
+
+   if (!ofw_bus_status_okay(dev))
+   return (ENXIO);
+
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
+   return (ENXIO);
+
+   /* Binding says that we need a child node for the actual dwc3 
controller */
+   node = ofw_bus_get_node(dev);
+   if (OF_child(node) <= 0)
+   return (ENXIO);
+
+   device_set_desc(dev, "Rockchip RK3399 DWC3");
+   return (BUS_PROBE_DEFAULT);
+}
+
+static int
+rk_dwc3_attach(device_t dev)
+{
+   struct rk_dwc3_softc *sc;
+   device_t cdev;
+   phandle_t node, child;
+   int err;
+
+   sc = device_get_softc(dev);
+   sc->dev = dev;
+   node = ofw_bus_get_node(dev);
+
+   /* Mandatory clocks */
+   if (clk_get_by_ofw_name(dev, 0, "ref_clk", >clk_ref) != 0) {
+   device_printf(dev, "Cannot get ref_clk clock\n");
+   return (ENXIO);
+   }
+   err = clk_enable(sc->clk_ref);
+   if (err != 0) {
+   device_printf(dev, "Could not enable clock %s\n",
+   clk_get_name(sc->clk_ref));
+   return (ENXIO);
+ 

svn commit: r354087 - head/sys/arm64/rockchip/clk

2019-10-25 Thread Emmanuel Vadot
Author: manu
Date: Fri Oct 25 18:08:25 2019
New Revision: 354087
URL: https://svnweb.freebsd.org/changeset/base/354087

Log:
  arm64: rk3399: Add clock and gate for usb3 clocks
  
  MFC after:1 month

Modified:
  head/sys/arm64/rockchip/clk/rk3399_cru.c

Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c
==
--- head/sys/arm64/rockchip/clk/rk3399_cru.cFri Oct 25 17:56:24 2019
(r354086)
+++ head/sys/arm64/rockchip/clk/rk3399_cru.cFri Oct 25 18:08:25 2019
(r354087)
@@ -54,9 +54,18 @@ __FBSDID("$FreeBSD$");
 
 #defineSCLK_USB2PHY0_REF   123
 #defineSCLK_USB2PHY1_REF   124
+#defineSCLK_USB3OTG0_REF   129
+#defineSCLK_USB3OTG1_REF   130
+#defineSCLK_USB3OTG0_SUSPEND   131
+#defineSCLK_USB3OTG1_SUSPEND   132
 #defineACLK_EMMC_CORE  241
 #defineACLK_EMMC_NOC   242
 #defineACLK_EMMC_GRF   243
+#defineACLK_USB3_NOC   245
+#defineACLK_USB3OTG0   246
+#defineACLK_USB3OTG1   247
+#defineACLK_USB3_RKSOC_AXI_PERF248
+#defineACLK_USB3_GRF   249
 #definePCLK_GPIO2  336
 #definePCLK_GPIO3  337
 #definePCLK_GPIO4  338
@@ -103,6 +112,12 @@ static struct rk_cru_gate rk3399_gates[] = {
CRU_GATE(0, "hclk_perilp1_cpll_src", "cpll", 0x320, 1)
CRU_GATE(0, "hclk_perilp1_gpll_src", "gpll", 0x320, 0)
 
+   /* CRU_CLKGATE_CON12 */
+   CRU_GATE(SCLK_USB3OTG0_REF, "sclk_usb3otg0_ref", "xin24m", 0x330, 1)
+   CRU_GATE(SCLK_USB3OTG1_REF, "sclk_usb3otg1_ref", "xin24m", 0x330, 2)
+   CRU_GATE(SCLK_USB3OTG0_SUSPEND, "sclk_usb3otg0_suspend", "xin24m", 
0x330, 3)
+   CRU_GATE(SCLK_USB3OTG1_SUSPEND, "sclk_usb3otg1_suspend", "xin24m", 
0x330, 4)
+
/* CRU_CLKGATE_CON20 */
CRU_GATE(HCLK_HOST0, "hclk_host0", "hclk_perihp", 0x350, 5)
CRU_GATE(HCLK_HOST0_ARB, "hclk_host0_arb", "hclk_perihp", 0x350, 6)
@@ -117,6 +132,13 @@ static struct rk_cru_gate rk3399_gates[] = {
CRU_GATE(PCLK_I2C2, "pclk_rki2c2", "pclk_perilp1", 0x358, 9)
CRU_GATE(PCLK_I2C3, "pclk_rki2c3", "pclk_perilp1", 0x358, 10)
 
+   /* CRU_CLKGATE_CON30 */
+   CRU_GATE(ACLK_USB3_NOC, "aclk_usb3_noc", "aclk_usb3", 0x378, 0)
+   CRU_GATE(ACLK_USB3OTG0, "aclk_usb3otg0", "aclk_usb3", 0x378, 1)
+   CRU_GATE(ACLK_USB3OTG1, "aclk_usb3otg1", "aclk_usb3", 0x378, 2)
+   CRU_GATE(ACLK_USB3_RKSOC_AXI_PERF, "aclk_usb3_rksoc_axi_perf", 
"aclk_usb3", 0x378, 3)
+   CRU_GATE(ACLK_USB3_GRF, "aclk_usb3_grf", "aclk_usb3", 0x378, 4)
+
/* CRU_CLKGATE_CON31 */
CRU_GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_alive", 0x37c, 3)
CRU_GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_alive", 0x37c, 4)
@@ -1066,6 +1088,32 @@ static struct rk_clk_composite_def pclk_perilp1 = {
.flags = RK_CLK_COMPOSITE_HAVE_GATE,
 };
 
+/* USB3 clock */
+
+#defineACLK_USB3   244
+static const char *aclk_usb3_parents[] = {"cpll", "gpll", "npll", "npll"};
+static struct rk_clk_composite_def aclk_usb3 = {
+   .clkdef = {
+   .id = ACLK_USB3,
+   .name = "aclk_usb3",
+   .parent_names = aclk_usb3_parents,
+   .parent_cnt = nitems(aclk_usb3_parents),
+   },
+   /* CRU_CLKSET_CON39 */
+   .muxdiv_offset = 0x19C,
+   .mux_shift = 6,
+   .mux_width = 2,
+
+   .div_shift = 0,
+   .div_width = 5,
+
+   /* CRU_CLKGATE_CON12 */
+   .gate_offset = 0x330,
+   .gate_shift = 0,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_GATE,
+};
+
 /*
  * i2c
  */
@@ -1210,6 +1258,114 @@ static struct rk_clk_composite_def i2c7 = {
.flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
 };
 
+/* USB3 */
+
+#defineSCLK_UPHY0_TCPDPHY_REF  125
+#defineSCLK_UPHY0_TCPDCORE 126
+
+/* Missing xin32k exported by rk808 */
+static const char *uphy0_tcpdphy_ref_parents[] = {"xin24m"};
+
+static struct rk_clk_composite_def uphy0_tcpdphy_ref = {
+   .clkdef = {
+   .id = SCLK_UPHY0_TCPDPHY_REF,
+   .name = "uphy0_tcpdphy_ref",
+   .parent_names = uphy0_tcpdphy_ref_parents,
+   .parent_cnt = nitems(uphy0_tcpdphy_ref_parents),
+   },
+   /* CRU_CLKSET_CON64 */
+   .muxdiv_offset = 0x0200,
+   .mux_shift = 15,
+   .mux_width = 1,
+
+   .div_shift = 8,
+   .div_width = 5,
+
+   /* CRU_CLKGATE_CON13 */
+   .gate_offset = 0x0334,
+   .gate_shift = 4,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
+};
+
+/* Missing xin32k exported by rk808 */
+static const char *uphy0_tcpdcore_parents[] = {"xin24m", "xin24m", "cpll", 
"gpll"};
+
+static struct rk_clk_composite_def uphy0_tcpdcore = {
+   .clkdef = {
+   .id = SCLK_UPHY0_TCPDCORE,
+   .name = 

Re: svn commit: r354049 - in stable/12/sys/amd64: amd64 include

2019-10-25 Thread Alexander Motin
On 25.10.2019 13:26, John Baldwin wrote:
> On 10/24/19 2:10 PM, Alexander Motin wrote:
>> Author: mav
>> Date: Thu Oct 24 21:10:09 2019
>> New Revision: 354049
>> URL: https://svnweb.freebsd.org/changeset/base/354049
>>
>> Log:
>>   MFC r351457 (by kib): amd64: rework PCPU allocation
>>   
>>   Move pcpu KVA out of .bss into dynamically allocated VA at
>>   pmap_bootstrap().  This avoids demoting superpage mapping .data/.bss.
>>   Also it makes possible to use pmap_qenter() for installation of
>>   domain-local pcpu page on NUMA configs.
>>   
>>   Refactor pcpu and IST initialization by moving it to helper functions.
> 
> I'll merge the bhyve change today, but this probably broke bhyve.  There
> was a followup fix from kib with some other fixes for this beyond bhyve,
> or was that just fixes to the actual NUMA allocation of pcpu?

Oops, I've missed the bhyve fix.  Merged it now.  Thanks for notice.

As far as I see, the bhyve issue was one of its kind.  There were few
pcpu allocation fixes, which I merged, and one header reorganization
patch, which I think is cosmetic, so I haven't merged it so far, but
will take another look.

-- 
Alexander Motin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354086 - head/sys/dev/flash

2019-10-25 Thread Emmanuel Vadot
Author: manu
Date: Fri Oct 25 17:56:24 2019
New Revision: 354086
URL: https://svnweb.freebsd.org/changeset/base/354086

Log:
  flash: Add GigaDevice gd25q128 flash
  
  Add this flash chip which is a 128Mb spi flash.
  
  MFC after:1 week

Modified:
  head/sys/dev/flash/mx25l.c

Modified: head/sys/dev/flash/mx25l.c
==
--- head/sys/dev/flash/mx25l.c  Fri Oct 25 17:54:37 2019(r354085)
+++ head/sys/dev/flash/mx25l.c  Fri Oct 25 17:56:24 2019(r354086)
@@ -150,6 +150,7 @@ static struct mx25l_flash_ident flash_devices[] = {
 
/* GigaDevice */
{ "gd25q64",0xc8, 0x4017, 64 * 1024, 128, FL_ERASE_4K },
+   { "gd25q128",   0xc8, 0x4018, 64 * 1024, 256, FL_ERASE_4K },
 };
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354085 - in stable/12/sys/amd64/vmm: . amd

2019-10-25 Thread Alexander Motin
Author: mav
Date: Fri Oct 25 17:54:37 2019
New Revision: 354085
URL: https://svnweb.freebsd.org/changeset/base/354085

Log:
  MFC r351591 (by jhb): Use get_pcpu() to fetch the current CPU's pcpu pointer.
  
  This avoids encoding knowledge about how pcpu objects are allocated and is
  also a few instructions shorter.

Modified:
  stable/12/sys/amd64/vmm/amd/svm.c
  stable/12/sys/amd64/vmm/vmm_host.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/vmm/amd/svm.c
==
--- stable/12/sys/amd64/vmm/amd/svm.c   Fri Oct 25 17:41:08 2019
(r354084)
+++ stable/12/sys/amd64/vmm/amd/svm.c   Fri Oct 25 17:54:37 2019
(r354085)
@@ -102,9 +102,6 @@ SYSCTL_INT(_hw_vmm_svm, OID_AUTO, vmcb_clean, CTLFLAG_
 static MALLOC_DEFINE(M_SVM, "svm", "svm");
 static MALLOC_DEFINE(M_SVM_VLAPIC, "svm-vlapic", "svm-vlapic");
 
-/* Per-CPU context area. */
-extern struct pcpu __pcpu[];
-
 static uint32_t svm_feature = ~0U; /* AMD SVM features. */
 SYSCTL_UINT(_hw_vmm_svm, OID_AUTO, features, CTLFLAG_RDTUN, _feature, 0,
 "SVM features advertised by CPUID.800AH:EDX");
@@ -2054,7 +2051,7 @@ svm_vmrun(void *arg, int vcpu, register_t rip, pmap_t 
/* Launch Virtual Machine. */
VCPU_CTR1(vm, vcpu, "Resume execution at %#lx", state->rip);
svm_dr_enter_guest(gctx);
-   svm_launch(vmcb_pa, gctx, &__pcpu[curcpu]);
+   svm_launch(vmcb_pa, gctx, get_pcpu());
svm_dr_leave_guest(gctx);
 
CPU_CLR_ATOMIC(curcpu, >pm_active);

Modified: stable/12/sys/amd64/vmm/vmm_host.h
==
--- stable/12/sys/amd64/vmm/vmm_host.h  Fri Oct 25 17:41:08 2019
(r354084)
+++ stable/12/sys/amd64/vmm/vmm_host.h  Fri Oct 25 17:54:37 2019
(r354085)
@@ -72,14 +72,11 @@ vmm_get_host_gdtrbase(void)
return ((uint64_t)[NGDT * curcpu]);
 }
 
-struct pcpu;
-extern struct pcpu __pcpu[];
-
 static __inline uint64_t
 vmm_get_host_gsbase(void)
 {
 
-   return ((uint64_t)&__pcpu[curcpu]);
+   return ((uint64_t)get_pcpu());
 }
 
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354084 - head/tests/sys/netinet6/frag6

2019-10-25 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Oct 25 17:41:08 2019
New Revision: 354084
URL: https://svnweb.freebsd.org/changeset/base/354084

Log:
  frag6-test:  update for r354046, conform to 8200 for overlapping fragments
  
  The change to conform to RFC 8200 for overlapping fragments now frees
  the entire reassembly queue if the overlapping fragments are not an
  exact match.
  As a result we do see one less packet in the timeout statistics from
  expiry.  No other statistics change as the event is not counted.
  It can be argued that we should improve the statistics counters in
  that case.
  This test case update should have been committed alongside the original
  commit.
  
  Pointyhat to: bz
  MFC after:3 weeks
  X-MFC with:   r354046
  Sponsored by: Netflix

Modified:
  head/tests/sys/netinet6/frag6/frag6_14.sh

Modified: head/tests/sys/netinet6/frag6/frag6_14.sh
==
--- head/tests/sys/netinet6/frag6/frag6_14.sh   Fri Oct 25 16:59:54 2019
(r354083)
+++ head/tests/sys/netinet6/frag6/frag6_14.sh   Fri Oct 25 17:41:08 2019
(r354084)
@@ -95,7 +95,7 @@ EOF
 0
 6
 2
-4
+3
 0
 0
 0
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354049 - in stable/12/sys/amd64: amd64 include

2019-10-25 Thread John Baldwin
On 10/24/19 2:10 PM, Alexander Motin wrote:
> Author: mav
> Date: Thu Oct 24 21:10:09 2019
> New Revision: 354049
> URL: https://svnweb.freebsd.org/changeset/base/354049
> 
> Log:
>   MFC r351457 (by kib): amd64: rework PCPU allocation
>   
>   Move pcpu KVA out of .bss into dynamically allocated VA at
>   pmap_bootstrap().  This avoids demoting superpage mapping .data/.bss.
>   Also it makes possible to use pmap_qenter() for installation of
>   domain-local pcpu page on NUMA configs.
>   
>   Refactor pcpu and IST initialization by moving it to helper functions.

I'll merge the bhyve change today, but this probably broke bhyve.  There
was a followup fix from kib with some other fixes for this beyond bhyve,
or was that just fixes to the actual NUMA allocation of pcpu?

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354083 - head/sys/vm

2019-10-25 Thread Gleb Smirnoff
Author: glebius
Date: Fri Oct 25 16:59:54 2019
New Revision: 354083
URL: https://svnweb.freebsd.org/changeset/base/354083

Log:
  Add couple more assertions to vm_pager_assert_in().  The bogus page is
  not allowed at ends of the request, and all non-bogus pages must be
  consecutive.
  
  Reviewed by:  kib

Modified:
  head/sys/vm/vm_pager.c

Modified: head/sys/vm/vm_pager.c
==
--- head/sys/vm/vm_pager.c  Fri Oct 25 16:30:24 2019(r354082)
+++ head/sys/vm/vm_pager.c  Fri Oct 25 16:59:54 2019(r354083)
@@ -257,15 +257,20 @@ vm_pager_assert_in(vm_object_t object, vm_page_t *m, i
 {
 #ifdef INVARIANTS
 
-   VM_OBJECT_ASSERT_WLOCKED(object);
-   KASSERT(count > 0, ("%s: 0 count", __func__));
/*
-* All pages must be busied, not mapped, not fully valid,
-* not dirty and belong to the proper object.
+* All pages must be consecutive, busied, not mapped, not fully valid,
+* not dirty and belong to the proper object.  Some pages may be the
+* bogus page, but the first and last pages must be a real ones.
 */
+
+   VM_OBJECT_ASSERT_WLOCKED(object);
+   KASSERT(count > 0, ("%s: 0 count", __func__));
for (int i = 0 ; i < count; i++) {
-   if (m[i] == bogus_page)
+   if (m[i] == bogus_page) {
+   KASSERT(i != 0 && i != count - 1,
+   ("%s: page %d is the bogus page", __func__, i));
continue;
+   }
vm_page_assert_xbusied(m[i]);
KASSERT(!pmap_page_is_mapped(m[i]),
("%s: page %p is mapped", __func__, m[i]));
@@ -275,6 +280,8 @@ vm_pager_assert_in(vm_object_t object, vm_page_t *m, i
("%s: page %p is dirty", __func__, m[i]));
KASSERT(m[i]->object == object,
("%s: wrong object %p/%p", __func__, object, m[i]->object));
+   KASSERT(m[i]->pindex == m[0]->pindex + i,
+   ("%s: page %p isn't consecutive", __func__, m[i]));
}
 #endif
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354081 - head/sys/netinet6

2019-10-25 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Oct 25 16:29:09 2019
New Revision: 354081
URL: https://svnweb.freebsd.org/changeset/base/354081

Log:
  frag6: do not leak counter in error cases
  
  When allocating the IPv6 fragement packet queue entry we do checks
  against counters and if we pass we increment one of the counters
  to claim the spot.  Right after that we have two cases (malloc and MAC)
  which can both fail in which case we free the entry but never released
  our claim on the counter.  In theory this can lead to not accepting new
  fragments after a long time, especially if it would be MAC "refusing"
  them.
  Rather than immediately subtracting the value in the error case, only
  increment it after these two cases so we can no longer leak it.
  
  MFC after:3 weeks
  Sponsored by: Netflix

Modified:
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet6/frag6.c
==
--- head/sys/netinet6/frag6.c   Fri Oct 25 16:28:39 2019(r354080)
+++ head/sys/netinet6/frag6.c   Fri Oct 25 16:29:09 2019(r354081)
@@ -528,7 +528,6 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
atomic_load_int(_frag6_nfragpackets) >=
(u_int)V_ip6_maxfragpackets)
goto dropfrag;
-   atomic_add_int(_frag6_nfragpackets, 1);
 
/* Allocate IPv6 fragement packet queue entry. */
q6 = (struct ip6q *)malloc(sizeof(struct ip6q), M_FRAG6,
@@ -542,6 +541,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
}
mac_ip6q_create(m, q6);
 #endif
+   atomic_add_int(_frag6_nfragpackets, 1);
 
/* ip6q_nxt will be filled afterwards, from 1st fragment. */
TAILQ_INIT(>ip6q_frags);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354082 - head/sys/dev/superio

2019-10-25 Thread Andriy Gapon
Author: avg
Date: Fri Oct 25 16:30:24 2019
New Revision: 354082
URL: https://svnweb.freebsd.org/changeset/base/354082

Log:
  superio: do not crash if failed to create the character device
  
  MFC after:1 week

Modified:
  head/sys/dev/superio/superio.c

Modified: head/sys/dev/superio/superio.c
==
--- head/sys/dev/superio/superio.c  Fri Oct 25 16:29:09 2019
(r354081)
+++ head/sys/dev/superio/superio.c  Fri Oct 25 16:30:24 2019
(r354082)
@@ -636,7 +636,8 @@ superio_attach(device_t dev)
UID_ROOT, GID_WHEEL, 0600, "superio%d", device_get_unit(dev));
if (sc->chardev == NULL)
device_printf(dev, "failed to create character device\n");
-   sc->chardev->si_drv1 = sc;
+   else
+   sc->chardev->si_drv1 = sc;
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354080 - head/sys/dev/superio

2019-10-25 Thread Andriy Gapon
Author: avg
Date: Fri Oct 25 16:28:39 2019
New Revision: 354080
URL: https://svnweb.freebsd.org/changeset/base/354080

Log:
  superio_io.h: fix the copyright
  
  MFC after:1 week

Modified:
  head/sys/dev/superio/superio_io.h

Modified: head/sys/dev/superio/superio_io.h
==
--- head/sys/dev/superio/superio_io.h   Fri Oct 25 16:07:24 2019
(r354079)
+++ head/sys/dev/superio/superio_io.h   Fri Oct 25 16:28:39 2019
(r354080)
@@ -1,4 +1,6 @@
-/*
+ /*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
  * Copyright (c) 2019 Andriy Gapon
  *
  * Redistribution and use in source and binary forms, with or without
@@ -10,7 +12,7 @@
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354076 - head/sys/dev/ow

2019-10-25 Thread Andriy Gapon
On 25/10/2019 19:06, Ian Lepore wrote:
> I will say if you ever do
> anything like this to code I wrote, I will revert it immediately.

I hope you never write code like:
-   if (sbttons(now - then) < t->t_rdv * 1000)
-   } while ((now - then) / SBT_1US < t->t_slot);

-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354076 - head/sys/dev/ow

2019-10-25 Thread Ian Lepore
On Fri, 2019-10-25 at 19:03 +0300, Andriy Gapon wrote:
> On 25/10/2019 18:56, Ian Lepore wrote:
> > On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote:
> > > On 25/10/2019 18:46, Ian Lepore wrote:
> > > > On Fri, 2019-10-25 at 15:38 +, Andriy Gapon wrote:
> > > > > Author: avg
> > > > > Date: Fri Oct 25 15:38:09 2019
> > > > > New Revision: 354076
> > > > > URL: https://svnweb.freebsd.org/changeset/base/354076
> > > > > 
> > > > > Log:
> > > > >   owc_gpiobus_read_data: compare times in sbintime_t units
> > > > >   
> > > > >   Previously the code used sbttous() before microseconds
> > > > > comparison
> > > > > in one
> > > > >   place, sbttons() and nanoseconds in another, division by
> > > > > SBT_1US
> > > > > and
> > > > >   microseconds in yet another.
> > > > >   
> > > > >   Now the code consistently uses multiplication by SBT_1US to
> > > > > convert
> > > > >   microseconds to sbintime_t before comparing them with
> > > > > periods
> > > > > between
> > > > >   calls to sbinuptime().  This is fast, this is precise
> > > > > enough
> > > > > (below
> > > > >   0.03%) and the periods defined by the protocol cannot
> > > > > overflow.
> > > > >   
> > > > >   Reviewed by:imp (D22108)
> > > > >   MFC after:  2 weeks
> > > > > 
> > > > > Modified:
> > > > >   head/sys/dev/ow/owc_gpiobus.c
> > > > > 
> > > > > Modified: head/sys/dev/ow/owc_gpiobus.c
> > > > > =
> > > > > 
> > > > > 
> > > > > =
> > > > > --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50
> > > > > 2019  (
> > > > > r354
> > > > > 075)
> > > > > +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09
> > > > > 2019  (
> > > > > r354
> > > > > 076)
> > > > > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev,
> > > > > struct
> > > > > ow_timing *
> > > > >   do {
> > > > >   now = sbinuptime();
> > > > >   GETPIN(sc, );
> > > > > - } while (sbttous(now - then) < t->t_rdv + 2 && sample
> > > > > == 0);
> > > > > + } while (now - then < (t->t_rdv + 2) * SBT_1US &&
> > > > > sample == 0);
> > > > >   critical_exit();
> > > > >  
> > > > > - if (sbttons(now - then) < t->t_rdv * 1000)
> > > > > + if (now - then < t->t_rdv * SBT_1US)
> > > > >   *bit = 1;
> > > > >   else
> > > > >   *bit = 0;
> > > > > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev,
> > > > > struct
> > > > > ow_timing *
> > > > >   /* Wait out the rest of t_slot */
> > > > >   do {
> > > > >   now = sbinuptime();
> > > > > - } while ((now - then) / SBT_1US < t->t_slot);
> > > > > + } while (now - then < t->t_slot * SBT_1US);
> > > > >  
> > > > >   RELBUS(sc);
> > > > >  
> > > > 
> > > > Unit conversions with sbt times should be done using the macros
> > > > that
> > > > carefully avoid roundoff errors.  I don't understand why you've
> > > > changed
> > > > the code that correctly did use those macros to inline math.
> > > 
> > > I think that the commit message explains it:
> > > This is fast, this is precise enough (below 0.03%) and the
> > > periods
> > > defined by
> > > the protocol cannot overflow.
> > > 
> > > Do you disagree?
> > > Could you please explain in which of the three lines changed the
> > > new
> > > code is
> > > worse and why?
> > > 
> > 
> > I absolutely disagree (or I wouldn't have replied).  Unit
> > conversions
> > using sbt times should use the predefined macros, NOT incline
> > multiplication and division.  I don't know how to say it more
> > clearly
> > than that.  The conversion macros are idiomatic (at least, they
> > would
> > be if people stopped writing inline conversion expressions).
> 
> I can agree that I should have used ustosbt() instead of
> multiplication by
> SBT_1US, but I don't agree with your original message that I changed
> the code
> that correctly used the macros.
> 
> But again, I know the times being converted, they are fixed by the
> protocol and
> I do not see why I have to use this:
> 
> static __inline sbintime_t
> ustosbt(int64_t _us)
> {
> sbintime_t sb = 0;
> 
> #ifdef KASSERT
> KASSERT(_us >= 0, ("Negative values illegal for ustosbt:
> %jd", _us));
> #endif
> if (_us >= SBT_1S) {
> sb = (_us / 100) * SBT_1S;
> _us = _us % 100;
> }
> /* 9223372036855 = ceil(2^63 / 100) */
> sb += ((_us * 9223372036855ull) + 0x7fff) >> 31;
> return (sb);
> }
> 
> instead of this
> x * (((sbintime_t)1 << 32) / 100)
> 
> The times:
> static struct ow_timing timing_regular = {
> .t_slot = 60,   /* 60 to 120 */
> .t_low0 = 60,   /* really 60 to 120 */
> .t_low1 = 1,/* really 1 to 15 */
> .t_release = 45,/* <= 45us */
> .t_rec = 1, /* at least 1us */
> .t_rdv = 15,/* 15us */
> .t_rstl = 480,  

svn commit: r354079 - head/sys/dev/superio

2019-10-25 Thread Andriy Gapon
Author: avg
Date: Fri Oct 25 16:07:24 2019
New Revision: 354079
URL: https://svnweb.freebsd.org/changeset/base/354079

Log:
  superio: add a simple ioctl interface
  
  MFC after:1 week

Added:
  head/sys/dev/superio/superio_io.h   (contents, props changed)
Modified:
  head/sys/dev/superio/superio.c

Modified: head/sys/dev/superio/superio.c
==
--- head/sys/dev/superio/superio.c  Fri Oct 25 15:46:54 2019
(r354078)
+++ head/sys/dev/superio/superio.c  Fri Oct 25 16:07:24 2019
(r354079)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 #include "isa_if.h"
 
@@ -84,6 +85,7 @@ struct siosc {
struct mtx  conf_lock;
STAILQ_HEAD(, superio_devinfo)  devlist;
struct resource*io_res;
+   struct cdev *chardev;
int io_rid;
uint16_tio_port;
const struct sio_conf_methods   *methods;
@@ -96,6 +98,14 @@ struct siosc {
uint8_t enable_reg;
 };
 
+static d_ioctl_t   superio_ioctl;
+
+static struct cdevsw superio_cdevsw = {
+   .d_version =D_VERSION,
+   .d_ioctl =  superio_ioctl,
+   .d_name =   "superio",
+};
+
 #define NUMPORTS   2
 
 static uint8_t
@@ -621,6 +631,12 @@ superio_attach(device_t dev)
 
bus_generic_probe(dev);
bus_generic_attach(dev);
+
+   sc->chardev = make_dev(_cdevsw, device_get_unit(dev),
+   UID_ROOT, GID_WHEEL, 0600, "superio%d", device_get_unit(dev));
+   if (sc->chardev == NULL)
+   device_printf(dev, "failed to create character device\n");
+   sc->chardev->si_drv1 = sc;
return (0);
 }
 
@@ -633,6 +649,8 @@ superio_detach(device_t dev)
error = bus_generic_detach(dev);
if (error != 0)
return (error);
+   if (sc->chardev != NULL)
+   destroy_dev(sc->chardev);
device_delete_children(dev);
bus_release_resource(dev, SYS_RES_IOPORT, sc->io_rid, sc->io_res);
mtx_destroy(>conf_lock);
@@ -913,6 +931,31 @@ superio_find_dev(device_t superio, superio_dev_type_t 
return (dinfo->dev);
}
return (NULL);
+}
+
+static int
+superio_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags,
+struct thread *td)
+{
+   struct siosc *sc;
+   struct superiocmd *s;
+
+   sc = dev->si_drv1;
+   s = (struct superiocmd *)data;
+   switch (cmd) {
+   case SUPERIO_CR_READ:
+   sio_conf_enter(sc);
+   s->val = sio_ldn_read(sc, s->ldn, s->cr);
+   sio_conf_exit(sc);
+   return (0);
+   case SUPERIO_CR_WRITE:
+   sio_conf_enter(sc);
+   sio_ldn_write(sc, s->ldn, s->cr, s->val);
+   sio_conf_exit(sc);
+   return (0);
+   default:
+   return (ENOTTY);
+   }
 }
 
 static devclass_t superio_devclass;

Added: head/sys/dev/superio/superio_io.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/superio/superio_io.h   Fri Oct 25 16:07:24 2019
(r354079)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2019 Andriy Gapon
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef SUPERIO_IO_H
+#define SUPERIO_IO_H
+
+#include 
+
+struct superiocmd {
+   uint8_t ldn;
+   uint8_t cr;
+   uint8_t val;
+};
+
+#define SUPERIO_CR_READ_IOWR('s', 0, struct superiocmd)
+#define SUPERIO_CR_WRITE   

Re: svn commit: r354076 - head/sys/dev/ow

2019-10-25 Thread Andriy Gapon
On 25/10/2019 18:56, Ian Lepore wrote:
> On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote:
>> On 25/10/2019 18:46, Ian Lepore wrote:
>>> On Fri, 2019-10-25 at 15:38 +, Andriy Gapon wrote:
 Author: avg
 Date: Fri Oct 25 15:38:09 2019
 New Revision: 354076
 URL: https://svnweb.freebsd.org/changeset/base/354076

 Log:
   owc_gpiobus_read_data: compare times in sbintime_t units
   
   Previously the code used sbttous() before microseconds
 comparison
 in one
   place, sbttons() and nanoseconds in another, division by
 SBT_1US
 and
   microseconds in yet another.
   
   Now the code consistently uses multiplication by SBT_1US to
 convert
   microseconds to sbintime_t before comparing them with periods
 between
   calls to sbinuptime().  This is fast, this is precise enough
 (below
   0.03%) and the periods defined by the protocol cannot overflow.
   
   Reviewed by: imp (D22108)
   MFC after:   2 weeks

 Modified:
   head/sys/dev/ow/owc_gpiobus.c

 Modified: head/sys/dev/ow/owc_gpiobus.c
 =
 
 =
 --- head/sys/dev/ow/owc_gpiobus.c  Fri Oct 25 15:02:50 2019(
 r354
 075)
 +++ head/sys/dev/ow/owc_gpiobus.c  Fri Oct 25 15:38:09 2019(
 r354
 076)
 @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct
 ow_timing *
do {
now = sbinuptime();
GETPIN(sc, );
 -  } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0);
 +  } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0);
critical_exit();
  
 -  if (sbttons(now - then) < t->t_rdv * 1000)
 +  if (now - then < t->t_rdv * SBT_1US)
*bit = 1;
else
*bit = 0;
 @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct
 ow_timing *
/* Wait out the rest of t_slot */
do {
now = sbinuptime();
 -  } while ((now - then) / SBT_1US < t->t_slot);
 +  } while (now - then < t->t_slot * SBT_1US);
  
RELBUS(sc);
  
>>>
>>> Unit conversions with sbt times should be done using the macros
>>> that
>>> carefully avoid roundoff errors.  I don't understand why you've
>>> changed
>>> the code that correctly did use those macros to inline math.
>>
>> I think that the commit message explains it:
>> This is fast, this is precise enough (below 0.03%) and the periods
>> defined by
>> the protocol cannot overflow.
>>
>> Do you disagree?
>> Could you please explain in which of the three lines changed the new
>> code is
>> worse and why?
>>
> 
> I absolutely disagree (or I wouldn't have replied).  Unit conversions
> using sbt times should use the predefined macros, NOT incline
> multiplication and division.  I don't know how to say it more clearly
> than that.  The conversion macros are idiomatic (at least, they would
> be if people stopped writing inline conversion expressions).

I can agree that I should have used ustosbt() instead of multiplication by
SBT_1US, but I don't agree with your original message that I changed the code
that correctly used the macros.

But again, I know the times being converted, they are fixed by the protocol and
I do not see why I have to use this:

static __inline sbintime_t
ustosbt(int64_t _us)
{
sbintime_t sb = 0;

#ifdef KASSERT
KASSERT(_us >= 0, ("Negative values illegal for ustosbt: %jd", _us));
#endif
if (_us >= SBT_1S) {
sb = (_us / 100) * SBT_1S;
_us = _us % 100;
}
/* 9223372036855 = ceil(2^63 / 100) */
sb += ((_us * 9223372036855ull) + 0x7fff) >> 31;
return (sb);
}

instead of this
x * (((sbintime_t)1 << 32) / 100)

The times:
static struct ow_timing timing_regular = {
.t_slot = 60,   /* 60 to 120 */
.t_low0 = 60,   /* really 60 to 120 */
.t_low1 = 1,/* really 1 to 15 */
.t_release = 45,/* <= 45us */
.t_rec = 1, /* at least 1us */
.t_rdv = 15,/* 15us */
.t_rstl = 480,  /* 480us or more */
.t_rsth = 480,  /* 480us or more */
.t_pdl = 60,/* 60us to 240us */
.t_pdh = 60,/* 15us to 60us */
.t_lowr = 1,/* 1us */
};


-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354076 - head/sys/dev/ow

2019-10-25 Thread Ian Lepore
On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote:
> On 25/10/2019 18:46, Ian Lepore wrote:
> > On Fri, 2019-10-25 at 15:38 +, Andriy Gapon wrote:
> > > Author: avg
> > > Date: Fri Oct 25 15:38:09 2019
> > > New Revision: 354076
> > > URL: https://svnweb.freebsd.org/changeset/base/354076
> > > 
> > > Log:
> > >   owc_gpiobus_read_data: compare times in sbintime_t units
> > >   
> > >   Previously the code used sbttous() before microseconds
> > > comparison
> > > in one
> > >   place, sbttons() and nanoseconds in another, division by
> > > SBT_1US
> > > and
> > >   microseconds in yet another.
> > >   
> > >   Now the code consistently uses multiplication by SBT_1US to
> > > convert
> > >   microseconds to sbintime_t before comparing them with periods
> > > between
> > >   calls to sbinuptime().  This is fast, this is precise enough
> > > (below
> > >   0.03%) and the periods defined by the protocol cannot overflow.
> > >   
> > >   Reviewed by:imp (D22108)
> > >   MFC after:  2 weeks
> > > 
> > > Modified:
> > >   head/sys/dev/ow/owc_gpiobus.c
> > > 
> > > Modified: head/sys/dev/ow/owc_gpiobus.c
> > > =
> > > 
> > > =
> > > --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019(
> > > r354
> > > 075)
> > > +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019(
> > > r354
> > > 076)
> > > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct
> > > ow_timing *
> > >   do {
> > >   now = sbinuptime();
> > >   GETPIN(sc, );
> > > - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0);
> > > + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0);
> > >   critical_exit();
> > >  
> > > - if (sbttons(now - then) < t->t_rdv * 1000)
> > > + if (now - then < t->t_rdv * SBT_1US)
> > >   *bit = 1;
> > >   else
> > >   *bit = 0;
> > > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct
> > > ow_timing *
> > >   /* Wait out the rest of t_slot */
> > >   do {
> > >   now = sbinuptime();
> > > - } while ((now - then) / SBT_1US < t->t_slot);
> > > + } while (now - then < t->t_slot * SBT_1US);
> > >  
> > >   RELBUS(sc);
> > >  
> > 
> > Unit conversions with sbt times should be done using the macros
> > that
> > carefully avoid roundoff errors.  I don't understand why you've
> > changed
> > the code that correctly did use those macros to inline math.
> 
> I think that the commit message explains it:
> This is fast, this is precise enough (below 0.03%) and the periods
> defined by
> the protocol cannot overflow.
> 
> Do you disagree?
> Could you please explain in which of the three lines changed the new
> code is
> worse and why?
> 

I absolutely disagree (or I wouldn't have replied).  Unit conversions
using sbt times should use the predefined macros, NOT incline
multiplication and division.  I don't know how to say it more clearly
than that.  The conversion macros are idiomatic (at least, they would
be if people stopped writing inline conversion expressions).

-- Ian

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354076 - head/sys/dev/ow

2019-10-25 Thread Andriy Gapon
On 25/10/2019 18:46, Ian Lepore wrote:
> On Fri, 2019-10-25 at 15:38 +, Andriy Gapon wrote:
>> Author: avg
>> Date: Fri Oct 25 15:38:09 2019
>> New Revision: 354076
>> URL: https://svnweb.freebsd.org/changeset/base/354076
>>
>> Log:
>>   owc_gpiobus_read_data: compare times in sbintime_t units
>>   
>>   Previously the code used sbttous() before microseconds comparison
>> in one
>>   place, sbttons() and nanoseconds in another, division by SBT_1US
>> and
>>   microseconds in yet another.
>>   
>>   Now the code consistently uses multiplication by SBT_1US to convert
>>   microseconds to sbintime_t before comparing them with periods
>> between
>>   calls to sbinuptime().  This is fast, this is precise enough (below
>>   0.03%) and the periods defined by the protocol cannot overflow.
>>   
>>   Reviewed by:   imp (D22108)
>>   MFC after: 2 weeks
>>
>> Modified:
>>   head/sys/dev/ow/owc_gpiobus.c
>>
>> Modified: head/sys/dev/ow/owc_gpiobus.c
>> =
>> =
>> --- head/sys/dev/ow/owc_gpiobus.cFri Oct 25 15:02:50 2019(r354
>> 075)
>> +++ head/sys/dev/ow/owc_gpiobus.cFri Oct 25 15:38:09 2019(r354
>> 076)
>> @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct
>> ow_timing *
>>  do {
>>  now = sbinuptime();
>>  GETPIN(sc, );
>> -} while (sbttous(now - then) < t->t_rdv + 2 && sample == 0);
>> +} while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0);
>>  critical_exit();
>>  
>> -if (sbttons(now - then) < t->t_rdv * 1000)
>> +if (now - then < t->t_rdv * SBT_1US)
>>  *bit = 1;
>>  else
>>  *bit = 0;
>> @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct
>> ow_timing *
>>  /* Wait out the rest of t_slot */
>>  do {
>>  now = sbinuptime();
>> -} while ((now - then) / SBT_1US < t->t_slot);
>> +} while (now - then < t->t_slot * SBT_1US);
>>  
>>  RELBUS(sc);
>>  
> 
> Unit conversions with sbt times should be done using the macros that
> carefully avoid roundoff errors.  I don't understand why you've changed
> the code that correctly did use those macros to inline math.

I think that the commit message explains it:
This is fast, this is precise enough (below 0.03%) and the periods defined by
the protocol cannot overflow.

Do you disagree?
Could you please explain in which of the three lines changed the new code is
worse and why?

-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354078 - head/sys/dev/ow

2019-10-25 Thread Andriy Gapon
Author: avg
Date: Fri Oct 25 15:46:54 2019
New Revision: 354078
URL: https://svnweb.freebsd.org/changeset/base/354078

Log:
  owc_gpiobus: add missing space in r354077

Modified:
  head/sys/dev/ow/owc_gpiobus.c

Modified: head/sys/dev/ow/owc_gpiobus.c
==
--- head/sys/dev/ow/owc_gpiobus.c   Fri Oct 25 15:39:46 2019
(r354077)
+++ head/sys/dev/ow/owc_gpiobus.c   Fri Oct 25 15:46:54 2019
(r354078)
@@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing *
/* Wait out the rest of t_slot */
do {
now = sbinuptime();
-   } while (now - then < (t->t_slot + t->t_rec)* SBT_1US);
+   } while (now - then < (t->t_slot + t->t_rec) * SBT_1US);
 
RELBUS(sc);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354076 - head/sys/dev/ow

2019-10-25 Thread Ian Lepore
On Fri, 2019-10-25 at 15:38 +, Andriy Gapon wrote:
> Author: avg
> Date: Fri Oct 25 15:38:09 2019
> New Revision: 354076
> URL: https://svnweb.freebsd.org/changeset/base/354076
> 
> Log:
>   owc_gpiobus_read_data: compare times in sbintime_t units
>   
>   Previously the code used sbttous() before microseconds comparison
> in one
>   place, sbttons() and nanoseconds in another, division by SBT_1US
> and
>   microseconds in yet another.
>   
>   Now the code consistently uses multiplication by SBT_1US to convert
>   microseconds to sbintime_t before comparing them with periods
> between
>   calls to sbinuptime().  This is fast, this is precise enough (below
>   0.03%) and the periods defined by the protocol cannot overflow.
>   
>   Reviewed by:imp (D22108)
>   MFC after:  2 weeks
> 
> Modified:
>   head/sys/dev/ow/owc_gpiobus.c
> 
> Modified: head/sys/dev/ow/owc_gpiobus.c
> =
> =
> --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019(r354
> 075)
> +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019(r354
> 076)
> @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct
> ow_timing *
>   do {
>   now = sbinuptime();
>   GETPIN(sc, );
> - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0);
> + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0);
>   critical_exit();
>  
> - if (sbttons(now - then) < t->t_rdv * 1000)
> + if (now - then < t->t_rdv * SBT_1US)
>   *bit = 1;
>   else
>   *bit = 0;
> @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct
> ow_timing *
>   /* Wait out the rest of t_slot */
>   do {
>   now = sbinuptime();
> - } while ((now - then) / SBT_1US < t->t_slot);
> + } while (now - then < t->t_slot * SBT_1US);
>  
>   RELBUS(sc);
>  

Unit conversions with sbt times should be done using the macros that
carefully avoid roundoff errors.  I don't understand why you've changed
the code that correctly did use those macros to inline math.

-- Ian

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354077 - head/sys/dev/ow

2019-10-25 Thread Andriy Gapon
Author: avg
Date: Fri Oct 25 15:39:46 2019
New Revision: 354077
URL: https://svnweb.freebsd.org/changeset/base/354077

Log:
  owc_gpiobus_read_data: add recovery time to the read slot
  
  Reviewed by:  imp
  MFC after:2 weeks

Modified:
  head/sys/dev/ow/owc_gpiobus.c

Modified: head/sys/dev/ow/owc_gpiobus.c
==
--- head/sys/dev/ow/owc_gpiobus.c   Fri Oct 25 15:38:09 2019
(r354076)
+++ head/sys/dev/ow/owc_gpiobus.c   Fri Oct 25 15:39:46 2019
(r354077)
@@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing *
/* Wait out the rest of t_slot */
do {
now = sbinuptime();
-   } while (now - then < t->t_slot * SBT_1US);
+   } while (now - then < (t->t_slot + t->t_rec)* SBT_1US);
 
RELBUS(sc);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354076 - head/sys/dev/ow

2019-10-25 Thread Andriy Gapon
Author: avg
Date: Fri Oct 25 15:38:09 2019
New Revision: 354076
URL: https://svnweb.freebsd.org/changeset/base/354076

Log:
  owc_gpiobus_read_data: compare times in sbintime_t units
  
  Previously the code used sbttous() before microseconds comparison in one
  place, sbttons() and nanoseconds in another, division by SBT_1US and
  microseconds in yet another.
  
  Now the code consistently uses multiplication by SBT_1US to convert
  microseconds to sbintime_t before comparing them with periods between
  calls to sbinuptime().  This is fast, this is precise enough (below
  0.03%) and the periods defined by the protocol cannot overflow.
  
  Reviewed by:  imp (D22108)
  MFC after:2 weeks

Modified:
  head/sys/dev/ow/owc_gpiobus.c

Modified: head/sys/dev/ow/owc_gpiobus.c
==
--- head/sys/dev/ow/owc_gpiobus.c   Fri Oct 25 15:02:50 2019
(r354075)
+++ head/sys/dev/ow/owc_gpiobus.c   Fri Oct 25 15:38:09 2019
(r354076)
@@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing *
do {
now = sbinuptime();
GETPIN(sc, );
-   } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0);
+   } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0);
critical_exit();
 
-   if (sbttons(now - then) < t->t_rdv * 1000)
+   if (now - then < t->t_rdv * SBT_1US)
*bit = 1;
else
*bit = 0;
@@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing *
/* Wait out the rest of t_slot */
do {
now = sbinuptime();
-   } while ((now - then) / SBT_1US < t->t_slot);
+   } while (now - then < t->t_slot * SBT_1US);
 
RELBUS(sc);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354075 - stable/12/sys/kern

2019-10-25 Thread Alexander Motin
Author: mav
Date: Fri Oct 25 15:02:50 2019
New Revision: 354075
URL: https://svnweb.freebsd.org/changeset/base/354075

Log:
  MFC r353454: Allocate device softc from the device domain.
  
  Since we are trying to bind device interrupt threads to the device domain,
  it should have sense to make memory often accessed by them local. If domain
  is not known, fall back to round-robin.

Modified:
  stable/12/sys/kern/subr_bus.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/subr_bus.c
==
--- stable/12/sys/kern/subr_bus.c   Fri Oct 25 14:55:37 2019
(r354074)
+++ stable/12/sys/kern/subr_bus.c   Fri Oct 25 15:02:50 2019
(r354075)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2523,7 +2524,7 @@ void
 device_set_softc(device_t dev, void *softc)
 {
if (dev->softc && !(dev->flags & DF_EXTERNALSOFTC))
-   free(dev->softc, M_BUS_SC);
+   free_domain(dev->softc, M_BUS_SC);
dev->softc = softc;
if (dev->softc)
dev->flags |= DF_EXTERNALSOFTC;
@@ -2540,7 +2541,7 @@ device_set_softc(device_t dev, void *softc)
 void
 device_free_softc(void *softc)
 {
-   free(softc, M_BUS_SC);
+   free_domain(softc, M_BUS_SC);
 }
 
 /**
@@ -2789,6 +2790,9 @@ device_set_devclass_fixed(device_t dev, const char *cl
 int
 device_set_driver(device_t dev, driver_t *driver)
 {
+   int domain;
+   struct domainset *policy;
+
if (dev->state >= DS_ATTACHED)
return (EBUSY);
 
@@ -2796,7 +2800,7 @@ device_set_driver(device_t dev, driver_t *driver)
return (0);
 
if (dev->softc && !(dev->flags & DF_EXTERNALSOFTC)) {
-   free(dev->softc, M_BUS_SC);
+   free_domain(dev->softc, M_BUS_SC);
dev->softc = NULL;
}
device_set_desc(dev, NULL);
@@ -2805,8 +2809,12 @@ device_set_driver(device_t dev, driver_t *driver)
if (driver) {
kobj_init((kobj_t) dev, (kobj_class_t) driver);
if (!(dev->flags & DF_EXTERNALSOFTC) && driver->size > 0) {
-   dev->softc = malloc(driver->size, M_BUS_SC,
-   M_NOWAIT | M_ZERO);
+   if (bus_get_domain(dev, ) == 0)
+   policy = DOMAINSET_PREF(domain);
+   else
+   policy = DOMAINSET_RR();
+   dev->softc = malloc_domainset(driver->size, M_BUS_SC,
+   policy, M_NOWAIT | M_ZERO);
if (!dev->softc) {
kobj_delete((kobj_t) dev, NULL);
kobj_init((kobj_t) dev, _class);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354074 - stable/12/sys/dev/nvme

2019-10-25 Thread Alexander Motin
Author: mav
Date: Fri Oct 25 14:55:37 2019
New Revision: 354074
URL: https://svnweb.freebsd.org/changeset/base/354074

Log:
  MFC r352630: Make nvme(4) driver some more NUMA aware.
  
   - For each queue pair precalculate CPU and domain it is bound to.
  If queue pairs are not per-CPU, then use the domain of the device.
   - Allocate most of queue pair memory from the domain it is bound to.
   - Bind callouts to the same CPUs as queue pair to avoid migrations.
   - Do not assign queue pairs to each SMT thread.  It just wasted
  resources and increased lock congestions.
   - Remove fixed multiplier of CPUs per queue pair, spread them even.
  This allows to use more queue pairs in some hardware configurations.
   - If queue pair serves multiple CPUs, bind different NVMe devices to
  different CPUs.

Modified:
  stable/12/sys/dev/nvme/nvme_ahci.c
  stable/12/sys/dev/nvme/nvme_ctrlr.c
  stable/12/sys/dev/nvme/nvme_ctrlr_cmd.c
  stable/12/sys/dev/nvme/nvme_pci.c
  stable/12/sys/dev/nvme/nvme_private.h
  stable/12/sys/dev/nvme/nvme_qpair.c
  stable/12/sys/dev/nvme/nvme_sysctl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/nvme/nvme_ahci.c
==
--- stable/12/sys/dev/nvme/nvme_ahci.c  Fri Oct 25 14:51:21 2019
(r354073)
+++ stable/12/sys/dev/nvme/nvme_ahci.c  Fri Oct 25 14:55:37 2019
(r354074)
@@ -96,7 +96,6 @@ nvme_ahci_attach(device_t dev)
 
ctrlr->msix_enabled = 0;
ctrlr->num_io_queues = 1;
-   ctrlr->num_cpus_per_ioq = mp_ncpus;
if (bus_setup_intr(dev, ctrlr->res,
INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_intx_handler,
ctrlr, >tag) != 0) {

Modified: stable/12/sys/dev/nvme/nvme_ctrlr.c
==
--- stable/12/sys/dev/nvme/nvme_ctrlr.c Fri Oct 25 14:51:21 2019
(r354073)
+++ stable/12/sys/dev/nvme/nvme_ctrlr.c Fri Oct 25 14:55:37 2019
(r354074)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include "nvme_private.h"
 
@@ -57,6 +58,9 @@ nvme_ctrlr_construct_admin_qpair(struct nvme_controlle
int error;
 
qpair = >adminq;
+   qpair->id = 0;
+   qpair->cpu = CPU_FFS(_domain[ctrlr->domain]) - 1;
+   qpair->domain = ctrlr->domain;
 
num_entries = NVME_ADMIN_ENTRIES;
TUNABLE_INT_FETCH("hw.nvme.admin_entries", _entries);
@@ -75,22 +79,21 @@ nvme_ctrlr_construct_admin_qpair(struct nvme_controlle
 * The admin queue's max xfer size is treated differently than the
 *  max I/O xfer size.  16KB is sufficient here - maybe even less?
 */
-   error = nvme_qpair_construct(qpair, 
-0, /* qpair ID */
-0, /* vector */
-num_entries,
-NVME_ADMIN_TRACKERS,
-ctrlr);
+   error = nvme_qpair_construct(qpair, num_entries, NVME_ADMIN_TRACKERS,
+ctrlr);
return (error);
 }
 
+#define QP(ctrlr, c)   ((c) * (ctrlr)->num_io_queues / mp_ncpus)
+
 static int
 nvme_ctrlr_construct_io_qpairs(struct nvme_controller *ctrlr)
 {
struct nvme_qpair   *qpair;
uint32_tcap_lo;
uint16_tmqes;
-   int i, error, num_entries, num_trackers, 
max_entries;
+   int c, error, i, n;
+   int num_entries, num_trackers, max_entries;
 
/*
 * NVMe spec sets a hard limit of 64K max entries, but devices may
@@ -130,32 +133,35 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller 
 */
ctrlr->max_hw_pend_io = num_trackers * ctrlr->num_io_queues * 3 / 4;
 
-   /*
-* This was calculated previously when setting up interrupts, but
-*  a controller could theoretically support fewer I/O queues than
-*  MSI-X vectors.  So calculate again here just to be safe.
-*/
-   ctrlr->num_cpus_per_ioq = howmany(mp_ncpus, ctrlr->num_io_queues);
-
ctrlr->ioq = malloc(ctrlr->num_io_queues * sizeof(struct nvme_qpair),
M_NVME, M_ZERO | M_WAITOK);
 
-   for (i = 0; i < ctrlr->num_io_queues; i++) {
+   for (i = c = n = 0; i < ctrlr->num_io_queues; i++, c += n) {
qpair = >ioq[i];
 
/*
 * Admin queue has ID=0. IO queues start at ID=1 -
 *  hence the 'i+1' here.
-*
+*/
+   qpair->id = i + 1;
+   if (ctrlr->num_io_queues > 1) {
+   /* Find number of CPUs served by this queue. */
+   for (n = 1; QP(ctrlr, c + n) == i; n++)
+   ;
+   /* Shuffle multiple NVMe devices between CPUs. 

svn commit: r354073 - in stable/12: share/man/man4 sys/kern sys/powerpc/powernv sys/powerpc/powerpc sys/powerpc/ps3 sys/powerpc/pseries sys/sys sys/x86/x86

2019-10-25 Thread Alexander Motin
Author: mav
Date: Fri Oct 25 14:51:21 2019
New Revision: 354073
URL: https://svnweb.freebsd.org/changeset/base/354073

Log:
  MFC r342771 (by cem): Expose threads-per-core and physical core count 
information
  
  With new sysctls (to the best of our ability do detect them).  Restructured
  smp.4 slightly for clarity (keep relevant stuff closer to the top) while
  documenting.

Modified:
  stable/12/share/man/man4/smp.4
  stable/12/sys/kern/subr_smp.c
  stable/12/sys/powerpc/powernv/platform_powernv.c
  stable/12/sys/powerpc/powerpc/mp_machdep.c
  stable/12/sys/powerpc/ps3/platform_ps3.c
  stable/12/sys/powerpc/pseries/platform_chrp.c
  stable/12/sys/sys/smp.h
  stable/12/sys/x86/x86/mp_x86.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/smp.4
==
--- stable/12/share/man/man4/smp.4  Fri Oct 25 14:46:09 2019
(r354072)
+++ stable/12/share/man/man4/smp.4  Fri Oct 25 14:51:21 2019
(r354073)
@@ -23,7 +23,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 6, 2018
+.Dd January 4, 2019
 .Dt SMP 4
 .Os
 .Sh NAME
@@ -35,27 +35,6 @@
 The
 .Nm
 kernel implements symmetric multi-processor support.
-.Sh COMPATIBILITY
-Support for multi-processor systems is present for all Tier-1
-architectures on
-.Fx .
-Currently, this includes amd64, i386 and sparc64.
-Support is enabled using
-.Cd options SMP .
-It is permissible to use the SMP kernel configuration on non-SMP equipped
-motherboards.
-.Sh I386 NOTES
-For i386 systems, the
-.Nm
-kernel supports motherboards that follow the Intel MP specification,
-version 1.4.
-In addition to
-.Cd options SMP ,
-i386 also requires
-.Cd device apic .
-The
-.Xr mptable 1
-command may be used to view the status of multi-processor support.
 .Pp
 .Nm
 support can be disabled by setting the loader tunable
@@ -66,6 +45,13 @@ The number of CPUs detected by the system is available
 the read-only sysctl variable
 .Va hw.ncpu .
 .Pp
+The number of online threads per CPU core is available in the read-only sysctl
+variable
+.Va kern.smp.threads_per_core .
+The number of physical CPU cores detected by the system is available in the
+read-only sysctl variable
+.Va kern.smp.cores .
+.Pp
 .Fx
 allows specific CPUs on a multi-processor system to be disabled.
 This can be done using the
@@ -74,6 +60,12 @@ tunable, where X is the APIC ID of a CPU.
 Setting this tunable to 1 will result in the corresponding CPU being
 disabled.
 .Pp
+.Fx
+supports simultaneous multithreading on x86 and powerpc platforms.
+On x86, the logical CPUs can be disabled by setting the
+.Va machdep.hyperthreading_allowed
+tunable to zero.
+.Pp
 The
 .Xr sched_ule 4
 scheduler implements CPU topology detection and adjusts the scheduling
@@ -122,13 +114,26 @@ two quad-core processors is:
 .Pp
 This information is used internally by the kernel to schedule related
 tasks on CPUs that are closely grouped together.
-.Pp
-.Fx
-supports hyperthreading on Intel CPU's on the i386 and AMD64 platforms.
-Because using logical CPUs can cause performance penalties under certain loads,
-the logical CPUs can be disabled by setting the
-.Va machdep.hyperthreading_allowed
-tunable to zero.
+.Sh COMPATIBILITY
+Support for multi-processor systems is present for all Tier-1 and Tier-2
+architectures on
+.Fx .
+Currently, this includes x86, powerpc, arm, and sparc64.
+Support is enabled using
+.Cd options SMP .
+It is permissible to use the SMP kernel configuration on non-SMP hardware.
+.Sh I386 NOTES
+For i386 systems, the
+.Nm
+kernel supports motherboards that follow the Intel MP specification,
+version 1.4.
+In addition to
+.Cd options SMP ,
+i386 also requires
+.Cd device apic .
+The
+.Xr mptable 1
+command may be used to view the status of multi-processor support.
 .Sh SEE ALSO
 .Xr cpuset 1 ,
 .Xr mptable 1 ,
@@ -166,3 +171,20 @@ in
 also introduced support for SMP on the sparc64 architecture.
 .Sh AUTHORS
 .An Steve Passe Aq Mt f...@freebsd.org
+.Sh CAVEATS
+The
+.Va kern.smp.threads_per_core
+and
+.Va kern.smp.cores
+sysctl variables are provided as a best-effort guess.
+If an architecture or platform adds SMT and
+.Fx
+has not yet implemented detection, the reported values may be inaccurate.
+In this case,
+.Va kern.smp.threads_per_core
+will report
+.Dv 1
+and
+.Va kern.smp.cores
+will report the same value as
+.Va hw.ncpu .

Modified: stable/12/sys/kern/subr_smp.c
==
--- stable/12/sys/kern/subr_smp.c   Fri Oct 25 14:46:09 2019
(r354072)
+++ stable/12/sys/kern/subr_smp.c   Fri Oct 25 14:51:21 2019
(r354073)
@@ -98,6 +98,14 @@ int smp_cpus = 1;/* how many cpu's running */
 SYSCTL_INT(_kern_smp, OID_AUTO, cpus, CTLFLAG_RD|CTLFLAG_CAPRD, _cpus, 0,
 "Number of CPUs online");
 
+int smp_threads_per_core = 1;  /* how many SMT threads are running per core */
+SYSCTL_INT(_kern_smp, OID_AUTO, threads_per_core, 

svn commit: r354072 - head/sys/arm64/include

2019-10-25 Thread Andrew Turner
Author: andrew
Date: Fri Oct 25 14:46:09 2019
New Revision: 354072
URL: https://svnweb.freebsd.org/changeset/base/354072

Log:
  Remove the arm4 ID register masks, they are not needed after r353641.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/include/armreg.h

Modified: head/sys/arm64/include/armreg.h
==
--- head/sys/arm64/include/armreg.h Fri Oct 25 14:33:07 2019
(r354071)
+++ head/sys/arm64/include/armreg.h Fri Oct 25 14:46:09 2019
(r354072)
@@ -176,7 +176,6 @@
 #defineICC_SRE_EL2_EN  (1U << 3)
 
 /* ID_AA64DFR0_EL1 */
-#defineID_AA64DFR0_MASKUL(0x000ff0f0)
 #defineID_AA64DFR0_DebugVer_SHIFT  0
 #defineID_AA64DFR0_DebugVer_MASK   (UL(0xf) << 
ID_AA64DFR0_DebugVer_SHIFT)
 #defineID_AA64DFR0_DebugVer(x) ((x) & 
ID_AA64DFR0_DebugVer_MASK)
@@ -214,7 +213,6 @@
 #define ID_AA64DFR0_PMSVer_V1  (UL(0x1) << 
ID_AA64DFR0_PMSVer_SHIFT)
 
 /* ID_AA64ISAR0_EL1 */
-#defineID_AA64ISAR0_MASK   UL(0xf0f0)
 #defineID_AA64ISAR0_AES_SHIFT  4
 #defineID_AA64ISAR0_AES_MASK   (UL(0xf) << 
ID_AA64ISAR0_AES_SHIFT)
 #defineID_AA64ISAR0_AES(x) ((x) & ID_AA64ISAR0_AES_MASK)
@@ -269,7 +267,6 @@
 #define ID_AA64ISAR0_DP_IMPL   (UL(0x1) << 
ID_AA64ISAR0_DP_SHIFT)
 
 /* ID_AA64ISAR1_EL1 */
-#defineID_AA64ISAR1_MASK   UL(0x)
 #defineID_AA64ISAR1_DPB_SHIFT  0
 #defineID_AA64ISAR1_DPB_MASK   (UL(0xf) << 
ID_AA64ISAR1_DPB_SHIFT)
 #defineID_AA64ISAR1_DPB(x) ((x) & ID_AA64ISAR1_DPB_MASK)
@@ -312,7 +309,6 @@
 #define ID_AA64ISAR1_GPI_IMPL  (UL(0x1) << 
ID_AA64ISAR1_GPI_SHIFT)
 
 /* ID_AA64MMFR0_EL1 */
-#defineID_AA64MMFR0_MASK   UL(0x)
 #defineID_AA64MMFR0_PARange_SHIFT  0
 #defineID_AA64MMFR0_PARange_MASK   (UL(0xf) << 
ID_AA64MMFR0_PARange_SHIFT)
 #defineID_AA64MMFR0_PARange(x) ((x) & 
ID_AA64MMFR0_PARange_MASK)
@@ -360,7 +356,6 @@
 #define ID_AA64MMFR0_TGran4_NONE   (UL(0xf) << 
ID_AA64MMFR0_TGran4_SHIFT)
 
 /* ID_AA64MMFR1_EL1 */
-#defineID_AA64MMFR1_MASK   UL(0x)
 #defineID_AA64MMFR1_HAFDBS_SHIFT   0
 #defineID_AA64MMFR1_HAFDBS_MASK(UL(0xf) << 
ID_AA64MMFR1_HAFDBS_SHIFT)
 #defineID_AA64MMFR1_HAFDBS(x)  ((x) & ID_AA64MMFR1_HAFDBS_MASK)
@@ -407,7 +402,6 @@
 
 /* ID_AA64MMFR2_EL1 */
 #defineID_AA64MMFR2_EL1S3_0_C0_C7_2
-#defineID_AA64MMFR2_MASK   UL(0x0fff)
 #defineID_AA64MMFR2_CnP_SHIFT  0
 #defineID_AA64MMFR2_CnP_MASK   (UL(0xf) << 
ID_AA64MMFR2_CnP_SHIFT)
 #defineID_AA64MMFR2_CnP(x) ((x) & ID_AA64MMFR2_CnP_MASK)
@@ -445,7 +439,6 @@
 #define ID_AA64MMFR2_NV_IMPL   (UL(0x1) << 
ID_AA64MMFR2_NV_SHIFT)
 
 /* ID_AA64PFR0_EL1 */
-#defineID_AA64PFR0_MASKUL(0x000f)
 #defineID_AA64PFR0_EL0_SHIFT   0
 #defineID_AA64PFR0_EL0_MASK(UL(0xf) << 
ID_AA64PFR0_EL0_SHIFT)
 #defineID_AA64PFR0_EL0(x)  ((x) & ID_AA64PFR0_EL0_MASK)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354071 - stable/12/sys/ufs/ffs

2019-10-25 Thread Mark Johnston
Author: markj
Date: Fri Oct 25 14:33:07 2019
New Revision: 354071
URL: https://svnweb.freebsd.org/changeset/base/354071

Log:
  MFC r353733:
  Abbreviate softdep lock names.

Modified:
  stable/12/sys/ufs/ffs/ffs_softdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/ufs/ffs/ffs_softdep.c
==
--- stable/12/sys/ufs/ffs/ffs_softdep.c Fri Oct 25 14:30:27 2019
(r354070)
+++ stable/12/sys/ufs/ffs/ffs_softdep.c Fri Oct 25 14:33:07 2019
(r354071)
@@ -975,7 +975,7 @@ static  int softdep_count_dependencies(struct buf *bp, 
  * Global lock over all of soft updates.
  */
 static struct mtx lk;
-MTX_SYSINIT(softdep_lock, , "Global Softdep Lock", MTX_DEF);
+MTX_SYSINIT(softdep_lock, , "global softdep", MTX_DEF);
 
 #define ACQUIRE_GBLLOCK(lk)mtx_lock(lk)
 #define FREE_GBLLOCK(lk)   mtx_unlock(lk)
@@ -2478,7 +2478,7 @@ softdep_mount(devvp, mp, fs, cred)
ump = VFSTOUFS(mp);
ump->um_softdep = sdp;
MNT_IUNLOCK(mp);
-   rw_init(LOCK_PTR(ump), "Per-Filesystem Softdep Lock");
+   rw_init(LOCK_PTR(ump), "per-fs softdep");
sdp->sd_ump = ump;
LIST_INIT(>softdep_workitem_pending);
LIST_INIT(>softdep_journal_pending);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354070 - head/sys/arm64/arm64

2019-10-25 Thread Andrew Turner
Author: andrew
Date: Fri Oct 25 14:30:27 2019
New Revision: 354070
URL: https://svnweb.freebsd.org/changeset/base/354070

Log:
  Make special register names lowercase so they don't conflict with future
  ID register macros.
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/identcpu.c

Modified: head/sys/arm64/arm64/identcpu.c
==
--- head/sys/arm64/arm64/identcpu.c Fri Oct 25 14:20:59 2019
(r354069)
+++ head/sys/arm64/arm64/identcpu.c Fri Oct 25 14:30:27 2019
(r354070)
@@ -1187,15 +1187,15 @@ identify_cpu(void)
cpu_desc[cpu].mpidr = get_mpidr();
CPU_AFFINITY(cpu) = cpu_desc[cpu].mpidr & CPU_AFF_MASK;
 
-   cpu_desc[cpu].id_aa64dfr0 = READ_SPECIALREG(ID_AA64DFR0_EL1);
-   cpu_desc[cpu].id_aa64dfr1 = READ_SPECIALREG(ID_AA64DFR1_EL1);
-   cpu_desc[cpu].id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1);
-   cpu_desc[cpu].id_aa64isar1 = READ_SPECIALREG(ID_AA64ISAR1_EL1);
-   cpu_desc[cpu].id_aa64mmfr0 = READ_SPECIALREG(ID_AA64MMFR0_EL1);
-   cpu_desc[cpu].id_aa64mmfr1 = READ_SPECIALREG(ID_AA64MMFR1_EL1);
-   cpu_desc[cpu].id_aa64mmfr2 = READ_SPECIALREG(ID_AA64MMFR2_EL1);
-   cpu_desc[cpu].id_aa64pfr0 = READ_SPECIALREG(ID_AA64PFR0_EL1);
-   cpu_desc[cpu].id_aa64pfr1 = READ_SPECIALREG(ID_AA64PFR1_EL1);
+   cpu_desc[cpu].id_aa64dfr0 = READ_SPECIALREG(id_aa64dfr0_el1);
+   cpu_desc[cpu].id_aa64dfr1 = READ_SPECIALREG(id_aa64dfr1_el1);
+   cpu_desc[cpu].id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1);
+   cpu_desc[cpu].id_aa64isar1 = READ_SPECIALREG(id_aa64isar1_el1);
+   cpu_desc[cpu].id_aa64mmfr0 = READ_SPECIALREG(id_aa64mmfr0_el1);
+   cpu_desc[cpu].id_aa64mmfr1 = READ_SPECIALREG(id_aa64mmfr1_el1);
+   cpu_desc[cpu].id_aa64mmfr2 = READ_SPECIALREG(id_aa64mmfr2_el1);
+   cpu_desc[cpu].id_aa64pfr0 = READ_SPECIALREG(id_aa64pfr0_el1);
+   cpu_desc[cpu].id_aa64pfr1 = READ_SPECIALREG(id_aa64pfr1_el1);
 
if (cpu != 0) {
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354069 - head/sys/dev/ow

2019-10-25 Thread Andriy Gapon
Author: avg
Date: Fri Oct 25 14:20:59 2019
New Revision: 354069
URL: https://svnweb.freebsd.org/changeset/base/354069

Log:
  owc_gpiobus_read_data: disable preemption earlier
  
  Now this is done before starting the low pulse that has rather tight
  timing.
  
  Reviewed by:  imp (D22108)
  MFC after:2 weeks

Modified:
  head/sys/dev/ow/owc_gpiobus.c

Modified: head/sys/dev/ow/owc_gpiobus.c
==
--- head/sys/dev/ow/owc_gpiobus.c   Fri Oct 25 13:47:17 2019
(r354068)
+++ head/sys/dev/ow/owc_gpiobus.c   Fri Oct 25 14:20:59 2019
(r354069)
@@ -279,6 +279,8 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing *
if (error != 0)
return (error);
 
+   critical_enter();
+
/* Force low for t_lowr microseconds */
then = sbinuptime();
OUTPIN(sc);
@@ -291,7 +293,6 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing *
 * master's pushing the line low.
 */
INPIN(sc);
-   critical_enter();
do {
now = sbinuptime();
GETPIN(sc, );
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354068 - head/sys/dev/ow

2019-10-25 Thread Andriy Gapon
Author: avg
Date: Fri Oct 25 13:47:17 2019
New Revision: 354068
URL: https://svnweb.freebsd.org/changeset/base/354068

Log:
  ow_temp: better scopes for the lock
  
  The lock is used only for start / stop signaling.
  It is used only for 'flags' field and the related condition variable.
  
  This change is a follow-up to r354067, it was suggested by Warner in
  D22107.
  
  Suggested by: imp
  MFC after:1 week

Modified:
  head/sys/dev/ow/ow_temp.c

Modified: head/sys/dev/ow/ow_temp.c
==
--- head/sys/dev/ow/ow_temp.c   Fri Oct 25 13:42:36 2019(r354067)
+++ head/sys/dev/ow/ow_temp.c   Fri Oct 25 13:47:17 2019(r354068)
@@ -145,9 +145,9 @@ ow_temp_event_thread(void *arg)
sc->flags |= OW_TEMP_RUNNING;
mtx_unlock(>temp_lock);
ow_temp_read_power_supply(sc->dev, >parasite);
-   mtx_lock(>temp_lock);
if (sc->parasite)
device_printf(sc->dev, "Running in parasitic mode 
unsupported\n");
+   mtx_lock(>temp_lock);
while ((sc->flags & OW_TEMP_DONE) == 0) {
mtx_unlock(>temp_lock);
ow_temp_convert_t(sc->dev);
@@ -155,10 +155,9 @@ ow_temp_event_thread(void *arg)
msleep(sc, >temp_lock, 0, "owtcvt", hz);
if (sc->flags & OW_TEMP_DONE)
break;
+   mtx_unlock(>temp_lock);
for (retries = 5; retries > 0; retries--) {
-   mtx_unlock(>temp_lock);
rv = ow_temp_read_scratchpad(sc->dev, scratch, 
sizeof(scratch));
-   mtx_lock(>temp_lock);
if (rv == 0) {
crc = own_crc(sc->dev, scratch, sizeof(scratch) 
- 1);
if (crc == scratch[8]) {
@@ -182,6 +181,7 @@ ow_temp_event_thread(void *arg)
} else
sc->bad_reads++;
}
+   mtx_lock(>temp_lock);
msleep(sc, >temp_lock, 0, "owtcvt", sc->reading_interval);
}
sc->flags &= ~OW_TEMP_RUNNING;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354067 - head/sys/dev/ow

2019-10-25 Thread Andriy Gapon
Author: avg
Date: Fri Oct 25 13:42:36 2019
New Revision: 354067
URL: https://svnweb.freebsd.org/changeset/base/354067

Log:
  ow_temp: drop the lock around a call that can sleep
  
  This is similar to what is done around other calls that lead to
  own_command_wait() that can sleep.
  
  Reviewed by:  imp
  MFC after:1 week
  Differential Revision: https://reviews.freebsd.org/D22107

Modified:
  head/sys/dev/ow/ow_temp.c

Modified: head/sys/dev/ow/ow_temp.c
==
--- head/sys/dev/ow/ow_temp.c   Fri Oct 25 12:46:06 2019(r354066)
+++ head/sys/dev/ow/ow_temp.c   Fri Oct 25 13:42:36 2019(r354067)
@@ -143,7 +143,9 @@ ow_temp_event_thread(void *arg)
pause("owtstart", device_get_unit(sc->dev) * hz / 100); // 10ms stagger
mtx_lock(>temp_lock);
sc->flags |= OW_TEMP_RUNNING;
+   mtx_unlock(>temp_lock);
ow_temp_read_power_supply(sc->dev, >parasite);
+   mtx_lock(>temp_lock);
if (sc->parasite)
device_printf(sc->dev, "Running in parasitic mode 
unsupported\n");
while ((sc->flags & OW_TEMP_DONE) == 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354060 - in stable/12: . sbin/ifconfig share/man/man4 sys/amd64/conf sys/arm/conf sys/arm64/conf sys/conf sys/i386/

2019-10-25 Thread Kyle Evans
On Thu, Oct 24, 2019 at 11:50 PM Helge Oldach  wrote:
>
> Hi,
>
> Kyle Evans wrote on Fri, 25 Oct 2019 03:10:08 +0200 (CEST):
> > Author: kevans
> > Date: Fri Oct 25 01:10:08 2019
> > New Revision: 354060
> > URL: https://svnweb.freebsd.org/changeset/base/354060
> >
> > Log:
> >   MFC tun/tap merge: r347241, r347394, r347404, r347483, r351220, r351229,
> >   r352148, r353056-r353057, r353781-r353782, r353785-r353786, r353877
>
> > Modified: stable/12/UPDATING
> > ==
> > --- stable/12/UPDATINGFri Oct 25 00:47:37 2019(r354059)
> > +++ stable/12/UPDATINGFri Oct 25 01:10:08 2019(r354060)
> > @@ -16,6 +16,14 @@ from older versions of FreeBSD, try WITHOUT_CLANG and
> >  the tip of head, and then rebuild without this option. The bootstrap 
> > process
> >  from older version of current across the gcc/clang cutover is a bit 
> > fragile.
> >
> > +20191024:
> > + The tap(4) driver has been folded into tun(4), and the module has been
> > + renamed to tuntap.  You should update any kld_load="if_tap" or
> > + kld_load="if_tun" entries in /etc/rc.conf, if_tap_load="YES" or
> > + if_tun_load="YES" entries in /boot/loader.conf to load the if_tuntap
> > + module instead, and "device tap" or "device tun" entries in kernel
> > + config files to select the tuntap device instead.
> > +
>
> Should the /etc/rc.conf reference read kld_list instead of kld_load?
>

Ah, but of course I would do it a second time. Fixed in r354066- thanks!
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354066 - stable/12

2019-10-25 Thread Kyle Evans
Author: kevans
Date: Fri Oct 25 12:46:06 2019
New Revision: 354066
URL: https://svnweb.freebsd.org/changeset/base/354066

Log:
  MFC r352387: Fix if_tuntap UPDATING entry
  
  Reported by:  yuripv [originally]
  Reported by:  Helge Oldach (free...@oldach.net) [this time]

Modified:
  stable/12/UPDATING
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/UPDATING
==
--- stable/12/UPDATING  Fri Oct 25 09:37:54 2019(r354065)
+++ stable/12/UPDATING  Fri Oct 25 12:46:06 2019(r354066)
@@ -18,8 +18,8 @@ from older version of current across the gcc/clang cut
 
 20191024:
The tap(4) driver has been folded into tun(4), and the module has been
-   renamed to tuntap.  You should update any kld_load="if_tap" or
-   kld_load="if_tun" entries in /etc/rc.conf, if_tap_load="YES" or
+   renamed to tuntap.  You should update any kld_list="if_tap" or
+   kld_list="if_tun" entries in /etc/rc.conf, if_tap_load="YES" or
if_tun_load="YES" entries in /boot/loader.conf to load the if_tuntap
module instead, and "device tap" or "device tun" entries in kernel
config files to select the tuntap device instead.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354065 - head/sys/dev/gpio

2019-10-25 Thread Andriy Gapon
Author: avg
Date: Fri Oct 25 09:37:54 2019
New Revision: 354065
URL: https://svnweb.freebsd.org/changeset/base/354065

Log:
  gpioiic: set output after switching to output mode if presetting it failed
  
  Some controllers cannot preset future output value while the pin is in
  input mode.  This adds a fallback for those controllers.  The new code
  assumes that a controller reports an error in that case.
  
  For example, all hardware supported by nctgpio behaves in that way.
  
  This is a temporary measure.  In the future we will use
  GPIO_PIN_PRESET_LOW / GPIO_PIN_PRESET_HIGH to preset the output either
  in hardware, if supported, or in software (e.g., in
  gpiobus_pin_setflags).
  
  While here, I extracted common functionality of gpioiic_set{sda,scl} and
  gpioiic_get{sda,scl} to gpioiic_setpin and gpioiic_getpin respectively.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/gpio/gpioiic.c

Modified: head/sys/dev/gpio/gpioiic.c
==
--- head/sys/dev/gpio/gpioiic.c Fri Oct 25 09:24:41 2019(r354064)
+++ head/sys/dev/gpio/gpioiic.c Fri Oct 25 09:37:54 2019(r354065)
@@ -168,59 +168,67 @@ gpioiic_reset_bus(device_t dev)
 }
 
 static void
-gpioiic_setsda(device_t dev, int val)
+gpioiic_setpin(struct gpioiic_softc *sc, int pin, int val)
 {
-   struct gpioiic_softc*sc = device_get_softc(dev);
+   int err;
 
if (val == 0) {
-   GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, 0);
-   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin,
+   err = GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0);
+   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin,
GPIO_PIN_OUTPUT);
+
+   /*
+* Some controllers cannot set output value while a pin is in
+* input mode.
+*/
+   if (err != 0)
+   GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0);
} else {
-   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin,
+   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin,
GPIO_PIN_INPUT);
}
 }
 
 static void
+gpioiic_setsda(device_t dev, int val)
+{
+   struct gpioiic_softc*sc = device_get_softc(dev);
+
+   gpioiic_setpin(sc, sc->sda_pin, val);
+}
+
+static void
 gpioiic_setscl(device_t dev, int val)
 {
struct gpioiic_softc*sc = device_get_softc(dev);
 
-   if (val == 0) {
-   GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, 0);
-   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin,
-   GPIO_PIN_OUTPUT);
-   } else {
-   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin,
-   GPIO_PIN_INPUT);
-   }
+   gpioiic_setpin(sc, sc->scl_pin, val);
 }
 
 static int
-gpioiic_getscl(device_t dev)
+gpioiic_getpin(struct gpioiic_softc *sc, int pin)
 {
-   struct gpioiic_softc*sc = device_get_softc(dev);
unsigned intval;
 
-   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin,
-   GPIO_PIN_INPUT);
-   GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, );
-
+   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_INPUT);
+   GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, pin, );
return ((int)val);
 }
 
 static int
-gpioiic_getsda(device_t dev)
+gpioiic_getscl(device_t dev)
 {
struct gpioiic_softc*sc = device_get_softc(dev);
-   unsigned intval;
 
-   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin,
-   GPIO_PIN_INPUT);
-   GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, );
+   return (gpioiic_getpin(sc, sc->scl_pin));
+}
 
-   return ((int)val);
+static int
+gpioiic_getsda(device_t dev)
+{
+   struct gpioiic_softc*sc = device_get_softc(dev);
+
+   return (gpioiic_getpin(sc, sc->sda_pin));
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354064 - stable/11/sys/dev/gpio

2019-10-25 Thread Andriy Gapon
Author: avg
Date: Fri Oct 25 09:24:41 2019
New Revision: 354064
URL: https://svnweb.freebsd.org/changeset/base/354064

Log:
  MFC r353727: gpioiic: add the detach method

Modified:
  stable/11/sys/dev/gpio/gpioiic.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/gpio/gpioiic.c
==
--- stable/11/sys/dev/gpio/gpioiic.cFri Oct 25 09:23:53 2019
(r354063)
+++ stable/11/sys/dev/gpio/gpioiic.cFri Oct 25 09:24:41 2019
(r354064)
@@ -141,6 +141,15 @@ gpioiic_attach(device_t dev)
return (0);
 }
 
+static int
+gpioiic_detach(device_t dev)
+{
+
+   bus_generic_detach(dev);
+   device_delete_children(dev);
+   return (0);
+}
+
 /*
  * Reset bus by setting SDA first and then SCL. 
  * Must always be called with gpio bus locked.
@@ -239,7 +248,7 @@ static device_method_t gpioiic_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, gpioiic_probe),
DEVMETHOD(device_attach,gpioiic_attach),
-   DEVMETHOD(device_detach,bus_generic_detach),
+   DEVMETHOD(device_detach,gpioiic_detach),
 
/* iicbb interface */
DEVMETHOD(iicbb_setsda, gpioiic_setsda),
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354063 - stable/12/sys/dev/gpio

2019-10-25 Thread Andriy Gapon
Author: avg
Date: Fri Oct 25 09:23:53 2019
New Revision: 354063
URL: https://svnweb.freebsd.org/changeset/base/354063

Log:
  MFC r353727: gpioiic: add the detach method

Modified:
  stable/12/sys/dev/gpio/gpioiic.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/gpio/gpioiic.c
==
--- stable/12/sys/dev/gpio/gpioiic.cFri Oct 25 09:19:15 2019
(r354062)
+++ stable/12/sys/dev/gpio/gpioiic.cFri Oct 25 09:23:53 2019
(r354063)
@@ -143,6 +143,15 @@ gpioiic_attach(device_t dev)
return (0);
 }
 
+static int
+gpioiic_detach(device_t dev)
+{
+
+   bus_generic_detach(dev);
+   device_delete_children(dev);
+   return (0);
+}
+
 /*
  * Reset bus by setting SDA first and then SCL. 
  * Must always be called with gpio bus locked.
@@ -241,7 +250,7 @@ static device_method_t gpioiic_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, gpioiic_probe),
DEVMETHOD(device_attach,gpioiic_attach),
-   DEVMETHOD(device_detach,bus_generic_detach),
+   DEVMETHOD(device_detach,gpioiic_detach),
 
/* iicbb interface */
DEVMETHOD(iicbb_setsda, gpioiic_setsda),
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354062 - head/cddl/contrib/opensolaris/cmd/zfs

2019-10-25 Thread Andriy Gapon
Author: avg
Date: Fri Oct 25 09:19:15 2019
New Revision: 354062
URL: https://svnweb.freebsd.org/changeset/base/354062

Log:
  zfs.8: fix a typo in the date
  
  Reported by:  Trond Endrestøl 
  MFC after:3 days

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs.8

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Oct 25 04:44:17 2019
(r354061)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Oct 25 09:19:15 2019
(r354062)
@@ -32,7 +32,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Octover 16, 2019
+.Dd October 16, 2019
 .Dt ZFS 8
 .Os
 .Sh NAME
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"