2 weeks agofix share/man/man4/Makefile for hv_ata_pci_disengage.4 master github/master
dexuan [Fri, 18 Nov 2016 08:15:45 +0000 (08:15 +0000)]
fix share/man/man4/Makefile for hv_ata_pci_disengage.4

We need to remove the line since we removed the related manual just now.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft

2 weeks agoremove the hv_ata_pci_disengage(4) manual
dexuan [Fri, 18 Nov 2016 07:36:00 +0000 (07:36 +0000)]
remove the hv_ata_pci_disengage(4) manual

A few months ago, we removed the driver, which was not necessary any longer.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft

2 weeks agoupdate the hv_vmbus(4) manual by adding a dependency on pci
dexuan [Fri, 18 Nov 2016 07:27:41 +0000 (07:27 +0000)]
update the hv_vmbus(4) manual by adding a dependency on pci

We enhanced the vmbus driver to support PCIe pass-through recently.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft

2 weeks agohyperv/pcib: change the file name: pcib.c -> vmbus_pcib.c
dexuan [Fri, 18 Nov 2016 06:44:18 +0000 (06:44 +0000)]
hyperv/pcib: change the file name: pcib.c -> vmbus_pcib.c

This makes the file name and the variable naming in the file consistent.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft

2 weeks agohyperv/vmbus,pcib: Add MODULE_DEPEND on pci
dexuan [Fri, 18 Nov 2016 06:24:22 +0000 (06:24 +0000)]
hyperv/vmbus,pcib: Add MODULE_DEPEND on pci

We'd better add this dependency explicitly, though usually the pci
driver is built into the kernel by default.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft

2 weeks agohyperv/pcib: Fix the build for some kernel configs
dexuan [Fri, 18 Nov 2016 05:33:01 +0000 (05:33 +0000)]
hyperv/pcib: Fix the build for some kernel configs

Add the dependency on pci explicitly for the pcib and vmbus drivers.
The related Makefiles are updated accordingly too.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft

2 weeks agoiflib updates and fixes:
sbruno [Fri, 18 Nov 2016 04:19:21 +0000 (04:19 +0000)]
iflib updates and fixes:
-    reset gen on down
-    initialize admin task statically
-    drain mp_ring on down
-    don't drop context lock on stop
-    reset error stats on down
-    fix typo in min_latency sysctl
-    return ENOBUFS from if_transmit if the driver isn't running or the link is down

Submitted by:
Reviewed by: shurd
MFC after: 2 days
Sponsored by: Isilon and Limelight Networks
Differential Revision:

2 weeks agoSupport fetching RFLAGS in fasttrap_getreg().
markj [Fri, 18 Nov 2016 03:11:11 +0000 (03:11 +0000)]
Support fetching RFLAGS in fasttrap_getreg().

MFC after: 1 week

2 weeks agoAdd a dtrace script for collecting schedgraph data
rstone [Fri, 18 Nov 2016 02:29:09 +0000 (02:29 +0000)]
Add a dtrace script for collecting schedgraph data

2 weeks agoIf FreeBSD source tree is a subproject of a bigger project, then .git or
glebius [Fri, 18 Nov 2016 00:13:30 +0000 (00:13 +0000)]
If FreeBSD source tree is a subproject of a bigger project, then .git or
.hg may reside above FreeBSD sources root.  Provide function findvcs()
that will climb up and seek for presence of a VCS directory.

Reviewed by: imp (earlier version of the patch)

2 weeks agoCleanup some leftovers from '-s' removal in r302792.
bdrewery [Thu, 17 Nov 2016 23:16:56 +0000 (23:16 +0000)]
Cleanup some leftovers from '-s' removal in r302792.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

2 weeks agoAdd missing newline in error mesage
shurd [Thu, 17 Nov 2016 23:05:34 +0000 (23:05 +0000)]
Add missing newline in error mesage

Approved by: davidch
MFC after: 13 days
Sponsored by: Broadcom Corporation

2 weeks agorc.subr: Swap checks so we only fork sysctl if *_oomprotect is set.
jilles [Thu, 17 Nov 2016 22:49:51 +0000 (22:49 +0000)]
rc.subr: Swap checks so we only fork sysctl if *_oomprotect is set.

2 weeks ago[net80211] Don't check bgscanidle setting in net80211 for full-offload scan.
ivadasz [Thu, 17 Nov 2016 21:52:00 +0000 (21:52 +0000)]
[net80211] Don't check bgscanidle setting in net80211 for full-offload scan.

If full-offload scan is used, the NIC driver (or rather the firmware of
the NIC) should take care of interrupting and continuing the background
scan. So net80211 should ignore the vap->iv_bgscanidle setting then, instead
the NIC driver might look at this setting and pass it on to the firmware
in some way if possible.

Since full-offload scans won't be explicitly interrupted by net80211, it
also doesn't really make sense to check the vap->iv_bgscanidle condition
in that case, before starting a background scan. If the NIC driver
advertises background scan support and full-offload scanning, the firmware
should be able to execute that scan without interfering too much with our
data traffic.

Reviewed by: adrian, avos
Approved by: adrian (mentor)
Differential Revision:

2 weeks agoAdd flag SF_USER_READAHEAD to sendfile(2). When specified, the syscall won't
glebius [Thu, 17 Nov 2016 21:36:18 +0000 (21:36 +0000)]
Add flag SF_USER_READAHEAD to sendfile(2).  When specified, the syscall won't
do any speculations about readahead, and use exactly the amount of readahead
specified by user.  E.g. setting SF_FLAGS(0, SF_USER_READAHEAD) will guarantee
that no readahead at all will be performed.

