freebsd.git
7 years agoSwitch to Linux / device tree upstream names. U-boot uses these by
imp [Sat, 28 Jan 2017 05:07:55 +0000 (05:07 +0000)]
Switch to Linux / device tree upstream names. U-boot uses these by
default, and the fewer changes relative to the upstream u-boot the
better.
Add compatibility links for the old names.
Add dts file for BeagleBone Green while we're here.

7 years agoHonor LINKS=x y in dtb modules. We need this for compatibility links
imp [Sat, 28 Jan 2017 05:07:53 +0000 (05:07 +0000)]
Honor LINKS=x y in dtb modules. We need this for compatibility links
for old, FreeBSD names.

7 years agoImprove the aio tests
asomers [Sat, 28 Jan 2017 04:33:51 +0000 (04:33 +0000)]
Improve the aio tests

* Add tests for aio_suspend(2).
* Add tests for polled completion notification.
* Test the full matrix of file descriptor types and completion notification
  mechanisms.
* Don't bother with mkstemp, because ATF runs every test in its own temp dir.
* Fix some typos.
* Remove extraneous ATF_REQUIRE_KERNEL_MODULE calls.

Reviewed by: jhb
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D9045

7 years agoGarbage collect the FPU_ERROR_BROKEN option.
nyan [Sat, 28 Jan 2017 03:53:53 +0000 (03:53 +0000)]
Garbage collect the FPU_ERROR_BROKEN option.
It is for pc98 only.

7 years agoRegen after r312910.
nyan [Sat, 28 Jan 2017 02:25:33 +0000 (02:25 +0000)]
Regen after r312910.

7 years agoRemove pc98 support completely.
nyan [Sat, 28 Jan 2017 02:22:15 +0000 (02:22 +0000)]
Remove pc98 support completely.
I thank all developers and contributors for pc98.

Relnotes: yes

7 years agoAdd iflib man pages for developers.
sbruno [Sat, 28 Jan 2017 00:40:36 +0000 (00:40 +0000)]
Add iflib man pages for developers.

Doc review is probably waranted here for editing.

Submitted by: Nicole Graziano

7 years agoERL: set -march=octeon+ for use with external toolchain
emaste [Sat, 28 Jan 2017 00:00:10 +0000 (00:00 +0000)]
ERL: set -march=octeon+ for use with external toolchain

Upstream GCC and devel/mips64-gcc use "octeon+" as the CPU setting for
the Octeon processor in the EdgeRouter Lite. As of r312899 the base
system GCC 4.2.1 accepts octeon+ as an alias for the Octeon support
added in r208737 for the same CPU.

Sponsored by: The FreeBSD Foundation

7 years agoAdd a knob to change default behavior of inheriting listen socket's tcp stack
hiren [Fri, 27 Jan 2017 23:10:46 +0000 (23:10 +0000)]
Add a knob to change default behavior of inheriting listen socket's tcp stack
regardless of what the default stack for the system is set to.

With current/default behavior, after changing the default tcp stack, the
application needs to be restarted to pick up that change. Setting this new knob
net.inet.tcp.functions_inherit_listen_socket_stack to '0' would change that
behavior and make any new connection use the newly selected default tcp stack.

Reviewed by: rrs
MFC after: 2 weeks
Sponsored by: Limelight Networks

7 years agoUnregister CPL handlers for TOE-related messages when unloading TOM.
jhb [Fri, 27 Jan 2017 23:08:30 +0000 (23:08 +0000)]
Unregister CPL handlers for TOE-related messages when unloading TOM.

MFC after: 1 week
Sponsored by: Chelsio Communications

7 years agoIFLIB updates:
sbruno [Fri, 27 Jan 2017 23:08:06 +0000 (23:08 +0000)]
IFLIB updates:
We found routing performance dropped significantly when configuring
FreeBSD as a router, we are applying the following changes in order to
resolve those issues and hopefully perform better.
 - don't prefetch the flags array, we usually don't need it
 - prefetch the next cache line of each of the software descriptor arrays as
   well as the first cache line of each of the next four packets' mbufs and
   clusters
 - reduce max copy size to 63 bytes
 - convert rx soft descriptors from array of structures to a structure of arrays
 - update copyrights

Submitted by: Matt Macy <mmacy@nextbsd.org>

7 years agoDon't drop a reference to the TOE PCB in undo_offload_socket().
jhb [Fri, 27 Jan 2017 23:03:28 +0000 (23:03 +0000)]
Don't drop a reference to the TOE PCB in undo_offload_socket().

undo_offload_socket() is only called by t4_connect() during a connection
setup failure, but t4_connect() still owns the TOE PCB and frees ita
after undo_offload_socket() returns.  Release a reference in
undo_offload_socket() resulted in a double-free which panicked when
t4_connect() performed the second free.  The reference release was
added to undo_offload_socket() incorrectly in r299210.

MFC after: 1 week
Sponsored by: Chelsio Communications

7 years agoReplace customized busmaster code with standardized setup call.
sbruno [Fri, 27 Jan 2017 22:30:27 +0000 (22:30 +0000)]
Replace customized busmaster code with standardized setup call.

