Re: svn commit: r330884 - in head/sys: dev/cxgbe dev/cxgbe/firmware dev/cxgbe/tom modules/cxgbe/tom

2018-03-13 Thread O. Hartmann
On Tue, 13 Mar 2018 23:05:51 + (UTC)
John Baldwin  wrote:

> Author: jhb
> Date: Tue Mar 13 23:05:51 2018
> New Revision: 330884
> URL: https://svnweb.freebsd.org/changeset/base/330884
> 
> Log:
>   Support for TLS offload of TOE connections on T6 adapters.
>   
>   The TOE engine in Chelsio T6 adapters supports offloading of TLS
>   encryption and TCP segmentation for offloaded connections.  Sockets
>   using TLS are required to use a set of custom socket options to upload
>   RX and TX keys to the NIC and to enable RX processing.  Currently
>   these socket options are implemented as TCP options in the vendor
>   specific range.  A patched OpenSSL library will be made available in a
>   port / package for use with the TLS TOE support.
>   
>   TOE sockets can either offload both transmit and reception of TLS
>   records or just transmit.  TLS offload (both RX and TX) is enabled by
>   setting the dev.t6nex..tls sysctl to 1 and requires TOE to be
>   enabled on the relevant interface.  Transmit offload can be used on
>   any "normal" or TLS TOE socket by using the custom socket option to
>   program a transmit key.  This permits most TOE sockets to
>   transparently offload TLS when applications use a patched SSL library
>   (e.g. using LD_LIBRARY_PATH to request use of a patched OpenSSL
>   library).  Receive offload can only be used with TOE sockets using the
>   TLS mode.  The dev.t6nex.0.toe.tls_rx_ports sysctl can be set to a
>   list of TCP port numbers.  Any connection with either a local or
>   remote port number in that list will be created as a TLS socket rather
>   than a plain TOE socket.  Note that although this sysctl accepts an
>   arbitrary list of port numbers, the sysctl(8) tool is only able to set
>   sysctl nodes to a single value.  A TLS socket will hang without
>   receiving data if used by an application that is not using a patched
>   SSL library.  Thus, the tls_rx_ports node should be used with care.
>   For a server mostly concerned with offloading TLS transmit, this node
>   is not needed as plain TOE sockets will fall back to software crypto
>   when using an unpatched SSL library.
>   
>   New per-interface statistics nodes are added giving counts of TLS
>   packets and payload bytes (payload bytes do not include TLS headers or
>   authentication tags/MACs) offloaded via the TOE engine, e.g.:
>   
>   dev.cc.0.stats.rx_tls_octets: 149
>   dev.cc.0.stats.rx_tls_records: 13
>   dev.cc.0.stats.tx_tls_octets: 26501823
>   dev.cc.0.stats.tx_tls_records: 1620
>   
>   TLS transmit work requests are constructed by a new variant of
>   t4_push_frames() called t4_push_tls_records() in tom/t4_tls.c.
>   
>   TLS transmit work requests require a buffer containing IVs.  If the
>   IVs are too large to fit into the work request, a separate buffer is
>   allocated when constructing a work request.  This buffer is associated
>   with the transmit descriptor and freed when the descriptor is ACKed by
>   the adapter.
>   
>   Received TLS frames use two new CPL messages.  The first message is a
>   CPL_TLS_DATA containing the decryped payload of a single TLS record.
>   The handler places the mbuf containing the received payload on an
>   mbufq in the TOE pcb.  The second message is a CPL_RX_TLS_CMP message
>   which includes a copy of the TLS header and indicates if there were
>   any errors.  The handler for this message places the TLS header into
>   the socket buffer followed by the saved mbuf with the payload data.
>   Both of these handlers are contained in tom/t4_tls.c.
>   
>   A few routines were exposed from t4_cpl_io.c for use by t4_tls.c
>   including send_rx_credits(), a new send_rx_modulate(), and
>   t4_close_conn().
>   
>   TLS keys for both transmit and receive are stored in onboard memory
>   in the NIC in the "TLS keys" memory region.
>   
>   In some cases a TLS socket can hang with pending data available in the
>   NIC that is not delivered to the host.  As a workaround, TLS sockets
>   are more aggressive about sending CPL_RX_DATA_ACK messages anytime that
>   any data is read from a TLS socket.  In addition, a fallback timer will
>   periodically send CPL_RX_DATA_ACK messages to the NIC for connections
>   that are still in the handshake phase.  Once the connection has
>   finished the handshake and programmed RX keys via the socket option,
>   the timer is stopped.
>   
>   A new function select_ulp_mode() is used to determine what sub-mode a
>   given TOE socket should use (plain TOE, DDP, or TLS).  The existing
>   set_tcpddp_ulp_mode() function has been renamed to set_ulp_mode() and
>   handles initialization of TLS-specific state when necessary in
>   addition to DDP-specific state.
>   
>   Since TLS sockets do not receive individual TCP segments but always
>   receive full TLS records, they can receive more data than is available
>   in the current window (e.g. if a 16k TLS record is received but the
>   socket buffer is itself 16k).  To 

svn commit: r330908 - in releng/11.1: . sys/amd64/amd64 sys/amd64/ia32 sys/amd64/include sys/amd64/vmm sys/amd64/vmm/intel sys/conf sys/dev/cpuctl sys/dev/hyperv/vmbus sys/dev/hyperv/vmbus/amd64 sy...

2018-03-13 Thread Gordon Tetlow
Author: gordon
Date: Wed Mar 14 04:00:00 2018
New Revision: 330908
URL: https://svnweb.freebsd.org/changeset/base/330908

Log:
  Add mitigations for two classes of speculative execution vulnerabilities
  on amd64. [FreeBSD-SA-18:03.speculative_execution]
  
  Approved by:  so
  Security: FreeBSD-SA-18:03.speculative_execution
  Security: CVE-2017-5715
  Security: CVE-2017-5754

Modified:
  releng/11.1/UPDATING
  releng/11.1/sys/amd64/amd64/apic_vector.S
  releng/11.1/sys/amd64/amd64/atpic_vector.S
  releng/11.1/sys/amd64/amd64/cpu_switch.S
  releng/11.1/sys/amd64/amd64/db_trace.c
  releng/11.1/sys/amd64/amd64/exception.S
  releng/11.1/sys/amd64/amd64/genassym.c
  releng/11.1/sys/amd64/amd64/initcpu.c
  releng/11.1/sys/amd64/amd64/machdep.c
  releng/11.1/sys/amd64/amd64/mp_machdep.c
  releng/11.1/sys/amd64/amd64/pmap.c
  releng/11.1/sys/amd64/amd64/support.S
  releng/11.1/sys/amd64/amd64/sys_machdep.c
  releng/11.1/sys/amd64/amd64/trap.c
  releng/11.1/sys/amd64/amd64/vm_machdep.c
  releng/11.1/sys/amd64/ia32/ia32_exception.S
  releng/11.1/sys/amd64/ia32/ia32_syscall.c
  releng/11.1/sys/amd64/include/asmacros.h
  releng/11.1/sys/amd64/include/frame.h
  releng/11.1/sys/amd64/include/intr_machdep.h
  releng/11.1/sys/amd64/include/md_var.h
  releng/11.1/sys/amd64/include/pcb.h
  releng/11.1/sys/amd64/include/pcpu.h
  releng/11.1/sys/amd64/include/pmap.h
  releng/11.1/sys/amd64/include/smp.h
  releng/11.1/sys/amd64/vmm/intel/vmx.c
  releng/11.1/sys/amd64/vmm/vmm.c
  releng/11.1/sys/conf/Makefile.amd64
  releng/11.1/sys/conf/newvers.sh
  releng/11.1/sys/dev/cpuctl/cpuctl.c
  releng/11.1/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S
  releng/11.1/sys/dev/hyperv/vmbus/i386/vmbus_vector.S
  releng/11.1/sys/dev/hyperv/vmbus/vmbus.c
  releng/11.1/sys/i386/i386/apic_vector.s
  releng/11.1/sys/i386/i386/atpic_vector.s
  releng/11.1/sys/i386/i386/exception.s
  releng/11.1/sys/i386/i386/machdep.c
  releng/11.1/sys/i386/i386/pmap.c
  releng/11.1/sys/i386/i386/support.s
  releng/11.1/sys/i386/i386/vm_machdep.c
  releng/11.1/sys/sys/cpuctl.h
  releng/11.1/sys/x86/include/apicvar.h
  releng/11.1/sys/x86/include/specialreg.h
  releng/11.1/sys/x86/include/x86_smp.h
  releng/11.1/sys/x86/include/x86_var.h
  releng/11.1/sys/x86/isa/atpic.c
  releng/11.1/sys/x86/x86/cpu_machdep.c
  releng/11.1/sys/x86/x86/identcpu.c
  releng/11.1/sys/x86/x86/local_apic.c
  releng/11.1/sys/x86/x86/mp_x86.c
  releng/11.1/sys/x86/xen/pv.c
  releng/11.1/usr.sbin/cpucontrol/cpucontrol.8
  releng/11.1/usr.sbin/cpucontrol/cpucontrol.c

Modified: releng/11.1/UPDATING
==
--- releng/11.1/UPDATINGWed Mar 14 03:50:12 2018(r330907)
+++ releng/11.1/UPDATINGWed Mar 14 04:00:00 2018(r330908)
@@ -16,6 +16,11 @@ 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.
 
+20180314   p8  FreeBSD-SA-18:03.speculative_execution
+
+   Add mitigations for two classes of speculative execution vulnerabilities
+   on amd64.
+
 20180307   p7  FreeBSD-SA-18:01.ipsec
FreeBSD-SA-18:02.ntp
FreeBSD-EN-18:01.tzdata

Modified: releng/11.1/sys/amd64/amd64/apic_vector.S
==
--- releng/11.1/sys/amd64/amd64/apic_vector.S   Wed Mar 14 03:50:12 2018
(r330907)
+++ releng/11.1/sys/amd64/amd64/apic_vector.S   Wed Mar 14 04:00:00 2018
(r330908)
@@ -2,7 +2,13 @@
  * Copyright (c) 1989, 1990 William F. Jolitz.
  * Copyright (c) 1990 The Regents of the University of California.
  * All rights reserved.
+ * Copyright (c) 2014-2018 The FreeBSD Foundation
+ * All rights reserved.
  *
+ * Portions of this software were developed by
+ * Konstantin Belousov  under sponsorship from
+ * the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -38,12 +44,12 @@
 
 #include "opt_smp.h"
 
+#include "assym.s"
+
 #include 
 #include 
 #include 
 
-#include "assym.s"
-
 #ifdef SMP
 #define LK lock ;
 #else
@@ -73,30 +79,28 @@ as_lapic_eoi:
  * translates that into a vector, and passes the vector to the
  * lapic_handle_intr() function.
  */
-#defineISR_VEC(index, vec_name)
\
-   .text ; \
-   SUPERALIGN_TEXT ;   \
-IDTVEC(vec_name) ; \
-   PUSH_FRAME ;\
-   FAKE_MCOUNT(TF_RIP(%rsp)) ; \
-   cmpl$0,x2apic_mode ;

svn commit: r330907 - stable/11/sys/dev/ofw

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Wed Mar 14 03:50:12 2018
New Revision: 330907
URL: https://svnweb.freebsd.org/changeset/base/330907

Log:
  MFC r330019: ofw_fdt: Simplify parts with new libfdt methods
  
  libfdt now provides methods to iterate through subnodes and properties in a
  convenient fashion.
  
  Replace our ofw_fdt_{peer,child} searches with calls to their corresponding
  libfdt methods. Rework ofw_fdt_nextprop to use the
  fdt_for_each_property_offset macro, making it even more obvious what it's
  doing.
  
  No functional change intended.

Modified:
  stable/11/sys/dev/ofw/ofw_fdt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ofw/ofw_fdt.c