2 weeks agoUse bogus_page to properly reduce number of I/Os in sendfile(2). The new
glebius [Thu, 17 Nov 2016 21:02:55 +0000 (21:02 +0000)]
Use bogus_page to properly reduce number of I/Os in sendfile(2).  The new
sendfile_swapin() loop works this way:

- Find first invalid page in the request.
- Do vm_pager_has_page() and get count of pages, that can be taken in
  single I/O.
- Trim valid pages from the end of the request.
- Cycle through the request and substitute to bogus_page all valid
  pages that are in the middle of the request.
- After I/O launched (pager copies array of pages into buf(9), it
  is important to restore proper page pointers with help vm_page_lookup().

Count bogus pages used and report them in sendfile stats.

2 weeks agoAfter some ZIL changes 6 years ago zil_slog_limit got partially broken
mav [Thu, 17 Nov 2016 21:01:27 +0000 (21:01 +0000)]
After some ZIL changes 6 years ago zil_slog_limit got partially broken
due to zl_itx_list_sz not updated when async itx'es upgraded to sync.
Actually because of other changes about that time zl_itx_list_sz is not
really required to implement the functionality, so this patch removes
some unneeded broken code and variables.

Original idea of zil_slog_limit was to reduce chance of SLOG abuse by
single heavy logger, that increased latency for other (more latency critical)
loggers, by pushing heavy log out into the main pool instead of SLOG. Beside
huge latency increase for heavy writers, this implementation caused double
write of all data, since the log records were explicitly prepared for SLOG.
Since we now have I/O scheduler, I've found it can be much more efficient
to reduce priority of heavy logger SLOG writes from ZIO_PRIORITY_SYNC_WRITE
to ZIO_PRIORITY_ASYNC_WRITE, while still leave them on SLOG.

Existing ZIL implementation had problem with space efficiency when it
has to write large chunks of data into log blocks of limited size. In some
cases efficiency stopped to almost as low as 50%. In case of ZIL stored on
spinning rust, that also reduced log write speed in half, since head had to
uselessly fly over allocated but not written areas. This change improves
the situation by offloading problematic operations from z*_log_write() to
zil_lwb_commit(), which knows real situation of log blocks allocation and
can split large requests into pieces much more efficiently. Also as side
effect it removes one of two data copy operations done by ZIL code WR_COPIED

While there, untangle and unify code of z*_log_write() functions.
Also zfs_log_write() alike to zvol_log_write() can now handle writes crossing
block boundary, that may also improve efficiency if ZPL is made to do that.

Sponsored by: iXsystems, Inc.

2 weeks agoRevert r307392: I've found a way to avoid big allocations completely.
mav [Thu, 17 Nov 2016 20:44:51 +0000 (20:44 +0000)]
Revert r307392:  I've found a way to avoid big allocations completely.

2 weeks agoFix "camcontrol rescan" with SATA drives behind a SAS controller
asomers [Thu, 17 Nov 2016 20:42:56 +0000 (20:42 +0000)]
Fix "camcontrol rescan" with SATA drives behind a SAS controller

A bug in CAM's serial number hash logic resulted in SATA drives behind a SAS
controller getting removed and readded anytime the drive was rescanned for
any reason.

PR: 212914
Submitted by: kadesai
Reported by: kadesai
Reviewed by: asomers, ken
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp

2 weeks agoPass SWAPSIZE in env(1) when invoking for the
gjb [Thu, 17 Nov 2016 20:34:08 +0000 (20:34 +0000)]
Pass SWAPSIZE in env(1) when invoking for the
vm-image target, missed in r308737.

Sponsored by: The FreeBSD Foundation

2 weeks ago- If caller specifies readbehind and readahead that together with count
glebius [Thu, 17 Nov 2016 20:32:32 +0000 (20:32 +0000)]
- If caller specifies readbehind and readahead that together with count
  doesn't fit into a buf, then trim readbehind and readahead evenly.  If
  rbehind was limited by the previous BMAP, then roundup its trim to
  block size.
- Add KASSERT to check that b_blkno has proper offset from original
  blkno returned by BMAP. [1]
- Add KASSERT to check that pages in buf are consecutive.

Reviewed by: kib
Submitted by: kib [1]

2 weeks ago[iwm] Sync iwm_nvm_read_chunk() function with Linux iwlwifi.
ivadasz [Thu, 17 Nov 2016 20:00:20 +0000 (20:00 +0000)]
[iwm] Sync iwm_nvm_read_chunk() function with Linux iwlwifi.

This fixes an error handling detail in iwm_nvm_read_chunk(), where an
error response from the firmware for an NVM read shouldn't be fatal if
the offset was non-zero.

Approved by: adrian (mentor)
Obtained from: DragonFlyBSD git 250a1c33fca1725121fe499f9cebc90267d209f9
Differential Revision:

2 weeks agoloader: zfs toplevel vdev must have spa set.
tsoome [Thu, 17 Nov 2016 19:38:30 +0000 (19:38 +0000)]
loader: zfs toplevel vdev must have spa set.

The salt based checksum mechanisms, such as skein, are storing the seed
in spa structure, and need to access the spa to use the seed. The current
mechanism for quick access to correct spa is via pointer provided by
vdev structure, but unfortunately the current code does set spa only
for the leaf vdev. This patch will fix the issue by making sure the
loader zfs reader will set spa also for top-level vdevs.

PR: 214375
Reported by: lstewart
Reviewed by: allanjude, imp
Approved by: allanjude (mentor), imp (mentor)
MFC after: 2 weeks
Differential Revision:

2 weeks agoZero etherswitch_vlangroup structure before doing partial assignments.
loos [Thu, 17 Nov 2016 19:02:25 +0000 (19:02 +0000)]
Zero etherswitch_vlangroup structure before doing partial assignments.

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)

