svn commit: r331481 - head/contrib/tzdata

2018-03-23 Thread Philip Paeps
Author: philip
Date: Sat Mar 24 04:52:29 2018
New Revision: 331481
URL: https://svnweb.freebsd.org/changeset/base/331481

Log:
  Import tzdata 2018d
  
  Changes: https://github.com/eggert/tz/blob/2018d/NEWS
  
  MFC after:3 days

Added:
  head/contrib/tzdata/ziguard.awk
 - copied unchanged from r331479, vendor/tzdata/dist/ziguard.awk
Modified:
  head/contrib/tzdata/CONTRIBUTING
  head/contrib/tzdata/Makefile
  head/contrib/tzdata/NEWS
  head/contrib/tzdata/africa
  head/contrib/tzdata/antarctica
  head/contrib/tzdata/asia
  head/contrib/tzdata/australasia
  head/contrib/tzdata/backzone
  head/contrib/tzdata/checktab.awk
  head/contrib/tzdata/europe
  head/contrib/tzdata/northamerica
  head/contrib/tzdata/southamerica
  head/contrib/tzdata/theory.html
  head/contrib/tzdata/version
  head/contrib/tzdata/zishrink.awk
  head/contrib/tzdata/zone.tab
  head/contrib/tzdata/zone1970.tab
Directory Properties:
  head/contrib/tzdata/   (props changed)

Modified: head/contrib/tzdata/CONTRIBUTING
==
--- head/contrib/tzdata/CONTRIBUTINGSat Mar 24 04:42:56 2018
(r331480)
+++ head/contrib/tzdata/CONTRIBUTINGSat Mar 24 04:52:29 2018
(r331481)
@@ -25,7 +25,8 @@ justification.  Citations should use https: URLs if av
 
 Please submit changes against either the latest release in
  or the master branch of the development
-repository.  If you use Git the following workflow may be helpful:
+repository.  The latter is preferred.  If you use Git the following
+workflow may be helpful:
 
   * Copy the development repository.
 
@@ -42,6 +43,12 @@ repository.  If you use Git the following workflow may
 
   git checkout -b mybranch
 
+  * Sleuth by using 'git blame'.  For example, when fixing data for
+Africa/Sao_Tome, if the command 'git blame africa' outputs a line
+'2951fa3b (Paul Eggert 2018-01-08 09:03:13 -0800 1068) Zone
+Africa/Sao_Tome 0:26:56 - LMT 1884', commit 2951fa3b should
+provide some justification for the 'Zone Africa/Sao_Tome' line.
+
   * Edit source files.  Include commentary that justifies the
 changes by citing reliable sources.
 
@@ -66,6 +73,9 @@ repository.  If you use Git the following workflow may
 for others to review.
 
   git send-email master
+
+For an archived example of such an email, see
+.
 
   * Start anew by getting current with the master branch again
 (the second step above).

Modified: head/contrib/tzdata/Makefile
==
--- head/contrib/tzdata/MakefileSat Mar 24 04:42:56 2018
(r331480)
+++ head/contrib/tzdata/MakefileSat Mar 24 04:52:29 2018
(r331481)
@@ -10,6 +10,15 @@ VERSION= unknown
 # Email address for bug reports.
 BUGEMAIL=  t...@iana.org
 
+# Choose source data features.  To get new features right away, use:
+#  DATAFORM=   vanguard
+# To wait a while before using new features, to give downstream users
+# time to upgrade zic (the default), use:
+#  DATAFORM=   main
+# To wait even longer for new features, use:
+#  DATAFORM=   rearguard
+DATAFORM=  main
+
 # Change the line below for your time zone (after finding the zone you want in
 # the time zone files, or adding it to a time zone file).
 # Alternately, if you discover you've got the wrong time zone, you can just
@@ -25,10 +34,10 @@ LOCALTIME=  GMT
 # for handling POSIX-style time zone environment variables,
 # change the line below (after finding the zone you want in the
 # time zone files, or adding it to a time zone file).
-# (When a POSIX-style environment variable is handled, the rules in the
+# When a POSIX-style environment variable is handled, the rules in the
 # template file are used to determine "spring forward" and "fall back" days and
 # times; the environment variable itself specifies UT offsets of standard and
-# summer time.)
+# daylight saving time.
 # Alternately, if you discover you've got the wrong time zone, you can just
 #  zic -p rightzone
 # to correct things.
@@ -189,13 +198,18 @@ LDLIBS=
 #  -DHAVE_STDINT_H if you have a non-C99 compiler with 
 #  -DHAVE_STRFTIME_L if  declares locale_t and strftime_l
 #  -DHAVE_STRDUP=0 if your system lacks the strdup function
+#  -DHAVE_STRTOLL=0 if your system lacks the strtoll function
 #  -DHAVE_SYMLINK=0 if your system lacks the symlink function
 #  -DHAVE_SYS_STAT_H=0 if your compiler lacks a 
 #  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a 
 #  -DHAVE_TZSET=0 if your system lacks a tzset function
 #  -DHAVE_UNISTD_H=0 if your compiler lacks a 
 #  -Dlocale_t=XXX if your system uses XXX instead of locale_t
+#  -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
+#  with external linkage, e.g., applications cannot define 'localtime'.
 #  -Dssize_t=long on 

svn commit: r331478 - head/usr.sbin/ctld

2018-03-23 Thread John-Mark Gurney
Author: jmg
Date: Sat Mar 24 04:21:22 2018
New Revision: 331478
URL: https://svnweb.freebsd.org/changeset/base/331478

Log:
  minor work smithing...

Modified:
  head/usr.sbin/ctld/ctld.8

Modified: head/usr.sbin/ctld/ctld.8
==
--- head/usr.sbin/ctld/ctld.8   Sat Mar 24 04:03:55 2018(r331477)
+++ head/usr.sbin/ctld/ctld.8   Sat Mar 24 04:21:22 2018(r331478)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 28, 2017
+.Dd March 23, 2018
 .Dt CTLD 8
 .Os
 .Sh NAME
@@ -47,8 +47,11 @@ passing connections to the kernel part of the native i
 .Pp
 Upon startup, the
 .Nm
-daemon parses the configuration file and exits, if it encounters any errors.
-Then it compares the configuration with the kernel list of LUNs managed
+daemon parses the configuration file.
+If it encounters any errors,
+.Nm
+exits.
+It then compares the configuration with the kernel list of LUNs managed
 by previously running
 .Nm
 instances, removes LUNs no longer existing in the configuration file,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331477 - head/stand/lua

2018-03-23 Thread Kyle Evans
Author: kevans
Date: Sat Mar 24 04:03:55 2018
New Revision: 331477
URL: https://svnweb.freebsd.org/changeset/base/331477

Log:
  lualoader: Privatize some more config.lua bits
  
  These functions are also not quite suitable for a public API, so privatize
  them to config.

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Mar 24 04:00:01 2018(r331476)
+++ head/stand/lua/config.lua   Sat Mar 24 04:03:55 2018(r331477)
@@ -92,6 +92,16 @@ local function setEnv(key, value)
return loader.setenv(key, value)
 end
 
