svn commit: r313430 - head/sys/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 07:09:10 2017
New Revision: 313430
URL: https://svnweb.freebsd.org/changeset/base/313430

Log:
  [iwm] Remove 1s delay after fw loading. Can't reproduce issues on AC8260.
  
  The 1s delay was added in the update to version 16 fw, where Family 8000
  support was added.
  
  Obtained from:DragonflyBSD commit 
bb480ca679a7ea530bdca6e41082d5755e9751dc

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Wed Feb  8 07:08:13 2017(r313429)
+++ head/sys/dev/iwm/if_iwm.c   Wed Feb  8 07:09:10 2017(r313430)
@@ -2678,12 +2678,6 @@ iwm_load_firmware(struct iwm_softc *sc, 
}
}
 
-   /*
-* Give the firmware some time to initialize.
-* Accessing it too early causes errors.
-*/
-   msleep(, >sc_mtx, 0, "iwmfwinit", hz);
-
return error;
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313429 - head/sys/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 07:08:13 2017
New Revision: 313429
URL: https://svnweb.freebsd.org/changeset/base/313429

Log:
  [iwm] SCAN_ABORT_UMAC response doesn't use a wide id
  
  Obtained from:DragonflyBSD commit 
cef47a9cbb0a3ce5f18369fed9403d2764884bc2

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Wed Feb  8 07:07:23 2017(r313428)
+++ head/sys/dev/iwm/if_iwm.c   Wed Feb  8 07:08:13 2017(r313429)
@@ -5482,7 +5482,7 @@ iwm_notif_intr(struct iwm_softc *sc)
case IWM_TIME_EVENT_CMD:
case IWM_WIDE_ID(IWM_ALWAYS_LONG_GROUP, IWM_SCAN_CFG_CMD):
case IWM_WIDE_ID(IWM_ALWAYS_LONG_GROUP, IWM_SCAN_REQ_UMAC):
-   case IWM_WIDE_ID(IWM_ALWAYS_LONG_GROUP, IWM_SCAN_ABORT_UMAC):
+   case IWM_SCAN_ABORT_UMAC:
case IWM_SCAN_OFFLOAD_REQUEST_CMD:
case IWM_SCAN_OFFLOAD_ABORT_CMD:
case IWM_REPLY_BEACON_FILTERING_CMD:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313428 - in head/sys: conf modules/iwmfw/iwm8000Cfw

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 07:07:23 2017
New Revision: 313428
URL: https://svnweb.freebsd.org/changeset/base/313428

Log:
  [iwm] back this out to version 16 for now.
  
  Since I'm manually playing the dragonflybsd iwm/iwmfw commits forward, I'm ..
  well, this.  This right here.

Modified:
  head/sys/conf/files
  head/sys/modules/iwmfw/iwm8000Cfw/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Feb  8 07:05:56 2017(r313427)
+++ head/sys/conf/files Wed Feb  8 07:07:23 2017(r313428)
@@ -1939,7 +1939,7 @@ iwm8000Cfw.fwooptional iwm8000Cfw | i
no-implicit-rule\
clean   "iwm8000Cfw.fwo"
 iwm8000C.fwoptional iwm8000Cfw | iwmfw \
-   dependency  "$S/contrib/dev/iwm/iwm-8000C-17.fw.uu" \
+   dependency  "$S/contrib/dev/iwm/iwm-8000C-16.fw.uu" \
compile-with"${NORMAL_FW}"  \
no-obj no-implicit-rule \
clean   "iwm8000C.fw"

Modified: head/sys/modules/iwmfw/iwm8000Cfw/Makefile
==
--- head/sys/modules/iwmfw/iwm8000Cfw/Makefile  Wed Feb  8 07:05:56 2017
(r313427)
+++ head/sys/modules/iwmfw/iwm8000Cfw/Makefile  Wed Feb  8 07:07:23 2017
(r313428)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
 KMOD=  iwm8000Cfw
-IMG=   iwm-8000C-17
+IMG=   iwm-8000C-16
 
 .include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313427 - head/sys/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 07:05:56 2017
New Revision: 313427
URL: https://svnweb.freebsd.org/changeset/base/313427

Log:
  [iwm] Recognize the IWM_UCODE_TLV_FW_MEM_SEG firmware section type.
  
  * Will be needed for loading version 22 of 7265D firmware.
  
  Obtained from:DragonflyBSD commit 
1d244c8133cf15d00d46836bc48958188cf9f510

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Wed Feb  8 07:04:06 2017(r313426)
+++ head/sys/dev/iwm/if_iwm.c   Wed Feb  8 07:05:56 2017(r313427)
@@ -892,6 +892,9 @@ iwm_read_firmware(struct iwm_softc *sc, 
le32toh(((const uint32_t *)tlv_data)[2]));
break;
 