2 weeks agoloader: beri_sdcard_disk_print() needs to return int.
tsoome [Thu, 17 Nov 2016 18:38:35 +0000 (18:38 +0000)]
loader: beri_sdcard_disk_print() needs to return int.

The did change the return type for
dv_print callbacks, but the return type for beri_sdcard_disk_print()
was left unchanged, causing compile errors.

Reported by: cy
Reviewed by: brooks, rstone, allanjude
Approved by: allanjude (mentor)
Differential Revision:

2 weeks agoDefine dependencies for some auto-generated source files in libdtrace.
markj [Thu, 17 Nov 2016 18:13:42 +0000 (18:13 +0000)]
Define dependencies for some auto-generated source files in libdtrace.

Remove an unneeded beforedepend rule.

Reported by: emaste, jhb
Reviewed by: bdrewery
MFC after: 1 week

2 weeks agocrunchide: report explicit error for combined string table
emaste [Thu, 17 Nov 2016 18:12:17 +0000 (18:12 +0000)]
crunchide: report explicit error for combined string table

Some tools produce objects with a combined strtab and shstrtab.
These objects are not supported by crunchide since it rewrites the
symtab and strtab to "hide" symbols. This invalidates section header
offsets into a combined strtab/shstrtab.

In the future we could support these objects (by ensuring that we retain
unmodified section name strings in the output .strtab, and then rewriting
each section header's sh_name).

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 weeks agoFix build when no INET and INET6 in kernel config.
br [Thu, 17 Nov 2016 16:13:30 +0000 (16:13 +0000)]
Fix build when no INET and INET6 in kernel config.

Submitted by: kan
Sponsored by: DARPA, AFRL

2 weeks agoDo not reallocate driver softc for uart unnecessarily.
br [Thu, 17 Nov 2016 16:06:53 +0000 (16:06 +0000)]
Do not reallocate driver softc for uart unnecessarily.

Do not assume that all uart drivers use uart_softc structure as is.
Some do a sensible thing and do declare their uart class and driver
properly and arrive into uart_bus_attach with suitably sized softc.

Submitted by: kan
Sponsored by: DARPA, AFRL

2 weeks agoMake gpiobus early driver at BUS_PAS_BUS.
br [Thu, 17 Nov 2016 15:37:44 +0000 (15:37 +0000)]
Make gpiobus early driver at BUS_PAS_BUS.

The gpiobus driver is attached explicitly and generally should be
at the same pass as its parent. Making it use BUS_PAS_BUS ensures
that it attaches immediately after parent adds it (assuming the
parent itself attached at BUS_PAS_BUS and above).

Submitted by: kan
Sponsored by: DARPA, AFRL

2 weeks agoMore robust handling of whois referrals from RIRs.
fanf [Thu, 17 Nov 2016 15:19:06 +0000 (15:19 +0000)]
More robust handling of whois referrals from RIRs.

An example problem case is (University of Oxford)
which is in an APNIC ERX address range. Previously we assumed
that ARIN has the correct information for all ERX allocations,
but in this case ARIN refers back to APNIC, rather than referring
to RIPE. This caused whois to loop.

Whois will no longer loop back and forth forever between two RIRs
that don't have an answer, but instead try the other RIRs in turn.

2 weeks agoDeclare dwc_otg_detach as non-static (same as dwc_otg_attach),
br [Thu, 17 Nov 2016 15:12:03 +0000 (15:12 +0000)]
Declare dwc_otg_detach as non-static (same as dwc_otg_attach),
so it can be called from fdt-glue drivers.

Submitted by: kan
Sponsored by: DARPA, AFRL

2 weeks agoAllow operation with UTMI+ phy.
br [Thu, 17 Nov 2016 15:08:30 +0000 (15:08 +0000)]
Allow operation with UTMI+ phy.

Submitted by: kan
Sponsored by: DARPA, AFRL

2 weeks agoRemove outdated comment.
br [Thu, 17 Nov 2016 14:43:13 +0000 (14:43 +0000)]
Remove outdated comment.

Pointed out by: andrew (original author)
Sponsored by: DARPA, AFRL

2 weeks agoAdd support for UART found in the Ingenic XBurst system on chips.
br [Thu, 17 Nov 2016 14:41:22 +0000 (14:41 +0000)]
Add support for UART found in the Ingenic XBurst system on chips.

These CPUs has non-standard UART enable bit hidden in the UART FIFO
Control Register.

Sponsored by: DARPA, AFRL

2 weeks agoWriting out the L2TP control packet requires 12 bytes of
bz [Thu, 17 Nov 2016 14:03:44 +0000 (14:03 +0000)]
Writing out the L2TP control packet requires 12 bytes of
contiguous memory but in one path we did not always guarantee this,
thus do a m_pullup() there.

PR: 214385
Submitted by: Joe Jones (joeknockando
MFC after: 3 days

2 weeks agoAdd driver for DM9000 Ethernet MAC Controller.
br [Thu, 17 Nov 2016 11:48:07 +0000 (11:48 +0000)]
Add driver for DM9000 Ethernet MAC Controller.

This device found in the Ingenic jz4780 SoC.

Submitted by: kan
Sponsored by: DARPA, AFRL

2 weeks agoImport Ingenic CI20 (jz4780) DTS files.
br [Thu, 17 Nov 2016 11:31:13 +0000 (11:31 +0000)]
Import Ingenic CI20 (jz4780) DTS files.

Submitted by: kan
Sponsored by: DARPA, AFRL

2 weeks agoNotify the use via setting errno when a TCP RST segment is received
tuexen [Thu, 17 Nov 2016 08:15:02 +0000 (08:15 +0000)]
Notify the use via setting errno when a TCP RST segment is received
either in the CLOSING or LAST-ACK state.

Reviewed by: hiren
MFC after: 3 weeks
Sponsored by: Netflix
Differential Revision:

2 weeks ago[etherswitch] add infineon adm6996fc support on etherswitch
mizhka [Thu, 17 Nov 2016 07:33:37 +0000 (07:33 +0000)]
[etherswitch] add infineon adm6996fc support on etherswitch

This is Infineon ADM6996FC/M/MX driver code on etherswitch framework.
Support PORT and DOT1Q VLAN.
This code suppose ADM6996FC SDC/SDIO connect to SOC network interface
This code tested on Netgear WGR614Cv7.

Submitted by: Hiroki Mori <>
Reviewed by: adrian, mizhka
Approved by: adrian(mentor)
Differential Revision:

2 weeks agohyperv/vss: Install the userland daemon to /usr/sbin instead of /
sephe [Thu, 17 Nov 2016 03:02:35 +0000 (03:02 +0000)]
hyperv/vss: Install the userland daemon to /usr/sbin instead of /

Submitted by: markj
Reported by: markj
MFC after: 3 weeks
Sponsored by: Microsoft

2 weeks agohyperv/vss: Nuke unused variables.
sephe [Thu, 17 Nov 2016 03:00:56 +0000 (03:00 +0000)]
hyperv/vss: Nuke unused variables.

Submitted by: markj
Reported by: markj
MFC after: 3 weeks
Sponsored by: Microsoft

2 weeks agoFix grammar nit
bdrewery [Thu, 17 Nov 2016 00:21:55 +0000 (00:21 +0000)]
Fix grammar nit

2 weeks agoPass SWAPSIZE in env(1) when invoking, otherwise
gjb [Wed, 16 Nov 2016 18:08:50 +0000 (18:08 +0000)]
Pass SWAPSIZE in env(1) when invoking, otherwise
mkimg(1) does not create the second partition after r307008.

Sponsored by: The FreeBSD Foundation

2 weeks agoAllow installworld to be skipped as well as installkernel with -W.
imp [Wed, 16 Nov 2016 17:11:05 +0000 (17:11 +0000)]
Allow installworld to be skipped as well as installkernel with -W.
Allow -B to mean -K -W.

There are times when fixing non-base elementes of the build that you
don't want to wait to get a completely clean world install. This
allows that at the cost of a little danger.

Submitted by: gallatin@
Sponsored by: Netflix, Inc

2 weeks agoStart to move the old interface into a legacy file.
imp [Wed, 16 Nov 2016 16:49:21 +0000 (16:49 +0000)]
Start to move the old interface into a legacy file.

2 weeks agocrunchide: remove obsolete a.out header and comment
emaste [Wed, 16 Nov 2016 16:39:51 +0000 (16:39 +0000)]
crunchide: remove obsolete a.out header and comment

crunchide(1) gained ELF support in r39172, and lost the unused a.out
and non-functional ECOFF suport in r281655.

Sponsored by: The FreeBSD Foundation

2 weeks agoMove the fast fault path into the separate function.
kib [Wed, 16 Nov 2016 16:34:17 +0000 (16:34 +0000)]
Move the fast fault path into the separate function.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 weeks agoAdd full softfloat and hardfloat support for RISC-V.
br [Wed, 16 Nov 2016 15:21:32 +0000 (15:21 +0000)]
Add full softfloat and hardfloat support for RISC-V.

Hardfloat is now default (use riscv64sf as TARGET_ARCH
for softfloat).

Sponsored by: DARPA, AFRL
Differential Revision:

2 weeks agoMake sure MAC address is reprogrammed when if_init() callback is
hselasky [Wed, 16 Nov 2016 14:39:03 +0000 (14:39 +0000)]
Make sure MAC address is reprogrammed when if_init() callback is
invoked. Else promiscious mode must be used to pass traffic. While at
it fix a debug print macro.

MFC after: 1 week

2 weeks agoAdd bnxt(4) to the hardware notes.
brueffer [Wed, 16 Nov 2016 13:27:39 +0000 (13:27 +0000)]
Add bnxt(4) to the hardware notes.

2 weeks agoVarious minor cleanups.
brueffer [Wed, 16 Nov 2016 13:22:57 +0000 (13:22 +0000)]
Various minor cleanups.

2 weeks agoInclude the SMSC LAN91C111 driver, this is found in some of the ARM models.
andrew [Wed, 16 Nov 2016 11:37:43 +0000 (11:37 +0000)]
Include the SMSC LAN91C111 driver, this is found in some of the ARM models.

2 weeks agoUse the correct OF_getencprop to get the height.
andrew [Wed, 16 Nov 2016 11:31:53 +0000 (11:31 +0000)]
Use the correct OF_getencprop to get the height.

Reported by: jmcneill
Sponsored by: ABT Systems Ltd

2 weeks agohyperv/pcib: enable PCIe pass-through (a.k.a. Discrete Device Assignment)
dexuan [Wed, 16 Nov 2016 09:25:00 +0000 (09:25 +0000)]
hyperv/pcib: enable PCIe pass-through (a.k.a. Discrete Device Assignment)

The feature enables us to pass through physical PCIe devices to FreeBSD VM
running on Hyper-V (Windows Server 2016) to get near-native performance with
low CPU utilization.

The patch implements a PCI bridge driver to support the feature:

1) The pcib driver talks to the host to discover device(s) and presents
the device(s) to FreeBSD's pci driver via PCI configuration space (note:
to access the configuration space, we don't use the standard I/O port
0xCF8/CFC method; instead, we use an MMIO-based method supplied by Hyper-V,
which is very similar to the 0xCF8/CFC method).