+-- name here is one of 'name', 'type', flags', 'before', 'after', or 'error.'
+-- These are set from lines in loader.conf(5): ${key}_${name}="${value}" where
+-- ${key} is a module name.
+local function setKey(key, name, value)
+   if modules[key] == nil then
+   modules[key] = {}
+   end
+   modules[key][name] = value
+end
+
 local pattern_table = {
{
str = "^%s*(#.*)",
@@ -111,42 +121,42 @@ local pattern_table = {
{
str = "^%s*([%w_]+)_name%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v)
-   config.setKey(k, "name", v)
+   setKey(k, "name", v)
end,
},
--  module_type="value"
{
str = "^%s*([%w_]+)_type%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v)
-   config.setKey(k, "type", v)
+   setKey(k, "type", v)
end,
},
--  module_flags="value"
{
str = "^%s*([%w_]+)_flags%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v)
-   config.setKey(k, "flags", v)
+   setKey(k, "flags", v)
end,
},
--  module_before="value"
{
str = "^%s*([%w_]+)_before%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v)
-   config.setKey(k, "before", v)
+   setKey(k, "before", v)
end,
},
--  module_after="value"
{
str = "^%s*([%w_]+)_after%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v)
-   config.setKey(k, "after", v)
+   setKey(k, "after", v)
end,
},
--  module_error="value"
{
str = "^%s*([%w_]+)_error%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v)
-   config.setKey(k, "error", v)
+   setKey(k, "error", v)
end,
},
--  exec="command"
@@ -178,6 +188,73 @@ local pattern_table = {
},
 }
 
+local function isValidComment(line)
+   if line ~= nil then
+   local s = line:match("^%s*#.*")
+   if s == nil then
+   s = line:match("^%s*$")
+   end
+   if s == nil then
+   return false
+   end
+   end
+   return true
+end
+
+local function loadModule(mod, silent)
+   local status = true
+   local pstatus
+   for k, v in pairs(mod) do
+   if v.load == "YES" then
+   local str = "load "
+   if v.flags ~= nil then
+   str = str .. v.flags .. " "
+   end
+   if v.type ~= nil then
+   str = str .. "-t " .. v.type .. " "
+   end
+   if v.name ~= nil then
+   str = str .. v.name
+   else
+   str = str .. k
+   end
+   if v.before ~= nil then
+   pstatus = cli_execute_unparsed(v.before) == 0
+   if not pstatus and not silent then
+   print(MSG_FAILEXBEF:format(v.before, k))
+   end
+   status = status and pstatus
+   end
+
+   if cli_execute_unparsed(str) ~= 0 then
+   if not silent then
+   print(MSG_FAILEXMOD:format(str))
+   end
+   if v.error ~= nil then
+   cli_execute_unparsed(v.error)
+   end
+   status = false
+   end
+
+   if v.after ~= nil then
+   pstatus = cli_execute_unparsed(v.after) == 0
+   if not pstatus and not 

svn commit: r331476 - head/stand/lua

2018-03-23 Thread Kyle Evans
Author: kevans
Date: Sat Mar 24 04:00:01 2018
New Revision: 331476
URL: https://svnweb.freebsd.org/changeset/base/331476

Log:
  lualoader: Make config env-related bits private API
  
  This pertains exclusively to the set/restore functionality that we offer,
  where any changes made by loader.conf previously will be effectively removed
  upon reload of the configuration. We don't currently have a need to export
  these, so don't bother.

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Mar 24 02:01:25 2018(r331475)
+++ head/stand/lua/config.lua   Sat Mar 24 04:00:01 2018(r331476)
@@ -34,6 +34,10 @@ local hook = require("hook")
 local config = {}
 local modules = {}
 local carousel_choices = {}
+-- Which variables we changed
+local env_changed = {}
+-- Values to restore env to (nil to unset)
+local env_restore = {}
 
 local MSG_FAILEXEC = "Failed to exec '%s'"
 local MSG_FAILSETENV = "Failed to '%s' with value: %s"
@@ -50,6 +54,44 @@ local MSG_KERNLOADING = "Loading kernel..."
 local MSG_MODLOADING = "Loading configured modules..."
 local MSG_MODLOADFAIL = "Could not load one or more modules!"
 
+local function restoreEnv()
+   -- Examine changed environment variables
+   for k, v in pairs(env_changed) do
+   local restore_value = env_restore[k]
+   if restore_value == nil then
+   -- This one doesn't need restored for some reason
+   goto continue
+   end
+   local current_value = loader.getenv(k)
+   if current_value ~= v then
+   -- This was overwritten by some action taken on the menu
+   -- most likely; we'll leave it be.
+   goto continue
+   end
+   restore_value = restore_value.value
+   if restore_value ~= nil then
+   loader.setenv(k, restore_value)
+   else
+   loader.unsetenv(k)
+   end
+   ::continue::
+   end
+
+   env_changed = {}
+   env_restore = {}
+end
+
+local function setEnv(key, value)
+   -- Track the original value for this if we haven't already
+   if env_restore[key] == nil then
+   env_restore[key] = {value = loader.getenv(key)}
+   end
+
+   env_changed[key] = value
+
+   return loader.setenv(key, value)
+end
+
 local pattern_table = {
{
str = "^%s*(#.*)",
@@ -120,7 +162,7 @@ local pattern_table = {
{
str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v)
-   if config.setenv(k, v) ~= 0 then
+   if setEnv(k, v) ~= 0 then
print(MSG_FAILSETENV:format(k, v))
end
end,
@@ -129,7 +171,7 @@ local pattern_table = {
{
str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)",
process = function(k, v)
-   if config.setenv(k, v) ~= 0 then
+   if setEnv(k, v) ~= 0 then
print(MSG_FAILSETENV:format(k, tostring(v)))
end
end,
@@ -195,10 +237,6 @@ local function checkNextboot()
 end
 
 -- Module exports
--- Which variables we changed
-config.env_changed = {}
--- Values to restore env to (nil to unset)
-config.env_restore = {}
 config.verbose = false
 
 -- The first item in every carousel is always the default item.
@@ -214,44 +252,6 @@ function config.setCarouselIndex(id, idx)
carousel_choices[id] = idx
 end
 
-function config.restoreEnv()
-   -- Examine changed environment variables
-   for k, v in pairs(config.env_changed) do
-   local restore_value = config.env_restore[k]
-   if restore_value == nil then
-   -- This one doesn't need restored for some reason
-   goto continue
-   end
-   local current_value = loader.getenv(k)
-   if current_value ~= v then
-   -- This was overwritten by some action taken on the menu
-   -- most likely; we'll leave it be.
-   goto continue
-   end
-   restore_value = restore_value.value
-   if restore_value ~= nil then
-   loader.setenv(k, restore_value)
-   else
-   loader.unsetenv(k)
-   end
-   ::continue::
-   end
-
-   config.env_changed = {}
-   config.env_restore = {}
-end
-
-function config.setenv(key, value)
-   -- Track the original value for this if we haven't already
-   if config.env_restore[key] == nil then
-   config.env_restore[key] 

svn commit: r331475 - in head/stand: efi/libefi i386/libi386

2018-03-23 Thread Kyle Evans
Author: kevans
Date: Sat Mar 24 02:01:25 2018
New Revision: 331475
URL: https://svnweb.freebsd.org/changeset/base/331475

Log:
  loader consoles: Implement SGR 24, 25
  
  Mostly for completeness sake- implement 24 (no underline) and 25 (no blink)
  
  MFC after:3 days

Modified:
  head/stand/efi/libefi/efi_console.c
  head/stand/i386/libi386/vidconsole.c

Modified: head/stand/efi/libefi/efi_console.c
==
--- head/stand/efi/libefi/efi_console.c Sat Mar 24 01:53:43 2018
(r331474)
+++ head/stand/efi/libefi/efi_console.c Sat Mar 24 02:01:25 2018
(r331475)
@@ -386,6 +386,10 @@ efi_term_emu(int c)
case 22:/* normal intensity */
fg_c &= ~0x8;
break;
+   case 24:/* not underline */
+   case 25:/* not blinking */
+   bg_c &= ~0x8;
+   break;
case 30: case 31: case 32: case 33:
case 34: case 35: case 36: case 37:
fg_c = ansi_col[args[i] - 30];

Modified: head/stand/i386/libi386/vidconsole.c
==
--- head/stand/i386/libi386/vidconsole.cSat Mar 24 01:53:43 2018
(r331474)
+++ head/stand/i386/libi386/vidconsole.cSat Mar 24 02:01:25 2018
(r331475)
@@ -452,6 +452,10 @@ vidc_term_emu(int c)
case 22:/* normal intensity */
fg_c &= ~0x8;
break;
+   case 24:/* not underline */
+   case 25:/* not blinking */
+   bg_c &= ~0x8;
+   break;
case 30: case 31: case 32: case 33:
case 34: case 35: case 36: case 37:
fg_c = ansi_col[args[i] - 30];
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331474 - head/stand/efi/loader

2018-03-23 Thread Kyle Evans
Author: kevans
Date: Sat Mar 24 01:53:43 2018
New Revision: 331474
URL: https://svnweb.freebsd.org/changeset/base/331474

Log:
  efi loader: Choose a console mode instead if hw.vga.textmode is set
  
  Not all systems use efifb; pull hw.vga.textmode and choose a good console
  mode instead if it's set to something non-zero. This is basically a revival
  of the code that used to live in boot1, but instead rebased onto this
  different way of doing mode selection in loader.efi.
  
  Interestingly enough, the regression that was previously introduced where
  GOP would not reflect the console setting does not seem to exist when
  console mode selection is done here. I've not done any investigation as to
  why this is the case. Nevertheless, boot1.efi is still not the best place to
  do mode selection.

Modified:
  head/stand/efi/loader/framebuffer.c

Modified: head/stand/efi/loader/framebuffer.c
==
--- head/stand/efi/loader/framebuffer.c Sat Mar 24 01:15:38 2018
(r331473)
+++ head/stand/efi/loader/framebuffer.c Sat Mar 24 01:53:43 2018
(r331474)
@@ -588,6 +588,29 @@ gop_autoresize(EFI_GRAPHICS_OUTPUT *gop)
 }
 
 static int
+text_autoresize()
+{
+   SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
+   EFI_STATUS status;
+   UINTN i, max_dim, best_mode, cols, rows;
+
+   conout = ST->ConOut;
+   max_dim = best_mode = 0;
+   for (i = 0; i < conout->Mode->MaxMode; i++) {
+   status = conout->QueryMode(conout, i, , );
+   if (EFI_ERROR(status))
+   continue;
+   if (cols * rows > max_dim) {
+   max_dim = cols * rows;
+   best_mode = i;
+   }
+   }
+   if (max_dim > 0)
+   conout->SetMode(conout, best_mode);
+   return (CMD_OK);
+}
+
+static int
 uga_autoresize(EFI_UGA_DRAW_PROTOCOL *gop)
 {
 
@@ -601,8 +624,14 @@ command_autoresize(int argc, char *argv[])
 {
EFI_GRAPHICS_OUTPUT *gop;
EFI_UGA_DRAW_PROTOCOL *uga;
+   char *textmode;
EFI_STATUS status;
u_int mode;
+
+   textmode = getenv("hw.vga.textmode");
+   /* If it's set and non-zero, we'll select a console mode instead */
+   if (textmode != NULL && strcmp(textmode, "0") != 0)
+   return (text_autoresize());
 
gop = NULL;
uga = NULL;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331472 - head/sys/dev/cxgbe

2018-03-23 Thread Navdeep Parhar
Author: np
Date: Sat Mar 24 01:07:58 2018
New Revision: 331472
URL: https://svnweb.freebsd.org/changeset/base/331472

Log:
  cxgbe(4): Always initialize requested_speed to a valid value.
  
  This fixes an avoidable EINVAL when the user tries to disable AN after
  the port is initialized but l1cfg doesn't have a valid speed to use.
  
  MFC after:1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cSat Mar 24 00:26:42 2018
(r331471)
+++ head/sys/dev/cxgbe/t4_main.cSat Mar 24 01:07:58 2018
(r331472)
@@ -3981,12 +3981,11 @@ init_l1cfg(struct port_info *pi)
 
ASSERT_SYNCHRONIZED_OP(sc);
 
+   lc->requested_speed = port_top_speed(pi);   /* in Gbps */
if (t4_autoneg != 0 && lc->supported & FW_PORT_CAP_ANEG) {
lc->requested_aneg = AUTONEG_ENABLE;
-   lc->requested_speed = 0;
} else {
lc->requested_aneg = AUTONEG_DISABLE;
-   lc->requested_speed = port_top_speed(pi);   /* in Gbps */
}
 
lc->requested_fc = t4_pause_settings & (PAUSE_TX | PAUSE_RX);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331470 - head/stand/defaults

2018-03-23 Thread Kyle Evans
Author: kevans
Date: Fri Mar 23 23:46:59 2018
New Revision: 331470
URL: https://svnweb.freebsd.org/changeset/base/331470

Log:
  loader.conf(5): Convert list of values to much better looking  table format
  
  Discussed with:   jhb, rpokala

Modified:
  head/stand/defaults/loader.conf.5

Modified: head/stand/defaults/loader.conf.5
==
--- head/stand/defaults/loader.conf.5   Fri Mar 23 23:02:50 2018
(r331469)
+++ head/stand/defaults/loader.conf.5   Fri Mar 23 23:46:59 2018
(r331470)
@@ -222,11 +222,17 @@ replacing it with
 character (useful for embedded products and such).
 .It Va efi_max_resolution
 Specify the maximum desired resolution for the EFI console.
-The following pre-defined values are accepted: 480p, 720p, 1080p, 2160p or 4k,
-5k.
-The standard
-.Va WidthxHeight
-format is also accepted, e.g., 1920x1080.
+The following values are accepted:
+.Bl -column "WidthxHeight"
+.It Sy Value Ta Sy Resolution
+.It 480p Ta 640x480
+.It 720p Ta 1280x720
+.It 1080p Ta 1920x1080
+.It 2160p Ta 3840x2160
+.It 4k Ta 3840x2160
+.It 5k Ta 5120x2880
+.It Va Width Ns x Ns Va Height Ta Va Width Ns x Ns Va Height
+.El
 .It Va kernel
 .Pq Dq kernel
 .It Va kernels
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331469 - head/stand/defaults

2018-03-23 Thread Kyle Evans
Author: kevans
Date: Fri Mar 23 23:02:50 2018
New Revision: 331469
URL: https://svnweb.freebsd.org/changeset/base/331469

Log:
  loader.conf(5): Document efi_max_resolution

Modified:
  head/stand/defaults/loader.conf.5

Modified: head/stand/defaults/loader.conf.5
==
--- head/stand/defaults/loader.conf.5   Fri Mar 23 22:59:45 2018
(r331468)
+++ head/stand/defaults/loader.conf.5   Fri Mar 23 23:02:50 2018
(r331469)
@@ -23,7 +23,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" $FreeBSD$
-.Dd March 19, 2018
+.Dd March 23, 2018
 .Dt LOADER.CONF 5
 .Os
 .Sh NAME
@@ -220,6 +220,13 @@ selects the video console which prevents any input and
 replacing it with
 .Dq spinning
 character (useful for embedded products and such).
+.It Va efi_max_resolution
+Specify the maximum desired resolution for the EFI console.
+The following pre-defined values are accepted: 480p, 720p, 1080p, 2160p or 4k,
+5k.
+The standard
+.Va WidthxHeight
+format is also accepted, e.g., 1920x1080.
 .It Va kernel
 .Pq Dq kernel
 .It Va kernels
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331468 - head/usr.sbin/makefs/cd9660

2018-03-23 Thread Benno Rice
Author: benno
Date: Fri Mar 23 22:59:45 2018
New Revision: 331468
URL: https://svnweb.freebsd.org/changeset/base/331468

Log:
  Don't try to modify El Torito section headers if there aren't any.
  
  MFC after:1 week

Modified:
  head/usr.sbin/makefs/cd9660/cd9660_eltorito.c

Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c
==
--- head/usr.sbin/makefs/cd9660/cd9660_eltorito.c   Fri Mar 23 22:52:26 
2018(r331467)
+++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c   Fri Mar 23 22:59:45 
2018(r331468)
@@ -468,11 +468,14 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int fir
}
 
/* Find the last Section Header entry and mark it as the last. */
+   head = NULL;
LIST_FOREACH(next, >boot_entries, ll_struct) {
if (next->entry_type == ET_ENTRY_SH)
head = next;
}
-   head->entry_data.SH.header_indicator[0] = ET_SECTION_HEADER_LAST;
+   if (head != NULL)
+   head->entry_data.SH.header_indicator[0] =
+   ET_SECTION_HEADER_LAST;
 
/* TODO: Remaining boot disks when implemented */
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331467 - head/usr.sbin/makefs/cd9660

2018-03-23 Thread Benno Rice
Author: benno
Date: Fri Mar 23 22:52:26 2018
New Revision: 331467
URL: https://svnweb.freebsd.org/changeset/base/331467

Log:
  Correctly mark the last El Torito section header.
  
  Reported by:  Thomas Schmitt 
  Reviewed by:  emaste, imp
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D14812

Modified:
  head/usr.sbin/makefs/cd9660/cd9660_eltorito.c

Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c
==
--- head/usr.sbin/makefs/cd9660/cd9660_eltorito.c   Fri Mar 23 22:36:24 
2018(r331466)
+++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c   Fri Mar 23 22:52:26 
2018(r331467)
@@ -294,7 +294,10 @@ cd9660_boot_setup_section_head(char platform)
return NULL;
 
sh = >entry_data.SH;
-   /* More by default. The last one will manually be set to 0x91 */
+   /*
+* More by default.
+* The last one will manually be set to ET_SECTION_HEADER_LAST
+*/
sh->header_indicator[0] = ET_SECTION_HEADER_MORE;
sh->platform_id[0] = platform;
sh->num_section_entries[0] = 0;
@@ -463,6 +466,13 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int fir
LIST_INSERT_AFTER(head, temp, ll_struct);
tmp_disk = TAILQ_NEXT(tmp_disk, image_list);
}
+
+   /* Find the last Section Header entry and mark it as the last. */
+   LIST_FOREACH(next, >boot_entries, ll_struct) {
+   if (next->entry_type == ET_ENTRY_SH)
+   head = next;
+   }
+   head->entry_data.SH.header_indicator[0] = ET_SECTION_HEADER_LAST;
 
/* TODO: Remaining boot disks when implemented */
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331466 - head/sys/x86/x86

2018-03-23 Thread John Baldwin
Author: jhb
Date: Fri Mar 23 22:36:24 2018
New Revision: 331466
URL: https://svnweb.freebsd.org/changeset/base/331466

Log:
  Add a workaround to the hypervisor detection for older versions of KVM.
  
  Originally KVM set %eax to 0 in the cpuid leaf 0x400 rather than
  to the highest supported leaf in the hypervisor "branch".  Detect this
  case and fixup the %eax value so that the hypervisor is still
  detected.
  
  Reported by:  jpaetzel
  Reviewed by:  kib
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D14810

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

Modified: head/sys/x86/x86/identcpu.c
==
--- head/sys/x86/x86/identcpu.c Fri Mar 23 21:06:06 2018(r331465)
+++ head/sys/x86/x86/identcpu.c Fri Mar 23 22:36:24 2018(r331466)
@@ -1304,6 +1304,18 @@ identify_hypervisor(void)
if (cpu_feature2 & CPUID2_HV) {
vm_guest = VM_GUEST_VM;
do_cpuid(0x4000, regs);
+
+   /*
+* KVM from Linux kernels prior to commit
+* 57c22e5f35aa4b9b2fe11f73f3e62bbf9ef36190 set %eax
+* to 0 rather than a valid hv_high value.  Check for
+* the KVM signature bytes and fixup %eax to the
+* highest supported leaf in that case.
+*/
+   if (regs[0] == 0 && regs[1] == 0x4b4d564b &&
+   regs[2] == 0x564b4d56 && regs[3] == 0x004d)
+   regs[0] = 0x4001;
+   
if (regs[0] >= 0x4000) {
hv_high = regs[0];
((u_int *)_vendor)[0] = regs[1];
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331464 - in head/stand: defaults efi/loader

2018-03-23 Thread Kyle Evans
Author: kevans
Date: Fri Mar 23 21:02:46 2018
New Revision: 331464
URL: https://svnweb.freebsd.org/changeset/base/331464

Log:
  efi loader: Respect efi_max_resolution in loader.conf(5)
  
  Default the max resolution to 1080p, we'll accept Width x Height
  specifications along with the following presets:
  
  - 480p
  - 720p
  - 1080p
  - 2160p or 4k
  - 5k
  
  PR:   224825
  Differential Revision:https://reviews.freebsd.org/D14801

Modified:
  head/stand/defaults/loader.conf
  head/stand/efi/loader/framebuffer.c

Modified: head/stand/defaults/loader.conf
==
--- head/stand/defaults/loader.conf Fri Mar 23 20:56:18 2018
(r331463)
+++ head/stand/defaults/loader.conf Fri Mar 23 21:02:46 2018
(r331464)
@@ -75,6 +75,9 @@ acpi_video_load="NO"  # Load the ACPI video extension 
 #geom_eli_passphrase_prompt="NO" # Prompt for geli(8) passphrase to mount root
 bootenv_autolist="YES" # Auto populate the list of ZFS Boot 
Environments
 #beastie_disable="NO"  # Turn the beastie boot menu on and off
+efi_max_resolution="1080p" # Set the max resolution for EFI loader to use:
+   # 480p, 720p, 1080p, 2160p/4k, 5k, or specify
+   # WidthxHeight (e.g. 1920x1080)
 #kernels="kernel kernel.old"   # Kernels to display in the boot menu
 #loader_logo="orbbw"   # Desired logo: orbbw, orb, fbsdbw, beastiebw, 
beastie, none
 #comconsole_speed="9600"   # Set the current serial console speed

Modified: head/stand/efi/loader/framebuffer.c
==
--- head/stand/efi/loader/framebuffer.c Fri Mar 23 20:56:18 2018
(r331463)
+++ head/stand/efi/loader/framebuffer.c Fri Mar 23 21:02:46 2018
(r331464)
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -45,6 +46,40 @@ static EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCO
 static EFI_GUID pciio_guid = EFI_PCI_IO_PROTOCOL_GUID;
 static EFI_GUID uga_guid = EFI_UGA_DRAW_PROTOCOL_GUID;
 
+static struct named_resolution {
+   const char *name;
+   const char *alias;
+   unsigned int width;
+   unsigned int height;
+} resolutions[] = {
+   {
+   .name = "480p",
+   .width = 640,
+   .height = 480,
+   },
+   {
+   .name = "720p",
+   .width = 1280,
+   .height = 720,
+   },
+   {
+   .name = "1080p",
+   .width = 1920,
+   .height = 1080,
+   },
+   {
+   .name = "2160p",
+   .alias = "4k",
+   .width = 3840,
+   .height = 2160,
+   },
+   {
+   .name = "5k",
+   .width = 5120,
+   .height = 2880,
+   }
+};
+
 static u_int
 efifb_color_depth(struct efi_fb *efifb)
 {
@@ -462,6 +497,57 @@ print_efifb(int mode, struct efi_fb *efifb, int verbos
}
 }
 
+static bool
+efi_resolution_compare(struct named_resolution *res, const char *cmp)
+{
+
+   if (strcasecmp(res->name, cmp) == 0)
+   return (true);
+   if (res->alias != NULL && strcasecmp(res->alias, cmp) == 0)
+   return (true);
+   return (false);
+}
+
+
+static void
+efi_get_max_resolution(int *width, int *height)
+{
+   struct named_resolution *res;
+   char *maxres;
+   char *height_start, *width_start;
+   int idx;
+
+   *width = *height = 0;
+   maxres = getenv("efi_max_resolution");
+   /* No max_resolution set? Bail out; choose highest resolution */
+   if (maxres == NULL)
+   return;
+   /* See if it matches one of our known resolutions */
+   for (idx = 0; idx < nitems(resolutions); ++idx) {
+   res = [idx];
+   if (efi_resolution_compare(res, maxres)) {
+   *width = res->width;
+   *height = res->height;
+   return;
+   }
+   }
+   /* Not a known resolution, try to parse it; make a copy we can modify */
+   maxres = strdup(maxres);
+   if (maxres == NULL)
+   return;
+   height_start = strchr(maxres, 'x');
+   if (height_start == NULL) {
+   free(maxres);
+   return;
+   }
+   width_start = maxres;
+   *height_start++ = 0;
+   /* Errors from this will effectively mean "no max" */
+   *width = (int)strtol(width_start, NULL, 0);
+   *height = (int)strtol(height_start, NULL, 0);
+   free(maxres);
+}
+
 static int
 gop_autoresize(EFI_GRAPHICS_OUTPUT *gop)
 {
@@ -470,16 +556,22 @@ gop_autoresize(EFI_GRAPHICS_OUTPUT *gop)
EFI_STATUS status;
UINTN infosz;
UINT32 best_mode, currdim, maxdim, mode;
+   int height, max_height, max_width, width;
 
best_mode 

svn commit: r331463 - in head: release/amd64 usr.sbin/makefs/cd9660

2018-03-23 Thread Benno Rice
Author: benno
Date: Fri Mar 23 20:56:18 2018
New Revision: 331463
URL: https://svnweb.freebsd.org/changeset/base/331463

Log:
  Allow makefs to properly tag UEFI El Torito boot images. Use them in amd64 
ISOs.
  
  UEFI booting requires an EFI System Partition (ESP). On most storage devices
  this will be in a specific partition type. To allow booting from CD/ISO
  filesystems, UEFI will look for an ESP in the form of a FAT filesystem image
  embedded in the image. Historically FreeBSD has added one of these to its
  amd64 ISO images but marked it as simply another i386 boot image. Luckily for
  us most UEFI implementations are rather forgiving and work this out for us.
  
  This change adds the ability to mark a boot image as being a UEFI image. It
  also modifies our ISO generation to use this marking for the UEFI image we
  embed.
  
  Reported by:  Thomas Schmitt 
  Reviewed by:  emaste, imp
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D14809

Modified:
  head/release/amd64/mkisoimages.sh
  head/usr.sbin/makefs/cd9660/cd9660_eltorito.c
  head/usr.sbin/makefs/cd9660/cd9660_eltorito.h

Modified: head/release/amd64/mkisoimages.sh
==
--- head/release/amd64/mkisoimages.sh   Fri Mar 23 20:32:54 2018
(r331462)
+++ head/release/amd64/mkisoimages.sh   Fri Mar 23 20:56:18 2018
(r331463)
@@ -38,7 +38,7 @@ if [ "$1" = "-b" ]; then
umount efi
rmdir efi
mdconfig -d -u $device
-   bootable="-o bootimage=i386;efiboot.img -o no-emul-boot $bootable"
+   bootable="-o bootimage=efi;efiboot.img -o no-emul-boot $bootable"

shift
 else

Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c
==
--- head/usr.sbin/makefs/cd9660/cd9660_eltorito.c   Fri Mar 23 20:32:54 
2018(r331462)
+++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c   Fri Mar 23 20:56:18 
2018(r331463)
@@ -104,9 +104,12 @@ cd9660_add_boot_disk(iso9660_disk *diskStructure, cons
else if (strcmp(sysname, "macppc") == 0 ||
 strcmp(sysname, "mac68k") == 0)
new_image->system = ET_SYS_MAC;
+   else if (strcmp(sysname, "efi") == 0 ||
+strcmp(sysname, "uefi") == 0)
+   new_image->system = ET_SYS_UEFI;
else {
warnx("boot disk system must be "
- "i386, powerpc, macppc, or mac68k");
+ "efi, i386, powerpc, macppc, mac68k");
free(temp);
free(new_image);
return 0;
@@ -338,12 +341,12 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int fir
int used_sectors;
int num_entries = 0;
int catalog_sectors;
-   struct boot_catalog_entry *x86_head, *mac_head, *ppc_head,
+   struct boot_catalog_entry *x86_head, *mac_head, *ppc_head, *uefi_head,
*valid_entry, *default_entry, *temp, *head, **headp, *next;
struct cd9660_boot_image *tmp_disk;
 
headp = NULL;
-   x86_head = mac_head = ppc_head = NULL;
+   x86_head = mac_head = ppc_head = uefi_head = NULL;
 
/* If there are no boot disks, don't bother building boot information */
if (TAILQ_EMPTY(>boot_images))
@@ -421,6 +424,9 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int fir
break;
case ET_SYS_MAC:
headp = _head;
+   break;
+   case ET_SYS_UEFI:
+   headp = _head;
break;
default:
warnx("%s: internal error: unknown system type",

Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.h
==
--- head/usr.sbin/makefs/cd9660/cd9660_eltorito.h   Fri Mar 23 20:32:54 
2018(r331462)
+++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.h   Fri Mar 23 20:56:18 
2018(r331463)
@@ -44,6 +44,7 @@
 #defineET_SYS_X86  0
 #defineET_SYS_PPC  1
 #defineET_SYS_MAC  2
+#defineET_SYS_UEFI 0xef
 
 #define ET_BOOT_ENTRY_SIZE 0x20
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331462 - in head/sys: amd64/linux amd64/linux32 i386/linux

2018-03-23 Thread Ed Maste
Author: emaste
Date: Fri Mar 23 20:32:54 2018
New Revision: 331462
URL: https://svnweb.freebsd.org/changeset/base/331462

Log:
  Remove redundant cast from Linuxulator SYSINITs

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

Modified: head/sys/amd64/linux/linux_sysvec.c
==
--- head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 20:29:34 2018
(r331461)
+++ head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 20:32:54 2018
(r331462)
@@ -810,7 +810,7 @@ linux_vdso_install(void *param)
(linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base);
 }
 SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY,
-(sysinit_cfunc_t)linux_vdso_install, NULL);
+linux_vdso_install, NULL);
 
 static void
 linux_vdso_deinstall(void *param)
@@ -819,7 +819,7 @@ linux_vdso_deinstall(void *param)
__elfN(linux_shared_page_fini)(linux_shared_page_obj);
 }
 SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST,
-(sysinit_cfunc_t)linux_vdso_deinstall, NULL);
+linux_vdso_deinstall, NULL);
 
 static char GNULINUX_ABI_VENDOR[] = "GNU";
 static int GNULINUX_ABI_DESC = 0;

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 20:29:34 2018
(r331461)
+++ head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 20:32:54 2018
(r331462)
@@ -1008,7 +1008,7 @@ linux_vdso_install(void *param)
(linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base);
 }
 SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY,
-(sysinit_cfunc_t)linux_vdso_install, NULL);
+linux_vdso_install, NULL);
 
 static void
 linux_vdso_deinstall(void *param)
@@ -1017,7 +1017,7 @@ linux_vdso_deinstall(void *param)
__elfN(linux_shared_page_fini)(linux_shared_page_obj);
 }
 SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST,