Reported by: jhb

7 years agohwpmc: annotate pmc_hook and pmc_intr as __read_mostly
mjg [Fri, 27 Jan 2017 22:14:42 +0000 (22:14 +0000)]
hwpmc: annotate pmc_hook and pmc_intr as __read_mostly

MFC after: 1 month

7 years agohwpmc: partially depessimize mmap handling if the module is not loaded
mjg [Fri, 27 Jan 2017 22:13:15 +0000 (22:13 +0000)]
hwpmc: partially depessimize mmap handling if the module is not loaded

In particular this means the pmc sx lock is no longer taken when an
executable mapping succeeds.

MFC after: 1 week

7 years agoSquash a couple of uses of xpt_print_path()
scottl [Fri, 27 Jan 2017 21:55:47 +0000 (21:55 +0000)]
Squash a couple of uses of xpt_print_path()

Sponsored by: Netflix

7 years agoadd octeon+ as an alias for octeon in GCC & binutils
emaste [Fri, 27 Jan 2017 21:31:32 +0000 (21:31 +0000)]
add octeon+ as an alias for octeon in GCC & binutils

In r208737 jmallett@ added support for the "mips64r2" architecture
and "octeon" CPU, and the saa/saad instructions.

Upstream binutils also added the "octeon+" CPU, and the saa/saad
instructions are only available in octeon+, not octeon.  Since our
base system tool chain already accepts saa/saad with -march=octeon,
just allow octeon+ as an alias.

This allows the use of octeon+ in kernel config files, for use with both
external tool chain and in-tree GCC/binutils.

PR: 216516
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 years agoRename LLD_AS_LD to LLD_IS_LD, for consistency with CLANG_IS_CC
emaste [Fri, 27 Jan 2017 21:18:23 +0000 (21:18 +0000)]
Rename LLD_AS_LD to LLD_IS_LD, for consistency with CLANG_IS_CC

An additional case missed in r312855

7 years agoFix an off-by-one in an assertion on fasttrap tracepoint sizes.
markj [Fri, 27 Jan 2017 17:58:41 +0000 (17:58 +0000)]
Fix an off-by-one in an assertion on fasttrap tracepoint sizes.

FASTTRAP_MAX_INSTR_SIZE is the largest valid value of a tracepoint, so
correct the assertion accordingly. This limit was hit with a 15-byte NOP.

Reported by: bdrewery
MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoSprinkle __read_mostly on backoff and lock profiling code.
mjg [Fri, 27 Jan 2017 15:03:51 +0000 (15:03 +0000)]
Sprinkle __read_mostly on backoff and lock profiling code.

MFC after: 1 month

7 years agocache: annotate with __read_mostly and __exclusive_cache_line
mjg [Fri, 27 Jan 2017 14:56:36 +0000 (14:56 +0000)]
cache: annotate with __read_mostly and __exclusive_cache_line

MFC after: 1 month

7 years agoIntroduce __read_mostly and __exclusive_cache_line macros.
mjg [Fri, 27 Jan 2017 14:53:09 +0000 (14:53 +0000)]
Introduce __read_mostly and __exclusive_cache_line macros.

The intended use is to annotate frequently used globals which either rarely
change (and thus can be grouped in the same cacheline) or are an atomic counter
(which means it may benefit from being the only variable in the cacheline).

Linker script support is provided only for amd64. Architectures without it risk
having other variables put in, i.e. as if they were not annotated. This is
harmless from correctness point of view.

Reviewed by: bde (previous version)
MFC after: 1 month

7 years agoHide unneeded message under bootverbose.
akiyama [Fri, 27 Jan 2017 14:17:48 +0000 (14:17 +0000)]
Hide unneeded message under bootverbose.

MFC after: 1 week

7 years agoFix lookup of original destination address when using a redirect rule.
cy [Fri, 27 Jan 2017 14:12:34 +0000 (14:12 +0000)]
Fix lookup of original destination address when using a redirect rule.
Transparent proxying, e.g. to squid, is an example of this.

Obtained from: NetBSD ip_nat.c r1.17, ip_nat6.c r1.10
MFC after: 6 weeks

7 years agosfxge(4): compact the first hot part of RxQ control
arybchik [Fri, 27 Jan 2017 11:59:02 +0000 (11:59 +0000)]
sfxge(4): compact the first hot part of RxQ control

buf_base_id is used on RxQ control operations only and not used on
datapath.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

7 years agosfxge(4): fix RxQ structure layout vs usage on datapath
arybchik [Fri, 27 Jan 2017 11:57:19 +0000 (11:57 +0000)]
sfxge(4): fix RxQ structure layout vs usage on datapath

Recent changes in the pseudo header accessor prototypes start to
use common code RxQ handle on datapath. The handle was located
at the end of the structure with members not used on datapath.

Reviewed by:    philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D9359

7 years agosfxge(4): fix invalid VLAN tagging after stop/start
arybchik [Fri, 27 Jan 2017 11:56:18 +0000 (11:56 +0000)]
sfxge(4): fix invalid VLAN tagging after stop/start

TxQ is destroyed on stop and last used tag should be reset to default 0
on the next start.