2) The pcib driver allocates resources for the device(s) and initialize
the related BARs, when the device driver's attach method is invoked;

3) The pcib driver talks to the host to create MSI/MSI-X interrupt
remapping between the guest and the host;

4) The pcib driver supports device hot add/remove.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision:

2 weeks agohyperv/vmbus: add new vmbus methods to support PCIe pass-through
dexuan [Wed, 16 Nov 2016 09:08:32 +0000 (09:08 +0000)]
hyperv/vmbus: add new vmbus methods to support PCIe pass-through

The new methods will be used by the coming pcib driver.

Reviewed by: sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision:

2 weeks agohyperv/vmbus: add a new method to get vcpu_id
dexuan [Wed, 16 Nov 2016 09:02:17 +0000 (09:02 +0000)]
hyperv/vmbus: add a new method to get vcpu_id

vcpu_id is host's representation of guest CPU.
We get the mapping between vcpu_id and FreeBSD kernel's cpu id when VMBus
driver is loaded. Later, when a driver, like the coming pcib driver, talks
to the host and needs to refer to a guest CPU, the driver must use the

Reviewed by: jhb, sephe
Approved by: sephe (mentor)
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision:

2 weeks agoSimplify the page tracking for VA<->PA translations.
jhibbits [Wed, 16 Nov 2016 05:24:42 +0000 (05:24 +0000)]
Simplify the page tracking for VA<->PA translations.