-(sysinit_cfunc_t)linux_vdso_deinstall, NULL);
+linux_vdso_deinstall, NULL);
 
 static char GNU_ABI_VENDOR[] = "GNU";
 static int GNULINUX_ABI_DESC = 0;

Modified: head/sys/i386/linux/linux_sysvec.c
==
--- head/sys/i386/linux/linux_sysvec.c  Fri Mar 23 20:29:34 2018
(r331461)
+++ head/sys/i386/linux/linux_sysvec.c  Fri Mar 23 20:32:54 2018
(r331462)
@@ -983,7 +983,7 @@ linux_vdso_install(void *param)
elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj;
 }
 SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY,
-(sysinit_cfunc_t)linux_vdso_install, NULL);
+linux_vdso_install, NULL);
 
 static void
 linux_vdso_deinstall(void *param)
@@ -992,7 +992,7 @@ linux_vdso_deinstall(void *param)
__elfN(linux_shared_page_fini)(linux_shared_page_obj);
 }
 SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST,
-(sysinit_cfunc_t)linux_vdso_deinstall, NULL);
+linux_vdso_deinstall, NULL);
 
 static char GNU_ABI_VENDOR[] = "GNU";
 static int GNULINUX_ABI_DESC = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331459 - in head/sys: mips/include sys

2018-03-23 Thread John Baldwin
Author: jhb
Date: Fri Mar 23 19:31:52 2018
New Revision: 331459
URL: https://svnweb.freebsd.org/changeset/base/331459

Log:
  Move remaining EF_MIPS_* flags to .
  
  Reviewed by:  brooks
  Sponsored by: DARPA / AFRL
  Differential Revision:https://reviews.freebsd.org/D14789

Modified:
  head/sys/mips/include/elf.h
  head/sys/sys/elf_common.h

Modified: head/sys/mips/include/elf.h
==
--- head/sys/mips/include/elf.h Fri Mar 23 19:30:00 2018(r331458)
+++ head/sys/mips/include/elf.h Fri Mar 23 19:31:52 2018(r331459)
@@ -243,24 +243,4 @@ __ElfType(Auxinfo);
 #defineR_MIPS_COPY 126
 #defineR_MIPS_JUMP_SLOT127
 
-/*
- * ELF Flags
- */
-
-#defineEF_MIPS_ARCH_1  0x  /* -mips1 code */
-#defineEF_MIPS_ARCH_2  0x1000  /* -mips2 code */
-#defineEF_MIPS_ARCH_3  0x2000  /* -mips3 code */
-#defineEF_MIPS_ARCH_4  0x3000  /* -mips4 code */
-#defineEF_MIPS_ARCH_5  0x4000  /* -mips5 code */
-#defineEF_MIPS_ARCH_32 0x5000  /* -mips32 code */
-#defineEF_MIPS_ARCH_64 0x6000  /* -mips64 code */
-#defineEF_MIPS_ARCH_32R2   0x7000  /* -mips32r2 code */
-#defineEF_MIPS_ARCH_64R2   0x8000  /* -mips64r2 code */
-
-#defineEF_MIPS_ABI 0xf000
-#defineEF_MIPS_ABI_O32 0x1000
-#defineEF_MIPS_ABI_O64 0x2000
-#defineEF_MIPS_ABI_EABI32  0x3000
-#defineEF_MIPS_ABI_EABI64  0x4000
-
 #endif /* __MIPS_ELF_H */

