Commit Graph

112170 Commits

Author SHA1 Message Date
Emmanuel Vadot
be79f382c8 We need the GIC to be attached so attach later at BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE
Reviewed by:	andrew
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D7080
2016-07-21 13:26:39 +00:00
Andrew Turner
951154084f Fix the build:
* Add acpi_if.h to the SRC list in the uart module
 * Only include new acpi headers when they are needed

Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-21 13:01:35 +00:00
Andrew Turner
cf9df3c56b Add support for arm64 to uart_dev_acpi by using the _HID property to find
the uart class to use in a similar way as the fdt driver.

Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7248
2016-07-21 09:32:55 +00:00
Sepherosa Ziehau
82b8a87964 hyperv: hv_vmbus_channel -> vmbus_channel
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7260
2016-07-21 06:09:47 +00:00
Sepherosa Ziehau
f62b3ae3be hyperv/vmbus: Shuffle function declaration and macro definition.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7259
2016-07-21 05:46:26 +00:00
Sepherosa Ziehau
3fcf36f408 hyperv/vmbus: Reorder channel fields.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7258
2016-07-21 05:38:05 +00:00
Sepherosa Ziehau
f617e011c9 hyperv/vmbus: Save event flag location and evet flag mask.
This avoids unnecessary access to the vmbus_softc struct on sending path.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7257
2016-07-21 05:30:31 +00:00
Warner Losh
3a31c31c22 Actually import nvme_sim so the CAM attachment for NVME (nda) actually
works.

MFC after: 1 week
2016-07-21 03:11:39 +00:00
Warner Losh
e0ce51cb80 Remove some bogus comments and printfs. Also, we can't
cam_periph_releaes_locked() at the end of nvme_probe_start because we
hit an assertion which may be bogus. Instead, leak a periph until we
sort it out. Since these devices don't arrive and depart often, so
this is the lessor of two evils.

MFC after: 1 week
2016-07-21 03:11:37 +00:00
Warner Losh
336b7b6665 Fix mismerge and add NVME xport support to devstat (or rather, exclude
it from SCSI).

MFC after: 1 week
2016-07-21 03:11:36 +00:00
Warner Losh
b24ced67d0 Fix mismerge and include the nvme support.
Also, print out the name of any CCB's functions that's not supported.

MFC after: 1 week
2016-07-21 03:11:35 +00:00
Conrad Meyer
1005d8aff4 imgact_elf: Rename the segment iterator to match reality
The each_writable_segment routine evaluates segments on a slightly little more
nuanced metric than simply "writable" or not.  Rename the function to more
closely match its behavior (each_dumpable_segment).

Suggested by:	jhb
Sponsored by:	EMC / Isilon Storage Division
2016-07-20 22:51:33 +00:00
Conrad Meyer
f3325003d9 ANSI-fy imgact_elf.c
Sponsored by:	EMC / Isilon Storage Division
2016-07-20 22:46:56 +00:00
Andriy Voskoboinyk
73bb505548 urtwn: fix A-MSDU tx aggregation when encryption is used.
Clear unused (undocumented) CAM bytes while setting a key;
without that, hardware does weird things when A-MSDU bit in QoS header
is set.

Tested with RTL8188CUS (AP) -> RTL8188EU (STA) (A-MSDU transmit).

Reported by:	many
Obtained from:	https://github.com/s3erios/urtwm
MFC after:	5 days
2016-07-20 22:05:44 +00:00
Sean Bruno
c25b4c97a1 Remove uneeded parens.
MFC after:	1 day
2016-07-20 19:21:11 +00:00
Conrad Meyer
07f825e871 Fix DEBUG build on 64-bit arch after r303099
Reported by:	Larry Rosenman <ler at lerctr.org>
2016-07-20 18:11:22 +00:00
Andrew Turner
68abdc4081 Mark the Designware MMC and USB OTG drivers as FDT only. These are normally
found on arm64 devices that use FDT.

Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-20 17:46:33 +00:00
Alan Cox
8d67b8c863 Add a comment describing the 'fast path' that was introduced in r270011.
Reviewed by:	kib
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-07-20 17:20:22 +00:00
Andrew Turner
d4c893910d We will be switching to a new arm64 uart cpu driver that handles both FDT
and ACPI. As such pull out what will be the common parts of the FDT cpu
detection to a new function that can be shared between them.

Reviewed by:	manu
Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7262
2016-07-20 17:19:47 +00:00
Conrad Meyer
c17b0bd2a6 Extend ELF coredump to support more than 65535 segments
The ELF e_phnum field is only 16 bits wide. To support more than 65535 segments
(program headers), Sun's "Linker and Libraries Guide" table 7-7 (or 12-7,
depending on document version) prescribes a special first section header where
sh_info represents the real number of program headers.

Test code to follow, when it is ready.

Reference:	http://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf

Reviewed by:	emaste, markj
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D7255
2016-07-20 16:59:36 +00:00
Gleb Smirnoff
9f3391243b Redo the r302894: the very new value for a non-scheduled callout is -1.
This was recently added in r290664.

Noticed by:	hselasky
Tested by:	Larry Rosenman <ler lerctr.org>
PR:		210884
2016-07-20 16:48:25 +00:00
Gleb Smirnoff
47e4280922 Revert r303037. It re-introduces the panic with TCP timers.
Agreed by:	rrs, re (gjb)
2016-07-20 16:44:22 +00:00
Konstantin Belousov
e73b16ae7a Ensure that the UFS directory vnode' vm_object is properly sized
before UFS_BALLOC() is called.  I do not believe that this caused any
real issue on FreeBSD because the exclusive vnode lock is held over
the balloc/resize, the change is to make formally correct KPI use.

Based on:	the Matthew Dillon' patch from DragonFly BSD
PR:	93942
Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-07-20 14:40:56 +00:00
Emmanuel Vadot
280ab2edb1 Add support for the SID (Security ID Module) on Allwinner A10 and A20.
The rootkey is burnt at production and can't be changed, thus is can be used
as a device unique ID or to generate a MAC address (This is was u-boot does).
The rootkey is exposed as a sysctl (dev.aw_sid.<unit>.rootkey).

Reviewed by:	jmcneill
Differential Revision:	https://reviews.freebsd.org/D6383
2016-07-20 11:23:06 +00:00
Roger Pau Monné
c397b61ea5 vesa: fix panic on suspend
Fix the following panic seen when migrating a FreeBSD guest on Xen:

panic: mtx_lock() of destroyed mutex @ /usr/src/sys/dev/fb/vesa.c:541
cpuid = 0
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe001d2fa4f0
vpanic() at vpanic+0x182/frame 0xfffffe001d2fa570
kassert_panic() at kassert_panic+0x126/frame 0xfffffe001d2fa5e0
__mtx_lock_flags() at __mtx_lock_flags+0x15b/frame 0xfffffe001d2fa630
vesa_bios_save_restore() at vesa_bios_save_restore+0x78/frame 0xfffffe001d2fa680
vga_suspend() at vga_suspend+0xa3/frame 0xfffffe001d2fa6b0
isavga_suspend() at isavga_suspend+0x1d/frame 0xfffffe001d2fa6d0
bus_generic_suspend_child() at bus_generic_suspend_child+0x44/frame
[...]

This is caused because vga_sub_configure (which is called if the VGA adapter
is attached after VESA tried to initialize), points to vesa_configure, which
doesn't initialize the VESA mutex. In order to fix it, make sure
vga_sub_configure points to vesa_load, so that all the needed vesa
components are properly initialized.

Sponsored by:		Citrix Systems R&D
MFC after:		3 days
PR:			209203
Reviewed by:		dumbbell
Differential revision:	https://reviews.freebsd.org/D7196
2016-07-20 09:29:39 +00:00
Michael Tuexen
0ee5c319f2 Fix a bug in deferred stream reset processing which results
in using a length field before it is set.

Thanks to Taylor Brandstetter for reporting the issue and
providing a fix.

MFC after:	3 days
2016-07-20 06:29:26 +00:00
Sepherosa Ziehau
e90bb68be6 hyperv/vmbus: Save MNF trigger location instead of MNF trigger index.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7246
2016-07-20 06:12:32 +00:00
Sepherosa Ziehau
6254947245 hyperv/vmbus: Hide channel struct definition.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7245
2016-07-20 06:00:27 +00:00
Sepherosa Ziehau
fda1c6ee42 hyperv/vmbus: Deprecate the device private data in channel struct
They are neither flexible nor extensible.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7244
2016-07-20 05:48:52 +00:00
Sepherosa Ziehau
ca871fb75c hyperv/vmbus: Pass channel as the first argument for channel callback
The prepares to kill device private fields in channel struct, which
are not flexible and extensible.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7243
2016-07-20 05:34:28 +00:00
Sepherosa Ziehau
9129ad2d70 hyperv/vmbus: Channel struct field rename
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7242
2016-07-20 05:26:04 +00:00
Sepherosa Ziehau
4cd995ff5d hyperv/vmbus: Move IC register definition to Hyper-V utilities
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7241
2016-07-20 05:16:23 +00:00
Sepherosa Ziehau
267fb25f21 hyperv/vmbus: Get rid of unnecessary definition.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7240
2016-07-20 05:03:04 +00:00
Mark Johnston
afa5d70339 Release the second critical section in uma_zfree_arg() slightly earlier.
It is only needed when removing a full bucket from the per-CPU cache. The
bucket cache (uz_buckets) is protected by the zone mutex and thus the
critical section can be released before inserting into that list.