Reviewed by:    philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D9358

7 years agoUse the busdma API to allocate all DMA-able memory.
hselasky [Fri, 27 Jan 2017 11:46:55 +0000 (11:46 +0000)]
Use the busdma API to allocate all DMA-able memory.

The MLX5 driver has four different types of DMA allocations which are
now allocated using busdma:

1) The 4K firmware DMA-able blocks. One busdma object per 4K allocation.
2) Data for firmware commands use the 4K firmware blocks split into four 1K blocks.
3) The 4K firmware blocks are also used for doorbell pages.
4) The RQ-, SQ- and CQ- DMA rings. One busdma object per allocation.

After this patch the mlx5en driver can be used with DMAR enabled in
the FreeBSD kernel.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoAdd support for device surprise removal and other PCI errors.
hselasky [Fri, 27 Jan 2017 11:29:33 +0000 (11:29 +0000)]
Add support for device surprise removal and other PCI errors.

- When device disappears from PCI indicate error device state and:
  1) Trigger command completion for all pending commands
  2) Prevent new commands from executing and return:
     - success for modify and remove/cleanup commands
     - failure for create/query commands
  3) When reclaiming pages for a device in error state don't ask FW to
     return all given pages, just release the allocated memory

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoWait for all VFs pages to be reclaimed before closing EQ pages.
hselasky [Fri, 27 Jan 2017 11:19:06 +0000 (11:19 +0000)]
Wait for all VFs pages to be reclaimed before closing EQ pages.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoRename struct fw_page into struct mlx5_fw_page as a preparation step
hselasky [Fri, 27 Jan 2017 11:03:58 +0000 (11:03 +0000)]
Rename struct fw_page into struct mlx5_fw_page as a preparation step
for adding busdma support.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix command completion with callback scenario.
hselasky [Fri, 27 Jan 2017 10:56:03 +0000 (10:56 +0000)]
Fix command completion with callback scenario.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoMinor code refactor as a preparation step for suprise removal of CX-4
hselasky [Fri, 27 Jan 2017 10:47:53 +0000 (10:47 +0000)]
Minor code refactor as a preparation step for suprise removal of CX-4
PCI device(s), changes:
- alloc_entry() now clears bit for page slot entry aswell
- update of cmd->ent_arr[] is now under cmd->alloc_lock
- complete command if alloc_entry() fails

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoUse ffs() to scan for first bit instead of using a for() loop.
hselasky [Fri, 27 Jan 2017 10:36:49 +0000 (10:36 +0000)]
Use ffs() to scan for first bit instead of using a for() loop.
Minor code refactor while at it.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoMake fw_pages statistics counter 64-bit to avoid overflow.
hselasky [Fri, 27 Jan 2017 10:20:38 +0000 (10:20 +0000)]
Make fw_pages statistics counter 64-bit to avoid overflow.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoAdd support for reading advanced diagnostic counters.
hselasky [Fri, 27 Jan 2017 10:03:50 +0000 (10:03 +0000)]
Add support for reading advanced diagnostic counters.

By default reading the diagnostic counters is disabled. The firmware
decides which counters are supported and only those supported show up
in the dev.mce.X.diagnostics sysctl tree.

To enable reading of diagnostic counters set one or more of the
following sysctls to one:

dev.mce.X.conf.diag_general_enable=1
dev.mce.X.conf.diag_pci_enable=1

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agosfxge(4): cleanup: remove unused soft context struct member rxq_cache
arybchik [Fri, 27 Jan 2017 08:54:33 +0000 (08:54 +0000)]
sfxge(4): cleanup: remove unused soft context struct member rxq_cache

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

7 years agosfxge(4): cleanup: remvoe trailing tab
arybchik [Fri, 27 Jan 2017 08:53:11 +0000 (08:53 +0000)]
sfxge(4): cleanup: remvoe trailing tab

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

7 years agosfxge(4): cleanup: remove unused txq_index TxQ control structure member
arybchik [Fri, 27 Jan 2017 08:51:48 +0000 (08:51 +0000)]
sfxge(4): cleanup: remove unused txq_index TxQ control structure member

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

7 years agoEnforce reading the consumer and producer counters once to ensure
hselasky [Fri, 27 Jan 2017 08:32:50 +0000 (08:32 +0000)]
Enforce reading the consumer and producer counters once to ensure
consistent return values from the mlx5e_sq_has_room_for()
function. The two counters are incremented by different threads under
different locks.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoRemove nested #ifdef that can't possibly be false.
imp [Fri, 27 Jan 2017 08:30:43 +0000 (08:30 +0000)]
Remove nested #ifdef that can't possibly be false.

7 years agoConfigure the timer capture pin to input mode in the timer control
ian [Fri, 27 Jan 2017 04:08:24 +0000 (04:08 +0000)]
Configure the timer capture pin to input mode in the timer control
register, in addition to configuring it as input with the pinmux driver.

There was a control register bit commented as "no desc in datasheet".  A
later revision of the manual reveals the bit to be an input/output control
for the timer pin.  In addition to configuring capture or pulse mode, you
apparently have to separately configure the pin direction in the timer
control register.

