Commit Graph

212634 Commits

Author SHA1 Message Date
Sepherosa Ziehau
bcc9e3e995 hyperv/vmbus: Git rid of sc version of pcpu data extraction macro
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6503
2016-05-24 06:10:21 +00:00
Sepherosa Ziehau
0408d8b80a hyperv/vmbus: Use busdma(9) for messages and event flags
And
- Move message and event flags to vmbus_softc per-cpu data.
- Get rid of hv_setup_arg, which serves no purpose now.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6502
2016-05-24 06:01:39 +00:00
Sepherosa Ziehau
fc2d20095c hyperv/vmbus: Move SynIC setup/teardown from hyperv file to vmbus file
Avoid unnecessary exposure.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6501
2016-05-24 05:51:51 +00:00
Sepherosa Ziehau
5c8e70d86c hyperv/vmbus: Rename local variable and break long lines
No functional changes.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6500
2016-05-24 05:43:55 +00:00
Dmitry Chagin
ab610366b5 Don't leak fp in case where fo_ioctl() returns an error.
Reported by:	C Turt <ecturt@gmail.com>
MFC after:	1 week
2016-05-24 05:29:41 +00:00
Sepherosa Ziehau
d8313c45a6 hyperv/busdma: Take BUS_DMA_ZERO into account
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6499
2016-05-24 05:26:52 +00:00
Sepherosa Ziehau
86931e66f6 hyperv/vmbus: Pass vmbus_softc and curcpu to hv_vmbus_isr()
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6498
2016-05-24 05:18:26 +00:00
Sepherosa Ziehau
a995872175 hyperv/vmbus: Move vmbus interrupt counter into vmbus softc
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6497
2016-05-24 05:06:01 +00:00
Don Lewis
660d4fe299 Fix CID 1006692 in /usr/sbin/pw pw_log() function and other fixes
The length of the name returned from the $LOGNAME and $USER can be
very long and it was being concatenated to a fixed length buffer
with no bounds checking.  Fix this problem by limiting the length
of the name copied.

Additionally, this name is actually used to create a format string
to be used in adding log file entries so embedded % characters in
the name could confuse *printf(), and embedded whitespace could
confuse a log file parser.  Handle the former by escaping each %
with an additional %, and handle the latter by simply stripping it
out.

Clean up the code by moving the variable declarations to the top
of the function, formatting them to conform with style, and moving
intialization elsewhere.

Reduce code indentation by returning early in a couple of places.