MFC after:	1 week
2016-07-20 01:01:50 +00:00
Mark Johnston
20c58db95a Make vm_pageout_wakeup_thresh a u_int rather than an int.
It's a threshold for v_free_count, which is of type u_int. This also lets
us get rid of a cast in vm_paging_needed().

Reviewed by:	alc
MFC after:	1 week
2016-07-20 00:09:22 +00:00
Mark Johnston
e86e17af79 Merge {amd64,i386}/instr_size.c into x86_instr_size.c.
Also reduce the diff between us and upstream: the input data model will
always be DATAMODEL_NATIVE because of a bug (p_model is never set but is
always initialized to 0), so we don't need to override the caller anyway.
This change is also necessary to support the pid provider for 32-bit
processes on amd64.

MFC after:	2 weeks
2016-07-20 00:02:10 +00:00
Conrad Meyer
f41bde667c Increase vt(4) framebuffer maximum size
And rename "DEFAULT" constants to the more accurate "MAX."

PR:		210382
Submitted by:	Felix <felixphew0 at gmail.com>
Reviewed by:	wblock, cem
Tested by:	Dave Cottlehuber <dch at skunkwerks.at>
2016-07-19 19:20:47 +00:00
Scott Long
3c79101150 Remove unused variable from last commit. 2016-07-19 19:19:03 +00:00
Scott Long
49e20d2420 Supporting flushing the dump before returning, and simplify/combine the
logic.  Switch to a 5us delay since most NVME devices can easily do 200,000
iops.

Submitted by:	imp
MFC after:	3 days
Sponsored by:	Netflix, Inc.
2016-07-19 19:09:23 +00:00
Emmanuel Vadot
ddda1a9c2f Do not use TERM_EMU on arm and arm64 as it doesn't behave well with serial console.
Reviewed by:	andrew, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D6783
2016-07-19 19:00:22 +00:00
Randall Stewart
3d84a18803 This reverts out Gleb's changes and adds three small
fixes that I think closes up the races Gleb was
looking for. This is running quite nicely in Netflix and
now no longer causes TCP-tcb leaks.

Differential Revision:	7135
2016-07-19 18:31:19 +00:00
Mark Murray
a1acc06f4f Random bit generator (RBG) driver for RPi and RPi2.
Summary:
This driver supports the following methods to trigger gathering random bits from the hardware:
1. interrupt when the FIFO is full (default) fed into the harvest queue
2. callout (when BCM2835_RNG_USE_CALLOUT is defined) every second if hz is less than 100, otherwise hz / 100, feeding the random bits into the harvest queue

If the kernel is booted with verbose enabled, the contents of the registers will be dumped after the RBG is started during the attach routine.

Author: hackagadget_gmail.com (Stephen J. Kiernan)

Test Plan: Built RPI2 kernel and booted on board. Tested the different methods to feed the harvest queue (callout, interrupt) and the interrupt driven approach seems best. However, keeping the other method for people to be able to experiment with.

Reviewed By: adrian, delphij, markm

Differential Revision: https://reviews.freebsd.org/D6888
2016-07-19 18:07:47 +00:00
Sean Bruno
03d28807f5 Fixup DA cable detection routines to not set the cable type to
unknown if they do not match one of two cable types.

PR:		150249
Submitted by:	borjam@sarenet.es
Reviewed by:	erj
MFC after:	3 days
2016-07-19 17:31:48 +00:00
Michael Tuexen
0fa7377a03 Use correct order of conditions to avoid NULL deref.
MFC after:	3 days
X-MFC with:	r302935
2016-07-19 11:16:44 +00:00
Michael Tuexen
0ba4c8abe0 netstat and sockstat expect the IPv6 link local addresses to
have an embedded scope. So don't recover.

MFC after:	3 days
2016-07-19 09:48:08 +00:00
Sepherosa Ziehau
e62409966b hyperv/vmbus: Rename laundered vmbus channel code
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7232
2016-07-19 07:51:22 +00:00
Sepherosa Ziehau
d9687005ae hyperv/vmbus: Temp/internal variable/function rename
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7231
2016-07-19 06:04:44 +00:00
Sepherosa Ziehau
e93854c495 hyperv/vmbus: Function rename
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7230
2016-07-19 05:57:19 +00:00
Sepherosa Ziehau
742fb4f669 hyperv/vmbus: Cleanup cpu based channel selection.
And create cpu to channel map at device attach time for storvsc(4).

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7229
2016-07-19 05:46:15 +00:00
Andrey V. Elsukov
f1ff88cf8c Use g_resize_provider() to change the size of GEOM_DISK provider,
when it is being opened. This should fix the possible loss of a resize
event when disk capacity changed.

PR:		211028
Reported by:	Dexuan Cui <decui at microsoft dot com>
MFC after:	3 weeks
2016-07-19 05:36:21 +00:00
Andrey V. Elsukov
ed22e564b8 Add named dynamic states support to ipfw(4).
The keep-state, limit and check-state now will have additional argument
flowname. This flowname will be assigned to dynamic rule by keep-state
or limit opcode. And then can be matched by check-state opcode or
O_PROBE_STATE internal opcode. To reduce possible breakage and to maximize
compatibility with old rulesets default flowname introduced.
It will be assigned to the rules when user has omitted state name in
keep-state and check-state opcodes. Also if name is ambiguous (can be
evaluated as rule opcode) it will be replaced to default.

Reviewed by:	julian
Obtained from:	Yandex LLC
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D6674
2016-07-19 04:56:59 +00:00
Scott Long
a498975ef7 Implement crashdump support on NVME
MFC after:	3 days
Sponsored by:	Netflix, Inc.
2016-07-19 03:13:51 +00:00
Adrian Chadd
ffa25bec32 [ath] don't do LDPC, STBC or short-gi for locationing frames.
The 11n duration calculation function in net80211 and the HAL round /up/
the duration calculation for short-gi, so we can't use that.

The 11n duration calculation doesn't know about the extra symbol time
needed for STBC, nor the LDPC encoding duration, so we can't use
that.

This (along with other, local hacks) allow the locationing services to
get down to around 200nS (yes, nanoseconds) of variance when speaking
to a "good" AP.

Tested:

* AR9380, STA mode, local locationing frame hacks
2016-07-19 00:27:17 +00:00
Andrey V. Elsukov
b867e84e95 Add ipfw_nptv6 module that implements Network Prefix Translation for IPv6
as defined in RFC 6296. The module works together with ipfw(4) and
implemented as its external action module. When it is loaded, it registers
as eaction and can be used in rules. The usage pattern is similar to
ipfw_nat(4). All matched by rule traffic goes to the NPT module.

Reviewed by:	hrs
Obtained from:	Yandex LLC
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D6420
2016-07-18 19:46:31 +00:00
Alexander Motin
84e633724f Negotiate/disable TXCSUM_IPV6 same as TXCSUM. 2016-07-18 16:58:47 +00:00
John Baldwin
ccb83afd81 Include process IDs in core dumps.
When threads were added to the kernel, the pr_pid member of the
NT_PRSTATUS note was repurposed to store LWP IDs instead of process
IDs.  However, the process ID was no longer recorded in core dumps.
This change adds a pr_pid field to prpsinfo (NT_PRSINFO).  Rather than
bumping the prpsinfo version number, note parsers can use the note's
payload size to determine if pr_pid is present.

Reviewed by:	kib, emaste (older version)
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D7117
2016-07-18 15:14:23 +00:00
John Baldwin
fc4f075a1a Add PTRACE_VFORK to trace vfork events.
First, PL_FLAG_FORKED events now also set a PL_FLAG_VFORKED flag when
the new child was created via vfork() rather than fork().  Second, a
new PL_FLAG_VFORK_DONE event can now be enabled via the PTRACE_VFORK
event mask.  This new stop is reported after the vfork parent resumes
due to the child calling exit or exec.  Debuggers can use this stop to
reinsert breakpoints in the vfork parent process before it resumes.

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D7045
2016-07-18 14:53:55 +00:00
Alexander Motin
d0cefbdc0d Update if_hwassist when interface options are changed.
In particular for me this fixes checksum problem when if_bridge attached
to the interface requests TXCSUM to be disabled, but effectively ignored.