Before this change, the timer block was apparently driving a signal onto a
pad configured by pinmux as input.  Capture mode still accidentally worked
for me during testing because I was using a very strong signal source that
just out-muscled the weaker drive from the misconfigured pin.

7 years agoUse cross-NM (XNM) in compat32 build
emaste [Fri, 27 Jan 2017 03:43:18 +0000 (03:43 +0000)]
Use cross-NM (XNM) in compat32 build

An attempt to build mips64 using external toolchain failed as it tried
to use the host amd64 nm.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 years agoRename LLD_AS_LD to LLD_IS_LD, for consistency with CLANG_IS_CC
emaste [Fri, 27 Jan 2017 01:59:12 +0000 (01:59 +0000)]
Rename LLD_AS_LD to LLD_IS_LD, for consistency with CLANG_IS_CC

Reported by: Dan McGregor <dan.mcgregor usask.ca>

7 years ago[net80211] prepare configuration checks for VHT, fragment-offload and seqno-offload.
adrian [Fri, 27 Jan 2017 01:24:24 +0000 (01:24 +0000)]
[net80211] prepare configuration checks for VHT, fragment-offload and seqno-offload.

* allocate an ext bit for fragment offload.  Some NICs (like the ath10k
  hardware in native wifi or 802.3 mode) support doing packet fragmentation
  in firmware/hardware, so we don't have to do it here.

* allocate an ext bit for VHT and start using it.

7 years ago[ath] fix "doing stuff before wakeup" warning; add comments for ACK/CTS handling...
adrian [Fri, 27 Jan 2017 01:17:00 +0000 (01:17 +0000)]
[ath] fix "doing stuff before wakeup" warning; add comments for ACK/CTS handling during DFS/PASSIVE channels

* Although the hardware is awake, the power state handling doesn't think so.
  So just explicitly wake it up early in setup so ath_hal calls don't complain.

* We shouldn't be transmitting or ACKing frames during DFS CAC or on passive
  channels before we hear a beacon.  So, start laying down comments in the
  places where this work has to be done.

Note:

* The main bit missing from finishing this particular bit of work is a state
  call to transition a VAP from passive to non-passive when a beacon is heard.
  CAC is easy, it's an interface state.  So, I'll go and add a method to control
  that soon.

7 years agoFix libcam build. It was broken with r312827.
jkim [Fri, 27 Jan 2017 00:17:07 +0000 (00:17 +0000)]
Fix libcam build.  It was broken with r312827.

7 years agoRemove 'options NO_SWAPPING' from ERL configuration file
lidl [Thu, 26 Jan 2017 20:45:04 +0000 (20:45 +0000)]
Remove 'options NO_SWAPPING' from ERL configuration file

7 years agoPull in r278160 from upstream llvm trunk (by Wei Mi):
dim [Thu, 26 Jan 2017 20:39:43 +0000 (20:39 +0000)]
Pull in r278160 from upstream llvm trunk (by Wei Mi):

  Recommit "Use ValueOffsetPair to enhance value reuse during SCEV
  expansion".

  The fix for PR28705 will be committed consecutively.

  In D12090, the ExprValueMap was added to reuse existing value during
  SCEV expansion. However, const folding and sext/zext distribution can
  make the reuse still difficult.

  A simplified case is: suppose we know S1 expands to V1 in
  ExprValueMap, and
    S1 = S2 + C_a
    S3 = S2 + C_b
  where C_a and C_b are different SCEVConstants. Then we'd like to
  expand S3 as V1 - C_a + C_b instead of expanding S2 literally. It is
  helpful when S2 is a complex SCEV expr and S2 has no entry in
  ExprValueMap, which is usually caused by the fact that S3 is
  generated from S1 after const folding.

  In order to do that, we represent ExprValueMap as a mapping from SCEV
  to ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a}
  into the ExprValueMap when we create SCEV for V1. When S3 is
  expanded, it will first expand S2 to V1 - C_a because of S2->{V1,
  C_a} in the map, then expand S3 to V1 - C_a + C_b.

  Differential Revision: https://reviews.llvm.org/D21313

Pull in r278161 from upstream llvm trunk (by Wei Mi):

  Fix the runtime error caused by "Use ValueOffsetPair to enhance value
  reuse during SCEV expansion".

  The patch is to fix the bug in PR28705. It was caused by setting
  wrong return value for SCEVExpander::findExistingExpansion. The
  return values of findExistingExpansion have different meanings when
  the function is used in different ways so it is easy to make mistake.
  The fix creates two new interfaces to replace
  SCEVExpander::findExistingExpansion, and specifies where each
  interface is expected to be used.

  Differential Revision: https://reviews.llvm.org/D22942

Pull in r281439 from upstream llvm trunk (by Wei Mi):

  Create a getelementptr instead of sub expr for ValueOffsetPair if the
  value is a pointer.

  This patch is to fix PR30213. When expanding an expr based on
  ValueOffsetPair, if the value is of pointer type, we can only create
  a getelementptr instead of sub expr.

  Differential Revision: https://reviews.llvm.org/D24088