Reported by:	Coverity
CID:		1006692
Reviewed by:	markj (previous version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D6490
2016-05-24 05:02:24 +00:00
Adrian Chadd
40dcddfcca [bwn] begin separating out the attach path from the SIBA specific bits.
* convert phy_getinfo() to take a "gmode" flag, rather than the siba
  TGSHIGH flags and then check for 2GHz.  This should ensure that
  gmode is set correctly even on DUALPHY NICs.
* move the siba_powerup() call and the TGSHIGH decoding into a
  call to bwn_is_bus_siba(), and return an error if it's called
  on anything else.  We don't yet do anything else, but when we do..

Tested:

* BCM4322, 11a STA
2016-05-24 04:58:58 +00:00
Adrian Chadd
972459a6ca [bwn] add BCM43225 to the BHND device list.
This is all for the bhnd(4) work in progress.  It's enough to probe/attach
all the bhnd internals, but we're missing OTP support and some cleanup
code.  And, well, all the rest of the bhnd(4) migration.

So no, this won't give you BCM43225 support.  Sorry!
2016-05-24 04:55:00 +00:00
Peter Wemm
00774f3549 It seems <sys/types.h> is a new prerequisite for <bitstring.h> after
r300539. Attempt to fix the build for i386.
2016-05-24 03:15:46 +00:00
John Baldwin
1717b68af1 Don't prematurely return short completions on blocking sockets.
Always requeue an AIO job at the head of the socket buffer's queue if
sosend() or soreceive() returns EWOULDBLOCK on a blocking socket.
Previously, requests were only requeued if they returned EWOULDBLOCK
and completed no data.  Now after a partial completion on a blocking
socket the request is queued and the remaining request is retried when
the socket is ready.  This allows writes larger than the currently
available space on a blocking socket to fully complete.  Reads on a
blocking socket that satifsy the low watermark can still return a short
read (same as read()).

In order to track previously completed data, the internal 'status'
field of the AIO job is used to store the amount of previously
computed data.

Non-blocking sockets continue to return short completions for both
reads and writes.

Add a test for a "large" AIO write on a blocking socket that writes
twice the socket buffer size to a UNIX domain socket.

Sponsored by:	Chelsio Communications
2016-05-24 03:13:27 +00:00
Sean Bruno
bf10f1a085 Update some of the TBD entries in ciss(4) to match what's in the pci
IDS data.

Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2016-05-24 01:42:21 +00:00
Luiz Otavio O Souza
8ba8cb912b Move the OFW iicbus code to dev/iicbus to stop polluting dev/ofw with
unrelated code.

Discussed with:		nwhitehorn (a long time ago)
2016-05-24 01:33:49 +00:00
Adrian Chadd
a7978cf36d [bwn] add extra debugging for non-SIBA devices.
This is a no-op at the present moment, but will eventually remind me
where the SIBA specific demons lie.

Tested:

* BCM4322, STA mode
2016-05-24 01:20:30 +00:00
Adrian Chadd
f4a3eb0297 [bhnd] Implement pass-through resource management for ChipCommon.
This patchset adds support to bhnd_chipc for sharing SYS_RES_MEMORY
resources with its children, allowing us to hang devices off of
bhnd_chipc that rely on access to a subset of the device register space
that bhnd_chipc itself must also allocate.

We could avoid most of this heavy lifting if RF_SHAREABLE+SYS_RES_MEMORY
wasn't limited to use with allocations at the same size/offset.

As a work-around, I implemented something similar to vga_pci.c, which
implements similar reference counting of of PCI BAR resources for its
children.

With these changes, chipc will use reference counting of SYS_RES_MEMORY
allocation/activation requests, to decide when to allocate/activate/
deactivate/release resources from the parent bhnd(4) bus.

The requesting child device is allocated a new resource from chipc's
rman, pointing to (possibly a subregion of) the refcounted bhnd resources
allocated by chipc.

Other resource types are just passed directly to the parent bhnd bus;
RF_SHAREABLE works just fine with IRQs.

I also lifted the SPROM device code out into a common driver, since this
now allows me to hang simple subclasses off of a common driver off of both
bhndb_pci and bhnd_chipc.

Tested:

* (landonf) Tested against BCM4331 and BCM4312, confirmed that SPROM still
  attaches and can be queried.

Submitted by:	Landon Fuller <landonf@landonf.org>
Reviewed by:	mizkha@gmail.com
Differential Revision:	https://reviews.freebsd.org/D6471
2016-05-24 01:12:19 +00:00
Don Lewis
95320acebc Fix multiple Coverity Out-of-bounds access false postive issues in CAM
The currently used idiom for clearing the part of a ccb after its
header generates one or two Coverity errors for each time it is
used.  All instances generate an Out-of-bounds access (ARRAY_VS_SINGLETON)
error because of the treatment of the header as a two element array,
with a pointer to the non-existent second element being passed as
the starting address to bzero().  Some instances also alsp generate
Out-of-bounds access (OVERRUN) errors, probably because the space
being cleared is larger than the sizeofstruct ccb_hdr).

In addition, this idiom is difficult for humans to understand and
it is error prone.  The user has to chose the proper struct ccb_*
type (which does not appear in the surrounding code) for the sizeof()
in the length calculation.  I found several instances where the
length was incorrect, which could cause either an actual out of
bounds write, or incompletely clear the ccb.

A better way is to write the code to clear the ccb itself starting
at sizeof(ccb_hdr) bytes from the start of the ccb, and calculate
the length based on the specific type of struct ccb_* being cleared
as specified by the union ccb member being used.  The latter can
normally be seen in the nearby code.  This is friendlier for Coverity
and other static analysis tools because they will see that the
intent is to clear the trailing part of the ccb.

Wrap all of the boilerplate code in a convenient macro that only
requires a pointer to the desired union ccb member (or a pointer
to the union ccb itself) as an argument.