Drop the tracking down to the pmap layer, with optimizations to only track
necessary pages.  This should give a (slight) performance improvement, as well
as a stability improvement, as the tracking is already mostly handled by the
pmap layer.

2 weeks agoCompile trampoline with soft-float on MIPS, to match the rest of the kernel
kan [Wed, 16 Nov 2016 03:24:20 +0000 (03:24 +0000)]
Compile trampoline with soft-float on MIPS, to match the rest of the kernel

Core kernel is always compiled with -msoft-float on all of our platforms,
make sure we follow the suit with trampoline as well.

Reviewed by: adrian, br, imp
Differential Revision:

2 weeks agoMake MIPS startup assembly files use neutral float ABI.
kan [Wed, 16 Nov 2016 03:21:49 +0000 (03:21 +0000)]
Make MIPS startup assembly files use neutral float ABI.

This allows these files to be used with hard and softfloat targets
with no special flags passed to the compiler.

Reviewed by: adrian, br, imp
Differential Revision:

2 weeks agoSet endianness and floating point flags explicitly for MIPS targets
kan [Wed, 16 Nov 2016 03:19:36 +0000 (03:19 +0000)]
Set endianness and floating point flags explicitly for MIPS targets

The tree can be build with an external toolchain that will not
necessarily default to desired settings, so we have to specify
the required flags explicitly to force the required compilation

Reviewed by: adrian, br
Sponsored by:

2 weeks agoUpdate to reflect the demise of PG_CACHED pages.
alc [Wed, 16 Nov 2016 02:51:24 +0000 (02:51 +0000)]
Update to reflect the demise of PG_CACHED pages.

Reviewed by: kib, markj
Sponsored by: Dell EMC Isilon
Differential Revision:

2 weeks agoAdd a GPIO poweroff and reset driver.
jhibbits [Wed, 16 Nov 2016 02:14:07 +0000 (02:14 +0000)]
Add a GPIO poweroff and reset driver.

This implements part of the gpio-poweroff and gpio-restart device tree
bindings.  Optional properties are not handled currently.  It also currently
only supports level-triggered reset.

Reviewed By: gonzo
Differential Revision:

2 weeks agoReduce NFS "NFSv4( mounted on)? fileid > 32bits" log spam.
cperciva [Wed, 16 Nov 2016 01:11:49 +0000 (01:11 +0000)]
Reduce NFS "NFSv4( mounted on)? fileid > 32bits" log spam.

Rather than printing a warning for every time we receive a fileid > 2^32
from the NFS server, count warnings and print at most one of each warning
type per minute, e.g.,

Nov 15 05:17:34 ip-172-30-1-221 kernel: NFSv4 fileid > 32bits (24730 occurrences)
Nov 15 05:17:56 ip-172-30-1-221 kernel: NFSv4 mounted on fileid > 32bits (178 occurrences)
Nov 15 05:18:53 ip-172-30-1-221 kernel: NFSv4 fileid > 32bits (7582 occurrences)
Nov 15 05:18:58 ip-172-30-1-221 kernel: NFSv4 mounted on fileid > 32bits (23 occurrences)

