Commit Graph

219875 Commits

Author SHA1 Message Date
Jason A. Harmening
fc100b8af2 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
2017-01-26 05:23:33 +00:00
Cy Schubert
520f089ad0 Use normal KNF cuddling of elses.
Reported by:	bde
MFC after:	2 weeks
X-MFC with:	r312777
2017-01-26 04:51:48 +00:00
Cy Schubert
971fa117c0 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
2017-01-26 01:24:05 +00:00
Sean Bruno
cbf1505df9 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.
2017-01-25 23:12:03 +00:00
Edward Tomasz Napierala
5ab1cf33f7 Bring the ctl headers a bit closer to style(9). No functional changes. 2017-01-25 22:52:57 +00:00
Gleb Smirnoff
beb4b31200 For non-listening AF_UNIX sockets return error code EOPNOTSUPP to match
documentation and SUS.
2017-01-25 22:26:45 +00:00
Kristof Provost
ab5cda71df 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
2017-01-25 21:25:26 +00:00
Cy Schubert
26594bd1ee Remove extraneous blank line.
MFC after:	2 weeks
X-MFC with:	r312777
2017-01-25 20:59:23 +00:00
Ed Maste
080b710889 strings: avoid unnecessary trip through handle_file for stdin
Sponsored by:	The FreeBSD Foundation
2017-01-25 20:59:06 +00:00
Cy Schubert
d780a32bc5 Issue an error message when an incorrect flush argument is
encountered.`

MFC after:	2 weeks
2017-01-25 20:41:16 +00:00
Ed Maste
f27ac8e297 ANSIfy kern_ntptime.c 2017-01-25 20:22:32 +00:00
Ed Maste
2d0e733b3a libthr: coalesce repeated #if blocks 2017-01-25 20:19:48 +00:00
Luiz Otavio O Souza
338e227ac0 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)
2017-01-25 19:04:08 +00:00
Alexander Motin
72dc1ba904 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
2017-01-25 18:16:17 +00:00
Dimitry Andric
1324fa835c 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
2017-01-25 17:59:22 +00:00
Andrew Turner
02dbdb1677 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
2017-01-25 17:35:11 +00:00
Mark Johnston
61ef24a5a3 Fix initialization of "p" after r312658.
CID:	1369410
2017-01-25 16:35:57 +00:00
Sean Bruno
06bb7c507a Replace overlooked smp_started checks and variable use in a print
with the now used tqg_smp_started.

Submitted by:	bde
2017-01-25 15:54:44 +00:00
Sean Bruno
0b27526201 Resolve a non-fatal syntax warning left in by a trailing ;
Submitted by:	bde
2017-01-25 15:52:03 +00:00
Ed Maste
ef4fe1d90c 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
2017-01-25 15:42:29 +00:00
Sean Bruno
f7ae9a84e3 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
2017-01-25 14:37:05 +00:00
Wojciech Macek
f09f75fec6 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
2017-01-25 12:18:21 +00:00
Alexander Motin
627c3a8d38 Add Timeout and Protect mode page description from MMC-6.
MFC after:	2 weeks
2017-01-25 11:47:16 +00:00
Wojciech Macek
5f55eefb91 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
2017-01-25 10:34:37 +00:00
Wojciech Macek
a569f640e3 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
2017-01-25 10:32:57 +00:00
Wojciech Macek
ccd5b1b023 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
2017-01-25 10:31:16 +00:00
Wojciech Macek
228042ce94 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
2017-01-25 10:29:46 +00:00
Wojciech Macek
e5e94d2de9 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
2017-01-25 10:28:21 +00:00
Wojciech Macek
c0f1c1f8ff 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
2017-01-25 10:25:59 +00:00
Wojciech Macek
81526b839f 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
2017-01-25 10:22:07 +00:00
Wojciech Macek
76b73da7ae 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
2017-01-25 06:11:07 +00:00
Wojciech Macek
23e463579f 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
2017-01-25 06:08:10 +00:00
Warner Losh
b20c0a07fb Preening pass to fix up trailing white space and other minor style(9)
nits (though I'm sure others remain).

MFC After: 3 days
2017-01-25 02:05:08 +00:00
David C Somayajulu
b89f227912 Added support for if_transmit and if_qflush
Removed if_start
updated version to 3.10.33

MFC after:5 days
2017-01-25 00:23:38 +00:00
Adrian Chadd
3557b26a4b [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.
2017-01-24 22:52:09 +00:00
Ed Maste
77ebe276ba 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
2017-01-24 22:46:43 +00:00
Mateusz Guzik
736ff8c396 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
2017-01-24 22:00:16 +00:00
Mateusz Guzik
543b2f425d proc: perform a lockless check in sys_issetugid
Discussed with:	kib
MFC after:	1 week
2017-01-24 21:48:57 +00:00
Michael Tuexen
bd60638c98 Fix a bug where the overhead of the I-DATA chunk was not considered.
MFC after: 1 week
2017-01-24 21:30:31 +00:00
Jilles Tjoelker
824c5192ba skel: Remove reference to deleted part in previous commit to this file.
Reported by:	Rodney W. Grimes
MFC after:	1 week
2017-01-24 21:07:13 +00:00
Andrew Turner
d15ac668f0 Fix the error value we write in cerror. __error returns an int *, however
we were writing a 64 bit value meaning the 32 bits after this would be
trashed.

MFC after:	3 days
Sponsored by:	DARPA, AFRL
2017-01-24 18:56:09 +00:00
Conrad Meyer
90a79ac576 Use time_t for intermediate values to avoid overflow in clock_ts_to_ct
Add additionally safety and overflow checks to clock_ts_to_ct and the
BCD routines while we're here.

Perform a safety check in sys_clock_settime() first to avoid easy local
root panic, without having to propagate an error value back through
dozens of APIs currently lacking error returns.

PR:		211960, 214300
Submitted by:	Justin McOmie <justin.mcomie at gmail.com>, kib@
Reported by:	Tim Newsham <tim.newsham at nccgroup.trust>
Reviewed by:	kib@
Sponsored by:	Dell EMC Isilon, FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D9279
2017-01-24 18:05:29 +00:00
Tijl Coosemans
86e01d5add Apply r210555 to 64 bit linux support:
The interpreter name should no longer be treated as a buffer that can be
overwritten.

PR:		216346
MFC after:	3 days
2017-01-24 16:13:59 +00:00
Sean Bruno
bd84f70044 iflib:
Add internal tracking of smp startup status to reliably figure out
     what methods are to be used to get gtaskqueue up and running.

e1000:
     Calculating this pointer gives undefined behaviour when (last == -1)
     (it is before the buffer).  The pointer is always followed.  Panics
     occurred when it points to an unmapped page.  Otherwise, the pointed-to
     garbage tends to not have the E1000_TXD_STAT_DD bit set in it, so in the
     broken case the loop was usually null and the function just returned, and
     this was acidentally correct.

Submitted by:	bde
Reported by:	Matt Macy <mmacy@nextbsd.org>
2017-01-24 16:05:42 +00:00
Sean Bruno
36fa5d5b64 Revert 312696 due to build tests. 2017-01-24 15:55:52 +00:00
Sean Bruno
562a3182f6 iflib:
Add internal tracking of smp startup status to reliably figure out
   what methods are to be used to get gtaskqueue up and running.

e1000:
   Calculating this pointer gives undefined behaviour when (last == -1)
   (it is before the buffer).  The pointer is always followed.  Panics
   occurred when it points to an unmapped page.  Otherwise, the pointed-to
   garbage tends to not have the E1000_TXD_STAT_DD bit set in it, so in the
   broken case the loop was usually null and the function just returned, and
   this was acidentally correct.

Submitted by:	bde
Reviewed by:	Matt Macy <mmacy@nextbsd.org>
2017-01-24 14:48:32 +00:00
Alexander Motin
e7037673ca Make CTL ramdisk backend a real RAM disk.
If "capacity" LU option is set, ramdisk backend now implements featured
thin provisioned disk, storing data in malloc(9) allocated memory blocks
of pblocksize bytes (default PAGE_SIZE or 4KB).  Additionally ~0.2% of LU
size is used for indirection tree (bigger pblocksize reduce the overhead).
Backend supports all unmap and anchor operations.  If configured capacity
is overflowed, proper error conditions are reported.

If "capacity" LU option is not set, the backend operates mostly the same
as before without allocating real storage: writes go to nowhere, reads
return zeroes, reporting that all LBAs are unmapped.

This backend is still mostly oriented on testing and benchmarking (it is
still a volatile RAM disk), but now it should allow to run real FS tests,
not only simple dumb dd.

MFC after:	2 weeks
2017-01-24 12:13:41 +00:00
Sevan Janiyan
16ce602c2e Improve wording when describing -mmin.
PR:		215922
Submitted by:	danielsh AT apache DOT org
Approved by:	bcr (mentor)
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D9313
2017-01-24 10:42:21 +00:00
Li-Wen Hsu
8ff21c23a5 Add RISC-V support for truss(1)
While here, extract NARGREG as a definition.

Reviewed by:	br
Differential Revision:	https://reviews.freebsd.org/D9249
2017-01-24 09:41:44 +00:00
Dexuan Cui
33408a34c4 hyperv/hn: add devctl_notify for VF_UP/DOWN events
Reviewed by:	sephe
Approved by:	sephe (mentor)
MFC after:	2 weeks
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D9102
2017-01-24 09:27:13 +00:00