+   case IWM_UCODE_TLV_FW_MEM_SEG:
+   break;
+
default:
device_printf(sc->sc_dev,
"%s: unknown firmware section %d, abort\n",

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hWed Feb  8 07:04:06 2017
(r313426)
+++ head/sys/dev/iwm/if_iwmreg.hWed Feb  8 07:05:56 2017
(r313427)
@@ -1006,6 +1006,7 @@ enum iwm_ucode_tlv_type {
IWM_UCODE_TLV_FW_DBG_CONF   = 39,
IWM_UCODE_TLV_FW_DBG_TRIGGER= 40,
IWM_UCODE_TLV_FW_GSCAN_CAPA = 50,
+   IWM_UCODE_TLV_FW_MEM_SEG= 51,
 };
 
 struct iwm_ucode_tlv {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313424 - svnadmin/conf

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 07:03:24 2017
New Revision: 313424
URL: https://svnweb.freebsd.org/changeset/base/313424

Log:
  No need for more of that thanks.
  
  Approved by:  core (implicit)

Modified:
  svnadmin/conf/sizelimit.conf

Modified: svnadmin/conf/sizelimit.conf
==
--- svnadmin/conf/sizelimit.confWed Feb  8 07:03:09 2017
(r313423)
+++ svnadmin/conf/sizelimit.confWed Feb  8 07:03:24 2017
(r313424)
@@ -27,4 +27,3 @@ np
 obrien
 peter
 rwatson
-adrian
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313425 - head/sys/conf

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 07:03:52 2017
New Revision: 313425
URL: https://svnweb.freebsd.org/changeset/base/313425

Log:
  [iwm] add version 17 firmware.

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Feb  8 07:03:24 2017(r313424)
+++ head/sys/conf/files Wed Feb  8 07:03:52 2017(r313425)
@@ -1897,7 +1897,7 @@ iwm3160fw.fwo optional iwm3160fw | iwm
no-implicit-rule\
clean   "iwm3160fw.fwo"
 iwm3160.fw optional iwm3160fw | iwmfw  \
-   dependency  "$S/contrib/dev/iwm/iwm-3160-16.fw.uu" \
+   dependency  "$S/contrib/dev/iwm/iwm-3160-17.fw.uu" \
compile-with"${NORMAL_FW}"  \
no-obj no-implicit-rule \
clean   "iwm3160.fw"
@@ -1911,7 +1911,7 @@ iwm7260fw.fwo optional iwm7260fw | iwm
no-implicit-rule\
clean   "iwm7260fw.fwo"
 iwm7260.fw optional iwm7260fw | iwmfw  \
-   dependency  "$S/contrib/dev/iwm/iwm-7260-16.fw.uu" \
+   dependency  "$S/contrib/dev/iwm/iwm-7260-17.fw.uu" \
compile-with"${NORMAL_FW}"  \
no-obj no-implicit-rule \
clean   "iwm7260.fw"
@@ -1925,7 +1925,7 @@ iwm7265fw.fwo optional iwm7265fw | iwm
no-implicit-rule\
clean   "iwm7265fw.fwo"
 iwm7265.fw optional iwm7265fw | iwmfw  \
-   dependency  "$S/contrib/dev/iwm/iwm-7265-16.fw.uu" \
+   dependency  "$S/contrib/dev/iwm/iwm-7265-17.fw.uu" \
compile-with"${NORMAL_FW}"  \
no-obj no-implicit-rule \
clean   "iwm7265.fw"
@@ -1939,7 +1939,7 @@ iwm8000Cfw.fwooptional iwm8000Cfw | i
no-implicit-rule\
clean   "iwm8000Cfw.fwo"
 iwm8000C.fwoptional iwm8000Cfw | iwmfw \
-   dependency  "$S/contrib/dev/iwm/iwm-8000C-16.fw.uu" \
+   dependency  "$S/contrib/dev/iwm/iwm-8000C-17.fw.uu" \
compile-with"${NORMAL_FW}"  \
no-obj no-implicit-rule \
clean   "iwm8000C.fw"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313426 - in head/sys/modules/iwmfw: iwm3160fw iwm7260fw iwm7265fw iwm8000Cfw

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 07:04:06 2017
New Revision: 313426
URL: https://svnweb.freebsd.org/changeset/base/313426

Log:
  [iwm] bump firmware to version 17.

Modified:
  head/sys/modules/iwmfw/iwm3160fw/Makefile
  head/sys/modules/iwmfw/iwm7260fw/Makefile
  head/sys/modules/iwmfw/iwm7265fw/Makefile
  head/sys/modules/iwmfw/iwm8000Cfw/Makefile

Modified: head/sys/modules/iwmfw/iwm3160fw/Makefile
==
--- head/sys/modules/iwmfw/iwm3160fw/Makefile   Wed Feb  8 07:03:52 2017
(r313425)
+++ head/sys/modules/iwmfw/iwm3160fw/Makefile   Wed Feb  8 07:04:06 2017
(r313426)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
 KMOD=  iwm3160fw
-IMG=   iwm-3160-16
+IMG=   iwm-3160-17
 
 .include 

Modified: head/sys/modules/iwmfw/iwm7260fw/Makefile
==
--- head/sys/modules/iwmfw/iwm7260fw/Makefile   Wed Feb  8 07:03:52 2017
(r313425)
+++ head/sys/modules/iwmfw/iwm7260fw/Makefile   Wed Feb  8 07:04:06 2017
(r313426)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
 KMOD=  iwm7260fw
-IMG=   iwm-7260-16
+IMG=   iwm-7260-17
 
 .include 

Modified: head/sys/modules/iwmfw/iwm7265fw/Makefile
==
--- head/sys/modules/iwmfw/iwm7265fw/Makefile   Wed Feb  8 07:03:52 2017
(r313425)
+++ head/sys/modules/iwmfw/iwm7265fw/Makefile   Wed Feb  8 07:04:06 2017
(r313426)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
 KMOD=  iwm7265fw
-IMG=   iwm-7265-16
+IMG=   iwm-7265-17
 
 .include 

Modified: head/sys/modules/iwmfw/iwm8000Cfw/Makefile
==
--- head/sys/modules/iwmfw/iwm8000Cfw/Makefile  Wed Feb  8 07:03:52 2017
(r313425)
+++ head/sys/modules/iwmfw/iwm8000Cfw/Makefile  Wed Feb  8 07:04:06 2017
(r313426)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
 KMOD=  iwm8000Cfw
-IMG=   iwm-8000C-16
+IMG=   iwm-8000C-17
 
 .include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313423 - head/sys/contrib/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 07:03:09 2017
New Revision: 313423
URL: https://svnweb.freebsd.org/changeset/base/313423

Log:
  [iwm] add this 3 megabyte firmware image.

Added:
  head/sys/contrib/dev/iwm/iwm-8000C-17.fw.uu

Added: head/sys/contrib/dev/iwm/iwm-8000C-17.fw.uu
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/dev/iwm/iwm-8000C-17.fw.uu Wed Feb  8 07:03:09 2017
(r313423)
@@ -0,0 +1,53122 @@
+begin 644 iwm-8000C-17.fw
+M`$E73`IS=')E86TZ3=7A?0V]R94-Y8VQE,31?"`(!'!``
+M0"$P```+P"0$``!@```*$`
+M``$``(:B!18@!`$!``0```'$Q!0``
+M
+M``#)HZK+"NR_;[>SV-J?H*@2
+M)"VN"OM[Z)]:'1-)
+MBXB&):Q^@4FLV\VRR$6:.F52&%E"TY(P!W2[JX&"60!'>'E_$E."J>2NA*_RWBGOMO_;^DQAVF]8/%ULJT$W"]"STML5RM(DDN([K3\US#5
+M9'!WV03*PM0=Q0$HQ.OOB86Z;1_UWHS_:'WVO?0$2,[A#@Y!VA2$U9`5G
+MYXD1(`C,DU7;E46SIN?N'F$PTY3X@Z`R_?A'D*G8PY[J;Y%+W>FEW:?H:1CQ
+M_$2,#K5'MRL"KM!U#E'-EJ,H1#EGEDS\GO;S1H4B'?0VUT++-8,4D%#@.Z
+MR@2_W',#!PB``0```(```(`!``<(``4`!0`'
+MN*T```"`1`"PK0``$P2``0```(```!$```!Q,04```$,
+MT(``2":```CU@`#L[(``E!.``(!P@0``
+M``!L(,`0#QL)(MP=P!`*`!M`(``;;@H``&&``!MN/@``80`!``!A``(;
+M;F$``&$0`!MN`0``86\``&%J``!A```;)"``'<`12`CA&!\`"&(``!LE
+M`0`;)```!24!``4D``@%.0$`!6*((,`1`@`%)``(!3D!``5BC"#`$00`!20`
+M"`4Y`0`%8I`@P!$(``4D``@%.0$`!6*4(,`1$``%)``(!3D!``5BF"#`$2``
+M!20`"`4Y`0`%8IP@P!%```4D``@%.0$`!6*@(,`1```()0``""1(".$91`CA
+M&10(P!(!`!MP"@``80\<'2($`!TF)`C`$@$;(R+H'<`0`0`C<`$``&$1`!LP
+M`0`;,.@=P!&\#P!A```;)(``'<`1"`!?<`D``&'0!\`2``D;*,P'@($`
+M`,`7U`?`$@`)(!X"!``#`%ZX/`&',!\`2X`>`@0``P!?(!\`2W`>`@0``
+MP!>G#P!A```;)``!'<`1"`!?<*(/`&$```4EX@0%)-0'P!(`"1LH``4;
+M*=P'@($``,`7T`?`$@`)@`!1LIX`>`@0``P!>5#P!A```;)``"'<`1
+M"`!?<`0``&'L'\`0__\;,^P?P!&,#P!A[!_`$```'L'\`1B`\`80``@
+M`!LD7!S`$0```&'<'<`0```=)"$!`%@Q0`!F<`@``&&`9^(8`0`3<`4`
+M`&$(`%@P"`!D,28``&$(`%@P"0``80]%`"(`7``Y]"7`$`$!$S(!`1,S`0`3
+M8N__`#($``!B`V``8@``6#@"`%@Q=P``8>@=P!!X^`$D_\`!)0`!$SD/$P$B
+M'`C`$@`!$SCH'<`1`0!2)'A%P!`!`!-P#```80@`6##8'L`0"@`30`(`$VX$
+M``!A`0`()```""5$".$9`0``80"`6#`(`&0Q80@`6&[C#P!A```3)0``
+M$R0D$,`1`(`3)```$R4X',`1D`K`$@$`$W`%``!A```3)0``$R0``"$E```A
+M)!(``&$``!,E`P`3)```(242`"$D#T0`(@H``$```0!P!```8?[_$S("`#!P
+M^/\A,OK_(3(``@!P!```8?W_$S("`#!PQ_\A,M?_(3(H`,T1#R$3(BP`S1%P
+M"L`2!`#-$70*P!((`,T1>`K`$@``S1&`"L`2\![-$80*P!(P*@=P!`/$P@=P!!P^`$D__\!
+M)0`!$SD/$P$B%`C`$@`!$SCH'<`1`0!2)'A%P!`!`!-P`@``80@`9#'C#P!A
+MC`K`$@$`$VY>``!AJ-6`@0``P!8&`1-B!`C`$`0`$V0/7``B"@``0``&`'`:
+M``!A```3)```$R4``,`7(`!8,<@@P!!P1<`0$`C`$```$R4#`!,D'`C`$1P(
+MP!$``!,D!`C`$0\4%2($`!4F#S`@(OO_,#(#`!,D&`C`$0\4%2("`!4F#R`P
+M(@``$R001<`1&`C`$1``6#$``!,E`P`3)```(24_`"$D#TP`(@H``$`!``!P
+M!```8?[_$S("`#!P^/\A,OK_(3("``!P!```8?W_$S("`#!PQ_\A,M?_(3(H
+M`,T1#R$3(BP`S1$``!,E```3)`P`S1%\"L`2``#-$0]-$R($$,41`@`3)/`<
+MP!$!`!,D[!S`$0``$R1P`!,E$!S`$0``$R4``!,DX!S`$0``$R4!`!,D<$3$
+M$60`$R101,01F-6`@0``P!8"`1-B#Q05(@P`%28!`!,D`0`3)"00P!$``!,D
+M``#`%P\4%2(0`!4F!@`3)%!$Q!$``!,D<$3$$0``%20A```;)0``!
+M`&1N`0`;)`(`9"`!LD!`!D;@0`,`!MB#QL+(@\+8R(!`!M``@`;00``
+M`&$``!LEG`N`@0`;@``,`6```;)0(!MQ#V1C(@``'20A
+M
+M
+M``#0!P`!`0$!`0$!`;T?
+M``!C+@``_P``"```
+M`0``
+M
+M
+M

svn commit: r313422 - svnadmin/conf

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 07:02:56 2017
New Revision: 313422
URL: https://svnweb.freebsd.org/changeset/base/313422

Log:
  mumble mumble 3 megabyte firmware images sigh.
  
  Approved by:  core (implicit)

Modified:
  svnadmin/conf/sizelimit.conf

Modified: svnadmin/conf/sizelimit.conf
==
--- svnadmin/conf/sizelimit.confWed Feb  8 07:02:09 2017
(r313421)
+++ svnadmin/conf/sizelimit.confWed Feb  8 07:02:56 2017
(r313422)
@@ -27,3 +27,4 @@ np
 obrien
 peter
 rwatson
+adrian
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313419 - head/sys/contrib/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 07:01:31 2017
New Revision: 313419
URL: https://svnweb.freebsd.org/changeset/base/313419

Log:
  [iwm] add version 17 firmware.

Added:
  head/sys/contrib/dev/iwm/iwm-3160-17.fw.uu

Added: head/sys/contrib/dev/iwm/iwm-3160-17.fw.uu
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/dev/iwm/iwm-3160-17.fw.uu  Wed Feb  8 07:01:31 2017
(r313419)
@@ -0,0 +1,20409 @@
+begin 644 iwm-3160-17.fw
+M`$E73`IS=')E86TZ3=7A?0V]R94-Y8VQE,31?"`(`'!``
+M0!$P0``0```(```!$```#B
+M804```$```"$?(``,"B``(RF@`#,F8``Z!.``(";@```
+M``!L(,`0#QL)(MP=P!`*`!M`(``;;@0``&$0`!MN`0``
+M810``&$/``!A```;)"``'<`1W`3`$@$``(``!A#QP=(@0`'2;H'<`0
+M`0`;,.@=P!&"!!LD"``;)00HP!'I#P!A```;)0`!<',`18=P=P!``
+M`!TD(0$`6#$/10`B`%P`.?0EP!`!`1,R`0$3,P$`$V+O_P`R!```8@-@
+M`&(``%@X`@!8,6,``&'D!,`2Z!W`$0$`4B2T'\`0`@`3<`,``&$(`%@P"`!D
+M,0<``&$/$U(B@@03)`@`$R4!`%)N`0``80$``&$```!A"`!8;NL/`&$``!,E
+M```3)"00P!$`@!,D```3)3@P'P!($*,`1\`?`$LA)QQ$/@=P!`/$P'AL7
+M%!(*'AX>'AX>'AL7%!(*'AX>'AX>'AL7%!(*'AX8M@$`
+M!0```@0```!#AY.(@<
+MB1R*'(L)P```L```!TH@$`#/3_`0`-
+M6%("``X```"`8!`!`"`0"P'0$`L!T!`+`=`0"P'0$`L!T!`+`=`0"P
+M'0$`L!T!`+`=`0"P'0$`L!T!`+`=`0"P'0$`L!T!`+`=`0"P'0$`L!T!``#_
+M``#\_@``^/X``+`=`0"P'0$`L!T!`+`=`0"P'0$`\`$!`+`=`0"P'0$`L!T!
+M`+`=`0"P'0$`P!H!`+`=`0"P'0$`-`X!`,`-`0"P'0$`L!T!`+`=`0``#@$`
+ML!T!`+`=`0"P'0$`L!T!`+`=`0#(_```W/L``+`=`0"P'0$`L!T!`'0(`0#L
+M'P$`L!T!`+`=`0"P'0$`L!T!`+`=`0"P'0$`L!T!`$@4`0"P'0$`%`D!`+`=
+M`0#H#0$`L!T!``C_``"P'0$`L!T!`+`=`0"P'0$`L!T!`+`=`0!L_@``L!T!
+M`+`=`0"P'0$`L!T!`+`=`0"P'0$`'!H!`/0,`0"P'0$`L!T!`+`=`0"8_0``
+ML!T!`/C\``!T!@$`L!T!`-@&`0"P'0$`L!T!`+`=`0!X_0``L!T!`+`=`0`T
+M_P``L!T!`(P:`0!P`@$`L!T!`+`=`0#<``$`Z!\!`+`=`0`\&@$`L!T!``@,
+M`0`H_```G!D!`+`=`0"P'0$`@`P!`+`=`0"P'0$`L!T!`%P&`0"P'0$`L!T!
+M`+`=`0"P'0$`L!T!`#P#`0"P'0$`L!T!`+`=`0"P'0$`L!T!`/@3`0"P'0$`
+ML!T!`+`=`0"P'0$`L!T!`+`=`0"P'0$`L!T!`+`=`0"P'0$`L!T!`+`=`0"P
+M'0$`L!T!`#0(`0#P'P$`L!T!`+`=`0"P'0$`L!T!`+`=`0"P'0$`//8``+`=
+M`0"P'0$`L!T!`*0?`0"``P$`L!T!`+`=`0"P'0$`L!T!`,P#`0`$%0$`2/8`
+M`+`=`0"P'0$`L!T!`+`=`0"P'0$`Y!\!`+`=`0#```#T*@$`!0```@0`
+M``!`8```#_!P!8
+M!P```/\@``P0$``$`1`.$!`0$!`0$!`0$!`0$!`0$!`0$!`0$!`0#Q`)$!`%

svn commit: r313421 - head/sys/contrib/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 07:02:09 2017
New Revision: 313421
URL: https://svnweb.freebsd.org/changeset/base/313421

Log:
  [iwm] add version 17 firmware.

Added:
  head/sys/contrib/dev/iwm/iwm-7265-17.fw.uu

Added: head/sys/contrib/dev/iwm/iwm-7265-17.fw.uu
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/dev/iwm/iwm-7265-17.fw.uu  Wed Feb  8 07:02:09 2017
(r313421)
@@ -0,0 +1,26235 @@
+begin 644 iwm-7265-17.fw
+M`$E73`IS=')E86TZ3=7A?0V]R94-Y8VQE,31?"`(`'!``
+M0!$P2``0```(```!$```#B
+M804```$```"HMH```#.``*SK@`"8W8``O!R``(#?@```
+M``!L(,`0#QL)(MP=P!`*`!M`(``;;@H``&&``!MN/```
+M80`!]``!A``(;;CX``&$0`!MN`0``84P``&%'``!A```;)"``'<`1
+MB`;A&!\`"&(``!LE`0`;)```!24!``4D``@%.0$`!6*((,`1`@`%)``(!3D!
+M``5BC"#`$00`!20`"`4Y`0`%8I`@P!$(``4D``@%.0$`!6*4(,`1$``%)``(
+M!3D!``5BF"#`$2``!20`"`4Y`0`%8IP@P!%```4D``@%.0$`!6*@(,`1```(
+M)0``""2(!N$9A`;A&4`!(!`!MP"```80\<'2($`!TFZ!W`$`$`#H'<`1
+M@@0;)`@`$*,`1O@\`80!LEY!W`$01LEY!W`$0```
+M`ALEY!W`$0@`7W`$``!AV!W`$/_^+8'<`1KP\`8=@=P!```1LPV!W`$:L/
+M`&$``!LE``$;)%P!,B``#&$0,`
+M`20```$E#T4`(@!<`#GO_P`R'```9`"`$R0!`!,E.!S`$0]W$R+@',`1`@`!
+M8@\!$R($",`1!P`3)0<.$R0$*,`1C`G`$@0HP!&0"<`2R$G'$0]P$R(!`!,P
+M!"C`$9@)P!(8*,`1#Q,#(@@`6#$#`!,D```3)00(P!$``!,D.$7`$04``&$`
+M`%@X!`!8,0``$R0!`!,E.!S`$0``%20AZ!W`$`\3!R(/9`$B"@`!0`@`
+M`7`>``!A"`!8;@D``&$(``=P!0``80`"7#$!``@D```()80"``!A`"!8
+M,&$!0A,D```3)00HP!&"!!,D&``3)00HP!'H'<`0YO\3,O__$S/H'<`1
+M```!)`@``24/`6,B`0!2)`@`!VX"``!A```5)"$4``!A0`;`$N@=P!$!
+M`%(DM!_`$`(`$W`"``!A"`!D,>,/`&$/$U(B#Q-2(@$`4FX$``!A@@03)`@`
+M$R4$*,`1!```88($$R08`!,E!"C`$0```&'8-("!``#`%@(!$V1"`1,D!"C`
+M$1"\@($``,`6!@$38@0(P!`$`!-D#UP`(@H``$``!@!P&@``80``$R0``!,E
+M``#`%R``6#'((,`0<$7`$!`(P!```!,E`P`3)!P(P!$<",`1```3)`0(P!$/
+M%!4B!``5)@\P("+[_S`R`P`3)!@(P!$/%!4B`@`5)@\@,"(``!,D$$7`$1@(
+MP!$0`%@Q#P`3(@$`$S`$*,`1#WP3(@@`S!$``!,E```3)#1(QQ$/>Q,B`0`3
+M,`0HP!$/%!4B`@`5)@]-$R($$,41`@`3)/``#(!@L`>`!`!P\`%`#\#!$`&``L"A(`
+MI`$``!,`#``@#10``P`L#14`!``P#0``
+M`!X>B!Z(6@```%8```!6B%:(`@$``*H`
+M``"JB*J(_@$``(P*``!4C%2,I!\```#^```!`/\``@'_`0#_

svn commit: r313420 - head/sys/contrib/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 07:01:58 2017
New Revision: 313420
URL: https://svnweb.freebsd.org/changeset/base/313420

Log:
  [iwm] add version 17 firmware.

Added:
  head/sys/contrib/dev/iwm/iwm-7260-17.fw.uu

Added: head/sys/contrib/dev/iwm/iwm-7260-17.fw.uu
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/dev/iwm/iwm-7260-17.fw.uu  Wed Feb  8 07:01:58 2017
(r313420)
@@ -0,0 +1,23322 @@
+begin 644 iwm-7260-17.fw
+M`$E73`IS=')E86TZ3=7A?0V]R94-Y8VQE,31?"`(`'!``
+M0!$P1``0```(```!$```#B
+M804```$```#@DX``E"J``*R_@`#(L8``*!6``("S@```
+M``!L(,`0#QL)(MP=P!`*`!M`(``;;@0``&$0`!MN`0``
+M810``&$/``!A```;)"``'<`1``7`$@$``(``!A#QP=(@0`'2;H'<`0
+M`0`;,.@=P!&"!!LD"``;)00HP!'I#P!A```;)0`!<',`18=P=P!``
+M`!TD(0$`6#$/10`B`%P`.?0EP!`!`1,R`0$3,P$`$V+O_P`R!```8@-@
+M`&(``%@X`@!8,68``&$(!<`2Z!W`$0$`4B2T'\`0`@`3<`,``&$(`%@P"`!D
+M,0T``&$/$U(B@@03)`@`$R4!`%)N!```88($$R0(`!,E!"C`$00``&&"!!,D
+M&``3)00HP!$```!A"`!8;N4/`&$``!,E```3)"00P!$`@!,D```3)3@!,B!`#*$0```20```$E!@``80]V$R(L2,<1
+M#W@3(@``QA$#``$D```!)0]%`"(`7``Y[_\`,AD``&0`@!,D`0`3)3@'H@>B%H```!6
+M5HA6B`(!``"JJHBJB/X!``","@``5(Q4C*0?
+M_@```0#_``(!_P$`_P$!`/X"`0,"_P$!`/\!`0'_`@#_`P(`_@0"`P+_`@(`
+M_P("`?\#`/\%`P#^!@,``_\#`P#_`P,!_P```+1(```*
+M!+B5@``420``!00```"XE8``
+M`0```-0``0#L`@$`7`(!`,0"`0!4_0``3/T``!@V
+M```$,P``5#,!"_\```4#```$`@``!O\```#_```,
+M_P``!_\```C_```)_P``"O\```+_`0#_``$"`!$!`0(!`0$#_P$!!`(!`04#
+M`0$&!`$!!P4!`0@&`0$)#P$!"A`!``S_`0#^_P(`_P<"`0'_`@(""`("`PD"
+M`@0*`@(%"P("!@P"`@<-`@((#@(""0X"`@H-`@`,_P(`_O\`
+M``#_!P```/\```?_``$)"```"O\!`@```0,!_P$#`O\!`P/_`0$$
+M_P$"!0`!`0O_`0(,_P$$!@8!`0?_`0`(_P$`"O\"`@#_`@,!_P(#`O\"`P/_
+M`@$$`0("!0`"`0L!`@(,`0($!@8"`@<``@`(`0(`"@$#`/\"`P,`_P,#`?\#
+M`P+_`P,#!`,!!`4#`@4``P$+!0,"#`4#!`8&`P,'_P,`"`4#``H%`P#^`P0$
+M`/\$!`'_!`0"_P0$`_\$!`3_!`0%_P0$"_\$!`S_!`0&!@0$!P8$``C_!``*
+M_P#_`0,``@("``,``@``!?\```;_```$_P``!P0```C_
+M`0#_`0$!``,!`@$"`0("`@$`!/\!`0<$`0`(_P(#``8"`@(&`@`%_P(`!O\"
+M``3_`@`'!P(`"`<#`P`&`P`!!0,"`@8#`07_`P`&_P,`!`<#``<'`P`(!P``
+M`0#_`0#_``$``?\!`@+_`@#_`0(``?\"`0/_`@,$_P(""O\"`@G_`@((
+M_P,``?\#`0,*`P4%"@,$!O\#!@H(`P,)_P0`_P,$``'_!`$#"P0"!PL$`@@$
+M!`,$_P0""@D$!`G_!`0&_P4`_P(%!`;_!0$#!@4``?\%!0K_!04)!08`__\&
+M!`;_!@$#!@8``?\&`P3_!@8)!P8&"O\`
+M``!PCX```0`#;(^```$``R@5@``!``%4DH```0`#6)*```$``XA(`0`"``0`
+M```(!`P""@8.`0D%#0,+!P\!D0```3\```*1```^/0```Y$``#T]```$D0``
+M/P,```61```)$```!I$``!8<```'D0``'Q\```B1```<%@``"9$``!`)```*
+MD0```S\```N1```]/0``#)$``#T^```-D0``/P$``!$0/DA(2.`0!`T@
+M!"!#.0#@A`$``.$0`0(0E\L%`#!@"P_2!!C2^/__
+M'P%S,`$```G@B8:$A`K@A(0```O@IE77(`S@(HLL,@W@JHF'(@[@'GOL,1?@
+MDHR+BAC@BHH``!G@?DGG(!K@(HLL,AO@DTVW(1S@'GOL,21@``)S
+M`!$@%(4!``)@_A0```-@$10```9@$10``!D0!&$0(!(@E`,```D0
+M;E\``!H0`#$0A@$``#(0D`$``#,0R#004#40@#H0:0``
+M`#L0P,$0`"K@^>7G)BO@(HLL,BS@<\YI*RW@'GOL,2C@BXN)B2G@
+MB8D``#;@7%Q<7#?@7%P``#'@_^=Q`#+@[C0G`#/@H/#\`#3@L0\``#7@
+M``)'`0```%)*"0!2R@@`$4((`!!""`#OO0<`[[T'`.\Y!P#..0<`SCD'`*ZU
+M!@"M-0<`#T8)`'/."0!32@D`4DH)`%)*"0`RQ@@`,<8(`#'&"``QQ@@`$$((
+M`!!""``00@@`$$((`!!""``00@@`$$((`.^]!P#OO0<`[[T'`.^]!P#OO0<`
+M[[T'`.^]!P#OO0<`[[T'`.^]!P`/0@@`$$((`!!""``00@@`$$((`!!""``0
+M0@@`,,8(`#'&"``QQ@@`,<8(`%)*"0!22@D`4DH)`'/."0!31@@`S[4&`*VU
+M!@#..0<`SCD'`,ZY!P#OO0<`[[T'``]""``00@@`,4H)`%)*"0#OO0<`[ST'
+M`,ZU!@"M-08`C#$&`,T]"``QQ@@`,<8(`%%*"0!22@D`4DH)`#+&"``QQ@@`
+M,48(`!!""``00@@`$$((`!!""``0Q@@`,<8(`#'&"`!22@D`4DH)`%)*"0`Q
+MQ@@`,<8(`/"Y!@",,08`C+4&`*TU!P#.O0<`[[T'`#'&"``Q0@@`$,('`.^]
+M!P#O00@`$$((`!!""``QQ@@`,<8(`!%""``00@@`$,('`.^]!P#O00@`$,((
+M`#'&"``>'AX>'AL7%!(*'AX>'AX;%Q02"AX>'AX>'AX;%Q02"AX>'AX><4
+M$@H>'AX>'AX><4$@H>'AX>'AL7%!(*'AX``+C:`0`%
+M```"!+B5@```
+M

svn commit: r313418 - head/sys/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 06:57:21 2017
New Revision: 313418
URL: https://svnweb.freebsd.org/changeset/base/313418

Log:
  [iwm] Recognize IWM_DTS_MEASUREMENT_NOTIF_WIDE notification.
  
  * Add the command groups enum, and the iwm_phy_ops_subcmd_ids enum
to if_iwmreg.h definitions.
  
  * The IWM_DTS_MEASUREMENT_NOTIF_WIDE notification will be generated by
version 17 firmware.
  
  Taken-From: Linux iwlwifi
  
  Obtained from:DragonflyBSD commit 
4d8d6f9def2ffb60aaf2d88f72f069a96c0b4e3f

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Wed Feb  8 06:56:28 2017(r313417)
+++ head/sys/dev/iwm/if_iwm.c   Wed Feb  8 06:57:21 2017(r313418)
@@ -5451,7 +5451,9 @@ iwm_notif_intr(struct iwm_softc *sc)
notif->source_id, sc->sc_fw_mcc);
break; }
 
-   case IWM_DTS_MEASUREMENT_NOTIFICATION: {
+   case IWM_DTS_MEASUREMENT_NOTIFICATION:
+   case IWM_WIDE_ID(IWM_PHY_OPS_GROUP,
+IWM_DTS_MEASUREMENT_NOTIF_WIDE): {
struct iwm_dts_measurement_notif_v1 *notif;
 
if (iwm_rx_packet_payload_len(pkt) < sizeof(*notif)) {

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hWed Feb  8 06:56:28 2017
(r313417)
+++ head/sys/dev/iwm/if_iwmreg.hWed Feb  8 06:57:21 2017
(r313418)
@@ -1949,6 +1949,25 @@ enum {
IWM_REPLY_MAX = 0xff,
 };
 
+enum iwm_phy_ops_subcmd_ids {
+   IWM_CMD_DTS_MEASUREMENT_TRIGGER_WIDE = 0x0,
+   IWM_CTDP_CONFIG_CMD = 0x03,
+   IWM_TEMP_REPORTING_THRESHOLDS_CMD = 0x04,
+   IWM_CT_KILL_NOTIFICATION = 0xFE,
+   IWM_DTS_MEASUREMENT_NOTIF_WIDE = 0xFF,
+};
+
+/* command groups */
+enum {
+   IWM_LEGACY_GROUP = 0x0,
+   IWM_LONG_GROUP = 0x1,
+   IWM_SYSTEM_GROUP = 0x2,
+   IWM_MAC_CONF_GROUP = 0x3,
+   IWM_PHY_OPS_GROUP = 0x4,
+   IWM_DATA_PATH_GROUP = 0x5,
+   IWM_PROT_OFFLOAD_GROUP = 0xb,
+};
+
 /**
  * struct iwm_cmd_response - generic response struct for most commands
  * @status: status of the command asked, changes for each one
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313417 - head/sys/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 06:56:28 2017
New Revision: 313417
URL: https://svnweb.freebsd.org/changeset/base/313417

Log:
  [iwm] Very basic DTS thermal sensor support (prints temp as debug msg).
  
  * Adds IWM_DEBUG_TEMP debug message type, for printing messages related
to temperature sensors and thermal/TDP infos.
  
  * The firmware regularly sends us DTS measurement notifications, so just
print the temperature value as a debugging message.
  
  (Adrian's addition):
  
  * Eventually this can be used by the driver to limit transmit rate / power to
try and do some thermal throttling.
  
  Obtained from:DragonflyBSD commit 
efb7d4eb5c3140889a8880e12fd83c7bbfd0059d

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_debug.h
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Wed Feb  8 06:54:08 2017(r313416)
+++ head/sys/dev/iwm/if_iwm.c   Wed Feb  8 06:56:28 2017(r313417)
@@ -5451,8 +5451,20 @@ iwm_notif_intr(struct iwm_softc *sc)
notif->source_id, sc->sc_fw_mcc);
break; }
 
-   case IWM_DTS_MEASUREMENT_NOTIFICATION:
+   case IWM_DTS_MEASUREMENT_NOTIFICATION: {
+   struct iwm_dts_measurement_notif_v1 *notif;
+
+   if (iwm_rx_packet_payload_len(pkt) < sizeof(*notif)) {
+   device_printf(sc->sc_dev,
+   "Invalid DTS_MEASUREMENT_NOTIFICATION\n");
+   break;
+   }
+   notif = (void *)pkt->data;
+   IWM_DPRINTF(sc, IWM_DEBUG_TEMP,
+   "IWM_DTS_MEASUREMENT_NOTIFICATION - %d\n",
+   notif->temp);
break;
+   }
 
case IWM_PHY_CONFIGURATION_CMD:
case IWM_TX_ANT_CONFIGURATION_CMD:

Modified: head/sys/dev/iwm/if_iwm_debug.h
==
--- head/sys/dev/iwm/if_iwm_debug.h Wed Feb  8 06:54:08 2017
(r313416)
+++ head/sys/dev/iwm/if_iwm_debug.h Wed Feb  8 06:56:28 2017
(r313417)
@@ -41,6 +41,7 @@ enum {
IWM_DEBUG_FIRMWARE_TLV  = 0x0002,   /* Firmware TLV parsing */
IWM_DEBUG_TRANS = 0x0004,   /* Transport layer (eg PCIe) */
IWM_DEBUG_EEPROM= 0x0008,   /* EEPROM/channel information */
+   IWM_DEBUG_TEMP  = 0x0010,   /* Thermal Sensor handling */
IWM_DEBUG_REGISTER  = 0x2000,   /* print chipset register */
IWM_DEBUG_TRACE = 0x4000,   /* Print begin and start driver 
function */
IWM_DEBUG_FATAL = 0x8000,   /* fatal errors */

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hWed Feb  8 06:54:08 2017
(r313416)
+++ head/sys/dev/iwm/if_iwmreg.hWed Feb  8 06:56:28 2017
(r313417)
@@ -5978,6 +5978,30 @@ enum iwm_mcc_source {
IWM_MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11,
 };
 
+/**
+ * struct iwm_dts_measurement_notif_v1 - measurements notification
+ *
+ * @temp: the measured temperature
+ * @voltage: the measured voltage
+ */
+struct iwm_dts_measurement_notif_v1 {
+   int32_t temp;
+   int32_t voltage;
+} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_1*/
+
+/**
+ * struct iwm_dts_measurement_notif_v2 - measurements notification
+ *
+ * @temp: the measured temperature
+ * @voltage: the measured voltage
+ * @threshold_idx: the trip index that was crossed
+ */
+struct iwm_dts_measurement_notif_v2 {
+   int32_t temp;
+   int32_t voltage;
+   int32_t threshold_idx;
+} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_2 */
+
 /*
  * Some cherry-picked definitions
  */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313416 - head/sys/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 06:54:08 2017
New Revision: 313416
URL: https://svnweb.freebsd.org/changeset/base/313416

Log:
  [iwm] Only for family 7000 power-down busmaster DMA clocks when stopping.
  
  Taken-From: Linux iwlwifi
  
  Obtained from:DragonflyBSD commit 
4c45994fcc77373ae2fb0901db15368c9731f641

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Wed Feb  8 06:53:23 2017(r313415)
+++ head/sys/dev/iwm/if_iwm.c   Wed Feb  8 06:54:08 2017(r313416)
@@ -1401,11 +1401,12 @@ iwm_stop_device(struct iwm_softc *sc)
for (qid = 0; qid < nitems(sc->txq); qid++)
iwm_reset_tx_ring(sc, >txq[qid]);
 
-   /*
-* Power-down device's busmaster DMA clocks
-*/
-   iwm_write_prph(sc, IWM_APMG_CLK_DIS_REG, IWM_APMG_CLK_VAL_DMA_CLK_RQT);
-   DELAY(5);
+   if (sc->cfg->device_family == IWM_DEVICE_FAMILY_7000) {
+   /* Power-down device's busmaster DMA clocks */
+   iwm_write_prph(sc, IWM_APMG_CLK_DIS_REG,
+   IWM_APMG_CLK_VAL_DMA_CLK_RQT);
+   DELAY(5);
+   }
 
/* Make sure (redundant) we've released our request to stay awake */
IWM_CLRBITS(sc, IWM_CSR_GP_CNTRL,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313415 - head/sys/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 06:53:23 2017
New Revision: 313415
URL: https://svnweb.freebsd.org/changeset/base/313415

Log:
  [iwm] Implement apmg_wake_up_wa workaround properly for 7000 family.
  
  * Add iwm_pcie_set_cmd_in_flight() and iwm_pcie_clear_cmd_in_flight()
helper methods.
  
  * Use ring->queued tracking in the command queue to set/clear the
cmd_hold_nic_awake bit at the right points.
  
  Taken-From: Linux iwlwifi
  
  Obtained from:DragonflyBSD commit 
ce43f57f5308b579ea21e8a5a29969114ba2247d

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_pcie_trans.c
  head/sys/dev/iwm/if_iwm_pcie_trans.h
  head/sys/dev/iwm/if_iwm_util.c
  head/sys/dev/iwm/if_iwmvar.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Wed Feb  8 06:50:59 2017(r313414)
+++ head/sys/dev/iwm/if_iwm.c   Wed Feb  8 06:53:23 2017(r313415)
@@ -182,7 +182,8 @@ __FBSDID("$FreeBSD$");
 #define IWM_DEVICE_7000_COMMON \
.device_family = IWM_DEVICE_FAMILY_7000,\
.eeprom_size = IWM_OTP_LOW_IMAGE_SIZE_FAMILY_7000,  \
-   .nvm_hw_section_num = IWM_NVM_HW_SECTION_NUM_FAMILY_7000
+   .nvm_hw_section_num = IWM_NVM_HW_SECTION_NUM_FAMILY_7000,   \
+   .apmg_wake_up_wa = 1
 
 const struct iwm_cfg iwm7260_cfg = {
.fw_name = IWM7260_FW,
@@ -1251,6 +1252,9 @@ iwm_reset_tx_ring(struct iwm_softc *sc, 
sc->qfullmsk &= ~(1 << ring->qid);
ring->queued = 0;
ring->cur = 0;
+
+   if (ring->qid == IWM_MVM_CMD_QUEUE && sc->cmd_hold_nic_awake)
+   iwm_pcie_clear_cmd_in_flight(sc);
 }
 
 static void
@@ -3338,6 +3342,18 @@ iwm_cmd_done(struct iwm_softc *sc, struc
data->m = NULL;
}
wakeup(>desc[pkt->hdr.idx]);
+
+   if (((pkt->hdr.idx + ring->queued) % IWM_TX_RING_COUNT) != ring->cur) {
+   device_printf(sc->sc_dev,
+   "%s: Some HCMDs skipped?: idx=%d queued=%d cur=%d\n",
+   __func__, pkt->hdr.idx, ring->queued, ring->cur);
+   /* XXX call iwm_force_nmi() */
+   }
+
+   KASSERT(ring->queued > 0, ("ring->queued is empty?"));
+   ring->queued--;
+   if (ring->queued == 0)
+   iwm_pcie_clear_cmd_in_flight(sc);
 }
 
 #if 0
@@ -5580,9 +5596,6 @@ iwm_notif_intr(struct iwm_softc *sc)
ADVANCE_RXQ(sc);
}
 
-   IWM_CLRBITS(sc, IWM_CSR_GP_CNTRL,
-   IWM_CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
-
/*
 * Tell the firmware what we have processed.
 * Seems like the hardware gets upset unless we align

Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c
==
--- head/sys/dev/iwm/if_iwm_pcie_trans.cWed Feb  8 06:50:59 2017
(r313414)
+++ head/sys/dev/iwm/if_iwm_pcie_trans.cWed Feb  8 06:53:23 2017
(r313415)
@@ -253,6 +253,9 @@ iwm_nic_lock(struct iwm_softc *sc)
 {
int rv = 0;
 
+   if (sc->cmd_hold_nic_awake)
+   return 1;
+
IWM_SETBITS(sc, IWM_CSR_GP_CNTRL,
IWM_CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
 
@@ -277,6 +280,9 @@ iwm_nic_lock(struct iwm_softc *sc)
 void
 iwm_nic_unlock(struct iwm_softc *sc)
 {
+   if (sc->cmd_hold_nic_awake)
+   return;
+
IWM_CLRBITS(sc, IWM_CSR_GP_CNTRL,
IWM_CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
 }
@@ -583,3 +589,55 @@ iwm_pcie_rx_stop(struct iwm_softc *sc)
}
return ret;
 }
+
+void
+iwm_pcie_clear_cmd_in_flight(struct iwm_softc *sc)
+{
+   if (!sc->cfg->apmg_wake_up_wa)
+   return;
+
+   if (!sc->cmd_hold_nic_awake) {
+   device_printf(sc->sc_dev,
+   "%s: cmd_hold_nic_awake not set\n", __func__);
+   return;
+   }
+
+   sc->cmd_hold_nic_awake = 0;
+   IWM_CLRBITS(sc, IWM_CSR_GP_CNTRL,
+   IWM_CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
+}
+
+int
+iwm_pcie_set_cmd_in_flight(struct iwm_softc *sc)
+{
+   int ret;
+
+   /*
+* wake up the NIC to make sure that the firmware will see the host
+* command - we will let the NIC sleep once all the host commands
+* returned. This needs to be done only on NICs that have
+* apmg_wake_up_wa set.
+*/
+   if (sc->cfg->apmg_wake_up_wa &&
+   !sc->cmd_hold_nic_awake) {
+
+   IWM_SETBITS(sc, IWM_CSR_GP_CNTRL,
+   IWM_CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
+
+ret = iwm_poll_bit(sc, IWM_CSR_GP_CNTRL,
+   IWM_CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN,
+   (IWM_CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY |
+IWM_CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP),
+   15000);
+if (ret == 0) {
+   

svn commit: r313414 - head/sys/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 06:50:59 2017
New Revision: 313414
URL: https://svnweb.freebsd.org/changeset/base/313414

Log:
  [iwm] Use iwm_mvm_scan_stop_wait to properly abort scans.
  
  * Add IWM_FLAG_SCAN_RUNNING to sc->sc_flags to track whether the firmware
is currently running a scan, in order to decide wheter iwm_scan_end
needs to abort a running scan.
  
  * In iwm_scan_end, if the scan is still running, we now abort it, in order
to keep the firmware scanning state in sync.
  
  * Try to make things a bit simpler, by reacting on the
IWM_SCAN_OFFLOAD_COMPLETE and IWM_SCAN_COMPLETE_UMAC notifications,
instead of IWM_SCAN_ITERATION_COMPLETE and
IWM_SCAN_ITERATION_COMPLETE_UMAC. This should be fine since we always
only tell the firmware to do a single scan iteration anyway.
  
  Obtained from:DragonflyBSD commit 
1f249c981c4e89e7cde1836a75b61cac36dc7ac5

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwmvar.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Wed Feb  8 06:44:50 2017(r313413)
+++ head/sys/dev/iwm/if_iwm.c   Wed Feb  8 06:50:59 2017(r313414)
@@ -4951,6 +4951,7 @@ iwm_stop(struct iwm_softc *sc)
iwm_led_blink_stop(sc);
sc->sc_tx_timer = 0;
iwm_stop_device(sc);
+   sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING;
 }
 
 static void
@@ -5475,6 +5476,10 @@ iwm_notif_intr(struct iwm_softc *sc)
case IWM_SCAN_OFFLOAD_COMPLETE: {
struct iwm_periodic_scan_complete *notif;
notif = (void *)pkt->data;
+   if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) {
+   sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING;
+   ieee80211_runtask(ic, >sc_es_task);
+   }
break;
}
 
@@ -5492,9 +5497,10 @@ iwm_notif_intr(struct iwm_softc *sc)
IWM_DPRINTF(sc, IWM_DEBUG_SCAN,
"UMAC scan complete, status=0x%x\n",
notif->status);
-#if 0  /* XXX This would be a duplicate scan end call */
-   taskqueue_enqueue(sc->sc_tq, >sc_es_task);
-#endif
+   if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) {
+   sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING;
+   ieee80211_runtask(ic, >sc_es_task);
+   }
break;
}
 
@@ -6254,15 +6260,21 @@ iwm_scan_start(struct ieee80211com *ic)
int error;
 
IWM_LOCK(sc);
+   if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) {
+   /* This should not be possible */
+   device_printf(sc->sc_dev,
+   "%s: Previous scan not completed yet\n", __func__);
+   }
if (isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN))
error = iwm_mvm_umac_scan(sc);
else
error = iwm_mvm_lmac_scan(sc);
if (error != 0) {
-   device_printf(sc->sc_dev, "could not initiate 2 GHz scan\n");
+   device_printf(sc->sc_dev, "could not initiate scan\n");
IWM_UNLOCK(sc);
ieee80211_cancel_scan(vap);
} else {
+   sc->sc_flags |= IWM_FLAG_SCAN_RUNNING;
iwm_led_blink_start(sc);
IWM_UNLOCK(sc);
}
@@ -6278,7 +6290,23 @@ iwm_scan_end(struct ieee80211com *ic)
iwm_led_blink_stop(sc);
if (vap->iv_state == IEEE80211_S_RUN)
iwm_mvm_led_enable(sc);
+   if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) {
+   /*
+* Removing IWM_FLAG_SCAN_RUNNING now, is fine because
+* both iwm_scan_end and iwm_scan_start run in the ic->ic_tq
+* taskqueue.
+*/
+   sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING;
+   iwm_mvm_scan_stop_wait(sc);
+   }
IWM_UNLOCK(sc);
+
+   /*
+* Make sure we don't race, if sc_es_task is still enqueued here.
+* This is to make sure that it won't call ieee80211_scan_done
+* when we have already started the next scan.
+*/
+   taskqueue_cancel(ic->ic_tq, >sc_es_task, NULL);
 }
 
 static void

Modified: head/sys/dev/iwm/if_iwmvar.h
==
--- head/sys/dev/iwm/if_iwmvar.hWed Feb  8 06:44:50 2017
(r313413)
+++ head/sys/dev/iwm/if_iwmvar.hWed Feb  8 06:50:59 2017
(r313414)
@@ -415,6 +415,7 @@ struct iwm_softc {
 #define IWM_FLAG_RFKILL(1 << 3)
 #define IWM_FLAG_BUSY  (1 << 4)
 #define IWM_FLAG_SCANNING  (1 << 5)
+#define IWM_FLAG_SCAN_RUNNING  (1 << 6)
 
struct intr_config_hook sc_preinit_hook;
struct callout  

svn commit: r313413 - head/sys/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 06:44:50 2017
New Revision: 313413
URL: https://svnweb.freebsd.org/changeset/base/313413

Log:
  [iwm] Add scan abort functions, to properly cancel a running scan.
  
  * Uses the notification wait api to wait for the corresponding scan
complete notification after sending the abort command.
  
  Taken-From: Linux iwlwifi
  
  Obtained from:DragonflyBSD commit 
b484d09d54301740f036ddf02008117f563960c2

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_scan.c
  head/sys/dev/iwm/if_iwm_scan.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Wed Feb  8 06:43:02 2017(r313412)
+++ head/sys/dev/iwm/if_iwm.c   Wed Feb  8 06:44:50 2017(r313413)
@@ -5447,7 +5447,9 @@ iwm_notif_intr(struct iwm_softc *sc)
case IWM_TIME_EVENT_CMD:
case IWM_WIDE_ID(IWM_ALWAYS_LONG_GROUP, IWM_SCAN_CFG_CMD):
case IWM_WIDE_ID(IWM_ALWAYS_LONG_GROUP, IWM_SCAN_REQ_UMAC):
+   case IWM_WIDE_ID(IWM_ALWAYS_LONG_GROUP, IWM_SCAN_ABORT_UMAC):
case IWM_SCAN_OFFLOAD_REQUEST_CMD:
+   case IWM_SCAN_OFFLOAD_ABORT_CMD:
case IWM_REPLY_BEACON_FILTERING_CMD:
case IWM_MAC_PM_POWER_TABLE:
case IWM_TIME_QUOTA_CMD:

Modified: head/sys/dev/iwm/if_iwm_scan.c
==
--- head/sys/dev/iwm/if_iwm_scan.c  Wed Feb  8 06:43:02 2017
(r313412)
+++ head/sys/dev/iwm/if_iwm_scan.c  Wed Feb  8 06:44:50 2017
(r313413)
@@ -153,6 +153,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -737,3 +738,86 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc)
free(req, M_DEVBUF);
return ret;
 }
+
+static int
+iwm_mvm_lmac_scan_abort(struct iwm_softc *sc)
+{
+   int ret;
+   struct iwm_host_cmd hcmd = {
+   .id = IWM_SCAN_OFFLOAD_ABORT_CMD,
+   .len = { 0, },
+   .data = { NULL, },
+   .flags = IWM_CMD_SYNC,
+   };
+   uint32_t status;
+
+   ret = iwm_mvm_send_cmd_status(sc, , );
+   if (ret)
+   return ret;
+
+   if (status != IWM_CAN_ABORT_STATUS) {
+   /*
+* The scan abort will return 1 for success or
+* 2 for "failure".  A failure condition can be
+* due to simply not being in an active scan which
+* can occur if we send the scan abort before the
+* microcode has notified us that a scan is completed.
+*/
+   IWM_DPRINTF(sc, IWM_DEBUG_SCAN,
+   "SCAN OFFLOAD ABORT ret %d.\n", status);
+   ret = ENOENT;
+   }
+
+   return ret;
+}
+
+static int
+iwm_mvm_umac_scan_abort(struct iwm_softc *sc)
+{
+   struct iwm_umac_scan_abort cmd = {};
+   int uid, ret;
+
+   uid = 0;
+   cmd.uid = htole32(uid);
+
+   IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Sending scan abort, uid %u\n", uid);
+
+   ret = iwm_mvm_send_cmd_pdu(sc,
+  iwm_cmd_id(IWM_SCAN_ABORT_UMAC,
+ IWM_ALWAYS_LONG_GROUP, 0),
+  0, sizeof(cmd), );
+
+   return ret;
+}
+
+int
+iwm_mvm_scan_stop_wait(struct iwm_softc *sc)
+{
+   struct iwm_notification_wait wait_scan_done;
+   static const uint16_t scan_done_notif[] = { IWM_SCAN_COMPLETE_UMAC,
+  IWM_SCAN_OFFLOAD_COMPLETE, };
+   int ret;
+
+   iwm_init_notification_wait(sc->sc_notif_wait, _scan_done,
+  scan_done_notif, nitems(scan_done_notif),
+  NULL, NULL);
+
+   IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Preparing to stop scan\n");
+
+   if (isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN))
+   ret = iwm_mvm_umac_scan_abort(sc);
+   else
+   ret = iwm_mvm_lmac_scan_abort(sc);
+
+   if (ret) {
+   IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "couldn't stop scan\n");
+   iwm_remove_notification(sc->sc_notif_wait, _scan_done);
+   return ret;
+   }
+
+   IWM_UNLOCK(sc);
+   ret = iwm_wait_notification(sc->sc_notif_wait, _scan_done, hz);
+   IWM_LOCK(sc);
+
+   return ret;
+}

Modified: head/sys/dev/iwm/if_iwm_scan.h
==
--- head/sys/dev/iwm/if_iwm_scan.h  Wed Feb  8 06:43:02 2017
(r313412)
+++ head/sys/dev/iwm/if_iwm_scan.h  Wed Feb  8 06:44:50 2017
(r313413)
@@ -109,5 +109,6 @@
 extern int iwm_mvm_lmac_scan(struct iwm_softc *sc);
 extern int iwm_mvm_config_umac_scan(struct iwm_softc *);
 extern int iwm_mvm_umac_scan(struct iwm_softc *);
+extern int 

svn commit: r313412 - head/sys/dev/iwm

2017-02-07 Thread Adrian Chadd
Author: adrian
Date: Wed Feb  8 06:43:02 2017
New Revision: 313412
URL: https://svnweb.freebsd.org/changeset/base/313412

Log:
  [iwm] Get rid of iwm_disable_rx_dma, just use iwm_pcie_rx_stop directly.
  
  * This also fixes one of many small nic lock handling bugs, and matches
iwlwifi's code.
  
  Obtained from:DragonflyBSD git 
50787d03cd0a0366c9cc4a055bb6977e5f65c85d

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_pcie_trans.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Wed Feb  8 03:21:29 2017(r313411)
+++ head/sys/dev/iwm/if_iwm.c   Wed Feb  8 06:43:02 2017(r313412)
@@ -302,7 +302,6 @@ static int  iwm_alloc_sched(struct iwm_so
 static int iwm_alloc_kw(struct iwm_softc *);
 static int iwm_alloc_ict(struct iwm_softc *);
 static int iwm_alloc_rx_ring(struct iwm_softc *, struct iwm_rx_ring *);
-static voidiwm_disable_rx_dma(struct iwm_softc *);
 static voidiwm_reset_rx_ring(struct iwm_softc *, struct iwm_rx_ring *);
 static voidiwm_free_rx_ring(struct iwm_softc *, struct iwm_rx_ring *);
 static int iwm_alloc_tx_ring(struct iwm_softc *, struct iwm_tx_ring *,
@@ -1104,18 +1103,6 @@ fail:iwm_free_rx_ring(sc, ring);
 }
 
 static void
-iwm_disable_rx_dma(struct iwm_softc *sc)
-{
-   /* XXX conditional nic locks are stupid */
-   /* XXX print out if we can't lock the NIC? */
-   if (iwm_nic_lock(sc)) {
-   /* XXX handle if RX stop doesn't finish? */
-   (void) iwm_pcie_rx_stop(sc);
-   iwm_nic_unlock(sc);
-   }
-}
-
-static void
 iwm_reset_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring)
 {
/* Reset the ring state */
@@ -1401,7 +1388,7 @@ iwm_stop_device(struct iwm_softc *sc)
}
iwm_nic_unlock(sc);
}
-   iwm_disable_rx_dma(sc);
+   iwm_pcie_rx_stop(sc);
 
/* Stop RX ring. */
iwm_reset_rx_ring(sc, >rxq);
@@ -1485,16 +1472,18 @@ iwm_mvm_nic_config(struct iwm_softc *sc)
 static int
 iwm_nic_rx_init(struct iwm_softc *sc)
 {
-   if (!iwm_nic_lock(sc))
-   return EBUSY;
-
/*
 * Initialize RX ring.  This is from the iwn driver.
 */
memset(sc->rxq.stat, 0, sizeof(*sc->rxq.stat));
 
-   /* stop DMA */
-   iwm_disable_rx_dma(sc);
+   /* Stop Rx DMA */
+   iwm_pcie_rx_stop(sc);
+
+   if (!iwm_nic_lock(sc))
+   return EBUSY;
+
+   /* reset and flush pointers */
IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_RBDCB_WPTR, 0);
IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_FLUSH_RB_REQ, 0);
IWM_WRITE(sc, IWM_FH_RSCSR_CHNL0_RDPTR, 0);

Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c
==
--- head/sys/dev/iwm/if_iwm_pcie_trans.cWed Feb  8 03:21:29 2017
(r313411)
+++ head/sys/dev/iwm/if_iwm_pcie_trans.cWed Feb  8 06:43:02 2017
(r313412)
@@ -572,10 +572,14 @@ iwm_set_pwr(struct iwm_softc *sc)
 int
 iwm_pcie_rx_stop(struct iwm_softc *sc)
 {
-
-   IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
-   return (iwm_poll_bit(sc, IWM_FH_MEM_RSSR_RX_STATUS_REG,
-   IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE,
-   IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE,
-   1000));
+   int ret = 0;
+   if (iwm_nic_lock(sc)) {
+   IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
+   ret = iwm_poll_bit(sc, IWM_FH_MEM_RSSR_RX_STATUS_REG,
+   IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE,
+   IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE,
+   1000);
+   iwm_nic_unlock(sc);
+   }
+   return ret;
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313411 - head/contrib/elftoolchain/libelftc

2017-02-07 Thread Justin Hibbits
Author: jhibbits
Date: Wed Feb  8 03:21:29 2017
New Revision: 313411
URL: https://svnweb.freebsd.org/changeset/base/313411

Log:
  Add elf*-powerpc-freebsd targets to the elftoolchain target list
  
  FreeBSD uses the full target triple when generating embedded rootfs images
  (MFS_IMAGE= make option).  Without this change objcopy errors out with:
  
  objcopy: elf64-poewrpc-freebsd: invalid target name
  
  MFC after:2 weeks

Modified:
  head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c

Modified: head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
==
--- head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Wed Feb  8 
00:02:54 2017(r313410)
+++ head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Wed Feb  8 
03:21:29 2017(r313411)
@@ -127,6 +127,15 @@ struct _Elftc_Bfd_Target _libelftc_targe
},
 
{
+   .bt_name  = "elf32-powerpc-freebsd",
+   .bt_type  = ETF_ELF,
+   .bt_byteorder = ELFDATA2MSB,
+   .bt_elfclass  = ELFCLASS32,
+   .bt_machine   = EM_PPC,
+   .bt_osabi = ELFOSABI_FREEBSD,
+   },
+
+   {
.bt_name  = "elf32-powerpcle",
.bt_type  = ETF_ELF,
.bt_byteorder = ELFDATA2LSB,
@@ -290,6 +299,15 @@ struct _Elftc_Bfd_Target _libelftc_targe
},
 
{
+   .bt_name  = "elf64-powerpc-freebsd",
+   .bt_type  = ETF_ELF,
+   .bt_byteorder = ELFDATA2MSB,
+   .bt_elfclass  = ELFCLASS64,
+   .bt_machine   = EM_PPC64,
+   .bt_osabi = ELFOSABI_FREEBSD,
+   },
+
+   {
.bt_name  = "elf64-powerpcle",
.bt_type  = ETF_ELF,
.bt_byteorder = ELFDATA2LSB,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r313394 - head/sys/kern

2017-02-07 Thread Bruce Evans

On Tue, 7 Feb 2017, Emmanuel Vadot wrote:


Log:
 subr_sfbus.c need sys/proc.h for struct thread definition.
 This fixes kernel build for armv6.

 Discussed with: kib


sys/proc.h was accidentally (?) provided by gross namespace pollution
on some arches (perhaps on all the arches that use subr_sfbuf.c) in
.  This pollution is only supplied under INVARIANTS,
so it is not completely accidental.  However, at least on i386, sys/proc.h
and its nested pollution isn't even used for anything except to pollute.

 has lots of other undocumented pollution which is
actually partially used (mainly sys/pcpu.h and its pollution).

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


Re: svn commit: r313410 - head/usr.sbin/bsdinstall/partedit

2017-02-07 Thread Devin Teske
Thank you very much, Ravi!
— 
Devin

> On Feb 7, 2017, at 4:02 PM, Ravi Pokala  wrote:
> 
> Author: rpokala
> Date: Wed Feb  8 00:02:54 2017
> New Revision: 313410
> URL: https://svnweb.freebsd.org/changeset/base/313410
> 
> Log:
>  Fix indentation (only line in file w/ 8-space indent rather than hard-tab).
> 
>  MFH: 1 week
> 
> Modified:
>  head/usr.sbin/bsdinstall/partedit/scripted.c
> 
> Modified: head/usr.sbin/bsdinstall/partedit/scripted.c
> ==
> --- head/usr.sbin/bsdinstall/partedit/scripted.c  Tue Feb  7 22:45:59 
> 2017(r313409)
> +++ head/usr.sbin/bsdinstall/partedit/scripted.c  Wed Feb  8 00:02:54 
> 2017(r313410)
> @@ -85,7 +85,7 @@ part_config(char *disk, const char *sche
>   LIST_FOREACH(classp, _class, lg_class)
>   if (strcmp(classp->lg_name, "PART") == 0)
>   break;
> -if (classp != NULL) {
> + if (classp != NULL) {
>   LIST_FOREACH(gpart, >lg_geom, lg_geom)
>   if (strcmp(gpart->lg_name, disk) == 0)
>   break;
> 

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

Re: svn commit: r313410 - head/usr.sbin/bsdinstall/partedit

2017-02-07 Thread Ravi Pokala
Err, that should have been s/MFH/MFC/ (obviously)

-Ravi (rpokala@)

-Original Message-
From:  on behalf of Ravi Pokala 

Date: 2017-02-07, Tuesday at 16:02
To: , , 

Subject: svn commit: r313410 - head/usr.sbin/bsdinstall/partedit

Author: rpokala
Date: Wed Feb  8 00:02:54 2017
New Revision: 313410
URL: https://svnweb.freebsd.org/changeset/base/313410

Log:
  Fix indentation (only line in file w/ 8-space indent rather than hard-tab).
  
  MFH:  1 week

Modified:
  head/usr.sbin/bsdinstall/partedit/scripted.c

Modified: head/usr.sbin/bsdinstall/partedit/scripted.c
==
--- head/usr.sbin/bsdinstall/partedit/scripted.cTue Feb  7 22:45:59 
2017(r313409)
+++ head/usr.sbin/bsdinstall/partedit/scripted.cWed Feb  8 00:02:54 
2017(r313410)
@@ -85,7 +85,7 @@ part_config(char *disk, const char *sche
LIST_FOREACH(classp, _class, lg_class)
if (strcmp(classp->lg_name, "PART") == 0)
break;
-if (classp != NULL) {
+   if (classp != NULL) {
LIST_FOREACH(gpart, >lg_geom, lg_geom)
if (strcmp(gpart->lg_name, disk) == 0)
break;




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


svn commit: r313410 - head/usr.sbin/bsdinstall/partedit

2017-02-07 Thread Ravi Pokala
Author: rpokala
Date: Wed Feb  8 00:02:54 2017
New Revision: 313410
URL: https://svnweb.freebsd.org/changeset/base/313410

Log:
  Fix indentation (only line in file w/ 8-space indent rather than hard-tab).
  
  MFH:  1 week

Modified:
  head/usr.sbin/bsdinstall/partedit/scripted.c

Modified: head/usr.sbin/bsdinstall/partedit/scripted.c
==
--- head/usr.sbin/bsdinstall/partedit/scripted.cTue Feb  7 22:45:59 
2017(r313409)
+++ head/usr.sbin/bsdinstall/partedit/scripted.cWed Feb  8 00:02:54 
2017(r313410)
@@ -85,7 +85,7 @@ part_config(char *disk, const char *sche
LIST_FOREACH(classp, _class, lg_class)
if (strcmp(classp->lg_name, "PART") == 0)
break;
-if (classp != NULL) {
+   if (classp != NULL) {
LIST_FOREACH(gpart, >lg_geom, lg_geom)
if (strcmp(gpart->lg_name, disk) == 0)
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r313260 - head/sys/kern

2017-02-07 Thread Steven Hartland

On 07/02/2017 20:34, Ed Maste wrote:

On 7 February 2017 at 10:30, Steven Hartland
 wrote:

All I'm suggesting is, while one could guess this may be a performance or
possibly a compatibility thing, the reason is not obvious, so a small piece
of detail on why the change was done should always be included.

For this one something like the following would be nice:

Switch fget_unlocked to atomic_fcmpset

Improve performance under contention by switching fget_unlocked to
use atomic_fcmpset.

I agree, and one of the key reasons to do this is so that there's this
tiny bit of context if someone later runs "git blame" or "svn
annotate" and discovers this change for the line containing
atomic_fcmpset. Comments containing "eliminate memory leak" or "remove
unused variable" have a self-evident reason, but I don't believe
that's true for "switch to atomic_fcmpset."

Repeating the "switch fget_unlocked to..." in the proposed commit
message above feels redundant to me though, and I would suggest:

| Switch fget_unlocked to atomic_fcmpset
|
| Improves performance under contention.

or just:

| Use atmoic_fcmpset to improve performance under contention
All those work for me as they clearly state why the change was made, so 
I hope this is something we can try to improve moving forward :)

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


Re: svn commit: r313409 - head/sys/geom/journal

2017-02-07 Thread John Baldwin
On Tuesday, February 07, 2017 10:46:00 PM John Baldwin wrote:
> Author: jhb
> Date: Tue Feb  7 22:45:59 2017
> New Revision: 313409
> URL: https://svnweb.freebsd.org/changeset/base/313409
> 
> Log:
>   Defer startup of gjournal switcher kproc.
>   
>   Don't start switcher kproc until the first GEOM is created.
>   
>   Reviewed by:pjd
>   MFC after:  1 month
>   Differential Revision:  https://reviews.freebsd.org/D8576

Originally this triggered a panic with EARLY_AP_STARTUP, but that was later
resolved by permitting callouts during early boot for !thread0.  However,
this is still useful to avoid creating an unused kthread on a system that
doesn't use gjournal, so I committed it for that reason.

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


Re: svn commit: r313342 - head/sys/conf

2017-02-07 Thread John Baldwin
On Tuesday, February 07, 2017 07:10:58 PM Andrew Turner wrote:
> On Mon, 06 Feb 2017 10:43:09 -0800
> John Baldwin  wrote:
> 
> > On Monday, February 06, 2017 02:41:34 PM Andrew Turner wrote:
> > > Author: andrew
> > > Date: Mon Feb  6 14:41:34 2017
> > > New Revision: 313342
> > > URL: https://svnweb.freebsd.org/changeset/base/313342
> > > 
> > > Log:
> > >   Only build the ACPI PCI drivers on x86, they are unlikely to be
> > > used on arm64 without dignificant changes.
> > >   
> > >   Obtained from:  ABT Systems Ltd
> > >   Sponsored by:   The FreeBSD Foundation  
> > 
> > I still think this is not really the right approach.  Nothing about
> > _BBN, _CRS, or _PRT, etc. is x86-specific.
> > 
> 
> the main issue is the code assumes a single PCIe root controller, e.g.
> the pci_cfg* KPI won't work on ThunderX with 6 independent PCIe root
> controllers. I expect much of the code could be re-enabled on arm64,
> however for now it's easier to disable it.

It would be fairly trivial to add a domain argument to the pci_cfg*
API.  Right now x86 only supports a single domain partly due to this
(the MCFG handler doesn't yet handle multiple domains because it can't
be handed a request for a domain other than zero, but that is only an
implementation choice in part due to this API limitation).

I'd be more inclined to pass PCI config requests up to the parent
nexus driver and not use pci_cfg* in the ACPI code at all though if
that model works better.

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


svn commit: r313409 - head/sys/geom/journal

2017-02-07 Thread John Baldwin
Author: jhb
Date: Tue Feb  7 22:45:59 2017
New Revision: 313409
URL: https://svnweb.freebsd.org/changeset/base/313409

Log:
  Defer startup of gjournal switcher kproc.
  
  Don't start switcher kproc until the first GEOM is created.
  
  Reviewed by:  pjd
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D8576

Modified:
  head/sys/geom/journal/g_journal.c

Modified: head/sys/geom/journal/g_journal.c
==
--- head/sys/geom/journal/g_journal.c   Tue Feb  7 22:40:38 2017
(r313408)
+++ head/sys/geom/journal/g_journal.c   Tue Feb  7 22:45:59 2017
(r313409)
@@ -227,11 +227,14 @@ struct g_class g_journal_class = {
 
 static int g_journal_destroy(struct g_journal_softc *sc);
 static void g_journal_metadata_update(struct g_journal_softc *sc);
+static void g_journal_start_switcher(struct g_class *mp);
+static void g_journal_stop_switcher(void);
 static void g_journal_switch_wait(struct g_journal_softc *sc);
 
 #defineGJ_SWITCHER_WORKING 0
 #defineGJ_SWITCHER_DIE 1
 #defineGJ_SWITCHER_DIED2
+static struct proc *g_journal_switcher_proc = NULL;
 static int g_journal_switcher_state = GJ_SWITCHER_WORKING;
 static int g_journal_switcher_wokenup = 0;
 static int g_journal_sync_requested = 0;
@@ -2383,6 +2386,10 @@ g_journal_create(struct g_class *mp, str
sc->sc_jconsumer = cp;
}
 
+   /* Start switcher kproc if needed. */
+   if (g_journal_switcher_proc == NULL)
+   g_journal_start_switcher(mp);
+
if ((sc->sc_type & GJ_TYPE_COMPLETE) != GJ_TYPE_COMPLETE) {
/* Journal is not complete yet. */
return (gp);
@@ -2759,7 +2766,6 @@ static void g_journal_switcher(void *arg
 static void
 g_journal_init(struct g_class *mp)
 {
-   int error;
 
/* Pick a conservative value if provided value sucks. */
if (g_journal_cache_divisor <= 0 ||
@@ -2779,9 +2785,6 @@ g_journal_init(struct g_class *mp)
g_journal_lowmem, mp, EVENTHANDLER_PRI_FIRST);
if (g_journal_event_lowmem == NULL)
GJ_DEBUG(0, "Warning! Cannot register lowmem event.");
-   error = kproc_create(g_journal_switcher, mp, NULL, 0, 0,
-   "g_journal switcher");
-   KASSERT(error == 0, ("Cannot create switcher thread."));
 }
 
 static void
@@ -2794,11 +2797,7 @@ g_journal_fini(struct g_class *mp)
}
if (g_journal_event_lowmem != NULL)
EVENTHANDLER_DEREGISTER(vm_lowmem, g_journal_event_lowmem);
-   g_journal_switcher_state = GJ_SWITCHER_DIE;
-   wakeup(_journal_switcher_state);
-   while (g_journal_switcher_state != GJ_SWITCHER_DIED)
-   tsleep(_journal_switcher_state, PRIBIO, "jfini:wait", hz / 5);
-   GJ_DEBUG(1, "Switcher died.");
+   g_journal_stop_switcher();
 }
 
 DECLARE_GEOM_CLASS(g_journal_class, g_journal);
@@ -2998,9 +2997,34 @@ next:
}
 }
 
+static void
+g_journal_start_switcher(struct g_class *mp)
+{
+   int error;
+
+   g_topology_assert();
+   MPASS(g_journal_switcher_proc == NULL);
+   g_journal_switcher_state = GJ_SWITCHER_WORKING;
+   error = kproc_create(g_journal_switcher, mp, _journal_switcher_proc,
+   0, 0, "g_journal switcher");
+   KASSERT(error == 0, ("Cannot create switcher thread."));
+}
+
+static void
+g_journal_stop_switcher(void)
+{
+   g_topology_assert();
+   MPASS(g_journal_switcher_proc != NULL);
+   g_journal_switcher_state = GJ_SWITCHER_DIE;
+   wakeup(_journal_switcher_state);
+   while (g_journal_switcher_state != GJ_SWITCHER_DIED)
+   tsleep(_journal_switcher_state, PRIBIO, "jfini:wait", hz / 5);
+   GJ_DEBUG(1, "Switcher died.");
+   g_journal_switcher_proc = NULL;
+}
+
 /*
- * TODO: Switcher thread should be started on first geom creation and killed on
- * last geom destruction.
+ * TODO: Kill switcher thread on last geom destruction?
  */
 static void
 g_journal_switcher(void *arg)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313408 - stable/11/sys/dev/pci

2017-02-07 Thread John Baldwin
Author: jhb
Date: Tue Feb  7 22:40:38 2017
New Revision: 313408
URL: https://svnweb.freebsd.org/changeset/base/313408

Log:
  MFC 313097: Require Data Layer Active reporting for native PCI-e HotPlug.
  
  Some PCI-e bridges report that they support HotPlug in the slot
  capabilities but do not report support for Data Layer Active events
  in the link capabilities register.  These bridges do not work correctly
  when HotPlug is used.  Further, while the description of HotPlug in
  the spec does not mention that DL active events are required, the
  description of the link capabilities register says that DL active is
  required for HotPlug.  Thanks to Dave Baukus for finding that language
  in the spec.
  
  PR:   211699

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

Modified: stable/11/sys/dev/pci/pci_pci.c
==
--- stable/11/sys/dev/pci/pci_pci.c Tue Feb  7 20:34:03 2017
(r313407)
+++ stable/11/sys/dev/pci/pci_pci.c Tue Feb  7 22:40:38 2017
(r313408)
@@ -935,6 +935,8 @@ pcib_probe_hotplug(struct pcib_softc *sc
 
if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_HPC) == 0)
return;
+   if ((sc->pcie_link_cap & PCIEM_LINK_CAP_DL_ACTIVE) == 0)
+   return;
 
/*
 * Some devices report that they have an MRL when they actually
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r313260 - head/sys/kern

2017-02-07 Thread Ed Maste
On 7 February 2017 at 10:30, Steven Hartland
 wrote:
> All I'm suggesting is, while one could guess this may be a performance or
> possibly a compatibility thing, the reason is not obvious, so a small piece
> of detail on why the change was done should always be included.
>
> For this one something like the following would be nice:
>
> Switch fget_unlocked to atomic_fcmpset
>
> Improve performance under contention by switching fget_unlocked to
> use atomic_fcmpset.

I agree, and one of the key reasons to do this is so that there's this
tiny bit of context if someone later runs "git blame" or "svn
annotate" and discovers this change for the line containing
atomic_fcmpset. Comments containing "eliminate memory leak" or "remove
unused variable" have a self-evident reason, but I don't believe
that's true for "switch to atomic_fcmpset."

Repeating the "switch fget_unlocked to..." in the proposed commit
message above feels redundant to me though, and I would suggest:

| Switch fget_unlocked to atomic_fcmpset
|
| Improves performance under contention.

or just:

| Use atmoic_fcmpset to improve performance under contention
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313407 - in head: sys/kern sys/sys usr.bin/gcore

2017-02-07 Thread John Baldwin
Author: jhb
Date: Tue Feb  7 20:34:03 2017
New Revision: 313407
URL: https://svnweb.freebsd.org/changeset/base/313407

Log:
  Copy the e_machine and e_flags fields from the binary into an ELF core dump.
  
  In the kernel, cache the machine and flags fields from ELF header to use in
  the ELF header of a core dump. For gcore, the copy these fields over from
  the ELF header in the binary.
  
  This matters for platforms which encode ABI information in the flags field
  (such as o32 vs n32 on MIPS).
  
  Reviewed by:  kib
  Sponsored by: DARPA / AFRL
  Differential Revision:https://reviews.freebsd.org/D9392

Modified:
  head/sys/kern/imgact_elf.c
  head/sys/sys/proc.h
  head/usr.bin/gcore/elfcore.c

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Tue Feb  7 19:47:30 2017(r313406)
+++ head/sys/kern/imgact_elf.c  Tue Feb  7 20:34:03 2017(r313407)
@@ -1055,6 +1055,8 @@ __CONCAT(exec_, __elfN(imgact))(struct i
imgp->interpreted = 0;
imgp->reloc_base = addr;
imgp->proc->p_osrel = osrel;
+   imgp->proc->p_elf_machine = hdr->e_machine;
+   imgp->proc->p_elf_flags = hdr->e_flags;
 
 ret:
free(interp_buf, M_TEMP);
@@ -1655,15 +1657,11 @@ __elfN(puthdr)(struct thread *td, void *
ehdr->e_ident[EI_ABIVERSION] = 0;
ehdr->e_ident[EI_PAD] = 0;
ehdr->e_type = ET_CORE;
-#if defined(COMPAT_FREEBSD32) && __ELF_WORD_SIZE == 32
-   ehdr->e_machine = ELF_ARCH32;
-#else
-   ehdr->e_machine = ELF_ARCH;
-#endif
+   ehdr->e_machine = td->td_proc->p_elf_machine;
ehdr->e_version = EV_CURRENT;
ehdr->e_entry = 0;
ehdr->e_phoff = sizeof(Elf_Ehdr);
-   ehdr->e_flags = 0;
+   ehdr->e_flags = td->td_proc->p_elf_flags;
ehdr->e_ehsize = sizeof(Elf_Ehdr);
ehdr->e_phentsize = sizeof(Elf_Phdr);
ehdr->e_shentsize = sizeof(Elf_Shdr);

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Tue Feb  7 19:47:30 2017(r313406)
+++ head/sys/sys/proc.h Tue Feb  7 20:34:03 2017(r313407)
@@ -617,8 +617,11 @@ struct proc {
   our subtree. */
u_int   p_xexit;/* (c) Exit code. */
u_int   p_xsig; /* (c) Stop/kill sig. */
+   uint16_tp_elf_machine;  /* (x) ELF machine type */
+   uint64_tp_elf_flags;/* (x) ELF flags */
+   
 /* End area that is copied on creation. */
-#definep_endcopy   p_xsig
+#definep_endcopy   p_elf_flags
struct pgrp *p_pgrp;/* (c + e) Pointer to process group. */
struct knlist   *p_klist;   /* (c) Knotes attached to this proc. */
int p_numthreads;   /* (c) Number of threads. */

Modified: head/usr.bin/gcore/elfcore.c
==
--- head/usr.bin/gcore/elfcore.cTue Feb  7 19:47:30 2017
(r313406)
+++ head/usr.bin/gcore/elfcore.cTue Feb  7 20:34:03 2017
(r313407)
@@ -117,8 +117,8 @@ static void *elf_note_procstat_psstrings
 static void *elf_note_procstat_rlimit(void *, size_t *);
 static void *elf_note_procstat_umask(void *, size_t *);
 static void *elf_note_procstat_vmmap(void *, size_t *);
-static void elf_puthdr(pid_t, vm_map_entry_t, void *, size_t, size_t, size_t,
-int);
+static void elf_puthdr(int, pid_t, vm_map_entry_t, void *, size_t, size_t,
+size_t, int);
 static void elf_putnote(int, notefunc_t, void *, struct sbuf *);
 static void elf_putnotes(pid_t, struct sbuf *, size_t *);
 static void freemap(vm_map_entry_t);
@@ -178,7 +178,7 @@ elf_detach(void)
  * Write an ELF coredump for the given pid to the given fd.
  */
 static void
-elf_coredump(int efd __unused, int fd, pid_t pid)
+elf_coredump(int efd, int fd, pid_t pid)
 {
vm_map_entry_t map;
struct sseg_closure seginfo;
@@ -230,7 +230,7 @@ elf_coredump(int efd __unused, int fd, p
hdr = sbuf_data(sb);
segoff = sbuf_len(sb);
/* Fill in the header. */
-   elf_puthdr(pid, map, hdr, hdrsize, notesz, segoff, seginfo.count);
+   elf_puthdr(efd, pid, map, hdr, hdrsize, notesz, segoff, seginfo.count);
 
n = write(fd, hdr, segoff);
if (n == -1)
@@ -420,14 +420,21 @@ elf_putnote(int type, notefunc_t notefun
  * Generate the ELF coredump header.
  */
 static void
-elf_puthdr(pid_t pid, vm_map_entry_t map, void *hdr, size_t hdrsize,
+elf_puthdr(int efd, pid_t pid, vm_map_entry_t map, void *hdr, size_t hdrsize,
 size_t notesz, size_t segoff, int numsegs)
 {
-   Elf_Ehdr *ehdr;
+   Elf_Ehdr *ehdr, binhdr;
Elf_Phdr *phdr;
Elf_Shdr *shdr;
struct phdr_closure phc;
+   ssize_t cnt;
 
+   cnt = read(efd, , sizeof(binhdr));
+   if (cnt < 0)
+   

Re: svn commit: r313352 - in head/sys: compat/cloudabi compat/freebsd32 compat/linux vm

2017-02-07 Thread Konstantin Belousov
On Tue, Feb 07, 2017 at 12:29:35PM -0600, Alan Cox wrote:
> I tend to agree with John.  Why not use the same types for the kern_*
> parameters as are used in the corresponding args structure?  Let the
> conversion to the Mach VM types happen inside of the function's
> implementation.

I do not object, but still I want to point out that such arrangement
really depends on all Unix-like systems using the same type model (ILP32
or LP64 or both). If we would try to use current kern_* functions from
syscallsubr.h for something more involved, like x32, then the assumption
breaks and the type puns are spread.

In fact, even in the compat32 layer (host native ILP32->LP64), the
somewhat incorrect type manipulations are performed, e.g. we represent
a binary-native pointer as host' uint32_t type, which is converted to
void * for the purpose of kern_ calls. This conversion assumes much more
about the platform than only type sizes, e.g. the flat address space
with individually addressable bytes and normal arithmetic for pointers.
Mach types are somewhat better in this respect, with purposedly used
arithmetic types like vm_size_t, vm_offset_t, vm_ooffset_t for address
space operations.

Again, I do not object but want to note this mismatch.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313404 - in head/lib/libnetbsd: . sys

2017-02-07 Thread Ngie Cooper
Author: ngie
Date: Tue Feb  7 19:42:41 2017
New Revision: 313404
URL: https://svnweb.freebsd.org/changeset/base/313404

Log:
  Improve libnetbsd compatibility with NetBSD
  
  This change is being made to diff reduce/reduce duplication in
  contrib/netbsd-tests and to facilitate further porting of software from
  NetBSD
  
  Add the following headers:
  - sys/event.h:
  -- sys/types.h is required for kqueue on FreeBSD, but not NetBSD.
  - sys/types.h:
  -- NBBY is defined in sys/param.h on FreeBSD, not sys/types.h like on NetBSD.
 Pull in sys/param.h to have parity with NetBSD.
  - sys/wait.h:
  -- Define wrusage as __wrusage for parity with NetBSD typedef.
  - glob.h
  -- Define __gl_stat_t as "struct stat" for parity with NetBSD typedef.
  - pthread.h:
  -- Pull in pthread_np.h for _np functions defined separately on FreeBSD.
  
  Improve compatibility with NetBSD in the following headers:
  
  - sha1.h:
  -- define SHA1_CTX as SHA_CTX
  -- define SHA1Final as SHA1_Final
  - sha2.h:
  -- #include sha384 to pick up all of the SHA 384 bit macros and definitions.
  - util.h:
  -- Add sys/types.h to util.h to pollute the header for types used in
 flags_to_string and string_to_flags (u_long) as NetBSD doesn't require them
 for the functions.
  
  MFC after:  2 weeks
  Sponsored by:   Dell EMC Isilon

Added:
  head/lib/libnetbsd/glob.h
 - copied, changed from r31, 
projects/netbsd-tests-upstream-01-2017/lib/libnetbsd/glob.h
  head/lib/libnetbsd/pthread.h
 - copied, changed from r312303, 
projects/netbsd-tests-upstream-01-2017/lib/libnetbsd/pthread.h
  head/lib/libnetbsd/sys/event.h
 - copied unchanged from r312242, 
projects/netbsd-tests-upstream-01-2017/lib/libnetbsd/sys/event.h
  head/lib/libnetbsd/sys/types.h
 - copied unchanged from r312241, 
projects/netbsd-tests-upstream-01-2017/lib/libnetbsd/sys/types.h
  head/lib/libnetbsd/sys/wait.h
 - copied unchanged from r312240, 
projects/netbsd-tests-upstream-01-2017/lib/libnetbsd/sys/wait.h
Modified:
  head/lib/libnetbsd/sha1.h
  head/lib/libnetbsd/sha2.h
  head/lib/libnetbsd/util.h

Copied and modified: head/lib/libnetbsd/glob.h (from r31, 
projects/netbsd-tests-upstream-01-2017/lib/libnetbsd/glob.h)
==
--- projects/netbsd-tests-upstream-01-2017/lib/libnetbsd/glob.h Sun Jan 15 
10:16:20 2017(r31, copy source)
+++ head/lib/libnetbsd/glob.h   Tue Feb  7 19:42:41 2017(r313404)
@@ -1,33 +1,30 @@
-/* $FreeBSD$   */
-
 /*-
- * Copyright (c) 2012 SRI International
+ * Copyright (c) 2017 Dell, Inc.
  * All rights reserved.
  *
- * This software was developed by SRI International and the University of
- * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
- * ("CTSRD"), as part of the DARPA CRASH research programme.
- *
  * 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.
+ * 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.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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.
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 

svn commit: r313403 - head/sys/arm/allwinner

2017-02-07 Thread Emmanuel Vadot
Author: manu
Date: Tue Feb  7 19:28:32 2017
New Revision: 313403
URL: https://svnweb.freebsd.org/changeset/base/313403

Log:
  Rename timer.c to a10_timer.c
  
  Requested by: andrew

Added:
  head/sys/arm/allwinner/a10_timer.c
 - copied unchanged from r313402, head/sys/arm/allwinner/timer.c
Deleted:
  head/sys/arm/allwinner/timer.c
Modified:
  head/sys/arm/allwinner/files.allwinner_up

Copied: head/sys/arm/allwinner/a10_timer.c (from r313402, 
head/sys/arm/allwinner/timer.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/a10_timer.c  Tue Feb  7 19:28:32 2017
(r313403, copy of r313402, head/sys/arm/allwinner/timer.c)
@@ -0,0 +1,367 @@
+/*-
+ * Copyright (c) 2012 Ganbold Tsagaankhuu 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+
+/**
+ * Timer registers addr
+ *
+ */
+#define SW_TIMER_IRQ_EN_REG0x00
+#define SW_TIMER_IRQ_STA_REG   0x04
+#define SW_TIMER0_CTRL_REG 0x10
+#define SW_TIMER0_INT_VALUE_REG0x14
+#define SW_TIMER0_CUR_VALUE_REG0x18
+
+#define SW_COUNTER64LO_REG 0xa4
+#define SW_COUNTER64HI_REG 0xa8
+#define CNT64_CTRL_REG 0xa0
+
+#define CNT64_RL_EN0x02 /* read latch enable */
+
+#define TIMER_ENABLE   (1<<0)
+#define TIMER_AUTORELOAD   (1<<1)
+#define TIMER_OSC24M   (1<<2) /* oscillator = 24mhz */
+#define TIMER_PRESCALAR(0<<4) /* prescalar = 1 */
+
+#define SYS_TIMER_CLKSRC   2400 /* clock source */
+
+struct a10_timer_softc {
+   device_tsc_dev;
+   struct resource *res[2];
+   bus_space_tag_t sc_bst;
+   bus_space_handle_t sc_bsh;
+   void*sc_ih; /* interrupt handler */
+   uint32_tsc_period;
+   uint32_ttimer0_freq;
+   struct eventtimer et;
+};
+
+int a10_timer_get_timerfreq(struct a10_timer_softc *);
+
+#define timer_read_4(sc, reg)  \
+   bus_space_read_4(sc->sc_bst, sc->sc_bsh, reg)
+#define timer_write_4(sc, reg, val)\
+   bus_space_write_4(sc->sc_bst, sc->sc_bsh, reg, val)
+
+static u_int   a10_timer_get_timecount(struct timecounter *);
+static int a10_timer_timer_start(struct eventtimer *,
+sbintime_t first, sbintime_t period);
+static int a10_timer_timer_stop(struct eventtimer *);
+
+static uint64_t timer_read_counter64(void);
+
+static int a10_timer_hardclock(void *);
+static int a10_timer_probe(device_t);
+static int a10_timer_attach(device_t);
+
+static delay_func a10_timer_delay;
+
+static struct timecounter a10_timer_timecounter = {
+   .tc_name   = "a10_timer timer0",
+   .tc_get_timecount  = a10_timer_get_timecount,
+   .tc_counter_mask   = ~0u,
+   .tc_frequency  = 0,
+   .tc_quality= 1000,
+};
+
+struct a10_timer_softc *a10_timer_sc = NULL;
+
+static struct resource_spec a10_timer_spec[] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
+   { SYS_RES_IRQ,  0,  RF_ACTIVE },
+   { -1, 0 }
+};
+
+static uint64_t
+timer_read_counter64(void)
+{
+   uint32_t lo, hi;
+
+   /* Latch counter, wait for it to be ready to read. */
+   timer_write_4(a10_timer_sc, CNT64_CTRL_REG, CNT64_RL_EN);
+   while (timer_read_4(a10_timer_sc, CNT64_CTRL_REG) & CNT64_RL_EN)
+   continue;
+
+   hi = timer_read_4(a10_timer_sc, 

Re: svn commit: r313398 - head/contrib/byacc/test/yacc

2017-02-07 Thread Ngie Cooper (yaneurabeya)

> On Feb 7, 2017, at 10:46, Jung-uk Kim  wrote:
> 
> On 02/07/2017 13:40, Ngie Cooper (yaneurabeya) wrote:
>> 
>>> On Feb 7, 2017, at 10:37, Ngie Cooper  wrote:
>>> 
>>> Author: ngie
>>> Date: Tue Feb  7 18:37:46 2017
>>> New Revision: 313398
>>> URL: https://svnweb.freebsd.org/changeset/base/313398
>>> 
>>> Log:
>>> Apply r274475's to expr.oxout.tab.c to fix the test on FreeBSD
>>> 
>>> YYINT on FreeBSD is int, not short
>>> 
>>> I'll work with the upstream maintainer or come up with a build
>>> method of modifying their definitions on install instead of
>>> having to modify tests to match our forked YYINT definition.
>>> 
>>> PR: 216891
>>> Sponsored by:   Dell EMC Isilon
>> 
>>  I forgot to mention… "X-MFC with:   r313105, r313106”.
>>  An MFC timer was never set for those changes, so I didn’t set a timer 
>> in my change either, but if those changes are backported, I can backport 
>> this one as well.
> 
> Thanks and sorry for the break.

No worries :)… I have an idea for how to do this more reliably in the future 
without having to hack up the tests. I’ll send that out for CR sometime this 
coming week.
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r313342 - head/sys/conf

2017-02-07 Thread Andrew Turner
On Mon, 06 Feb 2017 10:43:09 -0800
John Baldwin  wrote:

> On Monday, February 06, 2017 02:41:34 PM Andrew Turner wrote:
> > Author: andrew
> > Date: Mon Feb  6 14:41:34 2017
> > New Revision: 313342
> > URL: https://svnweb.freebsd.org/changeset/base/313342
> > 
> > Log:
> >   Only build the ACPI PCI drivers on x86, they are unlikely to be
> > used on arm64 without dignificant changes.
> >   
> >   Obtained from:ABT Systems Ltd
> >   Sponsored by: The FreeBSD Foundation  
> 
> I still think this is not really the right approach.  Nothing about
> _BBN, _CRS, or _PRT, etc. is x86-specific.
> 

the main issue is the code assumes a single PCIe root controller, e.g.
the pci_cfg* KPI won't work on ThunderX with 6 independent PCIe root
controllers. I expect much of the code could be re-enabled on arm64,
however for now it's easier to disable it.

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


svn commit: r313401 - head/sys/netinet

2017-02-07 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Feb  7 18:57:57 2017
New Revision: 313401
URL: https://svnweb.freebsd.org/changeset/base/313401

Log:
  Fix garbage IP addresses in UDP log_in_vain messages
  
  If multiple threads emit a UDP log_in_vain message concurrently,
  the IP addresses could be garbage due to concurrent usage of a
  single string buffer inside inet_ntoa().  Use inet_ntoa_r() with
  two stack buffers instead.
  
  Reported by:  Mark Martinec 
  MFC after:3 days
  Relnotes: yes
  Sponsored by: Dell EMC

Modified:
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/udp_usrreq.c
==
--- head/sys/netinet/udp_usrreq.c   Tue Feb  7 18:57:52 2017
(r313400)
+++ head/sys/netinet/udp_usrreq.c   Tue Feb  7 18:57:57 2017
(r313401)
@@ -667,13 +667,13 @@ udp_input(struct mbuf **mp, int *offp, i
INPLOOKUP_RLOCKPCB, ifp, m);
if (inp == NULL) {
if (udp_log_in_vain) {
-   char buf[4*sizeof "123"];
+   char src[INET_ADDRSTRLEN];
+   char dst[INET_ADDRSTRLEN];
 
-   strcpy(buf, inet_ntoa(ip->ip_dst));
log(LOG_INFO,
"Connection attempt to UDP %s:%d from %s:%d\n",
-   buf, ntohs(uh->uh_dport), inet_ntoa(ip->ip_src),
-   ntohs(uh->uh_sport));
+   inet_ntoa_r(ip->ip_dst, dst), ntohs(uh->uh_dport),
+   inet_ntoa_r(ip->ip_src, src), ntohs(uh->uh_sport));
}
UDPSTAT_INC(udps_noport);
if (m->m_flags & (M_BCAST | M_MCAST)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r313398 - head/contrib/byacc/test/yacc

2017-02-07 Thread Jung-uk Kim

On 02/07/2017 13:40, Ngie Cooper (yaneurabeya) wrote:



On Feb 7, 2017, at 10:37, Ngie Cooper  wrote:

Author: ngie
Date: Tue Feb  7 18:37:46 2017
New Revision: 313398
URL: https://svnweb.freebsd.org/changeset/base/313398

Log:
 Apply r274475's to expr.oxout.tab.c to fix the test on FreeBSD

 YYINT on FreeBSD is int, not short

 I'll work with the upstream maintainer or come up with a build
 method of modifying their definitions on install instead of
 having to modify tests to match our forked YYINT definition.

 PR:216891
 Sponsored by:  Dell EMC Isilon


I forgot to mention… "X-MFC with:  r313105, r313106”.
An MFC timer was never set for those changes, so I didn’t set a timer 
in my change either, but if those changes are backported, I can backport this 
one as well.


Thanks and sorry for the break.

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

Re: svn commit: r313398 - head/contrib/byacc/test/yacc

2017-02-07 Thread Ngie Cooper (yaneurabeya)

> On Feb 7, 2017, at 10:37, Ngie Cooper  wrote:
> 
> Author: ngie
> Date: Tue Feb  7 18:37:46 2017
> New Revision: 313398
> URL: https://svnweb.freebsd.org/changeset/base/313398
> 
> Log:
>  Apply r274475's to expr.oxout.tab.c to fix the test on FreeBSD
> 
>  YYINT on FreeBSD is int, not short
> 
>  I'll work with the upstream maintainer or come up with a build
>  method of modifying their definitions on install instead of
>  having to modify tests to match our forked YYINT definition.
> 
>  PR:  216891
>  Sponsored by:Dell EMC Isilon

I forgot to mention… "X-MFC with:   r313105, r313106”.
An MFC timer was never set for those changes, so I didn’t set a timer 
in my change either, but if those changes are backported, I can backport this 
one as well.
Thanks,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r313398 - head/contrib/byacc/test/yacc

2017-02-07 Thread Ngie Cooper
Author: ngie
Date: Tue Feb  7 18:37:46 2017
New Revision: 313398
URL: https://svnweb.freebsd.org/changeset/base/313398

Log:
  Apply r274475's to expr.oxout.tab.c to fix the test on FreeBSD
  
  YYINT on FreeBSD is int, not short
  
  I'll work with the upstream maintainer or come up with a build
  method of modifying their definitions on install instead of
  having to modify tests to match our forked YYINT definition.
  
  PR:   216891
  Sponsored by: Dell EMC Isilon

Modified:
  head/contrib/byacc/test/yacc/expr.oxout.tab.c

Modified: head/contrib/byacc/test/yacc/expr.oxout.tab.c
==
--- head/contrib/byacc/test/yacc/expr.oxout.tab.c   Tue Feb  7 18:23:44 
2017(r313397)
+++ head/contrib/byacc/test/yacc/expr.oxout.tab.c   Tue Feb  7 18:37:46 
2017(r313398)
@@ -178,7 +178,7 @@ extern int YYPARSE_DECL();
 #define ID 257
 #define CONST 258
 #define YYERRCODE 256
-typedef short YYINT;
+typedef int YYINT;
 static const YYINT expr.oxout_lhs[] = {  -1,
 2,0,1,3,3,3,3,3,3,3,
 };
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r313352 - in head/sys: compat/cloudabi compat/freebsd32 compat/linux vm

2017-02-07 Thread Alan Cox
On 02/07/2017 11:55, John Baldwin wrote:
> On Tuesday, February 07, 2017 12:55:08 PM Edward Tomasz Napierala wrote:
>> On 0207T1039, Konstantin Belousov wrote:
>>> On Mon, Feb 06, 2017 at 03:03:11PM -0800, John Baldwin wrote:
 On Monday, February 06, 2017 08:57:12 PM Edward Tomasz Napierala wrote:
> Author: trasz
> Date: Mon Feb  6 20:57:12 2017
> New Revision: 313352
> URL: https://svnweb.freebsd.org/changeset/base/313352
>
> Log:
>   Add kern_vm_mmap2(), kern_vm_mprotect(), kern_vm_msync(), 
> kern_vm_munlock(),
>   kern_vm_munmap(), and kern_vm_madvise(), and use them in various compats
>   instead of their sys_*() counterparts.
>   
>   Reviewed by:ed, dchagin, kib
>   MFC after:  2 weeks
>   Sponsored by:   DARPA, AFRL
>   Differential Revision:  https://reviews.freebsd.org/D9378
 I know kib@ suggested kern_vm_ instead of the vm_ you had 
 suggested,
 but just kern_ would be more consistent.  That is what we have done 
 with
 every other system call.  (e.g. there isn't kern_socket_bind, 
 kern_socket_listen,
 etc., but just kern_bind() and kern_listen()).
>>> Note that the kern_vm_* functions are not quite regular syscall helpers.
>>> The big issue with them, which caused my suggestion, is that the
>>> functions cannot be declared in sys/syscallsubr.h, because their
>>> declarations depend on the vm/*.h namespace.
>> Exactly; they use vm-specific types (vm_offset_t, for example).  And I
>> wanted to avoid changing the types all over the place, at least for now.
> You would only need  though right?  None of the actual objects
> are used, just things like vm_prot_t?
>
> OTOH, kern_* is currently only used for things that are syscall 
> implementations
> and generally take syscall arguments directly (or close approximations of
> syscall arguments).  It is annoying to lose the consistency in meaning.
>

I tend to agree with John.  Why not use the same types for the kern_*
parameters as are used in the corresponding args structure?  Let the
conversion to the Mach VM types happen inside of the function's
implementation.


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


svn commit: r313397 - head/usr.bin/sed/tests

2017-02-07 Thread Ngie Cooper
Author: ngie
Date: Tue Feb  7 18:23:44 2017
New Revision: 313397
URL: https://svnweb.freebsd.org/changeset/base/313397

Log:
  Don't expect :inplace_symlink_src to fail anymore (post-r313277)
  
  The S_ISREG check was restored, such that the code will again fail with
  in-place replacements on symlinks
  
  MFC after:12 days
  X-MFC with:   r313277
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.bin/sed/tests/sed2_test.sh

Modified: head/usr.bin/sed/tests/sed2_test.sh
==
--- head/usr.bin/sed/tests/sed2_test.sh Tue Feb  7 18:19:11 2017
(r313396)
+++ head/usr.bin/sed/tests/sed2_test.sh Tue Feb  7 18:23:44 2017
(r313397)
@@ -47,8 +47,6 @@ inplace_symlink_src_head()
 }
 inplace_symlink_src_body()
 {
-   atf_expect_fail "Check for S_IFREG reverted in r312404"
-
echo foo > a
atf_check ln -s a b
atf_check -e not-empty -s not-exit:0 sed -i '' -e 's,foo,bar,g' b
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313396 - in head/sys/arm64: arm64 include

2017-02-07 Thread Andrew Turner
Author: andrew
Date: Tue Feb  7 18:19:11 2017
New Revision: 313396
URL: https://svnweb.freebsd.org/changeset/base/313396

Log:
  Push reading of ESR_EL1 to assembly. Among other uses this will allow us
  to expose this to signal handlers, e.g. for the clang sanitizers.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/exception.S
  head/sys/arm64/arm64/genassym.c
  head/sys/arm64/arm64/trap.c
  head/sys/arm64/include/frame.h

Modified: head/sys/arm64/arm64/exception.S
==
--- head/sys/arm64/arm64/exception.STue Feb  7 17:40:59 2017
(r313395)
+++ head/sys/arm64/arm64/exception.STue Feb  7 18:19:11 2017
(r313396)
@@ -56,10 +56,12 @@ __FBSDID("$FreeBSD$");
stp x0,  x1,  [sp, #(TF_X + 0  * 8)]
mrs x10, elr_el1
mrs x11, spsr_el1
+   mrs x12, esr_el1
 .if \el == 0
mrs x18, sp_el0
 .endif
-   stp x10, x11, [sp, #(TF_ELR)]
+   str x10, [sp, #(TF_ELR)]
+   stp w11, w12, [sp, #(TF_SPSR)]
stp x18,  lr, [sp, #(TF_SP)]
mrs x18, tpidr_el1
add x29, sp, #(TF_SIZE)

Modified: head/sys/arm64/arm64/genassym.c
==
--- head/sys/arm64/arm64/genassym.c Tue Feb  7 17:40:59 2017
(r313395)
+++ head/sys/arm64/arm64/genassym.c Tue Feb  7 18:19:11 2017
(r313396)
@@ -62,4 +62,5 @@ ASSYM(TD_LOCK, offsetof(struct thread, t
 ASSYM(TF_SIZE, sizeof(struct trapframe));
 ASSYM(TF_SP, offsetof(struct trapframe, tf_sp));
 ASSYM(TF_ELR, offsetof(struct trapframe, tf_elr));
+ASSYM(TF_SPSR, offsetof(struct trapframe, tf_spsr));
 ASSYM(TF_X, offsetof(struct trapframe, tf_x));

Modified: head/sys/arm64/arm64/trap.c
==
--- head/sys/arm64/arm64/trap.c Tue Feb  7 17:40:59 2017(r313395)
+++ head/sys/arm64/arm64/trap.c Tue Feb  7 18:19:11 2017(r313396)
@@ -257,7 +257,7 @@ print_registers(struct trapframe *frame)
printf("  sp: %16lx\n", frame->tf_sp);
printf("  lr: %16lx\n", frame->tf_lr);
printf(" elr: %16lx\n", frame->tf_elr);
-   printf("spsr: %16lx\n", frame->tf_spsr);
+   printf("spsr: %8x\n", frame->tf_spsr);
 }
 
 void
@@ -267,7 +267,7 @@ do_el1h_sync(struct trapframe *frame)
uint64_t esr, far;
 
/* Read the esr register to get the exception details */
-   esr = READ_SPECIALREG(esr_el1);
+   esr = frame->tf_esr;
exception = ESR_ELx_EXCEPTION(esr);
 
 #ifdef KDTRACE_HOOKS
@@ -352,7 +352,7 @@ do_el0_sync(struct trapframe *frame)
td = curthread;
td->td_frame = frame;
 
-   esr = READ_SPECIALREG(esr_el1);
+   esr = frame->tf_esr;
exception = ESR_ELx_EXCEPTION(esr);
switch (exception) {
case EXCP_UNKNOWN:

Modified: head/sys/arm64/include/frame.h
==
--- head/sys/arm64/include/frame.h  Tue Feb  7 17:40:59 2017
(r313395)
+++ head/sys/arm64/include/frame.h  Tue Feb  7 18:19:11 2017
(r313396)
@@ -45,7 +45,8 @@ struct trapframe {
uint64_t tf_sp;
uint64_t tf_lr;
uint64_t tf_elr;
-   uint64_t tf_spsr;
+   uint32_t tf_spsr;
+   uint32_t tf_esr;
uint64_t tf_x[30];
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r313352 - in head/sys: compat/cloudabi compat/freebsd32 compat/linux vm

2017-02-07 Thread John Baldwin
On Tuesday, February 07, 2017 12:55:08 PM Edward Tomasz Napierala wrote:
> On 0207T1039, Konstantin Belousov wrote:
> > On Mon, Feb 06, 2017 at 03:03:11PM -0800, John Baldwin wrote:
> > > On Monday, February 06, 2017 08:57:12 PM Edward Tomasz Napierala wrote:
> > > > Author: trasz
> > > > Date: Mon Feb  6 20:57:12 2017
> > > > New Revision: 313352
> > > > URL: https://svnweb.freebsd.org/changeset/base/313352
> > > > 
> > > > Log:
> > > >   Add kern_vm_mmap2(), kern_vm_mprotect(), kern_vm_msync(), 
> > > > kern_vm_munlock(),
> > > >   kern_vm_munmap(), and kern_vm_madvise(), and use them in various 
> > > > compats
> > > >   instead of their sys_*() counterparts.
> > > >   
> > > >   Reviewed by:  ed, dchagin, kib
> > > >   MFC after:2 weeks
> > > >   Sponsored by: DARPA, AFRL
> > > >   Differential Revision:https://reviews.freebsd.org/D9378
> > > 
> > > I know kib@ suggested kern_vm_ instead of the vm_ you had 
> > > suggested,
> > > but just kern_ would be more consistent.  That is what we have done 
> > > with
> > > every other system call.  (e.g. there isn't kern_socket_bind, 
> > > kern_socket_listen,
> > > etc., but just kern_bind() and kern_listen()).
> > 
> > Note that the kern_vm_* functions are not quite regular syscall helpers.
> > The big issue with them, which caused my suggestion, is that the
> > functions cannot be declared in sys/syscallsubr.h, because their
> > declarations depend on the vm/*.h namespace.
> 
> Exactly; they use vm-specific types (vm_offset_t, for example).  And I
> wanted to avoid changing the types all over the place, at least for now.

You would only need  though right?  None of the actual objects
are used, just things like vm_prot_t?

OTOH, kern_* is currently only used for things that are syscall implementations
and generally take syscall arguments directly (or close approximations of
syscall arguments).  It is annoying to lose the consistency in meaning.

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


svn commit: r313395 - head/tests/sys/netinet

2017-02-07 Thread Alan Somers
Author: asomers
Date: Tue Feb  7 17:40:59 2017
New Revision: 313395
URL: https://svnweb.freebsd.org/changeset/base/313395

Log:
  Add fibs_test:udp_dontroute6, another IPv6 multi-FIB test
  
  PR:   196361
  MFC after:3 weeks
  Sponsored by: Spectra Logic Corp

Modified:
  head/tests/sys/netinet/fibs_test.sh
  head/tests/sys/netinet/udp_dontroute.c

Modified: head/tests/sys/netinet/fibs_test.sh
==
--- head/tests/sys/netinet/fibs_test.sh Tue Feb  7 17:31:24 2017
(r313394)
+++ head/tests/sys/netinet/fibs_test.sh Tue Feb  7 17:40:59 2017
(r313395)
@@ -595,6 +595,61 @@ udp_dontroute_cleanup()
cleanup_tap
 }
 
+atf_test_case udp_dontroute6 cleanup
+udp_dontroute6_head()
+{
+   atf_set "descr" "Source address selection for UDP IPv6 packets with 
SO_DONTROUTE on non-default FIBs works"
+   atf_set "require.user" "root"
+   atf_set "require.config" "fibs"
+}
+
+udp_dontroute6_body()
+{
+   # Configure the TAP interface to use an RFC3849 nonrouteable address
+   # and a non-default fib
+   ADDR0="2001:db8::2"
+   ADDR1="2001:db8::3"
+   SUBNET="2001:db8::"
+   MASK="64"
+   # Use a different IP on the same subnet as the target
+   TARGET="2001:db8::100"
+   SRCDIR=`atf_get_srcdir`
+
+   atf_expect_fail "PR196361 IPv6 network routes don't respect 
net.add_addr_allfibs=0"
+
+   # Check system configuration
+   if [ 0 != `sysctl -n net.add_addr_allfibs` ]; then
+   atf_skip "This test requires net.add_addr_allfibs=0"
+   fi
+   get_fibs 2
+
+   # Configure the TAP interfaces.  Use no_dad so the addresses will be
+   # ready right away and won't be marked as tentative until DAD
+   # completes.
+   setup_tap ${FIB0} inet6 ${ADDR0} ${MASK} no_dad
+   TARGET_TAP=${TAP}
+   setup_tap ${FIB1} inet6 ${ADDR1} ${MASK} no_dad
+
+   # Send a UDP packet with SO_DONTROUTE.  In the failure case, it will
+   # return ENETUNREACH, or send the packet to the wrong tap
+   atf_check -o ignore setfib ${FIB0} \
+   ${SRCDIR}/udp_dontroute -6 ${TARGET} /dev/${TARGET_TAP}
+   cleanup_tap
+
+   # Repeat, but this time target the other tap
+   setup_tap ${FIB0} inet6 ${ADDR0} ${MASK} no_dad
+   setup_tap ${FIB1} inet6 ${ADDR1} ${MASK} no_dad
+   TARGET_TAP=${TAP}
+
+   atf_check -o ignore setfib ${FIB1} \
+   ${SRCDIR}/udp_dontroute -6 ${TARGET} /dev/${TARGET_TAP}
+}
+
+udp_dontroute6_cleanup()
+{
+   cleanup_tap
+}
+
 
 atf_init_test_cases()
 {
@@ -609,6 +664,7 @@ atf_init_test_cases()
atf_add_test_case subnet_route_with_multiple_fibs_on_same_subnet
atf_add_test_case subnet_route_with_multiple_fibs_on_same_subnet_inet6
atf_add_test_case udp_dontroute
+   atf_add_test_case udp_dontroute6
 }
 
 # Looks up one or more fibs from the configuration data and validates them.
@@ -656,6 +712,7 @@ get_tap()
 # Protocol (inet or inet6)
 # IP address
 # Netmask in number of bits (eg 24 or 8)
+# Extra flags
 # Return: the tap interface name as the env variable TAP
 setup_tap()
 {
@@ -663,9 +720,10 @@ setup_tap()
local PROTO=$2
local ADDR=$3
local MASK=$4
+   local FLAGS=$5
get_tap
-   echo setfib ${FIB} ifconfig $TAP ${PROTO} ${ADDR}/${MASK} fib $FIB
-   setfib ${FIB} ifconfig $TAP ${PROTO} ${ADDR}/${MASK} fib $FIB
+   echo setfib ${FIB} ifconfig $TAP ${PROTO} ${ADDR}/${MASK} fib $FIB 
$FLAGS
+   setfib ${FIB} ifconfig $TAP ${PROTO} ${ADDR}/${MASK} fib $FIB $FLAGS
 }
 
 cleanup_tap()

Modified: head/tests/sys/netinet/udp_dontroute.c
==
--- head/tests/sys/netinet/udp_dontroute.c  Tue Feb  7 17:31:24 2017
(r313394)
+++ head/tests/sys/netinet/udp_dontroute.c  Tue Feb  7 17:40:59 2017
(r313395)
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -52,7 +53,7 @@
 int
 main(int argc, char **argv)
 {
-   struct sockaddr_in dst;
+   struct sockaddr_storage dst;
int s, t;
int opt;
int ret;
@@ -60,17 +61,33 @@ main(int argc, char **argv)
const char* sendbuf = "Hello, World!";
const size_t buflen = 80;
char recvbuf[buflen];
-
-   if (argc != 3) {
-   fprintf(stderr, "Usage: %s ip_address tapdev\n", argv[0]);
+   bool v6 = false;
+   const char *addr, *tapdev;
+   const uint16_t port = 46120;
+
+   bzero(, sizeof(dst));
+   if (argc < 3 || argc > 4) {
+   fprintf(stderr, "Usage: %s [-6] ip_address tapdev\n", argv[0]);
exit(2);
}
 
-   t = open(argv[2], O_RDWR | O_NONBLOCK);
+   if (strcmp("-6", argv[1]) == 0) {
+   v6 = true;
+   addr = argv[2];
+   tapdev = argv[3];
+   } else {
+   

svn commit: r313394 - head/sys/kern

2017-02-07 Thread Emmanuel Vadot
Author: manu
Date: Tue Feb  7 17:31:24 2017
New Revision: 313394
URL: https://svnweb.freebsd.org/changeset/base/313394

Log:
  subr_sfbus.c need sys/proc.h for struct thread definition.
  This fixes kernel build for armv6.
  
  Discussed with: kib

Modified:
  head/sys/kern/subr_sfbuf.c

Modified: head/sys/kern/subr_sfbuf.c
==
--- head/sys/kern/subr_sfbuf.c  Tue Feb  7 17:15:13 2017(r313393)
+++ head/sys/kern/subr_sfbuf.c  Tue Feb  7 17:31:24 2017(r313394)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313393 - head/sys/modules/dtb/allwinner

2017-02-07 Thread Emmanuel Vadot
Author: manu
Date: Tue Feb  7 17:15:13 2017
New Revision: 313393
URL: https://svnweb.freebsd.org/changeset/base/313393

Log:
  Switch to the Linux device tree upstream names for Allwinner boards.
  Newer u-boot that uses the u-boot-master port uses these names.

Modified:
  head/sys/modules/dtb/allwinner/Makefile

Modified: head/sys/modules/dtb/allwinner/Makefile
==
--- head/sys/modules/dtb/allwinner/Makefile Tue Feb  7 17:04:31 2017
(r313392)
+++ head/sys/modules/dtb/allwinner/Makefile Tue Feb  7 17:15:13 2017
(r313393)
@@ -1,17 +1,26 @@
 # $FreeBSD$
 # All the dts files for allwinner systems we support.
 DTS=   \
-   bananapi.dts \
-   bananapim2.dts \
-   cubieboard.dts \
-   cubieboard2.dts \
nanopi-neo.dts \
-   olimex-a20-som-evb.dts \
-   olinuxino-lime.dts \
orangepi-plus-2e.dts \
-   pcduino3.dts \
sinovoip-bpi-m3.dts \
+   sun4i-a10-cubieboard.dts \
+   sun4i-a10-olinuxino-lime.dts \
+   sun6i-a31s-sinovoip-bpi-m2.dts \
sun5i-a13-olinuxino.dts \
-   sun5i-r8-chip.dts
+   sun5i-r8-chip.dts \
+   sun7i-a20-bananapi.dts \
+   sun7i-a20-cubieboard2.dts \
+   sun7i-a20-olimex-som-evb.dts \
+   sun7i-a20-pcduino3.dts
+
+LINKS= \
+   ${DTBDIR}/sun4i-a10-cubieboard.dtb ${DTBDIR}/cubieboard.dtb \
+   ${DTBDIR}/sun4i-a10-olinuxino-lime.dtb ${DTBDIR}/olinuxino-lime.dtb \
+   ${DTBDIR}/sun6i-a31s-sinovoip-bpi-m2.dtb ${DTBDIR}/bananapim2.dtb \
+   ${DTBDIR}/sun7i-a20-bananapi.dtb ${DTBDIR}/bananapi.dtb \
+   ${DTBDIR}/sun7i-a20-cubieboard2.dtb ${DTBDIR}/cubieboard2.dtb \
+   ${DTBDIR}/sun7i-a20-olimex-som-evb.dtb ${DTBDIR}/olimex-a20-som-evb.dtb 
\
+   ${DTBDIR}/sun7i-a20-pcduino3.dtb ${DTBDIR}/pcduino3.dtb
 
 .include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313392 - in head/sys: kern sys

2017-02-07 Thread Mateusz Guzik
Author: mjg
Date: Tue Feb  7 17:04:31 2017
New Revision: 313392
URL: https://svnweb.freebsd.org/changeset/base/313392

Log:
  rwlock: implement RW_LOCK_WRITER_RECURSED bit
  
  This moves recursion handling out of the inlined wunlock path and in
  particular saves a read and a branch.
  
  Discussed with:

Modified:
  head/sys/kern/kern_rwlock.c
  head/sys/sys/rwlock.h

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Tue Feb  7 17:03:22 2017(r313391)
+++ head/sys/kern/kern_rwlock.c Tue Feb  7 17:04:31 2017(r313392)
@@ -312,6 +312,7 @@ __rw_try_wlock(volatile uintptr_t *c, co
if (rw_wlocked(rw) &&
(rw->lock_object.lo_flags & LO_RECURSABLE) != 0) {
rw->rw_recurse++;
+   atomic_set_ptr(>rw_lock, RW_LOCK_WRITER_RECURSED);
rval = 1;
} else
rval = atomic_cmpset_acq_ptr(>rw_lock, RW_UNLOCKED,
@@ -345,10 +346,8 @@ _rw_wunlock_cookie(volatile uintptr_t *c
WITNESS_UNLOCK(>lock_object, LOP_EXCLUSIVE, file, line);
LOCK_LOG_LOCK("WUNLOCK", >lock_object, 0, rw->rw_recurse, file,
line);
-   if (rw->rw_recurse)
-   rw->rw_recurse--;
-   else
-   _rw_wunlock_hard(rw, (uintptr_t)curthread, file, line);
+
+   _rw_wunlock_hard(rw, (uintptr_t)curthread, file, line);
 
TD_LOCKS_DEC(curthread);
 }
@@ -802,6 +801,7 @@ __rw_wlock_hard(volatile uintptr_t *c, u
("%s: recursing but non-recursive rw %s @ %s:%d\n",
__func__, rw->lock_object.lo_name, file, line));
rw->rw_recurse++;
+   atomic_set_ptr(>rw_lock, RW_LOCK_WRITER_RECURSED);
if (LOCK_LOG_TEST(>lock_object, 0))
CTR2(KTR_LOCK, "%s: %p recursing", __func__, rw);
return;
@@ -994,12 +994,17 @@ __rw_wunlock_hard(volatile uintptr_t *c,
return;
 
rw = rwlock2rw(c);
-   MPASS(!rw_recursed(rw));
 
-   LOCKSTAT_PROFILE_RELEASE_RWLOCK(rw__release, rw,
-   LOCKSTAT_WRITER);
-   if (_rw_write_unlock(rw, tid))
+   if (!rw_recursed(rw)) {
+   LOCKSTAT_PROFILE_RELEASE_RWLOCK(rw__release, rw,
+   LOCKSTAT_WRITER);
+   if (_rw_write_unlock(rw, tid))
+   return;
+   } else {
+   if (--(rw->rw_recurse) == 0)
+   atomic_clear_ptr(>rw_lock, RW_LOCK_WRITER_RECURSED);
return;
+   }
 
KASSERT(rw->rw_lock & (RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS),
("%s: neither of the waiter flags are set", __func__));

Modified: head/sys/sys/rwlock.h
==
--- head/sys/sys/rwlock.h   Tue Feb  7 17:03:22 2017(r313391)
+++ head/sys/sys/rwlock.h   Tue Feb  7 17:04:31 2017(r313392)
@@ -58,9 +58,10 @@
 #defineRW_LOCK_READ_WAITERS0x02
 #defineRW_LOCK_WRITE_WAITERS   0x04
 #defineRW_LOCK_WRITE_SPINNER   0x08
+#defineRW_LOCK_WRITER_RECURSED 0x10
 #defineRW_LOCK_FLAGMASK
\
(RW_LOCK_READ | RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS |  \
-   RW_LOCK_WRITE_SPINNER)
+   RW_LOCK_WRITE_SPINNER | RW_LOCK_WRITER_RECURSED)
 #defineRW_LOCK_WAITERS (RW_LOCK_READ_WAITERS | 
RW_LOCK_WRITE_WAITERS)
 
 #defineRW_OWNER(x) ((x) & ~RW_LOCK_FLAGMASK)
@@ -111,13 +112,9 @@
 #define__rw_wunlock(rw, tid, file, line) do {  
\
uintptr_t _tid = (uintptr_t)(tid);  \
\
-   if ((rw)->rw_recurse)   \
-   (rw)->rw_recurse--; \
-   else {  \
-   if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__release) ||\
-   !_rw_write_unlock((rw), _tid))) \
-   _rw_wunlock_hard((rw), _tid, (file), (line));   \
-   }   \
+   if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__release) ||\
+   !_rw_write_unlock((rw), _tid))) \
+   _rw_wunlock_hard((rw), _tid, (file), (line));   \
 } while (0)
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313391 - head/sys/kern

2017-02-07 Thread Mateusz Guzik
Author: mjg
Date: Tue Feb  7 17:03:22 2017
New Revision: 313391
URL: https://svnweb.freebsd.org/changeset/base/313391

Log:
  Bump struct thread alignment to 32.
  
  This gives additional bits to use in locking primitives which store
  the lock thread pointer in the lock value.
  
  Discussed with:   kib

Modified:
  head/sys/kern/init_main.c
  head/sys/kern/kern_thread.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Tue Feb  7 16:01:07 2017(r313390)
+++ head/sys/kern/init_main.c   Tue Feb  7 17:03:22 2017(r313391)
@@ -99,7 +99,7 @@ void mi_startup(void);/* 
Should be e
 static struct session session0;
 static struct pgrp pgrp0;
 struct proc proc0;
-struct thread0_storage thread0_st __aligned(16);
+struct thread0_storage thread0_st __aligned(32);
 struct vmspace vmspace0;
 struct proc *initproc;
 

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Tue Feb  7 16:01:07 2017(r313390)
+++ head/sys/kern/kern_thread.c Tue Feb  7 17:03:22 2017(r313391)
@@ -281,7 +281,7 @@ threadinit(void)
 
thread_zone = uma_zcreate("THREAD", sched_sizeof_thread(),
thread_ctor, thread_dtor, thread_init, thread_fini,
-   16 - 1, UMA_ZONE_NOFREE);
+   32 - 1, UMA_ZONE_NOFREE);
tidhashtbl = hashinit(maxproc / 2, M_TIDHASH, );
rw_init(_lock, "tidhash");
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313390 - head/sys/kern

2017-02-07 Thread Mateusz Guzik
Author: mjg
Date: Tue Feb  7 16:01:07 2017
New Revision: 313390
URL: https://svnweb.freebsd.org/changeset/base/313390

Log:
  locks: follow up r313386
  
  Unfinished diff was committed by accident. The loop in lock_delay
  was changed to decrement, but the loop iterator was still incrementing.

Modified:
  head/sys/kern/subr_lock.c

Modified: head/sys/kern/subr_lock.c
==
--- head/sys/kern/subr_lock.c   Tue Feb  7 15:16:01 2017(r313389)
+++ head/sys/kern/subr_lock.c   Tue Feb  7 16:01:07 2017(r313390)
@@ -128,7 +128,7 @@ lock_delay(struct lock_delay_arg *la)
if (__predict_false(la->delay > lc->max))
la->delay = lc->max;
 
-   for (i = la->delay; i > 0; i++)
+   for (i = la->delay; i > 0; i--)
cpu_spinwait();
 
la->spin_cnt += la->delay;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r313260 - head/sys/kern

2017-02-07 Thread Steven Hartland

On 07/02/2017 14:57, Mateusz Guzik wrote:

On Sun, Feb 05, 2017 at 03:17:46PM +, Alexey Dokuchaev wrote:

On Sun, Feb 05, 2017 at 04:00:06AM +0100, Mateusz Guzik wrote:

For instance, plugging an unused variable, a memory leak, doing a
lockless check first etc. are all pretty standard and unless there is
something unusual going on (e.g. complicated circumstances leading to a
leak) there is not much to explain. In particular, I don't see why
anyone would explain why leaks are bad on each commit plugging one.

Right; these (unused variable, resource leaks) usually do not warrant
elaborate explanation.

[ Some linefeeds below were trimmed for brevity ]

The gist is as follows: there are plenty of cases where the kernel wants
to atomically replace the value of a particular variable. Sometimes,
like in this commit, we want to bump the counter by 1, but only if the
current value is not 0. For that we need to read the value, see if it is
0 and if not, try to replace what we read with what we read + 1. We
cannot just increment as the value could have changed to 0 in the
meantime.
But this also means that multiple cpus doing the same operation on the
same variable will trip on each other - one will succeed while the rest
will have to retry.
Prior to this commit, each retry attempt would explicitly re-read the
value. This induces cache coherency traffic slowing everyone down.
amd64 has the nice property of giving us the value it found eleminating
the need to explicitly re-read it. There is similar story on i386 and
sparc.
Other architectures may also benefit from this, but that I did not
benchmark.

In short[,] under contention atomic_fcmpset is going to be faster than
atomic_cmpset.
I did not benchmark this particular change, but a switch of the sort
easily gives 10%+ in microbenchmarks on amd64.
That said, while one can argue this optimizes the code, it really
depessimizes it as something of the sort should have been already
employed.

Given the above, IMHO it's quite far from an obvious or of manpage-lookup
thing, and thus requires proper explanation in the commit log.


If the aformenteiond explanation is necessary, the place for it is in
the man page. There are already several commits with fcmpset and there
will be more to come. I don't see why any of them would convey the
information.

The details of why performance under contention of atomic_fcmpset is 
better than atomic_cmpset, a manpage would be nice.


All I'm suggesting is, while one could guess this may be a performance 
or possibly a compatibility thing, the reason is not obvious, so a small 
piece of detail on why the change was done should always be included.


For this one something like the following would be nice:

Switch fget_unlocked to atomic_fcmpset

Improve performance under contention by switching fget_unlocked to
use atomic_fcmpset.

With small piece of additional information, its clear the reason for the 
change (why) was to improve performance and anyone who wants more detail 
on why this would be the case can research it via a manpage or other 
resources, wouldn't you agree?


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


Re: svn commit: r313352 - in head/sys: compat/cloudabi compat/freebsd32 compat/linux vm

2017-02-07 Thread Konstantin Belousov
On Tue, Feb 07, 2017 at 02:50:15PM +0100, Mateusz Guzik wrote:
> Can we start dropping the td argument? It always is curthread and
> almost always has to be anyway as something down below accesses
> data in a manner only safe for curthread (classic: credential checks).
> 
> With this example the function takes 7 args. So the commit added an
> indirection which cannot be tail called on amd64 due to the 7th argument
> passed through the stack. Removing the td argument deals with the
> problem.

OTOH accessing current thread as curthread adds some number of instructions
with %gs prefixes.  On older machines, this caused bubbles in the frontend
decoding of the instructions, which made using plain pointer instead of the
magical curthread reasonable.  Modern big processors should not have the
problem anymore, but smaller designs like Atom still do.

I suspect it is quite hard to notice a difference there, either with %gs
decoding overhead, or with the missed tail call optimization, for the
vm syscalls which are quite slow on its own.  The effects of both micro-
optimizations should be noise.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313389 - head/sys/boot/efi/libefi

2017-02-07 Thread Emmanuel Vadot
Author: manu
Date: Tue Feb  7 15:16:01 2017
New Revision: 313389
URL: https://svnweb.freebsd.org/changeset/base/313389

Log:
  efipart is also using the '%S' printf format, add -Wno-format for it.
  This fix building for armv6.

Modified:
  head/sys/boot/efi/libefi/Makefile

Modified: head/sys/boot/efi/libefi/Makefile
==
--- head/sys/boot/efi/libefi/Makefile   Tue Feb  7 15:13:19 2017
(r313388)
+++ head/sys/boot/efi/libefi/Makefile   Tue Feb  7 15:16:01 2017
(r313389)
@@ -26,6 +26,7 @@ SRCS+=time_event.c
 # of a short. There's no good cast to use here so just ignore the
 # warnings for now.
 CWARNFLAGS.efinet.c+=  -Wno-format
+CWARNFLAGS.efipart.c+= -Wno-format
 CWARNFLAGS.env.c+= -Wno-format
 
 .if ${MACHINE_CPUARCH} == "aarch64"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313388 - in stable/11/sys: dev/ixgbe net

2017-02-07 Thread Ryan Stone
Author: rstone
Date: Tue Feb  7 15:13:19 2017
New Revision: 313388
URL: https://svnweb.freebsd.org/changeset/base/313388

Log:
  MFC r312544
  
Fix reference to free memory in ixgbe/if_media.c
  
When ixgbe receives an interrupt indicating that a new optical module
may have been inserted, it discards all of its current media types
by calling ifmedia_removeall() and then creates a new set of media
types for the supported media on the new module.  However,
ifmedia_removeall() was maintaining a pointer to whatever the
current media type was before the call to ifmedia_removealL().
The result of this was that any attempt to read the current media
type of the interface (e.g. via ifconfig) would return potentially
garbage data from free memory (or if one were particularly unlucky
on an architecture that does not malloc() from a direct map, page
fault the kernel).
  
Fix this by NULL'ing out the current media field in if_media.c,
and have ixgbe update the current media type after recreating
them.
  
Submitted by: Matt Joras 
Reviewed by:  sbruno, erj
MFC after:1 week
Sponsored by: Dell EMC Isilon
Differential Revision:https://reviews.freebsd.org/D9164

Modified:
  stable/11/sys/dev/ixgbe/if_ix.c
  stable/11/sys/net/if_media.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ixgbe/if_ix.c
==
--- stable/11/sys/dev/ixgbe/if_ix.c Tue Feb  7 15:12:27 2017
(r313387)
+++ stable/11/sys/dev/ixgbe/if_ix.c Tue Feb  7 15:13:19 2017
(r313388)
@@ -3878,6 +3878,7 @@ ixgbe_handle_msf(void *context, int pend
/* Adjust media types shown in ifconfig */
ifmedia_removeall(>media);
ixgbe_add_media_types(adapter);
+   ifmedia_set(>media, IFM_ETHER | IFM_AUTO);
IXGBE_CORE_UNLOCK(adapter);
return;
 }

Modified: stable/11/sys/net/if_media.c
==
--- stable/11/sys/net/if_media.cTue Feb  7 15:12:27 2017
(r313387)
+++ stable/11/sys/net/if_media.cTue Feb  7 15:13:19 2017
(r313388)
@@ -107,6 +107,7 @@ ifmedia_removeall(ifm)
LIST_REMOVE(entry, ifm_list);
free(entry, M_IFADDR);
}
+   ifm->ifm_cur = NULL;
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313387 - in stable/10/sys: dev/ixgbe net

2017-02-07 Thread Ryan Stone
Author: rstone
Date: Tue Feb  7 15:12:27 2017
New Revision: 313387
URL: https://svnweb.freebsd.org/changeset/base/313387

Log:
  MFC r312544
  
Fix reference to free memory in ixgbe/if_media.c
  
When ixgbe receives an interrupt indicating that a new optical module
may have been inserted, it discards all of its current media types
by calling ifmedia_removeall() and then creates a new set of media
types for the supported media on the new module.  However,
ifmedia_removeall() was maintaining a pointer to whatever the
current media type was before the call to ifmedia_removealL().
The result of this was that any attempt to read the current media
type of the interface (e.g. via ifconfig) would return potentially
garbage data from free memory (or if one were particularly unlucky
on an architecture that does not malloc() from a direct map, page
fault the kernel).
  
Fix this by NULL'ing out the current media field in if_media.c,
and have ixgbe update the current media type after recreating
them.
  
Submitted by: Matt Joras 
Reviewed by:  sbruno, erj
MFC after:1 week
Sponsored by: Dell EMC Isilon
Differential Revision:https://reviews.freebsd.org/D9164

Modified:
  stable/10/sys/dev/ixgbe/if_ix.c
  stable/10/sys/net/if_media.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ixgbe/if_ix.c
==
--- stable/10/sys/dev/ixgbe/if_ix.c Tue Feb  7 14:49:36 2017
(r313386)
+++ stable/10/sys/dev/ixgbe/if_ix.c Tue Feb  7 15:12:27 2017
(r313387)
@@ -3885,6 +3885,7 @@ ixgbe_handle_msf(void *context, int pend
/* Adjust media types shown in ifconfig */
ifmedia_removeall(>media);
ixgbe_add_media_types(adapter);
+   ifmedia_set(>media, IFM_ETHER | IFM_AUTO);
IXGBE_CORE_UNLOCK(adapter);
return;
 }

Modified: stable/10/sys/net/if_media.c
==
--- stable/10/sys/net/if_media.cTue Feb  7 14:49:36 2017
(r313386)
+++ stable/10/sys/net/if_media.cTue Feb  7 15:12:27 2017
(r313387)
@@ -105,6 +105,7 @@ ifmedia_removeall(ifm)
LIST_REMOVE(entry, ifm_list);
free(entry, M_IFADDR);
}
+   ifm->ifm_cur = NULL;
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r313260 - head/sys/kern

2017-02-07 Thread Mateusz Guzik
On Sun, Feb 05, 2017 at 03:17:46PM +, Alexey Dokuchaev wrote:
> On Sun, Feb 05, 2017 at 04:00:06AM +0100, Mateusz Guzik wrote:
> > For instance, plugging an unused variable, a memory leak, doing a
> > lockless check first etc. are all pretty standard and unless there is
> > something unusual going on (e.g. complicated circumstances leading to a
> > leak) there is not much to explain. In particular, I don't see why
> > anyone would explain why leaks are bad on each commit plugging one.
> 
> Right; these (unused variable, resource leaks) usually do not warrant
> elaborate explanation.
> 
> [ Some linefeeds below were trimmed for brevity ]
> > The gist is as follows: there are plenty of cases where the kernel wants
> > to atomically replace the value of a particular variable. Sometimes,
> > like in this commit, we want to bump the counter by 1, but only if the
> > current value is not 0. For that we need to read the value, see if it is
> > 0 and if not, try to replace what we read with what we read + 1. We
> > cannot just increment as the value could have changed to 0 in the
> > meantime.
> > But this also means that multiple cpus doing the same operation on the
> > same variable will trip on each other - one will succeed while the rest
> > will have to retry.
> > Prior to this commit, each retry attempt would explicitly re-read the
> > value. This induces cache coherency traffic slowing everyone down.
> > amd64 has the nice property of giving us the value it found eleminating
> > the need to explicitly re-read it. There is similar story on i386 and
> > sparc.
> > Other architectures may also benefit from this, but that I did not
> > benchmark.
> > 
> > In short[,] under contention atomic_fcmpset is going to be faster than
> > atomic_cmpset.
> > I did not benchmark this particular change, but a switch of the sort
> > easily gives 10%+ in microbenchmarks on amd64.
> > That said, while one can argue this optimizes the code, it really
> > depessimizes it as something of the sort should have been already
> > employed.
> 
> Given the above, IMHO it's quite far from an obvious or of manpage-lookup
> thing, and thus requires proper explanation in the commit log.
> 

If the aformenteiond explanation is necessary, the place for it is in
the man page. There are already several commits with fcmpset and there
will be more to come. I don't see why any of them would convey the
information.

> > > While on this subject are there any official guidelines to writing
> > > commit messages, if no should we create some?
> > 
> > I'm unaware of any.
> 
> We might not have official guidelines, but 30%-what/70%-why rule would
> apply perfectly here. ;-)
> 
> ./danfe

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


svn commit: r313386 - in head/sys: kern sys

2017-02-07 Thread Mateusz Guzik
Author: mjg
Date: Tue Feb  7 14:49:36 2017
New Revision: 313386
URL: https://svnweb.freebsd.org/changeset/base/313386

Log:
  locks: change backoff to exponential
  
  Previous implementation would use a random factor to spread readers and
  reduce chances of starvation. This visibly reduces effectiveness of the
  mechanism.
  
  Switch to the more traditional exponential variant. Try to limit starvation
  by imposing an upper limit of spins after which spinning is half of what
  other threads get. Note the mechanism is turned off by default.
  
  Reviewed by:  kib (previous version)

Modified:
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c
  head/sys/kern/subr_lock.c
  head/sys/sys/lock.h

Modified: head/sys/kern/kern_mutex.c
==
--- head/sys/kern/kern_mutex.c  Tue Feb  7 12:04:04 2017(r313385)
+++ head/sys/kern/kern_mutex.c  Tue Feb  7 14:49:36 2017(r313386)
@@ -140,63 +140,27 @@ struct lock_class lock_class_mtx_spin = 
 #ifdef ADAPTIVE_MUTEXES
 static SYSCTL_NODE(_debug, OID_AUTO, mtx, CTLFLAG_RD, NULL, "mtx debugging");
 
-static struct lock_delay_config __read_mostly mtx_delay = {
-   .initial= 1000,
-   .step   = 500,
-   .min= 100,
-   .max= 5000,
-};
+static struct lock_delay_config __read_mostly mtx_delay;
 
-SYSCTL_INT(_debug_mtx, OID_AUTO, delay_initial, CTLFLAG_RW, _delay.initial,
-0, "");
-SYSCTL_INT(_debug_mtx, OID_AUTO, delay_step, CTLFLAG_RW, _delay.step,
-0, "");
-SYSCTL_INT(_debug_mtx, OID_AUTO, delay_min, CTLFLAG_RW, _delay.min,
+SYSCTL_INT(_debug_mtx, OID_AUTO, delay_base, CTLFLAG_RW, _delay.base,
 0, "");
 SYSCTL_INT(_debug_mtx, OID_AUTO, delay_max, CTLFLAG_RW, _delay.max,
 0, "");
 
-static void
-mtx_delay_sysinit(void *dummy)
-{
-
-   mtx_delay.initial = mp_ncpus * 25;
-   mtx_delay.step = (mp_ncpus * 25) / 2;
-   mtx_delay.min = mp_ncpus * 5;
-   mtx_delay.max = mp_ncpus * 25 * 10;
-}
-LOCK_DELAY_SYSINIT(mtx_delay_sysinit);
+LOCK_DELAY_SYSINIT_DEFAULT(mtx_delay);
 #endif
 
 static SYSCTL_NODE(_debug, OID_AUTO, mtx_spin, CTLFLAG_RD, NULL,
 "mtx spin debugging");
 
-static struct lock_delay_config __read_mostly mtx_spin_delay = {
-   .initial= 1000,
-   .step   = 500,
-   .min= 100,
-   .max= 5000,
-};
-
-SYSCTL_INT(_debug_mtx_spin, OID_AUTO, delay_initial, CTLFLAG_RW,
-_spin_delay.initial, 0, "");
-SYSCTL_INT(_debug_mtx_spin, OID_AUTO, delay_step, CTLFLAG_RW, 
_spin_delay.step,
-0, "");
-SYSCTL_INT(_debug_mtx_spin, OID_AUTO, delay_min, CTLFLAG_RW, 
_spin_delay.min,
-0, "");
-SYSCTL_INT(_debug_mtx_spin, OID_AUTO, delay_max, CTLFLAG_RW, 
_spin_delay.max,
-0, "");
+static struct lock_delay_config __read_mostly mtx_spin_delay;
 
-static void
-mtx_spin_delay_sysinit(void *dummy)
-{
+SYSCTL_INT(_debug_mtx_spin, OID_AUTO, delay_base, CTLFLAG_RW,
+_spin_delay.base, 0, "");
+SYSCTL_INT(_debug_mtx_spin, OID_AUTO, delay_max, CTLFLAG_RW,
+_spin_delay.max, 0, "");
 
-   mtx_spin_delay.initial = mp_ncpus * 25;
-   mtx_spin_delay.step = (mp_ncpus * 25) / 2;
-   mtx_spin_delay.min = mp_ncpus * 5;
-   mtx_spin_delay.max = mp_ncpus * 25 * 10;
-}
-LOCK_DELAY_SYSINIT(mtx_spin_delay_sysinit);
+LOCK_DELAY_SYSINIT_DEFAULT(mtx_spin_delay);
 
 /*
  * System-wide mutexes

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Tue Feb  7 12:04:04 2017(r313385)
+++ head/sys/kern/kern_rwlock.c Tue Feb  7 14:49:36 2017(r313386)
@@ -100,32 +100,14 @@ static SYSCTL_NODE(_debug, OID_AUTO, rwl
 SYSCTL_INT(_debug_rwlock, OID_AUTO, retry, CTLFLAG_RW, _retries, 0, "");
 SYSCTL_INT(_debug_rwlock, OID_AUTO, loops, CTLFLAG_RW, _loops, 0, "");
 
-static struct lock_delay_config __read_mostly rw_delay = {
-   .initial= 1000,
-   .step   = 500,
-   .min= 100,
-   .max= 5000,
-};
+static struct lock_delay_config __read_mostly rw_delay;
 
-SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_initial, CTLFLAG_RW, 
_delay.initial,
-0, "");
-SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_step, CTLFLAG_RW, _delay.step,
-0, "");
-SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_min, CTLFLAG_RW, _delay.min,
+SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_base, CTLFLAG_RW, _delay.base,
 0, "");
 SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_max, CTLFLAG_RW, _delay.max,
 0, "");
 
-static void
-rw_delay_sysinit(void *dummy)
-{
-
-   rw_delay.initial = mp_ncpus * 25;
-   rw_delay.step = (mp_ncpus * 25) / 2;
-   rw_delay.min = mp_ncpus * 5;
-   rw_delay.max = mp_ncpus * 25 * 10;
-}
-LOCK_DELAY_SYSINIT(rw_delay_sysinit);
+LOCK_DELAY_SYSINIT_DEFAULT(rw_delay);
 #endif
 
 /*

Modified: head/sys/kern/kern_sx.c

Re: svn commit: r313330 - in head: contrib/netcat lib/libipsec sbin/ifconfig sbin/setkey share/man/man4 sys/conf sys/modules sys/modules/ipsec sys/modules/tcp/tcpmd5 sys/net sys/netinet sys/netinet/tc

2017-02-07 Thread Slawa Olhovchenkov
On Tue, Feb 07, 2017 at 03:53:05AM +0300, Andrey V. Elsukov wrote:

> On 06.02.2017 17:31, Dmitry Morozovsky wrote:
> >> Date: Mon Feb  6 08:49:57 2017
> >> New Revision: 313330
> >> URL: https://svnweb.freebsd.org/changeset/base/313330
> >>
> >> Log:
> >>   Merge projects/ipsec into head/.
> >
> > [snip]
> >
> > Great, thanks!
> >
> > Have you any plans to merge this into stable/11 to reduce diffs in network
> > stack code?
> 
> It depends from the further users feedback.
> I wanted to do MFC after one or two months. But there are two things 
> that are questionable. The date of stable/11 feature freeze is not 
> known. And there is also some changes that can be considered as POLA 
> violations. E.g. now SPIs are unique, and if user had manually 
> configured SAs with the same SPI, the MFC will break this.

What about IKE? I am don't know, do IKE SPI number negotiation?
Or remote side just assign implicit SPI? In last case posible race on
local system.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r313352 - in head/sys: compat/cloudabi compat/freebsd32 compat/linux vm

2017-02-07 Thread Mateusz Guzik
On Mon, Feb 06, 2017 at 08:57:12PM +, Edward Tomasz Napierala wrote:
> Author: trasz
> Date: Mon Feb  6 20:57:12 2017
> New Revision: 313352
> URL: https://svnweb.freebsd.org/changeset/base/313352
> 
> Log:
>   Add kern_vm_mmap2(), kern_vm_mprotect(), kern_vm_msync(), kern_vm_munlock(),
>   kern_vm_munmap(), and kern_vm_madvise(), and use them in various compats
>   instead of their sys_*() counterparts.
>   
> -sys_mmap(td, uap)
> - struct thread *td;
> - struct mmap_args *uap;
> +sys_mmap(struct thread *td, struct mmap_args *uap)
> +{
> +
> + return (kern_vm_mmap(td, (vm_offset_t)uap->addr, uap->len,
> + uap->prot, uap->flags, uap->fd, uap->pos));
> +}
> +
> +int
> +kern_vm_mmap(struct thread *td, vm_offset_t addr, vm_size_t size,
> +vm_prot_t prot, int flags, int fd, off_t pos)
>  {

Can we start dropping the td argument? It always is curthread and
almost always has to be anyway as something down below accesses
data in a manner only safe for curthread (classic: credential checks).

With this example the function takes 7 args. So the commit added an
indirection which cannot be tail called on amd64 due to the 7th argument
passed through the stack. Removing the td argument deals with the
problem.

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


Re: svn commit: r313352 - in head/sys: compat/cloudabi compat/freebsd32 compat/linux vm

2017-02-07 Thread Edward Tomasz Napierala
On 0207T1039, Konstantin Belousov wrote:
> On Mon, Feb 06, 2017 at 03:03:11PM -0800, John Baldwin wrote:
> > On Monday, February 06, 2017 08:57:12 PM Edward Tomasz Napierala wrote:
> > > Author: trasz
> > > Date: Mon Feb  6 20:57:12 2017
> > > New Revision: 313352
> > > URL: https://svnweb.freebsd.org/changeset/base/313352
> > > 
> > > Log:
> > >   Add kern_vm_mmap2(), kern_vm_mprotect(), kern_vm_msync(), 
> > > kern_vm_munlock(),
> > >   kern_vm_munmap(), and kern_vm_madvise(), and use them in various compats
> > >   instead of their sys_*() counterparts.
> > >   
> > >   Reviewed by:ed, dchagin, kib
> > >   MFC after:  2 weeks
> > >   Sponsored by:   DARPA, AFRL
> > >   Differential Revision:  https://reviews.freebsd.org/D9378
> > 
> > I know kib@ suggested kern_vm_ instead of the vm_ you had 
> > suggested,
> > but just kern_ would be more consistent.  That is what we have done 
> > with
> > every other system call.  (e.g. there isn't kern_socket_bind, 
> > kern_socket_listen,
> > etc., but just kern_bind() and kern_listen()).
> 
> Note that the kern_vm_* functions are not quite regular syscall helpers.
> The big issue with them, which caused my suggestion, is that the
> functions cannot be declared in sys/syscallsubr.h, because their
> declarations depend on the vm/*.h namespace.

Exactly; they use vm-specific types (vm_offset_t, for example).  And I
wanted to avoid changing the types all over the place, at least for now.

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


svn commit: r313385 - in head/sys/arm: altera/socfpga conf

2017-02-07 Thread Andrew Turner
Author: andrew
Date: Tue Feb  7 12:04:04 2017
New Revision: 313385
URL: https://svnweb.freebsd.org/changeset/base/313385

Log:
  Add support for PLATFORM and PLATFORM_SMP to the Altera SOCFPGA SoC. This
  will help with moving it to GENERIC.
  
  Reviewed by:  br
  Sponsored by: ABT Systems Ltd
  Differential Revision:https://reviews.freebsd.org/D9461

Added:
  head/sys/arm/altera/socfpga/socfpga_mp.h   (contents, props changed)
Modified:
  head/sys/arm/altera/socfpga/socfpga_common.c
  head/sys/arm/altera/socfpga/socfpga_machdep.c
  head/sys/arm/altera/socfpga/socfpga_mp.c
  head/sys/arm/conf/SOCKIT.common

Modified: head/sys/arm/altera/socfpga/socfpga_common.c
==
--- head/sys/arm/altera/socfpga/socfpga_common.cTue Feb  7 08:33:46 
2017(r313384)
+++ head/sys/arm/altera/socfpga/socfpga_common.cTue Feb  7 12:04:04 
2017(r313385)
@@ -43,27 +43,3 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-void
-cpu_reset(void)
-{
-   uint32_t paddr;
-   bus_addr_t vaddr;
-   phandle_t node;
-
-   if (rstmgr_warmreset() == 0)
-   goto end;
-
-   node = OF_finddevice("rstmgr");
-   if (node == -1)
-   goto end;
-
-   if ((OF_getencprop(node, "reg", , sizeof(paddr))) > 0) {
-   if (bus_space_map(fdtbus_bs_tag, paddr, 0x8, 0, ) == 0) {
-   bus_space_write_4(fdtbus_bs_tag, vaddr,
-   RSTMGR_CTRL, CTRL_SWWARMRSTREQ);
-   }
-   }
-
-end:
-   while (1);
-}

Modified: head/sys/arm/altera/socfpga/socfpga_machdep.c
==
--- head/sys/arm/altera/socfpga/socfpga_machdep.c   Tue Feb  7 08:33:46 
2017(r313384)
+++ head/sys/arm/altera/socfpga/socfpga_machdep.c   Tue Feb  7 12:04:04 
2017(r313385)
@@ -28,7 +28,6 @@
  * SUCH DAMAGE.
  */
 
-#include "opt_ddb.h"
 #include "opt_platform.h"
 
 #include 
@@ -41,38 +40,22 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include 
+
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 
-vm_offset_t
-platform_lastaddr(void)
-{
-
-   return (devmap_lastaddr());
-}
-
-void
-platform_probe_and_attach(void)
-{
-
-}
-
-void
-platform_gpio_init(void)
-{
-
-}
-
-void
-platform_late_init(void)
-{
+#include 
+#include 
 
-}
+#include "platform_if.h"
 
-int
-platform_devmap_init(void)
+static int
+socfpga_devmap_init(platform_t plat)
 {
 
/* UART */
@@ -99,3 +82,42 @@ platform_devmap_init(void)
 
return (0);
 }
+
+static void
+socfpga_cpu_reset(platform_t plat)
+{
+   uint32_t paddr;
+   bus_addr_t vaddr;
+   phandle_t node;
+
+   if (rstmgr_warmreset() == 0)
+   goto end;
+
+   node = OF_finddevice("rstmgr");
+   if (node == -1)
+   goto end;
+
+   if ((OF_getencprop(node, "reg", , sizeof(paddr))) > 0) {
+   if (bus_space_map(fdtbus_bs_tag, paddr, 0x8, 0, ) == 0) {
+   bus_space_write_4(fdtbus_bs_tag, vaddr,
+   RSTMGR_CTRL, CTRL_SWWARMRSTREQ);
+   }
+   }
+
+end:
+   while (1);
+}
+
+static platform_method_t socfpga_methods[] = {
+   PLATFORMMETHOD(platform_devmap_init,socfpga_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  socfpga_cpu_reset),
+
+#ifdef SMP
+   PLATFORMMETHOD(platform_mp_setmaxid,socfpga_mp_setmaxid),
+   PLATFORMMETHOD(platform_mp_start_ap,socfpga_mp_start_ap),
+#endif
+
+   PLATFORMMETHOD_END,
+};
+
+FDT_PLATFORM_DEF(socfpga, "socfpga", 0, "altr,socfpga", 0);

Modified: head/sys/arm/altera/socfpga/socfpga_mp.c
==
--- head/sys/arm/altera/socfpga/socfpga_mp.cTue Feb  7 08:33:46 2017
(r313384)
+++ head/sys/arm/altera/socfpga/socfpga_mp.cTue Feb  7 12:04:04 2017
(r313385)
@@ -28,6 +28,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_platform.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 #include 
@@ -45,6 +47,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+
+#include 
 
 #defineSCU_PHYSBASE0xFFFEC000
 #defineSCU_SIZE0x100
@@ -85,7 +90,7 @@ socfpga_trampoline(void)
 }
 
 void
-platform_mp_setmaxid(void)
+socfpga_mp_setmaxid(platform_t plat)
 {
int hwcpu, ncpu;
 
@@ -105,7 +110,7 @@ platform_mp_setmaxid(void)
 }
 
 void
-platform_mp_start_ap(void)
+socfpga_mp_start_ap(platform_t plat)
 {
bus_space_handle_t scu, rst, ram;
int reg;

Added: head/sys/arm/altera/socfpga/socfpga_mp.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/altera/socfpga/socfpga_mp.hTue Feb  7 12:04:04 2017
(r313385)
@@ -0,0 +1,34 @@
+/*-
+ * Copyright (c) 2017 Andrew Turner 

Re: svn commit: r313339 - head/sys/kern

2017-02-07 Thread Andrew Turner
On Tue, 7 Feb 2017 11:35:48 +0100
Svatopluk Kraus  wrote:
> Does an xref refer only to one hardware? Or two hardwares may have
> same xrefs? Why one hardware cannot be represented by one PIC in
> INTRNG even if two drivers exist for it?

The xref is an FDT thing, in INTRNG we use it as a handle to hardware.
This changes it so each of these handles refers to hardware within one
of two spaces, the PIC space and MSI space. It may be that for FDT
these spaces are non overlapping, however with ACPI it will simplify
the code to allow us to have the same handle refer to different
controllers in different spaces.

> On Mon, Feb 6, 2017 at 2:08 PM, Andrew Turner 
> wrote:
> > Author: andrew
> > Date: Mon Feb  6 13:08:48 2017
> > New Revision: 313339
> > URL: https://svnweb.freebsd.org/changeset/base/313339
> >
> > Log:
> >   Only allow the pic type to be either a PIC or MSI type. All
> > interrupt controller drivers handle either MSI/MSI-X interrupts, or
> > regular interrupts, as such enforce this in the interrupt handling
> > framework. If a later driver was to handle both it would need to
> > create one of each.
> >
> >   This will allow future changes to allow the xref space to
> > overlap, but refer to different drivers.
> >
> >   Obtained from:ABT Systems Ltd
> >   Sponsored by: The FreeBSD Foundation
> >   X-Differential Revision:  https://reviews.freebsd.org/D8616
...
> > @@ -822,13 +827,13 @@ intr_pic_claim_root(device_t dev, intptr
> >  {
> > struct intr_pic *pic;
> >
> > -   pic = pic_lookup(dev, xref);
> > +   pic = pic_lookup(dev, xref, FLAG_PIC);
> > if (pic == NULL) {
> > device_printf(dev, "not registered\n");
> > return (EINVAL);
> > }
> >
> > -   KASSERT((pic->pic_flags & FLAG_PIC) != 0,
> > +   KASSERT((pic->pic_flags & FLAG_TYPE_MASK) == FLAG_PIC,
> > ("%s: Found a non-PIC controller: %s", __func__,
> >  device_get_name(pic->pic_dev)));
> >  
> 
> So, you would check that  pic_lookup(dev, xref, FLAG_PIC) returns PIC
> with FLAG_PIC set?
> Really? This nonsense is in other places too. If you would like to be
> this way, check it only in pic_lookup() then!

It's there so if someone makes a change to pic_lookup that breaks
this assumption they will be told about it.

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


Re: svn commit: r313339 - head/sys/kern

2017-02-07 Thread Svatopluk Kraus
So, you did it again. No discussion, you have just committed what you
wanted even if I requested a change. It means that I wanted to review
it! Or you think that I forget about that when you wait for three
months?

Your change is not explained at all !! So, explain it better or revert!

Does an xref refer only to one hardware? Or two hardwares may have
same xrefs? Why one hardware cannot be represented by one PIC in
INTRNG even if two drivers exist for it?

Except for the flag, intr_pic_register() is same as intr_msi_register() now.


On Mon, Feb 6, 2017 at 2:08 PM, Andrew Turner  wrote:
> Author: andrew
> Date: Mon Feb  6 13:08:48 2017
> New Revision: 313339
> URL: https://svnweb.freebsd.org/changeset/base/313339
>
> Log:
>   Only allow the pic type to be either a PIC or MSI type. All interrupt
>   controller drivers handle either MSI/MSI-X interrupts, or regular
>   interrupts, as such enforce this in the interrupt handling framework.
>   If a later driver was to handle both it would need to create one of each.
>
>   This will allow future changes to allow the xref space to overlap, but
>   refer to different drivers.
>
>   Obtained from:ABT Systems Ltd
>   Sponsored by: The FreeBSD Foundation
>   X-Differential Revision:  https://reviews.freebsd.org/D8616
>
> Modified:
>   head/sys/kern/subr_intr.c
>
> Modified: head/sys/kern/subr_intr.c
> ==
> --- head/sys/kern/subr_intr.c   Mon Feb  6 11:37:20 2017(r313338)
> +++ head/sys/kern/subr_intr.c   Mon Feb  6 13:08:48 2017(r313339)
> @@ -105,8 +105,10 @@ struct intr_pic {
> SLIST_ENTRY(intr_pic)   pic_next;
> intptr_tpic_xref;   /* hardware identification */
> device_tpic_dev;
> +/* Only one of FLAG_PIC or FLAG_MSI may be set */
>  #defineFLAG_PIC(1 << 0)
>  #defineFLAG_MSI(1 << 1)
> +#defineFLAG_TYPE_MASK  (FLAG_PIC | FLAG_MSI)
> u_int   pic_flags;
> struct mtx  pic_child_lock;
> SLIST_HEAD(, intr_pic_child) pic_children;
> @@ -115,7 +117,7 @@ struct intr_pic {
>  static struct mtx pic_list_lock;
>  static SLIST_HEAD(, intr_pic) pic_list;
>
> -static struct intr_pic *pic_lookup(device_t dev, intptr_t xref);
> +static struct intr_pic *pic_lookup(device_t dev, intptr_t xref, int flags);
>
>  /* Interrupt source definition. */
>  static struct mtx isrc_table_lock;
> @@ -688,7 +690,7 @@ isrc_add_handler(struct intr_irqsrc *isr
>   *  Lookup interrupt controller locked.
>   */
>  static inline struct intr_pic *
> -pic_lookup_locked(device_t dev, intptr_t xref)
> +pic_lookup_locked(device_t dev, intptr_t xref, int flags)
>  {
> struct intr_pic *pic;
>
> @@ -699,6 +701,10 @@ pic_lookup_locked(device_t dev, intptr_t
>
> /* Note that pic->pic_dev is never NULL on registered PIC. */
> SLIST_FOREACH(pic, _list, pic_next) {
> +   if ((pic->pic_flags & FLAG_TYPE_MASK) !=
> +   (flags & FLAG_TYPE_MASK))
> +   continue;
> +
> if (dev == NULL) {
> if (xref == pic->pic_xref)
> return (pic);
> @@ -715,12 +721,12 @@ pic_lookup_locked(device_t dev, intptr_t
>   *  Lookup interrupt controller.
>   */
>  static struct intr_pic *
> -pic_lookup(device_t dev, intptr_t xref)
> +pic_lookup(device_t dev, intptr_t xref, int flags)
>  {
> struct intr_pic *pic;
>
> mtx_lock(_list_lock);
> -   pic = pic_lookup_locked(dev, xref);
> +   pic = pic_lookup_locked(dev, xref, flags);
> mtx_unlock(_list_lock);
> return (pic);
>  }
> @@ -729,12 +735,12 @@ pic_lookup(device_t dev, intptr_t xref)
>   *  Create interrupt controller.
>   */
>  static struct intr_pic *
> -pic_create(device_t dev, intptr_t xref)
> +pic_create(device_t dev, intptr_t xref, int flags)
>  {
> struct intr_pic *pic;
>
> mtx_lock(_list_lock);
> -   pic = pic_lookup_locked(dev, xref);
> +   pic = pic_lookup_locked(dev, xref, flags);
> if (pic != NULL) {
> mtx_unlock(_list_lock);
> return (pic);
> @@ -746,6 +752,7 @@ pic_create(device_t dev, intptr_t xref)
> }
> pic->pic_xref = xref;
> pic->pic_dev = dev;
> +   pic->pic_flags = flags;
> mtx_init(>pic_child_lock, "pic child lock", NULL, MTX_SPIN);
> SLIST_INSERT_HEAD(_list, pic, pic_next);
> mtx_unlock(_list_lock);
> @@ -757,12 +764,12 @@ pic_create(device_t dev, intptr_t xref)
>   *  Destroy interrupt controller.
>   */
>  static void
> -pic_destroy(device_t dev, intptr_t xref)
> +pic_destroy(device_t dev, intptr_t xref, int flags)
>  {
> struct intr_pic *pic;
>
> mtx_lock(_list_lock);
> -   pic = pic_lookup_locked(dev, xref);
> +   pic = pic_lookup_locked(dev, xref, flags);
> if 

Re: svn commit: r313352 - in head/sys: compat/cloudabi compat/freebsd32 compat/linux vm

2017-02-07 Thread Konstantin Belousov
On Mon, Feb 06, 2017 at 03:03:11PM -0800, John Baldwin wrote:
> On Monday, February 06, 2017 08:57:12 PM Edward Tomasz Napierala wrote:
> > Author: trasz
> > Date: Mon Feb  6 20:57:12 2017
> > New Revision: 313352
> > URL: https://svnweb.freebsd.org/changeset/base/313352
> > 
> > Log:
> >   Add kern_vm_mmap2(), kern_vm_mprotect(), kern_vm_msync(), 
> > kern_vm_munlock(),
> >   kern_vm_munmap(), and kern_vm_madvise(), and use them in various compats
> >   instead of their sys_*() counterparts.
> >   
> >   Reviewed by:  ed, dchagin, kib
> >   MFC after:2 weeks
> >   Sponsored by: DARPA, AFRL
> >   Differential Revision:https://reviews.freebsd.org/D9378
> 
> I know kib@ suggested kern_vm_ instead of the vm_ you had suggested,
> but just kern_ would be more consistent.  That is what we have done with
> every other system call.  (e.g. there isn't kern_socket_bind, 
> kern_socket_listen,
> etc., but just kern_bind() and kern_listen()).

Note that the kern_vm_* functions are not quite regular syscall helpers.
The big issue with them, which caused my suggestion, is that the
functions cannot be declared in sys/syscallsubr.h, because their
declarations depend on the vm/*.h namespace.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313384 - stable/10/sys/vm

2017-02-07 Thread Konstantin Belousov
Author: kib
Date: Tue Feb  7 08:33:46 2017
New Revision: 313384
URL: https://svnweb.freebsd.org/changeset/base/313384

Log:
  MFC r313249:
  Style, use tab after #define.

Modified:
  stable/10/sys/vm/vm_object.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/vm/vm_object.h
==
--- stable/10/sys/vm/vm_object.hTue Feb  7 08:31:07 2017
(r313383)
+++ stable/10/sys/vm/vm_object.hTue Feb  7 08:33:46 2017
(r313384)
@@ -192,8 +192,8 @@ struct vm_object {
 #defineOBJ_DISCONNECTWNT 0x4000/* disconnect from vnode wanted 
*/
 #defineOBJ_TMPFS   0x8000  /* has tmpfs vnode allocated */
 
-#define IDX_TO_OFF(idx) (((vm_ooffset_t)(idx)) << PAGE_SHIFT)
-#define OFF_TO_IDX(off) ((vm_pindex_t)(((vm_ooffset_t)(off)) >> PAGE_SHIFT))
+#defineIDX_TO_OFF(idx) (((vm_ooffset_t)(idx)) << PAGE_SHIFT)
+#defineOFF_TO_IDX(off) ((vm_pindex_t)(((vm_ooffset_t)(off)) >> 
PAGE_SHIFT))
 
 #ifdef _KERNEL
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313383 - stable/11/sys/vm

2017-02-07 Thread Konstantin Belousov
Author: kib
Date: Tue Feb  7 08:31:07 2017
New Revision: 313383
URL: https://svnweb.freebsd.org/changeset/base/313383

Log:
  MFC r313249:
  Style, use tab after #define.

Modified:
  stable/11/sys/vm/vm_object.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/vm_object.h
==
--- stable/11/sys/vm/vm_object.hTue Feb  7 06:34:02 2017
(r313382)
+++ stable/11/sys/vm/vm_object.hTue Feb  7 08:31:07 2017
(r313383)
@@ -195,8 +195,8 @@ struct vm_object {
 #defineOBJ_DISCONNECTWNT 0x4000/* disconnect from vnode wanted 
*/
 #defineOBJ_TMPFS   0x8000  /* has tmpfs vnode allocated */
 
-#define IDX_TO_OFF(idx) (((vm_ooffset_t)(idx)) << PAGE_SHIFT)
-#define OFF_TO_IDX(off) ((vm_pindex_t)(((vm_ooffset_t)(off)) >> PAGE_SHIFT))
+#defineIDX_TO_OFF(idx) (((vm_ooffset_t)(idx)) << PAGE_SHIFT)
+#defineOFF_TO_IDX(off) ((vm_pindex_t)(((vm_ooffset_t)(off)) >> 
PAGE_SHIFT))
 
 #ifdef _KERNEL
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"