A buildworld with an NFS mounted /usr/obj can otherwise result in
hundreds of thousands of lines being printed, which seems unnecessarily

When ino_t becomes a 64-bit type, these printfs will no longer be needed
(and the problems associated with truncating 64-bit fileids to generate
32-bit inode numbers will also go away).

Reviewed by: rmacklem
MFC after: 1 month
Differential Revision:

2 weeks agoRemove a lingering reference to cache pages from vmstat(8).
markj [Wed, 16 Nov 2016 00:21:18 +0000 (00:21 +0000)]
Remove a lingering reference to cache pages from vmstat(8).

Reported by: alc

2 weeks agoOn command error, reset only DMA and FIFO engines instead of the entire
jmcneill [Tue, 15 Nov 2016 23:48:30 +0000 (23:48 +0000)]
On command error, reset only DMA and FIFO engines instead of the entire
controller. Fixes eMMC device detection on OrangePi Plus 2e (and likely

2 weeks agoAllow the MMC frequency to be set up to 52MHz for MMC high speed timings.
jmcneill [Tue, 15 Nov 2016 23:46:01 +0000 (23:46 +0000)]
Allow the MMC frequency to be set up to 52MHz for MMC high speed timings.

2 weeks ago[etherswitch] enable phy4/mac4 of ip175c
mizhka [Tue, 15 Nov 2016 22:30:25 +0000 (22:30 +0000)]
[etherswitch] enable phy4/mac4 of ip175c

If MII1 interface is disabled, then enable phy4/mac4.

Submitted by: Hiroki Mori <>
Reviewed by: mizhka, adrian
Approved by: adrian (mentor)
Differential Revision:

2 weeks ago[etherswitch] add RTL8366SR support
mizhka [Tue, 15 Nov 2016 21:58:04 +0000 (21:58 +0000)]
[etherswitch] add RTL8366SR support

Add RTL8366SR support at etherswitch driver. Tested on RTL8366RB and

Submitted by: Hiroki Mori <>
Reviewed by: adrian, mizhka
Approved by: adrian(mentor)
Differential Revision:

2 weeks ago[etherswitch] add Marvell 88e6060 switch support
mizhka [Tue, 15 Nov 2016 21:49:01 +0000 (21:49 +0000)]
[etherswitch] add Marvell 88e6060 switch support

Add 88e6060 basic support: only port-based VLAN is supported.
No vlan(4) support.

Submitted by: Hiroki Mori <>
Reviewed by: mizhka, adrian
Approved by: adrian(mentor)
Differential Revision:

2 weeks agoAfter r308533, the platform compatible string must be an exact match.
loos [Tue, 15 Nov 2016 21:18:55 +0000 (21:18 +0000)]
After r308533, the platform compatible string must be an exact match.

Use "ti,am33xx" instead of "ti,am335x", which gives an exact match in every
DTS we support.

This fixes the boot on TI SoCs after r308533.

Suggested by: gonzo
Sponsored by: Rubicon Communications, LLC (Netgate)

2 weeks ago[MIPS] Fix Config3[ULRI] printing
mizhka [Tue, 15 Nov 2016 20:44:19 +0000 (20:44 +0000)]
[MIPS] Fix Config3[ULRI] printing

Bit identifier of printf %b is octal integer, but not decimal. ULRI bit is
13-th bit (starting with 0) according to MIPS Architecture Volume III v.6.
In this case the bit identifier (starts with 1) should be \16.

Reviewed by:    gonzo
Approved by: adrian(mentor)
Differential Revision:

2 weeks agoNew driver for Broadcom NetXtreme-C and NetXtreme-E devices.
shurd [Tue, 15 Nov 2016 20:35:29 +0000 (20:35 +0000)]
New driver for Broadcom NetXtreme-C and NetXtreme-E devices.

This driver uses the iflib framework supporting Broadcom
25/50Gbps devices.

Reviewed by: gallatin, wblock
Approved by: davidch
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Broadcom Limited
Differential Revision:

2 weeks ago[BHND] correct spelling error in macro name
mizhka [Tue, 15 Nov 2016 20:05:22 +0000 (20:05 +0000)]
[BHND] correct spelling error in macro name

This commit is part of D6920 review. One of macro had wrong prefix:

Reviewed by: landonf, adrian (mentor)
Approved by: adrian (mentor)
Differential Revision:

2 weeks agoPlug a lock leak in sysctl_ifmalist().
markj [Tue, 15 Nov 2016 19:23:48 +0000 (19:23 +0000)]
Plug a lock leak in sysctl_ifmalist().

Fix style in the local variable declarations.

PR: 214542
MFC after: 1 week

2 weeks agoChange the TI aintc driver name to "ti_aintc" to avoid the conflict with
loos [Tue, 15 Nov 2016 19:09:36 +0000 (19:09 +0000)]
Change the TI aintc driver name to "ti_aintc" to avoid the conflict with
the aintc driver for Allwinner A10.

This fixes the boot of the GENERIC ARM kernel on TI/AM335x SoCs.

Sponsored by: Rubicon Communications, LLC (Netgate)

2 weeks agoFix ti_gpio_detach() to avoid crashing if something goes wrong.
loos [Tue, 15 Nov 2016 18:57:25 +0000 (18:57 +0000)]
Fix ti_gpio_detach() to avoid crashing if something goes wrong.

Sponsored by: Rubicon Communication, LLC (Netgate)

2 weeks agoRemove most of the code for implementing PG_CACHED pages. (This change does
alc [Tue, 15 Nov 2016 18:22:50 +0000 (18:22 +0000)]
Remove most of the code for implementing PG_CACHED pages.  (This change does
not remove user-space visible fields from vm_cnt or all of the references to
cached pages from comments.  Those changes will come later.)

Reviewed by: kib, markj
Tested by: pho
Sponsored by: Dell EMC Isilon
Differential Revision:

2 weeks agoSync instruction cache's after writing user breakpoints on MIPS.
jhb [Tue, 15 Nov 2016 17:01:48 +0000 (17:01 +0000)]
Sync instruction cache's after writing user breakpoints on MIPS.

Add an implementation for pmaps_sync_icache() on MIPS that sync's the
instruction cache on all CPUs via smp_rendezvous() after a debugger
inserts a breakpoint via ptrace(PT_IO).

Tested by: kan (on Creator CI20 running Ingenic JZ4780 SOC)
MFC after: 2 weeks
Sponsored by: DARPA / AFRL

2 weeks agoPass CPUID[1] %edx (cpu_feature), %ecx (cpu_feature2) and
kib [Tue, 15 Nov 2016 09:43:26 +0000 (09:43 +0000)]
Pass CPUID[1] %edx (cpu_feature), %ecx (cpu_feature2) and
CPUID[7].%ebx (cpu_stdext_feature), %ecx (cpu_stdext_feature2) to the
ifunc resolvers on x86.

It is much more clean to use CPUID instruction in usermode to retrieve
this information than to pass AT_HWCAP aux vector from kernel, on
x86.  Still, the change does allow for use of AT_HWCAP on arches where it is
needed, by passing aux array to ifunc_init() initializer which should
prepare arguments for ifunc resolvers.

Current signature for resolvers on x86 is
func_t iresolve(uint32_t cpu_feature, uint32_t cpu_feature2,
    uint32_t cpu_stdext_feature, uint32_t cpu_stdext_feature2);
where arguments have identical meaning as the kernel variables of the
same name.  The ABIs allow to use resolvers with the void or shortened
list of arguments.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision:

2 weeks agoAssert that there is no unresolved symbols during rtld linking.
kib [Tue, 15 Nov 2016 09:40:03 +0000 (09:40 +0000)]
Assert that there is no unresolved symbols during rtld linking.

Reviewed by: emaste, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-Differential revision:

2 weeks agoUpdate hint to utilize user variable.
kib [Tue, 15 Nov 2016 09:37:35 +0000 (09:37 +0000)]
Update hint to utilize user variable.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 weeks agoAdd myself (dexuan) as a src committer and sephe as my mentor.
dexuan [Tue, 15 Nov 2016 09:20:28 +0000 (09:20 +0000)]
Add myself (dexuan) as a src committer and sephe as my mentor.

Approved by: sephe (mentor)

2 weeks agoAdd missing support of named lookup tables to the IPv6 code.
ae [Tue, 15 Nov 2016 07:13:16 +0000 (07:13 +0000)]
Add missing support of named lookup tables to the IPv6 code.

PR: 214419
MFC after: 1 week
Sponsored by: Yandex LLC

2 weeks agoUpstream DTS provides PLL3 and PLL7 nodes (and their x2 form),
manu [Tue, 15 Nov 2016 07:08:33 +0000 (07:08 +0000)]
Upstream DTS provides PLL3 and PLL7 nodes (and their x2 form),
so remove them from our DTS and adapt the code to handle them correctly.
This fix HDMI video on A20.

2 weeks agoWhen you select make OLDTIMEZONES=1 then you need a few added directories
julian [Tue, 15 Nov 2016 06:37:44 +0000 (06:37 +0000)]
When you select make OLDTIMEZONES=1 then you need a few added directories
to be made or the command fails

Sponsored by: panzura

2 weeks agoAdd sdhci and mmc drivers to MPC85XX/MPC85XXSPE
jhibbits [Tue, 15 Nov 2016 05:05:51 +0000 (05:05 +0000)]
Add sdhci and mmc drivers to MPC85XX/MPC85XXSPE

sdhci was missing from MPC85XXSPE, and mmc/mmcsd were missing from both.

2 weeks agoWrite to the correct GPIO registers.
jhibbits [Tue, 15 Nov 2016 04:49:26 +0000 (04:49 +0000)]
Write to the correct GPIO registers.

Offset 0 is the direction register, not the data register.

MFC after: 1 week

2 weeks ago[evdev] Add evdev support to kbdmux(4) driver
gonzo [Tue, 15 Nov 2016 04:12:19 +0000 (04:12 +0000)]
[evdev] Add evdev support to kbdmux(4) driver

To enable event sourcing from kbdmux(4) kern.evdev.rcpt_mask value
should have bit 1 set (this is default)

Submitted by: Vladimir Kondratiev <>
MFC after: 1 week
Differential Revision:

2 weeks agocache: plug a write-only variable in cache_negative_zap_one
mjg [Tue, 15 Nov 2016 03:43:10 +0000 (03:43 +0000)]
cache: plug a write-only variable in cache_negative_zap_one

2 weeks agocache: fix a race between entry removal and demotion
mjg [Tue, 15 Nov 2016 03:38:05 +0000 (03:38 +0000)]
cache: fix a race between entry removal and demotion

The negative list shrinker can demote an entry with only hotlist + neglist
locks held. On the other hand entry removal possibly sets the NCF_DVDROP
without aformentioned locks held prior to detaching it from the respective
netlist., which can lose the update made by the shrinker.

Reported and tested by: truckman

2 weeks agohyperv/vss: Add driver and tools for VSS
sephe [Tue, 15 Nov 2016 02:36:12 +0000 (02:36 +0000)]
hyperv/vss: Add driver and tools for VSS

VSS stands for "Volume Shadow Copy Service".  Unlike virtual machine
snapshot, it only takes snapshot for the virtual disks, so both
filesystem and applications have to aware of it, and cooperate the
whole VSS process.

This driver exposes two device files to the userland:


    Normally userland programs should _not_ mess with this device file.
    It is currently used by the hv_vss_daemon(8), which freezes and
    thaws the filesystem.  NOTE: currently only UFS is supported, if
    the system mounts _any_ other filesystems, the hv_vss_daemon(8)
    will veto the VSS process.

    If hv_vss_daemon(8) was disabled, then this device file must be
    opened, and proper ioctls must be issued to keep the VSS working.


    Userland application can opened this device file to receive the
    VSS freeze notification, hold the VSS for a while (mainly to flush
    application data to filesystem), release the VSS process, and
    receive the VSS thaw notification i.e. applications can run again.

    The VSS will still work, even if this device file is not opened.
    However, only filesystem consistency is promised, if this device
    file is not opened or is not operated properly.

hv_vss_daemon(8) is started by devd(8) by default.  It can be disabled
by editting /etc/devd/hyperv.conf.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: kib, mckusick
MFC after: 3 weeks
Sponsored by: Microsoft
Differential Revision:

2 weeks ago[net80211] announce 11n capabilities in probe requests in IBSS mode.
adrian [Tue, 15 Nov 2016 01:47:37 +0000 (01:47 +0000)]
[net80211] announce 11n capabilities in probe requests in IBSS mode.

The 802.11-2012 specification notes that a subset of IEs should be present
in IBSS probe requests.  This is what (initially) allows nodes to discover
that other nodes are 11n capable.  Notably - HTCAP, but not HTINFO.

This isn't everything required to reliably enable 11n between net80211
peers; there's more work to come.


* AR9380, IBSS+11n mode

2 weeks ago[mips] enable relbuf on mips for now to work around page aliasing in mips hardware.
adrian [Tue, 15 Nov 2016 01:41:45 +0000 (01:41 +0000)]
[mips] enable relbuf on mips for now to work around page aliasing in mips hardware.

Although the higher end MIPS hardware handles cache aliasing issues in
hardware, the older cores (r4k, etc) and some compile versions of the
newer cores (mips24k, mips34k, mips74k) don't have this feature.
This means we end up with some very unfortunate behaviour that was
made very obvious by some recent changes to the FFS pager by kib.

So, flip this off until we get our MIPS pmap/cache code upgraded to
handle aliased pages in software.

Discussed with: kib, bsdimp, juli

2 weeks ago[mips] make UMTX_CHAINS configurable at compile time.
adrian [Tue, 15 Nov 2016 01:34:38 +0000 (01:34 +0000)]
[mips] make UMTX_CHAINS configurable at compile time.

The default (512) wastes quite a bit of space which doesn't really buy
us much on highly embedded systems which don't take a lot of locks in

This makes it at least build time configurable so people can experiment.

2 weeks agoReduce dmesg verbosity.
loos [Tue, 15 Nov 2016 00:58:31 +0000 (00:58 +0000)]
Reduce dmesg verbosity.

2 weeks agofold(1): Revert incorrect r308432
cem [Tue, 15 Nov 2016 00:24:18 +0000 (00:24 +0000)]
fold(1): Revert incorrect r308432

As Jean-S├ębastien notes, fold(1) requires handling argv-supplied files.  That
will require a slightly more sophisticated approach.

Reported by: dumbbell@
Sponsored by: Dell EMC Isilon

2 weeks agonet80211: switch from ieee80211_iterate_nodes() to
avos [Mon, 14 Nov 2016 23:51:28 +0000 (23:51 +0000)]
net80211: switch from ieee80211_iterate_nodes() to
ieee80211_iterate_nodes_vap() where possible; this should
make the code a bit cleaner.

2 weeks ago[MIPS] Print Config7 on boot for several MIPS architectures
mizhka [Mon, 14 Nov 2016 21:38:36 +0000 (21:38 +0000)]
[MIPS] Print Config7 on boot for several MIPS architectures

Config7 contains useful fields, for instance, field AR indicating that the D-cache is configured to avoid cache aliases. This patch brings printing of config7 for MIPS 24K, 74K, 1004K.

Reviewed by: adrian
Approved by: adrian (mentor)
Differential Revision:

2 weeks agoAdd the cpsw, the NIC driver for ti/am335x, to GENERIC kernel.
loos [Mon, 14 Nov 2016 20:57:30 +0000 (20:57 +0000)]
Add the cpsw, the NIC driver for ti/am335x, to GENERIC kernel.

While here:

 - remove 'device mii' - included by miibus;
 - remove 'device smcphy' - included by miibus;
 - sorted the network drivers list;
 - added a comment about miibus based on amd64/GENERIC.

Sponsored by: Rubicon Communications, LLC (Netgate)