MFC after:	3 days
Sponsored by:	iXsystems, Inc.
2016-07-18 14:40:13 +00:00
Konstantin Belousov
77d6809483 The assertion re-added in r302614 was triggered when stopping signal
is delivered to vforked child.  Issue is that we avoid stopping such
children in issignal() to not block parents.  But executed AST, which
ignored stops, leaves the child with the signal pending but no AST
pending.

On first exec after vfork(), call signotify() to handle pending
reenabled signals.  Adjust the assert to not check vfork children
until exec.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-07-18 10:53:47 +00:00
Gleb Smirnoff
809a9d1353 Revert the last commit. It must get more review and testing first. 2016-07-18 09:29:08 +00:00
Gleb Smirnoff
ef58c6a7a3 Redo the r302894: the very new value for a non-scheduled callout is -1.
This was recently added in r290664.

Noticed by:	hselasky
PR:		210884
2016-07-18 09:26:06 +00:00
Luiz Otavio O Souza
59b67ee8f0 Fix a random memory overwrite at boot time, simplebus_init() and
simplebus_add_device() expect a simplebus_softc structure associated with
the device.

Add the simplebus_softc as first member in am335x_pwmss_softc structure.

Sponsored by:	Rubicon Communications (Netgate)
2016-07-18 06:35:40 +00:00
Sepherosa Ziehau
367d703632 hyperv/vmbus: Cosmetic vmbus channel open cleanup
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7217
2016-07-18 05:36:31 +00:00
Maxim Sobolev
55f9588af4 Relax checking if the privider size matches size recorded in the
superblock, allowing provider to be bit bigger, i.e. have some
extra padding after the FS image. That in some cases might be
a side-effect of using CLOOP format which enforces certain block
size and trying to compress image that is not exactly the number
of those blocks in size. The UFS itself does not have any issues
mounting such padded file systems, so it's what GEOM_LABEL should
do.

Submitted by:	@mizhka_gmail.com
Differential Revision:	https://reviews.freebsd.org/D6208
2016-07-18 05:00:01 +00:00
Konstantin Belousov
56d48d6dcb Fix another bug after r302350.
Reported and tested by:	pho
PR:	210884
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2016-07-18 04:30:34 +00:00
Alan Cox
0c3a489325 Break up vm_fault()'s implementation of the read-ahead and delete-behind
optimizations into two distinct pieces.  The first piece consists of the
code that should only be performed once per page fault and requires the map
to be locked.  The second piece consists of the code that should be
performed each time a pager is called on an object in the shadow chain.
(This second piece expects the map to be unlocked.)

Previously, the entire implementation could be executed multiple times.
Moreover, the second and subsequent executions would occur with the map
unlocked.  Usually, the ensuing unsynchronized accesses to the map were
harmless because the map was not changing.  Nonetheless, it was possible for
a use-after-free error to occur, where vm_fault() wrote to a freed map
entry.  This change corrects that problem.

Reported by:	avg
Reviewed by:	kib
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-07-18 04:20:26 +00:00
Maxim Sobolev
e0cd4b7f6f Don't print same value twice, one in decimal once in hex. This makes
output more cryptic than it needs to be and wastes cpu cycles and
console bandwidth.
2016-07-18 03:59:03 +00:00
Justin Hibbits
78cc33fd32 Remove booke_enable_l3_cache declaration and remaining definition.
L3 cache is not defined by Book-E, so is platform specific.  Since it was
already moved for e500-based devices into mpc85xx in r292903, just eliminate it
altogether.  Any device that supports L3 cache should have its own platform
means to enable it.
2016-07-17 19:24:28 +00:00
Justin Hibbits
b926a14ca7 No need to include mpc85xx.h anymore, so remove it. 2016-07-17 19:19:50 +00:00
Mariusz Zaborski
1b55032939 Fix nvlist array memory leak.
When we change nvl_array_next to NULL it means that we want to destroy or
take nvlist_array. The nvpair, which stores next nvlist of nvlist_array element
is no longer needed and can be freed.

Submitted by:	Adam Starak <starak.adam@gmail.com>
MFC after:	1 week
2016-07-17 15:36:02 +00:00
Mariusz Zaborski
26dc4fcaa7 Fix memory leak in the nvlist string array.
Submitted by:	Adam Starak <starak.adam@gmail.com>
MFC after:	1 week
2016-07-17 15:29:31 +00:00
Michal Meloun
79cceaac0f TEGRA: Subclass Tegra PCIE driver from ofw_pci base driver.
Remove now redundant code.
2016-07-17 14:45:15 +00:00
Alexander Motin
db8e94bb3b Restore PIM_ATA_EXT flag handling, lost at r300207.
This re-enables NCQ TRIM usage on capable hardware (bhyve).
2016-07-17 14:17:58 +00:00
Michal Meloun
efafbd0a87 OFWPCI: Add support for NEW_PCIB.
MFC after: 3 weeks
2016-07-17 13:43:46 +00:00
Michal Meloun
5572376db2 OFWPCI: Improve resource handling.
- add new rman for prefetchable memory. Is used only if given 'ranges'
  property contains prefetchable memory range.

- not all ranges in 'ranges' property are subject for rman's filling.
  Tegra for example, have two addition records which are used for
  'pci 'register' -> 'assigned-address' -> 'ranges' machinery.
  Add sc_ranges_mask for masking not rman related ranges.

- consistently pass unknown (not managed at this level) resources
  allocation/release/adjust requests to parent.

MFC after: 3 weeks
2016-07-17 13:43:00 +00:00
Michael Tuexen
487e2e6507 Add a constant required by RFC 7496.
MFC after:	3 days
2016-07-17 13:33:35 +00:00
Michael Tuexen
8e1b295f09 Fix the PR-SCTP behaviour.
This is done by rrs@.

MFC after:	3 days
2016-07-17 13:14:51 +00:00
Alexander Motin
e50f405eca In AHCI_IRQ_MODE_AFTER mode do not clear interrupts below.
This is probably a NOP change since IS register is not activery used for
interrupts below the shared, but it looked odd to clear interrupts we did
not handle.
2016-07-17 12:45:58 +00:00
Alexander Motin
eaf4f6fe69 Do not consider the last interrupt shared if there are enough interrupts
for all channels.
2016-07-17 12:31:31 +00:00
Michael Tuexen
26f0250adf Add missing sctps_reasmusrmsgs counter.
Joint work with rrs@.
MFC after:	3 days
2016-07-17 08:31:21 +00:00
Jared McNeill
01a469b860 Add support for Allwinner H3 EMAC.
H3 EMAC is the same as A83T/A64 except the SoC includes an (optional)
internal 10/100 PHY. Both internal and external PHYs are supported on H3
with this driver.
2016-07-16 18:06:41 +00:00
Konstantin Belousov
86f1146329 Another issue reported on http://seclists.org/oss-sec/2016/q3/68 is
that struct kevent member ident has uintptr_t type, which is silently
truncated to int in the call to fget().  Explicitely check for the
valid range.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-07-16 13:24:58 +00:00
Michael Tuexen
643fd575da Deal with a portential memory allocation failure, which was reported
by the clang static code analyzer.
Joint work with rrs@.

MFC after:	3 days
2016-07-16 12:25:37 +00:00
Michael Tuexen
b4bf72213a Don't free a data chunk twice.
Found by the clang static code analyzer running for the userland stack.

MFC after:	3 days
2016-07-16 08:11:43 +00:00
Michael Tuexen
56d2f7d8e5 Address a potential memory leak found a the clang static code analyzer
running on the userland stack.

MFC after:	3 days
2016-07-16 07:48:01 +00:00
John Baldwin
a5c6318fc3 Rename PTRACE_SYSCALL to LINUX_PTRACE_SYSCALL.
Suggested by:	kib
2016-07-16 00:54:46 +00:00
Konstantin Belousov
f470cca578 In ptrace_vm_entry(), do not call vmspace_free() while owning a vm
object lock.

The vmspace_free() operations might need to lock map, object etc on
last dereference.  Postpone the free until object's inspection is
done.

Reported and tested by:	will
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-07-15 23:26:33 +00:00
Andrey V. Elsukov
7aeccebc0d Add net.inet6.ip6.intr_queue_maxlen sysctl. It can be used to
change netisr queue limit for IPv6 at runtime.

Obtained from:	Yandex LLC
MFC after:	2 weeks
Sponsored by:	Yandex LLC
2016-07-15 17:09:30 +00:00
John Baldwin
8d570f64aa Add a mask of optional ptrace() events.
ptrace() now stores a mask of optional events in p_ptevents.  Currently
this mask is a single integer, but it can be expanded into an array of
integers in the future.