Reported by:	Coverity
CID:		1007578, 1008684, 1009724, 1009773, 1011304, 1011306
CID:		1011307, 1011308, 1011309, 1011310, 1011311, 1011312
CID:		1011313, 1011314, 1011315, 1011316, 1011317, 1011318
CID:		1011319, 1011320, 1011321, 1011322, 1011324, 1011325
CID:		1011326, 1011327, 1011328, 1011329, 1011330, 1011374
CID:		1011390, 1011391, 1011392, 1011393, 1011394, 1011395
CID:		1011396, 1011397, 1011398, 1011399, 1011400, 1011401
CID:		1011402, 1011403, 1011404, 1011405, 1011406, 1011408
CID:		1011409, 1011410, 1011411, 1011412, 1011413, 1011414
CID:		1017461, 1018387, 1086860, 1086874, 1194257, 1229897
CID:		1229968, 1306229, 1306234, 1331282, 1331283, 1331294
CID:		1331295, 1331535, 1331536, 1331539, 1331540, 1341623
CID:		1341624, 1341637, 1341638, 1355264, 1355324
Reviewed by:	scottl, ken, delphij, imp
MFH:		1 month
Differential Revision:	https://reviews.freebsd.org/D6496
2016-05-24 00:57:11 +00:00
Allan Jude
24d17f1e24 Only set kern.geom.part.mbr.enforce_chs=0 once, instead of once per disk
Sponsored by:	ScaleEngine Inc.
2016-05-24 00:23:39 +00:00
Allan Jude
bb4fd0a0d1 Add support for RAID 1+0 (striped mirrors) to bsdinstall/zfsboot
Sponsored by:	ScaleEngine Inc.
2016-05-24 00:22:29 +00:00
Alan Somers
37f32e5379 Fix build of kern/subr_unit.c, broken by r300539
Reported by:	peter
Pointyhat to:	asomers
Sponsored by:	Spectra Logic Corp
2016-05-24 00:14:58 +00:00
Jung-uk Kim
22d9c132f6 Document POPCNT erratum for 6th Generation Intel Core processors. 2016-05-23 23:00:47 +00:00
Baptiste Daroussin
b821f297e0 Update pci_vendors to 2016.05.23 2016-05-23 22:01:06 +00:00
Bryan Drewery
f0c619b22f Be more clear about LOCKLEAF being exclusive and add LOCKSHARED. 2016-05-23 21:29:57 +00:00
Alan Somers
1b82e02f4d Add bit_count to the bitstring(3) api
Add a bit_count function, which efficiently counts the number of bits set in
a bitstring.

sys/sys/bitstring.h
tests/sys/sys/bitstring_test.c
share/man/man3/bitstring.3
	Add bit_alloc

sys/kern/subr_unit.c
	Use bit_count instead of a naive counting loop in check_unrhdr, used
	when INVARIANTS are enabled. The userland test runs about 6x faster
	in a generic build, or 8.5x faster when built for Nehalem, which has
	the POPCNT instruction.

sys/sys/param.h
	Bump __FreeBSD_version due to the addition of bit_alloc

UPDATING
	Add a note about the ABI incompatibility of the bitstring(3)
	changes, as suggested by lidl.

Suggested by:	gibbs
Reviewed by:	gibbs, ngie
MFC after:	9 days
X-MFC-With:	299090, 300538
Relnotes:	yes
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D6255
2016-05-23 20:29:18 +00:00
Alan Somers
fc13dfc8e2 Commit a missing change from 299090
tests/sys/kern/Makefile
	Reenable a disabled compiler warning, the need for which was
	eliminated by r299090.

Reviewed by:	ngie
MFC after:	4 weeks
X-MFC-With:	299090
Sponsored by:	Spectra Logic Corp
2016-05-23 20:19:07 +00:00
Mark Johnston
65fdf52123 Mark the prefix and default router list sysctl handlers MPSAFE.
MFC after:	2 weeks
2016-05-23 20:18:11 +00:00
Mark Johnston
cc51be7b81 Acquire the nd6 lock in the prefix list sysctl handler.
The nd6 lock will be used to synchronize access to the NDP prefix list.

MFC after:	2 weeks
Tested by:	Jason Wolfe (as part of a larger change)
2016-05-23 20:15:08 +00:00
Ian Lepore
0d66d6d423 Spaces->tab in comment. 2016-05-23 20:13:17 +00:00
Ian Lepore
25926a4b4b Oops, fix a paste-o commited in r300533. 2016-05-23 20:12:38 +00:00
Ian Lepore
2c96ac7a39 Use the new(-ish) CP15_SCTLR macro to generate system control reg accesses
where possible.  In the places that doesn't work (multi-line inline asm,
and places where the old armv4 cpufuncs mechanism is used), annotate the
accesses with a comment that includes SCTLR.  Now a grep -i sctlr can find
all the system control register manipulations.

No functional changes.
2016-05-23 20:07:17 +00:00
Kenneth D. Merry
3f54ec85e8 Fix ada(4) trim support quirk setting.
I broke broke the quirk in the ada(4) driver disabling NCQ trim support
in revision 300207.  The support flags were set before the quirks were
loaded.