This should fix assertion failures when building OpenCV >= 3.1, and also
allow building lang/spidermonkey24 without any further assertions.

PR: 215649
MFC after: 1 week

7 years agoRevert r312765 for now, since it causes assertions when building
dim [Thu, 26 Jan 2017 20:18:28 +0000 (20:18 +0000)]
Revert r312765 for now, since it causes assertions when building
lang/spidermonkey24.

Reported by: antoine
PR: 215649

7 years agoFix a development mis-merge from r312827
scottl [Thu, 26 Jan 2017 20:18:03 +0000 (20:18 +0000)]
Fix a development mis-merge from r312827

Sponsored by: Netflix

7 years agoRefactor xpt_print_path, xpt_print, and xpt_path_string. Implement
scottl [Thu, 26 Jan 2017 20:08:58 +0000 (20:08 +0000)]
Refactor xpt_print_path, xpt_print, and xpt_path_string.  Implement
all of them in terms of an sbuf-based back-end, xpt_path_sbuf.  This
unifies the implementation, but more importantly it stops the output
fropm being split between 4 or more invocations of printf.  The
multiple invocations cause interleaving of the messages on the
console during boot, making the output of disk discovery often
unintelligible.  This change helps a lot, but more work is needed.

Reviewed by: ken, mav
Sponsored by: Netflix

7 years agoMerge OpenSSL 1.0.2k.
jkim [Thu, 26 Jan 2017 19:10:29 +0000 (19:10 +0000)]
Merge OpenSSL 1.0.2k.

7 years agoEnable modules in the MIPS ERL kernel config
emaste [Thu, 26 Jan 2017 18:18:35 +0000 (18:18 +0000)]
Enable modules in the MIPS ERL kernel config

As reported by cperciva[1], modules are beneficial for typical
Edgerouter Lite use cases.

[1] http://www.daemonology.net/blog/2016-01-10-FreeBSD-EdgeRouter-Lite.html

7 years agomips: exclude modules that fail to build
emaste [Thu, 26 Jan 2017 18:05:31 +0000 (18:05 +0000)]
mips: exclude modules that fail to build

7 years agoDisconnect netfpga10g module from the build
emaste [Thu, 26 Jan 2017 17:59:54 +0000 (17:59 +0000)]
Disconnect netfpga10g module from the build

It only builds with the non-default DEVICE_POLLING option.

Approved by: bz

7 years agoCorrect grammar.
obrien [Thu, 26 Jan 2017 16:36:12 +0000 (16:36 +0000)]
Correct grammar.

7 years agoMinor style annoyance.
sbruno [Thu, 26 Jan 2017 13:50:09 +0000 (13:50 +0000)]
Minor style annoyance.

Submitted by: bde

7 years agoA few more style bugs lying around in here.
sbruno [Thu, 26 Jan 2017 13:48:45 +0000 (13:48 +0000)]
A few more style bugs lying around in here.

Submitted by: bde

7 years agoShoot a couple of style bugs down in the macro declarations.
sbruno [Thu, 26 Jan 2017 13:46:47 +0000 (13:46 +0000)]
Shoot a couple of style bugs down in the macro declarations.

Submitted by: bde

7 years agoMake fdt_pm_mask_table internal to the Marvell code, it's unued anywhere
andrew [Thu, 26 Jan 2017 13:04:14 +0000 (13:04 +0000)]
Make fdt_pm_mask_table internal to the Marvell code, it's unued anywhere
else.

Sponsored by: ABT Systems Ltd

7 years agoAdd dummy functions for Marvell SoC's not equipped with AHCI
wma [Thu, 26 Jan 2017 11:14:23 +0000 (11:14 +0000)]
Add dummy functions for Marvell SoC's not equipped with AHCI

Commit r312747 ("Setup decoding windows for ARMADA38X") resulted
in build failing for Marvell platforms, which don't have AHCI controller.
This patch provides a fix by adding dummy functions for such cases.

On the occasion rename register dump routine to decode_win_ahci_dump,
in order to avoid confusion.

Submitted by:          Marcin Wojtas <mw@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield

7 years agoUpdate the mentor/mentee relationships to add myself.
rezny [Thu, 26 Jan 2017 07:07:09 +0000 (07:07 +0000)]
Update the mentor/mentee relationships to add myself.

Reviewed by: swills
Approved by: swills (mentor)
Differential Revision: https://reviews.freebsd.org/D9343

7 years agoFurther cleanup of per-CPU armv6 pmap data:
jah [Thu, 26 Jan 2017 05:23:33 +0000 (05:23 +0000)]
Further cleanup of per-CPU armv6 pmap data:

- Replace pcpu_find(curcpu) with get_pcpu(), which is much
  more direct.

- Remove armv4 pcpu fields which I added in r286296 but never
  needed to use.

- armv6 pc_qmap_addr was leftover from the old armv6 pmap
  implementation.  Rename it and put it to use in the new one.

Noted by: skra
Reviewed by: skra
MFC after:  1 week
Differential Revision: https://reviews.freebsd.org/D9312

7 years agoUse normal KNF cuddling of elses.
cy [Thu, 26 Jan 2017 04:51:48 +0000 (04:51 +0000)]
Use normal KNF cuddling of elses.