Two new ptrace requests can be used to manipulate the event mask:
PT_GET_EVENT_MASK fetches the current event mask and PT_SET_EVENT_MASK
sets the current event mask.

The current set of events include:
- PTRACE_EXEC: trace calls to execve().
- PTRACE_SCE: trace system call entries.
- PTRACE_SCX: trace syscam call exits.
- PTRACE_FORK: trace forks and auto-attach to new child processes.
- PTRACE_LWP: trace LWP events.

The S_PT_SCX and S_PT_SCE events in the procfs p_stops flags have
been replaced by PTRACE_SCE and PTRACE_SCX.  PTRACE_FORK replaces
P_FOLLOW_FORK and PTRACE_LWP replaces P2_LWP_EVENTS.

The PT_FOLLOW_FORK and PT_LWP_EVENTS ptrace requests remain for
compatibility but now simply toggle corresponding flags in the
event mask.

While here, document that PT_SYSCALL, PT_TO_SCE, and PT_TO_SCX both
modify the event mask and continue the traced process.

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D7044
2016-07-15 15:32:09 +00:00
Andrew Turner
e0f50f02e4 Implement bus_print_child to print the resources used by the ITS driver.
Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-15 13:25:47 +00:00
Gleb Smirnoff
2138e263cb Fix regression introduced by r302350. The change of return value for a
callout that wasn't scheduled at all was unintentional and yielded in
several panics.

PR:		210884
2016-07-15 09:28:32 +00:00
Konstantin Belousov
d7e8cfd63d Do not allow creation of char or block special nodes with VNOVAL dev_t.
As was reported on http://seclists.org/oss-sec/2016/q3/68, tmpfs code
contains assertion that rdev != VNOVAL.  On FreeBSD, there is no other
consequences except triggering the assert.  To be compatible with
systems where device nodes have some significance, reject mknod(2)
call with dev == VNOVAL at the syscall level.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-07-15 09:23:18 +00:00
Sepherosa Ziehau
d745ae11c9 hyperv/vmbus: Cleanup channel sysctl tree creation
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7214
2016-07-15 08:40:22 +00:00
Sepherosa Ziehau
3ccc0ce030 hyperv/vmbus: Cosmetic vmbus channel close cleanup
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7213
2016-07-15 08:31:53 +00:00
Sepherosa Ziehau
d0856980e4 hyperv/vmbus: Function rename
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7212
2016-07-15 08:23:33 +00:00
Sepherosa Ziehau
a91e5fd55f hyperv/vmbus: Back out r302888 temporarily
Committed by accident w/ duplicated commit log

MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-07-15 08:13:44 +00:00
Sepherosa Ziehau
047affd165 hyperv/hn: Busdma-fy rxbuf and chimney sending buffer
Nuke unused channel GPADL API.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7211
2016-07-15 08:08:13 +00:00
Sepherosa Ziehau
8c209c9206 hyperv/hn: Busdma-fy rxbuf and chimney sending buffer
Nuke unused channel GPADL API.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7211
2016-07-15 08:06:48 +00:00
Sepherosa Ziehau
43bbe6b27f hyperv/vmbus: Cleanup channel packet receiving.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7204
2016-07-15 07:53:45 +00:00
Sepherosa Ziehau
7c55724859 hyperv/vmbus: Cleanup channel receiving.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7202
2016-07-15 07:45:30 +00:00
Sepherosa Ziehau
7bf5900964 hyperv/vmbus: Factor out macros to do channel packet length conversion.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7194
2016-07-15 07:35:01 +00:00
Sepherosa Ziehau
a47c066339 hyperv/vmbus: Field rename
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7193
2016-07-15 07:26:31 +00:00
Sepherosa Ziehau
12140675e8 hyperv/vmbus: Function rename
And reorder the error prone parameters list.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7191
2016-07-15 07:16:46 +00:00
Sepherosa Ziehau
4817a5a58d hyperv/vmbus: Cleanup channel sending
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7178
2016-07-15 07:07:17 +00:00
Sepherosa Ziehau
03055a2cea hyperv/vmbus: Move channel packet types definition to vmbus.h
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7177
2016-07-15 06:58:21 +00:00
Sepherosa Ziehau
1680fb300c hyperv/vmbus: Move channel packet flags definition to vmbus.h
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7176
2016-07-15 06:49:45 +00:00
Sepherosa Ziehau
66e132bd0f hyeprv/vmbus: Rework prplist sending.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7175
2016-07-15 06:40:59 +00:00
Adrian Chadd
7ff1939db0 [ath] [ath_hal] break out the duration calculation to optionally include SIFS.
The pre-11n calculations include SIFS, but the 11n ones don't.

The reason is that (mostly) the 11n hardware is doing the SIFS calculation
for us but the pre-11n hardware isn't.  This means that we're over-shooting
the times in the duration field for non-11n frames on 11n hardware, which
is OK, if not a little inefficient.

Now, this is all fine for what the hardware needs for doing duration math
for ACK, RTS/CTS, frame length, etc, but it isn't useful for doing PHY
duration calculations.  Ie, given a frame to TX and its timestamp, what
would the end of the actual transmission time be; and similar for an
RX timestamp and figuring out its original length.

So, this adds a new field to the duration routines which requests
SIFS or no SIFS to be included.  All the callers currently will call
it requesting SIFS, so this /should/ be a glorious no-op.  I'm however
planning some future work around airtime fairness and positioning which
requires these routines to have SIFS be optional.

Notably though, the 11n version doesn't do any SIFS addition at the moment.
I'll go and tweak and verify all of the packet durations before I go and
flip that part on.

Tested:

* AR9330, STA mode
* AR9330, AP mode
* AR9380, STA mode
2016-07-15 06:39:35 +00:00
Sepherosa Ziehau
6199f16549 hyperv/vmbus: Rework sglist sending.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7156
2016-07-15 06:29:19 +00:00
Sepherosa Ziehau
d64ec3506d hyperv/vmbus: Redefine channel packet.
The channel packet header will be shared w/ PRP (physical region page)
list channel packet and SG (scatter gather) list channel packet.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7155
2016-07-15 06:16:39 +00:00
Sepherosa Ziehau
013c69bf17 hyperv/vmbus: Field rename
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7146
2016-07-15 06:08:48 +00:00
Sepherosa Ziehau
23eaa43cc8 hyperv/vmbus: Set vcpuid to 0, if MSR_HV_VP_INDEX does not exist.
Mainly for compatibility.  While I'm here, rename cpuid related
fields in hv_vmbus_channel.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7141
2016-07-15 05:59:27 +00:00
Sepherosa Ziehau
29bf5462b5 hyperv/vmbus: Busdma-fy channel bufring.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7140
2016-07-15 05:51:58 +00:00
Sepherosa Ziehau
9ab42c2138 hyperv/vmbus: Add vmbus_chan_gpadl_connect, which takes GPA physaddr
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7139
2016-07-15 05:40:34 +00:00
Sepherosa Ziehau
b3a6435528 hyperv/vmbus: Use iovec for bufring scatter/gather list.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7134
2016-07-15 05:29:04 +00:00
Sepherosa Ziehau
4ad849ba82 hyperv/vmbus: Remove unused function definition/declaration.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7131
2016-07-15 05:15:21 +00:00
Sepherosa Ziehau
9ef6240130 hyperv/vmbus: Function rename
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7129
2016-07-15 05:06:15 +00:00
Sepherosa Ziehau
1bb1ecfc00 hyperv/vmbus: Remove unused struct
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7127
2016-07-15 04:54:07 +00:00
Sepherosa Ziehau
7d590c7345 hyperv/vmbus: Merge hv_channel_mgmt.c into hv_channel.c
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7126
2016-07-15 04:42:08 +00:00
John Baldwin
c77547d2f9 Include command line arguments in core dump process info.
Fill in pr_psargs in the NT_PRSINFO ELF core dump note with command
line arguments.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D7116
2016-07-14 23:20:05 +00:00
John Baldwin
bdc29f6563 Move nested include of <sys/queue.h> inside _KERNEL.
This removes namespace pollution for userland brought in by r299122.

PR:		210319
Submitted by:	knu
MFC after:	1 week
2016-07-14 23:14:10 +00:00
Mark Johnston
0649caae32 Let DDB's buf printer handle NULL pointers in the buf page array.
A buf's b_pages and b_npages fields may be inconsistent after a panic.
For instance, vfs_vmio_invalidate() sets b_npages to zero only after all
pages are unwired and their page array entries are cleared.

MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2016-07-14 18:49:05 +00:00
Andrew Turner
5d94bbc241 Finish removing the non-INTRNG support from sys/arm64.
Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-14 17:31:29 +00:00
Andrew Turner
ec1172ed92 Remove the non-INTRNG support from the ThunderX PCIe drivers.
Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-14 17:23:49 +00:00
Andrew Turner
c55795369b Move gic_v3_irqsrc into the GICv3 driver source as it's only needed there.
Remove unused macros from the GICv3 header.

Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-14 17:16:51 +00:00
Andrew Turner
a509d56d7f Move structures only used by the GICv3 ITS driver from a shared header to
the ITS driver file. There is no need for other drivers to need to know
about these structures.

Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-14 17:10:54 +00:00
Andrew Turner
b30fd6a080 Remove the non-INTRNG support from the GICv3 interrupt controller driver.
This is no longer needed.

Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-14 17:05:25 +00:00
Andrew Turner
08916a36a9 Remove support for the arm64 pre-INTRNG interrupt framework from the PCI
driver. Support for this was removed in r302375.

Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-07-14 16:52:18 +00:00
Alexander Motin
4cefe96c6d Increase number of I/O APIC pins from 24 to 32 to give PCI up to 16 IRQs.
Move HPET to the top of the supported 0-31 range.

Proposed by:	jhb@, grehan@
2016-07-14 14:35:25 +00:00
Enji Cooper
e5619a893e Always panic if an invalid capability is passed to capable(..) instead of
just with INVARIANTS

rwatson's point was valid in the sense that if the data passed at runtime is
invalid, it should always trip the invariant, not just in the debug case.
This is a deterrent against malicious input, or input caused by hardware
errors.

MFC after: 4 days
X-MFC with: r302577
Requested by: rwatson
Sponsored by: EMC / Isilon Storage Division
2016-07-14 13:55:38 +00:00
Andriy Gapon
70e3da3892 MFV r302645: 6878 Add scrub completion info to "zpool history"
illumos/illumos-gate@1825bc56e5
1825bc56e5

https://www.illumos.org/issues/6878
  Summary of changes:
      * Replace generic "scan done" message with "scan aborted, restarting",
        "scan cancelled", or "scan done"
      * Log number of errors using spa_get_errlog_size
      * Refactor scan restarting check into static function

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Nav Ravindranath <nav@delphix.com>
MFC after:	2 weeks
2016-07-14 11:53:39 +00:00
Andriy Gapon
39a6b17491 MFV r302650: 6940 Cannot unlink directories when over quota
illumos/illumos-gate@99189164df
99189164df

https://www.illumos.org/issues/6940
  Similar to #6334, but this time with empty directories:
  $ zfs create tank/quota
  $ zfs set quota=10M tank/quota
  $ zfs snapshot tank/quota@snap1
  $ zfs set mountpoint=/mnt/tank/quota tank/quota
  $ mkdir /mnt/tank/quota/dir # create an empty directory
  $ mkfile 11M /mnt/tank/quota/11M
  /mnt/tank/quota/11M: initialized 9830400 of 11534336 bytes: Disc quota exceeded
  $ rmdir /mnt/tank/quota/dir # now unlink the empty directory
  rmdir: directory "/mnt/tank/quota/dir": Disc quota exceeded
  From user perspective, I would expect that ZFS is always able to remove files
  and directories even when the quota is exceeded.

Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Simon Klinkert <simon.klinkert@gmail.com>
MFC after:	2 weeks
2016-07-14 11:51:01 +00:00
Andriy Gapon
fe0cc75230 MFV r302644: 6513 partially filled holes lose birth time
illumos/illumos-gate@8df0bcf0df
8df0bcf0df

https://www.illumos.org/issues/6513
  If a ZFS object contains a hole at level one, and then a data block is created
  at level 0 underneath that l1 block, l0 holes will be created. However, these
  l0 holes do not have the birth time property set; as a result, incremental
  sends will not send those holes.
  Fix is to modify the dbuf_read code to fill in birth time data.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Boris Protopopov <bprotopopov@hotmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Paul Dagnelie <pcd@delphix.com>
MFC after:	3 weeks
2016-07-14 11:48:42 +00:00
Andriy Gapon
e7ed92bbbc MFV r302641: 6844 dnode_next_offset can detect fictional holes
illumos/illumos-gate@11ceac77ea
11ceac77ea

https://www.illumos.org/issues/6844
  dnode_next_offset is used in a variety of places to iterate over the holes or
  allocated blocks in a dnode. It operates under the premise that it can iterate
  over the blockpointers of a dnode in open context while holding only the
  dn_struct_rwlock as reader. Unfortunately, this premise does not hold.
  When we create the zio for a dbuf, we pass in the actual block pointer in the
  indirect block above that dbuf. When we later zero the bp in
  zio_write_compress, we are directly modifying the bp. The state of the bp is
  now inconsistent from the perspective of dnode_next_offset: the bp will appear
  to be a hole until zio_dva_allocate finally finishes filling it in. In the
  meantime, dnode_next_offset can detect a hole in the dnode when none exists.
  I was able to experimentally demonstrate this behavior with the following
  setup:
  1. Create a file with 1 million dbufs.
  2. Create a thread that randomly dirties L2 blocks by writing to the first L0
  block under them.
  3. Observe dnode_next_offset, waiting for it to skip over a hole in the middle
  of a file.
  4. Do dnode_next_offset in a loop until we skip over such a non-existent hole.
  The fix is to ensure that it is valid to iterate over the indirect blocks in a
  dnode while holding the dn_struct_rwlock by passing the zio a copy of the BP
  and updating the actual BP in dbuf_write_ready while holding the lock.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Boris Protopopov <bprotopopov@hotmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Alex Reece <alex@delphix.com>
MFC after:	3 weeks
2016-07-14 11:42:53 +00:00
Andriy Gapon
875e6e5b04 MFV r302640: 6874 rollback and receive need to reset ZPL state to what's on disk
illumos/illumos-gate@1fdcbd00c9
1fdcbd00c9

https://www.illumos.org/issues/6874
  When we do a clone swap (caused by "zfs rollback" or "zfs receive"), the ZPL
  doesn't completely reload the state from the DMU; some values remain cached in
  the zfsvfs_t.
  steps to reproduce:
  ```
  #!/bin/bash -x
  zfs destroy -R test/fs
  zfs destroy -R test/recvd
  zfs create test/fs
  zfs snapshot test/fs@a
  zfs set userquota@$USER=1m test/fs
  zfs snapshot test/fs@b
  zfs send test/fs@a | zfs recv test/recvd
  zfs send -i @a test/fs@b | zfs recv test/recvd
  zfs userspace test/recvd
     1. should show 1m quota
        dd if=/dev/urandom of=/test/recvd/file bs=1k count=1024
        sync
        dd if=/dev/urandom of=/test/recvd/file2 bs=1k count=1024
     2. should fail with ENOSPC
        sync
        zfs unmount test/recvd
        zfs mount test/recvd
        zfs userspace test/recvd
     3. if bug above, now shows 1m quota
        dd if=/dev/urandom of=/test/recvd/file3 bs=1k count=1024
     4. if bug above, now fails with ENOSPC
  ```

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Matthew Ahrens <mahrens@delphix.com>
MFC after:	3 weeks
2016-07-14 11:39:36 +00:00
Andriy Gapon
7a946127ef remove a stray change from r302834
MFC after:	3 weeks
X-MFC with:	r302834
2016-07-14 11:13:26 +00:00
Andriy Gapon
a2d87b79cf fix-up for configuration of AMD Family 10h processors borrowed from Linux
http://lxr.free-electrons.com/source/arch/x86/kernel/cpu/amd.c#L643
BIOS may configure Family 10h processors to convert WC+ cache type
to CD.  That can hurt performance of guest VMs using nested paging.

Reviewed by:	kib
MFC after:	3 weeks
Differential Revision: https://reviews.freebsd.org/D6059
2016-07-14 11:03:05 +00:00
Sepherosa Ziehau
e11f3043cd hyperv/vmbus: Move bus related message processing into vmbus.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7125
2016-07-14 08:40:59 +00:00
Sepherosa Ziehau
7e70f1cbaf hyperv/vmbus: Sub-channel related fields renaming
And reorganize comment.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7113
2016-07-14 08:15:13 +00:00
Sepherosa Ziehau
e480791797 hyperv/vmbus: Fix the racy channel close.
It is not safe to iterate the sub-channel list w/o lock on the
close path, while it's even more difficult to hold the lock
and iterate the sub-channel list.  We leverage the
vmbua_{get,rel}_subchan() functions to solve this dilemma.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7112
2016-07-14 07:59:01 +00:00
Sepherosa Ziehau
c1bea00ed1 hyperv/vmbus: Field renaming to reflect reality
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7111
2016-07-14 07:48:26 +00:00
Sepherosa Ziehau
77321df6e4 hyperv/vmbus: Release vmbus channel lock before detach devices
Device detach method may sleep.