Modified: head/sys/sys/elf_common.h
==
--- head/sys/sys/elf_common.h   Fri Mar 23 19:30:00 2018(r331458)
+++ head/sys/sys/elf_common.h   Fri Mar 23 19:31:52 2018(r331459)
@@ -344,10 +344,24 @@ typedef struct {
 #defineEF_MIPS_UCODE   0x0010
 #defineEF_MIPS_ABI20x0020  /* N32 */
 #defineEF_MIPS_OPTIONS_FIRST   0x0080
+#defineEF_MIPS_ABI 0xF000
+#defineEF_MIPS_ABI_O32 0x1000
+#defineEF_MIPS_ABI_O64 0x2000
+#defineEF_MIPS_ABI_EABI32  0x3000
+#defineEF_MIPS_ABI_EABI64  0x4000
 #defineEF_MIPS_ARCH_ASE0x0F00  /* Architectural 
extensions */
 #defineEF_MIPS_ARCH_ASE_MDMX   0x0800  /* MDMX multimedia 
extension */
 #defineEF_MIPS_ARCH_ASE_M160x0400  /* MIPS-16 ISA 
extensions */
 #defineEF_MIPS_ARCH0xF000  /* Architecture field */
+#defineEF_MIPS_ARCH_1  0x  /* -mips1 code */
+#defineEF_MIPS_ARCH_2  0x1000  /* -mips2 code */
+#defineEF_MIPS_ARCH_3  0x2000  /* -mips3 code */
+#defineEF_MIPS_ARCH_4  0x3000  /* -mips4 code */
+#defineEF_MIPS_ARCH_5  0x4000  /* -mips5 code */
+#defineEF_MIPS_ARCH_32 0x5000  /* -mips32 code */
+#defineEF_MIPS_ARCH_64 0x6000  /* -mips64 code */
+#defineEF_MIPS_ARCH_32R2   0x7000  /* -mips32r2 code */
+#defineEF_MIPS_ARCH_64R2   0x8000  /* -mips64r2 code */
 
 #defineEF_PPC_EMB  0x8000
 #defineEF_PPC_RELOCATABLE  0x0001
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331456 - head/sys/dev/mlx5/mlx5_en

2018-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar 23 18:38:12 2018
New Revision: 331456
URL: https://svnweb.freebsd.org/changeset/base/331456

Log:
  Don't wait for completions when a mlx5en(4) device is in internal
  error state.
  
  If the device is in internal error state the hardware will not
  generate completions. Just move on to destroy the resources.
  
  Submitted by: slavash@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cFri Mar 23 18:35:59 2018
(r331455)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cFri Mar 23 18:38:12 2018
(r331456)
@@ -907,8 +907,7 @@ mlx5e_destroy_rq(struct mlx5e_rq *rq)
wq_sz = mlx5_wq_ll_get_size(>wq);
for (i = 0; i != wq_sz; i++) {
if (rq->mbuf[i].mbuf != NULL) {
-   bus_dmamap_unload(rq->dma_tag,
-   rq->mbuf[i].dma_map);
+   bus_dmamap_unload(rq->dma_tag, rq->mbuf[i].dma_map);
m_freem(rq->mbuf[i].mbuf);
}
bus_dmamap_destroy(rq->dma_tag, rq->mbuf[i].dma_map);
@@ -1064,8 +1063,11 @@ mlx5e_close_rq(struct mlx5e_rq *rq)
 static void
 mlx5e_close_rq_wait(struct mlx5e_rq *rq)
 {
+   struct mlx5_core_dev *mdev = rq->channel->priv->mdev;
+
/* wait till RQ is empty */
-   while (!mlx5_wq_ll_is_empty(>wq)) {
+   while (!mlx5_wq_ll_is_empty(>wq) &&
+  (mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR)) {
msleep(4);
rq->cq.mcq.comp(>cq.mcq);
}
@@ -1404,6 +1406,7 @@ void
 mlx5e_drain_sq(struct mlx5e_sq *sq)
 {
int error;
+   struct mlx5_core_dev *mdev= sq->priv->mdev;
 
/*
 * Check if already stopped.
@@ -1436,7 +1439,8 @@ mlx5e_drain_sq(struct mlx5e_sq *sq)
/* wait till SQ is empty or link is down */
mtx_lock(>lock);
while (sq->cc != sq->pc &&
-   (sq->priv->media_status_last & IFM_ACTIVE) != 0) {
+   (sq->priv->media_status_last & IFM_ACTIVE) != 0 &&
+   mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) {
mtx_unlock(>lock);
msleep(1);
sq->cq.mcq.comp(>cq.mcq);
@@ -1453,7 +1457,8 @@ mlx5e_drain_sq(struct mlx5e_sq *sq)
 
/* wait till SQ is empty */
mtx_lock(>lock);
-   while (sq->cc != sq->pc) {
+   while (sq->cc != sq->pc &&
+  mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) {
mtx_unlock(>lock);
msleep(1);
sq->cq.mcq.comp(>cq.mcq);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331455 - head/sys/dev/mlx5/mlx5_core

2018-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar 23 18:35:59 2018
New Revision: 331455
URL: https://svnweb.freebsd.org/changeset/base/331455

Log:
  Fix incorrect page count when mlx5core is in internal error.
  
  Change page cleanup flow when in internal error to properly decrement
  the page counts when reclaiming pages. That prevents timing out
  waiting for extra pages that were actually cleaned up previously.
  
  Submitted by: slavash@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.cFri Mar 23 18:34:38 
2018(r331454)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.cFri Mar 23 18:35:59 
2018(r331455)
@@ -380,6 +380,37 @@ out_free:
return err;
 }
 
+static int reclaim_pages_cmd(struct mlx5_core_dev *dev,
+u32 *in, int in_size, u32 *out, int out_size)
+{
+   struct mlx5_fw_page *fwp;
+   struct rb_node *p;
+   u32 func_id;
+   u32 npages;
+   u32 i = 0;
+
+   if (dev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR)
+   return mlx5_cmd_exec(dev, in, in_size, out, out_size);
+
+   /* No hard feelings, we want our pages back! */
+   npages = MLX5_GET(manage_pages_in, in, input_num_entries);
+   func_id = MLX5_GET(manage_pages_in, in, function_id);
+
+   p = rb_first(>priv.page_root);
+   while (p && i < npages) {
+   fwp = rb_entry(p, struct mlx5_fw_page, rb_node);
+   p = rb_next(p);
+   if (fwp->func_id != func_id)
+   continue;
+
+   MLX5_ARRAY_SET64(manage_pages_out, out, pas, i, fwp->dma_addr);
+   i++;
+   }
+
+   MLX5_SET(manage_pages_out, out, output_num_entries, i);
+   return 0;
+}
+
 static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages,
 int *nclaimed)
 {
@@ -404,7 +435,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u3
MLX5_SET(manage_pages_in, in, input_num_entries, npages);
 
mlx5_core_dbg(dev, "npages %d, outlen %d\n", npages, outlen);
-   err = mlx5_cmd_exec(dev, in, sizeof(in), out, outlen);
+   err = reclaim_pages_cmd(dev, in, sizeof(in), out, outlen);
if (err) {
mlx5_core_err(dev, "failed reclaiming pages\n");
goto out_free;
@@ -531,19 +562,13 @@ int mlx5_reclaim_startup_pages(struct mlx5_core_dev *d
p = rb_first(>priv.page_root);
if (p) {
fwp = rb_entry(p, struct mlx5_fw_page, rb_node);
-   if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
-   --dev->priv.fw_pages;
-   free_4k(dev, fwp->dma_addr);
-   nclaimed = 1;
-   } else {
-   err = reclaim_pages(dev, fwp->func_id,
-   optimal_reclaimed_pages(),
-   );
-   if (err) {
-   mlx5_core_warn(dev, "failed reclaiming 
pages (%d)\n",
-  err);
-   return err;
-   }
+   err = reclaim_pages(dev, fwp->func_id,
+   optimal_reclaimed_pages(),
+   );
+   if (err) {
+   mlx5_core_warn(dev, "failed reclaiming pages 
(%d)\n",
+  err);
+   return err;
}
 
if (nclaimed)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2018-03-23 Thread Sean Bruno
Author: sbruno
Date: Fri Mar 23 18:34:38 2018
New Revision: 331454
URL: https://svnweb.freebsd.org/changeset/base/331454

Log:
  Revert r331379 as the "simple" lock changes have revealed a deeper problem
  and need for a rethink.
  
  Submitted by: Jason Eggleston 
  Sponsored by: Limelight Networks

Modified:
  head/sys/netinet/ip_output.c
  head/sys/netinet/raw_ip.c
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cFri Mar 23 18:34:35 2018
(r331453)
+++ head/sys/netinet/ip_output.cFri Mar 23 18:34:38 2018
(r331454)
@@ -1314,14 +1314,12 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt)
break;
 
case IP_PORTRANGE:
-   INP_RLOCK(inp);
if (inp->inp_flags & INP_HIGHPORT)
optval = IP_PORTRANGE_HIGH;
else if (inp->inp_flags & INP_LOWPORT)
optval = IP_PORTRANGE_LOW;
else
optval = 0;
-   INP_RUNLOCK(inp);
break;
 
case IP_ONESBCAST:
@@ -1347,11 +1345,9 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt)
break;
 #ifdef RSS
case IP_RSSBUCKETID:
-   INP_RLOCK(inp);
retval = rss_hash2bucket(inp->inp_flowid,
inp->inp_flowtype,
_bucket);
-   INP_RUNLOCK(inp);
if (retval == 0)
optval = rss_bucket;
else

Modified: head/sys/netinet/raw_ip.c
==
--- head/sys/netinet/raw_ip.c   Fri Mar 23 18:34:35 2018(r331453)
+++ head/sys/netinet/raw_ip.c   Fri Mar 23 18:34:38 2018(r331454)
@@ -639,12 +639,10 @@ rip_ctloutput(struct socket *so, struct sockopt *sopt)
sizeof optval);
if (error)
break;
-   INP_WLOCK(inp);
if (optval)
inp->inp_flags |= INP_HDRINCL;
else
inp->inp_flags &= ~INP_HDRINCL;
-   INP_WUNLOCK(inp);
break;
 
case IP_FW3:/* generic ipfw v.3 functions */

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Fri Mar 23 18:34:35 2018
(r331453)
+++ head/sys/netinet6/ip6_output.c  Fri Mar 23 18:34:38 2018
(r331454)
@@ -1498,10 +1498,8 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt)
error = soopt_mcopyin(sopt, m); /* XXX */
if (error != 0)
break;
-   INP_WLOCK(in6p);
error = ip6_pcbopts(>in6p_outputopts,
m, so, sopt);
-   INP_WUNLOCK(in6p);
m_freem(m); /* XXX */
break;
}
@@ -1637,13 +1635,11 @@ do {
\
error = EINVAL;
break;
}
-   INP_WLOCK(in6p);
optp = >in6p_outputopts;
error = ip6_pcbopt(IPV6_HOPLIMIT,
(u_char *), sizeof(optval),
optp, (td != NULL) ? td->td_ucred :
NULL, uproto);
-   INP_WUNLOCK(in6p);
break;
}
 
@@ -1694,10 +1690,8 @@ do { 
\
 * available only prior to bind(2).
 * see ipng mailing list, Jun 22 2001.
 */
-   INP_WLOCK(in6p);
if (in6p->inp_lport ||
  

svn commit: r331453 - head/sys/dev/mlx5/mlx5_core

2018-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar 23 18:34:35 2018
New Revision: 331453
URL: https://svnweb.freebsd.org/changeset/base/331453

Log:
  Don't save PCI state when PCI error is detected in mlx5core.
  
  When a PCI error is detected the PCI state could be corrupt, don't
  save it in that flow. Save the state after initialization. After
  restoring the PCI state during slot reset save it again, restoring
  the state destroys the previously saved state info.
  
  Submitted by: slavash@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:32:03 2018
(r331452)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:34:35 2018
(r331453)
@@ -1224,6 +1224,7 @@ static int init_one(struct pci_dev *pdev,
goto clean_health;
}
 
+   pci_save_state(pdev->dev.bsddev);
return 0;
 
 clean_health:
@@ -1264,7 +1265,6 @@ static pci_ers_result_t mlx5_pci_err_detected(struct p
mlx5_enter_error_state(dev, false);
mlx5_unload_one(dev, priv, false);
if (state) {
-   pci_save_state(pdev->dev.bsddev);
mlx5_drain_health_wq(dev);
mlx5_pci_disable_device(dev);
}
@@ -1289,6 +1289,7 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci
pci_set_master(pdev);
pci_set_powerstate(pdev->dev.bsddev, PCI_POWERSTATE_D0);
pci_restore_state(pdev->dev.bsddev);
+   pci_save_state(pdev->dev.bsddev);
 
return err ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED;
 }
@@ -1343,7 +1344,6 @@ static void mlx5_pci_resume(struct pci_dev *pdev)
 
dev_info(>dev, "%s was called\n", __func__);
 
-   pci_save_state(pdev->dev.bsddev);
wait_vital(pdev);
 
err = mlx5_load_one(dev, priv, false);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331452 - in head/sys: conf dev/mlx5 dev/mlx5/mlx5_core modules/mlx5

2018-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar 23 18:32:03 2018
New Revision: 331452
URL: https://svnweb.freebsd.org/changeset/base/331452

Log:
  Add mutual exclusion mechanism for software reset of firmware in mlx5core.
  
  Since the FW can be shared between PCI functions it is common that
  more than one health poll will detected a failure, this can lead to
  multiple resets.
  
  The solution is to use a FW locking mechanism using semaphore space to
  provide a way to synchronize between functions. The FW semaphore is
  acquired via config cycle access. First the VSEC gateway must be
  acquired, then the semaphore can be locked by writing a value to it
  and confirmed it's locked by reading the same value back. The process
  in the same to free the semaphore, except the value written should be
  zero.
  
  Submitted by: slavash@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Added:
  head/sys/dev/mlx5/mlx5_core/mlx5_crspace.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_core.h
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c
  head/sys/modules/mlx5/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Fri Mar 23 18:24:09 2018(r331451)
+++ head/sys/conf/files Fri Mar 23 18:32:03 2018(r331452)
@@ -4732,6 +4732,8 @@ dev/mlx5/mlx5_core/mlx5_cmd.c 
optional mlx5 pci   \
compile-with "${OFED_C}"
 dev/mlx5/mlx5_core/mlx5_cq.c   optional mlx5 pci   \
compile-with "${OFED_C}"
+dev/mlx5/mlx5_core/mlx5_crspace.c  optional mlx5 pci   \
+   compile-with "${OFED_C}"
 dev/mlx5/mlx5_core/mlx5_diagnostics.c  optional mlx5 pci   \
compile-with "${OFED_C}"
 dev/mlx5/mlx5_core/mlx5_eq.c   optional mlx5 pci   \

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Fri Mar 23 18:24:09 2018(r331451)
+++ head/sys/dev/mlx5/driver.h  Fri Mar 23 18:32:03 2018(r331452)
@@ -651,6 +651,7 @@ struct mlx5_core_dev {
struct mlx5_flow_root_namespace *sniffer_tx_root_ns;
u32 num_q_counter_allocated[MLX5_INTERFACE_NUMBER];
struct mlx5_dump_data   *dump_data;
+   u32 vsec_addr;
 };
 
 enum {

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 18:24:09 2018
(r331451)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 18:32:03 2018
(r331452)
@@ -64,6 +64,16 @@ enum {
MLX5_CMD_TIME, /* print command execution time */
 };
 
+enum mlx5_semaphore_space_address {
+   MLX5_SEMAPHORE_SW_RESET = 0x20,
+};
+
+enum {
+   UNLOCK = 0,
+   LOCK = 1,
+   CAP_ID = 0x9,
+};
+
 struct mlx5_core_dev;
 
 int mlx5_query_hca_caps(struct mlx5_core_dev *dev);
@@ -95,4 +105,8 @@ struct mlx5_crspace_regmap {
 
 extern struct pci_driver mlx5_core_driver;
 
+void mlx5_vsec_init(struct mlx5_core_dev *dev);
+int mlx5_pciconf_cap9_sem(struct mlx5_core_dev *dev, int state);
+int mlx5_pciconf_set_sem_addr_space(struct mlx5_core_dev *dev,
+   u32 sem_space_address, int state);
 #endif /* __MLX5_CORE_H__ */

Added: head/sys/dev/mlx5/mlx5_core/mlx5_crspace.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_crspace.c  Fri Mar 23 18:32:03 2018
(r331452)
@@ -0,0 +1,248 @@
+/*-
+ * Copyright (c) 2013-2018, Mellanox Technologies, Ltd.  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 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 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 

svn commit: r331450 - head/sys/vm

2018-03-23 Thread Jeff Roberson
Author: jeff
Date: Fri Mar 23 18:24:02 2018
New Revision: 331450
URL: https://svnweb.freebsd.org/changeset/base/331450

Log:
  Fix two compliation problems on non-amd64 architectures.

Modified:
  head/sys/vm/vm_page.c
  head/sys/vm/vm_reserv.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Fri Mar 23 18:20:42 2018(r331449)
+++ head/sys/vm/vm_page.c   Fri Mar 23 18:24:02 2018(r331450)
@@ -1783,7 +1783,9 @@ again:
 */
KASSERT(m != NULL, ("missing page"));
 
+#if VM_NRESERVLEVEL > 0
 found:
+#endif
vm_page_alloc_check(m);
 
/*

Modified: head/sys/vm/vm_reserv.c
==
--- head/sys/vm/vm_reserv.c Fri Mar 23 18:20:42 2018(r331449)
+++ head/sys/vm/vm_reserv.c Fri Mar 23 18:24:02 2018(r331450)
@@ -419,7 +419,7 @@ vm_reserv_depopulate(vm_reserv_t rv, int index)
index));
KASSERT(rv->popcnt > 0,
("vm_reserv_depopulate: reserv %p's popcnt is corrupted", rv));
-   KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains,
+   KASSERT(rv->domain < vm_ndomains,
("vm_reserv_depopulate: reserv %p's domain is corrupted %d",
rv, rv->domain));
if (rv->popcnt == VM_LEVEL_0_NPAGES) {
@@ -531,7 +531,7 @@ vm_reserv_populate(vm_reserv_t rv, int index)
("vm_reserv_populate: reserv %p is already full", rv));
KASSERT(rv->pages->psind == 0,
("vm_reserv_populate: reserv %p is already promoted", rv));
-   KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains,
+   KASSERT(rv->domain < vm_ndomains,
("vm_reserv_populate: reserv %p's domain is corrupted %d",
rv, rv->domain));
popmap_set(rv->popmap, index);
@@ -1218,7 +1218,7 @@ vm_reserv_reclaim(vm_reserv_t rv)
vm_reserv_domain_lock(rv->domain);
KASSERT(rv->inpartpopq,
("vm_reserv_reclaim: reserv %p's inpartpopq is FALSE", rv));
-   KASSERT(rv->domain >= 0 && rv->domain < vm_ndomains,
+   KASSERT(rv->domain < vm_ndomains,
("vm_reserv_reclaim: reserv %p's domain is corrupted %d",
rv, rv->domain));
TAILQ_REMOVE(_rvq_partpop[rv->domain], rv, partpopq);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331451 - in head/sys/dev/mlx5: . mlx5_core

2018-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar 23 18:24:09 2018
New Revision: 331451
URL: https://svnweb.freebsd.org/changeset/base/331451

Log:
  Issue a software reset on firmware assert in mlx5core.
  
  If a FW assert is considered fatal, indicated by a new bit in the
  health buffer, reset the FW. After the reset, follow the normal
  recovery flow.
  
  Submitted by: slavash@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/device.h
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c

Modified: head/sys/dev/mlx5/device.h
==
--- head/sys/dev/mlx5/device.h  Fri Mar 23 18:24:02 2018(r331450)
+++ head/sys/dev/mlx5/device.h  Fri Mar 23 18:24:09 2018(r331451)
@@ -410,6 +410,10 @@ struct mlx5_cmd_layout {
u8  status_own;
 };
 
+enum mlx5_fatal_assert_bit_offsets {
+   MLX5_RFR_OFFSET = 31,
+};
+
 struct mlx5_health_buffer {
__be32  assert_var[5];
__be32  rsvd0[3];
@@ -418,10 +422,18 @@ struct mlx5_health_buffer {
__be32  rsvd1[2];
__be32  fw_ver;
__be32  hw_id;
-   __be32  rsvd2;
+   __be32  rfr;
u8  irisc_index;
u8  synd;
__be16  ext_synd;
+};
+
+enum mlx5_initializing_bit_offsets {
+   MLX5_FW_RESET_SUPPORTED_OFFSET = 30,
+};
+
+enum mlx5_cmd_addr_l_sz_offset {
+   MLX5_NIC_IFC_OFFSET = 8,
 };
 
 struct mlx5_init_seg {

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Fri Mar 23 18:24:02 2018
(r331450)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Fri Mar 23 18:24:09 2018
(r331451)
@@ -56,6 +56,7 @@ enum  {
MLX5_SENSOR_PCI_ERR = 2,
MLX5_SENSOR_NIC_DISABLED= 3,
MLX5_SENSOR_NIC_SW_RESET= 4,
+   MLX5_SENSOR_FW_SYND_RFR = 5,
 };
 
 static u8 get_nic_mode(struct mlx5_core_dev *dev)
@@ -63,6 +64,18 @@ static u8 get_nic_mode(struct mlx5_core_dev *dev)
return (ioread32be(>iseg->cmdq_addr_l_sz) >> 8) & 7;
 }
 
+static bool sensor_fw_synd_rfr(struct mlx5_core_dev *dev)
+{
+   struct mlx5_core_health *health = >priv.health;
+   struct mlx5_health_buffer __iomem *h = health->health;
+   u32 rfr = ioread32be(>rfr) >> MLX5_RFR_OFFSET;
+   u8 synd = ioread8(>synd);
+
+   if (rfr && synd)
+   mlx5_core_dbg(dev, "FW requests reset, synd: %d\n", synd);
+   return rfr && synd;
+}
+
 static void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev)
 {
unsigned long flags;
@@ -115,10 +128,44 @@ static u32 check_fatal_sensors(struct mlx5_core_dev *d
return MLX5_SENSOR_NIC_DISABLED;
if (sensor_nic_sw_reset(dev))
return MLX5_SENSOR_NIC_SW_RESET;
+   if (sensor_fw_synd_rfr(dev))
+   return MLX5_SENSOR_FW_SYND_RFR;
 
return MLX5_SENSOR_NO_ERR;
 }
 
+static void reset_fw_if_needed(struct mlx5_core_dev *dev)
+{
+   bool supported = (ioread32be(>iseg->initializing) >>
+ MLX5_FW_RESET_SUPPORTED_OFFSET) & 1;
+   u32 cmdq_addr, fatal_error;
+
+   if (!supported)
+   return;
+
+   /* The reset only needs to be issued by one PF. The health buffer is
+* shared between all functions, and will be cleared during a reset.
+* Check again to avoid a redundant 2nd reset. If the fatal erros was
+* PCI related a reset won't help.
+*/
+   fatal_error = check_fatal_sensors(dev);
+   if (fatal_error == MLX5_SENSOR_PCI_COMM_ERR ||
+   fatal_error == MLX5_SENSOR_NIC_DISABLED ||
+   fatal_error == MLX5_SENSOR_NIC_SW_RESET) {
+   mlx5_core_warn(dev, "Not issuing FW reset. Either it's already 
done or won't help.");
+   return;
+   }
+
+   mlx5_core_warn(dev, "Issuing FW Reset\n");
+   /* Write the NIC interface field to initiate the reset, the command
+* interface address also resides here, don't overwrite it.
+*/
+   cmdq_addr = ioread32be(>iseg->cmdq_addr_l_sz);
+   iowrite32be((cmdq_addr & 0xF000) |
+   MLX5_NIC_IFC_SW_RESET << MLX5_NIC_IFC_OFFSET,
+   >iseg->cmdq_addr_l_sz);
+}
+
 void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force)
 {
mutex_lock(>intf_state_mutex);
@@ -130,6 +177,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev,
if (!force)
mlx5_core_err(dev, "internal state error detected\n");
if (check_fatal_sensors(dev) || force) {
+   reset_fw_if_needed(dev);
dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;
mlx5_trigger_cmd_completions(dev);
}
@@ -230,11 +278,14 @@ static void health_care(struct work_struct *work)

svn commit: r331449 - in head/sys/dev/mlx5: . mlx5_core

2018-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar 23 18:20:42 2018
New Revision: 331449
URL: https://svnweb.freebsd.org/changeset/base/331449

Log:
  Handle software reset of firmware in error flow in mlx5core.
  
  Some mlx5 adapter firmware allows the driver to reset the firmware in
  the event of an error. When a software reset is issued on any physical
  function all PFs enter reset state. This is a recoverable condition.
  The existing recovery flow was designed to allow the recovery of a
  VF after a PF driver reload. This patch expands the scope of that
  flow to recover PFs or VFs after a SW reset has been issued.
  When a software reset is issued the following occurs:
  
  1. The NIC interface mode is set to SW_RESET (7) while the reset is in
 progress.
  2. Once the reset completes the NIC interface mode is set to NIC
 disabled (1).
  
  After the reset has been issued (added in a subsequent patch) the
  health poll for other functions will detect that the NIC interface
  state has been set to disabled. This will cause it to enter the
  existing recovery flow.  If the PCI is still working (meaning it
  doesn't return 0xff on all reads) it means recovery can proceed
  immediately instead of waiting 60 seconds.
  
  The error detetion has also been refactored to avoid incorrect or
  misleading log messages.
  
  Submitted by: slavash@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Fri Mar 23 18:15:01 2018(r331448)
+++ head/sys/dev/mlx5/driver.h  Fri Mar 23 18:20:42 2018(r331449)
@@ -492,7 +492,7 @@ struct mlx5_core_health {
struct timer_list   timer;
u32 prev;
int miss_counter;
-   boolsick;
+   u32 fatal_error;
/* wq spinlock to synchronize draining */
spinlock_t  wq_lock;
struct workqueue_struct*wq;

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Fri Mar 23 18:15:01 2018
(r331448)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Fri Mar 23 18:20:42 2018
(r331449)
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "mlx5_core.h"
@@ -41,7 +42,7 @@ enum {
MLX5_NIC_IFC_FULL   = 0,
MLX5_NIC_IFC_DISABLED   = 1,
MLX5_NIC_IFC_NO_DRAM_NIC= 2,
-   MLX5_NIC_IFC_INVALID= 3,
+   MLX5_NIC_IFC_SW_RESET   = 7,
 };
 
 enum {
@@ -49,9 +50,17 @@ enum {
MLX5_DROP_NEW_RECOVERY_WORK,
 };
 
-static u8 get_nic_state(struct mlx5_core_dev *dev)
+enum  {
+   MLX5_SENSOR_NO_ERR  = 0,
+   MLX5_SENSOR_PCI_COMM_ERR= 1,
+   MLX5_SENSOR_PCI_ERR = 2,
+   MLX5_SENSOR_NIC_DISABLED= 3,
+   MLX5_SENSOR_NIC_SW_RESET= 4,
+};
+
+static u8 get_nic_mode(struct mlx5_core_dev *dev)
 {
-   return (ioread32be(>iseg->cmdq_addr_l_sz) >> 8) & 3;
+   return (ioread32be(>iseg->cmdq_addr_l_sz) >> 8) & 7;
 }
 
 static void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev)
@@ -77,20 +86,39 @@ no_trig:
spin_unlock_irqrestore(>cmd.alloc_lock, flags);
 }
 
-static int in_fatal(struct mlx5_core_dev *dev)
+static bool sensor_pci_no_comm(struct mlx5_core_dev *dev)
 {
struct mlx5_core_health *health = >priv.health;
struct mlx5_health_buffer __iomem *h = health->health;
+   bool err = ioread32be(>fw_ver) == 0x;
 
-   if (get_nic_state(dev) == MLX5_NIC_IFC_DISABLED)
-   return 1;
+   return err;
+}
 
-   if (ioread32be(>fw_ver) == 0x)
-   return 1;
+static bool sensor_nic_disabled(struct mlx5_core_dev *dev)
+{
+   return get_nic_mode(dev) == MLX5_NIC_IFC_DISABLED;
+}
 
-   return 0;
+static bool sensor_nic_sw_reset(struct mlx5_core_dev *dev)
+{
+   return get_nic_mode(dev) == MLX5_NIC_IFC_SW_RESET;
 }
 
+static u32 check_fatal_sensors(struct mlx5_core_dev *dev)
+{
+   if (sensor_pci_no_comm(dev))
+   return MLX5_SENSOR_PCI_COMM_ERR;
+   if (pci_channel_offline(dev->pdev))
+   return MLX5_SENSOR_PCI_ERR;
+   if (sensor_nic_disabled(dev))
+   return MLX5_SENSOR_NIC_DISABLED;
+   if (sensor_nic_sw_reset(dev))
+   return MLX5_SENSOR_NIC_SW_RESET;
+
+   return MLX5_SENSOR_NO_ERR;
+}
+
 void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force)
 {
mutex_lock(>intf_state_mutex);
@@ -101,7 +129,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev,
 
if (!force)

svn commit: r331447 - head/sys/dev/mlx5/mlx5_core

2018-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar 23 18:11:06 2018
New Revision: 331447
URL: https://svnweb.freebsd.org/changeset/base/331447

Log:
  Hide verbose proclamation of error when forced in mlx5core.
  
  When mlx5_enter_error_state() operation is forced by shutdown, the
  messages surrounding setting the error state are not informational
  and confuse users.
  
  Submitted by: kib@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Fri Mar 23 18:09:09 2018
(r331446)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Fri Mar 23 18:11:06 2018
(r331447)
@@ -99,14 +99,16 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev,
return;
}
 
-   mlx5_core_err(dev, "start\n");
+   if (!force)
+   mlx5_core_err(dev, "internal state error detected\n");
if (pci_channel_offline(dev->pdev) || in_fatal(dev) || force) {
dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;
mlx5_trigger_cmd_completions(dev);
}
 
mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0);
-   mlx5_core_err(dev, "end\n");
+   if (!force)
+   mlx5_core_err(dev, "system error event triggered\n");
 
 unlock:
mutex_unlock(>intf_state_mutex);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331446 - in head/sys/dev/mlx5: . mlx5_core

2018-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar 23 18:09:09 2018
New Revision: 331446
URL: https://svnweb.freebsd.org/changeset/base/331446

Log:
  Cancel delayed recovery work when unloading the mlx5core driver.
  
  linux commit 2a0165a034ac024b60cca49c61e46f4afa2e4d98
  
  Submitted by: Matthew Finlay 
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Fri Mar 23 18:02:20 2018(r331445)
+++ head/sys/dev/mlx5/driver.h  Fri Mar 23 18:09:09 2018(r331446)
@@ -892,6 +892,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev);
 void mlx5_start_health_poll(struct mlx5_core_dev *dev);
 void mlx5_stop_health_poll(struct mlx5_core_dev *dev);
 void mlx5_drain_health_wq(struct mlx5_core_dev *dev);
+void mlx5_drain_health_recovery(struct mlx5_core_dev *dev);
 void mlx5_trigger_health_work(struct mlx5_core_dev *dev);
 
 #definemlx5_buf_alloc_node(dev, size, direct, buf, node) \

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Fri Mar 23 18:02:20 2018
(r331445)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Fri Mar 23 18:09:09 2018
(r331446)
@@ -46,6 +46,7 @@ enum {
 
 enum {
MLX5_DROP_NEW_HEALTH_WORK,
+   MLX5_DROP_NEW_RECOVERY_WORK,
 };
 
 static u8 get_nic_state(struct mlx5_core_dev *dev)
@@ -175,7 +176,7 @@ static void health_care(struct work_struct *work)
mlx5_handle_bad_state(dev);
 
spin_lock_irqsave(>wq_lock, flags);
-   if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, >flags))
+   if (!test_bit(MLX5_DROP_NEW_RECOVERY_WORK, >flags))
schedule_delayed_work(>recover_work, recover_delay);
else
dev_err(>pdev->dev,
@@ -306,6 +307,7 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev)
init_timer(>timer);
health->sick = 0;
clear_bit(MLX5_DROP_NEW_HEALTH_WORK, >flags);
+   clear_bit(MLX5_DROP_NEW_RECOVERY_WORK, >flags);
health->health = >iseg->health;
health->health_counter = >iseg->health_counter;
 
@@ -328,9 +330,21 @@ void mlx5_drain_health_wq(struct mlx5_core_dev *dev)
 
spin_lock_irqsave(>wq_lock, flags);
set_bit(MLX5_DROP_NEW_HEALTH_WORK, >flags);
+   set_bit(MLX5_DROP_NEW_RECOVERY_WORK, >flags);
spin_unlock_irqrestore(>wq_lock, flags);
cancel_delayed_work_sync(>recover_work);
cancel_work_sync(>work);
+}
+
+void mlx5_drain_health_recovery(struct mlx5_core_dev *dev)
+{
+   struct mlx5_core_health *health = >priv.health;
+   unsigned long flags;
+
+   spin_lock_irqsave(>wq_lock, flags);
+   set_bit(MLX5_DROP_NEW_RECOVERY_WORK, >flags);
+   spin_unlock_irqrestore(>wq_lock, flags);
+   cancel_delayed_work_sync(>priv.health.recover_work);
 }
 
 void mlx5_health_cleanup(struct mlx5_core_dev *dev)

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:02:20 2018
(r331445)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:09:09 2018
(r331446)
@@ -1114,6 +1114,9 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, 
 {
int err = 0;
 
+   if (cleanup)
+   mlx5_drain_health_recovery(dev);
+
mutex_lock(>intf_state_mutex);
if (test_bit(MLX5_INTERFACE_STATE_DOWN, >intf_state)) {
dev_warn(>pdev->dev, "%s: interface is down, NOP\n", 
__func__);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331445 - in head/sys/dev/mlx5: . mlx5_core

2018-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar 23 18:02:20 2018
New Revision: 331445
URL: https://svnweb.freebsd.org/changeset/base/331445

Log:
  Add support for fast unload in shutdown flow in mlx5core.
  
  This patch accumulates the following Linux commits:
  
  - 8812c24d28f4972c4f2b9998bf30b1f2a1b62adf
net/mlx5: Add fast unload support in shutdown flow
  - 59211bd3b6329c3e5f4a90ac3d7f87ffa7867073
net/mlx5: Split the load/unload flow into hardware and software flows
  - 4525abeaae54560254a1bb8970b3d4c225d32ef4
net/mlx5: Expose command polling interface
  
  Submitted by: Matthew Finlay 
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
  head/sys/dev/mlx5/mlx5_core/mlx5_core.h
  head/sys/dev/mlx5/mlx5_core/mlx5_fw.c
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c
  head/sys/dev/mlx5/mlx5_ifc.h

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Fri Mar 23 17:58:33 2018(r331444)
+++ head/sys/dev/mlx5/driver.h  Fri Mar 23 18:02:20 2018(r331445)
@@ -779,6 +779,7 @@ struct mlx5_cmd_work_ent {
u64 ts2;
u16 op;
u8  busy;
+   boolpolling;
 };
 
 struct mlx5_pas {
@@ -866,6 +867,7 @@ static inline u32 mlx5_base_mkey(const u32 key)
return key & 0xff00u;
 }
 
+void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force);
 int mlx5_cmd_init(struct mlx5_core_dev *dev);
 void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);
 void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
@@ -877,6 +879,8 @@ int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in,
 int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
 void *out, int out_size, mlx5_cmd_cbk_t callback,
 void *context);
+int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size,
+ void *out, int out_size);
 int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn);
 int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn);
 int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c  Fri Mar 23 17:58:33 2018