Reported by: bde
MFC after: 2 weeks
X-MFC with: r312777

7 years agoCurrently the fragment info is placed at the top of the linked list
cy [Thu, 26 Jan 2017 01:24:05 +0000 (01:24 +0000)]
Currently the fragment info is placed at the top of the linked list
under a shared read lock. This patch attempts to upgrade the lock to
an exclusive write lock. If the exclusive write lock fails to be
obtained, the current fragment is not placed at the head of the list.

This portion of the patch was inspired by NetBSD ip_frag.c r1.4 (which
effectively removed the section of code that performed the reordering).

The patch to sys/contrib/ipfilter/netinet/ip_compat.h adds the
MUTEX_TRY_UPGRADE macro to support the patch to ip_frag.c.

The patch to contrib/ipfilter/lib/rwlock_emul.c supports this patch
by emulating the mutex in userspace when exercised by ipftest(1).

Inspired by: NetBSD ip_frag.c r1.4
MFC after: 1 month

7 years agoImplement RSS queue tagging for em(4) class devices from a copy and massage
sbruno [Wed, 25 Jan 2017 23:12:03 +0000 (23:12 +0000)]
Implement RSS queue tagging for em(4) class devices from a copy and massage
of functions from igb(4).  This enables 2 queue routing on 82574L class
devices again.

7 years agoBring the ctl headers a bit closer to style(9). No functional changes.
trasz [Wed, 25 Jan 2017 22:52:57 +0000 (22:52 +0000)]
Bring the ctl headers a bit closer to style(9).  No functional changes.

7 years agoFor non-listening AF_UNIX sockets return error code EOPNOTSUPP to match
glebius [Wed, 25 Jan 2017 22:26:45 +0000 (22:26 +0000)]
For non-listening AF_UNIX sockets return error code EOPNOTSUPP to match
documentation and SUS.

7 years agobridge: Release the bridge lock when calling bridge_set_ifcap()
kp [Wed, 25 Jan 2017 21:25:26 +0000 (21:25 +0000)]
bridge: Release the bridge lock when calling bridge_set_ifcap()

This calls ioctl() handlers for the different interfaces in the bridge.
These handlers expect to get called in an ioctl context where it's safe
for them to sleep. We may not sleep with the bridge lock held.

However, we still need to protect the interface list, to ensure it
doesn't get changed while we iterate over it.
Use BRIDGE_XLOCK(), which prevents bridge members from being removed.
Adding bridge members is safe, because it uses LIST_INSERT_HEAD().

This caused panics when adding xen interfaces to a bridge.

PR: 216304
Reviewed by: ae
MFC after: 1 week
Sponsored by: RootBSD
Differential Revision: https://reviews.freebsd.org/D9290

7 years agoRemove extraneous blank line.
cy [Wed, 25 Jan 2017 20:59:23 +0000 (20:59 +0000)]
Remove extraneous blank line.

MFC after: 2 weeks
X-MFC with: r312777

7 years agostrings: avoid unnecessary trip through handle_file for stdin
emaste [Wed, 25 Jan 2017 20:59:06 +0000 (20:59 +0000)]
strings: avoid unnecessary trip through handle_file for stdin

Sponsored by: The FreeBSD Foundation