While I'm here, rename the function, fix indentation and function
comment.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7110
2016-07-14 07:39:34 +00:00
Sepherosa Ziehau
4cf4f2248e hyperv/vmbus: Only add primary channels to vmbus channel list
- Make the vmbus_chan_add more straightforward.
- Partially fix the hv_vmbus_release_unattached_channels().

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7109
2016-07-14 07:31:43 +00:00
Sepherosa Ziehau
3a1079321c hyperv/vmbus: Use sub-channel index to detect primary channel
In case that VMBUS_CHAN_ISPRIMARY is needed in the early place of
channel setup.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7108
2016-07-14 07:24:03 +00:00
Sepherosa Ziehau
ea505e3821 hyperv/vmbus: Cleanup vmbus_chan_add()
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7106
2016-07-14 07:08:59 +00:00
Sepherosa Ziehau
8c1ac91660 hyperv/vmbus: Nuke the channel open state.
Channel is either opened or not-opened.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7105
2016-07-14 06:59:04 +00:00
Sepherosa Ziehau
0b1e5b0fd0 hyperv/vmbus: Cleanup vmbus_chan_msgproc_choffer
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7104
2016-07-14 06:48:24 +00:00
Sepherosa Ziehau
dab4260c90 hyperv/vmbus: Move new channel scan notification to device register
And nuke now unnecessary function indirection.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7103
2016-07-14 06:40:42 +00:00
Sepherosa Ziehau
245903228c hyperv/vmbus: Move device register and channel free to the caller.
This paves the way for more cleanup/disentangle.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7102
2016-07-14 06:29:12 +00:00
Sepherosa Ziehau
88cafda3b1 hyperv/vmbus: Alloc/Free monitor param in vmbus channel alloc/free.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7101
2016-07-14 06:18:11 +00:00
Sepherosa Ziehau
d805de567f hyperv/vmbus: Get rid of rel{_id,id}, use channel id consistently.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7100
2016-07-14 06:10:00 +00:00
Sepherosa Ziehau
5ef8204d4b hyperv/vmbus: Remove unused bits
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7095
2016-07-14 06:00:40 +00:00
Sepherosa Ziehau
f15c787ae7 hyperv/vmbus: Switch to vmbus channel message macros
Prepare for more cleanup.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7094
2016-07-14 05:49:14 +00:00
Sepherosa Ziehau
e979461031 hyperv/vmbus: Move channel offer message definition to vmbus_reg.h
- Avoid bit fields.
- Avoid unnecessary indirection.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7093
2016-07-14 05:33:33 +00:00
Sepherosa Ziehau
71ac1309f0 hyperv: hv_guid -> struct hyperv_guid.
This paves way for the further cleanup/disentangle.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7092
2016-07-14 05:25:31 +00:00
Sepherosa Ziehau
6c3a5c5759 hyperv/vmbus: Remove unused bits
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7091
2016-07-14 05:14:12 +00:00
Mark Johnston
7d31c3939a Move some gmirror metadata update messages to a higher debug level.
These can be printed quite frequently from a mostly-idle mirror, cluttering
the console.

MFC after:	1 week
2016-07-14 00:40:24 +00:00
Mark Johnston
f4d0e9c95f Allow ACPI wakeup code and page tables to be stored in non-contiguous pages.
Since these pages are allocated from a narrow range of memory, this makes
the allocation more likely to succeed.

Suggested by:	kib
Reviewed by:	jkim, kib
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D7154
2016-07-14 00:38:04 +00:00
Andrew Turner
07b8a57120 Add memmmap on arm64 so we can mmap /dev/mem and /dev/kmem.
Obtained from:	ABT Systems Ltd
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2016-07-13 23:03:34 +00:00
Jared McNeill
169285288c Allwinner Gigabit EMAC performance improvements.
- Support DEVICE_POLLING
 - Increase TX descriptors to 1024
 - Add support for passing a chain of mbufs to if_input, reducing the
   number of calls to mtx_unlock/mtx_lock under load.
 - Remove duplicate byteswap when setting TX_INT_CTL in TX descriptor.
 - Set undocumented "TX_NEXT_FRAME" bit in TX control 1 register.
   According to the A83T BSP, setting this bit allows the DMA engine to
   operate on a packet while receiving another.

Tested on A83T (1000Mbps PHY) and H3 (100Mbps PHY).

Reviewed by:		manu
Differential Revision:	https://reviews.freebsd.org/D7031
2016-07-13 20:46:54 +00:00
Jared McNeill
814f548cd5 H3/A83T: Use PLL_PERIPH/2 for AHB2 parent clock.
Reviewed by:	manu
2016-07-13 20:44:02 +00:00
Dimitry Andric
be39349169 Fix a page fault in ip6_setpktopt(), occurring when the pflog module is
loaded, and syncthing is started, which uses setsockopt(IPV6_PKGINFO).

This is because pflog interfaces do not normally have an IPv6 address,
causing the ND_IFINFO() macro to dereference a NULL pointer.

Reviewed by:	ae
PR:		210943
MFC after:	3 days
2016-07-13 19:41:19 +00:00
Eric Badger
fdb6320d45 Add explicit detection of KVM hypervisor
Set vm_guest to a new enum value (VM_GUEST_KVM) when kvm is detected and use
vm_guest in conditionals testing for KVM.

Also, fix a conditional checking if we're running in a VM which caught only
the generic VM case, but not more specific VMs (KVM, VMWare, etc.).  (Spotted
by: vangyzen).

Differential revision:	https://reviews.freebsd.org/D7172
Sponsored by:	Dell Inc.
Approved by:	kib (mentor), vangyzen (mentor)
Reviewed by:	alc
MFC after:	4 weeks
2016-07-13 19:19:18 +00:00
Jung-uk Kim
0aed566c32 Remove a tunable and always reset system clock while resuming with ACPI.
Requested by:	bde (long ago)
2016-07-13 19:16:32 +00:00
Andriy Gapon
ac3623e090 re-apply r299908: zfsctl_snapdir_lookup: clear VV_ROOT of snapshot's root
The change has been undone in r301275 on the assumption that it was no
longer required.  But that was incorrect, because in this case (and only
in this case) the snapshot root vnode is looked up before z_parent is
fixed up.