sys/cam/ata/ata_da.c:
	Call adasetflags() after loading quirks, so that we'll set the
	flags accurately.

Sponsored by:	Spectra Logic
2016-05-23 19:52:08 +00:00
Conrad Meyer
ab7c85b4b9 ntb_hw(4): Only record the first three MSIX vectors
Don't overrun the msix_data array by reading the (unused) link state
interrupt information.

Reported by:	mav (earlier version)
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D6489
2016-05-23 19:46:58 +00:00
Svatopluk Kraus
f7b9669629 INTRNG - support new interrupt mapping type INTR_MAP_DATA_GPIO
introduced in r298738.

Reviewed by:	ian
2016-05-23 18:16:21 +00:00
Svatopluk Kraus
e2ff80bcb7 INTRNG - use gpio generic interrupt modes definitions added in r298738.
Reviewed by:	ian
2016-05-23 18:12:52 +00:00
Bryan Drewery
699f93b956 Properly allow META_MODE to be set from environment.
Sponsored by:	EMC / Isilon Storage Division
2016-05-23 17:27:42 +00:00
Bryan Drewery
62c63e31e1 Use sed(1) to determine cc version rather than tail(1) since it is already in ITOOLS.
This fixes 'tail: not found' warnings in installworld after r300351.

Sponsored by:	EMC / Isilon Storage Division
2016-05-23 17:11:32 +00:00
Steven Kreuzer
34ae4f7f92 Document r298998, OpenSSL updated to 1.0.2h.
Approved by:	gjb@ (implicit with re@ hat on)
2016-05-23 17:06:46 +00:00
Allan Jude
b06bc65e71 Only export and re-import the root pool if installing on MBR
This step is required in order to dd the boot2 bits into the ZFS partition

Sponsored by:	ScaleEngine Inc.
2016-05-23 17:04:13 +00:00
Alan Cox
10b4196bd0 Correct an error in a comment: One of the conditions for page allocation
is actually the opposite of that stated in the comment.

Remove an unnecessary assignment.  Use an assertion to document the fact
that no assignment is needed.

Rewrite another comment to clarify that the page is not completely valid.

Reviewed by:	kib
2016-05-23 16:59:05 +00:00
Allan Jude
7289f18f78 Fix missing pool name in zfs set command 2016-05-23 16:49:26 +00:00
Bryan Drewery
7e1b3c5e2c Move binutils handling after src.opts.mk.
This fixes the arm64 build after r300348.

Sponsored by:	EMC / Isilon Storage Division
2016-05-23 16:24:34 +00:00
Hans Petter Selasky
44701cf732 Implement "atomic_long_add_unless()" in the LinuxKPI and fix the
implementation of "atomic_long_inc_not_zero()".

Found by:	ngie @
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-05-23 16:19:51 +00:00
Steven Kreuzer
ff55aa1f44 Document r296190, openresolv updated to 3.7.3.
Approved by:	gjb@ (implicit with re@ hat on)
2016-05-23 15:44:39 +00:00
Steven Kreuzer
dc5bff7e9f Document r298161, sqlite3 updated to 3.12.1.
Approved by:	gjb@ (implicit with re@ hat on)
2016-05-23 15:37:12 +00:00
Steven Kreuzer
7096bfcd43 Document r298192, file(1) updated to 5.26.
Approved by:	gjb@ (implicit with re@ hat on)
2016-05-23 15:33:56 +00:00
Andrew Turner
df7a2251cc Add the needed hwpmc hooks to subr_intr.c. This is needed for the correct
operation of hwpmc on, for example, arm64 with intrng.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-05-23 15:26:35 +00:00
Allan Jude
dcf362194d Fix error in bsdinstall where additional filesystems cannot be mounted
Do not set canmount=noauto on the boot environment at create time, because
this causes / to not be mounted, and since the chroot is read only, new
mountpoints cannot be created.

The property is set later, when other properties are adjusted

Reported by:	HardenedBSD
Sponsored by:	ScaleEngine Inc.
2016-05-23 15:11:01 +00:00
Kristof Provost
b599e8dc59 pf: Fix more ICMP mistranslation
In the default case fix the substitution of the destination address.

PR:		201519
Submitted by:	Max <maximos@als.nnov.ru>
MFC after:	1 week
2016-05-23 13:59:48 +00:00
Hans Petter Selasky
8b68f2509f A missing definition needed by ktime_to_ms().
Obtained from:	kmacy @
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-05-23 13:19:20 +00:00