(r331444)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c  Fri Mar 23 18:02:20 2018
(r331445)
@@ -859,6 +859,7 @@ static void cmd_work_handler(struct work_struct *work)
 unsigned long cb_timeout = msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC);
struct mlx5_cmd_layout *lay;
struct semaphore *sem;
+   bool poll_cmd = ent->polling;
 
sem = ent->page_queue ? >pages_sem : >sem;
down(sem);
@@ -897,7 +898,7 @@ static void cmd_work_handler(struct work_struct *work)
iowrite32be(1 << ent->idx, >iseg->cmd_dbell);
mmiowb();
/* if not in polling don't use ent after this point*/
-   if (cmd->mode == CMD_MODE_POLLING) {
+   if (cmd->mode == CMD_MODE_POLLING || poll_cmd) {
poll_timeout(ent);
/* make sure we read the descriptor after ownership is SW */
mlx5_cmd_comp_handler(dev, 1U << ent->idx);
@@ -940,7 +941,7 @@ static int wait_func(struct mlx5_core_dev *dev, struct
struct mlx5_cmd *cmd = >cmd;
int err;
 
-   if (cmd->mode == CMD_MODE_POLLING) {
+   if (cmd->mode == CMD_MODE_POLLING || ent->polling) {
wait_for_completion(>done);
err = ent->ret;
} else if (!wait_for_completion_timeout(>done, timeout)) {
@@ -969,7 +970,8 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, 
   int uin_size,
   struct mlx5_cmd_msg *out, void *uout, int uout_size,
   mlx5_cmd_cbk_t callback,
-  void *context, int page_queue, u8 *status)
+  void *context, int page_queue, u8 *status,
+  bool force_polling)
 {
struct mlx5_cmd *cmd = >cmd;
struct mlx5_cmd_work_ent *ent;
@@ -986,6 +988,8 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, 
if (IS_ERR(ent))
return PTR_ERR(ent);
 
+   ent->polling = force_polling;
+
if (!callback)
init_completion(>done);
 
@@ -1260,7 +1264,8 @@ static int is_manage_pages(void *in)
 static int cmd_exec_helper(struct mlx5_core_dev *dev,
   void *in, int in_size,
   void *out, int out_size,
-  mlx5_cmd_cbk_t callback, void *context)
+  mlx5_cmd_cbk_t callback, void *context,
+  

svn commit: r331443 - in head/sys/dev/mlx5: . mlx5_core

2018-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar 23 17:33:14 2018
New Revision: 331443
URL: https://svnweb.freebsd.org/changeset/base/331443

Log:
  Improve support for health recovery in mlx5core.
  
  This patch accumulates the following Linux commits:
  
  - 04c0c1ab38e95105d950db5b84e727637e149ce7
net/mlx5: PCI error recovery health care simulation
  - 0179720d6be2096b8d0a4d143254ff9e77747daa
net/mlx5: Introduce trigger_health_work function
  - 3fece5d676939f42f434c63dfe1bd42d7d94e6f0
net/mlx5: Continue health polling until it is explicitly stopped
  
  Submitted by: Matthew Finlay 
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_core.h
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Fri Mar 23 17:28:04 2018(r331442)
+++ head/sys/dev/mlx5/driver.h  Fri Mar 23 17:33:14 2018(r331443)
@@ -498,6 +498,7 @@ struct mlx5_core_health {
struct workqueue_struct*wq;
unsigned long   flags;
struct work_struct  work;
+   struct delayed_work recover_work;
 };
 
 #defineMLX5_CQ_LINEAR_ARRAY_SIZE   1024
@@ -887,6 +888,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev);
 void mlx5_start_health_poll(struct mlx5_core_dev *dev);
 void mlx5_stop_health_poll(struct mlx5_core_dev *dev);
 void mlx5_drain_health_wq(struct mlx5_core_dev *dev);
+void mlx5_trigger_health_work(struct mlx5_core_dev *dev);
 
 #definemlx5_buf_alloc_node(dev, size, direct, buf, node) \
mlx5_buf_alloc(dev, size, direct, buf)

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 17:28:04 2018
(r331442)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Fri Mar 23 17:33:14 2018
(r331443)
@@ -74,6 +74,7 @@ void mlx5_core_event(struct mlx5_core_dev *dev, enum m
 unsigned long param);
 void mlx5_enter_error_state(struct mlx5_core_dev *dev);
 void mlx5_disable_device(struct mlx5_core_dev *dev);
+void mlx5_recover_device(struct mlx5_core_dev *dev);
 
 void mlx5e_init(void);
 void mlx5e_cleanup(void);

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Fri Mar 23 17:28:04 2018
(r331442)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Fri Mar 23 17:33:14 2018
(r331443)
@@ -40,14 +40,15 @@
 enum {
MLX5_NIC_IFC_FULL   = 0,
MLX5_NIC_IFC_DISABLED   = 1,
-   MLX5_NIC_IFC_NO_DRAM_NIC= 2
+   MLX5_NIC_IFC_NO_DRAM_NIC= 2,
+   MLX5_NIC_IFC_INVALID= 3,
 };
 
 enum {
MLX5_DROP_NEW_HEALTH_WORK,
 };
 
-static u8 get_nic_interface(struct mlx5_core_dev *dev)
+static u8 get_nic_state(struct mlx5_core_dev *dev)
 {
return (ioread32be(>iseg->cmdq_addr_l_sz) >> 8) & 3;
 }
@@ -80,7 +81,7 @@ static int in_fatal(struct mlx5_core_dev *dev)
struct mlx5_core_health *health = >priv.health;
struct mlx5_health_buffer __iomem *h = health->health;
 
-   if (get_nic_interface(dev) == MLX5_NIC_IFC_DISABLED)
+   if (get_nic_state(dev) == MLX5_NIC_IFC_DISABLED)
return 1;
 
if (ioread32be(>fw_ver) == 0x)
@@ -112,9 +113,9 @@ unlock:
 
 static void mlx5_handle_bad_state(struct mlx5_core_dev *dev)
 {
-   u8 nic_interface = get_nic_interface(dev);
+   u8 nic_state = get_nic_state(dev);
 
-   switch (nic_interface) {
+   switch (nic_state) {
case MLX5_NIC_IFC_FULL:
mlx5_core_warn(dev, "Expected to see disabled NIC but it is 
full driver\n");
break;
@@ -128,23 +129,58 @@ static void mlx5_handle_bad_state(struct mlx5_core_dev
break;
default:
mlx5_core_warn(dev, "Expected to see disabled NIC but it is has 
invalid value %d\n",
-  nic_interface);
+  nic_state);
}
 
mlx5_disable_device(dev);
 }
 
+static void health_recover(struct work_struct *work)
+{
+   struct mlx5_core_health *health;
+   struct delayed_work *dwork;
+   struct mlx5_core_dev *dev;
+   struct mlx5_priv *priv;
+   u8 nic_state;
+
+   dwork = container_of(work, struct delayed_work, work);
+   health = container_of(dwork, struct mlx5_core_health, recover_work);
+   priv = container_of(health, struct mlx5_priv, health);
+   dev = container_of(priv, struct mlx5_core_dev, priv);
+
+   nic_state = get_nic_state(dev);
+   if (nic_state == MLX5_NIC_IFC_INVALID) {
+   

svn commit: r331442 - in head/sys/amd64: linux linux32

2018-03-23 Thread Ed Maste
Author: emaste
Date: Fri Mar 23 17:28:04 2018
New Revision: 331442
URL: https://svnweb.freebsd.org/changeset/base/331442

Log:
  Fixup return style(9) in amd64 linux*_sysvec.c
  
  Sponsored by: Turing Robotic Industries Inc.

Modified:
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux32/linux32_sysvec.c

Modified: head/sys/amd64/linux/linux_sysvec.c
==
--- head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 17:25:19 2018
(r331441)
+++ head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 17:28:04 2018
(r331442)
@@ -184,15 +184,15 @@ linux_translate_traps(int signal, int trap_code)
 {
 
if (signal != SIGBUS)
-   return signal;
+   return (signal);
switch (trap_code) {
case T_PROTFLT:
case T_TSSFLT:
case T_DOUBLEFLT:
case T_PAGEFLT:
-   return SIGSEGV;
+   return (SIGSEGV);
default:
-   return signal;
+   return (signal);
}
 }
 

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 17:25:19 2018
(r331441)
+++ head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 17:28:04 2018
(r331442)
@@ -193,15 +193,15 @@ static int
 linux_translate_traps(int signal, int trap_code)
 {
if (signal != SIGBUS)
-   return signal;
+   return (signal);
switch (trap_code) {
case T_PROTFLT:
case T_TSSFLT:
case T_DOUBLEFLT:
case T_PAGEFLT:
-   return SIGSEGV;
+   return (SIGSEGV);
default:
-   return signal;
+   return (signal);
}
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331441 - head/sys/mips/mips

2018-03-23 Thread Olivier Houchard
Author: cognet
Date: Fri Mar 23 17:25:19 2018
New Revision: 331441
URL: https://svnweb.freebsd.org/changeset/base/331441

Log:
  In __sync_bool_compare_and_swap(), return true if the returned value is the
  same as the expected one, not the desired one.
  
  Pointy hat to:cognet
  MFC after:3 days

Modified:
  head/sys/mips/mips/stdatomic.c

Modified: head/sys/mips/mips/stdatomic.c
==
--- head/sys/mips/mips/stdatomic.c  Fri Mar 23 17:22:28 2018
(r331440)
+++ head/sys/mips/mips/stdatomic.c  Fri Mar 23 17:25:19 2018
(r331441)
@@ -327,7 +327,7 @@ __sync_bool_compare_and_swap_4(uint32_t *mem, uint32_t
 {
 
return (do_compare_and_swap_4(mem, expected, desired) ==
-   desired);
+   expected);
 }
 
 #defineEMIT_FETCH_AND_OP_4(name, op)   
\
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331440 - head/stand/i386/libi386

2018-03-23 Thread Kyle Evans
Author: kevans
Date: Fri Mar 23 17:22:28 2018
New Revision: 331440
URL: https://svnweb.freebsd.org/changeset/base/331440

Log:
  Match broken style of vidconsole.c
  
  This particular function uses a broken mix of indentation styles. Match it
  for the newly added SGR 22 bits.
  
  Reported by:  jkim
  X-MFC-With:   r331416

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

Modified: head/stand/i386/libi386/vidconsole.c
==
--- head/stand/i386/libi386/vidconsole.cFri Mar 23 17:16:36 2018
(r331439)
+++ head/stand/i386/libi386/vidconsole.cFri Mar 23 17:22:28 2018
(r331440)
@@ -449,9 +449,9 @@ vidc_term_emu(int c)
fg_c = bg_c;
bg_c = t;
break;
-case 22:   /* normal intensity */
-fg_c &= ~0x8;
-break;
+   case 22:/* normal intensity */
+   fg_c &= ~0x8;
+   break;
case 30: case 31: case 32: case 33:
case 34: case 35: case 36: case 37:
fg_c = ansi_col[args[i] - 30];
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331439 - in head/sys: amd64/linux amd64/linux32 i386/linux

2018-03-23 Thread Ed Maste
Author: emaste
Date: Fri Mar 23 17:16:36 2018
New Revision: 331439
URL: https://svnweb.freebsd.org/changeset/base/331439

Log:
  Sort headers in MD Linuxulator files
  
  Bring #includes closer to style(9) and reduce differences between the
  (three) MD versions of linux_machdep.c and linux_sysvec.c.
  
  Sponsored by: Turing Robotic Industries Inc.

Modified:
  head/sys/amd64/linux/linux_machdep.c
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux32/linux32_machdep.c
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/i386/linux/linux_machdep.c

Modified: head/sys/amd64/linux/linux_machdep.c
==
--- head/sys/amd64/linux/linux_machdep.cFri Mar 23 17:03:42 2018
(r331438)
+++ head/sys/amd64/linux/linux_machdep.cFri Mar 23 17:16:36 2018
(r331439)
@@ -33,15 +33,14 @@
 __FBSDID("$FreeBSD$");
 
 #include 
-#include 
-#include 
 #include 
+#include 
 #include 
-#include 
 #include 
+#include 
 #include 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -55,8 +54,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
+#include 
 #include 
 
 #include 
@@ -72,21 +72,21 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
-#include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 
 #include 
 

Modified: head/sys/amd64/linux/linux_sysvec.c
==
--- head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 17:03:42 2018
(r331438)
+++ head/sys/amd64/linux/linux_sysvec.c Fri Mar 23 17:16:36 2018
(r331439)
@@ -53,8 +53,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 

Modified: head/sys/amd64/linux32/linux32_machdep.c
==
--- head/sys/amd64/linux32/linux32_machdep.cFri Mar 23 17:03:42 2018
(r331438)
+++ head/sys/amd64/linux32/linux32_machdep.cFri Mar 23 17:16:36 2018
(r331439)
@@ -36,13 +36,12 @@ __FBSDID("$FreeBSD$");
 #include "opt_compat.h"
 
 #include 
-#include 
-#include 
 #include 
-#include 
-#include 
 #include 
+#include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -54,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -63,19 +63,19 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
+#include 
 #include 
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 
 static voidbsd_to_linux_rusage(struct rusage *ru, struct l_rusage *lru);
 

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 17:03:42 2018
(r331438)
+++ head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 23 17:16:36 2018
(r331439)
@@ -56,8 +56,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 

Modified: head/sys/i386/linux/linux_machdep.c
==
--- head/sys/i386/linux/linux_machdep.c Fri Mar 23 17:03:42 2018
(r331438)
+++ head/sys/i386/linux/linux_machdep.c Fri Mar 23 17:16:36 2018
(r331439)
@@ -30,45 +30,45 @@
 __FBSDID("$FreeBSD$");
 
 #include 
-#include 
 #include 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
 #include 
 #include 
 
-#include 
 #include 
+#include 
 #include 
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 
 #include   /* needed for pcb definition in 
linux_set_thread_area */
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331438 - head/sys/contrib/rdma/krping

2018-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar 23 17:03:42 2018
New Revision: 331438
URL: https://svnweb.freebsd.org/changeset/base/331438

Log:
  Exit krping on device removal to avoid endless hang situation.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/contrib/rdma/krping/krping.c

Modified: head/sys/contrib/rdma/krping/krping.c
==
--- head/sys/contrib/rdma/krping/krping.c   Fri Mar 23 16:59:51 2018
(r331437)
+++ head/sys/contrib/rdma/krping/krping.c   Fri Mar 23 17:03:42 2018
(r331438)
@@ -301,6 +301,8 @@ static int krping_cma_event_handler(struct rdma_cm_id 
 
case RDMA_CM_EVENT_DEVICE_REMOVAL:
printk(KERN_ERR PFX "cma detected device removal\n");
+   cb->state = ERROR;
+   wake_up_interruptible(>sem);
break;
 
default:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331437 - head/sys/dev/mlx5/mlx5_en

2018-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar 23 16:59:51 2018
New Revision: 331437
URL: https://svnweb.freebsd.org/changeset/base/331437

Log:
  Create designated workqueue for each mlx5en(4) device instance.
  
  The mlx5e_destroy_ifp() function may be called from the system workqueue and
  in this case trying to flush all works will cause a dead lock.
  Instead of using the system workqueue, create a designated workqueue
  for each mlx5en(4) device instance.
  
  Submitted by: slavash@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Fri Mar 23 16:56:44 2018
(r331436)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Fri Mar 23 16:59:51 2018
(r331437)
@@ -769,6 +769,8 @@ struct mlx5e_priv {
struct mlx5e_stats stats;
int counter_set_id;
 
+   struct workqueue_struct *wq;
+
eventhandler_tag vlan_detach;
eventhandler_tag vlan_attach;
struct ifmedia media;

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cFri Mar 23 16:56:44 2018
(r331436)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cFri Mar 23 16:59:51 2018
(r331437)
@@ -642,7 +642,7 @@ mlx5e_update_stats(void *arg)
 {
struct mlx5e_priv *priv = arg;
 
-   schedule_work(>update_stats_work);
+   queue_work(priv->wq, >update_stats_work);
 
callout_reset(>watchdog, hz, _update_stats, priv);
 }
@@ -654,7 +654,7 @@ mlx5e_async_event_sub(struct mlx5e_priv *priv,
switch (event) {
case MLX5_DEV_EVENT_PORT_UP:
case MLX5_DEV_EVENT_PORT_DOWN:
-   schedule_work(>update_carrier_work);
+   queue_work(priv->wq, >update_carrier_work);
break;
 
default:
@@ -2686,7 +2686,7 @@ mlx5e_set_rx_mode(struct ifnet *ifp)
 {
struct mlx5e_priv *priv = ifp->if_softc;
 
-   schedule_work(>set_rx_mode_work);
+   queue_work(priv->wq, >set_rx_mode_work);
 }
 
 static int
@@ -3540,11 +3540,20 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
goto err_free_sysctl;
}
mlx5e_build_ifp_priv(mdev, priv, ncv);
+
+   snprintf(unit, sizeof(unit), "mce%u_wq",
+   device_get_unit(mdev->pdev->dev.bsddev));
+   priv->wq = alloc_workqueue(unit, 0, 1);
+   if (priv->wq == NULL) {
+   if_printf(ifp, "%s: alloc_workqueue failed\n", __func__);
+   goto err_free_sysctl;
+   }
+
err = mlx5_alloc_map_uar(mdev, >cq_uar);
if (err) {
if_printf(ifp, "%s: mlx5_alloc_map_uar failed, %d\n",
__func__, err);
-   goto err_free_sysctl;
+   goto err_free_wq;
}
err = mlx5_core_alloc_pd(mdev, >pdn);
if (err) {
@@ -3666,6 +3675,9 @@ err_dealloc_pd:
 err_unmap_free_uar:
mlx5_unmap_free_uar(mdev, >cq_uar);
 
+err_free_wq:
+   destroy_workqueue(priv->wq);
+
 err_free_sysctl:
sysctl_ctx_free(>sysctl_ctx);
 
@@ -3728,7 +3740,7 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp
mlx5_core_dealloc_pd(priv->mdev, priv->pdn);
mlx5_unmap_free_uar(priv->mdev, >cq_uar);
mlx5e_disable_async_events(priv);
-   flush_scheduled_work();
+   destroy_workqueue(priv->wq);
mlx5e_priv_mtx_destroy(priv);
free(priv, M_MLX5EN);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331436 - in head: share/man/man9 sys/net sys/netinet sys/netinet6 sys/netpfil/pf

2018-03-23 Thread Kristof Provost
Author: kp
Date: Fri Mar 23 16:56:44 2018
New Revision: 331436
URL: https://svnweb.freebsd.org/changeset/base/331436

Log:
  netpfil: Introduce PFIL_FWD flag
  
  Forwarded packets passed through PFIL_OUT, which made it difficult for
  firewalls to figure out if they were forwarding or producing packets. This in
  turn is an issue for pf for IPv6 fragment handling: it needs to call
  ip6_output() or ip6_forward() to handle the fragments. Figuring out which was
  difficult (and until now, incorrect).
  Having pfil distinguish the two removes an ugly piece of code from pf.
  
  Introduce a new variant of the netpfil callbacks with a flags variable, which
  has PFIL_FWD set for forwarded packets. This allows pf to reliably work out if
  a packet is forwarded.
  
  Reviewed by:  ae, kevans
  Differential Revision:https://reviews.freebsd.org/D13715

Modified:
  head/share/man/man9/pfil.9
  head/sys/net/if_bridge.c
  head/sys/net/if_enc.c
  head/sys/net/if_ethersubr.c
  head/sys/net/pfil.c
  head/sys/net/pfil.h
  head/sys/net/pfvar.h
  head/sys/netinet/ip_fastfwd.c
  head/sys/netinet/ip_input.c
  head/sys/netinet/ip_output.c
  head/sys/netinet6/ip6_fastfwd.c
  head/sys/netinet6/ip6_forward.c
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/ip6_output.c
  head/sys/netpfil/pf/pf.c
  head/sys/netpfil/pf/pf.h
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/share/man/man9/pfil.9
==
--- head/share/man/man9/pfil.9  Fri Mar 23 16:23:15 2018(r331435)
+++ head/share/man/man9/pfil.9  Fri Mar 23 16:56:44 2018(r331436)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 27, 2017
+.Dd March 10, 2018
 .Dt PFIL 9
 .Os
 .Sh NAME
@@ -37,7 +37,9 @@
 .Nm pfil_head_unregister ,
 .Nm pfil_head_get ,
 .Nm pfil_add_hook ,
+.Nm pfil_add_hook_flags ,
 .Nm pfil_remove_hook ,
+.Nm pfil_remove_hook_flags ,
 .Nm pfil_run_hooks ,
 .Nm pfil_rlock ,
 .Nm pfil_runlock ,
@@ -51,6 +53,8 @@
 .In net/pfil.h
 .Bd -literal
 typedef int (*pfil_func_t)(void *arg, struct mbuf **mp, struct ifnet *, int 
dir, struct inpcb);
+.Bd -literal
+typedef int (*pfil_func_flags_t)(void *arg, struct mbuf **mp, struct ifnet *, 
int dir, int flags, struct inpcb);
 .Ft int
 .Fn pfil_head_register "struct pfil_head *head"
 .Ft int
@@ -58,11 +62,15 @@ typedef int (*pfil_func_t)(void *arg, struct mbuf **mp
 .Ft "struct pfil_head *"
 .Fn pfil_head_get "int af" "u_long dlt"
 .Ft int
-.Fn pfil_add_hook "pfil_func_t" "void *arg" "int flags" "struct pfil_head *"
+.Fn pfil_add_hook "pfil_func_t" "void *arg" "struct pfil_head *"
 .Ft int
-.Fn pfil_remove_hook "pfil_func_t" "void *arg" "int flags" "struct pfil_head *"
+.Fn pfil_add_hook_flags "pfil_func_flags_t" "void *arg" "int flags" "struct 
pfil_head *"
 .Ft int
-.Fn pfil_run_hooks "struct pfil_head *head" "struct mbuf **mp" "struct ifnet 
*" "int dir" "struct inpcb *"
+.Fn pfil_remove_hook "pfil_func_t" "void *arg" "struct pfil_head *"
+.Ft int
+.Fn pfil_remove_hook_flags "pfil_func_flags_t" "void *arg" "int flags" "struct 
pfil_head *"
+.Ft int
+.Fn pfil_run_hooks "struct pfil_head *head" "struct mbuf **mp" "struct ifnet 
*" "int dir" "int flags" "struct inpcb *"
 .Ft void
 .Fn pfil_rlock "struct pfil_head *" "struct rm_priotracker *"
 .Ft void
@@ -116,6 +124,7 @@ with the
 and
 .Fn pfil_remove_hook
 functions, respectively.
+.I
 The head is looked up using the
 .Fn pfil_head_get
 function, which takes the key and data link type that the packet filter
@@ -135,6 +144,10 @@ interface that the packet is traversing, and the direc
 or
 .Dv PFIL_OUT )
 that the packet is traveling.
+The
+.Vt flags
+argument will indicate if an outgoing packet is simply being forwarded with the
+value PFIL_FWD.
 The filter may change which mbuf the
 .Vt "mbuf\ **"
 argument references.

Modified: head/sys/net/if_bridge.c
==
--- head/sys/net/if_bridge.cFri Mar 23 16:23:15 2018(r331435)
+++ head/sys/net/if_bridge.cFri Mar 23 16:56:44 2018(r331436)
@@ -3176,7 +3176,8 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru
if (PFIL_HOOKED(_link_pfil_hook) && V_pfil_ipfw != 0 &&
dir == PFIL_OUT && ifp != NULL) {
 
-   error = pfil_run_hooks(_link_pfil_hook, mp, ifp, dir, NULL);
+   error = pfil_run_hooks(_link_pfil_hook, mp, ifp, dir, 0,
+   NULL);
 
if (*mp == NULL || error != 0) /* packet consumed by filter */
return (error);
@@ -3228,21 +3229,21 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru
 */
if (V_pfil_bridge && dir == PFIL_OUT && bifp != NULL)
error = pfil_run_hooks(_inet_pfil_hook, mp, bifp,
-   dir, NULL);
+   dir, 0, NULL);
 
if (*mp == NULL || error != 0) /* filter may 

Re: svn commit: r331209 - head

2018-03-23 Thread John Baldwin
On Thursday, March 22, 2018 04:39:38 AM Alexey Dokuchaev wrote:
> On Wed, Mar 21, 2018 at 10:34:15PM -0600, Warner Losh wrote:
> > On Wed, Mar 21, 2018 at 10:03 PM, Alexey Dokuchaev 
> > wrote:
> > > On Mon, Mar 19, 2018 at 09:20:40AM -0700, John Baldwin wrote:
> > > > ...
> > > > How does this fit with the recommended installation steps of doing
> > > > 'make installkernel' and rebooting before doing a 'make installworld'?
> > >
> > > Rebooting?  I vaguely recall recommended procedure was to switch to single
> > > user mode prior to `installworld', but personally I've never bothered and
> > > installed kernel, [mm -p,] world, mm -Fi, reboot.  Am I missing something?
> > 
> > Old advice was to do the installworld in single user, as that's the safest
> > (and also ensures you have a new kernel and don't install before rebooting).
> > However, we've had enough experience to see that usually an installworld +
> > reboot is sufficient.
> 
> Right, but John had mentioned extra reboot *between* installkernel and
> installworld, which I've never heard of before.

>From the end up of src/UPDATING:

To rebuild everything and install it on the current system.
---
# Note: sometimes if you are running current you gotta do more than
# is listed here if you are upgrading from a really old current.


make buildworld
make kernel KERNCONF=YOUR_KERNEL_HERE
[1]
 [3]
mergemaster -Fp [5]
make installworld
mergemaster -Fi [4]
make delete-old [6]


See also 
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html

Often you can take shortcuts, but this is the only process we guarantee will
always work.  (We will also sometimes add additional shims to make some of the
common shortcuts work, but we don't guarantee that.)

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


svn commit: r331435 - head/sys/cam/scsi

2018-03-23 Thread Warner Losh
Author: imp
Date: Fri Mar 23 16:23:15 2018
New Revision: 331435
URL: https://svnweb.freebsd.org/changeset/base/331435

Log:
  Flag when we have a pending TUR. Don't schedule another one when we
  have one pending. Otherwise, we can race and send two, which is
  wasteful in close proximity. It can also cause the acaquire/release
  count for TUR to be > 1, which is undexpected.
  
  PR: 226510
  Differential Review: https://reviews.freebsd.org/D14792

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Fri Mar 23 16:15:07 2018(r331434)
+++ head/sys/cam/scsi/scsi_da.c Fri Mar 23 16:23:15 2018(r331435)
@@ -116,7 +116,8 @@ typedef enum {
DA_FLAG_CAN_ATA_LOG = 0x008000,
DA_FLAG_CAN_ATA_IDLOG   = 0x01,
DA_FLAG_CAN_ATA_SUPCAP  = 0x02,
-   DA_FLAG_CAN_ATA_ZONE= 0x04
+   DA_FLAG_CAN_ATA_ZONE= 0x04,
+   DA_FLAG_TUR_PENDING = 0x08
 } da_flags;
 
 typedef enum {
@@ -2068,7 +2069,8 @@ daasync(void *callback_arg, u_int32_t code,
case AC_SCSI_AEN:
softc = (struct da_softc *)periph->softc;
cam_periph_lock(periph);
-   if (!cam_iosched_has_work_flags(softc->cam_iosched, 
DA_WORK_TUR)) {
+   if (!cam_iosched_has_work_flags(softc->cam_iosched, 
DA_WORK_TUR) &&
+   (softc->flags & DA_FLAG_TUR_PENDING) == 0) {
if (da_periph_acquire(periph, DA_REF_TUR) == 0) {
cam_iosched_set_work_flags(softc->cam_iosched, 
DA_WORK_TUR);
daschedule(periph);
@@ -3113,6 +3115,7 @@ more:
bp = cam_iosched_next_bio(softc->cam_iosched);
if (bp == NULL) {
if (cam_iosched_has_work_flags(softc->cam_iosched, 
DA_WORK_TUR)) {
+   softc->flags |= DA_FLAG_TUR_PENDING;
cam_iosched_clr_work_flags(softc->cam_iosched, 
DA_WORK_TUR);
scsi_test_unit_ready(_ccb->csio,
 /*retries*/ da_retry_count,
@@ -5570,7 +5573,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
if (daerror(done_ccb, CAM_RETRY_SELTO,
SF_RETRY_UA | SF_NO_RECOVERY | SF_NO_PRINT) ==
ERESTART)
-   return;
+   return; /* Will complete again, keep 
reference */
if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
cam_release_devq(done_ccb->ccb_h.path,
 /*relsim_flags*/0,
@@ -5579,6 +5582,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
 /*getcount_only*/0);
}
xpt_release_ccb(done_ccb);
+   softc->flags &= ~DA_FLAG_TUR_PENDING;
da_periph_release_locked(periph, DA_REF_TUR);
return;
}
@@ -5700,6 +5704,7 @@ damediapoll(void *arg)
struct da_softc *softc = periph->softc;
 
if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR) &&
+   (softc->flags & DA_FLAG_TUR_PENDING) == 0 &&
LIST_EMPTY(>pending_ccbs)) {
if (da_periph_acquire(periph, DA_REF_TUR) == 0) {
cam_iosched_set_work_flags(softc->cam_iosched, 
DA_WORK_TUR);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331433 - in head/sys/compat/linuxkpi/common: include/asm include/linux include/net src

2018-03-23 Thread Ed Maste
Author: emaste
Date: Fri Mar 23 15:50:01 2018
New Revision: 331433
URL: https://svnweb.freebsd.org/changeset/base/331433

Log:
  linuxkpi whitespace cleanup
  
  Reviewed by:  hselasky, markj
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D14807

Modified:
  head/sys/compat/linuxkpi/common/include/asm/byteorder.h
  head/sys/compat/linuxkpi/common/include/linux/bitops.h
  head/sys/compat/linuxkpi/common/include/linux/cdev.h
  head/sys/compat/linuxkpi/common/include/linux/compiler.h
  head/sys/compat/linuxkpi/common/include/linux/device.h
  head/sys/compat/linuxkpi/common/include/linux/dma-attrs.h
  head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
  head/sys/compat/linuxkpi/common/include/linux/err.h
  head/sys/compat/linuxkpi/common/include/linux/errno.h
  head/sys/compat/linuxkpi/common/include/linux/etherdevice.h
  head/sys/compat/linuxkpi/common/include/linux/fs.h
  head/sys/compat/linuxkpi/common/include/linux/idr.h
  head/sys/compat/linuxkpi/common/include/linux/if_ether.h
  head/sys/compat/linuxkpi/common/include/linux/if_vlan.h
  head/sys/compat/linuxkpi/common/include/linux/io.h
  head/sys/compat/linuxkpi/common/include/linux/jiffies.h
  head/sys/compat/linuxkpi/common/include/linux/kernel.h
  head/sys/compat/linuxkpi/common/include/linux/kmod.h
  head/sys/compat/linuxkpi/common/include/linux/kobject.h
  head/sys/compat/linuxkpi/common/include/linux/ktime.h
  head/sys/compat/linuxkpi/common/include/linux/list.h
  head/sys/compat/linuxkpi/common/include/linux/log2.h
  head/sys/compat/linuxkpi/common/include/linux/miscdevice.h
  head/sys/compat/linuxkpi/common/include/linux/mutex.h
  head/sys/compat/linuxkpi/common/include/linux/pci.h
  head/sys/compat/linuxkpi/common/include/linux/rwlock.h
  head/sys/compat/linuxkpi/common/include/linux/rwsem.h
  head/sys/compat/linuxkpi/common/include/linux/slab.h
  head/sys/compat/linuxkpi/common/include/linux/spinlock.h
  head/sys/compat/linuxkpi/common/include/linux/sysfs.h
  head/sys/compat/linuxkpi/common/include/linux/usb.h
  head/sys/compat/linuxkpi/common/include/linux/workqueue.h
  head/sys/compat/linuxkpi/common/include/net/if_inet6.h
  head/sys/compat/linuxkpi/common/include/net/ipv6.h
  head/sys/compat/linuxkpi/common/include/net/netevent.h
  head/sys/compat/linuxkpi/common/src/linux_compat.c
  head/sys/compat/linuxkpi/common/src/linux_idr.c
  head/sys/compat/linuxkpi/common/src/linux_radix.c
  head/sys/compat/linuxkpi/common/src/linux_usb.c

Modified: head/sys/compat/linuxkpi/common/include/asm/byteorder.h
==
--- head/sys/compat/linuxkpi/common/include/asm/byteorder.h Fri Mar 23 
15:46:53 2018(r331432)
+++ head/sys/compat/linuxkpi/common/include/asm/byteorder.h Fri Mar 23 
15:50:01 2018(r331433)
@@ -87,7 +87,7 @@
 
 static inline void
 be16_add_cpu(uint16_t *var, uint16_t val)
-{ 
+{
*var = cpu_to_be16(be16_to_cpu(*var) + val);
 }
 

Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h
==
--- head/sys/compat/linuxkpi/common/include/linux/bitops.h  Fri Mar 23 
15:46:53 2018(r331432)
+++ head/sys/compat/linuxkpi/common/include/linux/bitops.h  Fri Mar 23 
15:50:01 2018(r331433)
@@ -54,7 +54,7 @@
 #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
+#define BITS_PER_BYTE  8
 
 #definehweight8(x) bitcount((uint8_t)(x))
 #definehweight16(x)bitcount16(x)

Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h
==
--- head/sys/compat/linuxkpi/common/include/linux/cdev.hFri Mar 23 
15:46:53 2018(r331432)
+++ head/sys/compat/linuxkpi/common/include/linux/cdev.hFri Mar 23 
15:50:01 2018(r331433)
@@ -112,7 +112,7 @@ cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t
int error;
 
cdev->dev = dev;
-   
+
/* Setup arguments for make_dev_s() */
make_dev_args_init();
args.mda_devsw = 

Modified: head/sys/compat/linuxkpi/common/include/linux/compiler.h
==
--- head/sys/compat/linuxkpi/common/include/linux/compiler.hFri Mar 23 
15:46:53 2018(r331432)
+++ head/sys/compat/linuxkpi/common/include/linux/compiler.hFri Mar 23 
15:50:01 2018(r331433)
@@ -84,7 +84,7 @@
 #define__PASTE(a,b) ___PASTE(a,b)
 
 #defineACCESS_ONCE(x)  (*(volatile __typeof(x) *)&(x))
-  
+
 #defineWRITE_ONCE(x,v) do {\
barrier();  \

svn commit: r331432 - head/sys/i386/i386

2018-03-23 Thread Konstantin Belousov
Author: kib
Date: Fri Mar 23 15:46:53 2018
New Revision: 331432
URL: https://svnweb.freebsd.org/changeset/base/331432

Log:
  There is no need to disable interrupts around npxsave call.
  
  i386 was changed to only require critical section around the thread
  FPU state manipulations, and vm86_bioscall callers already enter
  critical section for other reasons.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/i386/i386/vm86bios.s

Modified: head/sys/i386/i386/vm86bios.s
==
--- head/sys/i386/i386/vm86bios.s   Fri Mar 23 15:44:31 2018
(r331431)
+++ head/sys/i386/i386/vm86bios.s   Fri Mar 23 15:46:53 2018
(r331432)
@@ -61,8 +61,6 @@ ENTRY(vm86_bioscall)
pushl   %edi
pushl   %gs
 
-   pushfl
-   cli
movlPCPU(CURTHREAD),%ecx
cmpl%ecx,PCPU(FPCURTHREAD)  /* do we need to save fp? */
jne 1f
@@ -73,8 +71,6 @@ ENTRY(vm86_bioscall)
addl$4,%esp
popl%edx/* recover our pcb */
 1:
-   popfl
-
movlSCR_VMFRAME(%edx),%ebx  /* target frame location */
movl%ebx,%edi   /* destination */
movlSCR_ARGFRAME(%edx),%esi /* source (set on entry) */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331431 - head/sys/i386/i386

2018-03-23 Thread Konstantin Belousov
Author: kib
Date: Fri Mar 23 15:44:31 2018
New Revision: 331431
URL: https://svnweb.freebsd.org/changeset/base/331431

Log:
  Update comment to match current field names.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/i386/i386/vm86.c

Modified: head/sys/i386/i386/vm86.c
==
--- head/sys/i386/i386/vm86.c   Fri Mar 23 15:35:19 2018(r331430)
+++ head/sys/i386/i386/vm86.c   Fri Mar 23 15:44:31 2018(r331431)
@@ -417,8 +417,8 @@ vm86_initialize(void)
 * pcb_esp  =stack frame pointer at time of switch
 * pcb_ebx  = va of vm86 page table
 * pcb_eip  =argument pointer to initial call
-* pcb_spare[0] =saved TSS descriptor, word 0
-* pcb_space[1] =saved TSS descriptor, word 1
+* pcb_vm86[0]  =saved TSS descriptor, word 0
+* pcb_vm86[1]  =saved TSS descriptor, word 1
 */
 #define new_ptdpcb_esi
 #define vm86_frame pcb_ebp
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331430 - in head/sys: dev/adlink modules/adlink

2018-03-23 Thread Warner Losh
Author: imp
Date: Fri Mar 23 15:35:19 2018
New Revision: 331430
URL: https://svnweb.freebsd.org/changeset/base/331430

Log:
  Convert the PCI ID selection from a simple if into a table.
  Mark the table with PNP info.
  Fix compilation by returning FILTER_STRAY in two places, as suggested by 
comments.
  Create a simple module from this. Left unconnected because I can't test it as 
a module.

Added:
  head/sys/modules/adlink/
  head/sys/modules/adlink/Makefile   (contents, props changed)
Modified:
  head/sys/dev/adlink/adlink.c

Modified: head/sys/dev/adlink/adlink.c
==
--- head/sys/dev/adlink/adlink.cFri Mar 23 15:35:15 2018
(r331429)
+++ head/sys/dev/adlink/adlink.cFri Mar 23 15:35:19 2018
(r331430)
@@ -137,7 +137,7 @@ adlink_intr(void *arg)
sc = arg;
u = bus_read_4(sc->res[0], 0x38);
if (!(u & 0x0080))
-   return; // XXX - FILTER_STRAY?
+   return (FILTER_STRAY);
bus_write_4(sc->res[0], 0x38, u | 0x003f4000);
 
sc->sample += sc->p0->chunksize / 2;
@@ -150,7 +150,7 @@ adlink_intr(void *arg)
 
if (sc->p0->state != STATE_RUN) {
printf("adlink: stopping %d\n", sc->p0->state);
-   return; // XXX - FILTER_STRAY?
+   return (FILTER_STRAY);
}
 
pg = pg->next;
@@ -346,14 +346,32 @@ adlink_ioctl(struct cdev *dev, u_long cmd, caddr_t dat
 
 static devclass_t adlink_devclass;
 
+struct pci_id
+{
+   uint16_tvendor;
+   uint16_tdevice;
+   const char  *desc;
+} adlink_id[] = {
+   { .vendor = 0x10e8, .device = 0x80da,
+ .desc ="Adlink PCI-9812 4 ch 12 bit 20 msps" }
+};
+
 static int
 adlink_probe(device_t self)
 {
+   int i;
+   uint16_t vendor, device;
 
-   if (pci_get_devid(self) != 0x80da10e8)
-   return (ENXIO);
-   device_set_desc(self, "Adlink PCI-9812 4 ch 12 bit 20 msps");
-   return (BUS_PROBE_DEFAULT);
+   vendor = pci_get_vendor(self);
+   device = pci_get_device(self);
+   for (i = 0; i < nitems(adlink_id); i++) {
+   if (adlink_id[i].vendor == vendor &&
+   adlink_id[i].device == device) {
+   device_set_desc(self, adlink_id[i].desc);
+   return (BUS_PROBE_DEFAULT);
+   }
+   }
+   return (ENXIO);
 }
 
 static struct resource_spec adlink_res_spec[] = {
@@ -420,5 +438,6 @@ static driver_t adlink_driver = {
 };
 
 DRIVER_MODULE(adlink, pci, adlink_driver, adlink_devclass, 0, 0);
-
+MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, adlink, adlink_id, 
sizeof(adlink_id[0]),
+nitems(adlink_id));
 #endif /* _KERNEL */

Added: head/sys/modules/adlink/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/adlink/MakefileFri Mar 23 15:35:19 2018
(r331430)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/dev/adlink
+
+KMOD=  adlink
+SRCS=  adlink.c \
+   device_if.h bus_if.h
+
+.include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331429 - head/sys/dev/xl

2018-03-23 Thread Warner Losh
Author: imp
Date: Fri Mar 23 15:35:15 2018
New Revision: 331429
URL: https://svnweb.freebsd.org/changeset/base/331429

Log:
  Add PNP info to xl as an example.

Modified:
  head/sys/dev/xl/if_xl.c

Modified: head/sys/dev/xl/if_xl.c
==
--- head/sys/dev/xl/if_xl.c Fri Mar 23 15:35:07 2018(r331428)
+++ head/sys/dev/xl/if_xl.c Fri Mar 23 15:35:15 2018(r331429)
@@ -334,6 +334,8 @@ static devclass_t xl_devclass;
 DRIVER_MODULE_ORDERED(xl, pci, xl_driver, xl_devclass, NULL, NULL,
 SI_ORDER_ANY);
 DRIVER_MODULE(miibus, xl, miibus_driver, miibus_devclass, NULL, NULL);
+MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, xl, xl_devs, 
sizeof(xl_devs[0]),
+nitems(xl_devs) - 1);
 
 static void
 xl_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331428 - head/sys/dev/ed

2018-03-23 Thread Warner Losh
Author: imp
Date: Fri Mar 23 15:35:07 2018
New Revision: 331428
URL: https://svnweb.freebsd.org/changeset/base/331428

Log:
  kill traling white space

Modified:
  head/sys/dev/ed/if_ed_pci.c

Modified: head/sys/dev/ed/if_ed_pci.c
==
--- head/sys/dev/ed/if_ed_pci.c Fri Mar 23 14:59:30 2018(r331427)
+++ head/sys/dev/ed/if_ed_pci.c Fri Mar 23 15:35:07 2018(r331428)
@@ -147,4 +147,3 @@ MODULE_DEPEND(ed, pci, 1, 1, 1);
 MODULE_DEPEND(ed, ether, 1, 1, 1);
 MODULE_PNP_INFO("W32:vendor/device;D:#", pci, ed, pci_ids, sizeof(pci_ids[0]),
 nitems(pci_ids) - 1);
-
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: 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 zlibW

2018-03-23 Thread Ruslan Bukin
On Fri, Mar 23, 2018 at 11:52:27AM +, Ruslan Bukin wrote:
> On Fri, Mar 23, 2018 at 08:46:36AM +, Ruslan Bukin wrote:
> > On Sat, Mar 17, 2018 at 03:49:15PM -0600, Alan Somers wrote:
> > >On Tue, Mar 13, 2018 at 9:00 PM, Conrad Meyer <[1]c...@freebsd.org> 
> > > wrote:
> > > 
> > >  Author: cem
> > >  Date: Wed Mar 14 03:00:17 2018
> > >  New Revision: 330894
> > >  URL: [2]https://svnweb.freebsd.org/changeset/base/330894
> > > 
> > >  Log:
> > >    Update to Zstandard 1.3.3
> > > 
> > >I think this broke the build on RISC-V.  Could you please take a look?
> > 
> > I can confirm it breaks RISC-V
> > 
> 
> I found the problem: after this commit kernel become slightly bigger: it was 
> 0x5fd080 bytes, become 0x61b080 bytes.
> 
> Spike gives us 0x60 free space only between start of physram to place 
> where it puts DTB.
> So DTB appears under our BSS section and we clear it during boot, so DTB is 
> no longer valid and kernel get stuck in fdt header checking routine.
> 
> I'm currently looking for a solution and rearrangements, it will take some 
> time.
> 

I found that Berkeley Boot Loader (BBL) miscalculates the size of payload 
(freebsd kernel) -- they does not include BSS section to calculatons.

I made a fix to our local riscv-pk (https://github.com/freebsd-riscv/riscv-pk) 
and created a pull request:
https://github.com/riscv/riscv-pk/pull/91

Thanks

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


svn commit: r331426 - head/sys/compat/linux

2018-03-23 Thread Ed Maste
Author: emaste
Date: Fri Mar 23 14:39:34 2018
New Revision: 331426
URL: https://svnweb.freebsd.org/changeset/base/331426

Log:
  Rationalize license text on Linuxolator files
  
  Many licenses on Linuxolator files contained small variations from the
  standard FreeBSD license text.  To avoid license proliferation switch to
  the standard 2-Clause FreeBSD license for those files where I have
  permission from each of the listed copyright holders.
  
  Approved by:  rdivacky, marcel
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/compat/linux/linux_ioctl.h
  head/sys/compat/linux/linux_ipc.h
  head/sys/compat/linux/linux_mib.h
  head/sys/compat/linux/linux_misc.h
  head/sys/compat/linux/linux_signal.h

Modified: head/sys/compat/linux/linux_ioctl.h
==
--- head/sys/compat/linux/linux_ioctl.h Fri Mar 23 14:38:56 2018
(r331425)
+++ head/sys/compat/linux/linux_ioctl.h Fri Mar 23 14:39:34 2018
(r331426)
@@ -1,5 +1,5 @@
 /*-
- * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 1999 Marcel Moolenaar
  * All rights reserved.
@@ -8,24 +8,22 @@
  * 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 
- *in this position and unchanged.
+ *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.
- * 3. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  *
  * $FreeBSD$
  */

Modified: head/sys/compat/linux/linux_ipc.h
==
--- head/sys/compat/linux/linux_ipc.h   Fri Mar 23 14:38:56 2018
(r331425)
+++ head/sys/compat/linux/linux_ipc.h   Fri Mar 23 14:39:34 2018
(r331426)
@@ -1,5 +1,5 @@
 /*-
- * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2000 Marcel Moolenaar
  * All rights reserved.
@@ -8,24 +8,22 @@
  * 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 
- *in this position and unchanged.
+ *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.
- * 3. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,

svn commit: r331425 - head/sys/vm

2018-03-23 Thread Mark Johnston
Author: markj
Date: Fri Mar 23 14:38:56 2018
New Revision: 331425
URL: https://svnweb.freebsd.org/changeset/base/331425

Log:
  Correct a couple of assertion messages in vm_page_reclaim_run().
  
  MFC after:3 days

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Fri Mar 23 14:36:24 2018(r331424)
+++ head/sys/vm/vm_page.c   Fri Mar 23 14:38:56 2018(r331425)
@@ -2473,7 +2473,7 @@ retry:
goto unlock;
}
KASSERT(m_new->wire_count == 0,
-   ("page %p is wired", m));
+   ("page %p is wired", m_new));
 
/*
 * Replace "m" with the new page.  For
@@ -2485,7 +2485,7 @@ retry:
pmap_remove_all(m);
m_new->aflags = m->aflags;
KASSERT(m_new->oflags == VPO_UNMANAGED,
-   ("page %p is managed", m));
+   ("page %p is managed", m_new));
m_new->oflags = m->oflags & VPO_NOSYNC;
pmap_copy_page(m, m_new);
m_new->valid = m->valid;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331422 - in head/sys/dev: mpr mps

2018-03-23 Thread Kenneth D. Merry
Author: ken
Date: Fri Mar 23 13:52:26 2018
New Revision: 331422
URL: https://svnweb.freebsd.org/changeset/base/331422

Log:
  Disable T10 Protection Information / EEDP handling for type 2 protection.
  
  The mps(4) and mpr(4) drivers and hardware handle T10 Protection
  Information, which is a system of checksums and guard blocks to protect
  data while it is being transferred and while it is on disk.  It is also
  known as T10 DIF.  For more details, see section 4.22 of the SBC-4 spec.
  
  Supporting Type 2 protection requires using 32 byte CDBs, and filling in
  the fields in those CDBs.  We don't yet support that in the da(4) driver.
  
  Type 1 and Type 3 protection don't require that, and can be handled by
  the mps(4)/mpr(4) driver's code and firmware without any additional
  input from the da(4) driver.
  
  If a drive has Type 2 protection enabled (you frequently see this with
  SAS drives shipped from Dell), don't set the various EEDP fields in the
  mps(4)/mpr(4) driver command fields.  Otherwise, you wind up with errors
  like this that would otherwise make no sense:
  
  (da9:mpr0:0:18:0): READ(10). CDB: 28 00 00 00 00 00 00 02 00 00
  (da9:mpr0:0:18:0): CAM status: SCSI Status Error
  (da9:mpr0:0:18:0): SCSI status: Check Condition
  (da9:mpr0:0:18:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command 
operation code)
  (da9:mpr0:0:18:0):
  (da9:mpr0:0:18:0): Field Replaceable Unit: 0
  (da9:mpr0:0:18:0): Command Specific Info: 0
  (da9:mpr0:0:18:0):
  (da9:mpr0:0:18:0): Descriptor 0x80: f8 21
  (da9:mpr0:0:18:0): Descriptor 0x81: 00 00 00 00 00 00
  (da9:mpr0:0:18:0): Error 22, Unretryable error
  
  In other words, what kind of strange SAS hard drive doesn't support a
  standard 10 byte SCSI READ command?  In this case, one that has Type 2
  protection enabled.
  
  We can revisit this when we put Type 2 protection support in the da(4)
  driver, but for now this will help people who put Type 2 formatted drives
  in a system and wonder what in the world is going on.
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mps/mps_sas.c

Modified: head/sys/dev/mpr/mpr_sas.c
==
--- head/sys/dev/mpr/mpr_sas.c  Fri Mar 23 11:08:59 2018(r331421)
+++ head/sys/dev/mpr/mpr_sas.c  Fri Mar 23 13:52:26 2018(r331422)
@@ -2130,8 +2130,8 @@ mprsas_action_scsiio(struct mprsas_softc *sassc, union
CDB.EEDP32.PrimaryReferenceTag);
req->CDB.EEDP32.PrimaryApplicationTagMask =
0x;
-   req->CDB.CDB32[1] = (req->CDB.CDB32[1] & 0x1F) |
-   0x20;
+   req->CDB.CDB32[1] =
+   (req->CDB.CDB32[1] & 0x1F) | 0x20;
} else {
eedp_flags |=
MPI2_SCSIIO_EEDPFLAGS_INC_PRI_APPTAG;
@@ -3502,8 +3502,19 @@ mprsas_async(void *callback_arg, uint32_t code, struct
 
if ((mprsas_get_ccbstatus((union ccb *)) == CAM_REQ_CMP)
&& (rcap_buf.prot & SRC16_PROT_EN)) {
-   lun->eedp_formatted = TRUE;
-   lun->eedp_block_size = scsi_4btoul(rcap_buf.length);
+   switch (rcap_buf.prot & SRC16_P_TYPE) {
+   case SRC16_PTYPE_1:
+   case SRC16_PTYPE_3:
+   lun->eedp_formatted = TRUE;
+   lun->eedp_block_size =
+   scsi_4btoul(rcap_buf.length);
+   break;
+   case SRC16_PTYPE_2:
+   default:
+   lun->eedp_formatted = FALSE;
+   lun->eedp_block_size = 0;
+   break;
+   }
} else {
lun->eedp_formatted = FALSE;
lun->eedp_block_size = 0;

Modified: head/sys/dev/mps/mps_sas.c
==
--- head/sys/dev/mps/mps_sas.c  Fri Mar 23 11:08:59 2018(r331421)
+++ head/sys/dev/mps/mps_sas.c  Fri Mar 23 13:52:26 2018(r331422)
@@ -3231,8 +3231,19 @@ mpssas_async(void *callback_arg, uint32_t code, struct
 
if ((mpssas_get_ccbstatus((union ccb *)) == CAM_REQ_CMP)
 && (rcap_buf.prot & SRC16_PROT_EN)) {
-   lun->eedp_formatted = TRUE;
-   lun->eedp_block_size = scsi_4btoul(rcap_buf.length);
+   switch (rcap_buf.prot & SRC16_P_TYPE) {
+   case SRC16_PTYPE_1:
+   case SRC16_PTYPE_3:
+   lun->eedp_formatted = TRUE;
+   

Re: 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 zlibW

2018-03-23 Thread Ruslan Bukin
On Fri, Mar 23, 2018 at 08:46:36AM +, Ruslan Bukin wrote:
> On Sat, Mar 17, 2018 at 03:49:15PM -0600, Alan Somers wrote:
> >On Tue, Mar 13, 2018 at 9:00 PM, Conrad Meyer <[1]c...@freebsd.org> 
> > wrote:
> > 
> >  Author: cem
> >  Date: Wed Mar 14 03:00:17 2018
> >  New Revision: 330894
> >  URL: [2]https://svnweb.freebsd.org/changeset/base/330894
> > 
> >  Log:
> >    Update to Zstandard 1.3.3
> > 
> >I think this broke the build on RISC-V.  Could you please take a look?
> 
> I can confirm it breaks RISC-V
> 

I found the problem: after this commit kernel become slightly bigger: it was 
0x5fd080 bytes, become 0x61b080 bytes.

Spike gives us 0x60 free space only between start of physram to place where 
it puts DTB.
So DTB appears under our BSS section and we clear it during boot, so DTB is no 
longer valid and kernel get stuck in fdt header checking routine.

I'm currently looking for a solution and rearrangements, it will take some time.

Thanks

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


svn commit: r331421 - head/sys/dev/usb/controller

2018-03-23 Thread Andrew Turner
Author: andrew
Date: Fri Mar 23 11:08:59 2018
New Revision: 331421
URL: https://svnweb.freebsd.org/changeset/base/331421

Log:
  If sc->sc_ep_max is already set use it to find the number of RX and TX
  endpoints. The Allwinner driver will need to set this as the EPINFO
  register isn't useful there.
  
  Submitted by: jmcneill
  Reviewed by:  hselasky
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D5881

Modified:
  head/sys/dev/usb/controller/musb_otg.c

Modified: head/sys/dev/usb/controller/musb_otg.c
==
--- head/sys/dev/usb/controller/musb_otg.c  Fri Mar 23 09:42:47 2018
(r331420)
+++ head/sys/dev/usb/controller/musb_otg.c  Fri Mar 23 11:08:59 2018
(r331421)
@@ -3168,19 +3168,24 @@ musbotg_init(struct musbotg_softc *sc)
 
MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0);
 
-   /* read out number of endpoints */
+   if (sc->sc_ep_max == 0) {
+   /* read out number of endpoints */
 
-   nrx =
-   (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) / 16);
+   nrx =
+   (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) / 16);
 
-   ntx =
-   (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) % 16);
+   ntx =
+   (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) % 16);
 
+   sc->sc_ep_max = (nrx > ntx) ? nrx : ntx;
+   } else {
+   nrx = ntx = sc->sc_ep_max;
+   }
+
/* these numbers exclude the control endpoint */
 
DPRINTFN(2, "RX/TX endpoints: %u/%u\n", nrx, ntx);
 
-   sc->sc_ep_max = (nrx > ntx) ? nrx : ntx;
if (sc->sc_ep_max == 0) {
DPRINTFN(2, "ERROR: Looks like the clocks are off!\n");
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r331420 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-03-23 Thread Andriy Gapon
Author: avg
Date: Fri Mar 23 09:42:47 2018
New Revision: 331420
URL: https://svnweb.freebsd.org/changeset/base/331420

Log:
  zfs: fix mismatch between format specifier and type
  
  vdev_dbgmsg_print_tree printed vdev_id of uint64_t type with %u format
  specifier.  That caused subsequent parameters to be incorrectly read
  from the stack and lead to a crash when a wrong value was interpreted as
  a string pointer.
  
  This should be upstreamed.
  
  Reported by:  pho
  MFC after:3 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Fri Mar 23 
09:40:41 2018(r331419)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Fri Mar 23 
09:42:47 2018(r331420)
@@ -237,7 +237,7 @@ vdev_dbgmsg_print_tree(vdev_t *vd, int indent)
}
 
zfs_dbgmsg("%*svdev %u: %s%s, guid: %llu, path: %s, %s", indent,
-   "", vd->vdev_id, vd->vdev_ops->vdev_op_type,
+   "", (int)vd->vdev_id, vd->vdev_ops->vdev_op_type,
vd->vdev_islog ? " (log)" : "",
(u_longlong_t)vd->vdev_guid,
vd->vdev_path ? vd->vdev_path : "N/A", state);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r331347 - in head: etc/mtree include sys/conf sys/dev/tcp_log sys/kern sys/netinet usr.bin/netstat

2018-03-23 Thread Jonathan Looney
On Thu, Mar 22, 2018 at 9:05 PM, Justin Hibbits 
wrote:

> On Thu, Mar 22, 2018 at 3:44 PM, Andriy Gapon  wrote:
> > On 22/03/2018 17:39, Jonathan Looney wrote:
> >> A tinderbox build didn't complain about atomic_fetchadd_64, so I assume
> it is OK.
> >>
> > FWWI, TARGET=powerpc TARGET_ARCH=powerpc build failed for me.
> >
> > cc1: warnings being treated as errors
> > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c: In function
> 'tcp_log_selectauto':
> > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: implicit
> declaration
> > of function 'atomic_fetchadd_64'
> > /usr/devel/svn/head/sys/netinet/tcp_log_buf.c:286: warning: nested
> extern
> > declaration of 'atomic_fetchadd_64' [-Wnested-externs]
>
> mips complains, too.  Check out https://ci.freebsd.org/tinderbox .
>

Thanks for all the reports! I'm working on a fix now.

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


svn commit: r331419 - head/lib/libusb

2018-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar 23 09:40:41 2018
New Revision: 331419
URL: https://svnweb.freebsd.org/changeset/base/331419

Log:
  Allow the libusb20_dev_get_port_path() function to be called when the
  USB device is closed. This fixes a compatibility issue with upstream
  libusb.
  
  Found by: romain@
  MFC after:1 week

Modified:
  head/lib/libusb/libusb20.c
  head/lib/libusb/libusb20_int.h
  head/lib/libusb/libusb20_ugen20.c

Modified: head/lib/libusb/libusb20.c
==
--- head/lib/libusb/libusb20.c  Fri Mar 23 05:37:18 2018(r331418)
+++ head/lib/libusb/libusb20.c  Fri Mar 23 09:40:41 2018(r331419)
@@ -77,7 +77,6 @@ dummy_callback(struct libusb20_transfer *xfer)
 #definedummy_check_connected (void *)dummy_int
 #definedummy_set_power_mode (void *)dummy_int
 #definedummy_get_power_mode (void *)dummy_int
-#definedummy_get_port_path (void *)dummy_int
 #definedummy_get_power_usage (void *)dummy_int
 #definedummy_kernel_driver_active (void *)dummy_int
 #definedummy_detach_kernel_driver (void *)dummy_int
@@ -745,7 +744,26 @@ libusb20_dev_get_power_mode(struct libusb20_device *pd
 int
 libusb20_dev_get_port_path(struct libusb20_device *pdev, uint8_t *buf, uint8_t 
bufsize)
 {
-   return (pdev->methods->get_port_path(pdev, buf, bufsize));
+
+   if (pdev->port_level == 0) {
+   /*
+* Fallback for backends without port path:
+*/
+   if (bufsize < 2)
+   return (LIBUSB20_ERROR_OVERFLOW);
+   buf[0] = pdev->parent_address;
+   buf[1] = pdev->parent_port;
+   return (2);
+   }
+
+   /* check if client buffer is too small */
+   if (pdev->port_level > bufsize)
+   return (LIBUSB20_ERROR_OVERFLOW);
+
+   /* copy port number information */
+   memcpy(buf, pdev->port_path, pdev->port_level);
+
+   return (pdev->port_level);  /* success */
 }
 
 uint16_t

Modified: head/lib/libusb/libusb20_int.h
==
--- head/lib/libusb/libusb20_int.h  Fri Mar 23 05:37:18 2018
(r331418)
+++ head/lib/libusb/libusb20_int.h  Fri Mar 23 09:40:41 2018
(r331419)
@@ -107,7 +107,6 @@ typedef int (libusb20_process_t)(struct libusb20_devic
 typedef int (libusb20_reset_device_t)(struct libusb20_device *pdev);
 typedef int (libusb20_set_power_mode_t)(struct libusb20_device *pdev, uint8_t 
power_mode);
 typedef int (libusb20_get_power_mode_t)(struct libusb20_device *pdev, uint8_t 
*power_mode);
-typedef int (libusb20_get_port_path_t)(struct libusb20_device *pdev, uint8_t 
*buf, uint8_t bufsize);
 typedef int (libusb20_get_power_usage_t)(struct libusb20_device *pdev, 
uint16_t *power_usage);
 typedef int (libusb20_set_alt_index_t)(struct libusb20_device *pdev, uint8_t 
iface_index, uint8_t alt_index);
 typedef int (libusb20_set_config_index_t)(struct libusb20_device *pdev, 
uint8_t index);
@@ -131,7 +130,6 @@ typedef void (libusb20_tr_cancel_async_t)(struct libus
   m(n, check_connected) \
   m(n, set_power_mode) \
   m(n, get_power_mode) \
-  m(n, get_port_path) \
   m(n, get_power_usage) \
   m(n, set_alt_index) \
   m(n, set_config_index) \
@@ -237,8 +235,11 @@ struct libusb20_device {
uint8_t is_opened;
uint8_t parent_address;
uint8_t parent_port;
+   uint8_t port_level;
 
charusb_desc[96];
+#defineLIBUSB20_DEVICE_PORT_PATH_MAX   32
+   uint8_t port_path[LIBUSB20_DEVICE_PORT_PATH_MAX];
 };
 
 extern const struct libusb20_backend_methods libusb20_ugen20_backend;

Modified: head/lib/libusb/libusb20_ugen20.c
==
--- head/lib/libusb/libusb20_ugen20.c   Fri Mar 23 05:37:18 2018
(r331418)
+++ head/lib/libusb/libusb20_ugen20.c   Fri Mar 23 09:40:41 2018
(r331419)
@@ -79,7 +79,6 @@ static libusb20_reset_device_t ugen20_reset_device;
 static libusb20_check_connected_t ugen20_check_connected;
 static libusb20_set_power_mode_t ugen20_set_power_mode;
 static libusb20_get_power_mode_t ugen20_get_power_mode;
-static libusb20_get_port_path_t ugen20_get_port_path;
 static libusb20_get_power_usage_t ugen20_get_power_usage;
 static libusb20_kernel_driver_active_t ugen20_kernel_driver_active;
 static libusb20_detach_kernel_driver_t ugen20_detach_kernel_driver;
@@ -136,6 +135,7 @@ ugen20_enumerate(struct libusb20_device *pdev, const c
const char *tmp = id;
struct usb_device_descriptor ddesc;
struct usb_device_info devinfo;
+   struct usb_device_port_path udpp;
uint32_t plugtime;
char buf[64];
int f;
@@ -219,6 +219,13 @@ ugen20_enumerate(struct libusb20_device *pdev, const c
pdev->device_address, devinfo.udi_vendor,
devinfo.udi_product, 

Re: 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 zlibW

2018-03-23 Thread Ruslan Bukin
On Sat, Mar 17, 2018 at 03:49:15PM -0600, Alan Somers wrote:
>On Tue, Mar 13, 2018 at 9:00 PM, Conrad Meyer <[1]c...@freebsd.org> wrote:
> 
>  Author: cem
>  Date: Wed Mar 14 03:00:17 2018
>  New Revision: 330894
>  URL: [2]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
>  [3]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
> 
>I think this broke the build on RISC-V.  Could you please take a look?
> 
>[4]https://ci.freebsd.org/job/FreeBSD-head-riscv64-build/7028/console
> 

I can confirm it breaks RISC-V

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


Re: svn commit: r328988 - in head/sys: conf modules/ipfw netinet netpfil/ipfw

2018-03-23 Thread Adrian Chadd
Hi!

It looks like this broke on mips32. I posted in -net on this.

In addition i can't even build the concurrencykit regression suite
from github. It just plainly fails to build, so I can't even attempt
to cross compile it for mips to test things.

Did you test this on any platform besides 64 bit intel?

Thanks!



-adrian


On 7 February 2018 at 10:59, Andrey V. Elsukov  wrote:
> Author: ae
> Date: Wed Feb  7 18:59:54 2018
> New Revision: 328988
> URL: https://svnweb.freebsd.org/changeset/base/328988
>
> Log:
>   Rework ipfw dynamic states implementation to be lockless on fast path.
>
>   o added struct ipfw_dyn_info that keeps all needed for ipfw_chk and
> for dynamic states implementation information;
>   o added DYN_LOOKUP_NEEDED() macro that can be used to determine the
> need of new lookup of dynamic states;
>   o ipfw_dyn_rule now becomes obsolete. Currently it used to pass
> information from kernel to userland only.
>   o IPv4 and IPv6 states now described by different structures
> dyn_ipv4_state and dyn_ipv6_state;
>   o IPv6 scope zones support is added;
>   o ipfw(4) now depends from Concurrency Kit;
>   o states are linked with "entry" field using CK_SLIST. This allows
> lockless lookup and protected by mutex modifications.
>   o the "expired" SLIST field is used for states expiring.
>   o struct dyn_data is used to keep generic information for both IPv4
> and IPv6;
>   o struct dyn_parent is used to keep O_LIMIT_PARENT information;
>   o IPv4 and IPv6 states are stored in different hash tables;
>   o O_LIMIT_PARENT states now are kept separately from O_LIMIT and
> O_KEEP_STATE states;
>   o per-cpu dyn_hp pointers are used to implement hazard pointers and they
> prevent freeing states that are locklessly used by lookup threads;
>   o mutexes to protect modification of lists in hash tables now kept in
> separate arrays. 65535 limit to maximum number of hash buckets now
> removed.
>   o Separate lookup and install functions added for IPv4 and IPv6 states
> and for parent states.
>   o By default now is used Jenkinks hash function.
>
>   Obtained from:Yandex LLC
>   MFC after:42 days
>   Sponsored by: Yandex LLC
>   Differential Revision:https://reviews.freebsd.org/D12685
>
> Modified:
>   head/sys/conf/files
>   head/sys/modules/ipfw/Makefile
>   head/sys/netinet/ip_fw.h
>   head/sys/netpfil/ipfw/ip_fw2.c
>   head/sys/netpfil/ipfw/ip_fw_dynamic.c
>   head/sys/netpfil/ipfw/ip_fw_private.h
>   head/sys/netpfil/ipfw/ip_fw_sockopt.c
>
> Modified: head/sys/conf/files
> ==
> --- head/sys/conf/files Wed Feb  7 18:50:36 2018(r328987)
> +++ head/sys/conf/files Wed Feb  7 18:59:54 2018(r328988)
> @@ -4374,7 +4374,8 @@ netpfil/ipfw/ip_dn_io.c   optional inet dummynet
>  netpfil/ipfw/ip_dn_glue.c  optional inet dummynet
>  netpfil/ipfw/ip_fw2.c  optional inet ipfirewall
>  netpfil/ipfw/ip_fw_bpf.c   optional inet ipfirewall
> -netpfil/ipfw/ip_fw_dynamic.c   optional inet ipfirewall
> +netpfil/ipfw/ip_fw_dynamic.c   optional inet ipfirewall \
> +   compile-with "${NORMAL_C} -I$S/contrib/ck/include"
>  netpfil/ipfw/ip_fw_eaction.c   optional inet ipfirewall
>  netpfil/ipfw/ip_fw_log.c   optional inet ipfirewall
>  netpfil/ipfw/ip_fw_pfil.c  optional inet ipfirewall
>
> Modified: head/sys/modules/ipfw/Makefile
> ==
> --- head/sys/modules/ipfw/Makefile  Wed Feb  7 18:50:36 2018
> (r328987)
> +++ head/sys/modules/ipfw/Makefile  Wed Feb  7 18:59:54 2018
> (r328988)
> @@ -9,7 +9,7 @@ SRCS+=  ip_fw_sockopt.c ip_fw_table.c ip_fw_table_algo.
>  SRCS+= ip_fw_table_value.c
>  SRCS+= opt_inet.h opt_inet6.h opt_ipdivert.h opt_ipfw.h
>
> -CFLAGS+= -DIPFIREWALL
> +CFLAGS+= -DIPFIREWALL -I${SRCTOP}/sys/contrib/ck/include
>  #
>  #If you want it verbose
>  #CFLAGS+= -DIPFIREWALL_VERBOSE
>
> Modified: head/sys/netinet/ip_fw.h
> ==
> --- head/sys/netinet/ip_fw.hWed Feb  7 18:50:36 2018(r328987)
> +++ head/sys/netinet/ip_fw.hWed Feb  7 18:59:54 2018(r328988)
> @@ -671,7 +671,7 @@ struct ipfw_flow_id {
> uint32_tsrc_ip;
> uint16_tdst_port;
> uint16_tsrc_port;
> -   uint8_t fib;
> +   uint8_t fib;/* XXX: must be uint16_t */
> uint8_t proto;
> uint8_t _flags; /* protocol-specific flags */
> uint8_t addr_type; /* 4=ip4, 6=ip6, 1=ether ? */
> @@ -682,6 +682,7 @@ struct ipfw_flow_id {
>  };
>  #endif
>
> +#defineIS_IP4_FLOW_ID(id)  ((id)->addr_type == 4)
>  #define IS_IP6_FLOW_ID(id) ((id)->addr_type == 6)
>
>  /*
>
> Modified: head/sys/netpfil/ipfw/ip_fw2.c
> 

Re: svn commit: r331369 - head/sys/vm

2018-03-23 Thread Cy Schubert
In message <20180323150709.h...@besplex.bde.org>, Bruce Evans writes:
> On Thu, 22 Mar 2018, Jeff Roberson wrote:
>
> > On Thu, 22 Mar 2018, Cy Schubert wrote:
> >
> >> It broke i386 too.
> >
> > I just did
> > TARGET_ARCH=i386 make buildworld
> > TARGET_ARCH=i386 make buildkernel
> >
> > This worked for me?
> >> 
> >> Index: sys/vm/vm_reserv.c
> >> ===
> >> --- sys/vm/vm_reserv.c (revision 331399)
> >> +++ sys/vm/vm_reserv.c (working copy)
> >> @@ -45,8 +45,6 @@
> >> 
> >> #include 
> >> #include 
> >> -#include 
> >> -#include 
> >> #include 
> >> #include 
> >> #include 
> >> @@ -55,6 +53,8 @@
> >> #include 
> >> #include 
> >> #include 
> >> +#include 
> >> +#include 
> >> #include 
> >> #include 
> >> 
> >> This is because sys/i386/include/machine.h uses critical_enter() and
> >> critical_exit() which are defined in sys/systm.h.
>
> Wrong fix.  I see you committed this.  Now there are more bugs to fix.
>
>  is a prerequisite for all kernel headers except
> , since it defines and declares things like KASSERT() and
> critical_enter() which might be used in other headers (except
> sys/param.h and its standard pollution).  Sometimes sys/systm.h is
> included as undocumented namespace pollution in headers that are
> accidentally included before the (other) ones that use KASSERT(), etc.
> The headers that have this bug have it to work around bugs in .c files
> like the one above.  It is more usual to have this bug by not including
> sys/systm.h at all than to have it by including it in a wrong order.
> Sorting it alphabetically almost always gives a wrong order.  It must
> be included after sys/param.h and that must be included first.

Agreed on alphabetic sorting.

>
> It is a related bug to include only sys/types.h and not sys/param.h.
> This requires chumminess with the current implementation and all
> future implementations.  sys/param.h provides certain undocumented
> but standard namespace pollution which might vary with the implementation,
> as necessary to satisfy some of the pollution requirements of all current
> and future implementations of other headers.  (The pollution should be
> monotonically decreasing but it was only that for a few years about 20
> years ago when I worked on fixing it.)  .c files that include sys/types.h
> instead of sys/param.h have do some subset of the includes in sys/param.h.
> Since nothing is documented and the subset might depend on the arch and
> user options, it is hard to know the minimal subset.

That's not the case here. sys/types.h is not included in this file but 
point taken.

>
> .c files that include sys/types.h tend to have lots of other #include
> bugs like not including sys/systm.h.  Again it is hard to know the
> minimal replacement for sys/systm.h and its undocumented but standard
> pollution.  It is a style bug to include both sys/types.h and sys/param.h.
> style(9) even explicitly forbids including both.  It is a larger style
> bug to include the standard pollution in sys/systm.h direction.  This
> includes especially  and .  These
> should be considered as being implemented in sys/systm.h, with the
>  headers for them only and implementation detail.  Similarly
> for .
>
> >> It built nicely on my amd64's though.
>
> amd64 apparently has more namespace pollution which breaks detection
> of the bug.  But I couldn't find where it is.  sys/systm.h isn't included
> nested in any amd64 or x86 headers.  Apparently some amd64 option gives
> it.

The reason is amd64 doesn't use critical_enter() and critical_exit() 
because counter_enter() and counter_exit() are NOPs. The reason they 
are NOPs in amd64 and not in i386 is not all i386 processors support 
cmpxchg8b. It is only then that the critical_*() functions are called.

>
> Bruce

I can create a phabricator revision to clean this instance up and move 
sys/systm.h just after sys/param.h. I'm just about to head out of town 
so I'll create it after I get back, after April 4.

Thank you for your input Bruce.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


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