MFC after:	5 days
2016-07-13 15:16:51 +00:00
Konstantin Belousov
de56aee0bf Trace timeval parameters to the getitimer(2) and setitimer(2) syscalls.
Reviewed by:	jhb
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D7158
2016-07-13 14:37:58 +00:00
Sepherosa Ziehau
e2d8dbe438 hyperv/vmbus: Cleanup channel rescind
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7090
2016-07-13 09:44:24 +00:00
Sepherosa Ziehau
37a911a59b hyperv/vmbus: Remove unused code
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7089
2016-07-13 09:36:46 +00:00
Sepherosa Ziehau
8c8cf3f2e2 hyperv/vmbus: Reorganize MNF event sending.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7088
2016-07-13 09:28:46 +00:00
Sepherosa Ziehau
562d480b7d hyperv: Signal event input parameter is shared w/ MNF
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7087
2016-07-13 09:19:33 +00:00
Sepherosa Ziehau
a570251d00 hyperv: All Hypercall parameters have same alignment requirement.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7086
2016-07-13 09:11:03 +00:00
Sepherosa Ziehau
782b0df476 hyperv/vmbus: Install different task function for batch/non-batch channels
This avoids bunch of unnecessary checks on hot path and simplifies the
channel processing.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7085
2016-07-13 08:30:14 +00:00
Sepherosa Ziehau
817c040c3f hyperv/vmbus: Remove unnecessary callback check.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7046
2016-07-13 06:55:21 +00:00
Sepherosa Ziehau
df1021e7bf hyperv/vmbus: Pack bool field into flags field
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7038
2016-07-13 06:46:29 +00:00
Sepherosa Ziehau
7c2abef176 hyperv/bufring: Remove unused fields
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7037
2016-07-13 06:39:04 +00:00
Sepherosa Ziehau
6de616d3a0 hyperv/vmbus: Nuke unused field from hv_vmbus_channel.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7036
2016-07-13 06:30:33 +00:00
Sepherosa Ziehau
3b50b13baa hyperv: Get rid of hv_device, which is unnecessary indirection.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7034
2016-07-13 06:17:15 +00:00
Sepherosa Ziehau
6a2ff2cbf7 hyperv/hn: Avoid the hv_device
This paves way to nuke the hv_device, which is actually an unncessary
indirection.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7033
2016-07-13 05:58:46 +00:00
Sepherosa Ziehau
47575345ba hyperv/vmbus: Deprecate the usage of hv_device.
This paves way to nuke the hv_device, which is actually an unncessary
indirection.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7032
2016-07-13 05:47:09 +00:00
Sepherosa Ziehau
2d19acf75b hyperv/util: Avoid the hv_device
This paves way to nuke the hv_device, which is actually an unncessary
indirection.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7028
2016-07-13 05:35:28 +00:00
Sepherosa Ziehau
d2c2a2ef36 hyperv/stor: Avoid the hv_device and nuke the broken get_stor_device
This paves way to nuke the hv_device, which is actually an unncessary
indirection.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7027
2016-07-13 05:28:07 +00:00
Sepherosa Ziehau
edd0c2c7c7 hyperv/vmbus: Add channel ivar accessor.
This makes life easier during the transition period to nuke the hv_device.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7026
2016-07-13 05:19:45 +00:00
Sepherosa Ziehau
93637258fd hyperv/vmbus: All ivars are read-only; nuke unnecessary write_ivar
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7025
2016-07-13 05:11:45 +00:00
Sepherosa Ziehau
884d26c84c hyperv/vmbus: Add vmbus method for GUID base device probing.
Reduce the exposure of hv_device.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7024
2016-07-13 05:01:12 +00:00
Sepherosa Ziehau
abe9fa4996 hyperv/vmbus: Remove the embedded offer message from hv_vmbus_channel
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7021
2016-07-13 04:51:37 +00:00
Sepherosa Ziehau
5c604feb67 hyperv/vmbus: Add type/instance guid fields into hv_vmbus_channel
This prepares to remove the unnecessary offer message embedding in
hv_vmbus_channel.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7020
2016-07-13 04:39:16 +00:00
Sepherosa Ziehau
d74e22ed4a hyperv/vmbus: Add flags field into hv_vmbus_channel for MNF indication
This prepares to remove the unnecessary offer message embedding in
hv_vmbus_channel.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7019
2016-07-13 04:31:08 +00:00
Sepherosa Ziehau
4ac0a9bf1e hyperv/vmbus: Make subchan index a field of hv_vmbus_channel.
This prepares to remove the unnecessary offer message embedding in
hv_vmbus_channel.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7015
2016-07-13 03:35:22 +00:00
Sepherosa Ziehau
2c4888c75b hyperv/vmbus: Make channel id a field of hv_vmbus_channel.
This prepares to remove the unnecessary offer message embedding in
hv_vmbus_channel.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7014
2016-07-13 03:24:29 +00:00
Sepherosa Ziehau
e71d17193d hyperv/vmbus: Merge hv_connection.c into hv_channel.c
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7004
2016-07-13 03:14:29 +00:00
Conrad Meyer
1be25cc928 ioat(4): Check ring links at grow/shrink in INVARIANTS 2016-07-12 21:57:05 +00:00
Conrad Meyer
6d41e1ed15 ioat(4): Add KTR trace for ioat_reset_hw 2016-07-12 21:57:02 +00:00
Conrad Meyer
bd17dd691e ioat(4): Enhance KTR logging for descriptor completions 2016-07-12 21:57:00 +00:00
Conrad Meyer
3b188a672f ioat(4): Assert against ring underflow 2016-07-12 21:56:57 +00:00
Conrad Meyer
08a6b96aa5 ioat_reserve_space: Recheck quiescing flag after dropping submit lock
Fix a minor bound check error while here (ring can only hold 1 <<
MAX_ORDER - 1 entries).
2016-07-12 21:56:55 +00:00
Conrad Meyer
fe19e76ced ioat(4): Remove force_hw_error sysctl; it does not work reliably 2016-07-12 21:56:52 +00:00
Conrad Meyer
f8253f1a39 ioat(4): Export HW capabilities to consumers 2016-07-12 21:56:49 +00:00
Conrad Meyer
25ad958599 ioat(4): Submitters pick up a shovel if queue is too full
Before attempting to grow the ring.
2016-07-12 21:56:46 +00:00
Conrad Meyer
c62db3954c ioat(4): Don't shrink ring if active 2016-07-12 21:56:34 +00:00
Conrad Meyer
35b7a45ef2 ioat(4): Print some more useful information about the ring from ddb "show ioat" 2016-07-12 21:52:26 +00:00
Stephen McConnell
32b0a21e43 Use real values to calculate Max I/O size instead of guessing.
Reviewed by:	ken, scottl
Approved by:	ken, scottl, ambrisko (mentors)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D7043
2016-07-12 19:34:10 +00:00
Conrad Meyer
db16ab7ea0 ioat(4): Shrink using the correct timer
Fix a typo introduced in r302352.

Sponsored by:	EMC / Isilon Storage Division
2016-07-12 17:58:58 +00:00
Don Lewis
98e82c02e5 Fix problems in the FQ-PIE AQM cleanup code that could leak memory or
cause a crash.

Because dummynet calls pie_cleanup() while holding a mutex, pie_cleanup()
is not able to use callout_drain() to make sure that all callouts are
finished before it returns, and callout_stop() is not sufficient to make
that guarantee.  After pie_cleanup() returns, dummynet will free a
structure that any remaining callouts will want to access.

Fix these problems by allocating a separate structure to contain the
data used by the callouts.  In pie_cleanup(), call callout_reset_sbt()
to replace the normal callout with a cleanup callout that does the cleanup
work for each sub-queue.  The instance of the cleanup callout that
destroys the last flow will also free the extra allocated block of memory.
Protect the reference count manipulation in the cleanup callout with
DN_BH_WLOCK() to be consistent with all of the other usage of the reference
count where this lock is held by the dummynet code.

Submitted by:	Rasool Al-Saadi <ralsaadi@swin.edu.au>
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D7174
2016-07-12 17:32:40 +00:00
Sepherosa Ziehau
283ec9df45 hyperv/vmbus: Destroy channel list lock upon attach failure and detach.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7003
2016-07-12 09:06:25 +00:00
Sepherosa Ziehau
250ca4ca3b hyperv/vmbus: Remove needed bits
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7002
2016-07-12 08:55:08 +00:00
Sepherosa Ziehau
af3be0bfa5 hyperv/vmbus: Move channel map to vmbus_softc
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6982
2016-07-12 08:47:04 +00:00
Roger Pau Monné
302244700f xen: automatically disable MSI-X interrupt migration
If the hypervisor version is smaller than 4.6.0. Xen commits 74fd00 and
70a3cb are required on the hypervisor side for this to be fixed, and those
are only included in 4.6.0, so stay on the safe side and disable MSI-X
interrupt migration on anything older than 4.6.0.

It should not cause major performance degradation unless a lot of MSI-X
interrupts are allocated.

Sponsored by:		Citrix Systems R&D
MFC after:		3 days
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D7148
2016-07-12 08:43:09 +00:00
Sepherosa Ziehau
99e315276a hyperv/vmbus: Fix sub-channel re-open support.
For multi-channel devices, once the primary channel is closed,
a set of 'rescind' messages for sub-channels will be delivered
by Hypervisor.  Sub-channel MUST be freed according to these
'rescind' messages; directly re-openning sub-channels in the
same fashion as the primary channel's re-opening does NOT work
at all.

After the primary channel is re-opened, requested # of sub-
channels will be delivered though 'channel offer' messages, and
this set of newly offered channels can be opened along side with
the primary channel.