==
--- stable/11/sys/dev/ofw/ofw_fdt.c Wed Mar 14 03:49:15 2018
(r330906)
+++ stable/11/sys/dev/ofw/ofw_fdt.c Wed Mar 14 03:50:12 2018
(r330907)
@@ -153,7 +153,7 @@ fdt_phandle_offset(phandle_t p)
 static phandle_t
 ofw_fdt_peer(ofw_t ofw, phandle_t node)
 {
-   int depth, offset;
+   int offset;
 
if (node == 0) {
/* Find root node */
@@ -165,39 +165,21 @@ ofw_fdt_peer(ofw_t ofw, phandle_t node)
offset = fdt_phandle_offset(node);
if (offset < 0)
return (0);
-
-   for (depth = 1, offset = fdt_next_node(fdtp, offset, );
-   offset >= 0;
-   offset = fdt_next_node(fdtp, offset, )) {
-   if (depth < 0)
-   return (0);
-   if (depth == 1)
-   return (fdt_offset_phandle(offset));
-   }
-
-   return (0);
+   offset = fdt_next_subnode(fdtp, offset);
+   return (fdt_offset_phandle(offset));
 }
 
 /* Return the first child of this node or 0. */
 static phandle_t
 ofw_fdt_child(ofw_t ofw, phandle_t node)
 {
-   int depth, offset;
+   int offset;
 
offset = fdt_phandle_offset(node);
if (offset < 0)
return (0);
-
-   for (depth = 0, offset = fdt_next_node(fdtp, offset, );
-   (offset >= 0) && (depth > 0);
-   offset = fdt_next_node(fdtp, offset, )) {
-   if (depth < 0)
-   return (0);
-   if (depth == 1)
-   return (fdt_offset_phandle(offset));
-   }
-
-   return (0);
+   offset = fdt_first_subnode(fdtp, offset);
+   return (fdt_offset_phandle(offset));
 }
 
 /* Return the parent of this node or 0. */
@@ -320,26 +302,24 @@ ofw_fdt_nextprop(ofw_t ofw, phandle_t package, const c
if (offset < 0)
return (-1);
 
-   /* Find the first prop in the node */
-   offset = fdt_first_property_offset(fdtp, offset);
-   if (offset < 0)
-   return (0); /* No properties */
-
-   if (previous != NULL) {
-   while (offset >= 0) {
+   if (previous == NULL)
+   /* Find the first prop in the node */
+   offset = fdt_first_property_offset(fdtp, offset);
+   else {
+   fdt_for_each_property_offset(offset, fdtp, offset) {
prop = fdt_getprop_by_offset(fdtp, offset, , NULL);
if (prop == NULL)
return (-1); /* Internal error */
-
+   /* Skip until we find 'previous', then bail out */
+   if (strcmp(name, previous) != 0)
+   continue;
offset = fdt_next_property_offset(fdtp, offset);
-   if (offset < 0)
-   return (0); /* No more properties */
-
-   /* Check if the last one was the one we wanted */
-   if (strcmp(name, previous) == 0)
-   break;
+   break;
}
}
+
+   if (offset < 0)
+   return (0); /* No properties */
 
prop = fdt_getprop_by_offset(fdtp, offset, , );
if (prop == NULL)
___
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: r330906 - in stable/11/sys: dev/ofw powerpc/ofw

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Wed Mar 14 03:49:15 2018
New Revision: 330906
URL: https://svnweb.freebsd.org/changeset/base/330906

Log:
  MFC r329579: Set internal error returns [of some OF functions] to 0
  
  Set internal error returns for OF_peer(), OF_child(), and OF_parent() to
  zero, matching the IEEE 1275 standard. Since these internal error paths
  have never, to my knowledge, been taken, behavior is unchanged.

Modified:
  stable/11/sys/dev/ofw/ofw_standard.c
  stable/11/sys/powerpc/ofw/ofw_real.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ofw/ofw_standard.c
==
--- stable/11/sys/dev/ofw/ofw_standard.cWed Mar 14 03:47:58 2018
(r330905)
+++ stable/11/sys/dev/ofw/ofw_standard.cWed Mar 14 03:49:15 2018
(r330906)
@@ -232,7 +232,7 @@ ofw_std_peer(ofw_t ofw, phandle_t node)
 
args.node = node;
if (openfirmware() == -1)
-   return (-1);
+   return (0);
return (args.next);
 }
 
@@ -254,7 +254,7 @@ ofw_std_child(ofw_t ofw, phandle_t node)
 
args.node = node;
if (openfirmware() == -1)
-   return (-1);
+   return (0);
return (args.child);
 }
 
@@ -276,7 +276,7 @@ ofw_std_parent(ofw_t ofw, phandle_t node)
 
args.node = node;
if (openfirmware() == -1)
-   return (-1);
+   return (0);
return (args.parent);
 }
 

Modified: stable/11/sys/powerpc/ofw/ofw_real.c
==
--- stable/11/sys/powerpc/ofw/ofw_real.cWed Mar 14 03:47:58 2018
(r330905)
+++ stable/11/sys/powerpc/ofw/ofw_real.cWed Mar 14 03:49:15 2018
(r330906)
@@ -366,7 +366,7 @@ ofw_real_peer(ofw_t ofw, phandle_t node)
argsptr = ofw_real_map(, sizeof(args));
if (openfirmware((void *)argsptr) == -1) {
ofw_real_stop();
-   return (-1);
+   return (0);
}
ofw_real_unmap(argsptr, , sizeof(args));
ofw_real_stop();
@@ -395,7 +395,7 @@ ofw_real_child(ofw_t ofw, phandle_t node)
argsptr = ofw_real_map(, sizeof(args));
if (openfirmware((void *)argsptr) == -1) {
ofw_real_stop();
-   return (-1);
+   return (0);
}
ofw_real_unmap(argsptr, , sizeof(args));
ofw_real_stop();
@@ -424,7 +424,7 @@ ofw_real_parent(ofw_t ofw, phandle_t node)
argsptr = ofw_real_map(, sizeof(args));
if (openfirmware((void *)argsptr) == -1) {
ofw_real_stop();
-   return (-1);
+   return (0);
}
ofw_real_unmap(argsptr, , sizeof(args));
ofw_real_stop();
___
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: r330905 - stable/11/sys/dev/ofw

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Wed Mar 14 03:47:58 2018
New Revision: 330905
URL: https://svnweb.freebsd.org/changeset/base/330905

Log:
  MFC r327391: Avoid use of the fdt_get_property_*() API
  
  [It is] intrinsically incompatible with FDT versions < 16. This also
  simplifies the code a bit.

Modified:
  stable/11/sys/dev/ofw/ofw_fdt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ofw/ofw_fdt.c
==
--- stable/11/sys/dev/ofw/ofw_fdt.c Wed Mar 14 03:45:33 2018
(r330904)
+++ stable/11/sys/dev/ofw/ofw_fdt.c Wed Mar 14 03:47:58 2018
(r330905)
@@ -227,7 +227,7 @@ ofw_fdt_instance_to_package(ofw_t ofw, ihandle_t insta
 static ssize_t
 ofw_fdt_getproplen(ofw_t ofw, phandle_t package, const char *propname)
 {
-   const struct fdt_property *prop;
+   const void *prop;
int offset, len;
 
offset = fdt_phandle_offset(package);
@@ -235,7 +235,7 @@ ofw_fdt_getproplen(ofw_t ofw, phandle_t package, const
return (-1);
 
len = -1;
-   prop = fdt_get_property(fdtp, offset, propname, );
+   prop = fdt_getprop(fdtp, offset, propname, );
 
if (prop == NULL && strcmp(propname, "name") == 0) {
/* Emulate the 'name' property */
@@ -312,7 +312,7 @@ static int
 ofw_fdt_nextprop(ofw_t ofw, phandle_t package, const char *previous, char *buf,
 size_t size)
 {
-   const struct fdt_property *prop;
+   const void *prop;
const char *name;
int offset;
 
@@ -327,7 +327,7 @@ ofw_fdt_nextprop(ofw_t ofw, phandle_t package, const c
 
if (previous != NULL) {
while (offset >= 0) {
-   prop = fdt_get_property_by_offset(fdtp, offset, NULL);
+   prop = fdt_getprop_by_offset(fdtp, offset, , NULL);
if (prop == NULL)
return (-1); /* Internal error */
 
@@ -336,17 +336,16 @@ ofw_fdt_nextprop(ofw_t ofw, phandle_t package, const c
return (0); /* No more properties */
 
/* Check if the last one was the one we wanted */
-   name = fdt_string(fdtp, fdt32_to_cpu(prop->nameoff));
if (strcmp(name, previous) == 0)
break;
}
}
 
-   prop = fdt_get_property_by_offset(fdtp, offset, );
+   prop = fdt_getprop_by_offset(fdtp, offset, , );
if (prop == NULL)
return (-1); /* Internal error */
 
-   strncpy(buf, fdt_string(fdtp, fdt32_to_cpu(prop->nameoff)), size);
+   strncpy(buf, name, size);
 
return (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: r330904 - in stable/11/sys: dev/ofw powerpc/ofw

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Wed Mar 14 03:45:33 2018
New Revision: 330904
URL: https://svnweb.freebsd.org/changeset/base/330904

Log:
  MFC r326310: Back out OF module installation in the event of failure.
  
  PS3 firmware gives some ancient FDT version (2) that fails the init check in
  OFW_FDT. It is still possible to make progress, but not while the OF layer
  is going crazy.

Modified:
  stable/11/sys/dev/ofw/openfirm.c
  stable/11/sys/powerpc/ofw/ofw_machdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ofw/openfirm.c
==
--- stable/11/sys/dev/ofw/openfirm.cWed Mar 14 03:43:49 2018
(r330903)
+++ stable/11/sys/dev/ofw/openfirm.cWed Mar 14 03:45:33 2018
(r330904)
@@ -201,6 +201,12 @@ OF_install(char *name, int prio)
ofw_def_t *ofwp, **ofwpp;
static int curr_prio = 0;
 
+   /* Allow OF layer to be uninstalled */
+   if (name == NULL) {
+   ofw_def_impl = NULL;
+   return (FALSE);
+   }
+
/*
 * Try and locate the OFW kobj corresponding to the name.
 */

Modified: stable/11/sys/powerpc/ofw/ofw_machdep.c
==
--- stable/11/sys/powerpc/ofw/ofw_machdep.c Wed Mar 14 03:43:49 2018
(r330903)
+++ stable/11/sys/powerpc/ofw/ofw_machdep.c Wed Mar 14 03:45:33 2018
(r330904)
@@ -389,6 +389,7 @@ boolean_t
 OF_bootstrap()
 {
boolean_t status = FALSE;
+   int err = 0;
 
 #ifdef AIM
if (openfirmware_entry != NULL) {
@@ -405,7 +406,7 @@ OF_bootstrap()
if (status != TRUE)
return status;
 
-   OF_init(openfirmware);
+   err = OF_init(openfirmware);
} else
 #endif
if (fdt != NULL) {
@@ -414,9 +415,15 @@ OF_bootstrap()
if (status != TRUE)
return status;
 
-   OF_init(fdt);
-   OF_interpret("perform-fixup", 0);
+   err = OF_init(fdt);
+   if (err == 0)
+   OF_interpret("perform-fixup", 0);
} 
+
+   if (err != 0) {
+   OF_install(NULL, 0);
+   status = FALSE;
+   }
 
return (status);
 }
___
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: r330903 - stable/11/sys/dev/ofw

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Wed Mar 14 03:43:49 2018
New Revision: 330903
URL: https://svnweb.freebsd.org/changeset/base/330903

Log:
  MFC r326204: Do not bind to CPUs with SMT
  
  Do not bind to CPUs with SMT, which use a different CPU numbering convention
  that does not play well with this driver.

Modified:
  stable/11/sys/dev/ofw/ofw_cpu.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ofw/ofw_cpu.c
==
--- stable/11/sys/dev/ofw/ofw_cpu.c Wed Mar 14 03:41:07 2018
(r330902)
+++ stable/11/sys/dev/ofw/ofw_cpu.c Wed Mar 14 03:43:49 2018
(r330903)
@@ -191,6 +191,10 @@ ofw_cpu_probe(device_t dev)
if (type == NULL || strcmp(type, "cpu") != 0)
return (ENXIO);
 
+   /* Skip SMT CPUs, which we can't reasonably represent with this code */
+   if (OF_hasprop(ofw_bus_get_node(dev), "ibm,ppc-interrupt-server#s"))
+   return (ENXIO);
+
device_set_desc(dev, "Open Firmware CPU");
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: r330902 - stable/11/sys/dev/ofw

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Wed Mar 14 03:41:07 2018
New Revision: 330902
URL: https://svnweb.freebsd.org/changeset/base/330902

Log:
  MFC r322359: Enable OF_setprop API function to add property in FDT
  
  This patch modifies function ofw_fdt_setprop (called by OF_setprop),
  so that it can add property, when replacing is not possible.
  Adding property is needed to fixup FDT's that have missing
  properties.

Modified:
  stable/11/sys/dev/ofw/ofw_fdt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ofw/ofw_fdt.c
==
--- stable/11/sys/dev/ofw/ofw_fdt.c Wed Mar 14 03:39:31 2018
(r330901)
+++ stable/11/sys/dev/ofw/ofw_fdt.c Wed Mar 14 03:41:07 2018
(r330902)
@@ -362,7 +362,11 @@ ofw_fdt_setprop(ofw_t ofw, phandle_t package, const ch
if (offset < 0)
return (-1);
 
-   return (fdt_setprop_inplace(fdtp, offset, propname, buf, len));
+   if (fdt_setprop_inplace(fdtp, offset, propname, buf, len) != 0)
+   /* Try to add property, when setting value inplace failed */
+   return (fdt_setprop(fdtp, offset, propname, buf, len));
+
+   return (0);
 }
 
 /* Convert a device specifier to a fully qualified pathname. */
___
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: r330901 - stable/11/sys/dev/ofw

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Wed Mar 14 03:39:31 2018
New Revision: 330901
URL: https://svnweb.freebsd.org/changeset/base/330901

Log:
  MFC r322289: Enable uing ofw_bus_find_compatible in early platform code
  
  Before this patch function ofw_bus_find_compatible was using
  memory allocations in order to find compatible node and the property's
  length. This way there was always a suited buffer for property,
  however this approach had also disadvantages - ofw_bus_find_compatible
  couldn't be used when malloc is not available, e.g. during fdt fixup stage.
  
  In order to remove the usage limitation of ofw_bus_find_compatible(),
  this patch modifies the function to use ofw_bus_node_is_compatible()
  (instead of the one without _int suffix), which uses a fixed
  buffer on stack instead of dynamic allocations.

Modified:
  stable/11/sys/dev/ofw/ofw_bus_subr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ofw/ofw_bus_subr.c
==
--- stable/11/sys/dev/ofw/ofw_bus_subr.cWed Mar 14 03:37:37 2018
(r330900)
+++ stable/11/sys/dev/ofw/ofw_bus_subr.cWed Mar 14 03:39:31 2018
(r330901)
@@ -703,22 +703,14 @@ phandle_t
 ofw_bus_find_compatible(phandle_t node, const char *onecompat)
 {
phandle_t child, ret;
-   void *compat;
-   int len;
 
/*
 * Traverse all children of 'start' node, and find first with
 * matching 'compatible' property.
 */
for (child = OF_child(node); child != 0; child = OF_peer(child)) {
-   len = OF_getprop_alloc(child, "compatible", 1, );
-   if (len >= 0) {
-   ret = ofw_bus_node_is_compatible_int(compat, len,
-   onecompat);
-   free(compat, M_OFWPROP);
-   if (ret != 0)
-   return (child);
-   }
+   if (ofw_bus_node_is_compatible(child, onecompat) != 0)
+   return (child);
 
ret = ofw_bus_find_compatible(child, onecompat);
if (ret != 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: r330900 - stable/11/sys/dev/ofw

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Wed Mar 14 03:37:37 2018
New Revision: 330900
URL: https://svnweb.freebsd.org/changeset/base/330900

Log:
  MFC r322287 (mw): Add support for "compatible" parameter in ofw_fdt_fixup
  
  Sometimes it's convenient to provide fixup to many boards
  that use the same SoC family (eg. Marvell Armada 38x).
  Instead of putting multiple entries in fdt_fixup_table,
  use one entry which refers to all boards with given SoC.

Modified:
  stable/11/sys/dev/ofw/ofw_fdt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ofw/ofw_fdt.c
==
--- stable/11/sys/dev/ofw/ofw_fdt.c Wed Mar 14 03:36:27 2018
(r330899)
+++ stable/11/sys/dev/ofw/ofw_fdt.c Wed Mar 14 03:37:37 2018
(r330900)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include "ofw_if.h"
 
@@ -431,7 +432,15 @@ ofw_fdt_fixup(ofw_t ofw)
for (i = 0; fdt_fixup_table[i].model != NULL; i++) {
if (strncmp(model, fdt_fixup_table[i].model,
FDT_MODEL_LEN) != 0)
-   continue;
+   /*
+* Sometimes it's convenient to provide one
+* fixup entry that refers to many boards.
+* To handle this case, simply check if model
+* is compatible parameter
+*/
+   if(!ofw_bus_node_is_compatible(root,
+   fdt_fixup_table[i].model))
+   continue;
 
if (fdt_fixup_table[i].handler != NULL)
(*fdt_fixup_table[i].handler)(root);
___
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: r330899 - stable/11/sys/dev/ofw

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Wed Mar 14 03:36:27 2018
New Revision: 330899
URL: https://svnweb.freebsd.org/changeset/base/330899

Log:
  MFC r317191, r317195: Don't ignore "disabled" CPUs
  
  r317191 (cognet):
  ePAPR states that any non-boot CPU will come in "disabled" state. So we
  should not consider a "disabled" cpu as a CPU we have to ignore, and we
  should use them if they provide a "enable-method".
  While I'm there, support "ok" as well as "okay", while ePAPR only accepts
  "okay", linux accepts "ok" too so we can expect it to be used.
  
  r317195 (cognet):
  Update comment ot reflect realilty, we know also take care of CPUs that
  provide a enable-method.

Modified:
  stable/11/sys/dev/ofw/ofw_cpu.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ofw/ofw_cpu.c
==
--- stable/11/sys/dev/ofw/ofw_cpu.c Wed Mar 14 03:30:34 2018
(r330898)
+++ stable/11/sys/dev/ofw/ofw_cpu.c Wed Mar 14 03:36:27 2018
(r330899)
@@ -315,13 +315,16 @@ ofw_cpu_early_foreach(ofw_cpu_foreach_cb callback, boo
 
/*
 * If we are filtering by runnable then limit to only
-* those that have been enabled.
+* those that have been enabled, or do provide a method
+* to enable them.
 */
if (only_runnable) {
status[0] = '\0';
OF_getprop(child, "status", status, sizeof(status));
-   if (status[0] != '\0' && strcmp(status, "okay") != 0)
-   continue;
+   if (status[0] != '\0' && strcmp(status, "okay") != 0 &&
+   strcmp(status, "ok") != 0 &&
+   !OF_hasprop(child, "enable-method"))
+   continue;
}
 
/*
___
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: r330898 - stable/11/stand/libsa

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Wed Mar 14 03:30:34 2018
New Revision: 330898
URL: https://svnweb.freebsd.org/changeset/base/330898

Log:
  MFC r329339: libsa: Consolidate tftp sendrecv into net.c sendrecv
  
  bootp/arp/rarp/rpc all use the sendrecv implementation in net.c. tftp has
  its own implementation because it passes an extra parameter into the recv
  callback for the received payload type to be held.
  
  These sendrecv implementations are otherwise equivalent, so consolidate
  them. The other users of sendrecv won't be using the extra argument to recv,
  but this gives us only one place to worry about respecting timeouts and one
  consistent timeout behavior.

Modified:
  stable/11/stand/libsa/arp.c
  stable/11/stand/libsa/bootp.c
  stable/11/stand/libsa/net.c
  stable/11/stand/libsa/net.h
  stable/11/stand/libsa/rarp.c
  stable/11/stand/libsa/rpc.c
  stable/11/stand/libsa/tftp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/libsa/arp.c
==
--- stable/11/stand/libsa/arp.c Wed Mar 14 03:19:51 2018(r330897)
+++ stable/11/stand/libsa/arp.c Wed Mar 14 03:30:34 2018(r330898)
@@ -65,7 +65,7 @@ int arp_num = 1;
 
 /* Local forwards */
 static ssize_t arpsend(struct iodesc *, void *, size_t);
-static ssize_t arprecv(struct iodesc *, void **, void **, time_t);
+static ssize_t arprecv(struct iodesc *, void **, void **, time_t, void *);
 
 /* Broadcast an ARP packet, asking who has addr on interface d */
 u_char *
@@ -118,7 +118,7 @@ arpwhohas(struct iodesc *d, struct in_addr addr)
ah = NULL;
i = sendrecv(d,
arpsend, , sizeof(wbuf.data),
-   arprecv, , (void **));
+   arprecv, , (void **), NULL);
if (i == -1) {
panic("arp: no response for %s\n",
  inet_ntoa(addr));
@@ -160,7 +160,7 @@ arpsend(struct iodesc *d, void *pkt, size_t len)
  * else -1 (and errno == 0)
  */
 static ssize_t
-arprecv(struct iodesc *d, void **pkt, void **payload, time_t tleft)
+arprecv(struct iodesc *d, void **pkt, void **payload, time_t tleft, void 
*extra)
 {
ssize_t n;
struct ether_arp *ah;

Modified: stable/11/stand/libsa/bootp.c
==
--- stable/11/stand/libsa/bootp.c   Wed Mar 14 03:19:51 2018
(r330897)
+++ stable/11/stand/libsa/bootp.c   Wed Mar 14 03:30:34 2018
(r330898)
@@ -73,7 +73,7 @@ staticchar vm_cmu[4] = VM_CMU;
 
 /* Local forwards */
 static ssize_t bootpsend(struct iodesc *, void *, size_t);
-static ssize_t bootprecv(struct iodesc *, void **, void **, time_t);
+static ssize_t bootprecv(struct iodesc *, void **, void **, time_t, void *);
 static int vend_rfc1048(u_char *, u_int);
 #ifdef BOOTP_VEND_CMU
 static void vend_cmu(u_char *);
@@ -183,7 +183,7 @@ bootp(int sock)
 
if(sendrecv(d,
bootpsend, bp, sizeof(*bp),
-   bootprecv, , (void **)) == -1) {
+   bootprecv, , (void **), NULL) == -1) {
printf("bootp: no reply\n");
return;
}
@@ -209,7 +209,7 @@ bootp(int sock)
free(pkt);
if(sendrecv(d,
bootpsend, bp, sizeof(*bp),
-   bootprecv, , (void **)) == -1) {
+   bootprecv, , (void **), NULL) == -1) {
printf("DHCPREQUEST failed\n");
return;
}
@@ -286,7 +286,8 @@ bootpsend(struct iodesc *d, void *pkt, size_t len)
 }
 
 static ssize_t
-bootprecv(struct iodesc *d, void **pkt, void **payload, time_t tleft)
+bootprecv(struct iodesc *d, void **pkt, void **payload, time_t tleft,
+void *extra)
 {
ssize_t n;
struct bootp *bp;

Modified: stable/11/stand/libsa/net.c
==
--- stable/11/stand/libsa/net.c Wed Mar 14 03:19:51 2018(r330897)
+++ stable/11/stand/libsa/net.c Wed Mar 14 03:30:34 2018(r330898)
@@ -72,8 +72,8 @@ ssize_t
 sendrecv(struct iodesc *d,
 ssize_t (*sproc)(struct iodesc *, void *, size_t),
 void *sbuf, size_t ssize,
-ssize_t (*rproc)(struct iodesc *, void **, void **, time_t),
-void **pkt, void **payload)
+ssize_t (*rproc)(struct iodesc *, void **, void **, time_t, void *),
+void **pkt, void **payload, void *recv_extra)
 {
ssize_t cc;
time_t t, tmo, tlast;
@@ -116,7 +116,7 @@ sendrecv(struct iodesc *d,
}
 
/* Try to get a packet and process it. */
-   cc = (*rproc)(d, pkt, payload, tleft);
+   cc = (*rproc)(d, pkt, payload, tleft, recv_extra);
/* Return on data, EOF or real error. */
if (cc != -1 || (errno != 0 && errno != ETIMEDOUT))
return (cc);

Modified: 

svn commit: r330896 - in stable/11/sys: dev/syscons kern

2018-03-13 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 03:09:47 2018
New Revision: 330896
URL: https://svnweb.freebsd.org/changeset/base/330896

Log:
  MFC r304804:
  
  Less-quick fix for locking fixes in r172250.  r172250 added a second
  syscons spinlock for the output routine alone.  It is better to extend
  the coverage of the first syscons spinlock added in r162285.  2 locks
  might work with complicated juggling, but no juggling was done.  What
  the 2 locks actually did was to cover some of the missing locking in
  each other and deadlock less often against each other than a single
  lock with larger coverage would against itself.  Races are preferable
  to deadlocks here, but 2 locks are still worse since they are harder
  to understand and fix.
  
  Prefer deadlocks to races and merge the second lock into the first one.
  
  Extend the scope of the spinlocking to all of sc_cnputc() instead of
  just the sc_puts() part.  This further prefers deadlocks to races.
  
  Extend the kdb_active hack from sc_puts() internals for the second lock
  to all spinlocking.  This reduces deadlocks much more than the other
  changes increases them.  The s/p,10* test in ddb gets much further now.
  Hide this detail in the SC_VIDEO_LOCK() macro.  Add namespace pollution
  in 1 nested #include and reduce namespace pollution in other nested
  #includes to pay for this.
  
  Move the first lock higher in the witness order.  The second lock was
  unnaturally low and the first lock was unnaturally high.  The second
  lock had to be above "sleepq chain" and/or "callout" to avoid spurious
  LORs for visual bells in sc_puts().  Other console driver locks are
  already even higher (but not adjacent like they should be) except when
  they are missing from the table.  Audio bells also benefit from the
  syscons lock being high so that audio mutexes have chance of being
  lower.  Otherwise, console drviver locks should be as low as possible.
  Non-spurious LORs now occur if the bell code calls printf() or is
  interrupted (perhaps by an NMI) and the interrupt handler calls
  printf().  Previous commits turned off many bells in console i/o but
  missed ones done by the teken layer.

Modified:
  stable/11/sys/dev/syscons/syscons.c
  stable/11/sys/dev/syscons/syscons.h
  stable/11/sys/kern/subr_witness.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Wed Mar 14 03:04:24 2018
(r330895)
+++ stable/11/sys/dev/syscons/syscons.c Wed Mar 14 03:09:47 2018
(r330896)
@@ -343,7 +343,9 @@ sctty_outwakeup(struct tty *tp)
len = ttydisc_getc(tp, buf, sizeof buf);
if (len == 0)
break;
+   SC_VIDEO_LOCK(scp->sc);
sc_puts(scp, buf, len, 0);
+   SC_VIDEO_UNLOCK(scp->sc);
 }
 }
 
@@ -1760,6 +1762,8 @@ sc_cnputc(struct consdev *cd, int c)
 
 /* assert(sc_console != NULL) */
 
+SC_VIDEO_LOCK(scp->sc);
+
 #ifndef SC_NO_HISTORY
 if (scp == scp->sc->cur_scp && scp->status & SLKED) {
scp->status &= ~SLKED;
@@ -1793,6 +1797,7 @@ sc_cnputc(struct consdev *cd, int c)
 s = spltty();  /* block sckbdevent and scrn_timer */
 sccnupdate(scp);
 splx(s);
+SC_VIDEO_UNLOCK(scp->sc);
 }
 
 static int
@@ -2726,24 +2731,14 @@ exchange_scr(sc_softc_t *sc)
 static void
 sc_puts(scr_stat *scp, u_char *buf, int len, int kernel)
 {
-int need_unlock = 0;
-
 #ifdef DEV_SPLASH
 /* make screensaver happy */
 if (!sticky_splash && scp == scp->sc->cur_scp && !sc_saver_keyb_only)
run_scrn_saver = FALSE;
 #endif
 
-if (scp->tsw) {
-   if (!kdb_active && !mtx_owned(>sc->scr_lock)) {
-   need_unlock = 1;
-   mtx_lock_spin(>sc->scr_lock);
-   }
+if (scp->tsw)
(*scp->tsw->te_puts)(scp, buf, len, kernel);
-   if (need_unlock)
-   mtx_unlock_spin(>sc->scr_lock);
-}
-
 if (scp->sc->delayed_next_scr)
sc_switch_scr(scp->sc, scp->sc->delayed_next_scr - 1);
 }
@@ -2906,10 +2901,8 @@ scinit(int unit, int flags)
  * disappeared...
  */
 sc = sc_get_softc(unit, flags & SC_KERNEL_CONSOLE);
-if ((sc->flags & SC_INIT_DONE) == 0) {
-   mtx_init(>scr_lock, "scrlock", NULL, MTX_SPIN);
+if ((sc->flags & SC_INIT_DONE) == 0)
SC_VIDEO_LOCKINIT(sc);
-}
 
 adp = NULL;
 if (sc->adapter >= 0) {
@@ -3126,7 +3119,6 @@ scterm(int unit, int flags)
(*scp->tsw->te_term)(scp, >ts);
 if (scp->ts != NULL)
free(scp->ts, M_DEVBUF);
-mtx_destroy(>scr_lock);
 mtx_destroy(>video_mtx);
 
 /* clear the structure */

Modified: stable/11/sys/dev/syscons/syscons.h
==
--- stable/11/sys/dev/syscons/syscons.h Wed Mar 14 03:04:24 2018
(r330895)
+++ stable/11/sys/dev/syscons/syscons.h Wed Mar 14 03:09:47 2018
(r330896)
@@ 

svn commit: r330895 - stable/11/sys/dev/syscons

2018-03-13 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 03:04:24 2018
New Revision: 330895
URL: https://svnweb.freebsd.org/changeset/base/330895

Log:
  MFC r304773,r304800:
  
  Flesh out the state and flags args to sccnopen().  Set state flags to
  indicate (potentially partial) success of the open.  Use these to
  decide what to close in sccnclose().  Only grab/ungrab use open/close
  so far.
  
  Add a per-sc variable to count successful keyboard opens and use
  this instead of the grab count to decide if the keyboad state has
  been switched.
  
  Start fixing the locking by using atomic ops for the most important
  counter -- the grab level one.  Other racy counting will eventually
  be fixed by normal mutex or kdb locking in most cases.
  
  Use a 2-entry per-sc stack of states for grabbing.  2 is just enough
  to debug grabbing, e.g., for gets().  gets() grabs once and might not
  be able to do a full (or any) state switch.  ddb grabs again and has
  a better chance of doing a full state switch and needs a place to
  stack the previous state.  For more than 3 levels, grabbing just
  changes the count.  Console drivers should try to switch on every i/o
  in case lower levels of nesting failed to switch but the current level
  succeeds, but then the switch (back) must be completed on every i/o
  and this flaps the state unless the switch is null.  The main point
  of grabbing is to make it null quite often.  Syscons grabbing also
  does a carefully chosen screen focus that is not done on every i/o.
  
  Add a large comment about grabbing.
  
  Restore some small lost comments.

Modified:
  stable/11/sys/dev/syscons/syscons.c
  stable/11/sys/dev/syscons/syscons.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Wed Mar 14 03:00:17 2018
(r330894)
+++ stable/11/sys/dev/syscons/syscons.c Wed Mar 14 03:04:24 2018
(r330895)
@@ -79,8 +79,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-struct sc_cnstate; /* not used yet */
-
 #define COLD 0
 #define WARM 1
 
@@ -1655,7 +1653,13 @@ sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int fl
 {
 int kbd_mode;
 
-if (sc->kbd == NULL)
+/* assert(sc_console_unit >= 0) */
+
+sp->kbd_opened = FALSE;
+sp->scr_opened = FALSE;
+
+/* Opening the keyboard is optional. */
+if (!(flags & 1) || sc->kbd == NULL)
goto over_keyboard;
 
 /*
@@ -1667,48 +1671,79 @@ sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int fl
 /* Switch the keyboard to console mode (K_XLATE, polled) on all scp's. */
 kbd_mode = K_XLATE;
 (void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)_mode);
+sc->kbd_open_level++;
 kbdd_poll(sc->kbd, TRUE);
+
+sp->kbd_opened = TRUE;
 over_keyboard: ;
 
+/* The screen is opened iff locking it succeeds. */
+sp->scr_opened = TRUE;
+
+/* The screen switch is optional. */
+if (!(flags & 2))
+   return;
+
+/* try to switch to the kernel console screen */
 if (!cold &&
sc->cur_scp->index != sc_console->index &&
sc->cur_scp->smode.mode == VT_AUTO &&
sc_console->smode.mode == VT_AUTO)
sc_switch_scr(sc, sc_console->index);
-
 }
 
 static void
 sccnclose(sc_softc_t *sc, struct sc_cnstate *sp)
 {
-if (sc->kbd == NULL)
+sp->scr_opened = FALSE;
+
+if (!sp->kbd_opened)
return;
 
 /* Restore keyboard mode (for the current, possibly-changed scp). */
 kbdd_poll(sc->kbd, FALSE);
-(void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)>cur_scp->kbd_mode);
+if (--sc->kbd_open_level == 0)
+   (void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)>cur_scp->kbd_mode);
 
 kbdd_disable(sc->kbd);
+sp->kbd_opened = FALSE;
 }
 
+/*
+ * Grabbing switches the screen and keyboard focus to sc_console and the
+ * keyboard mode to (K_XLATE, polled).  Only switching to polled mode is
+ * essential (for preventing the interrupt handler from eating input
+ * between polls).  Focus is part of the UI, and the other switches are
+ * work just was well when they are done on every entry and exit.
+ *
+ * Screen switches while grabbed are supported, and to maintain focus for
+ * this ungrabbing and closing only restore the polling state and then
+ * the keyboard mode if on the original screen.
+ */
+
 static void
 sc_cngrab(struct consdev *cp)
 {
 sc_softc_t *sc;
+int lev;
 
 sc = sc_console->sc;
-if (sc->grab_level++ == 0)
-   sccnopen(sc, NULL, 0);
+lev = atomic_fetchadd_int(>grab_level, 1);
+if (lev >= 0 && lev < 2)
+   sccnopen(sc, >grab_state[lev], 1 | 2);
 }
 
 static void
 sc_cnungrab(struct consdev *cp)
 {
 sc_softc_t *sc;
+int lev;
 
 sc = sc_console->sc;
-if (--sc->grab_level == 0)
-   sccnclose(sc, NULL);
+lev = atomic_load_acq_int(>grab_level) - 1;
+if (lev >= 0 && lev < 2)
+   sccnclose(sc, >grab_state[lev]);

svn commit: r330894 - in head/sys/contrib/zstd: . contrib/meson doc doc/images lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests zlibWrapper zlibWr...

2018-03-13 Thread Conrad Meyer
Author: cem
Date: Wed Mar 14 03:00:17 2018
New Revision: 330894
URL: https://svnweb.freebsd.org/changeset/base/330894

Log:
  Update to Zstandard 1.3.3
  
  Includes patch to conditionalize use of __builtin_clz(ll) on __has_builtin().
  The issue is tracked upstream at https://github.com/facebook/zstd/pull/884 .
  Otherwise, these are vanilla Zstandard 1.3.3 files.
  
  Note that the 1.3.4 release should be due out soon.
  
  Sponsored by: Dell EMC Isilon

Added:
  head/sys/contrib/zstd/doc/images/zstd_logo86.png   (contents, props changed)
  head/sys/contrib/zstd/lib/compress/zstd_compress_internal.h
 - copied, changed from r330893, 
head/sys/contrib/zstd/lib/compress/zstd_compress.h
  head/sys/contrib/zstd/tests/seqgen.c   (contents, props changed)
  head/sys/contrib/zstd/tests/seqgen.h   (contents, props changed)
Deleted:
  head/sys/contrib/zstd/lib/compress/zstd_compress.h
Modified:
  head/sys/contrib/zstd/Makefile
  head/sys/contrib/zstd/NEWS
  head/sys/contrib/zstd/README.md
  head/sys/contrib/zstd/circle.yml
  head/sys/contrib/zstd/contrib/meson/meson.build
  head/sys/contrib/zstd/doc/zstd_compression_format.md
  head/sys/contrib/zstd/doc/zstd_manual.html
  head/sys/contrib/zstd/lib/BUCK
  head/sys/contrib/zstd/lib/common/bitstream.h
  head/sys/contrib/zstd/lib/common/mem.h
  head/sys/contrib/zstd/lib/common/pool.c
  head/sys/contrib/zstd/lib/common/xxhash.c
  head/sys/contrib/zstd/lib/common/zstd_common.c
  head/sys/contrib/zstd/lib/common/zstd_internal.h
  head/sys/contrib/zstd/lib/compress/zstd_compress.c
  head/sys/contrib/zstd/lib/compress/zstd_double_fast.c
  head/sys/contrib/zstd/lib/compress/zstd_double_fast.h
  head/sys/contrib/zstd/lib/compress/zstd_fast.c
  head/sys/contrib/zstd/lib/compress/zstd_fast.h
  head/sys/contrib/zstd/lib/compress/zstd_lazy.c
  head/sys/contrib/zstd/lib/compress/zstd_lazy.h
  head/sys/contrib/zstd/lib/compress/zstd_ldm.h
  head/sys/contrib/zstd/lib/compress/zstd_opt.c
  head/sys/contrib/zstd/lib/compress/zstd_opt.h
  head/sys/contrib/zstd/lib/compress/zstdmt_compress.c
  head/sys/contrib/zstd/lib/compress/zstdmt_compress.h
  head/sys/contrib/zstd/lib/decompress/zstd_decompress.c
  head/sys/contrib/zstd/lib/deprecated/zbuff_compress.c
  head/sys/contrib/zstd/lib/dictBuilder/zdict.c
  head/sys/contrib/zstd/lib/legacy/zstd_v01.c
  head/sys/contrib/zstd/lib/legacy/zstd_v02.c
  head/sys/contrib/zstd/lib/legacy/zstd_v03.c
  head/sys/contrib/zstd/lib/legacy/zstd_v04.c
  head/sys/contrib/zstd/lib/legacy/zstd_v05.c
  head/sys/contrib/zstd/lib/legacy/zstd_v06.c
  head/sys/contrib/zstd/lib/legacy/zstd_v07.c
  head/sys/contrib/zstd/lib/zstd.h
  head/sys/contrib/zstd/programs/BUCK
  head/sys/contrib/zstd/programs/Makefile
  head/sys/contrib/zstd/programs/bench.c
  head/sys/contrib/zstd/programs/bench.h
  head/sys/contrib/zstd/programs/dibio.c
  head/sys/contrib/zstd/programs/fileio.c
  head/sys/contrib/zstd/programs/fileio.h
  head/sys/contrib/zstd/programs/platform.h
  head/sys/contrib/zstd/programs/util.h
  head/sys/contrib/zstd/programs/zstd.1
  head/sys/contrib/zstd/programs/zstd.1.md
  head/sys/contrib/zstd/programs/zstdcli.c
  head/sys/contrib/zstd/tests/Makefile
  head/sys/contrib/zstd/tests/decodecorpus.c
  head/sys/contrib/zstd/tests/fullbench.c
  head/sys/contrib/zstd/tests/fuzzer.c
  head/sys/contrib/zstd/tests/paramgrill.c
  head/sys/contrib/zstd/tests/playTests.sh
  head/sys/contrib/zstd/tests/zbufftest.c
  head/sys/contrib/zstd/tests/zstreamtest.c
  head/sys/contrib/zstd/zlibWrapper/BUCK
  head/sys/contrib/zstd/zlibWrapper/examples/zwrapbench.c
  head/sys/contrib/zstd/zlibWrapper/zstd_zlibwrapper.c

Modified: head/sys/contrib/zstd/Makefile
==
--- head/sys/contrib/zstd/Makefile  Wed Mar 14 02:56:43 2018
(r330893)
+++ head/sys/contrib/zstd/Makefile  Wed Mar 14 03:00:17 2018
(r330894)
@@ -72,9 +72,12 @@ zstdmt:
 zlibwrapper:
$(MAKE) -C $(ZWRAPDIR) test
 
+.PHONY: check
+check: shortest
+
 .PHONY: test shortest
 test shortest:
-   $(MAKE) -C $(PRGDIR) allVariants
+   $(MAKE) -C $(PRGDIR) allVariants MOREFLAGS="-g -DZSTD_DEBUG=1"
$(MAKE) -C $(TESTDIR) $@
 
 .PHONY: examples
@@ -127,11 +130,6 @@ uninstall:
 travis-install:
$(MAKE) install PREFIX=~/install_test_dir
 
-.PHONY: gppbuild
-gppbuild: clean
-   g++ -v
-   CC=g++ $(MAKE) -C programs all CFLAGS="-O3 -Wall -Wextra -Wundef 
-Wshadow -Wcast-align -Werror"
-
 .PHONY: gcc5build
 gcc5build: clean
gcc-5 -v
@@ -163,7 +161,7 @@ aarch64build: clean
CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd
 
 ppcbuild: clean
-   CC=powerpc-linux-gnu-gcc CLAGS="-m32 -Wno-attributes -Werror" $(MAKE) 
allzstd
+   CC=powerpc-linux-gnu-gcc CFLAGS="-m32 -Wno-attributes -Werror" $(MAKE) 
allzstd
 
 ppc64build: clean
CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) allzstd

Modified: head/sys/contrib/zstd/NEWS

svn commit: r330893 - stable/11/sys/dev/syscons

2018-03-13 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 02:56:43 2018
New Revision: 330893
URL: https://svnweb.freebsd.org/changeset/base/330893

Log:
  MFC r304758:
  
  Reorganise a little to prepare for locking fixes:
  - in sccnopen(), open the keyboard before the screen.  The keyboard
currently requires Giant (although it must be spinlocked to work
correctly as a console), so the previous order would be a LOR if
it has any semblance of locking.
  - add a (currently dummy) state arg to scgetc().

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

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Wed Mar 14 02:45:42 2018
(r330892)
+++ stable/11/sys/dev/syscons/syscons.c Wed Mar 14 02:56:43 2018
(r330893)
@@ -79,6 +79,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+struct sc_cnstate; /* not used yet */
+
 #define COLD 0
 #define WARM 1
 
@@ -185,7 +187,7 @@ static void scterm(int unit, int flags);
 static void scshutdown(void *, int);
 static void scsuspend(void *);
 static void scresume(void *);
-static u_int scgetc(sc_softc_t *sc, u_int flags);
+static u_int scgetc(sc_softc_t *sc, u_int flags, struct sc_cnstate *sp);
 static void sc_puts(scr_stat *scp, u_char *buf, int len, int kernel);
 #define SCGETC_CN  1
 #define SCGETC_NONBLOCK2
@@ -750,7 +752,7 @@ sckbdevent(keyboard_t *thiskbd, int event, void *arg)
  * I don't think this is nessesary, and it doesn't fix
  * the Xaccel-2.1 keyboard hang, but it can't hurt.XXX
  */
-while ((c = scgetc(sc, SCGETC_NONBLOCK)) != NOKEY) {
+while ((c = scgetc(sc, SCGETC_NONBLOCK, NULL)) != NOKEY) {
 
cur_tty = SC_DEV(sc, sc->cur_scp->index);
if (!tty_opened_ns(cur_tty))
@@ -1645,7 +1647,6 @@ sc_cnterm(struct consdev *cp)
 sc_console = NULL;
 }
 
-struct sc_cnstate; /* not used yet */
 static void sccnclose(sc_softc_t *sc, struct sc_cnstate *sp);
 static void sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int flags);
 
@@ -1654,14 +1655,8 @@ sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int fl
 {
 int kbd_mode;
 
-if (!cold &&
-   sc->cur_scp->index != sc_console->index &&
-   sc->cur_scp->smode.mode == VT_AUTO &&
-   sc_console->smode.mode == VT_AUTO)
-   sc_switch_scr(sc, sc_console->index);
-
 if (sc->kbd == NULL)
-   return;
+   goto over_keyboard;
 
 /*
  * Make sure the keyboard is accessible even when the kbd device
@@ -1673,6 +1668,14 @@ sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int fl
 kbd_mode = K_XLATE;
 (void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)_mode);
 kbdd_poll(sc->kbd, TRUE);
+over_keyboard: ;
+
+if (!cold &&
+   sc->cur_scp->index != sc_console->index &&
+   sc->cur_scp->smode.mode == VT_AUTO &&
+   sc_console->smode.mode == VT_AUTO)
+   sc_switch_scr(sc, sc_console->index);
+
 }
 
 static void
@@ -1787,7 +1790,7 @@ sc_cngetc(struct consdev *cd)
return -1;
 }
 
-c = scgetc(scp->sc, SCGETC_CN | SCGETC_NONBLOCK);
+c = scgetc(scp->sc, SCGETC_CN | SCGETC_NONBLOCK, NULL);
 
 switch (KEYFLAGS(c)) {
 case 0:/* normal char */
@@ -3383,7 +3386,7 @@ sc_init_emulator(scr_stat *scp, char *name)
  * return NOKEY if there is nothing there.
  */
 static u_int
-scgetc(sc_softc_t *sc, u_int flags)
+scgetc(sc_softc_t *sc, u_int flags, struct sc_cnstate *sp)
 {
 scr_stat *scp;
 #ifndef SC_NO_HISTORY
___
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: r330885 - head/sys/modules/cam

2018-03-13 Thread Warner Losh
On Mar 13, 2018 6:07 PM, "Brooks Davis"  wrote:

On Tue, Mar 13, 2018 at 11:36:15PM +, Warner Losh wrote:
> Author: imp
> Date: Tue Mar 13 23:36:15 2018
> New Revision: 330885
> URL: https://svnweb.freebsd.org/changeset/base/330885
>
> Log:
>   We need opt_compat.h after r330819 and 330820.
>
>   Add opt_compat.h to fix the stand-alone build case.

Sorry about that.  I only tested with buildkernel.  I'll MFC this before
either of those.


Don't fret. I was on the review and missed it too.

Warner
___
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: r330892 - stable/11/sys/dev/syscons

2018-03-13 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 02:45:42 2018
New Revision: 330892
URL: https://svnweb.freebsd.org/changeset/base/330892

Log:
  MFC r304173,r304181,r304186:
  
  Fix restoring the kbd_mode part of the keyboard state in grab/ungrab.
  Simply change the mode to K_XLATE using a local variable and use the
  grab level as a flag to tell screen switches not to change it again,
  so that we don't need to switch scp->kbd_mode.  We did the latter,
  but didn't have the complications to update the keyboard mode switch
  for every screen switch.  sc->kbd_mode remains at its user setting
  for all scp's and ungrabbing restores to it.
  
  Restructure the grabbing functions into mere wrappers of new open and
  close functions.  Scattered calls to sc_cnputc() and sc_cngetc() were
  broken by turning the semi-reentrant inline context-switching code in
  these functions into the grabbing functions.  cncheckc() calls for
  panic dumps are the main broken case.  The grabbing functions have
  special behaviour (mainly screen switching in sc_cngrab()) which makes
  them unsuitable as replacements for the inline code.
  
  Clean up the new sc cn open and close functions (old sc cn grab and ungrab
  functions).  Mainly, spell sc as itself instead of as scp->sc.

Modified:
  stable/11/sys/dev/syscons/syscons.c
  stable/11/sys/dev/syscons/syscons.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Wed Mar 14 02:35:49 2018
(r330891)
+++ stable/11/sys/dev/syscons/syscons.c Wed Mar 14 02:45:42 2018
(r330892)
@@ -1645,59 +1645,70 @@ sc_cnterm(struct consdev *cp)
 sc_console = NULL;
 }
 
+struct sc_cnstate; /* not used yet */
+static void sccnclose(sc_softc_t *sc, struct sc_cnstate *sp);
+static void sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int flags);
+
 static void
-sc_cngrab(struct consdev *cp)
+sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int flags)
 {
-scr_stat *scp;
+int kbd_mode;
 
 if (!cold &&
-   sc_console->sc->cur_scp->index != sc_console->index &&
-   sc_console->sc->cur_scp->smode.mode == VT_AUTO &&
+   sc->cur_scp->index != sc_console->index &&
+   sc->cur_scp->smode.mode == VT_AUTO &&
sc_console->smode.mode == VT_AUTO)
-   sc_switch_scr(sc_console->sc, sc_console->index);
+   sc_switch_scr(sc, sc_console->index);
 
-scp = sc_console->sc->cur_scp;
-
-if (scp->sc->kbd == NULL)
+if (sc->kbd == NULL)
return;
 
-if (scp->sc->grab_level++ > 0)
-   return;
-
 /*
  * Make sure the keyboard is accessible even when the kbd device
  * driver is disabled.
  */
-kbdd_enable(scp->sc->kbd);
+kbdd_enable(sc->kbd);
 
-/* we shall always use the keyboard in the XLATE mode here */
-scp->kbd_prev_mode = scp->kbd_mode;
-scp->kbd_mode = K_XLATE;
-(void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)>kbd_mode);
-
-kbdd_poll(scp->sc->kbd, TRUE);
+/* Switch the keyboard to console mode (K_XLATE, polled) on all scp's. */
+kbd_mode = K_XLATE;
+(void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)_mode);
+kbdd_poll(sc->kbd, TRUE);
 }
 
 static void
-sc_cnungrab(struct consdev *cp)
+sccnclose(sc_softc_t *sc, struct sc_cnstate *sp)
 {
-scr_stat *scp;
-
-scp = sc_console->sc->cur_scp; /* XXX */
-if (scp->sc->kbd == NULL)
+if (sc->kbd == NULL)
return;
 
-if (--scp->sc->grab_level > 0)
-   return;
+/* Restore keyboard mode (for the current, possibly-changed scp). */
+kbdd_poll(sc->kbd, FALSE);
+(void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)>cur_scp->kbd_mode);
 
-kbdd_poll(scp->sc->kbd, FALSE);
+kbdd_disable(sc->kbd);
+}
 
-scp->kbd_mode = scp->kbd_prev_mode;
-(void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)>kbd_mode);
-kbdd_disable(scp->sc->kbd);
+static void
+sc_cngrab(struct consdev *cp)
+{
+sc_softc_t *sc;
+
+sc = sc_console->sc;
+if (sc->grab_level++ == 0)
+   sccnopen(sc, NULL, 0);
 }
 
 static void
+sc_cnungrab(struct consdev *cp)
+{
+sc_softc_t *sc;
+
+sc = sc_console->sc;
+if (--sc->grab_level == 0)
+   sccnclose(sc, NULL);
+}
+
+static void
 sc_cnputc(struct consdev *cd, int c)
 {
 u_char buf[1];
@@ -2667,7 +2678,7 @@ exchange_scr(sc_softc_t *sc)
 sc_set_border(scp, scp->border);
 
 /* set up the keyboard for the new screen */
-if (sc->old_scp->kbd_mode != scp->kbd_mode)
+if (sc->grab_level == 0 && sc->old_scp->kbd_mode != scp->kbd_mode)
(void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)>kbd_mode);
 update_kbd_state(scp, scp->status, LOCK_MASK);
 
@@ -3412,7 +3423,7 @@ next_code:
 if (!(flags & SCGETC_CN))
random_harvest_queue(, sizeof(c), 1, RANDOM_KEYBOARD);
 
-if (scp->kbd_mode != K_XLATE)
+if (sc->grab_level == 0 && scp->kbd_mode != K_XLATE)

svn commit: r330891 - head/stand/uboot/common

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Wed Mar 14 02:35:49 2018
New Revision: 330891
URL: https://svnweb.freebsd.org/changeset/base/330891

Log:
  ubldr: Bump heap size from 512K to 1M
  
  lualoader in itself only uses another ~200K, but there seems to be no reason
  not to bump it a little higher to give us some more wiggle room.
  
  With this, I can boot using a menu-enabled lualoader, no problem and
  reasonably fast. Some heap usage datapoints from the review:
  
  forthloader, no menus, kernel loaded:
  heap base at 0x1203d5b0, top at 0x1208e000, used 330320
  
  lualoader, no menus, kernel loaded:
  heap base at 0x42050028, top at 0x420ab000, used 372696
  
  lualoader, menus, kernel loaded:
  heap base at 0x42050028, top at 0x420d5000, used 544728
  
  Since then, the no menu case for lualoader should have decreased slightly as
  I've made some changes to make sure that it no longer loads any of th emenu
  bits with beastie disabled.
  
  While here, split heap size out into a HEAP_SIZE macro.
  
  Reviewed by:  ian, imp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D14471

Modified:
  head/stand/uboot/common/main.c

Modified: head/stand/uboot/common/main.c
==
--- head/stand/uboot/common/main.c  Wed Mar 14 01:38:47 2018
(r330890)
+++ head/stand/uboot/common/main.c  Wed Mar 14 02:35:49 2018
(r330891)
@@ -41,6 +41,10 @@ __FBSDID("$FreeBSD$");
 #definenitems(x)   (sizeof((x)) / sizeof((x)[0]))
 #endif
 
+#ifndef HEAP_SIZE
+#defineHEAP_SIZE   (1 * 1024 * 1024)
+#endif
+
 struct uboot_devdesc currdev;
 struct arch_switch archsw; /* MI/MD interface boundary */
 int devs_no;
@@ -421,7 +425,7 @@ main(int argc, char **argv)
 * of our bss and the bottom of the u-boot stack to avoid overlap.
 */
uboot_heap_start = round_page((uintptr_t)end);
-   uboot_heap_end   = uboot_heap_start + 512 * 1024;
+   uboot_heap_end   = uboot_heap_start + HEAP_SIZE;
setheap((void *)uboot_heap_start, (void *)uboot_heap_end);
 
/*
___
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: r330890 - stable/11/share/mk

2018-03-13 Thread Ed Maste
Author: emaste
Date: Wed Mar 14 01:38:47 2018
New Revision: 330890
URL: https://svnweb.freebsd.org/changeset/base/330890

Log:
  MFC r330613: Disable LLD_BOOTSTRAP under WITHOUT_CROSS_COMPILER
  
  LLD is a cross toolchain component. It shouldn't be built when
  requesting a build without building a cross compiler.
  
  (CROSS_COMPILER is somewhat unfortunately named; in any case, lld
  should be treated as GNU binutils here.)
  
  Submitted by: Dan McGregor 

Modified:
  stable/11/share/mk/src.opts.mk
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/mk/src.opts.mk
==
--- stable/11/share/mk/src.opts.mk  Wed Mar 14 00:30:49 2018
(r330889)
+++ stable/11/share/mk/src.opts.mk  Wed Mar 14 01:38:47 2018
(r330890)
@@ -397,6 +397,7 @@ MK_BINUTILS_BOOTSTRAP:= no
 MK_CLANG_BOOTSTRAP:= no
 MK_ELFTOOLCHAIN_BOOTSTRAP:= no
 MK_GCC_BOOTSTRAP:= no
+MK_LLD_BOOTSTRAP:= no
 .endif
 
 .if ${MK_META_MODE} == "yes"
___
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: r330888 - in stable/11: share/man/man4 sys/dev/isp

2018-03-13 Thread Alexander Motin
Author: mav
Date: Wed Mar 14 00:27:25 2018
New Revision: 330888
URL: https://svnweb.freebsd.org/changeset/base/330888

Log:
  MFC r330121:
  Add support for Enhanced Gen 5 (16Gb) and Gen 6 (32Gb) QLogic FC HBAs.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/share/man/man4/isp.4
  stable/11/sys/dev/isp/isp.c
  stable/11/sys/dev/isp/isp_pci.c
  stable/11/sys/dev/isp/ispmbox.h
  stable/11/sys/dev/isp/ispvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/isp.4
==
--- stable/11/share/man/man4/isp.4  Wed Mar 14 00:04:58 2018
(r330887)
+++ stable/11/share/man/man4/isp.4  Wed Mar 14 00:27:25 2018
(r330888)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2009-2017 Alexander Motin 
+.\" Copyright (c) 2009-2018 Alexander Motin 
 .\" Copyright (c) 2006 Marcus Alves Grando
 .\" Copyright (c) 1998-2001 Matthew Jacob, for NASA/Ames Research Center
 .\"
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 3, 2017
+.Dd February 27, 2018
 .Dt ISP 4
 .Os
 .Sh NAME
@@ -139,6 +139,10 @@ Optical 4Gb Fibre Channel PCIe cards.
 Optical 8Gb Fibre Channel PCIe cards.
 .It Qlogic 267x/836x (aka 2031/8031)
 Optical 16Gb FC/FCoE PCIe cards.
+.It Qlogic 2690/2692/2694 (aka 2684/2692)
+Optical 16Gb Fibre Channel PCIe cards.
+.It Qlogic 2740/2742/2764 (aka 2722/2714)
+Optical 32Gb Fibre Channel PCIe cards.
 .El
 .Sh CONFIGURATION OPTIONS
 Target mode support for Fibre Channel adapters may be enabled with the

Modified: stable/11/sys/dev/isp/isp.c
==
--- stable/11/sys/dev/isp/isp.c Wed Mar 14 00:04:58 2018(r330887)
+++ stable/11/sys/dev/isp/isp.c Wed Mar 14 00:27:25 2018(r330888)
@@ -1,5 +1,5 @@
 /*-
- *  Copyright (c) 2009-2017 Alexander Motin 
+ *  Copyright (c) 2009-2018 Alexander Motin 
  *  Copyright (c) 1997-2009 by Matthew Jacob
  *  All rights reserved.
  *
@@ -224,8 +224,11 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
btype = "2532";
break;
case ISP_HA_FC_2600:
-   btype = "2031";
+   btype = "2600";
break;
+   case ISP_HA_FC_2700:
+   btype = "2700";
+   break;
default:
break;
}
@@ -2018,7 +2021,7 @@ isp_fibre_init_2400(ispsoftc_t *isp)
}
 
icbp->icb_execthrottle = DEFAULT_EXEC_THROTTLE(isp);
-   if (icbp->icb_execthrottle < 1) {
+   if (icbp->icb_execthrottle < 1 && !IS_26XX(isp)) {
isp_prt(isp, ISP_LOGERR, "bad execution throttle of %d- using 
%d", DEFAULT_EXEC_THROTTLE(isp), ICB_DFLT_THROTTLE);
icbp->icb_execthrottle = ICB_DFLT_THROTTLE;
}
@@ -2123,11 +2126,15 @@ isp_fibre_init_2400(ispsoftc_t *isp)
} else if (isp->isp_confopts & ISP_CFG_16GB) {
icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_MASK;
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_16GB;
+   } else if (isp->isp_confopts & ISP_CFG_32GB) {
+   icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_MASK;
+   icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_32GB;
} else {
switch (icbp->icb_fwoptions3 & ICB2400_OPT3_RATE_MASK) {
case ICB2400_OPT3_RATE_4GB:
case ICB2400_OPT3_RATE_8GB:
case ICB2400_OPT3_RATE_16GB:
+   case ICB2400_OPT3_RATE_32GB:
case ICB2400_OPT3_RATE_AUTO:
break;
case ICB2400_OPT3_RATE_2GB:
@@ -3092,6 +3099,8 @@ not_on_fabric:
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
if (mbs.param[1] == MBGSD_10GB)
fcp->isp_gbspeed = 10;
+   else if (mbs.param[1] == MBGSD_32GB)
+   fcp->isp_gbspeed = 32;
else if (mbs.param[1] == MBGSD_16GB)
fcp->isp_gbspeed = 16;
else if (mbs.param[1] == MBGSD_8GB)
@@ -5900,6 +5909,13 @@ isp_parse_async_fc(ispsoftc_t *isp, uint16_t mbox)
isp_prt(isp, ISP_LOGERR, "Temperature alert (subcode 0x%x)",
ISP_READ(isp, OUTMAILBOX1));
break;
+   case ASYNC_TRANSCEIVER_INSERTION:
+   isp_prt(isp, ISP_LOGDEBUG0, "Transceiver insertion (0x%x)",
+   ISP_READ(isp, OUTMAILBOX1));
+   break;
+   case ASYNC_TRANSCEIVER_REMOVAL:
+   isp_prt(isp, ISP_LOGDEBUG0, "Transceiver removal");
+   break;
case ASYNC_AUTOLOAD_FW_COMPLETE:
isp_prt(isp, ISP_LOGDEBUG0, "Autoload FW init complete");
break;
@@ -6824,7 +6840,7 @@ 

Re: svn commit: r330885 - head/sys/modules/cam

2018-03-13 Thread Brooks Davis
On Tue, Mar 13, 2018 at 11:36:15PM +, Warner Losh wrote:
> Author: imp
> Date: Tue Mar 13 23:36:15 2018
> New Revision: 330885
> URL: https://svnweb.freebsd.org/changeset/base/330885
> 
> Log:
>   We need opt_compat.h after r330819 and 330820.
>   
>   Add opt_compat.h to fix the stand-alone build case.

Sorry about that.  I only tested with buildkernel.  I'll MFC this before
either of those.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r330887 - head/usr.sbin/cxgbetool

2018-03-13 Thread Navdeep Parhar
Author: np
Date: Wed Mar 14 00:04:58 2018
New Revision: 330887
URL: https://svnweb.freebsd.org/changeset/base/330887

Log:
  cxgbetool(8): Add the ability to decode hardware TCBs.
  
  Obtained from:Chelsio Communications
  MFC after:1 week
  Sponsored by: Chelsio Communications

Added:
  head/usr.sbin/cxgbetool/tcb_common.c   (contents, props changed)
  head/usr.sbin/cxgbetool/tcb_common.h   (contents, props changed)
  head/usr.sbin/cxgbetool/tcbinfot4.c   (contents, props changed)
  head/usr.sbin/cxgbetool/tcbinfot5.c   (contents, props changed)
  head/usr.sbin/cxgbetool/tcbinfot6.c   (contents, props changed)
  head/usr.sbin/cxgbetool/tcbshowt4.c   (contents, props changed)
  head/usr.sbin/cxgbetool/tcbshowt5.c   (contents, props changed)
  head/usr.sbin/cxgbetool/tcbshowt6.c   (contents, props changed)
Modified:
  head/usr.sbin/cxgbetool/Makefile
  head/usr.sbin/cxgbetool/cxgbetool.c
Directory Properties:
  head/usr.sbin/cxgbetool/reg_defs_t5.c   (props changed)
  head/usr.sbin/cxgbetool/reg_defs_t6.c   (props changed)

Modified: head/usr.sbin/cxgbetool/Makefile
==
--- head/usr.sbin/cxgbetool/MakefileTue Mar 13 23:37:33 2018
(r330886)
+++ head/usr.sbin/cxgbetool/MakefileWed Mar 14 00:04:58 2018
(r330887)
@@ -2,6 +2,11 @@
 
 PROG=  cxgbetool
 MAN=   cxgbetool.8
+SRCS=  cxgbetool.c
+SRCS+= tcb_common.c
+SRCS+= tcbinfot4.c tcbshowt4.c
+SRCS+= tcbinfot5.c tcbshowt5.c
+SRCS+= tcbinfot6.c tcbshowt6.c
 CFLAGS+= -I${SRCTOP}/sys/dev/cxgbe -I${SRCTOP}/sys -I.
 WARNS?= 2
 

Modified: head/usr.sbin/cxgbetool/cxgbetool.c
==
--- head/usr.sbin/cxgbetool/cxgbetool.c Tue Mar 13 23:37:33 2018
(r330886)
+++ head/usr.sbin/cxgbetool/cxgbetool.c Wed Mar 14 00:04:58 2018
(r330887)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "t4_ioctl.h"
+#include "tcb_common.h"
 
 #define in_range(val, lo, hi) ( val < 0 || (val <= hi && val >= lo))
 #definemax(x, y) ((x) > (y) ? (x) : (y))
@@ -2102,6 +2103,7 @@ memdump(int argc, const char *argv[])
 static void
 show_tcb(uint32_t *buf, uint32_t len)
 {
+   unsigned char *tcb = (unsigned char *)buf;
const char *s;
int i, n = 8;
 
@@ -2112,6 +2114,10 @@ show_tcb(uint32_t *buf, uint32_t len)
}
printf("\n");
}
+   set_tcb_info(TIDTYPE_TCB, chip_id);
+   set_print_style(PRNTSTYL_COMP);
+   swizzle_tcb(tcb);
+   parse_n_display_xcb(tcb);
 }
 
 #define A_TP_CMM_TCB_BASE 0x7d10

Added: head/usr.sbin/cxgbetool/tcb_common.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/cxgbetool/tcb_common.cWed Mar 14 00:04:58 2018
(r330887)
@@ -0,0 +1,703 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2018 Chelsio Communications, Inc.
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "tcb_common.h"
+
+/***:---
+ ***: externals
+ ***:---
+ */
+
+extern _TCBVAR g_tcb_info4[];
+extern _TCBVAR g_scb_info4[];
+extern _TCBVAR g_fcb_info4[];
+extern void t4_display_tcb_aux_0(_TCBVAR *tvp,int aux);
+extern void t4_display_tcb_aux_1(_TCBVAR *tvp,int aux);
+extern void t4_display_tcb_aux_2(_TCBVAR *tvp,int aux);
+extern void t4_display_tcb_aux_3(_TCBVAR *tvp,int aux);
+
+extern _TCBVAR g_tcb_info5[];
+extern 

svn commit: r330886 - head/share/examples

2018-03-13 Thread Devin Teske
Author: dteske
Date: Tue Mar 13 23:37:33 2018
New Revision: 330886
URL: https://svnweb.freebsd.org/changeset/base/330886

Log:
  Install files added in SVN's r295373, r295457, r295542
  
  Reported by:  woodsb02
  MFC after:3 days
  X-MFC to: stable/11

Modified:
  head/share/examples/Makefile

Modified: head/share/examples/Makefile
==
--- head/share/examples/MakefileTue Mar 13 23:36:15 2018
(r330885)
+++ head/share/examples/MakefileTue Mar 13 23:37:33 2018
(r330886)
@@ -76,6 +76,12 @@ XFILES=  BSD_daemon/FreeBSD.pfa \
indent/indent.pro \
ipfw/change_rules.sh \
jails/README \
+   jails/VIMAGE \
+   jails/jail.xxx.conf \
+   jails/jib \
+   jails/jng \
+   jails/rc.conf.jails \
+   jails/rcjail.xxx.conf \
kld/Makefile \
kld/cdev/Makefile \
kld/cdev/README \
___
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: r330885 - head/sys/modules/cam

2018-03-13 Thread Warner Losh
Author: imp
Date: Tue Mar 13 23:36:15 2018
New Revision: 330885
URL: https://svnweb.freebsd.org/changeset/base/330885

Log:
  We need opt_compat.h after r330819 and 330820.
  
  Add opt_compat.h to fix the stand-alone build case.
  
  Sponsored by: Netflix.

Modified:
  head/sys/modules/cam/Makefile

Modified: head/sys/modules/cam/Makefile
==
--- head/sys/modules/cam/Makefile   Tue Mar 13 23:05:51 2018
(r330884)
+++ head/sys/modules/cam/Makefile   Tue Mar 13 23:36:15 2018
(r330885)
@@ -8,6 +8,7 @@ KMOD=   cam
 
 # See sys/conf/options for the flags that go into the different opt_*.h files.
 SRCS=  opt_cam.h
+SRCS=  opt_compat.h
 SRCS+= opt_ada.h
 SRCS+= opt_scsi.h
 SRCS+= opt_cd.h
___
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: r330884 - in head/sys: dev/cxgbe dev/cxgbe/firmware dev/cxgbe/tom modules/cxgbe/tom

2018-03-13 Thread John Baldwin
Author: jhb
Date: Tue Mar 13 23:05:51 2018
New Revision: 330884
URL: https://svnweb.freebsd.org/changeset/base/330884

Log:
  Support for TLS offload of TOE connections on T6 adapters.
  
  The TOE engine in Chelsio T6 adapters supports offloading of TLS
  encryption and TCP segmentation for offloaded connections.  Sockets
  using TLS are required to use a set of custom socket options to upload
  RX and TX keys to the NIC and to enable RX processing.  Currently
  these socket options are implemented as TCP options in the vendor
  specific range.  A patched OpenSSL library will be made available in a
  port / package for use with the TLS TOE support.
  
  TOE sockets can either offload both transmit and reception of TLS
  records or just transmit.  TLS offload (both RX and TX) is enabled by
  setting the dev.t6nex..tls sysctl to 1 and requires TOE to be
  enabled on the relevant interface.  Transmit offload can be used on
  any "normal" or TLS TOE socket by using the custom socket option to
  program a transmit key.  This permits most TOE sockets to
  transparently offload TLS when applications use a patched SSL library
  (e.g. using LD_LIBRARY_PATH to request use of a patched OpenSSL
  library).  Receive offload can only be used with TOE sockets using the
  TLS mode.  The dev.t6nex.0.toe.tls_rx_ports sysctl can be set to a
  list of TCP port numbers.  Any connection with either a local or
  remote port number in that list will be created as a TLS socket rather
  than a plain TOE socket.  Note that although this sysctl accepts an
  arbitrary list of port numbers, the sysctl(8) tool is only able to set
  sysctl nodes to a single value.  A TLS socket will hang without
  receiving data if used by an application that is not using a patched
  SSL library.  Thus, the tls_rx_ports node should be used with care.
  For a server mostly concerned with offloading TLS transmit, this node
  is not needed as plain TOE sockets will fall back to software crypto
  when using an unpatched SSL library.
  
  New per-interface statistics nodes are added giving counts of TLS
  packets and payload bytes (payload bytes do not include TLS headers or
  authentication tags/MACs) offloaded via the TOE engine, e.g.:
  
  dev.cc.0.stats.rx_tls_octets: 149
  dev.cc.0.stats.rx_tls_records: 13
  dev.cc.0.stats.tx_tls_octets: 26501823
  dev.cc.0.stats.tx_tls_records: 1620
  
  TLS transmit work requests are constructed by a new variant of
  t4_push_frames() called t4_push_tls_records() in tom/t4_tls.c.
  
  TLS transmit work requests require a buffer containing IVs.  If the
  IVs are too large to fit into the work request, a separate buffer is
  allocated when constructing a work request.  This buffer is associated
  with the transmit descriptor and freed when the descriptor is ACKed by
  the adapter.
  
  Received TLS frames use two new CPL messages.  The first message is a
  CPL_TLS_DATA containing the decryped payload of a single TLS record.
  The handler places the mbuf containing the received payload on an
  mbufq in the TOE pcb.  The second message is a CPL_RX_TLS_CMP message
  which includes a copy of the TLS header and indicates if there were
  any errors.  The handler for this message places the TLS header into
  the socket buffer followed by the saved mbuf with the payload data.
  Both of these handlers are contained in tom/t4_tls.c.
  
  A few routines were exposed from t4_cpl_io.c for use by t4_tls.c
  including send_rx_credits(), a new send_rx_modulate(), and
  t4_close_conn().
  
  TLS keys for both transmit and receive are stored in onboard memory
  in the NIC in the "TLS keys" memory region.
  
  In some cases a TLS socket can hang with pending data available in the
  NIC that is not delivered to the host.  As a workaround, TLS sockets
  are more aggressive about sending CPL_RX_DATA_ACK messages anytime that
  any data is read from a TLS socket.  In addition, a fallback timer will
  periodically send CPL_RX_DATA_ACK messages to the NIC for connections
  that are still in the handshake phase.  Once the connection has
  finished the handshake and programmed RX keys via the socket option,
  the timer is stopped.
  
  A new function select_ulp_mode() is used to determine what sub-mode a
  given TOE socket should use (plain TOE, DDP, or TLS).  The existing
  set_tcpddp_ulp_mode() function has been renamed to set_ulp_mode() and
  handles initialization of TLS-specific state when necessary in
  addition to DDP-specific state.
  
  Since TLS sockets do not receive individual TCP segments but always
  receive full TLS records, they can receive more data than is available
  in the current window (e.g. if a 16k TLS record is received but the
  socket buffer is itself 16k).  To cope with this, just drop the window
  to 0 when this happens, but track the overage and "eat" the overage as
  it is read from the socket buffer not opening the window (or adding
  rx_credits) for the overage bytes.
  
  Reviewed by:  np (earlier version)
  

svn commit: r330883 - head/stand/userboot/userboot

2018-03-13 Thread Gleb Smirnoff
Author: glebius
Date: Tue Mar 13 22:54:29 2018
New Revision: 330883
URL: https://svnweb.freebsd.org/changeset/base/330883

Log:
  Fix typo that misteriously passes compilation.

Modified:
  head/stand/userboot/userboot/main.c

Modified: head/stand/userboot/userboot/main.c
==
--- head/stand/userboot/userboot/main.c Tue Mar 13 21:42:38 2018
(r330882)
+++ head/stand/userboot/userboot/main.c Tue Mar 13 22:54:29 2018
(r330883)
@@ -159,7 +159,7 @@ extract_currdev(void)
//bzero(, sizeof(dev));
 
 #if defined(USERBOOT_ZFS_SUPPORT)
-   CT_ASSERT(sizeof(struct disk_devdesc) >= sizeof(struct zfs_devdesc));
+   CTASSERT(sizeof(struct disk_devdesc) >= sizeof(struct zfs_devdesc));
if (userboot_zfs_found) {
struct zfs_devdesc zdev;

___
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: r330882 - head/sys/dev/cxgbe/tom

2018-03-13 Thread John Baldwin
Author: jhb
Date: Tue Mar 13 21:42:38 2018
New Revision: 330882
URL: https://svnweb.freebsd.org/changeset/base/330882

Log:
  Simplify error handling in t4_tom.ko module loading.
  
  - Change t4_ddp_mod_load() to return void instead of always returning
success.  This avoids having to pretend to have proper support for
unloading when only part of t4_tom_mod_load() has run.
  - If t4_register_uld() fails, don't invoke t4_tom_mod_unload() directly.
The module handling code in the kernel invokes MOD_UNLOAD on a module
whose MOD_LOAD fails with an error already.
  
  Reviewed by:  np (part of a larger patch)
  MFC after:1 month
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/tom/t4_ddp.c
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/sys/dev/cxgbe/tom/t4_ddp.c
==
--- head/sys/dev/cxgbe/tom/t4_ddp.c Tue Mar 13 20:54:18 2018
(r330881)
+++ head/sys/dev/cxgbe/tom/t4_ddp.c Tue Mar 13 21:42:38 2018
(r330882)
@@ -1939,7 +1939,7 @@ t4_aio_queue_ddp(struct socket *so, struct kaiocb *job
return (0);
 }
 
-int
+void
 t4_ddp_mod_load(void)
 {
 
@@ -1948,7 +1948,6 @@ t4_ddp_mod_load(void)
TAILQ_INIT(_orphan_pagesets);
mtx_init(_orphan_pagesets_lock, "ddp orphans", NULL, MTX_DEF);
TASK_INIT(_orphan_task, 0, ddp_free_orphan_pagesets, NULL);
-   return (0);
 }
 
 void

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==
--- head/sys/dev/cxgbe/tom/t4_tom.c Tue Mar 13 20:54:18 2018
(r330881)
+++ head/sys/dev/cxgbe/tom/t4_tom.c Tue Mar 13 21:42:38 2018
(r330882)
@@ -1170,7 +1170,6 @@ t4_aio_queue_tom(struct socket *so, struct kaiocb *job
 static int
 t4_tom_mod_load(void)
 {
-   int rc;
struct protosw *tcp_protosw, *tcp6_protosw;
 
/* CPL handlers */
@@ -1178,9 +1177,7 @@ t4_tom_mod_load(void)
t4_init_listen_cpl_handlers();
t4_init_cpl_io_handlers();
 
-   rc = t4_ddp_mod_load();
-   if (rc != 0)
-   return (rc);
+   t4_ddp_mod_load();
 
tcp_protosw = pffindproto(PF_INET, IPPROTO_TCP, SOCK_STREAM);
if (tcp_protosw == NULL)
@@ -1202,11 +1199,7 @@ t4_tom_mod_load(void)
ifaddr_evhandler = EVENTHANDLER_REGISTER(ifaddr_event,
t4_tom_ifaddr_event, NULL, EVENTHANDLER_PRI_ANY);
 
-   rc = t4_register_uld(_uld_info);
-   if (rc != 0)
-   t4_tom_mod_unload();
-
-   return (rc);
+   return (t4_register_uld(_uld_info));
 }
 
 static void

Modified: head/sys/dev/cxgbe/tom/t4_tom.h
==
--- head/sys/dev/cxgbe/tom/t4_tom.h Tue Mar 13 20:54:18 2018
(r330881)
+++ head/sys/dev/cxgbe/tom/t4_tom.h Tue Mar 13 21:42:38 2018
(r330882)
@@ -389,7 +389,7 @@ void t4_free_page_pods(struct ppod_reservation *);
 int t4_soreceive_ddp(struct socket *, struct sockaddr **, struct uio *,
 struct mbuf **, struct mbuf **, int *);
 int t4_aio_queue_ddp(struct socket *, struct kaiocb *);
-int t4_ddp_mod_load(void);
+void t4_ddp_mod_load(void);
 void t4_ddp_mod_unload(void);
 void ddp_assert_empty(struct toepcb *);
 void ddp_init_toep(struct toepcb *);
___
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: r330881 - head/sys/sys

2018-03-13 Thread Brooks Davis
Author: brooks
Date: Tue Mar 13 20:54:18 2018
New Revision: 330881
URL: https://svnweb.freebsd.org/changeset/base/330881

Log:
  md_pad is used by MDIOCLIST and not available for future use.
  
  MFC after:1 week

Modified:
  head/sys/sys/mdioctl.h

Modified: head/sys/sys/mdioctl.h
==
--- head/sys/sys/mdioctl.h  Tue Mar 13 20:39:06 2018(r330880)
+++ head/sys/sys/mdioctl.h  Tue Mar 13 20:54:18 2018(r330881)
@@ -64,7 +64,7 @@ struct md_ioctl {
int md_fwheads; /* firmware heads */
int md_fwsectors;   /* firmware sectors */
char*md_label;  /* label of the device */
-   int md_pad[MDNPAD]; /* padding for future ideas */
+   int md_pad[MDNPAD]; /* storage for MDIOCLIST */
 };
 
 #define MD_NAME"md"
___
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: r330880 - head/sys/dev/md

2018-03-13 Thread Brooks Davis
Author: brooks
Date: Tue Mar 13 20:39:06 2018
New Revision: 330880
URL: https://svnweb.freebsd.org/changeset/base/330880

Log:
  Don't overflow the kernel struct mdio in the MDIOCLIST ioctl.
  
  Always terminate the list with -1 and document the ioctl behavior.
  This preserves existing behavior as seen from userspace with the
  addition of the unconditional termination which will not be seen by
  working consumers of MDIOCLIST.
  
  Because this ioctl can only be performed by root (in default
  configurations) and is not used in the base system this bug is not
  deemed to warrant either a security advisory or an eratta notice.
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  Discussed with:   security-officer (gordon)
  MFC after:3 days
  Security: kernel heap buffer overflow
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14685

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

Modified: head/sys/dev/md/md.c
==
--- head/sys/dev/md/md.cTue Mar 13 20:35:32 2018(r330879)
+++ head/sys/dev/md/md.cTue Mar 13 20:39:06 2018(r330880)
@@ -1750,13 +1750,24 @@ err_after_new:
strlen(sc->file) + 1);
return (error);
case MDIOCLIST:
+   /*
+* Write the number of md devices to mdio->md_pad[0].
+* Write the unit number of the first (MDNPAD - 2) units
+* to mdio->md_pad[1::(MDNPAD - 2)] and terminate the
+* list with -1.
+*
+* XXX: There is currently no mechanism to retrieve unit
+* numbers for more than (MDNPAD - 2) units.
+*
+* XXX: Due to the use of LIST_INSERT_HEAD in mdnew(), the
+* list of visible unit numbers not stable.
+*/
i = 1;
LIST_FOREACH(sc, _softc_list, list) {
-   if (i == MDNPAD - 1)
-   mdio->md_pad[i] = -1;
-   else
+   if (i < MDNPAD - 1)
mdio->md_pad[i++] = sc->unit;
}
+   mdio->md_pad[MIN(i, MDNPAD - 1)] = -1;
mdio->md_pad[0] = i - 1;
return (0);
default:
___
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: r330879 - head/lib/libfigpar

2018-03-13 Thread Devin Teske
Author: dteske
Date: Tue Mar 13 20:35:32 2018
New Revision: 330879
URL: https://svnweb.freebsd.org/changeset/base/330879

Log:
  Fix lint/igor warnings

Modified:
  head/lib/libfigpar/figpar.3

Modified: head/lib/libfigpar/figpar.3
==
--- head/lib/libfigpar/figpar.3 Tue Mar 13 20:31:07 2018(r330878)
+++ head/lib/libfigpar/figpar.3 Tue Mar 13 20:35:32 2018(r330879)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Nov 2, 2015
+.Dd Mar 13, 2018
 .Dt FIGPAR 3
 .Os
 .Sh NAME
@@ -38,22 +38,30 @@
 .In figpar.h
 .Ft int
 .Fo parse_config
-.Fa "struct figpar_config options[], const char *path"
-.Fa "int \*[lp]*unknown\*[rp]\*[lp]struct figpar_config *option, uint32_t line"
-.Fa "char *directive, char *value\*[rp], uint8_t processing_options"
+.Fa "struct figpar_config options[]"
+.Fa "const char *path"
+.Fa "int \*[lp]*unknown\*[rp]\*[lp]struct figpar_config *option"
+.Fa "uint32_t line"
+.Fa "char *directive"
+.Fa "char *value\*[rp]"
+.Fa "uint8_t processing_options"
 .Fc
 .Ft "struct figpar_config *"
 .Fo get_config_option
-.Fa "struct figpar_config options[], const char *directive"
+.Fa "struct figpar_config options[]"
+.Fa "const char *directive"
 .Fc
 .In string_m.h
 .Ft int
 .Fo replaceall
-.Fa "char *source, const char *find, const char *replace"
+.Fa "char *source"
+.Fa "const char *find"
+.Fa "const char *replace"
 .Fc
 .Ft unsigned int
 .Fo strcount
-.Fa "const char *source, const char *find"
+.Fa "const char *source"
+.Fa "const char *find"
 .Fc
 .Ft void
 .Fo strexpand
@@ -70,7 +78,8 @@
 .Sh DESCRIPTION
 The
 .Nm
-library provides a light-weight, portable framework for parsing configuration
+library provides a light-weight,
+portable framework for parsing configuration
 files.
 The library uses
 .Xr open 2 ,
@@ -87,8 +96,9 @@ provides raw data to a set of callback functions.
 These callback functions can in-turn initiate abort through their return value,
 allowing custom syntax validation during parsing.
 .Pp
-Configuration directives, types, and callback functions are provided through
-data structures defined in
+Configuration directives,
+types,
+and callback functions are provided through data structures defined in
 .In figpar.h :
 .Bd -literal -offset indent
 struct figpar_config {
@@ -132,7 +142,7 @@ argument to
 .Fn parse_config
 is a mask of bit fields which indicate various
 processing options.
-The possible flags are as follows:
+The possible flags are:
 .Bl -tag -width FIGPAR_BREAK_ON_SEMICOLON
 .It Dv FIGPAR_BREAK_ON_EQUALS
 An equals sign
@@ -151,7 +161,8 @@ Normally directives are matched case insensitively usi
 .Xr fnmatch 3 .
 This flag enables directive matching to be case sensitive.
 .It Dv FIGPAR_REQUIRE_EQUALS
-If a directive is not followed by an equals, processing is aborted.
+If a directive is not followed by an equals,
+processing is aborted.
 .It Dv FIGPAR_STRICT_EQUALS
 Equals must be part of the directive to be considered a delimiter between
 directive and value.
@@ -159,7 +170,7 @@ directive and value.
 .Pp
 The
 .Fa options
-struct array pointer can be NULL and every directive will invoke the
+struct array pointer can be NULL and every directive will run the
 .Fn unknown
 function argument.
 .Pp
@@ -168,13 +179,16 @@ The directive for each figpar_config item in the
 options argument is matched against each parsed directive using
 .Xr fnmatch 3
 until a match is found.
-If a match is found, the
+If a match is found,
+the
 .Fn action
-function for that figpar_config directive is invoked with the line number,
-directive, and value.
-Otherwise if no match, the
+function for that figpar_config directive is run with the line number,
+directive,
+and value.
+Otherwise if no match,
+the
 .Fn unknown
-function is invoked
+function is run
 .Pq with the same arguments .
 .Pp
 If either
@@ -197,19 +211,20 @@ is entirely optional as-is the use of
 .Fa "enum figpar_cfgtype"
 or
 .Fa "union figpar_cfgvalue" .
-For example, you could choose to pass a NULL pointer to
+For example,
+a NULL pointer can be passed to
 .Fn parse_config
-for the first argument and then provide a simple
+for the first argument while providing a simple
 .Fa unknown
 function based on
 .Xr queue 3
-that populates a singly-linked list of your own struct containing the
+that populates a singly-linked list of a struct containing the
 .Fa directive
 and
 .Fa value .
 .Pp
-In addition, the following miscellaneous string manipulation routines are
-provided by
+In addition,
+miscellaneous string manipulation routines are provided by
 .In string_m.h :
 .Bl -tag -width strexpandnl()
 .It Fn replaceall
@@ -224,8 +239,7 @@ Count the number of occurrences of one string that app
 .Fa source
 string.
 Return value is the total count.
-An example use would be if you need to know how large a block of memory needs
-to be for a
+An example use would be to show how large a block of memory needs to be for a
 .Fn replaceall
 series.
 .It Fn 

svn commit: r330878 - head/lib/libdpv

2018-03-13 Thread Devin Teske
Author: dteske
Date: Tue Mar 13 20:31:07 2018
New Revision: 330878
URL: https://svnweb.freebsd.org/changeset/base/330878

Log:
  Fix typo and lint/igor warnings

Modified:
  head/lib/libdpv/dpv.3

Modified: head/lib/libdpv/dpv.3
==
--- head/lib/libdpv/dpv.3   Tue Mar 13 20:16:07 2018(r330877)
+++ head/lib/libdpv/dpv.3   Tue Mar 13 20:31:07 2018(r330878)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Jan 26, 2016
+.Dd Mar 13, 2018
 .Dt DPV 3
 .Os
 .Sh NAME
@@ -36,7 +36,8 @@
 .In dpv.h
 .Ft int
 .Fo dpv
-.Fa "struct dpv_config *config, struct dpv_file_node *file_list"
+.Fa "struct dpv_config *config"
+.Fa "struct dpv_file_node *file_list"
 .Fc
 .Ft void
 .Fo dpv_free
@@ -60,8 +61,7 @@ or
 The
 .Fn dpv
 .Fa config
-argument contains the following properties for configuring global display
-features:
+argument properties for configuring global display features:
 .Bd -literal -offset indent
 struct dpv_config {
 uint8_t  keep_tite; /* Cleaner exit for scripts */
@@ -113,11 +113,12 @@ member of the
 .Fn dpv
 .Fa config
 argument is a mask of bit fields indicating various processing options.
-Possible flags are as follows:
+Possible flags are:
 .Bl -tag -width DPV_NO_OVERRUN
 .It Dv DPV_TEST_MODE
 Enable test mode.
-In test mode, the
+In test mode,
+the
 .Fn action
 callback of the
 .Fa config
@@ -126,18 +127,21 @@ Appends
 .Dq [TEST MODE]
 to the status line
 .Po
-to override, set the
+to override,
+set the
 .Va status_format
 member of the
 .Fn dpv
 .Fa config
 argument;
-e.g., to
+for example,
+to
 .Dv DPV_STATUS_DEFAULT
 .Pc .
 .It Dv DPV_WIDE_MODE
 Enable wide mode.
-In wide mode, the length of the
+In wide mode,
+the length of the
 .Va aprompt
 and
 .Va pprompt
@@ -169,7 +173,8 @@ does not support color
 environment variable is ignored
 .Pc .
 .It Dv DPV_NO_OVERRUN
-When enabled, callbacks for the current
+When enabled,
+callbacks for the current
 .Vt dpv_file_node
 are terminated when
 .Fn action
@@ -189,7 +194,7 @@ argument to
 .Fn dpv
 is a pointer to a
 .Dq linked-list ,
-described as follows in
+described in
 .In dpv.h :
 .Bd -literal -offset indent
 struct dpv_file_node {
@@ -206,7 +211,8 @@ struct dpv_file_node {
 For each of the items in the
 .Fa file_list
 .Dq linked-list
-argument, the
+argument,
+the
 .Fn action
 callback member of the
 .Fn dpv
@@ -214,7 +220,7 @@ callback member of the
 argument is called.
 The
 .Fn action
-function should perform a
+function performs a
 .Dq nominal
 action on the file and return.
 The return value of
@@ -231,7 +237,7 @@ provides a reference to the current
 .Vt dpv_file_node
 being processed.
 .Fa out
-provides a file descriptor where the data should go.
+provides a file descriptor where the data goes.
 .Pp
 If the
 .Va output
@@ -244,7 +250,7 @@ the
 .Fa out
 file descriptor of
 .Fn action
-will be zero and should be ignored.
+will be zero and can be ignored.
 If
 .Fa output
 was set to DPV_OUTPUT_FILE,
@@ -257,14 +263,16 @@ was set to DPV_OUTPUT_SHELL,
 will be an open file descriptor to a pipe for a spawned shell program.
 When
 .Fa out
-is greater than zero, you should write any data you have read back to
+is greater than zero,
+write data that has been read back to
 .Fa out .
 .Pp
 To abort
 .Fn dpv ,
 either from the
 .Fn action
-callback or asynchronously from a signal handler, two globals are provided via
+callback or asynchronously from a signal handler,
+two globals are provided via
 .In dpv.h :
 .Bd -literal -offset indent
 extern int dpv_interrupt; /* Set to TRUE in interrupt handler */
@@ -272,11 +280,12 @@ extern int dpv_abort; /* Set to true in callback t
 .Ed
 .Pp
 These globals are not automatically reset and must be manually maintained.
-Don't forget to reset these globals before subsequent invocations of
+Do not forget to reset these globals before subsequent invocations of
 .Fn dpv
 when making multiple calls from the same program.
 .Pp
-In addition, the
+In addition,
+the
 .Va status
 member of the
 .Fn action
@@ -284,7 +293,7 @@ member of the
 argument can be used to control callbacks for the current file.
 The
 .Va status
-member can be set to any of the following from
+member can be set to any of the below from
 .In dpv.h :
 .Bd -literal -offset indent
 enum dpv_status {
@@ -296,13 +305,17 @@ enum dpv_status {
 .Pp
 The default
 .Fa status
-is zero, DPV_STATUS_RUNING, which keeps the callbacks coming for the current
+is zero,
+DPV_STATUS_RUNNING,
+which keeps the callbacks coming for the current
 .Fn file .
 Setting
 .Ql file->status
 to anything other than DPV_STATUS_RUNNING will cause
 .Fn dpv
-to loop to the next file, effecting the next callback, if any.
+to loop to the next file,
+effecting the next callback,
+if any.
 .Pp
 The
 .Fn action
@@ -318,7 +331,7 @@ Percentages are reported through the
 return value of the
 .Fn action
 callback.
-Throughput statistics are calculated from the following global
+Throughput 

svn commit: r330876 - head/sys/dev/isp

2018-03-13 Thread Brooks Davis
Author: brooks
Date: Tue Mar 13 19:56:10 2018
New Revision: 330876
URL: https://svnweb.freebsd.org/changeset/base/330876

Log:
  Fix ISP_FC_LIP and ISP_RESCAN on big-endian 64-bit systems.
  
  For _IO() ioctls, addr is a pointer to uap->data which is a caddr_t.
  When the caddr_t stores an int, dereferencing addr as an (int *) results
  in truncation on little-endian 64-bit systems and corruption (owing to
  extracting top bits) on big-endian 64-bit systems. In practice the
  value of chan was probably always zero on systems of the latter type as
  all such FreeBSD platforms use a register-based calling convention.
  
  Reviewed by:  mav
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14673

Modified:
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Tue Mar 13 19:49:06 2018
(r330875)
+++ head/sys/dev/isp/isp_freebsd.c  Tue Mar 13 19:56:10 2018
(r330876)
@@ -444,7 +444,7 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int
 
case ISP_RESCAN:
if (IS_FC(isp)) {
-   chan = *(int *)addr;
+   chan = *(intptr_t *)addr;
if (chan < 0 || chan >= isp->isp_nchan) {
retval = -ENXIO;
break;
@@ -461,7 +461,7 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int
 
case ISP_FC_LIP:
if (IS_FC(isp)) {
-   chan = *(int *)addr;
+   chan = *(intptr_t *)addr;
if (chan < 0 || chan >= isp->isp_nchan) {
retval = -ENXIO;
break;
___
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: r330875 - head/usr.sbin/usbconfig

2018-03-13 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Mar 13 19:49:06 2018
New Revision: 330875
URL: https://svnweb.freebsd.org/changeset/base/330875

Log:
  Add "usbconfig dump_all_desc", a subcommand to dump all device and config
  descriptors.
  
  Reviewed by:  hselasky@
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/usbconfig/usbconfig.8
  head/usr.sbin/usbconfig/usbconfig.c

Modified: head/usr.sbin/usbconfig/usbconfig.8
==
--- head/usr.sbin/usbconfig/usbconfig.8 Tue Mar 13 19:28:03 2018
(r330874)
+++ head/usr.sbin/usbconfig/usbconfig.8 Tue Mar 13 19:49:06 2018
(r330875)
@@ -97,6 +97,8 @@ Remove a quirk.
 Add quirk for the currently selected USB device.
 .It Cm remove_quirk Ar quirk_name
 Remove a quirk for the currently selected USB device.
+.It Cm dump_all_desc
+Display the device and configuration descriptors.
 .It Cm dump_quirk_names
 Display the list of supported quirk names.
 .It Cm dump_device_quirks

Modified: head/usr.sbin/usbconfig/usbconfig.c
==
--- head/usr.sbin/usbconfig/usbconfig.c Tue Mar 13 19:28:03 2018
(r330874)
+++ head/usr.sbin/usbconfig/usbconfig.c Tue Mar 13 19:49:06 2018
(r330875)
@@ -77,6 +77,7 @@ struct options {
uint8_t got_power_on:1;
uint8_t got_dump_device_quirks:1;
uint8_t got_dump_quirk_names:1;
+   uint8_t got_dump_all_desc:1;
uint8_t got_dump_device_desc:1;
uint8_t got_dump_curr_config:1;
uint8_t got_dump_all_config:1;
@@ -112,6 +113,7 @@ enum {
T_SHOW_IFACE_DRIVER,
T_DUMP_QUIRK_NAMES,
T_DUMP_DEVICE_QUIRKS,
+   T_DUMP_ALL_DESC,
T_DUMP_DEVICE_DESC,
T_DUMP_CURR_CONFIG_DESC,
T_DUMP_ALL_CONFIG_DESC,
@@ -144,6 +146,7 @@ static const struct token token[] = {
{"remove_quirk", T_REMOVE_QUIRK, 1},
{"dump_quirk_names", T_DUMP_QUIRK_NAMES, 0},
{"dump_device_quirks", T_DUMP_DEVICE_QUIRKS, 0},
+   {"dump_all_desc", T_DUMP_ALL_DESC, 0},
{"dump_device_desc", T_DUMP_DEVICE_DESC, 0},
{"dump_curr_config_desc", T_DUMP_CURR_CONFIG_DESC, 0},
{"dump_all_config_desc", T_DUMP_ALL_CONFIG_DESC, 0},
@@ -283,6 +286,7 @@ usage(void)
"  remove_quirk " "\n"
"  dump_quirk_names" "\n"
"  dump_device_quirks" "\n"
+   "  dump_all_desc" "\n"
"  dump_device_desc" "\n"
"  dump_curr_config_desc" "\n"
"  dump_all_config_desc" "\n"
@@ -489,7 +493,8 @@ flush_command(struct libusb20_backend *pbe, struct opt
}
}
dump_any =
-   (opt->got_dump_device_desc ||
+   (opt->got_dump_all_desc ||
+   opt->got_dump_device_desc ||
opt->got_dump_curr_config ||
opt->got_dump_all_config ||
opt->got_dump_info);
@@ -508,6 +513,10 @@ flush_command(struct libusb20_backend *pbe, struct opt
} else if (opt->got_dump_curr_config) {
printf("\n");
dump_config(pdev, 0);
+   } else if (opt->got_dump_all_desc) {
+   printf("\n");
+   dump_device_desc(pdev);
+   dump_config(pdev, 1);
}
if (dump_any) {
printf("\n");
@@ -694,6 +703,12 @@ main(int argc, char **argv)
if (opt->got_get_template)
duplicate_option(argv[n]);
opt->got_get_template = 1;
+   opt->got_any++;
+   break;
+   case T_DUMP_ALL_DESC:
+   if (opt->got_dump_all_desc)
+   duplicate_option(argv[n]);
+   opt->got_dump_all_desc = 1;
opt->got_any++;
break;
case T_DUMP_DEVICE_DESC:
___
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: r330872 - head/bin/ps

2018-03-13 Thread John Baldwin
Author: jhb
Date: Tue Mar 13 18:30:26 2018
New Revision: 330872
URL: https://svnweb.freebsd.org/changeset/base/330872

Log:
  Add a "jail" keyword to list the name of a jail rather than its ID.
  
  Inspired by:  mwlucas
  Reviewed by:  jamie
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D14683

Modified:
  head/bin/ps/extern.h
  head/bin/ps/keyword.c
  head/bin/ps/print.c
  head/bin/ps/ps.1

Modified: head/bin/ps/extern.h
==
--- head/bin/ps/extern.hTue Mar 13 18:27:23 2018(r330871)
+++ head/bin/ps/extern.hTue Mar 13 18:30:26 2018(r330872)
@@ -55,6 +55,7 @@ char   *emulname(KINFO *, VARENT *);
 VARENT *find_varentry(VAR *);
 const   char *fmt_argv(char **, char *, char *, size_t);
 double  getpcpu(const KINFO *);
+char*jailname(KINFO *, VARENT *);
 char*kvar(KINFO *, VARENT *);
 char*label(KINFO *, VARENT *);
 char*loginclass(KINFO *, VARENT *);

Modified: head/bin/ps/keyword.c
==
--- head/bin/ps/keyword.c   Tue Mar 13 18:27:23 2018(r330871)
+++ head/bin/ps/keyword.c   Tue Mar 13 18:30:26 2018(r330872)
@@ -108,6 +108,7 @@ static VAR var[] = {
{"inblk", "INBLK", NULL, "read-blocks", USER, rvar, ROFF(ru_inblock),
LONG, "ld", 0},
{"inblock", "", "inblk", NULL, 0, NULL, 0, CHAR, NULL, 0},
+   {"jail", "JAIL", NULL, "jail-name", LJUST, jailname, 0, CHAR, NULL, 0},
{"jid", "JID", NULL, "jail-id", 0, kvar, KOFF(ki_jid), INT, "d", 0},
{"jobc", "JOBC", NULL, "job-control-count", 0, kvar, KOFF(ki_jobc),
SHORT, "d", 0},

Modified: head/bin/ps/print.c
==
--- head/bin/ps/print.c Tue Mar 13 18:27:23 2018(r330871)
+++ head/bin/ps/print.c Tue Mar 13 18:30:26 2018(r330872)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -839,4 +840,17 @@ loginclass(KINFO *k, VARENT *ve __unused)
return (strdup("-"));
}
return (strdup(k->ki_p->ki_loginclass));
+}
+
+char *
+jailname(KINFO *k, VARENT *ve __unused)
+{
+   char *name;
+
+   if (k->ki_p->ki_jid == 0)
+   return (strdup("-"));
+   name = jail_getname(k->ki_p->ki_jid);
+   if (name == NULL)
+   return (strdup("-"));
+   return (name);
 }

Modified: head/bin/ps/ps.1
==
--- head/bin/ps/ps.1Tue Mar 13 18:27:23 2018(r330871)
+++ head/bin/ps/ps.1Tue Mar 13 18:30:26 2018(r330872)
@@ -29,7 +29,7 @@
 .\" @(#)ps.1   8.3 (Berkeley) 4/18/94
 .\" $FreeBSD$
 .\"
-.Dd January 23, 2018
+.Dd March 13, 2018
 .Dt PS 1
 .Os
 .Sh NAME
@@ -576,6 +576,8 @@ group name (from egid) (alias
 .It Cm inblk
 total blocks read (alias
 .Cm inblock )
+.It Cm jail
+jail name
 .It Cm jid
 jail ID
 .It Cm jobc
___
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: r330871 - head/sys/vm

2018-03-13 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 13 18:27:23 2018
New Revision: 330871
URL: https://svnweb.freebsd.org/changeset/base/330871

Log:
  Revert the chunk from r330410 in vm_page_reclaim_run().
  
  There, the pages freed might be managed but the page's lock is not
  owned.  For KPI correctness, the page lock is requried around the call
  to vm_page_free_prep(), which is asserted.  Reclaim loop already did
  the work which could be done by vm_page_free_prep(), so the lock is
  not needed and the only consequence of not owning it is the assert
  trigger.
  
  Instead of adding the locking to satisfy the assert, revert to the
  code that calls vm_page_free_phys() directly.
  
  Reported by:  pho
  Discussed with:   jeff
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Tue Mar 13 18:24:21 2018(r330870)
+++ head/sys/vm/vm_page.c   Tue Mar 13 18:27:23 2018(r330871)
@@ -2538,7 +2538,17 @@ unlock:
}
if (m_mtx != NULL)
mtx_unlock(m_mtx);
-   vm_page_free_pages_toq(, false);
+   if ((m = SLIST_FIRST()) != NULL) {
+   vmd = VM_DOMAIN(domain);
+   vm_domain_free_lock(vmd);
+   do {
+   MPASS(vm_phys_domain(m) == domain);
+   SLIST_REMOVE_HEAD(, plinks.s.ss);
+   vm_page_free_phys(vmd, m);
+   } while ((m = SLIST_FIRST()) != NULL);
+   vm_domain_free_wakeup(vmd);
+   vm_domain_free_unlock(vmd);
+   }
return (error);
 }
 
___
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: r330870 - head/sys/powerpc/aim

2018-03-13 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Tue Mar 13 18:24:21 2018
New Revision: 330870
URL: https://svnweb.freebsd.org/changeset/base/330870

Log:
  Restore missing temporary variable, deleted by accident in r330845. This
  unbreaks the ppc32 AIM build.
  
  Reported by:  jhibbits

Modified:
  head/sys/powerpc/aim/aim_machdep.c

Modified: head/sys/powerpc/aim/aim_machdep.c
==
--- head/sys/powerpc/aim/aim_machdep.c  Tue Mar 13 17:57:53 2018
(r330869)
+++ head/sys/powerpc/aim/aim_machdep.c  Tue Mar 13 18:24:21 2018
(r330870)
@@ -228,9 +228,10 @@ aim_cpu_init(vm_offset_t toc)
register_t  msr;
uint8_t *cache_check;
int cacheline_warn;
-   #ifndef __powerpc64__
+#ifndef __powerpc64__
+   register_t  scratch;
int ppc64;
-   #endif
+#endif
 
trap_offset = 0;
cacheline_warn = 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: r330845 - in head/sys/powerpc: aim ofw powerpc

2018-03-13 Thread Justin Hibbits
This broke the powerpc (32-bit) build.

On Tue, Mar 13, 2018 at 10:03 AM, Nathan Whitehorn
 wrote:
> Author: nwhitehorn
> Date: Tue Mar 13 15:03:58 2018
> New Revision: 330845
> URL: https://svnweb.freebsd.org/changeset/base/330845
>
> Log:
>   Execute PowerPC64/AIM kernel from direct map region when possible.
>
>   When the kernel can be in real mode in early boot, we can execute from
>   high addresses aliased to the kernel's physical memory. If that high
>   address has the first two bits set to 1 (0xc...), those addresses will
>   automatically become part of the direct map. This reduces page table
>   pressure from the kernel and it sets up the kernel to be used with
>   radix translation, for which it has to be up here.
>
>   This is accomplished by exploiting the fact that all PowerPC kernels are
>   built as position-independent executables and relocate themselves
>   on start. Before this patch, the kernel runs at 1:1 VA:PA, but that
>   VA/PA is random and set by the bootloader. Very early, it processes
>   its ELF relocations to operate wherever it happens to find itself.
>   This patch uses that mechanism to re-enter and re-relocate the kernel
>   a second time witha new base address set up in the early parts of
>   powerpc_init().
>
>   Reviewed by:  jhibbits
>   Differential Revision:D14647
>
> Modified:
>   head/sys/powerpc/aim/aim_machdep.c
>   head/sys/powerpc/aim/locore64.S
>   head/sys/powerpc/aim/mmu_oea64.c
>   head/sys/powerpc/ofw/ofwcall64.S
>   head/sys/powerpc/powerpc/machdep.c
>
> Modified: head/sys/powerpc/aim/aim_machdep.c
> ==
> --- head/sys/powerpc/aim/aim_machdep.c  Tue Mar 13 15:02:46 2018
> (r330844)
> +++ head/sys/powerpc/aim/aim_machdep.c  Tue Mar 13 15:03:58 2018
> (r330845)
> @@ -160,15 +160,72 @@ extern void   *dlmisstrap, *dlmisssize;
>  extern void*dsmisstrap, *dsmisssize;
>
>  extern void *ap_pcpu;
> +extern void __restartkernel(vm_offset_t, vm_offset_t, vm_offset_t, void *, 
> uint32_t, register_t offset, register_t msr);
>
> +void aim_early_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry,
> +void *mdp, uint32_t mdp_cookie);
>  void aim_cpu_init(vm_offset_t toc);
>
>  void
> +aim_early_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void 
> *mdp,
> +uint32_t mdp_cookie)
> +{
> +   register_t  scratch;
> +
> +   /*
> +* If running from an FDT, make sure we are in real mode to avoid
> +* tromping on firmware page tables. Everything in the kernel assumes
> +* 1:1 mappings out of firmware, so this won't break anything not
> +* already broken. This doesn't work if there is live OF, since OF
> +* may internally use non-1:1 mappings.
> +*/
> +   if (ofentry == 0)
> +   mtmsr(mfmsr() & ~(PSL_IR | PSL_DR));
> +
> +#ifdef __powerpc64__
> +   /*
> +* If in real mode, relocate to high memory so that the kernel
> +* can execute from the direct map.
> +*/
> +   if (!(mfmsr() & PSL_DR) &&
> +   (vm_offset_t)_early_init < DMAP_BASE_ADDRESS)
> +   __restartkernel(fdt, 0, ofentry, mdp, mdp_cookie,
> +   DMAP_BASE_ADDRESS, mfmsr());
> +#endif
> +
> +   /* Various very early CPU fix ups */
> +   switch (mfpvr() >> 16) {
> +   /*
> +* PowerPC 970 CPUs have a misfeature requested by Apple that
> +* makes them pretend they have a 32-byte cacheline. Turn this
> +* off before we measure the cacheline size.
> +*/
> +   case IBM970:
> +   case IBM970FX:
> +   case IBM970MP:
> +   case IBM970GX:
> +   scratch = mfspr(SPR_HID5);
> +   scratch &= ~HID5_970_DCBZ_SIZE_HI;
> +   mtspr(SPR_HID5, scratch);
> +   break;
> +   #ifdef __powerpc64__
> +   case IBMPOWER7:
> +   case IBMPOWER7PLUS:
> +   case IBMPOWER8:
> +   case IBMPOWER8E:
> +   /* XXX: get from ibm,slb-size in device tree */
> +   n_slbs = 32;
> +   break;
> +   #endif
> +   }
> +}
> +
> +void
>  aim_cpu_init(vm_offset_t toc)
>  {
> size_t  trap_offset, trapsize;
> vm_offset_t trap;
> -   register_t  msr, scratch;
> +   register_t  msr;

scratch is used in powerpc, but not powerpc64.
___
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: r330868 - in head: stand/efi/loader sys/amd64/amd64 sys/arm64/arm64

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Tue Mar 13 17:10:52 2018
New Revision: 330868
URL: https://svnweb.freebsd.org/changeset/base/330868

Log:
  EFIRT: SetVirtualAddressMap with 1:1 mapping after exiting boot services
  
  This fixes a problem encountered on the Lenovo Thinkpad X220/Yoga 11e where
  runtime services would try to inexplicably jump to other parts of memory
  where it shouldn't be when attempting to enumerate EFI vars, causing a
  panic.
  
  The virtual mapping is enabled by default and can be disabled by setting
  efi_disable_vmap in loader.conf(5).
  
  Reviewed by:  kib (earlier version)
  MFC after:3 weeks
  Differential Revision:https://reviews.freebsd.org/D14677

Modified:
  head/stand/efi/loader/bootinfo.c
  head/sys/amd64/amd64/efirt_machdep.c
  head/sys/arm64/arm64/efirt_machdep.c

Modified: head/stand/efi/loader/bootinfo.c
==
--- head/stand/efi/loader/bootinfo.cTue Mar 13 17:04:14 2018
(r330867)
+++ head/stand/efi/loader/bootinfo.cTue Mar 13 17:10:52 2018
(r330868)
@@ -236,17 +236,48 @@ bi_copymodules(vm_offset_t addr)
return(addr);
 }
 
+static EFI_STATUS
+efi_do_vmap(EFI_MEMORY_DESCRIPTOR *mm, UINTN sz, UINTN mmsz, UINT32 mmver)
+{
+   EFI_MEMORY_DESCRIPTOR *desc, *viter, *vmap;
+   EFI_STATUS ret;
+   int curr, ndesc, nset;
+
+   nset = 0;
+   desc = mm;
+   ndesc = sz / mmsz;
+   vmap = malloc(sz);
+   if (vmap == NULL)
+   /* This isn't really an EFI error case, but pretend it is */
+   return (EFI_OUT_OF_RESOURCES);
+   viter = vmap;
+   for (curr = 0; curr < ndesc;
+   curr++, desc = NextMemoryDescriptor(desc, mmsz)) {
+   if ((desc->Attribute & EFI_MEMORY_RUNTIME) != 0) {
+   ++nset;
+   desc->VirtualStart = desc->PhysicalStart;
+   *viter = *desc;
+   viter = NextMemoryDescriptor(viter, mmsz);
+   }
+   }
+   ret = RS->SetVirtualAddressMap(nset * mmsz, mmsz, mmver, vmap);
+   free(vmap);
+   return (ret);
+}
+
 static int
 bi_load_efi_data(struct preloaded_file *kfp)
 {
EFI_MEMORY_DESCRIPTOR *mm;
EFI_PHYSICAL_ADDRESS addr;
EFI_STATUS status;
+   const char *efi_novmap;
size_t efisz;
UINTN efi_mapkey;
UINTN mmsz, pages, retry, sz;
UINT32 mmver;
struct efi_map_header *efihdr;
+   bool do_vmap;
 
 #if defined(__amd64__) || defined(__aarch64__)
struct efi_fb efifb;
@@ -266,6 +297,11 @@ bi_load_efi_data(struct preloaded_file *kfp)
}
 #endif
 
+   do_vmap = true;
+   efi_novmap = getenv("efi_disable_vmap");
+   if (efi_novmap != NULL)
+   do_vmap = strcasecmp(efi_novmap, "YES") != 0;
+
efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf;
 
/*
@@ -321,6 +357,13 @@ bi_load_efi_data(struct preloaded_file *kfp)
}
status = BS->ExitBootServices(IH, efi_mapkey);
if (EFI_ERROR(status) == 0) {
+   /*
+* This may be disabled by setting efi_disable_vmap in
+* loader.conf(5). By default we will setup the virtual
+* map entries.
+*/
+   if (do_vmap)
+   efi_do_vmap(mm, sz, mmsz, mmver);
efihdr->memory_size = sz;
efihdr->descriptor_size = mmsz;
efihdr->descriptor_version = mmver;

Modified: head/sys/amd64/amd64/efirt_machdep.c
==
--- head/sys/amd64/amd64/efirt_machdep.cTue Mar 13 17:04:14 2018
(r330867)
+++ head/sys/amd64/amd64/efirt_machdep.cTue Mar 13 17:10:52 2018
(r330868)
@@ -165,7 +165,7 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int 
descsz)) {
if ((p->md_attr & EFI_MD_ATTR_RT) == 0)
continue;
-   if (p->md_virt != NULL) {
+   if (p->md_virt != NULL && (uint64_t)p->md_virt != p->md_phys) {
if (bootverbose)
printf("EFI Runtime entry %d is mapped\n", i);
goto fail;

Modified: head/sys/arm64/arm64/efirt_machdep.c
==
--- head/sys/arm64/arm64/efirt_machdep.cTue Mar 13 17:04:14 2018
(r330867)
+++ head/sys/arm64/arm64/efirt_machdep.cTue Mar 13 17:10:52 2018
(r330868)
@@ -169,7 +169,7 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int 
descsz)) {
if ((p->md_attr & EFI_MD_ATTR_RT) == 0)
continue;
-   if (p->md_virt != NULL) {
+   if 

svn commit: r330867 - in stable/11/sys/compat/linuxkpi/common: include/linux src

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 17:04:14 2018
New Revision: 330867
URL: https://svnweb.freebsd.org/changeset/base/330867

Log:
  MFC r330271:
  Rename callout member in struct timer_list to match the one in struct
  delayed_work in the LinuxKPI. This allows the timer_pending() function
  macro to be used with delayed work structures.
  
  No functional nor structural change.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/timer.h
  stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/timer.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/timer.h  Tue Mar 13 
16:40:29 2018(r330866)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/timer.h  Tue Mar 13 
17:04:14 2018(r330867)
@@ -38,7 +38,7 @@
 #include 
 
 struct timer_list {
-   struct callout timer_callout;
+   struct callout callout;
void(*function) (unsigned long);
unsigned long data;
int expires;
@@ -51,7 +51,7 @@ extern unsigned long linux_timer_hz_mask;
 #definesetup_timer(timer, func, dat) do {  
\
(timer)->function = (func); \
(timer)->data = (dat);  \
-   callout_init(&(timer)->timer_callout, 1);   \
+   callout_init(&(timer)->callout, 1); \
 } while (0)
 
 #define__setup_timer(timer, func, dat, flags) do { 
\
@@ -62,16 +62,16 @@ extern unsigned long linux_timer_hz_mask;
 #defineinit_timer(timer) do {  
\
(timer)->function = NULL;   \
(timer)->data = 0;  \
-   callout_init(&(timer)->timer_callout, 1);   \
+   callout_init(&(timer)->callout, 1); \
 } while (0)
 
 extern void mod_timer(struct timer_list *, int);
 extern void add_timer(struct timer_list *);
 extern void add_timer_on(struct timer_list *, int cpu);
 
-#definedel_timer(timer)
(void)callout_stop(&(timer)->timer_callout)
-#definedel_timer_sync(timer)   
(void)callout_drain(&(timer)->timer_callout)
-#definetimer_pending(timer)callout_pending(&(timer)->timer_callout)
+#definedel_timer(timer)(void)callout_stop(&(timer)->callout)
+#definedel_timer_sync(timer)   (void)callout_drain(&(timer)->callout)
+#definetimer_pending(timer)callout_pending(&(timer)->callout)
 #defineround_jiffies(j)\
((int)(((j) + linux_timer_hz_mask) & ~linux_timer_hz_mask))
 #defineround_jiffies_relative(j) round_jiffies(j)

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Tue Mar 13 
16:40:29 2018(r330866)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Tue Mar 13 
17:04:14 2018(r330867)
@@ -1734,7 +1734,7 @@ mod_timer(struct timer_list *timer, int expires)
 {
 
timer->expires = expires;
-   callout_reset(>timer_callout,  
+   callout_reset(>callout,
linux_timer_jiffies_until(expires),
_timer_callback_wrapper, timer);
 }
@@ -1743,7 +1743,7 @@ void
 add_timer(struct timer_list *timer)
 {
 
-   callout_reset(>timer_callout,
+   callout_reset(>callout,
linux_timer_jiffies_until(timer->expires),
_timer_callback_wrapper, timer);
 }
@@ -1752,7 +1752,7 @@ void
 add_timer_on(struct timer_list *timer, int cpu)
 {
 
-   callout_reset_on(>timer_callout,
+   callout_reset_on(>callout,
linux_timer_jiffies_until(timer->expires),
_timer_callback_wrapper, timer, cpu);
 }
___
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: r330866 - in head/sys: amd64/linux amd64/linux32 i386/linux kern sys

2018-03-13 Thread Ed Maste
Author: emaste
Date: Tue Mar 13 16:40:29 2018
New Revision: 330866
URL: https://svnweb.freebsd.org/changeset/base/330866

Log:
  Use C99 boolean type for translate_osrel
  
  Migrate to modern types before creating MD Linuxolator bits for new
  architectures.
  
  Reviewed by:  cem
  Sponsored by: Turing Robotic Industries Inc.
  Differential Revision:https://reviews.freebsd.org/D14676

Modified:
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/i386/linux/linux_sysvec.c
  head/sys/kern/imgact_elf.c
  head/sys/sys/imgact_elf.h

Modified: head/sys/amd64/linux/linux_sysvec.c
==
--- head/sys/amd64/linux/linux_sysvec.c Tue Mar 13 16:33:41 2018
(r330865)
+++ head/sys/amd64/linux/linux_sysvec.c Tue Mar 13 16:40:29 2018
(r330866)
@@ -121,7 +121,7 @@ SET_DECLARE(linux_ioctl_handler_set, struct linux_ioct
 static register_t * linux_copyout_strings(struct image_params *imgp);
 static int elf_linux_fixup(register_t **stack_base,
struct image_params *iparams);
-static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel);
+static boollinux_trans_osrel(const Elf_Note *note, int32_t *osrel);
 static voidlinux_vdso_install(void *param);
 static voidlinux_vdso_deinstall(void *param);
 static voidlinux_set_syscall_retval(struct thread *td, int error);
@@ -846,7 +846,7 @@ SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER
 static char GNULINUX_ABI_VENDOR[] = "GNU";
 static int GNULINUX_ABI_DESC = 0;
 
-static boolean_t
+static bool
 linux_trans_osrel(const Elf_Note *note, int32_t *osrel)
 {
const Elf32_Word *desc;
@@ -857,7 +857,7 @@ linux_trans_osrel(const Elf_Note *note, int32_t *osrel
 
desc = (const Elf32_Word *)p;
if (desc[0] != GNULINUX_ABI_DESC)
-   return (FALSE);
+   return (false);
 
/*
 * For Linux we encode osrel as follows (see linux_mib.c):
@@ -865,7 +865,7 @@ linux_trans_osrel(const Elf_Note *note, int32_t *osrel
 */
*osrel = desc[1] * 100 + desc[2] * 1000 + desc[3];
 
-   return (TRUE);
+   return (true);
 }
 
 static Elf_Brandnote linux64_brandnote = {

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Tue Mar 13 16:33:41 2018
(r330865)
+++ head/sys/amd64/linux32/linux32_sysvec.c Tue Mar 13 16:40:29 2018
(r330866)
@@ -127,7 +127,7 @@ static void linux_sendsig(sig_t catcher, ksiginfo_
 static voidexec_linux_setregs(struct thread *td,
   struct image_params *imgp, u_long stack);
 static voidlinux32_fixlimit(struct rlimit *rl, int which);
-static boolean_t linux32_trans_osrel(const Elf_Note *note, int32_t *osrel);
+static boollinux32_trans_osrel(const Elf_Note *note, int32_t *osrel);
 static voidlinux_vdso_install(void *param);
 static voidlinux_vdso_deinstall(void *param);
 
@@ -1043,7 +1043,7 @@ SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER
 static char GNU_ABI_VENDOR[] = "GNU";
 static int GNULINUX_ABI_DESC = 0;
 
-static boolean_t
+static bool
 linux32_trans_osrel(const Elf_Note *note, int32_t *osrel)
 {
const Elf32_Word *desc;
@@ -1054,7 +1054,7 @@ linux32_trans_osrel(const Elf_Note *note, int32_t *osr
 
desc = (const Elf32_Word *)p;
if (desc[0] != GNULINUX_ABI_DESC)
-   return (FALSE);
+   return (false);
 
/*
 * For Linux we encode osrel as follows (see linux_mib.c):
@@ -1062,7 +1062,7 @@ linux32_trans_osrel(const Elf_Note *note, int32_t *osr
 */
*osrel = desc[1] * 100 + desc[2] * 1000 + desc[3];
 
-   return (TRUE);
+   return (true);
 }
 
 static Elf_Brandnote linux32_brandnote = {

Modified: head/sys/i386/linux/linux_sysvec.c
==
--- head/sys/i386/linux/linux_sysvec.c  Tue Mar 13 16:33:41 2018
(r330865)
+++ head/sys/i386/linux/linux_sysvec.c  Tue Mar 13 16:40:29 2018
(r330866)
@@ -115,7 +115,7 @@ static void linux_sendsig(sig_t catcher, ksiginfo_
 static voidexec_linux_setregs(struct thread *td,
struct image_params *imgp, u_long stack);
 static register_t *linux_copyout_strings(struct image_params *imgp);
-static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel);
+static boollinux_trans_osrel(const Elf_Note *note, int32_t *osrel);
 static voidlinux_vdso_install(void *param);
 static voidlinux_vdso_deinstall(void *param);
 
@@ -1017,7 +1017,7 @@ SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER
 static char GNU_ABI_VENDOR[] = "GNU";
 static int GNULINUX_ABI_DESC = 0;
 
-static boolean_t
+static bool
 linux_trans_osrel(const Elf_Note *note, int32_t *osrel)
 {

svn commit: r330865 - stable/11/sys/compat/linuxkpi/common/src

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:33:41 2018
New Revision: 330865
URL: https://svnweb.freebsd.org/changeset/base/330865

Log:
  MFC r330689:
  Implement proper support for complete_all() in the LinuxKPI.
  
  When complete_all() is called there might be multiple waiters. The
  current implementation could only handle one waiter. Make sure the
  completion is sticky when complete_all() is called to be compatible
  with Linux.
  
  Found by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Tue Mar 13 
16:33:00 2018(r330864)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Tue Mar 13 
16:33:41 2018(r330865)
@@ -1779,11 +1779,14 @@ linux_complete_common(struct completion *c, int all)
int wakeup_swapper;
 
sleepq_lock(c);
-   c->done++;
-   if (all)
+   if (all) {
+   c->done = UINT_MAX;
wakeup_swapper = sleepq_broadcast(c, SLEEPQ_SLEEP, 0, 0);
-   else
+   } else {
+   if (c->done != UINT_MAX)
+   c->done++;
wakeup_swapper = sleepq_signal(c, SLEEPQ_SLEEP, 0, 0);
+   }
sleepq_release(c);
if (wakeup_swapper)
kick_proc0();
@@ -1825,7 +1828,8 @@ linux_wait_for_common(struct completion *c, int flags)
} else
sleepq_wait(c, 0);
}
-   c->done--;
+   if (c->done != UINT_MAX)
+   c->done--;
sleepq_release(c);
 
 intr:
@@ -1878,7 +1882,8 @@ linux_wait_for_timeout_common(struct completion *c, in
goto done;
}
}
-   c->done--;
+   if (c->done != UINT_MAX)
+   c->done--;
sleepq_release(c);
 
/* return how many jiffies are left */
@@ -1894,12 +1899,10 @@ linux_try_wait_for_completion(struct completion *c)
 {
int isdone;
 
-   isdone = 1;
sleepq_lock(c);
-   if (c->done)
+   isdone = (c->done != 0);
+   if (c->done != 0 && c->done != UINT_MAX)
c->done--;
-   else
-   isdone = 0;
sleepq_release(c);
return (isdone);
 }
@@ -1909,10 +1912,8 @@ linux_completion_done(struct completion *c)
 {
int isdone;
 
-   isdone = 1;
sleepq_lock(c);
-   if (c->done == 0)
-   isdone = 0;
+   isdone = (c->done != 0);
sleepq_release(c);
return (isdone);
 }
___
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: r330864 - in head/stand: common efi/boot1 efi/loader/arch/arm ficl/aarch64 ficl/amd64 ficl/arm ficl/i386 ficl/mips ficl/mips64 ficl/powerpc ficl/riscv ficl/sparc64 i386/btx/lib i386/lib...

2018-03-13 Thread Warner Losh
Author: imp
Date: Tue Mar 13 16:33:00 2018
New Revision: 330864
URL: https://svnweb.freebsd.org/changeset/base/330864

Log:
  Prefer uintXX_t to u_intXX_t
  
  A foolish consistency is the hobgoblin of little minds, adored by
  little statesmen and philosophers and divines. With consistency a
  great soul has simply nothing to do. -- Ralph Waldo Emerson

Modified:
  head/stand/common/bootstrap.h
  head/stand/common/isapnp.c
  head/stand/common/load_elf.c
  head/stand/common/load_elf_obj.c
  head/stand/common/metadata.c
  head/stand/common/misc.c
  head/stand/common/pnp.c
  head/stand/efi/boot1/ufs_module.c
  head/stand/efi/loader/arch/arm/exec.c
  head/stand/ficl/aarch64/sysdep.c
  head/stand/ficl/amd64/sysdep.c
  head/stand/ficl/arm/sysdep.c
  head/stand/ficl/i386/sysdep.c
  head/stand/ficl/mips/sysdep.c
  head/stand/ficl/mips64/sysdep.c
  head/stand/ficl/powerpc/sysdep.c
  head/stand/ficl/riscv/sysdep.c
  head/stand/ficl/sparc64/sysdep.c
  head/stand/i386/btx/lib/btxv86.h
  head/stand/i386/libi386/biosacpi.c
  head/stand/i386/libi386/biosdisk.c
  head/stand/i386/libi386/biospnp.c
  head/stand/i386/libi386/bootinfo32.c
  head/stand/i386/libi386/bootinfo64.c
  head/stand/i386/libi386/elf64_freebsd.c
  head/stand/i386/libi386/multiboot.c
  head/stand/i386/libi386/pxe.c
  head/stand/i386/loader/main.c
  head/stand/libsa/arp.c
  head/stand/libsa/bootp.c
  head/stand/libsa/bootparam.c
  head/stand/libsa/dosfs.h
  head/stand/libsa/ext2fs.c
  head/stand/libsa/net.h
  head/stand/libsa/rpc.c
  head/stand/ofw/libofw/openfirm.c
  head/stand/powerpc/boot1.chrp/boot1.c
  head/stand/powerpc/kboot/ppc64_elf_freebsd.c
  head/stand/powerpc/ofw/elf_freebsd.c
  head/stand/powerpc/ofw/main.c
  head/stand/powerpc/ofw/ppc64_elf_freebsd.c
  head/stand/sparc64/boot1/boot1.c
  head/stand/sparc64/loader/main.c
  head/stand/uboot/lib/elf_freebsd.c
  head/stand/userboot/userboot/bootinfo32.c
  head/stand/userboot/userboot/bootinfo64.c
  head/stand/userboot/userboot/elf64_freebsd.c

Modified: head/stand/common/bootstrap.h
==
--- head/stand/common/bootstrap.h   Tue Mar 13 16:31:54 2018
(r330863)
+++ head/stand/common/bootstrap.h   Tue Mar 13 16:33:00 2018
(r330864)
@@ -150,7 +150,7 @@ voidpnp_addident(struct pnpinfo 
*pi, char *ident);
 struct pnpinfo *pnp_allocinfo(void);
 void   pnp_freeinfo(struct pnpinfo *pi);
 void   pnp_addinfo(struct pnpinfo *pi);
-char   *pnp_eisaformat(u_int8_t *data);
+char   *pnp_eisaformat(uint8_t *data);
 
 /*
  *  < 0- No ISA in system
@@ -168,7 +168,7 @@ extern int  isapnp_readport;
 struct file_metadata 
 {
 size_t md_size;
-u_int16_t  md_type;
+uint16_t   md_type;
 struct file_metadata   *md_next;
 char   md_data[1]; /* data are immediately 
appended */
 };
@@ -210,7 +210,7 @@ struct preloaded_file
 struct file_format
 {
 /* Load function must return EFTYPE if it can't handle the module supplied 
*/
-int(* l_load)(char *filename, u_int64_t dest, struct 
preloaded_file **result);
+int(* l_load)(char *filename, uint64_t dest, struct 
preloaded_file **result);
 /* Only a loader that will load a kernel (first module) should have an 
exec handler */
 int(* l_exec)(struct preloaded_file *mp);
 };
@@ -239,20 +239,20 @@ void file_removemetadata(struct preloaded_file *fp);
 #define ELF_RELOC_RELA 2
 
 /* Relocation offset for some architectures */
-extern u_int64_t __elfN(relocation_offset);
+extern uint64_t __elfN(relocation_offset);
 
 struct elf_file;
 typedef Elf_Addr (symaddr_fn)(struct elf_file *ef, Elf_Size symidx);
 
-int__elfN(loadfile)(char *filename, u_int64_t dest, struct preloaded_file 
**result);
-int__elfN(obj_loadfile)(char *filename, u_int64_t dest,
+int__elfN(loadfile)(char *filename, uint64_t dest, struct preloaded_file 
**result);
+int__elfN(obj_loadfile)(char *filename, uint64_t dest,
struct preloaded_file **result);
 int__elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr,
const void *reldata, int reltype, Elf_Addr relbase,
Elf_Addr dataaddr, void *data, size_t len);
-int __elfN(loadfile_raw)(char *filename, u_int64_t dest,
+int __elfN(loadfile_raw)(char *filename, uint64_t dest,
struct preloaded_file **result, int multiboot);
-int __elfN(load_modmetadata)(struct preloaded_file *fp, u_int64_t dest);
+int __elfN(load_modmetadata)(struct preloaded_file *fp, uint64_t dest);
 #endif
 
 /*

Modified: head/stand/common/isapnp.c
==
--- head/stand/common/isapnp.c  Tue Mar 13 16:31:54 2018(r330863)
+++ head/stand/common/isapnp.c  Tue Mar 13 16:33:00 2018

svn commit: r330863 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:31:54 2018
New Revision: 330863
URL: https://svnweb.freebsd.org/changeset/base/330863

Log:
  MFC r330399:
  Stub kernel_param_lock() and kernel_param_unlock() in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/moduleparam.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/moduleparam.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/moduleparam.hTue Mar 
13 16:30:51 2018(r330862)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/moduleparam.hTue Mar 
13 16:31:54 2018(r330863)
@@ -125,6 +125,9 @@
 #defineMODULE_PARM_DESC(name, desc) \
const char LINUXKPI_PARAM_DESC(name)[] = { desc }
 
+#definekernel_param_lock(...) do {} while (0)
+#definekernel_param_unlock(...) do {} while (0)
+
 SYSCTL_DECL(_compat_linuxkpi);
 
 #endif /* _LINUX_MODULEPARAM_H_ */
___
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: r330862 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:30:51 2018
New Revision: 330862
URL: https://svnweb.freebsd.org/changeset/base/330862

Log:
  MFC r330398:
  Implement wait_event_lock_irq() macro function in the LinuxKPI.
  
  Requested by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Tue Mar 13 
16:30:01 2018(r330861)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Tue Mar 13 
16:30:51 2018(r330862)
@@ -194,11 +194,19 @@ int linux_wait_event_common(wait_queue_head_t *, wait_
 })
 
 /*
- * Hold the (locked) spinlock when testing the cond.
+ * The passed spinlock is held when testing the condition.
  */
 #definewait_event_interruptible_lock_irq(wqh, cond, lock) ({   
\
__wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT,\
TASK_INTERRUPTIBLE, &(lock));   \
+})
+
+/*
+ * The passed spinlock is held when testing the condition.
+ */
+#definewait_event_lock_irq(wqh, cond, lock) ({ \
+   __wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT,\
+   TASK_UNINTERRUPTIBLE, &(lock)); \
 })
 
 static inline void
___
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: r330861 - in stable/11/sys/compat/linuxkpi/common: include/linux src

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:30:01 2018
New Revision: 330861
URL: https://svnweb.freebsd.org/changeset/base/330861

Log:
  MFC r330395:
  Implement DEFINE_WAIT_FUNC() function macro and default_wake_function()
  in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
  stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Tue Mar 13 
16:29:02 2018(r330860)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Tue Mar 13 
16:30:01 2018(r330861)
@@ -76,13 +76,17 @@ struct wait_queue_head {
  * renamed and furthermore must be the default wait queue callback.
  */
 extern wait_queue_func_t autoremove_wake_function;
+extern wait_queue_func_t default_wake_function;
 
-#defineDEFINE_WAIT(name)   
\
+#defineDEFINE_WAIT_FUNC(name, function)
\
wait_queue_t name = {   \
.private = current, \
-   .func = autoremove_wake_function,   \
+   .func = function,   \
.task_list = LINUX_LIST_HEAD_INIT(name.task_list)   \
}
+
+#defineDEFINE_WAIT(name) \
+   DEFINE_WAIT_FUNC(name, autoremove_wake_function)
 
 #defineDECLARE_WAITQUEUE(name, task)   
\
wait_queue_t name = {   \

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c   Tue Mar 13 
16:29:02 2018(r330860)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c   Tue Mar 13 
16:30:01 2018(r330861)
@@ -176,6 +176,13 @@ autoremove_wake_function(wait_queue_t *wq, unsigned in
return (ret);
 }
 
+int
+default_wake_function(wait_queue_t *wq, unsigned int state, int flags,
+void *key __unused)
+{
+   return (wake_up_task(wq->private, state));
+}
+
 void
 linux_wake_up(wait_queue_head_t *wqh, unsigned int state, int nr, bool locked)
 {
___
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: r330860 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:29:02 2018
New Revision: 330860
URL: https://svnweb.freebsd.org/changeset/base/330860

Log:
  MFC r330394:
  Implement pr_err_ratelimited() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/printk.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/printk.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/printk.h Tue Mar 13 
16:28:04 2018(r330859)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/printk.h Tue Mar 13 
16:29:02 2018(r330860)
@@ -118,4 +118,7 @@ print_hex_dump_bytes(const char *prefix_str, const int
__retval;   \
 })
 
+#definepr_err_ratelimited(fmt, ...) \
+   printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
+
 #endif /* _LINUX_PRINTK_H_ */
___
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: r330859 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:28:04 2018
New Revision: 330859
URL: https://svnweb.freebsd.org/changeset/base/330859

Log:
  MFC r330393:
  Implement __MODULE_STRING() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/module.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/module.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/module.h Tue Mar 13 
16:26:57 2018(r330858)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/module.h Tue Mar 13 
16:28:04 2018(r330859)
@@ -53,6 +53,7 @@
 
 #defineEXPORT_SYMBOL(name)
 #defineEXPORT_SYMBOL_GPL(name)
+#define__MODULE_STRING(x) __stringify(x)
 
 /* OFED pre-module initialization */
 #defineSI_SUB_OFED_PREINIT (SI_SUB_ROOT_CONF - 2)
___
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: r330858 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:26:57 2018
New Revision: 330858
URL: https://svnweb.freebsd.org/changeset/base/330858

Log:
  MFC r330392 and r330408:
  Implement BUILD_BUG() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Mar 13 
16:25:28 2018(r330857)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Mar 13 
16:26:57 2018(r330858)
@@ -86,6 +86,7 @@
 #defineS64_C(x) x ## LL
 #defineU64_C(x) x ## ULL
 
+#defineBUILD_BUG() do { CTASSERT(0); } while (0)
 #defineBUILD_BUG_ON(x) CTASSERT(!(x))
 #defineBUILD_BUG_ON_MSG(x, msg)BUILD_BUG_ON(x)
 #defineBUILD_BUG_ON_NOT_POWER_OF_2(x)  BUILD_BUG_ON(!powerof2(x))
___
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: r330853 - in stable/11/sys/compat/linuxkpi/common: include/linux src

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:20:59 2018
New Revision: 330853
URL: https://svnweb.freebsd.org/changeset/base/330853

Log:
  MFC r330387 and r330396:
  Rename the SLAB_DESTROY_BY_RCU flag into SLAB_TYPESAFE_BY_RCU in the LinuxKPI
  to be compatible with Linux.
  
  Keep the old SLAB_DESTROY_BY_RCU macro definition around in the LinuxKPI
  to avoid compilation breakage in external kernel modules.
  
  Requested by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/slab.h
  stable/11/sys/compat/linuxkpi/common/src/linux_slab.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/slab.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/slab.h   Tue Mar 13 
16:18:38 2018(r330852)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/slab.h   Tue Mar 13 
16:20:59 2018(r330853)
@@ -79,9 +79,12 @@ struct linux_kmem_cache {
 };
 
 #defineSLAB_HWCACHE_ALIGN  (1 << 0)
-#defineSLAB_DESTROY_BY_RCU (1 << 1)
+#defineSLAB_TYPESAFE_BY_RCU(1 << 1)
 #defineSLAB_RECLAIM_ACCOUNT(1 << 2)
 
+#defineSLAB_DESTROY_BY_RCU \
+   SLAB_TYPESAFE_BY_RCU
+
 static inline gfp_t
 linux_check_m_flags(gfp_t flags)
 {
@@ -162,7 +165,7 @@ extern void linux_kmem_cache_free_rcu(struct linux_kme
 static inline void
 linux_kmem_cache_free(struct linux_kmem_cache *c, void *m)
 {
-   if (unlikely(c->cache_flags & SLAB_DESTROY_BY_RCU))
+   if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU))
linux_kmem_cache_free_rcu(c, m);
else
uma_zfree(c->cache_zone, m);

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_slab.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_slab.c   Tue Mar 13 
16:18:38 2018(r330852)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_slab.c   Tue Mar 13 
16:20:59 2018(r330853)
@@ -49,7 +49,7 @@ linux_kmem_ctor(void *mem, int size, void *arg, int fl
 {
struct linux_kmem_cache *c = arg;
 
-   if (unlikely(c->cache_flags & SLAB_DESTROY_BY_RCU)) {
+   if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU)) {
struct linux_kmem_rcu *rcu = LINUX_KMEM_TO_RCU(c, mem);
 
/* duplicate cache pointer */
@@ -85,7 +85,7 @@ linux_kmem_cache_create(const char *name, size_t size,
else if (align != 0)
align--;
 
-   if (flags & SLAB_DESTROY_BY_RCU) {
+   if (flags & SLAB_TYPESAFE_BY_RCU) {
/* make room for RCU structure */
size = ALIGN(size, sizeof(void *));
size += sizeof(struct linux_kmem_rcu);
@@ -118,7 +118,7 @@ linux_kmem_cache_free_rcu(struct linux_kmem_cache *c, 
 void
 linux_kmem_cache_destroy(struct linux_kmem_cache *c)
 {
-   if (unlikely(c->cache_flags & SLAB_DESTROY_BY_RCU)) {
+   if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU)) {
/* make sure all free callbacks have been called */
rcu_barrier();
}
___
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: r330857 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:25:28 2018
New Revision: 330857
URL: https://svnweb.freebsd.org/changeset/base/330857

Log:
  MFC r330391:
  Implement writel_relaxed() in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/io.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/io.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/io.h Tue Mar 13 
16:24:28 2018(r330856)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/io.h Tue Mar 13 
16:25:28 2018(r330857)
@@ -74,6 +74,13 @@ writel(uint32_t b, void *addr)
 *(volatile uint32_t *)addr = b;
 }
 
+#undef writel_relaxed
+static inline void
+writel_relaxed(uint32_t b, void *addr)
+{
+   *(volatile uint32_t *)addr = b;
+}
+
 #undef writeq
 static inline void
 writeq(uint64_t b, void *addr)
___
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: r330856 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:24:28 2018
New Revision: 330856
URL: https://svnweb.freebsd.org/changeset/base/330856

Log:
  MFC r330390:
  Define noinline and __maybe_unused macros in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h   Tue Mar 
13 16:23:33 2018(r330855)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h   Tue Mar 
13 16:24:28 2018(r330856)
@@ -64,6 +64,7 @@
 #define__attribute_const__ __attribute__((__const__))
 #undef __always_inline
 #define__always_inline inline
+#definenoinline__noinline
 #definecacheline_aligned   __aligned(CACHE_LINE_SIZE)
 
 #definelikely(x)   __builtin_expect(!!(x), 1)
@@ -71,6 +72,7 @@
 #define typeof(x)  __typeof(x)
 
 #defineuninitialized_var(x)x = x
+#define__maybe_unused  __unused
 #define__always_unused __unused
 #define__must_check__result_use_check
 
___
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: r330855 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:23:33 2018
New Revision: 330855
URL: https://svnweb.freebsd.org/changeset/base/330855

Log:
  MFC r330389:
  Implement for_each_clear_bit() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/bitops.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/bitops.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Mar 13 
16:22:32 2018(r330854)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Mar 13 
16:23:33 2018(r330855)
@@ -390,6 +390,10 @@ done:
 (bit) < (size);\
 (bit) = find_next_bit((addr), (size), (bit) + 1))
 
+#definefor_each_clear_bit(bit, addr, size) \
+   for ((bit) = find_first_zero_bit((addr), (size));   \
+(bit) < (size);\
+(bit) = find_next_zero_bit((addr), (size), (bit) + 1))
 
 static inline uint64_t
 sign_extend64(uint64_t value, int index)
___
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: r330854 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:22:32 2018
New Revision: 330854
URL: https://svnweb.freebsd.org/changeset/base/330854

Log:
  MFC r330388:
  Implement GENMASK_ULL() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/bitops.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/bitops.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Mar 13 
16:20:59 2018(r330853)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Mar 13 
16:22:32 2018(r330854)
@@ -45,12 +45,15 @@
 #defineBITS_PER_LONG   32
 #endif
 
+#defineBITS_PER_LONG_LONG  64
+
 #defineBITMAP_FIRST_WORD_MASK(start)   (~0UL << ((start) % 
BITS_PER_LONG))
 #defineBITMAP_LAST_WORD_MASK(n)(~0UL >> (BITS_PER_LONG - (n)))
 #defineBITS_TO_LONGS(n)howmany((n), BITS_PER_LONG)
 #defineBIT_MASK(nr)(1UL << ((nr) & (BITS_PER_LONG - 1)))
 #define BIT_WORD(nr)   ((nr) / BITS_PER_LONG)
 #defineGENMASK(h, l)   (((~0UL) >> (BITS_PER_LONG - (h) - 1)) 
& ((~0UL) << (l)))
+#defineGENMASK_ULL(h, l)   (((~0ULL) >> (BITS_PER_LONG_LONG - (h) 
- 1)) & ((~0ULL) << (l)))
 #define BITS_PER_BYTE   8
 
 #definehweight8(x) bitcount((uint8_t)(x))
___
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: r330852 - stable/11/sys/kern

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:18:38 2018
New Revision: 330852
URL: https://svnweb.freebsd.org/changeset/base/330852

Log:
  MFC r330344:
  Correct the return code from pause() during cold startup from zero to
  EWOULDBLOCK. This also matches the description in pause(9).
  
  Discussed with:   kib@
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/kern/kern_synch.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_synch.c
==
--- stable/11/sys/kern/kern_synch.c Tue Mar 13 16:17:36 2018
(r330851)
+++ stable/11/sys/kern/kern_synch.c Tue Mar 13 16:18:38 2018
(r330852)
@@ -328,7 +328,7 @@ pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_
sbt = howmany(sbt, SBT_1US);
if (sbt > 0)
DELAY(sbt);
-   return (0);
+   return (EWOULDBLOCK);
}
return (_sleep(_wchan[curcpu], NULL,
(flags & C_CATCH) ? PCATCH : 0, wmesg, sbt, pr, flags));
___
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: r330851 - in stable/11/sys/compat/linuxkpi/common: include/linux src

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:17:36 2018
New Revision: 330851
URL: https://svnweb.freebsd.org/changeset/base/330851

Log:
  MFC r330352 and r330353:
  Implement msleep_interruptible() in the LinuxKPI. While at it use pause_sbt()
  instead of pause() in the msleep() function to avoid rounding errors when
  converting delay values forth and back. Add a guard for a delay value
  of zero milliseconds which is undefined.
  
  Suggested by: ian@
  Requested by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/delay.h
  stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/delay.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/delay.h  Tue Mar 13 
16:14:52 2018(r330850)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/delay.h  Tue Mar 13 
16:17:36 2018(r330851)
@@ -36,14 +36,20 @@
 #include 
 
 static inline void
-linux_msleep(int ms)
+linux_msleep(unsigned int ms)
 {
-   pause("lnxsleep", msecs_to_jiffies(ms));
+   /* guard against invalid values */
+   if (ms == 0)
+   ms = 1;
+   pause_sbt("lnxsleep", mstosbt(ms), 0, C_HARDCLOCK);
 }
 
 #undef msleep
-#definemsleep  linux_msleep
+#definemsleep(ms) linux_msleep(ms)
 
+#undef msleep_interruptible
+#definemsleep_interruptible(ms) linux_msleep_interruptible(ms)
+
 #defineudelay(t)   DELAY(t)
 
 static inline void
@@ -64,5 +70,7 @@ usleep_range(unsigned long min, unsigned long max)
 {
DELAY(min);
 }
+
+extern unsigned int linux_msleep_interruptible(unsigned int ms);
 
 #endif /* _LINUX_DELAY_H_ */

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c   Tue Mar 13 
16:14:52 2018(r330850)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c   Tue Mar 13 
16:17:36 2018(r330851)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -72,6 +73,25 @@ linux_add_to_sleepqueue(void *wchan, struct task_struc
ret = -ERESTARTSYS;
}
return (ret);
+}
+
+unsigned int
+linux_msleep_interruptible(unsigned int ms)
+{
+   int ret;
+
+   /* guard against invalid values */
+   if (ms == 0)
+   ms = 1;
+   ret = -pause_sbt("lnxsleep", mstosbt(ms), 0, C_HARDCLOCK | C_CATCH);
+
+   switch (ret) {
+   case -EWOULDBLOCK:
+   return (0);
+   default:
+   linux_schedule_save_interrupt_value(current, ret);
+   return (ms);
+   }
 }
 
 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: r330850 - in stable/11: share/man/man9 sys/kern sys/sys

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:14:52 2018
New Revision: 330850
URL: https://svnweb.freebsd.org/changeset/base/330850

Log:
  MFC r330349 and r330362:
  Allow pause_sbt() to catch signals during sleep by passing C_CATCH flag.
  Define pause_sig() function macro helper similarly to other kernel functions
  which catch signals. Update outdated function description.
  
  Document pause_sig(9) and update prototypes for existing pause(9) and
  pause_sbt(9) functions.
  
  Discussed with:   kib@
  Suggested by: cem@
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/share/man/man9/Makefile
  stable/11/share/man/man9/sleep.9
  stable/11/sys/kern/kern_synch.c
  stable/11/sys/sys/callout.h
  stable/11/sys/sys/systm.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man9/Makefile
==
--- stable/11/share/man/man9/Makefile   Tue Mar 13 16:10:11 2018
(r330849)
+++ stable/11/share/man/man9/Makefile   Tue Mar 13 16:14:52 2018
(r330850)
@@ -1597,6 +1597,7 @@ MLINKS+=sleep.9 msleep.9 \
sleep.9 msleep_spin.9 \
sleep.9 msleep_spin_sbt.9 \
sleep.9 pause.9 \
+   sleep.9 pause_sig.9 \
sleep.9 pause_sbt.9 \
sleep.9 tsleep.9 \
sleep.9 tsleep_sbt.9 \

Modified: stable/11/share/man/man9/sleep.9
==
--- stable/11/share/man/man9/sleep.9Tue Mar 13 16:10:11 2018
(r330849)
+++ stable/11/share/man/man9/sleep.9Tue Mar 13 16:14:52 2018
(r330850)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 24, 2015
+.Dd March 4, 2018
 .Dt SLEEP 9
 .Os
 .Sh NAME
@@ -34,6 +34,7 @@
 .Nm msleep_spin ,
 .Nm msleep_spin_sbt ,
 .Nm pause ,
+.Nm pause_sig ,
 .Nm pause_sbt ,
 .Nm tsleep ,
 .Nm tsleep_sbt ,
@@ -53,9 +54,11 @@
 .Ft int
 .Fn msleep_spin_sbt "void *chan" "struct mtx *mtx" "const char *wmesg" \
 "sbintime_t sbt" "sbintime_t pr" "int flags"
-.Ft void
+.Ft int
 .Fn pause "const char *wmesg" "int timo"
-.Ft void
+.Ft int
+.Fn pause_sig "const char *wmesg" "int timo"
+.Ft int
 .Fn pause_sbt "const char *wmesg" "sbintime_t sbt" "sbintime_t pr" \
  "int flags"
 .Ft int
@@ -73,6 +76,8 @@ The functions
 .Fn msleep ,
 .Fn msleep_spin ,
 .Fn pause ,
+.Fn pause_sig ,
+.Fn pause_sbt ,
 .Fn wakeup ,
 and
 .Fn wakeup_one
@@ -82,8 +87,10 @@ external event, it is put to sleep by
 .Fn tsleep ,
 .Fn msleep ,
 .Fn msleep_spin ,
+.Fn pause ,
+.Fn pause_sig ,
 or
-.Fn pause .
+.Fn pause_sbt .
 Threads may also wait using one of the locking primitive sleep routines
 .Xr mtx_sleep 9 ,
 .Xr rw_sleep 9 ,
@@ -248,6 +255,11 @@ The thread can not be awakened early by signals or cal
 .Fn wakeup
 or
 .Fn wakeup_one .
+The
+.Fn pause_sig
+function is a variant of
+.Fn pause
+which can be awakened early by signals.
 .Pp
 The
 .Fn wakeup_one
@@ -385,6 +397,10 @@ The
 .Fn pause
 function appeared in
 .Fx 7.0 .
+The
+.Fn pause_sig
+function appeared in
+.Fx 12.0 .
 .Sh AUTHORS
 .An -nosplit
 This manual page was written by

Modified: stable/11/sys/kern/kern_synch.c
==
--- stable/11/sys/kern/kern_synch.c Tue Mar 13 16:10:11 2018
(r330849)
+++ stable/11/sys/kern/kern_synch.c Tue Mar 13 16:14:52 2018
(r330850)
@@ -299,16 +299,16 @@ msleep_spin_sbt(void *ident, struct mtx *mtx, const ch
 }
 
 /*
- * pause() delays the calling thread by the given number of system ticks.
- * During cold bootup, pause() uses the DELAY() function instead of
- * the tsleep() function to do the waiting. The "timo" argument must be
- * greater than or equal to zero. A "timo" value of zero is equivalent
- * to a "timo" value of one.
+ * pause_sbt() delays the calling thread by the given signed binary
+ * time. During cold bootup, pause_sbt() uses the DELAY() function
+ * instead of the _sleep() function to do the waiting. The "sbt"
+ * argument must be greater than or equal to zero. A "sbt" value of
+ * zero is equivalent to a "sbt" value of one tick.
  */
 int
 pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags)
 {
-   KASSERT(sbt >= 0, ("pause: timeout must be >= 0"));
+   KASSERT(sbt >= 0, ("pause_sbt: timeout must be >= 0"));
 
/* silently convert invalid timeouts */
if (sbt == 0)
@@ -330,7 +330,8 @@ pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_
DELAY(sbt);
return (0);
}
-   return (_sleep(_wchan[curcpu], NULL, 0, wmesg, sbt, pr, flags));
+   return (_sleep(_wchan[curcpu], NULL,
+   (flags & C_CATCH) ? PCATCH : 0, wmesg, sbt, pr, flags));
 }
 
 /*

Modified: stable/11/sys/sys/callout.h
==
--- stable/11/sys/sys/callout.h Tue Mar 13 16:10:11 2018(r330849)
+++ stable/11/sys/sys/callout.h Tue Mar 13 16:14:52 2018

svn commit: r330849 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:10:11 2018
New Revision: 330849
URL: https://svnweb.freebsd.org/changeset/base/330849

Log:
  MFC r330274:
  Implement more lockdep stubs in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/lockdep.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/lockdep.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/lockdep.hTue Mar 
13 16:09:04 2018(r330848)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/lockdep.hTue Mar 
13 16:10:11 2018(r330849)
@@ -36,8 +36,9 @@ struct lock_class_key {
 };
 
 #definelockdep_set_class(lock, key)
-
 #definelockdep_set_class_and_name(lock, key, name)
+#definelockdep_set_current_reclaim_state(g) do { } while (0)
+#definelockdep_clear_current_reclaim_state() do { } while (0)
 
 #definelockdep_assert_held(m)  \
sx_assert(&(m)->sx, SA_XLOCKED)
___
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: r330848 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:09:04 2018
New Revision: 330848
URL: https://svnweb.freebsd.org/changeset/base/330848

Log:
  MFC r330273:
  Implement ktime_get_raw() function in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h  Tue Mar 13 
16:07:38 2018(r330847)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h  Tue Mar 13 
16:09:04 2018(r330848)
@@ -189,6 +189,15 @@ ktime_get_real_seconds(void)
return (ts.tv_sec);
 }
 
+static inline ktime_t
+ktime_get_raw(void)
+{
+   struct timespec ts;
+
+   nanotime();
+   return (timespec_to_ktime(ts));
+}
+
 static inline u64
 ktime_get_raw_ns(void)
 {
___
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: r330847 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-03-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 13 16:07:38 2018
New Revision: 330847
URL: https://svnweb.freebsd.org/changeset/base/330847

Log:
  MFC r330272:
  Implement wait_on_bit() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Tue Mar 13 
15:29:13 2018(r330846)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Tue Mar 13 
16:07:38 2018(r330847)
@@ -249,6 +249,8 @@ void linux_wake_up_atomic_t(atomic_t *);
 int linux_wait_on_atomic_t(atomic_t *, unsigned int);
 
 #definewake_up_bit(word, bit)  linux_wake_up_bit(word, bit)
+#definewait_on_bit(word, bit, state)   
\
+   linux_wait_on_bit_timeout(word, bit, state, MAX_SCHEDULE_TIMEOUT)
 #definewait_on_bit_timeout(word, bit, state, timeout)  
\
linux_wait_on_bit_timeout(word, bit, state, timeout)
 #definewake_up_atomic_t(a) linux_wake_up_atomic_t(a)
___
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: r330846 - head/sbin/nvmecontrol

2018-03-13 Thread Alexander Motin
Author: mav
Date: Tue Mar 13 15:29:13 2018
New Revision: 330846
URL: https://svnweb.freebsd.org/changeset/base/330846

Log:
  Add some argument checks to be more user-friendly.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sbin/nvmecontrol/format.c

Modified: head/sbin/nvmecontrol/format.c
==
--- head/sbin/nvmecontrol/format.c  Tue Mar 13 15:03:58 2018
(r330845)
+++ head/sbin/nvmecontrol/format.c  Tue Mar 13 15:29:13 2018
(r330846)
@@ -81,9 +81,13 @@ format(int argc, char *argv[])
pil = strtol(optarg, NULL, 0);
break;
case 'E':
+   if (ses == 2)
+   errx(1, "-E and -C are mutually exclusive");
ses = 1;
break;
case 'C':
+   if (ses == 1)
+   errx(1, "-E and -C are mutually exclusive");
ses = 2;
break;
default:
@@ -109,19 +113,7 @@ format(int argc, char *argv[])
 */
if (strstr(target, NVME_NS_PREFIX) == NULL) {
nsid = NVME_GLOBAL_NAMESPACE_TAG;
-
-   /* We have no previous parameters, so use defaults. */
-   if (lbaf < 0)
-   lbaf = 0;
-   if (mset < 0)
-   mset = 0;
-   if (pi < 0)
-   pi = 0;
-   if (pil < 0)
-   pil = 0;
} else {
-   parse_ns_str(target, path, );
-
/*
 * We send FORMAT commands to the controller, not the namespace,
 * since it is an admin cmd.  The namespace ID will be specified
@@ -129,25 +121,34 @@ format(int argc, char *argv[])
 * string to get the controller substring and namespace ID.
 */
close(fd);
+   parse_ns_str(target, path, );
open_dev(path, , 1, 1);
+   }
 
-   /* Check that controller can execute this command. */
-   read_controller_data(fd, );
-   if (((cd.fna >> NVME_CTRLR_DATA_FNA_FORMAT_ALL_SHIFT)
-& NVME_CTRLR_DATA_FNA_FORMAT_ALL_MASK) && ses == 0) {
-   fprintf(stderr, "H/w doesn't support per-NS format\n");
-   exit(1);
-   } else if (((cd.fna >> NVME_CTRLR_DATA_FNA_ERASE_ALL_SHIFT)
-& NVME_CTRLR_DATA_FNA_ERASE_ALL_MASK) && ses != 0) {
-   fprintf(stderr, "H/w doesn't support per-NS erase\n");
-   exit(1);
-   }
+   /* Check that controller can execute this command. */
+   read_controller_data(fd, );
+   if (((cd.oacs >> NVME_CTRLR_DATA_OACS_FORMAT_SHIFT) &
+   NVME_CTRLR_DATA_OACS_FORMAT_MASK) == 0)
+   errx(1, "controller does not support format");
+   if (((cd.fna >> NVME_CTRLR_DATA_FNA_CRYPTO_ERASE_SHIFT) &
+   NVME_CTRLR_DATA_FNA_CRYPTO_ERASE_MASK) == 0 && ses == 2)
+   errx(1, "controller does not support cryptographic erase");
 
+   if (nsid != NVME_GLOBAL_NAMESPACE_TAG) {
+   if (((cd.fna >> NVME_CTRLR_DATA_FNA_FORMAT_ALL_SHIFT) &
+   NVME_CTRLR_DATA_FNA_FORMAT_ALL_MASK) && ses == 0)
+   errx(1, "controller does not support per-NS format");
+   if (((cd.fna >> NVME_CTRLR_DATA_FNA_ERASE_ALL_SHIFT) &
+   NVME_CTRLR_DATA_FNA_ERASE_ALL_MASK) && ses != 0)
+   errx(1, "controller does not support per-NS erase");
+
/* Try to keep previous namespace parameters. */
read_namespace_data(fd, nsid, );
if (lbaf < 0)
lbaf = (nsd.flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT)
& NVME_NS_DATA_FLBAS_FORMAT_MASK;
+   if (lbaf > nsd.nlbaf)
+   errx(1, "LBA format is out of range");
if (mset < 0)
mset = (nsd.flbas >> NVME_NS_DATA_FLBAS_EXTENDED_SHIFT)
& NVME_NS_DATA_FLBAS_EXTENDED_MASK;
@@ -157,6 +158,17 @@ format(int argc, char *argv[])
if (pil < 0)
pil = (nsd.dps >> NVME_NS_DATA_DPS_PIT_SHIFT)
& NVME_NS_DATA_DPS_PIT_MASK;
+   } else {
+
+   /* We have no previous parameters, so default to zeroes. */
+   if (lbaf < 0)
+   lbaf = 0;
+   if (mset < 0)
+   mset = 0;
+   if (pi < 0)
+   pi = 0;
+   if (pil < 0)
+   pil = 0;
}
 
memset(, 0, sizeof(pt));
___

svn commit: r330845 - in head/sys/powerpc: aim ofw powerpc

2018-03-13 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Tue Mar 13 15:03:58 2018
New Revision: 330845
URL: https://svnweb.freebsd.org/changeset/base/330845

Log:
  Execute PowerPC64/AIM kernel from direct map region when possible.
  
  When the kernel can be in real mode in early boot, we can execute from
  high addresses aliased to the kernel's physical memory. If that high
  address has the first two bits set to 1 (0xc...), those addresses will
  automatically become part of the direct map. This reduces page table
  pressure from the kernel and it sets up the kernel to be used with
  radix translation, for which it has to be up here.
  
  This is accomplished by exploiting the fact that all PowerPC kernels are
  built as position-independent executables and relocate themselves
  on start. Before this patch, the kernel runs at 1:1 VA:PA, but that
  VA/PA is random and set by the bootloader. Very early, it processes
  its ELF relocations to operate wherever it happens to find itself.
  This patch uses that mechanism to re-enter and re-relocate the kernel
  a second time witha new base address set up in the early parts of
  powerpc_init().
  
  Reviewed by:  jhibbits
  Differential Revision:D14647

Modified:
  head/sys/powerpc/aim/aim_machdep.c
  head/sys/powerpc/aim/locore64.S
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/ofw/ofwcall64.S
  head/sys/powerpc/powerpc/machdep.c

Modified: head/sys/powerpc/aim/aim_machdep.c
==
--- head/sys/powerpc/aim/aim_machdep.c  Tue Mar 13 15:02:46 2018
(r330844)
+++ head/sys/powerpc/aim/aim_machdep.c  Tue Mar 13 15:03:58 2018
(r330845)
@@ -160,15 +160,72 @@ extern void   *dlmisstrap, *dlmisssize;
 extern void*dsmisstrap, *dsmisssize;
 
 extern void *ap_pcpu;
+extern void __restartkernel(vm_offset_t, vm_offset_t, vm_offset_t, void *, 
uint32_t, register_t offset, register_t msr);
 
+void aim_early_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry,
+void *mdp, uint32_t mdp_cookie);
 void aim_cpu_init(vm_offset_t toc);
 
 void
+aim_early_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void 
*mdp,
+uint32_t mdp_cookie)
+{
+   register_t  scratch;
+
+   /*
+* If running from an FDT, make sure we are in real mode to avoid
+* tromping on firmware page tables. Everything in the kernel assumes
+* 1:1 mappings out of firmware, so this won't break anything not
+* already broken. This doesn't work if there is live OF, since OF
+* may internally use non-1:1 mappings.
+*/
+   if (ofentry == 0)
+   mtmsr(mfmsr() & ~(PSL_IR | PSL_DR));
+
+#ifdef __powerpc64__
+   /*
+* If in real mode, relocate to high memory so that the kernel
+* can execute from the direct map.
+*/
+   if (!(mfmsr() & PSL_DR) &&
+   (vm_offset_t)_early_init < DMAP_BASE_ADDRESS)
+   __restartkernel(fdt, 0, ofentry, mdp, mdp_cookie,
+   DMAP_BASE_ADDRESS, mfmsr());
+#endif
+
+   /* Various very early CPU fix ups */
+   switch (mfpvr() >> 16) {
+   /*
+* PowerPC 970 CPUs have a misfeature requested by Apple that
+* makes them pretend they have a 32-byte cacheline. Turn this
+* off before we measure the cacheline size.
+*/
+   case IBM970:
+   case IBM970FX:
+   case IBM970MP:
+   case IBM970GX:
+   scratch = mfspr(SPR_HID5);
+   scratch &= ~HID5_970_DCBZ_SIZE_HI;
+   mtspr(SPR_HID5, scratch);
+   break;
+   #ifdef __powerpc64__
+   case IBMPOWER7:
+   case IBMPOWER7PLUS:
+   case IBMPOWER8:
+   case IBMPOWER8E:
+   /* XXX: get from ibm,slb-size in device tree */
+   n_slbs = 32;
+   break;
+   #endif
+   }
+}
+
+void
 aim_cpu_init(vm_offset_t toc)
 {
size_t  trap_offset, trapsize;
vm_offset_t trap;
-   register_t  msr, scratch;
+   register_t  msr;
uint8_t *cache_check;
int cacheline_warn;
#ifndef __powerpc64__
@@ -198,32 +255,6 @@ aim_cpu_init(vm_offset_t toc)
 * Bits 1-4, 10-15 (ppc32), 33-36, 42-47 (ppc64)
 */
psl_userstatic &= ~0x783fUL;
-
-   /* Various very early CPU fix ups */
-   switch (mfpvr() >> 16) {
-   /*
-* PowerPC 970 CPUs have a misfeature requested by Apple that
-* makes them pretend they have a 32-byte cacheline. Turn this
-* off before we measure the cacheline size.
-*/
-   case IBM970:
-   case IBM970FX:
-   case IBM970MP:
-   case IBM970GX:
-   scratch = 

svn commit: r330844 - head/sys/dev/efidev

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Tue Mar 13 15:02:46 2018
New Revision: 330844
URL: https://svnweb.freebsd.org/changeset/base/330844

Log:
  Correct minor typo in comment, efi_dmcap -> efi_tmcap

Modified:
  head/sys/dev/efidev/efirt.c

Modified: head/sys/dev/efidev/efirt.c
==
--- head/sys/dev/efidev/efirt.c Tue Mar 13 15:01:23 2018(r330843)
+++ head/sys/dev/efidev/efirt.c Tue Mar 13 15:02:46 2018(r330844)
@@ -268,7 +268,7 @@ efi_get_time(struct efi_tm *tm)
/*
 * UEFI spec states that the Capabilities argument to GetTime is
 * optional, but some UEFI implementations choke when passed a NULL
-* pointer. Pass a dummy efi_dmcap, even though we won't use it,
+* pointer. Pass a dummy efi_tmcap, even though we won't use it,
 * to workaround such implementations.
 */
error = efi_get_time_locked(tm, );
___
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: r330843 - head/sys/dev/efidev

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Tue Mar 13 15:01:23 2018
New Revision: 330843
URL: https://svnweb.freebsd.org/changeset/base/330843

Log:
  efirtc: Pass a dummy tmcap pointer to efi_get_time_locked
  
  As noted in the comment, UEFI spec claims the capabilities pointer is
  optional, but some implementations will choke and attempt to dereference it
  without checking. This specific problem was found on a Lenovo Thinkpad X220
  that would panic in efirtc_identify.

Modified:
  head/sys/dev/efidev/efirt.c

Modified: head/sys/dev/efidev/efirt.c
==
--- head/sys/dev/efidev/efirt.c Tue Mar 13 13:09:10 2018(r330842)
+++ head/sys/dev/efidev/efirt.c Tue Mar 13 15:01:23 2018(r330843)
@@ -259,12 +259,19 @@ efi_get_time_locked(struct efi_tm *tm, struct efi_tmca
 int
 efi_get_time(struct efi_tm *tm)
 {
+   struct efi_tmcap dummy;
int error;
 
if (efi_runtime == NULL)
return (ENXIO);
EFI_TIME_LOCK()
-   error = efi_get_time_locked(tm, NULL);
+   /*
+* UEFI spec states that the Capabilities argument to GetTime is
+* optional, but some UEFI implementations choke when passed a NULL
+* pointer. Pass a dummy efi_dmcap, even though we won't use it,
+* to workaround such implementations.
+*/
+   error = efi_get_time_locked(tm, );
EFI_TIME_UNLOCK()
return (error);
 }
___
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: r330842 - head/sys/kern

2018-03-13 Thread Ed Maste
Author: emaste
Date: Tue Mar 13 13:09:10 2018
New Revision: 330842
URL: https://svnweb.freebsd.org/changeset/base/330842

Log:
  Use C99 designated initializers for struct execsw
  
  It it makes use slightly more clear and facilitates grepping.

Modified:
  head/sys/kern/imgact_aout.c
  head/sys/kern/imgact_binmisc.c
  head/sys/kern/imgact_elf.c
  head/sys/kern/imgact_gzip.c
  head/sys/kern/imgact_shell.c

Modified: head/sys/kern/imgact_aout.c
==
--- head/sys/kern/imgact_aout.c Tue Mar 13 12:38:26 2018(r330841)
+++ head/sys/kern/imgact_aout.c Tue Mar 13 13:09:10 2018(r330842)
@@ -337,5 +337,8 @@ exec_aout_imgact(struct image_params *imgp)
 /*
  * Tell kern_execve.c about it, with a little help from the linker.
  */
-static struct execsw aout_execsw = { exec_aout_imgact, "a.out" };
+static struct execsw aout_execsw = {
+   .ex_imgact = exec_aout_imgact,
+   .ex_name = "a.out"
+};
 EXEC_SET(aout, aout_execsw);

Modified: head/sys/kern/imgact_binmisc.c
==
--- head/sys/kern/imgact_binmisc.c  Tue Mar 13 12:38:26 2018
(r330841)
+++ head/sys/kern/imgact_binmisc.c  Tue Mar 13 13:09:10 2018
(r330842)
@@ -753,5 +753,8 @@ SYSUNINIT(imgact_binmisc, SI_SUB_EXEC, SI_ORDER_MIDDLE
 /*
  * Tell kern_execve.c about it, with a little help from the linker.
  */
-static struct execsw imgact_binmisc_execsw = { imgact_binmisc_exec, KMOD_NAME 
};
+static struct execsw imgact_binmisc_execsw = {
+   .ex_imgact = imgact_binmisc_exec,
+   .ex_name = KMOD_NAME
+};
 EXEC_SET(imgact_binmisc, imgact_binmisc_execsw);

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Tue Mar 13 12:38:26 2018(r330841)
+++ head/sys/kern/imgact_elf.c  Tue Mar 13 13:09:10 2018(r330842)
@@ -2426,8 +2426,8 @@ __elfN(check_note)(struct image_params *imgp, Elf_Bran
  * Tell kern_execve.c about it, with a little help from the linker.
  */
 static struct execsw __elfN(execsw) = {
-   __CONCAT(exec_, __elfN(imgact)),
-   __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE))
+   .ex_imgact = __CONCAT(exec_, __elfN(imgact)),
+   .ex_name = __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE))
 };
 EXEC_SET(__CONCAT(elf, __ELF_WORD_SIZE), __elfN(execsw));
 

Modified: head/sys/kern/imgact_gzip.c
==
--- head/sys/kern/imgact_gzip.c Tue Mar 13 12:38:26 2018(r330841)
+++ head/sys/kern/imgact_gzip.c Tue Mar 13 13:09:10 2018(r330842)
@@ -387,5 +387,8 @@ Flush(void *vp, u_char * ptr, u_long siz)
 /*
  * Tell kern_execve.c about it, with a little help from the linker.
  */
-static struct execsw gzip_execsw = {exec_gzip_imgact, "gzip"};
+static struct execsw gzip_execsw = {
+   .ex_imgact = exec_gzip_imgact,
+   .ex_name = "gzip"
+};
 EXEC_SET(execgzip, gzip_execsw);

Modified: head/sys/kern/imgact_shell.c
==
--- head/sys/kern/imgact_shell.cTue Mar 13 12:38:26 2018
(r330841)
+++ head/sys/kern/imgact_shell.cTue Mar 13 13:09:10 2018
(r330842)
@@ -255,5 +255,8 @@ exec_shell_imgact(struct image_params *imgp)
 /*
  * Tell kern_execve.c about it, with a little help from the linker.
  */
-static struct execsw shell_execsw = { exec_shell_imgact, "#!" };
+static struct execsw shell_execsw = {
+   .ex_imgact = exec_shell_imgact,
+   .ex_name = "#!"
+};
 EXEC_SET(shell, shell_execsw);
___
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: r330838 - stable/11/sys/dev/syscons

2018-03-13 Thread Eitan Adler
Author: eadler
Date: Tue Mar 13 10:00:14 2018
New Revision: 330838
URL: https://svnweb.freebsd.org/changeset/base/330838

Log:
  MFC r304164:
  
  Disable some more unsafe things in (low level) console mode:
  - never call up to the tty layer to restart output for keyboard input in
console mode.  This was already disallowed in kdb mode.  Other cases
are rarely reached.
  - disable the reboot, halt and powerdown keys in console mode.  The suspend,
standby and panic keys are still allowed, and aren't even conditonal
on excessive configuration options.  Some of these actions are still
available in ddb mode as ddb commands which are equally unsafe.  Some
are useful at input prompts and should be restored when the locking is
fixed.
  - disallow bells in kdb mode (should be in console mode, but the flag for
that is not available).  Visual bell gives very alarming behaviour by
trying to use callouts which don't work in kdb mode.  Audio bell uses
timeouts and hardware resources with mutexes that can deadlock in
reasonable use of ddb.
  
  Screen switches in kdb mode are not very safe, but they are important
  functionality and there is a lot of code to make them sort of work.

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

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Tue Mar 13 09:58:29 2018
(r330837)
+++ stable/11/sys/dev/syscons/syscons.c Tue Mar 13 10:00:14 2018
(r330838)
@@ -3505,8 +3505,9 @@ next_code:
scp->status |= CURSOR_ENABLED;
sc_draw_cursor_image(scp);
}
+   /* Only safe in Giant-locked context. */
tp = SC_DEV(sc, scp->index);
-   if (!kdb_active && tty_opened_ns(tp))
+   if (!(flags & SCGETC_CN) && tty_opened_ns(tp))
sctty_outwakeup(tp);
 #endif
}
@@ -3557,21 +3558,21 @@ next_code:
 
case RBT:
 #ifndef SC_DISABLE_REBOOT
-   if (enable_reboot)
+   if (enable_reboot && !(flags & SCGETC_CN))
shutdown_nice(0);
 #endif
break;
 
case HALT:
 #ifndef SC_DISABLE_REBOOT
-   if (enable_reboot)
+   if (enable_reboot && !(flags & SCGETC_CN))
shutdown_nice(RB_HALT);
 #endif
break;
 
case PDWN:
 #ifndef SC_DISABLE_REBOOT
-   if (enable_reboot)
+   if (enable_reboot && !(flags & SCGETC_CN))
shutdown_nice(RB_HALT|RB_POWEROFF);
 #endif
break;
@@ -3842,7 +3843,7 @@ sc_respond(scr_stat *scp, const u_char *p, int count, 
 void
 sc_bell(scr_stat *scp, int pitch, int duration)
 {
-if (cold || shutdown_in_progress || !enable_bell)
+if (cold || kdb_active || shutdown_in_progress || !enable_bell)
return;
 
 if (scp != scp->sc->cur_scp && (scp->sc->flags & SC_QUIET_BELL))
___
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: r330837 - head/stand/i386/libi386

2018-03-13 Thread Toomas Soome
Author: tsoome
Date: Tue Mar 13 09:58:29 2018
New Revision: 330837
URL: https://svnweb.freebsd.org/changeset/base/330837

Log:
  biosdisk.c should not set d_opendata.
  
  Same as 330807, d_opendata is owned by open_disk and we should not
  set it.
  
  Mstand/i386/libi386/biosdisk.c

Modified:
  head/stand/i386/libi386/biosdisk.c

Modified: head/stand/i386/libi386/biosdisk.c
==
--- head/stand/i386/libi386/biosdisk.c  Tue Mar 13 09:46:09 2018
(r330836)
+++ head/stand/i386/libi386/biosdisk.c  Tue Mar 13 09:58:29 2018
(r330837)
@@ -404,7 +404,6 @@ bd_open(struct open_file *f, ...)
 */
disk.dd.d_dev = dev->dd.d_dev;
disk.dd.d_unit = dev->dd.d_unit;
-   disk.dd.d_opendata = NULL;
disk.d_slice = -1;
disk.d_partition = -1;
disk.d_offset = 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: r330836 - stable/11/sys/dev/syscons

2018-03-13 Thread Eitan Adler
Author: eadler
Date: Tue Mar 13 09:46:09 2018
New Revision: 330836
URL: https://svnweb.freebsd.org/changeset/base/330836

Log:
  MFC r304165,r304166:
  
  Like scr_lock, the grab count needs to be per-physical-device to work.
  
  This bug corrupted the grab count on both vtys if the ungrabbed vty is
  different from the console, and failed to restore the keyboard state
  on the ungrabbed vty, but not restoring the latter usually left the
  keyboard mode part of it uncorrupted at 1 (K_XLATE), while after this
  fix the keyboard mode part is usually corrupted to 0 (K_RAW).
  
  While here, rename the grab count from 'grabbed' to grab_level.

Modified:
  stable/11/sys/dev/syscons/syscons.c
  stable/11/sys/dev/syscons/syscons.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Tue Mar 13 09:42:33 2018
(r330835)
+++ stable/11/sys/dev/syscons/syscons.c Tue Mar 13 09:46:09 2018
(r330836)
@@ -1661,7 +1661,7 @@ sc_cngrab(struct consdev *cp)
 if (scp->sc->kbd == NULL)
return;
 
-if (scp->grabbed++ > 0)
+if (scp->sc->grab_level++ > 0)
return;
 
 /*
@@ -1687,7 +1687,7 @@ sc_cnungrab(struct consdev *cp)
 if (scp->sc->kbd == NULL)
return;
 
-if (--scp->grabbed > 0)
+if (--scp->sc->grab_level > 0)
return;
 
 kbdd_poll(scp->sc->kbd, FALSE);

Modified: stable/11/sys/dev/syscons/syscons.h
==
--- stable/11/sys/dev/syscons/syscons.h Tue Mar 13 09:42:33 2018
(r330835)
+++ stable/11/sys/dev/syscons/syscons.h Tue Mar 13 09:46:09 2018
(r330836)
@@ -230,6 +230,7 @@ typedef struct sc_softc {
charswitch_in_progress;
charwrite_in_progress;
charblink_in_progress;
+   int grab_level;
struct mtx  scr_lock;   /* mutex for sc_puts() */
struct mtx  video_mtx;
 
@@ -304,7 +305,6 @@ typedef struct scr_stat {
void*ts;
 
int status; /* status (bitfield) */
-   int grabbed;
int kbd_mode;   /* keyboard I/O mode */
int kbd_prev_mode;  /* keyboard I/O mode */
 
___
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: r330835 - in head: share/man/man4 sys/x86/isa

2018-03-13 Thread Roger Pau Monné
Author: royger
Date: Tue Mar 13 09:42:33 2018
New Revision: 330835
URL: https://svnweb.freebsd.org/changeset/base/330835

Log:
  at_rtc: check in ACPI FADT boot flags if the RTC is present
  
  Or else disable the device. Note that the detection can be bypassed by
  setting the hw.atrtc.enable option in the loader configuration file.
  More information can be found on atrtc(4).
  
  Sponsored by: Citrix Systems R
  Reviewed by:  ian
  Differential revision:https://reviews.freebsd.org/D14399

Modified:
  head/share/man/man4/atrtc.4
  head/sys/x86/isa/atrtc.c

Modified: head/share/man/man4/atrtc.4
==
--- head/share/man/man4/atrtc.4 Tue Mar 13 09:38:53 2018(r330834)
+++ head/share/man/man4/atrtc.4 Tue Mar 13 09:42:33 2018(r330835)
@@ -33,13 +33,18 @@
 .Sh SYNOPSIS
 This driver is a mandatory part of i386/amd64 kernels.
 .Pp
-The following tunable is settable from the
+The following tunables are settable from the
 .Xr loader 8 :
 .Bl -ohang
 .It Va hint.atrtc. Ns Ar X Ns Va .clock
 controls event timers functionality support.
 Setting to 0, disables it.
 Default value is 1.
+.It Va hw.atrtc.enable
+Forces enabling or disabling of the device(s).
+Setting to 0 disables it, setting to 1 enables it, bypassing any platform
+configuration hints.
+Default value is -1 (autodetect).
 .El
 .Sh DESCRIPTION
 This driver uses RTC hardware to supply kernel with time-of-day clock

Modified: head/sys/x86/isa/atrtc.c
==
--- head/sys/x86/isa/atrtc.cTue Mar 13 09:38:53 2018(r330834)
+++ head/sys/x86/isa/atrtc.cTue Mar 13 09:42:33 2018(r330835)
@@ -32,6 +32,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_acpi.h"
 #include "opt_isa.h"
 
 #include 
@@ -55,6 +56,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "clock_if.h"
 
+#ifdef DEV_ACPI
+#include 
+#endif
+
 /*
  * atrtc_lock protects low-level access to individual hardware registers.
  * atrtc_time_lock protects the entire sequence of accessing multiple registers
@@ -63,6 +68,10 @@ __FBSDID("$FreeBSD$");
 static struct mtx atrtc_lock;
 MTX_SYSINIT(atrtc_lock_init, _lock, "atrtc", MTX_SPIN);
 
+/* Force RTC enabled/disabled. */
+static int atrtc_enabled = -1;
+TUNABLE_INT("hw.atrtc.enabled", _enabled);
+
 struct mtx atrtc_time_lock;
 MTX_SYSINIT(atrtc_time_lock_init, _time_lock, "atrtc_time", MTX_DEF);
 
@@ -249,11 +258,43 @@ static struct isa_pnp_id atrtc_ids[] = {
{ 0 }
 };
 
+static bool
+atrtc_acpi_disabled(void)
+{
+#ifdef DEV_ACPI
+   ACPI_TABLE_FADT *fadt;
+   vm_paddr_t physaddr;
+   uint16_t flags;
+
+   physaddr = acpi_find_table(ACPI_SIG_FADT);
+   if (physaddr == 0)
+   return (false);
+
+   fadt = acpi_map_table(physaddr, ACPI_SIG_FADT);
+   if (fadt == NULL) {
+   printf("at_rtc: unable to map FADT ACPI table\n");
+   return (false);
+   }
+
+   flags = fadt->BootFlags;
+   acpi_unmap_table(fadt);
+
+   if (flags & ACPI_FADT_NO_CMOS_RTC)
+   return (true);
+#endif
+
+   return (false);
+}
+
 static int
 atrtc_probe(device_t dev)
 {
int result;
-   
+
+   if ((atrtc_enabled == -1 && atrtc_acpi_disabled()) ||
+   (atrtc_enabled == 0))
+   return (ENXIO);
+
result = ISA_PNP_PROBE(device_get_parent(dev), dev, atrtc_ids);
/* ENOENT means no PnP-ID, device is hinted. */
if (result == ENOENT) {
___
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: r330834 - head/sys/dev/vt/hw/vga

2018-03-13 Thread Roger Pau Monné
Author: royger
Date: Tue Mar 13 09:38:53 2018
New Revision: 330834
URL: https://svnweb.freebsd.org/changeset/base/330834

Log:
  vt_vga: check if VGA is available from ACPI FADT table
  
  On x86 the IA-PC Boot Flags in the FADT can signal whether VGA is
  available or not.
  
  Sponsored by: Citrix systems R
  Reviewed by:  marcel
  Differential revision:https://reviews.freebsd.org/D14397

Modified:
  head/sys/dev/vt/hw/vga/vt_vga.c

Modified: head/sys/dev/vt/hw/vga/vt_vga.c
==
--- head/sys/dev/vt/hw/vga/vt_vga.c Tue Mar 13 09:29:56 2018
(r330833)
+++ head/sys/dev/vt/hw/vga/vt_vga.c Tue Mar 13 09:38:53 2018
(r330834)
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_acpi.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -46,6 +48,10 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#if ((defined(__amd64__) || defined(__i386__)) && defined(DEV_ACPI))
+#include 
+#endif
+
 struct vga_softc {
bus_space_tag_t  vga_fb_tag;
bus_space_handle_t   vga_fb_handle;
@@ -1196,11 +1202,39 @@ vga_initialize(struct vt_device *vd, int textmode)
return (0);
 }
 
+static bool
+vga_acpi_disabled(void)
+{
+#if ((defined(__amd64__) || defined(__i386__)) && defined(DEV_ACPI))
+   ACPI_TABLE_FADT *fadt;
+   vm_paddr_t physaddr;
+   uint16_t flags;
+
+   physaddr = acpi_find_table(ACPI_SIG_FADT);
+   if (physaddr == 0)
+   return (false);
+
+   fadt = acpi_map_table(physaddr, ACPI_SIG_FADT);
+   if (fadt == NULL) {
+   printf("vt_vga: unable to map FADT ACPI table\n");
+   return (false);
+   }
+
+   flags = fadt->BootFlags;
+   acpi_unmap_table(fadt);
+
+   if (flags & ACPI_FADT_NO_VGA)
+   return (true);
+#endif
+
+   return (false);
+}
+
 static int
 vga_probe(struct vt_device *vd)
 {
 
-   return (CN_INTERNAL);
+   return (vga_acpi_disabled() ? CN_DEAD : CN_INTERNAL);
 }
 
 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: r330833 - stable/11/sys/dev/syscons

2018-03-13 Thread Eitan Adler
Author: eadler
Date: Tue Mar 13 09:29:56 2018
New Revision: 330833
URL: https://svnweb.freebsd.org/changeset/base/330833

Log:
  MFC r304161:
  
  Change all uses of 'debugger' to kdb_active and remove this variable.  This
  restores avoidance of doing dangerous things like calling wakeup() and
  callouts while in ddb.
  
  Initialization of 'debugger' was broken by removing the cndbctl() console
  method that was used mainly in this driver to initialize 'debugger' and
  switch to the console screen on entry to ddb.  The screen switch was
  restored using the cngrab() method, but cngrab() is more general so it
  should not initialize 'debugger' and never did.  'debugger' was just
  an over-engineered alias for kdb_active anyway.  It existed because
  kdb_active (when it was named ddb_active) was considered as a private
  kdb variable, and there are ordering problems initializing the variables
  atomically with the state that they represent, but an extra variable and
  method to set it increased these problems.
  
  The bug caused LORs, but WITNESS is normally misconfigured with
  WITNESS_SKIPSIN so it doesn't check the spinlocks used by wakeup() and
  callouts.

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

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Tue Mar 13 09:21:07 2018
(r330832)
+++ stable/11/sys/dev/syscons/syscons.c Tue Mar 13 09:29:56 2018
(r330833)
@@ -172,8 +172,6 @@ SYSCTL_INT(_machdep, OID_AUTO, enable_panic_key, CTLFL
 
 #define VTY_WCHAN(sc, vty) (_DEV(sc, vty))
 
-static int debugger;
-
 /* prototypes */
 static int sc_allocate_keyboard(sc_softc_t *sc, int unit);
 static int scvidprobe(int unit, int flags, int cons);
@@ -1815,7 +1813,7 @@ sccnupdate(scr_stat *scp)
 if (suspend_in_progress || scp->sc->font_loading_in_progress)
return;
 
-if (debugger > 0 || panicstr || shutdown_in_progress) {
+if (kdb_active || panicstr || shutdown_in_progress) {
sc_touch_scrn_saver();
 } else if (scp != scp->sc->cur_scp) {
return;
@@ -1884,7 +1882,7 @@ scrn_timer(void *arg)
 #endif /* PC98 */
 
 /* should we stop the screen saver? */
-if (debugger > 0 || panicstr || shutdown_in_progress)
+if (kdb_active || panicstr || shutdown_in_progress)
sc_touch_scrn_saver();
 if (run_scrn_saver) {
if (time_uptime > sc->scrn_time_stamp + scrn_blank_time)
@@ -2279,7 +2277,7 @@ stop_scrn_saver(sc_softc_t *sc, void (*saver)(sc_softc
 mark_all(sc->cur_scp);
 if (sc->delayed_next_scr)
sc_switch_scr(sc, sc->delayed_next_scr - 1);
-if (debugger == 0)
+if (!kdb_active)
wakeup(_blanked);
 }
 
@@ -2474,7 +2472,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr)
DPRINTF(5, ("error 2, requested vty isn't open!\n"));
return EINVAL;
}
-   if ((debugger > 0) && (SC_STAT(tp)->smode.mode == VT_PROCESS)) {
+   if (kdb_active && SC_STAT(tp)->smode.mode == VT_PROCESS) {
splx(s);
DPRINTF(5, ("error 3, requested vty is in the VT_PROCESS mode\n"));
return EINVAL;
@@ -2495,7 +2493,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr)
 * is supposed to be locked by splhigh(), but the debugger may
 * be invoked at splhigh().
 */
-   if (debugger == 0)
+   if (!kdb_active)
wakeup(VTY_WCHAN(sc,next_scr));
splx(s);
DPRINTF(5, ("switch done (new == old)\n"));
@@ -2518,7 +2516,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr)
 s = spltty();
 
 /* wake up processes waiting for this vty */
-if (debugger == 0)
+if (!kdb_active)
wakeup(VTY_WCHAN(sc,next_scr));
 
 /* wait for the controlling process to acknowledge, if necessary */
___
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: r330832 - stable/11/sys/dev/syscons

2018-03-13 Thread Eitan Adler
Author: eadler
Date: Tue Mar 13 09:21:07 2018
New Revision: 330832
URL: https://svnweb.freebsd.org/changeset/base/330832

Log:
  MFC r304153:
  
  Quick fix for locking fixes in r172250.  The lock added there was per-
  virtual-device, but needs to be per-physical-device so that it protects
  shared data.  Usually, scp->sc->write_in_progress got corrupted first
  and further corruption was limited when this variable was left at nonzero
  with no write in progress.
  
  Attempt to fix missing lock destruction in r162285.  Put it with the
  lock destruction for r172250 after moving the latter.  Both might be
  unreachable.
  
  To demonstrate the bug, find a buggy syscall or sysctl that calls
  printf(9) and run this often.  Run hd /dev/zero >/dev/ttyvN for any
  N != 0.  The console spam goes to ttyv0 and the non-console spam goes
  to ttyvN, so the lock provided no protection (but it helped for
  N == 0).

Modified:
  stable/11/sys/dev/syscons/syscons.c
  stable/11/sys/dev/syscons/syscons.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Tue Mar 13 09:18:04 2018
(r330831)
+++ stable/11/sys/dev/syscons/syscons.c Tue Mar 13 09:21:07 2018
(r330832)
@@ -2688,13 +2688,13 @@ sc_puts(scr_stat *scp, u_char *buf, int len, int kerne
 #endif
 
 if (scp->tsw) {
-   if (!kdb_active && !mtx_owned(>scr_lock)) {
+   if (!kdb_active && !mtx_owned(>sc->scr_lock)) {
need_unlock = 1;
-   mtx_lock_spin(>scr_lock);
+   mtx_lock_spin(>sc->scr_lock);
}
(*scp->tsw->te_puts)(scp, buf, len, kernel);
if (need_unlock)
-   mtx_unlock_spin(>scr_lock);
+   mtx_unlock_spin(>sc->scr_lock);
 }
 
 if (scp->sc->delayed_next_scr)
@@ -2859,8 +2859,10 @@ scinit(int unit, int flags)
  * disappeared...
  */
 sc = sc_get_softc(unit, flags & SC_KERNEL_CONSOLE);
-if ((sc->flags & SC_INIT_DONE) == 0)
+if ((sc->flags & SC_INIT_DONE) == 0) {
+   mtx_init(>scr_lock, "scrlock", NULL, MTX_SPIN);
SC_VIDEO_LOCKINIT(sc);
+}
 
 adp = NULL;
 if (sc->adapter >= 0) {
@@ -3077,7 +3079,8 @@ scterm(int unit, int flags)
(*scp->tsw->te_term)(scp, >ts);
 if (scp->ts != NULL)
free(scp->ts, M_DEVBUF);
-mtx_destroy(>scr_lock);
+mtx_destroy(>scr_lock);
+mtx_destroy(>video_mtx);
 
 /* clear the structure */
 if (!(flags & SC_KERNEL_CONSOLE)) {
@@ -3302,8 +3305,6 @@ init_scp(sc_softc_t *sc, int vty, scr_stat *scp)
 scp->history = NULL;
 scp->history_pos = 0;
 scp->history_size = 0;
-
-mtx_init(>scr_lock, "scrlock", NULL, MTX_SPIN);
 }
 
 int

Modified: stable/11/sys/dev/syscons/syscons.h
==
--- stable/11/sys/dev/syscons/syscons.h Tue Mar 13 09:18:04 2018
(r330831)
+++ stable/11/sys/dev/syscons/syscons.h Tue Mar 13 09:21:07 2018
(r330832)
@@ -230,6 +230,7 @@ typedef struct sc_softc {
charswitch_in_progress;
charwrite_in_progress;
charblink_in_progress;
+   struct mtx  scr_lock;   /* mutex for sc_puts() */
struct mtx  video_mtx;
 
longscrn_time_stamp;
@@ -344,7 +345,6 @@ typedef struct scr_stat {
 
int splash_save_mode;   /* saved mode for splash screen 
*/
int splash_save_status; /* saved status for splash 
screen */
-   struct mtx  scr_lock;   /* mutex for sc_puts() */
 #ifdef _SCR_MD_STAT_DECLARED_
scr_md_stat_t   md; /* machine dependent vars */
 #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: r330831 - stable/11/sys/dev/syscons/fonts

2018-03-13 Thread Eitan Adler
Author: eadler
Date: Tue Mar 13 09:18:04 2018
New Revision: 330831
URL: https://svnweb.freebsd.org/changeset/base/330831

Log:
  MFC r320805:
  
  Add files to help manage the (vga) syscons mouse cursor.
  
  To mostly fix distortion of mouse cursors by non-square pixels, I
  needed 8 variants of the same cursor shape for large fonts and
  another 7 variants for small fonts.  Some variants are shared,
  leaving only 13 variants in 26 glyphs altogether.  Keep these in
  the BDF source file cursor.bdf.  cursor.bdf has another 5 unused
  experimental cursors in 10 glyphs.  cursor.awk is a simple awk
  script for converting this and similar bdf files into C declarations
  for copying into scvgarndr.c.  syscons doesn't use any of this yet.

Added:
  stable/11/sys/dev/syscons/fonts/
 - copied from r320805, head/sys/dev/syscons/fonts/
Modified:
Directory Properties:
  stable/11/   (props changed)
___
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: r330830 - in stable/11/sys: compat/linuxkpi/common/include/linux dev/mlx4/mlx4_core

2018-03-13 Thread Andrey V. Elsukov
Author: ae
Date: Tue Mar 13 08:46:47 2018
New Revision: 330830
URL: https://svnweb.freebsd.org/changeset/base/330830

Log:
  MFC r330537:
Add mapping for several ethernet types used by Linux to FreeBSD
ethernet types.
  
Reviewed by:hselasky
Differential Revision:  https://reviews.freebsd.org/D14594

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/if_ether.h
  stable/11/sys/dev/mlx4/mlx4_core/mlx4.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/if_ether.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/if_ether.h   Tue Mar 
13 08:45:06 2018(r330829)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/if_ether.h   Tue Mar 
13 08:46:47 2018(r330830)
@@ -35,8 +35,6 @@
 
 #include 
 
-#defineETH_P_8021Q ETHERTYPE_VLAN
-
 #define ETH_HLENETHER_HDR_LEN   /* Total octets in header. 
 */
 #ifndef ETH_ALEN
 #define ETH_ALENETHER_ADDR_LEN
@@ -47,6 +45,11 @@
 /*
  * defined Ethernet Protocol ID's.
  */
-#define ETH_P_IP0x0800  /* Internet Protocol packet
 */
+#defineETH_P_IPETHERTYPE_IP
+#defineETH_P_IPV6  ETHERTYPE_IPV6
+#defineETH_P_MPLS_UC   ETHERTYPE_MPLS
+#defineETH_P_MPLS_MC   ETHERTYPE_MPLS_MCAST
+#defineETH_P_8021Q ETHERTYPE_VLAN
+#defineETH_P_8021ADETHERTYPE_QINQ
 
 #endif /* _LINUX_IF_ETHER_H_ */

Modified: stable/11/sys/dev/mlx4/mlx4_core/mlx4.h
==
--- stable/11/sys/dev/mlx4/mlx4_core/mlx4.h Tue Mar 13 08:45:06 2018
(r330829)
+++ stable/11/sys/dev/mlx4/mlx4_core/mlx4.h Tue Mar 13 08:46:47 2018
(r330830)
@@ -66,8 +66,6 @@
 
 #define MLX4_QUERY_IF_STAT_RESET   BIT(31)
 
-#defineETH_P_8021AD0x88A8
-
 enum {
MLX4_HCR_BASE   = 0x80680,
MLX4_HCR_SIZE   = 0x0001c,
___
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: r330829 - stable/11/sys/net

2018-03-13 Thread Andrey V. Elsukov
Author: ae
Date: Tue Mar 13 08:45:06 2018
New Revision: 330829
URL: https://svnweb.freebsd.org/changeset/base/330829

Log:
  MFC r330536:
Define ethernet type 0x88A8 as ETHERTYPE_QINQ.
  
Reviewed by:kp
Obtained from:  OpenBSD
Differential Revision:  https://reviews.freebsd.org/D14593

Modified:
  stable/11/sys/net/ethernet.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/ethernet.h
==
--- stable/11/sys/net/ethernet.hTue Mar 13 03:54:41 2018
(r330828)
+++ stable/11/sys/net/ethernet.hTue Mar 13 08:45:06 2018
(r330829)
@@ -341,6 +341,7 @@ struct ether_vlan_header {
 #defineETHERTYPE_PPPOE 0x8864  /* PPP Over Ethernet Session 
Stage */
 #defineETHERTYPE_LANPROBE  0x  /* HP LanProbe test? */
 #defineETHERTYPE_PAE   0x888e  /* EAPOL PAE/802.1x */
+#defineETHERTYPE_QINQ  0x88A8  /* 802.1ad VLAN stacking */
 #defineETHERTYPE_LOOPBACK  0x9000  /* Loopback: used to test 
interfaces */
 #defineETHERTYPE_LBACK ETHERTYPE_LOOPBACK  /* DEC MOP 
loopback */
 #defineETHERTYPE_XNSSM 0x9001  /* 3Com (Formerly Bridge 
Communications), XNS Systems Management */
___
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"