7 years agoIssue an error message when an incorrect flush argument is
cy [Wed, 25 Jan 2017 20:41:16 +0000 (20:41 +0000)]
Issue an error message when an incorrect flush argument is
encountered.`

MFC after: 2 weeks

7 years agoANSIfy kern_ntptime.c
emaste [Wed, 25 Jan 2017 20:22:32 +0000 (20:22 +0000)]
ANSIfy kern_ntptime.c

7 years agolibthr: coalesce repeated #if blocks
emaste [Wed, 25 Jan 2017 20:19:48 +0000 (20:19 +0000)]
libthr: coalesce repeated #if blocks

7 years agoAfter the in_control() changes in r257692, an existing address is
loos [Wed, 25 Jan 2017 19:04:08 +0000 (19:04 +0000)]
After the in_control() changes in r257692, an existing address is
(intentionally) deleted first and then completely added again (so all the
events, announces and hooks are given a chance to run).

This cause an issue with CARP where the existing CARP data structure is
removed together with the last address for a given VHID, which will cause
a subsequent fail when the address is later re-added.

This change fixes this issue by adding a new flag to keep the CARP data
structure when an address is not being removed.

There was an additional issue with IPv6 CARP addresses, where the CARP data
structure would never be removed after a change and lead to VHIDs which
cannot be destroyed.

Reviewed by: glebius
Obtained from: pfSense
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (Netgate)

7 years agoPartially workaround ASMedia HBA error recovery.
mav [Wed, 25 Jan 2017 18:16:17 +0000 (18:16 +0000)]
Partially workaround ASMedia HBA error recovery.

Taking closer look on my ASM1062 I found that it has bunch of issues around
error recovery: reported wrong CCS, failed commands reported as completed,
READ LOG EXT times out after NCQ error.  This patch workarounds first two
problems, that were making ATAPI devices close to unusable on these HBAs.

MFC after: 2 weeks

7 years agoPull in r276136 from upstream llvm trunk (by Wei Mi):
dim [Wed, 25 Jan 2017 17:59:22 +0000 (17:59 +0000)]
Pull in r276136 from upstream llvm trunk (by Wei Mi):

  Use ValueOffsetPair to enhance value reuse during SCEV expansion.

  In D12090, the ExprValueMap was added to reuse existing value during
  SCEV expansion. However, const folding and sext/zext distribution can
  make the reuse still difficult.

  A simplified case is: suppose we know S1 expands to V1 in
  ExprValueMap, and
    S1 = S2 + C_a
    S3 = S2 + C_b
  where C_a and C_b are different SCEVConstants. Then we'd like to
  expand S3 as V1 - C_a + C_b instead of expanding S2 literally. It is
  helpful when S2 is a complex SCEV expr and S2 has no entry in
  ExprValueMap, which is usually caused by the fact that S3 is
  generated from S1 after const folding.

  In order to do that, we represent ExprValueMap as a mapping from SCEV
  to ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a}
  into the ExprValueMap when we create SCEV for V1. When S3 is
  expanded, it will first expand S2 to V1 - C_a because of S2->{V1,
  C_a} in the map, then expand S3 to V1 - C_a + C_b.

  Differential Revision: https://reviews.llvm.org/D21313

This should fix assertion failures when building OpenCV >= 3.1.

PR: 215649
MFC after: 3 days

7 years agoPull the R_AARCH64_TLSDESC code out into a common function and use them in
andrew [Wed, 25 Jan 2017 17:35:11 +0000 (17:35 +0000)]
Pull the R_AARCH64_TLSDESC code out into a common function and use them in
both the plt and non-plt case.

This fixes an issue where libraries built with LLD can fail with
"Unhandled relocation 1031"

PR: 214971
Obtained from: 1 week
Sponsored by: DARPA, AFRL

7 years agoFix initialization of "p" after r312658.
markj [Wed, 25 Jan 2017 16:35:57 +0000 (16:35 +0000)]
Fix initialization of "p" after r312658.

CID: 1369410

7 years agoReplace overlooked smp_started checks and variable use in a print
sbruno [Wed, 25 Jan 2017 15:54:44 +0000 (15:54 +0000)]
Replace overlooked smp_started checks and variable use in a print
with the now used tqg_smp_started.

Submitted by: bde

7 years agoResolve a non-fatal syntax warning left in by a trailing ;
sbruno [Wed, 25 Jan 2017 15:52:03 +0000 (15:52 +0000)]
Resolve a non-fatal syntax warning left in by a trailing ;

Submitted by: bde

7 years agoAdd sys/capability.h deprecation warning
emaste [Wed, 25 Jan 2017 15:42:29 +0000 (15:42 +0000)]
Add sys/capability.h deprecation warning

In r263232 sys/capability.h was renamed to sys/capsicum.h, to avoid
conflicts with a capability.h header found on other operating systems.

Sponsored by: The FreeBSD Foundation

7 years agoAdd error checking to the pci_find_cap(, PCIY_MSIX,) call that is returns
sbruno [Wed, 25 Jan 2017 14:37:05 +0000 (14:37 +0000)]
Add error checking to the pci_find_cap(, PCIY_MSIX,) call that is returns
success and a good value.  Only then try to use it and set the MSIX_ENABLE
bit.

With the current em(4) driver we have observed failures in this case in a
specific environment when pci_find_cap() would not return the assumed
value, which meant we ended up writing to PCI register 2 (PCI_DEVICE_ID)
which is read-only.

PR: 216456
Submitted by: bz

7 years agoExtend AHCI_Q_BIT_STRING after adding new quirk for soft
wma [Wed, 25 Jan 2017 12:18:21 +0000 (12:18 +0000)]
Extend AHCI_Q_BIT_STRING after adding new quirk for soft
 reset delay

Adding new quirk (AHCI_Q_MRVL_SR_DEL) requires according extention
of AHCI_Q_BIT_STRING.

Submitted by:  Marcin Wojtas <mw@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Stormshield
Reviewed by:   wma

7 years agoAdd Timeout and Protect mode page description from MMC-6.
mav [Wed, 25 Jan 2017 11:47:16 +0000 (11:47 +0000)]
Add Timeout and Protect mode page description from MMC-6.

MFC after: 2 weeks

7 years agoAdd support for AHCI on ARMADA38X
wma [Wed, 25 Jan 2017 10:34:37 +0000 (10:34 +0000)]
Add support for AHCI on ARMADA38X

This file provides support for AHCI mode on Armada38x
and adds new optional AHCI device to arm/mv/files.mv.

Submitted by:          Konrad Adamczyk <ka@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D9222

7 years agoEnable optional soft reset in AHCI
wma [Wed, 25 Jan 2017 10:32:57 +0000 (10:32 +0000)]
Enable optional soft reset in AHCI

It occurred that some Marvell integrated controllers
require additional time after soft reset to work properly.
Introduce new quirk (AHCI_Q_MRVL_SR_DEL), that enable
such operation.

Submitted by:          Konrad Adamczyk <ka@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
Reviewed by:           mav
Differential revision: https://reviews.freebsd.org/D9221

7 years agoSetup decoding windows for ARMADA38X
wma [Wed, 25 Jan 2017 10:31:16 +0000 (10:31 +0000)]
Setup decoding windows for ARMADA38X

It is necesarry to open memory windows on internal bus for
AHCI driver to work correctly.

Submitted by:          Konrad Adamczyk <ka@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D9220

7 years agoFix node detection for MBUS windows configuration
wma [Wed, 25 Jan 2017 10:29:46 +0000 (10:29 +0000)]
Fix node detection for MBUS windows configuration

Configure decoding windows only for devices with
enabled nodes in FDT.

Submitted by:          Konrad Adamczyk <ka@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D9219

7 years agoExpand OpenFirmware API with ofw_bus_node_status_okay
wma [Wed, 25 Jan 2017 10:28:21 +0000 (10:28 +0000)]
Expand OpenFirmware API with ofw_bus_node_status_okay
 method

Method could be used before we can access device_t structure.
As per simple phandle_t handle we can access FDT to check
if specified node has been enabled.
It will be used in Marvell's common configuration code.

Submitted by:          Konrad Adamczyk <ka@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
Reviewed by:           zbb, meloun-miracle-cz
Differential revision: https://reviews.freebsd.org/D9218

7 years agoFix SHA256 usage on older CESA versions
wma [Wed, 25 Jan 2017 10:25:59 +0000 (10:25 +0000)]
Fix SHA256 usage on older CESA versions

Adding SHA256 support to Marvell crypto driver resulted in regression
for older SoC's, not capable of handling this mode in hardware.

Submitted by:          Emeric Poupon <emeric.poupon@stormshield.eu>
Obtained from:         Stormshield
Sponsored by:          Stormshield
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D9215

7 years agoUse SoC ID - based detection in CESA
wma [Wed, 25 Jan 2017 10:22:07 +0000 (10:22 +0000)]
Use SoC ID - based detection in CESA

This commit introduces following changes in order to get rid of
ifdef's from all around the driver.
* Introduce sc_soc_id field in cesa_softc structure - this value is
  obtained in cesa_attach() anyway, so make use of it.
* Replace ifdefs with SoC ID checks.
* Perform PM control status only for relevant SoC's.

Submitted by:          Marcin Wojtas <mw@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D9247

7 years agoAdd misssing Armada38x ID's in CESA attach
wma [Wed, 25 Jan 2017 06:11:07 +0000 (06:11 +0000)]
Add misssing Armada38x ID's in CESA attach

Marvell Armada 38x is supported in 3 variants,
so take all into consideration in crypto driver
attach routine.

Submitted by:          Marcin Wojtas <mw@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D9248

7 years agoIntroduce armada_thermal driver for Armada family platforms
wma [Wed, 25 Jan 2017 06:08:10 +0000 (06:08 +0000)]
Introduce armada_thermal driver for Armada family platforms

* Currently supports only Armada38X family but other Marvell SoC's
  can be added if needed.
* Provides temperature is C deg.
* To print the temperature one can use:
  sysctl dev.armada_thermal.0.temperature

Submitted by:          Zbigniew Bodek <zbb@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Stormshield
Differential revision: https://reviews.freebsd.org/D9217

7 years agoPreening pass to fix up trailing white space and other minor style(9)
imp [Wed, 25 Jan 2017 02:05:08 +0000 (02:05 +0000)]
Preening pass to fix up trailing white space and other minor style(9)
nits (though I'm sure others remain).

MFC After: 3 days

7 years agoAdded support for if_transmit and if_qflush
davidcs [Wed, 25 Jan 2017 00:23:38 +0000 (00:23 +0000)]
Added support for if_transmit and if_qflush
Removed if_start
updated version to 3.10.33

MFC after:5 days

7 years ago[ath_hal] note that the CCA configuration setting may be chip-dependent.
adrian [Tue, 24 Jan 2017 22:52:09 +0000 (22:52 +0000)]
[ath_hal] note that the CCA configuration setting may be chip-dependent.

I bet it isn't, but who knows - this is making assumptions about the
layout of AR_DIAG.

7 years agoimgact_elf: refactor et_dyn_addr calculation
emaste [Tue, 24 Jan 2017 22:46:43 +0000 (22:46 +0000)]
imgact_elf: refactor et_dyn_addr calculation

This simplifies the logic somewhat. It is extracted from the change in
review in D5603.

Differential Revision: https://reviews.freebsd.org/D9321

7 years agohwpmc: partially depessimize munmap handling if the module is not loaded
mjg [Tue, 24 Jan 2017 22:00:16 +0000 (22:00 +0000)]
hwpmc: partially depessimize munmap handling if the module is not loaded

HWPMC_HOOKS is enabled in GENERIC and triggers some work avoidable in the
common (module not loaded) case.

In particular this avoids permission checks + lock downgrade
singlethreaded and in cases were an executable mapping is found the pmc
sx lock is no longer bounced.

Note this is a band aid.

MFC after: 1 week