This unbreaks the MTU setting for hn(4), which requires re-
openning all existsing channels upon MTU change.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6978
2016-07-12 08:38:03 +00:00
Sepherosa Ziehau
81e1f05268 hyperv/vmbus: Free sysctl properly upon channel close.
Prepare for sub-channel re-open.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6977
2016-07-12 08:28:51 +00:00
Sepherosa Ziehau
3dee05577d hyperv/vmbus: More verbose for GPADL_connect/chan_{rescind,offer}
Reviewed by:	Dexuan Cui <decui microsoft com>, Hongjiang Zhang <honzhan microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6976
2016-07-12 08:21:28 +00:00
Sepherosa Ziehau
7fbf073008 hyperv/vmbus: Move channel list to vmbus_softc
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6956
2016-07-12 08:11:16 +00:00
Sepherosa Ziehau
ee7e313f03 hyperv/vmbus: Move GPADL index into vmbus_softc
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6954
2016-07-12 07:49:38 +00:00
Sepherosa Ziehau
38d19df6ff hyperv/vmbus: Rework vmbus version accessing.
Instead of global variable, vmbus version is accessed through
a vmbus DEVMETHOD now.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6953
2016-07-12 07:33:39 +00:00
Andrey A. Chernov
cbf4af1f7e Bump __FreeBSD_version after removing collation from [a-z]-type ranges. 2016-07-12 07:16:37 +00:00
Dmitry Chagin
2b51f15459 Fix pc98 LINT build.
MFC after:	4 days
2016-07-12 06:12:58 +00:00
Sepherosa Ziehau
f24517f037 hyperv/vmbus: Minor renaming
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6919
2016-07-12 05:55:11 +00:00
Sepherosa Ziehau
02888b1e1b ntb: Fix LINT
Sponsored by:	Microsoft OSTC
2016-07-12 05:41:34 +00:00
Sepherosa Ziehau
9e6efea698 hyperv/vmbus: Don't be oversmart in default cpu selection.
Pin the channel to cpu0 by default.  Drivers having special channel-cpu
mapping requirement should call vmbus_channel_cpu_{set,rr}() themselves.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6918
2016-07-12 05:31:33 +00:00
Sepherosa Ziehau
fc7ddc1e23 hyperv: Nuke unused stuffs
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6917
2016-07-12 05:23:14 +00:00
Sepherosa Ziehau
e44bdd84c9 hyperv/vmbus: Busdma-fy Hypercall signal event input parameter.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6916
2016-07-12 05:09:07 +00:00
Sepherosa Ziehau
44d03f9a5f hyperv/vmbus: Avoid tx_evtflags setting code duplication.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6915
2016-07-12 04:58:21 +00:00
Sepherosa Ziehau
88d2677299 hyperv/vmbus: Flatten channel message response processing.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6914
2016-07-12 04:35:32 +00:00
Andrey A. Chernov
239e5577a2 Undo r302601, WCHAR_MAX may not be a valid wchar value. 2016-07-12 04:20:44 +00:00
Konstantin Belousov
8f01bee46b Revive the check, disabled in r197963.
Despite the implication (process has pending signals -> the current
thread marked for AST and has TDF_NEEDSIGCHK set) is not true due to
other thread might manipulate its signal blocking mask, it should still
hold for the single-threaded processes.  Enable check for the condition
for single-threaded case, and replicate it from userret() to ast() as
well, where we check that ast indeed has no signal to deliver.

Note that the check is under DIAGNOSTIC, it is not enabled for INVARIANTS
but !DIAGNOSTIC since it imposes too heavy-weight locking for day-to-day
used debugging kernel.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-07-12 03:53:15 +00:00
Konstantin Belousov
4f4c35bb38 Add assert to complement r302328.
AST must not execute with TDF_SBDRY or TDF_SEINTR/TDF_SERESTART thread
flags set, which is asserted in userret(). As the consequence, -1 return
from cursig() must not be possible.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-07-12 03:52:05 +00:00
Sepherosa Ziehau
1f175550a0 hyperv: Nuke unused stuffs
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6913
2016-07-12 03:38:29 +00:00
Sepherosa Ziehau
e90ec741f9 hyperv/vmbus: Use post message Hypercall APIs for GPA disconnect
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6912
2016-07-12 03:32:07 +00:00
Sepherosa Ziehau
e9bd7c4417 hyperv/vmbus: Use post message Hypercall APIs for channel close
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6906
2016-07-12 03:25:36 +00:00
Sepherosa Ziehau
2bf62f9a89 hyperv/vmbus: Use post message Hypercall APIs for GPADL connect.
This also fixes memory leakge if sub-connect messages are needed.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6878
2016-07-12 03:19:40 +00:00
Sepherosa Ziehau
df9f40d810 hyperv/vmbus: Remove unnecessary check and unapplied comment
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6877
2016-07-12 03:14:35 +00:00
Sepherosa Ziehau
fc1208d658 hyperv/vmbus: Use post message Hypercall APIs for channel open
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6876
2016-07-12 03:09:10 +00:00
Sepherosa Ziehau
796a90bf5d hyperv/vmbus: Reorganize vmbus scan process.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6875
2016-07-12 03:03:17 +00:00
Sepherosa Ziehau
7a49521a4b hyperv/stor: Save the response status and xfer length properly.
The current command response handling discards status and xfer
length unconditionally, so that all of the commands would be
considered successful, even if errors happened.  When errors
really happens, this causes all kinds of wiredness, since the
buffer will not be filled on the host side and sense data will
be ignored.

Most of the time, errors do not happen, however, error does
happen for the request sent immediately after the disk resizing.
Discarding the SCSI status (SCSI_STATUS_CHECK_COND) and sense
data (capacity changes) prevents the disk resizing from working
properly.

This commit saves the response status and xfer length properly
for later use.

Submitted by:	Dexuan Cui <decui microsoft com>
Noticed by:	sephe
MFC after:	3 days
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7181
2016-07-12 02:57:13 +00:00
Landon J. Fuller
fdedcd9f95 bhnd(4): Add bus pass-aware discovery of platform devices (PMU,
NVRAM, ChipCommon, etc).

This extends the existing handling of NVRAM core discovery to support
locating additional devices that may be attached either directly as real
cores, or indirectly via ChipCommon (e.g. bhnd_pmu).

When attached as a SoC root bus (as opposed to a bridged WiFi device),
the platform devices may not be attached until later bus passes,
necessitating delayed discovery/initialization.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D6962
2016-07-12 02:16:48 +00:00
Landon J. Fuller
494fa6b933 mips/ddb: fix MIPS backtrace truncation and MIPS32 register printing.
- Cast 32-bit register values to uintmax_t for use with %jx.
 - Add special-case return address handling for MipsKernGenException to
   avoid early termination of stack walking in the exception handler
   stack frame.

Submitted by:	Michael Zhilin <mizhka@gmail.com>
Reviewed by:	ray
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D6907
2016-07-12 02:12:31 +00:00
Landon J. Fuller
692f593c23 bhnd(4): print extra register information on chipc SPI timeout.
Submitted by:	Michael Zhilin <mizhka@gmail.com>
Reviewed by:	imp
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D6993
2016-07-12 01:15:00 +00:00
Andrey A. Chernov
713a61670c I don't know why unsigned int is choosed for wchar_t here, but WCHAR_MAX
should be <= WINT_MAX. It is bigger, __UINT_MAX > INT32_MAX
2016-07-12 00:37:48 +00:00
Nathan Whitehorn
8c636a11dc Remove assumptions in MI code that the BSP is CPU 0.
MFC after:	2 weeks
2016-07-11 21:25:28 +00:00
Jared McNeill
9f2b8101d7 Add support for Allwinner A64.
Reviewed by:	andrew, manu
2016-07-11 20:15:46 +00:00
Jared McNeill
d1d50b7010 Return early from bus_dmamap_load callback if the error indicator is set.
Reviewed by:	andrew, manu
2016-07-11 20:14:50 +00:00
Jared McNeill
d40e52436e Add support for arm64. The allwinner_soc_family() function is not available
on arm64 and all SoCs using the old FIFO register location are 32-bit only,
so unconditionally use the new location for arm64.

Reviewed by:	andrew, manu
2016-07-11 20:13:46 +00:00
Jared McNeill
2d36de5fb7 Add support for Allwinner A64 CPUx-PORT and CPUs-PORT Port Controllers.
Reviewed by:	andrew, manu
2016-07-11 20:09:17 +00:00
Jared McNeill
25cd5941be Add Allwinner A64 padconf settings.
Reviewed by:	andrew, manu
2016-07-11 20:06:21 +00:00
Jared McNeill
eefa8817b0 Add SOC_ALLWINNER_A64 option for Allwinner A64 (sun50i) SoCs. 2016-07-11 20:05:03 +00:00
Jared McNeill
2274551aba Include sys/rman.h to fix build on arm64. 2016-07-11 20:03:31 +00:00
Jared McNeill
221a9d6dd6 Attach RSB early. Children of RSB may provide resources necessary for
other devices such as interrupts, GPIOs, and regulators.
2016-07-11 20:02:51 +00:00
Jared McNeill
7dd6227263 Build fix for arm64. The phy interface uses intptr_t for the "phy"
parameter, not int.
2016-07-11 20:00:57 +00:00
Jared McNeill
18c3530813 Remove unused bus_space prototypes. 2016-07-11 19:58:00 +00:00
Enji Cooper
092af585e1 Remove redundant declaration for tcp_dooptions, similar to r302576
netinet/tcp_var.h already defines this function

Differential Revision:	https://reviews.freebsd.org/D7189
MFC after:	1 week
PR:	209920
Reported by:	Mark Millard <markmi@dsl-only.net>
Reviewed by:	np
Tested with:	clang 3.8.0, gcc 4.2.1, gcc 5.3.0
Sponsored by:	EMC / Isilon Storage Division
2016-07-11 17:11:18 +00:00
Konstantin Belousov
725496ced5 Fix grammar.
Submitted by:	alc
MFC after:	2 weeks
2016-07-11 17:04:22 +00:00