Commit Graph

112606 Commits

Author SHA1 Message Date
Andrew Turner
1d32c3222e Add KASSERTS in pmap_alloc_l3 to ensure we are not encountering superpages
when we don't yet expect them;

Obtained from:	ABT Systems Ltd
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-08-22 10:21:09 +00:00
Sepherosa Ziehau
2e5573e6de hyperv/hn: Factor out function to simplify NVS request sending
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7578
2016-08-22 08:00:14 +00:00
Sepherosa Ziehau
8f556f2598 hyperv/hn: Factor out function to execute NVS transactions.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7577
2016-08-22 07:51:46 +00:00
Sepherosa Ziehau
ef56e63fb3 hyperv/hn: Get rid of netvsc_dev
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7575
2016-08-22 07:44:11 +00:00
Sepherosa Ziehau
fdd6031b04 hyperv/hn: Move chimney sending buffer to hn_softc
And don't recreate chimney sending buffer for each primary channel
open, it is now created in device_attach DEVMETHOD and destroyed
in device_detach DEVMETHOD.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7574
2016-08-22 07:34:39 +00:00
Pyun YongHyeon
bb7e9b3046 Add a missing change in r304575.
Noticed by:	jhb
2016-08-22 03:28:06 +00:00
Michael Tuexen
7fcbd928f8 Improve the locking when sending user messages.
First, keep a ref count on the stcb after looking it up, as
done in the other lookup cases.
Second, before looking again at sp, ensure that it is not
freed, because the assoc is about to be freed.

MFC after: 3 days
2016-08-22 01:45:29 +00:00
Pyun YongHyeon
477cba21d2 Add Killer E2400 Gigabit Ethernet support.
It seems Killer E2200/E2400 has a BIOS misconfiguration or silicon
bug which triggers DMA write errors when driver uses advertised
maximum payload size.  Force the maximum payload size to 128 bytes
in DMA configuration.
This change should fix occasional DMA write errors reported on
Killer E2200.

Tested by:	<psy0nic@sys-tek.org>
2016-08-22 01:19:05 +00:00
Pyun YongHyeon
03b4253bb8 Correct DMA channel number selection on AR816x family of
controllers. For Gigabit Ethernet version of AR816x, AR813x/AR815x
except L1D controller, use vendor recommended ASPM parameters.
While here, increase alc_dma_burst array size.  Broken H/W can
return bogus value in theory.
2016-08-22 01:06:54 +00:00
Michael Tuexen
26a5d52f03 Remove duplicate code, which is not protected by the appropriate locks.
MFC after: 3 days
2016-08-22 00:40:45 +00:00
Bjoern A. Zeeb
77ecef378a Remove the kernel optoion for IPSEC_FILTERTUNNEL, which was deprecated
more than 7 years ago in favour of a sysctl in r192648.
2016-08-21 18:55:30 +00:00
Hans Petter Selasky
a6ae9251b4 Make the UKBD USB transfers double buffered and set them up one by one,
so they are memory independent which allows for handling panics
triggered by the keyboard driver itself, typically via CTRL+ALT+ESC
sequences. Or if the USB keyboard driver was processing a key at the
moment of panic. Allow UKBD to be attached while keyboard polling is active.

Tested by:	Bruce Evans <bde@freebsd.org>
MFC after:	1 week
2016-08-21 18:37:21 +00:00
Bruce Evans
3f7880e23a Fix translation of the PrintScreen/SysRq and Pause/Break keys. Almost
everything was broken.  The cases that I noticed were Ctrl-PrintScreen
not being mapped to the virtual scancode 0x5c (debug) and Pause not being
mapped to the physical/virtual scancode 0x46 (slock).

These keys are the most complicated ones due to kludges to give some
compatibility back to before AT keyboards.

Alt-PrintScreen must pretend to be a separate key from PrintScreen
even at the "raw" level.  The (unique) usb code for it is 0x8a and we
just have to map this to our unique virtual scancode 0x54, but we
mapped it first to the internal code 0x7e and then to 0x79 which is a
key on the Japanese 106/109 keyboard.  This fix is under the
UKBD_EMULATE_ATASCANCODE option which shouldn't be used for non-AT
keyboards.  If it is, then the syscons Japanese keymaps have nothing
of importance for code 0x79 and can easily be changed.  0x54 is also
unimportant in Japanese and US keymaps.

NonAlt-PrintScreen and NonCtl-Pause/Break had many much larger bugs with
smaller compatibility problems from fixing them.  The details are too
ugly to give here.  Summary of the changed (hex) codes:

K_RAW  PrintScreen (Ctl, Shift, Ctl-Shift):             E0-2A-E0-37 -> E0-37
K_RAW  Alt-PrintScreen (all shift states):              79 -> 54
K_RAW  Pause/Break (unshifted, Shift, Alt, Alt-Shift)): E0-46 -> E1-1D-45
K_CODE ALT-PrintScreen (all shift states):              79 -> 54

That is 15 of 32 shift combinations for 2 keys fixed, with 8 easy cases
from the 79 -> 54 remapping.

The difference is only large and with no workaround using a keymap for
for K_RAW, but this affects other modes when ukbd is layered under kbmux
because kbmux keeps all subdevices in K_RAW mode and translates.  Oops.
I used kbdmux to generate the above table of changes.
2016-08-21 16:06:00 +00:00
Emmanuel Vadot
f8fc698b0d allwinner: Remove a20/a20_cpu_cfg.c from the build.
This was needed when we used the SoC specific timer and not the generic-timer.
2016-08-21 16:03:44 +00:00
Ed Schouten
79ad79d6a4 Add source files generated from the 32-bit system call table. 2016-08-21 16:02:25 +00:00
Ed Schouten
240f8c2d51 Add CPU independent code for running 32-bits CloudABI executables.
Essentially, this is a literal copy of the code in sys/compat/cloudabi64,
except that it now makes use of 32-bits datatypes and limits. In
sys/conf/files, we now need to take care to build the code in
sys/compat/cloudabi if either COMPAT_CLOUDABI32 or COMPAT_CLOUDABI64 is
turned on.

This change does not yet include any of the CPU dependent bits. Right
now I have implementations for running i386 binaries both on i386 and
x86-64, which I will send out for review separately.
2016-08-21 16:01:30 +00:00
Ed Schouten
df71f1dcd6 Fix s/64/32/ conversion errors in the system call table.
We should pull in the 32 bit headers when using this system call table.
2016-08-21 15:56:19 +00:00
Ed Schouten
98d627a0ab Import the 32-bit system call table and data types into the tree.
Obtained from:	https://github.com/NuxiNL/cloudabi
2016-08-21 15:41:19 +00:00
Ed Schouten
90f4145f82 Don't forget to define __ELF_WORD_SIZE.
Without it, we only obtain the ELF types native to the system. In this
we explicitly want the 64-bit versions.
2016-08-21 15:37:49 +00:00
Ed Schouten
47cb4d7bd0 Add a utility macro for converting 64-bit pointers to native pointers.
Right now we're casting uint64_t's to native pointers. This isn't
causing any problems right now, but if we want to provide a 32-bit
compatibility layer that works on 64-bit systems as well, this will
cause problems. Casting a uint32_t to a 64-bit pointer throws a compiler
error.

Introduce a TO_PTR() macro that casts the value to uintptr_t before
casting it to a pointer.
2016-08-21 15:36:18 +00:00
Ed Schouten
4fbc90654c Move the linker script from cloudabi64/ to cloudabi/.
It turns out that it works perfectly fine for generating 32-bits vDSOs
as well. While there, get rid of the extraneous .s file extension.
2016-08-21 15:14:06 +00:00
Ed Schouten
a953f555e1 Use the right _MAX constant.
Though uio_resid is of type ssize_t, we need to take into account that
this source file contains an implementation specific to a certain
userspace pointer size. If this file provided 32-bit implementations,
this should have used INT32_MAX, even when running a 64-bit kernel.

This change has no effect, but is simply in preparation for adding
support for running 32-bit CloudABI executables.
2016-08-21 09:32:20 +00:00
Ed Schouten
384ef4841a Use memcpy() to copy 64-bit timestamps into the syscall return values.
On 32-bit platforms, our 64-bit timestamps need to be split up across
two registers. A simple assignment to td_retval[0] will cause the top 32
bits to get lost. By using memcpy(), we will automatically either use 1
or 2 registers depending on the size of register_t.
2016-08-21 07:41:11 +00:00
Ed Schouten
7ce0716103 Rewrite the vDSOs for CloudABI in assembly.
The reason why the old vDSOs were written in C using inline assembly was
purely because they were embedded in the C library directly as static
inline functions. This was practical during development, because it
meant you could invoke system calls without any library dependencies.
The vDSO was simply a copy of these functions.

Now that we require the use of the vDSO, there is no longer any need for
embedding them in C code directly. Rewriting them in assembly has the
advantage that they are closer to ideal (less useless branching, less
assumptions about registers remaining unclobbered by the kernel, etc).
They are also easier to build, as they no longer depend on the C type
information for CloudABI.

Obtained from:	https://github.com/NuxiNL/cloudabi
2016-08-21 07:28:38 +00:00
Adrian Chadd
1a71a7f2a4 [mips] add support for the "creative" GNU extensions and IRIX hilarity around MIPS LO16/HI16 relocations.
This was .. an interesting headache.

There are two halves:

* The earlier IRIX stuff (yes, early) occasionally would do dead
  code removal and generate multiple consecutive LO16 entries.
  If this is done for REL entries then it's fine - there's no
  state kept between them.  But gcc 5.x seems to do this for
  RELA entries.

eg:

HI1 LO1 HI2 LO2 LO3 HI4 LO4

.. in this instance, LO2 should affect HI2, but LO3 doesn't at all
affect anything.  The matching HI3 was in code that was deleted
as "dead code".

Then, the next one:

* A "GCC extension" allows for multiple HI entries before a LO entry;
  and all of those HI entries use the first LO entry as their basis
  for RELA offset calculations.

It does this so GCC can also do dead code deletion without necessarily
having to geneate fake relocation entries for balanced HI/LO RELA
entries.

eg:

HI1 LO1 HI2 HI3 HI4 LO4 LO5 HI6 LO6 LO7

in this instance, HI{2,3,4} are the same relocation as LO4 (eg .bss)
and need to be buffered until LO4 - then the RELA offset is applied
from LO4 to HI{2,3,4} calculations.

/And/, the AHL from HI4 is used during the LO4 relocation calculation,
just like in the normal (ie, before this commit) implementation.

Then, LO5 doesn't trigger anything - the HI "buffer" is empty,
so there are no HI relocations to flush out.

HI6/LO6 are normal, and LO7 doesn't trigger any HI updates.

Tested:

* AR9344 SoC, kernel modules, using gcc-5.3 (mips-gcc-5.3.0 package)

Notes:

* Yes, I do feel dirty having written this code.

Reviewed by:	imp (after a handful of "this should be on fire" moments wrt gcc and this code)
2016-08-21 00:48:41 +00:00
Marko Zec
9da85a912d Permit disabling net.inet.udp.require_l2_bcast in VIMAGE kernels.
The default value of the tunable introduced in r304436 couldn't be
effectively overrided on VIMAGE kernels, because instead of being
accessed via the appropriate VNET() accessor macro, it was accessed
via the VNET_NAME() macro, which resolves to the (should-be) read-only
master template of initial values of per-VNET data.  Hence, while the
value of udp_require_l2_bcast could be altered on per-VNET basis, the
code in udp_input() would ignore it as it would always read the default
value (one) from the VNET master template.

Silence from: rstone
2016-08-20 22:12:26 +00:00
Mike Karels
db727c1bd7 Disable L2 caching for UDP over IPv6
The ip6_output routine is missing L2 cache invalication as done
in ip_output.  Even with that code, some problems with UDP over
IPv6 have been reported.  Diabling L2 cache for that problem works
around the problem for now.

PR:		211872 211926
Reviewed by:	gnn
Approved by:	gnn (mentor)
MFC after:	immediate
2016-08-20 20:46:53 +00:00
Robert Watson
70a98c110e Audit the accepted (or rejected) username argument to setlogin(2).
(NB: This was likely a mismerge from XNU in audit support, where the
text argument to setlogin(2) is captured -- but as a text token,
whereas this change uses the dedicated login-name field in struct
audit_record.)

MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2016-08-20 20:28:08 +00:00
Michael Tuexen
e19497672b Unbreak sctp_connectx().
MFC after: 3 days
2016-08-20 20:15:36 +00:00
Robert Watson
c3c0088bb0 Audit additional vnode information in the implementation of the
ftruncate(2) system call.  This was not required by the Common
Criteria, which needed only open-time audit.

MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2016-08-20 18:51:48 +00:00
Toomas Soome
5b6123e31d loader is filling fixed length command_errbuf with sprintf() and is trusting
strings provided by user/config files. This update is replacing sprintf with
snprintf for cases the command_errbuf is built from dynamic content.

PR:		211958
Reported by:	ecturt@gmail.com
Reviewed by:	imp, allanjude
Approved by:	imp (mentor), allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D7563
2016-08-20 16:23:19 +00:00
Andriy Gapon
6975a721d1 JMicron JMB361 has only a single SATA port
Discussed with:	mav
MFC after:	3 days
2016-08-20 09:13:14 +00:00
Justin Hibbits
beacb09864 Skip HID1 initialization on e6500 cores, it doesn't exist.
With this, and some drivers removed, a T2080 dev board boots to mountroot.

Submitted by:	Ivan Krivonos <int0dster_AT_gmail.com>
2016-08-20 00:55:58 +00:00
John Baldwin
21768fa9c0 Remove the ie(4) driver for Intel 82586 ISA Ethernet adapters.
This driver only supports 10Mb Ethernet using PIO (the hardware supports
DMA, but the driver only does PIO).  There are not any PCCard adapters
supported by this driver, only ISA cards.  In addition, it does not use
bus_space but instead uses bcopy with volatile pointers triggering a
host of warnings.  (if_ie.c is one of 3 files always built with
-Wno-error)

Relnotes:	yes
2016-08-20 00:49:29 +00:00
Eric Joyner
ff59a463a3 ixlv(4): Fix ixlv(4) not loading when loaded as a kernel module and netmap is enabled.
Define (unused) netmap variables; ixlv(4) doesn't support netmap yet.

Reported by:	sergey.kozlov@intel.com
Sponsored by:	Intel Corporation
2016-08-20 00:08:10 +00:00
Emmanuel Vadot
bee987e3c8 if_emac: Before generating a random MAC address, try using the SID rootkey
to generate one. This is was U-Boot does to generate a random MAC so we end
up with the same MAC address as if U-Boot did generate it.

MFC after:	1 week
2016-08-19 23:44:07 +00:00
John Baldwin
354b6f0fd9 Remove the spic(4) driver for the Sony Vaoi Jogdial.
This hardware is not present on any modern systems.  The driver is quite
hackish (raw inb/outb instead of bus_space, and raw inb/outb to random
I/O ports to enable ACPI since it predated proper ACPI support).

Relnotes:	yes
2016-08-19 23:39:08 +00:00
John Baldwin
09b9789b28 Remove the wl(4) driver and wlconfig(8) utility.
The wl(4) driver supports pre-802.11 PCCard wireless adapters that
are slower than 802.11b.  They do not work with any of the 802.11
framework and the driver hasn't been reported to actually work in a
long time.

Relnotes:	yes
2016-08-19 22:27:14 +00:00
John Baldwin
64450fdf48 Remove the wds(4) driver for the WD700 ISA SCSI HBA.
While this driver does do DMA, it bounce buffers all transactions through
a single 64k buffer.  It also does not have a manpage.

Relnotes:	yes
2016-08-19 21:51:42 +00:00
John Baldwin
c1c9764296 Remove the si(4) driver and sicontrol(8) for Specialix serial cards.
The si(4) driver supported multiport serial adapters for ISA, EISA, and
PCI buses.  This driver does not use bus_space, instead it depends on
direct use of the pointer returned by rman_get_virtual().  It is also
still locked by Giant and calls for patch testing to convert it to use
bus_space were unanswered.

Relnotes:	yes
2016-08-19 21:14:27 +00:00
John Baldwin
8891240001 Remove the scd(4) driver for Sony CDU31/33 CD-ROM drives.
This is a driver for a pre-ATAPI ISA CD-ROM adapter.  The driver only
uses PIO.
2016-08-19 19:31:55 +00:00
John Baldwin
7f6870434e Move cxgb and cxgbe down to the non-mii PCI NIC section. 2016-08-19 18:45:42 +00:00
Emmanuel Vadot
2d6c6bf704 Keep boot parameters in ARM trampoline code
Currently boot parameters (r0 - r3) are forgotten in ARM trampoline code.
This patch save them at startup and restore them before jumping into kernel
_start() routine.
This is usefull when booting with Linux ABI and/or custom bootloader.

Submitted by:	Grégory Soutadé <soutade@gmail.com>
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D7395
2016-08-19 18:02:36 +00:00
Mark Johnston
e5574e0966 Don't set P2_PTRACE_FSTP in a process that invokes ptrace(PT_TRACE_ME).
Such processes are stopped synchronously by a direct call to
ptracestop(SIGTRAP) upon exec. P2_PTRACE_FSTP causes the exec()ing thread
to suspend itself while waiting for a SIGSTOP that never arrives.

Reviewed by:	kib
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D7576
2016-08-19 17:57:14 +00:00
John Baldwin
bd6ff0807e Reorder sysctls so that nodes shared with the VF driver are added first.
This permits a single early return for VF devices in the routines that
add sysctl nodes.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7512
2016-08-19 17:54:51 +00:00
Ed Schouten
7a3558bed5 Regenerate system call table after r304483. 2016-08-19 17:54:06 +00:00
John Baldwin
301abe0f3f Adjust t4_port_init() to work with VF devices.
Specifically, the FW_PORT_CMD may or may not work for a VF (the PF
driver can choose whether or not to permit access to this command),
so don't attempt to fetch port information on a VF if permission is
denied by the PF.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7511
2016-08-19 17:52:48 +00:00
John Baldwin
577422fc53 Add structures for VF-specific adapter parameters.
While here, mark which parameters are PF-specific and which are
VF-specific.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7508
2016-08-19 17:49:49 +00:00
Ed Schouten
a5c3c5b14f Import the new automatically generated system call table for CloudABI.
Now that we've switched over to using the vDSO on CloudABI, it becomes a
lot easier for us to phase out old features. System call numbering is no
longer something that's part of the ABI. It's fully based on names. As
long as the numbering used by the kernel and the vDSO is consistent
(which it always is), it's all right.

Let's put this to the test by removing a system call (thread_tcb_set())
that's already unused for quite some time now, but was only left intact
to serve as a placeholder. Sync in the new system call table that uses
alphabetic sorting of system calls.

Obtained from:	https://github.com/NuxiNL/cloudabi
2016-08-19 17:49:35 +00:00
Emmanuel Vadot
c8442223b6 Allwinner: Move a10_padconf.c into a10 subdirectory. 2016-08-19 12:48:32 +00:00
Michal Meloun
032bdb1bb4 TEGRA: Remove forgotten debug printf. 2016-08-19 11:12:59 +00:00
Michal Meloun
7709abd109 TEGRA: Implement MSI/MSIX interrupts for pcie controller. 2016-08-19 10:53:17 +00:00
Michal Meloun
895c8b1c39 INTRNG: Rework handling with resources. Partially revert r301453.
- Read interrupt properties at bus enumeration time and store
   it into global mapping table.
 - At bus_activate_resource() time, given mapping entry is resolved and
   connected to real interrupt source. A copy of mapping entry is attached
   to given resource.
 - At bus_setup_intr() time, mapping entry stored in resource is used
   for delivery of requested interrupt configuration.
 - For MSI/MSIX interrupts, mapping entry is created within
   pci_alloc_msi()/pci_alloc_msix() call.
 - For legacy PCI interrupts, mapping entry must be created within
   pcib_route_interrupt() by pcib driver itself.

Reviewed by: nwhitehorn, andrew
Differential Revision: https://reviews.freebsd.org/D7493
2016-08-19 10:52:39 +00:00
Pyun YongHyeon
ac14c068f9 Host controller is byte oriented. Fix wrong assumption on big-endian
systems.

Pointed out by:	hselasky
2016-08-19 10:51:30 +00:00
Sepherosa Ziehau
852710e6db hyperv/hn: Move RXBUF to hn_softc
And don't recreate RXBUF for each primary channel open, it is now
created in device_attach DEVMETHOD and destroyed in device_detach
DEVMETHOD.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7556
2016-08-19 05:43:28 +00:00
Sepherosa Ziehau
d981413bcb hyperv/hn: Remove the useless num_channel
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7555
2016-08-19 05:30:39 +00:00
Sepherosa Ziehau
2a137ab6fd hyperv/hn: Remove assign-only struct field
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7554
2016-08-19 05:20:12 +00:00
Warner Losh
3f04cc100f Improve the pattern matching so that internal *'s work, as well as
[set] notation. This fixes pattern matching for recently added drives
that would set the NCQ Trim being broken incorrectly.

PR: 210686
Tested-by: Tomoaki AOKI
MFC After: 3 days
2016-08-19 04:30:29 +00:00
Sepherosa Ziehau
0366a4a1e0 hyperv/hn: Move NVS version to softc
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7553
2016-08-19 03:32:04 +00:00
Mark Johnston
7f649dda55 Correct a check for P2_PTRACE_FSTP in ptracestop().
MFC after:	1 day
2016-08-19 01:27:24 +00:00
Pyun YongHyeon
b06ccf7919 Fix build on big-endian systems.
Reported by:	bz
2016-08-19 00:50:32 +00:00
Ryan Stone
11f2a7cd67 Fix unlocked access to ifnet address list
in_broadcast() was iterating over the ifnet address list without
first taking an IF_ADDR_RLOCK.  This could cause a panic if a
concurrent operation modified the list.

Reviewed by: bz
MFC after: 2 months
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D7227
2016-08-18 22:59:10 +00:00
Ryan Stone
41029db13f Don't check for broadcast IPs on non-bcast pkts
in_broadcast() can be quite expensive, so skip calling it if the
incoming mbuf wasn't sent to a broadcast L2 address in the first
place.

Reviewed by: gnn
MFC after: 2 months
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D7309
2016-08-18 22:59:05 +00:00
Ryan Stone
90cc51a1ab Don't iterate over the ifnet addr list in ip_output()
For almost every packet that is transmitted through ip_output(),
a call to in_broadcast() was made to decide if the destination
IP was a broadcast address.  in_broadcast() iterates over the
ifnet's address to find a source IP matching the subnet of the
destination IP, and then checks if the IP is a broadcast in that
subnet.

This is completely redundant as we have already performed the
route lookup, so the source IP is already known.  Just use that
address to directly check whether the destination IP is a
broadcast address or not.

MFC after:	2 months
Sponsored By:	EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D7266
2016-08-18 22:59:00 +00:00
Ed Maste
1982043961 vt: fix old keyboard release in CONS_SETKBD
On the first switch we previously released the newly allocated keyboard
instead of the old one. Keyboard state was very confused afterwards for
further keyboard switches.

Submitted by:	bde
2016-08-18 16:22:40 +00:00
George V. Neville-Neil
3e7e23332f Remove the obsolete and unused openbsd_poll system call. (Phase 2)
Reported by:	brooks
Reviewed by:	brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D7548
2016-08-18 10:54:39 +00:00
George V. Neville-Neil
5cba398b0c Remove unusedd and obsolete openbsd_poll system call. (Phase 1)
Reported by:	brooks
Reviewed by:	brooks,jhb
Differential Revision:	https://reviews.freebsd.org/D7548
2016-08-18 10:50:40 +00:00
Bjoern A. Zeeb
db68f7839f Try to fix gcc compilation errors (which are right).
nat64_getlasthdr() returns an int, which can be -1 in case of error,
storing the result in an uint8_t and then comparing to < 0 is not
helpful.  Do what is done in the rest of the code and make proto an
int here as well.
2016-08-18 10:26:15 +00:00
Hans Petter Selasky
7dc445f8d3 Add support for setting blocking and non-blocking mode on /dev/rdma_cm
by returning success on FIONBIO and FIOASYNC IOCTLs. The actual flags
handling is done by the kern_ioctl() function.

Reported by:	Alex Bowden <alex.bowden@outlook.com>
Sponsored by:	Mellanox Technologies
MFC after:	1 week
2016-08-18 08:49:02 +00:00
Pyun YongHyeon
9ab0e2a7e0 When device is detached make sure to stop the controller and make
it return zero-length USB packet.
2016-08-18 07:11:31 +00:00
Pyun YongHyeon
15b5fb58b6 In axge_stop(), clear medium receive enable bit which will stop RX
MAC operation.
2016-08-18 06:46:14 +00:00
Pyun YongHyeon
2948462df8 When usbd_transfer_setup() fails, don't call
usbd_transfer_unsetup().
2016-08-18 06:35:09 +00:00
Pyun YongHyeon
a5d826557f Introduce axge_rxfilter() which configures RX filtering and replace
axge_setmulti()/axge_setpromisc() with axge_rxfilter().
Multicast filter programming and promiscuous mode requires
access to a common RX configuration register so there is no need to
use separate functions with added complexity.  axge_rxfilter() does
not read back AXGE_RCR register since accessing a register in USB
is too slow and we already have all knowledge of required
configuration.  Rebuilding RX filter configuration is simpler and
faster than manipulating every bits after reading back the
register.

Note, axge_rxfilter() does not set RCR_IPE(IP header alignment on
32bit boundary) to disable extra padding bytes insertion.  The
extra padding wastes ethernet to USB host bandwidth as well as
complicating RX handling logic.  Current USB framework requires
copying RX frames to mbufs so there is no need to worry about
alignment.  Previously axge_rx_frame() performed wrong bound check
due to the extra padding and it was broken when RX checksum
offloading is disabled.  See added comment in axge_rx_frame () for
actual RX packet layout.

In axge_init(), disable WOL.  It's meaningless to enable WOL in
normal operation.

In axge_rxeof(), use properly sized mbuf rather than blindly
allocating a mbuf cluster.

Use RX H/W checksum offloading only when administrator requested RX
checksum offloading. Previously it always used RX H/W checksum
offloading result regardless of RX checksum offloading state.

Separate L4 checksum offloading validation from L3 one and properly
set required offloading bits for each layer. This is to fix setting
L4 checksum offloading bits for L3 packets.

There are still lots of RX errors(probably RX FIFO overflows) under
moderate load.  Users are strongly recommended to enable ethernet
flow control.

Reviewed by:	kevlo (initial version), hselasky
2016-08-18 06:29:07 +00:00
Sepherosa Ziehau
5afcbd41b5 hyperv/kvp: Remove unnecessary function parameter.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7550
2016-08-18 06:03:55 +00:00
Sepherosa Ziehau
8caa09bd36 hyperv/hn: Get rid of the useless netvsc_packet
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7544
2016-08-18 05:52:03 +00:00
Sepherosa Ziehau
5aa07ccdd7 hyperv/hn: Constify RNDIS messages on RX path.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7542
2016-08-18 05:44:58 +00:00
Sepherosa Ziehau
83ecbf4d6a hyperv/hn: Pass RX packet info to netvsc_recv.
This paves to nuke netvsc_packet, which does not serves much
purpose now.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7541
2016-08-18 05:33:58 +00:00
Pyun YongHyeon
7c10cf8c28 Switch to TX header format rather than directly manipulating header
structures.  This simplifies mbuf copy operation to USB buffers as
well as improving readability.  The controller supports Microsoft
LSOv1(aka TSO) but this change set does not include the support due
to copying overhead to USB buffers and large amount of memory waste.

Remove useless ZLP padding which seems to come from Linux.  Required
bits the code tried to set was not copied into USB buffer so it had
no effect.  Unlike Linux, FreeBSD USB stack automatically generates
ZLP so no explicit padding is required in driver.[1]

Micro-optimize updating IFCOUNTER_OPACKETS counter by moving it out
of TX loop since updating counter is not cheap operation as it did
long time ago and we already know how many number of packets were
queued after exiting the loop.

While here, fix a checksum offloading bug which will happen when
upper stack computes checksum while H/W checksum offloading is
active.  The controller should be notified to not recompute the
checksum in this case.

Reviewed by:	kevlo (initial version), hselasky
Pointed out by:	hselasky [1]
2016-08-18 05:07:02 +00:00
Pyun YongHyeon
b2cdc7ca6f Rename cryptic RX filter constants with more readable ones.
No functional change.
2016-08-18 04:25:17 +00:00
Pyun YongHyeon
7598bc98ca Don't explicitly call MIIBUS_STATCHG() method handler. Link state
change should be handled by PHY driver.  Some broken PHY H/Ws may
need that workaround but it seems axge(4) don't use such PHYs.
2016-08-18 02:14:39 +00:00
Pyun YongHyeon
a42c5d9fa7 Pass PHY location information and remove PHY access hack. 2016-08-18 01:48:58 +00:00
Adrian Chadd
c7ee5294ca [net80211] correctly lock the ifp before accessing the lladdr.
Tested by: dhw
2016-08-18 01:25:12 +00:00
Toomas Soome
2c55d0903d Add SHA512, skein, large blocks support for loader zfs.
Updated sha512 from illumos.
Using skein from freebsd crypto tree.
Since loader itself is using 64MB memory for heap, updated zfsboot to
use same, and this also allows to support zfs large blocks.

Note, adding additional features does increate zfsboot code, therefore
this update does increase zfsboot code to 128k, also I have ported gptldr.S
update to zfsldr.S to support 64k+ code.

With this update, boot1.efi has almost reached the current limit of the size
set for it, so one of the future patches for boot1.efi will need to
increase the limit.

Currently known missing zfs features in boot loader are edonr and gzip support.

Reviewed by:	delphij, imp
Approved by:	imp (mentor)
Obtained from:	sha256.c update and skein_zfs.c stub from illumos.
Differential Revision:	https://reviews.freebsd.org/D7418
2016-08-18 00:37:07 +00:00
Emmanuel Vadot
d00d8ed84f Rename allwinner_machdep.{c.h} to aw_machdep.{c.h} as all allwinner source
files are name aw_*
2016-08-17 21:44:02 +00:00
Toomas Soome
88fb7b56ea boot1.efi Free() should check for NULL to provide consistent behavior
with libstand Free().

Reviewed by:	imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D7497
2016-08-17 21:29:57 +00:00
Emmanuel Vadot
627ea1e104 Rename kernel config A10 into ALLWINNER_UP as it is intend to work with all
Allwinner Uniprocessor SoC.
As of now it works with A10 and A13 (and possibly R8 as it is the same as the A13).
Move files.a10 into a1o subdirectory as it should be.
Rename std.a10 into std.allwinner_up
2016-08-17 20:32:08 +00:00
Landon J. Fuller
e15461c7e9 mips/broadcom: Implement CFE-based EARLY_PRINTF support.
This adds support for EARLY_PRINTF via the CFE console; the aim is to
provide a fix for the otherwise cyclic dependency between PMU discovery
and console printf/DELAY:

- We need to parse the bhnd(4) core table to determine the address (and
  type) of the PMU/PLL registers and calculate the CPU clock frequency.
- The core table parsing code will emit a printf() if a parse error is
  hit.
- Safely calling printf() without EARLY_PRINTF requires a working
  DELAY+cninit, which means we need the PMU.

Errors in core table parsing shouldn't happen, but lack of EARLY_PRINTF
makes debugging more difficult.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D7498
2016-08-17 20:24:14 +00:00
Andrey V. Elsukov
fdf95c0b81 Teach netisr_get_cpuid() to limit a given value to supported by netisr.
Use netisr_get_cpuid() in netisr_select_cpuid() to limit cpuid value
returned by protocol to be sure that it is not greather than nws_count.

PR:		211836
Reviewed by:	adrian
MFC after:	3 days
2016-08-17 20:21:33 +00:00
Emmanuel Vadot
ee9aaee1ec Add sun5i-a13-olinuxino to the build. 2016-08-17 17:59:09 +00:00
Emmanuel Vadot
b52a0db190 Remove pullup settings for MMC pins, this is not needed since r304290
MFC after:	1 week
2016-08-17 13:19:28 +00:00
Emmanuel Vadot
7dc8d93acb Only set pud settings if this is a pullup or pulldown configuration.
This removes the need to set the MMC pins with pullups in our DTS.
Thanks to jmcneill@ for spotting this.

Tested on Orange Pi One (Allwinner H3).

MFC after:	1 week
2016-08-17 13:09:31 +00:00
Emmanuel Vadot
4943ecf438 a10_gpio_get_function now returns the whole function not only
GPIO_INPUT/GPIO_OUTPUT.
a10_gpio_get_pud now returns the whole pud not only PULLDOWN/PULLUP.
Add a10_gpio_get_drv to get the current drive strenght.
During fdt pin configure, avoid setting function/drive/pud if it's already in
the correct value.

Tested on Allwinner H3 and A20

MFC after:	1 week
2016-08-17 10:20:36 +00:00
Bryan Drewery
b387915115 Garbage collect _umtx_lock(2)/_umtx_unlock(2) references removed in r263318.
This has no real impact on the resulting libc.so file.

MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-08-17 10:20:05 +00:00
Konstantin Belousov
e2a18110f0 Remove duplicated code.
aio_aqueue() calls aio_init_aioinfo() as the first action. There is no
need to duplicate the code in kern_aio_fsync().

Also fix indent for aio_aqueue() definition.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D7523
2016-08-17 10:14:22 +00:00
Konstantin Belousov
1680854946 Implement userspace gettimeofday(2) with HPET timecounter.
Right now, userspace (fast) gettimeofday(2) on x86 only works for
RDTSC.  For older machines, like Core2, where RDTSC is not C2/C3
invariant, and which fall to HPET hardware, this means that the call
has both the penalty of the syscall and of the uncached hw behind the
QPI or PCIe connection to the sought bridge.  Nothing can me done
against the access latency, but the syscall overhead can be removed.
System already provides mappable /dev/hpetX devices, which gives
straight access to the HPET registers page.

Add yet another algorithm to the x86 'vdso' timehands. Libc is updated
to handle both RDTSC and HPET.  For HPET, the index of the hpet device
to mmap is passed from kernel to userspace, index might be changed and
libc invalidates its mapping as needed.

Remove cpu_fill_vdso_timehands() KPI, instead require that
timecounters which can be used from userspace, to provide
tc_fill_vdso_timehands{,32}() methods.  Merge i386 and amd64
libc/<arch>/sys/__vdso_gettc.c into one source file in the new
libc/x86/sys location.  __vdso_gettc() internal interface is changed
to move timecounter algorithm detection into the MD code.

Measurements show that RDTSC even with the syscall overhead is faster
than userspace HPET access.  But still, userspace HPET is three-four
times faster than syscall HPET on several Core2 and SandyBridge
machines.

Tested by:	Howard Su <howard0su@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D7473
2016-08-17 09:52:09 +00:00
Konstantin Belousov
51c762d172 By default, allow all to read the HPET registers pages. At the same
time, by, by default disallow writes to the mmaped HPET pages.

Intent is to allow userspace to use HPET as fast (i.e. no-syscall)
timecounter for gettimeofday(2).  Unfortunately, the permission model
does not make it possible to safely unhide /dev/hpet in the jails even
if default mode is set to 0444, because untrusted jailed root may
change device permissions to writeable.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2016-08-17 09:20:04 +00:00
Sepherosa Ziehau
c4b78a2628 hyperv/util: Factor out helper for IC device_probe DEVMETHOD
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7530
2016-08-17 08:38:49 +00:00
Emmanuel Vadot
393fb50cbc Correctly print and cast u_int64_t and off_t.
Reported by:	ed, imp
MFC after:	1 week
2016-08-17 08:29:30 +00:00
Sepherosa Ziehau
eacbe92463 hyperv/util: Don't reference hn_softc in KVP
hn_softc is private data struct.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7519
2016-08-17 08:26:08 +00:00
Sepherosa Ziehau
bf965e6dee hyperv/hn: Get rid of unused bits
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7518
2016-08-17 05:57:10 +00:00
Sepherosa Ziehau
85c8f64b0b hyperv/hn: Remove reference to nvsp_status
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7517
2016-08-17 05:45:57 +00:00
Sepherosa Ziehau
8b55644bae hyperv/hn: Remove reference to nvsp_msg
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7516
2016-08-17 05:34:02 +00:00
Sepherosa Ziehau
5f0dee26f1 hyperv/hn: Simplify RNDIS RX packets acknowledgement.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7515
2016-08-17 05:25:47 +00:00
Sepherosa Ziehau
46911ec745 hyperv/hn: Ignore the useless TX table.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7514
2016-08-17 05:14:26 +00:00
Sepherosa Ziehau
86afc9b625 hyperv/storvsc: Deliver CAM_SEL_TIMEOUT upon SRB status error.
SRB status is set to 0x20 by the hypervisor, if the specified LUN is
unaccessible, and even worse the INQUIRY response will not be set by
the hypervisor at all under this situation.  Additionally, SRB status
is 0x20 too, for TUR on an unaccessible LUN.

Deliver CAM_SEL_TIMEOUT to CAM upon SRB status errors as suggested by
Scott Long, other values seems improper.

This commit fixes the Hyper-V disk hotplug support.

Submitted by:	Hongjiang Zhang <honzhan microsoft com>
MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7521
2016-08-17 05:02:18 +00:00
David C Somayajulu
00caeec74a Add support for set/get cam search mode
MFC after: 5 days
2016-08-17 02:40:17 +00:00
David C Somayajulu
80e3aec68c Add ql_minidump.h
MFC after:5 days
2016-08-17 01:57:58 +00:00
David C Somayajulu
6a62bec0cd Upgrade fw, bootloader and minidump template to version 5.4.58
Add minidump retrieval code

MFC after: 5 days
2016-08-17 01:56:37 +00:00
Eric van Gyzen
991d431fa8 PCIe HotPlug: Detect bridges that are not really HotPlug capable
Some devices report that they have an MRL when they actually
do not.  Since they always report that the MRL is open, child
devices would be ignored.  Try to detect these devices and
ignore their claim of HotPlug support.  Specifically,
if there is an open MRL but the Data Link Layer is active,
the MRL is not real.

Revert r303645 to re-enable HotPlug support for slots with
power controllers, since it works correctly in my testing.

Start the DLL state-change timer if Presence /or/ MRL state changes,
along with other conditions.  Previously, we started the timer iff
Presence changed.  If there is an MRL, it must be closed for power
to be turned on, so Presence is unlikely to change on an MRL-close event.

Add a printf() of interesting registers on HotPlug interrupts and
commands (one from erj@).  These were very useful for debugging.
Guard them with bootverbose, since they're spam in normal operation.

In collaboration with:	jhb
Reviewed by:	jhb
MFC after:	1 day
Relnotes:	yes (re-enable HotPlug support for slots with power controllers)
Sponsored by:	Dell Inc.
Differential Revision:	https://reviews.freebsd.org/D7509
2016-08-17 01:24:34 +00:00
Gleb Smirnoff
dc4ee9a895 Fix a stupid typo (or copy/paste buffer malfunction). 2016-08-16 23:00:22 +00:00
Gleb Smirnoff
c0f50fa012 We should not be allowing a timeout to reset when a drain is in progress on
it (either async or sync drain).

At this moment the only user of drain is TCP, but TCP wouldn't reschedule a
callout after it has drained it, since it drains only when a tcpcb is closed.
This for now the problem isn't observed.

Submitted by:	rrs
2016-08-16 21:55:34 +00:00
Landon J. Fuller
1728aef23d bhnd(4): Implement NVRAM support required for PMU bring-up.
- Added a generic bhnd_nvram_parser API, with support for the TLV format
  used on WGT634U devices, the standard BCM NVRAM format used on most
  modern devices, and the "board text file" format used on some hardware
  to supply external NVRAM data at runtime (e.g. via an EFI variable).

- Extended the bhnd_bus_if and bhnd_nvram_if interfaces to support both
  string-based and primitive data type variable access, required for
  common behavior across both SPROM and NVRAM data sources.
- Extended the existing SPROM implementation to support the new
  string-based NVRAM APIs.

- Added an abstract bhnd_nvram driver, implementing the bhnd_nvram_if
  atop the bhnd_nvram_parser API.
- Added a CFE-based bhnd_nvram driver to provide read-only access to
  NVRAM data on MIPS SoCs, pending implementation of a flash-aware
  bhnd_nvram driver.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D7489
2016-08-16 21:32:05 +00:00
Landon J. Fuller
9dfeb4140c bhndb(4): Drop MIPS-incompatible __builtin_ctz dependency.
This replaces the bitfield representation of the bhndb register window
freelist with the bitstring API, eliminating a dependency on
(MIPS-unsupported) __builtin_ctz().

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D7495
2016-08-16 21:20:05 +00:00
Kirk McKusick
988fd417a0 Bug 211013 reports that a write error to a UFS filesystem running
with softupdates panics the kernel. The problem that has been pointed
out is that when there is a transient write error on certain metadata
blocks, specifically directory blocks (PAGEDEP), inode blocks
(INODEDEP), indirect pointer blocks (INDIRDEPS), and cylinder group
(BMSAFEMAP, but only when journaling is enabled), we get a panic
in one of the routines called by softdep_disk_io_initiation that
the I/O is "already started" when we retry the write.

These dependency types potentially need to do roll-backs when called
by softdep_disk_io_initiation before doing a write and then a
roll-forward when called by softdep_disk_write_complete after the
I/O completes.  The panic happens when there is a transient error.
At the top of softdep_disk_write_complete we check to see if the
write had an error and if an error occurred we just return.  This
return is correct most of the time because the main role of the routines
called by softdep_disk_write_complete is to process the now-completed
dependencies so that the next I/O steps can happen.

But for the four types listed above, they do not get to do their
rollback operations. This causes the panic when softdep_disk_io_initiation
gets called on the second attempt to do the write and the roll-back
routines find that the roll-backs have already been done. As an
aside I note that there is also the problem that the buffer will
have been unlocked and thus made visible to the filesystem and to
user applications with the roll-backs in place.

The way to resolve the problem is to add a flag to the routines called
by softdep_disk_write_complete for the four dependency types noted
that indicates whether the write was successful (WRITESUCCEEDED).
If the write does not succeed, they do just the roll-backs and then
return. If the write was successful they also do their usual
processing of the now-completed dependencies.

The fix was tested by selectively injecting write errors for buffers
holding dependencies of each of the four types noted above and then
verifying that the kernel no longer paniced and that following the
successful retry of the write that the filesystem could be unmounted
and successfully checked cleanly.

PR: 211013
Reviewed by: kib
2016-08-16 21:02:30 +00:00
Mark Johnston
915a263ea2 Remove prototypes missed in r303951. 2016-08-16 19:43:17 +00:00
Konstantin Belousov
948137db10 In UFS_BALLOC(), invalidate pages of indirect buffers on failed block
allocation unwinding.

Dandling buffers are released on UFS_BALLOC() failure to ensure that
later attempt to allocate blocks in close range do not find the blocks
with invalid content, since possible partial block allocations are
unwound.  As such, it is not enough to just release the buffers, the
pages must also invalidated and removed from the vnode vm_object
queue.  Otherwise the pages might be found later and used to
reconstruct indirect buffers when doing allocations at offset close to
the failure point, and their stale content compromise the filesystem
integrity.

Note that just marking the buffer as B_INVAL is not enough, B_NOCACHE
is required.  To be sure, clear the B_CACHE flag as well.  This
complements the r174973, which started releasing buffers.

Reported and tested by:	pho
Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-16 17:30:58 +00:00
Konstantin Belousov
2da4bcb82b On unwind after failed block allocation in ffs_balloc_ufs{1,2}, assert
that recorded allocated blocks numbers match the physical block
numbers of dandling buffers which are released.

When finally freeing the blocks during unwind, assert that dandling
buffers where not re-allocated.  They shouldn't, because the vnode lock
is owned exclusive.

Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-16 17:18:38 +00:00
Kirk McKusick
65d3199746 Add two new macros, SLIST_CONCAT and LIST_CONCAT. Note in both the
queue.h header file and in the queue.3 manual page that they are O(n)
so should be used only in low-usage paths with short lists (otherwise
an STAILQ or TAILQ should be used).

Reviewed by: kib
2016-08-16 17:07:48 +00:00
Konstantin Belousov
39f7cbe9ab When looking up dandling buffers for unwing after failing block
allocation in UFS_BALLOC(), there is no need to map them.

Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-16 17:05:15 +00:00
Konstantin Belousov
554248587e When block allocation fails in UFS_BALLOC(), and the volume does not
have SU enabled, there is no point in calling softdep_request_cleanup().

The call cannot produce free blocks, but we unecessarily lock ufsmount
and do inode block write.  Usual point of not doing optimizations for
the corner case of the full volume is not applicable there, the work
is easily avoidable, and the addition CPU and disk io load do not lead
to succeeding retry.

Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-16 16:50:48 +00:00
Konstantin Belousov
f1503c5a49 In ffs_balloc_ufs{1,2} routines, assert that unwind records do not
overflow local arrays.  This is not immediately obvious from the
static code inspection, due to retry logic.

Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-16 16:49:56 +00:00
Randall Stewart
eadd00f81a A few more wording tweaks as suggested (with some modifications
as well) by Ravi Pokala. Thanks for the comments :-)
Sponsored by: Netflix Inc.
2016-08-16 15:17:36 +00:00
Randall Stewart
587d67c008 Here we update the modular tcp to be able to switch to an
alternate TCP stack in other then the closed state (pre-listen/connect).
The idea is that *if* that is supported by the alternate stack, it
is asked if its ok to switch. If it approves the "handoff" then we
allow the switch to happen. Also the fini() function now gets a flag
to tell if you are switching away *or* the tcb is destroyed. The
init() call into the alternate stack is moved to the end so the
tcb is more fully formed before the init transpires.

Sponsored by:	Netflix Inc.
Differential Revision:	D6790
2016-08-16 15:11:46 +00:00
Emmanuel Vadot
858a3f496f Only use WaitForKeys event if it exists, this is not the case in u-boot efi implementation.
Reviewed by:	jhb, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D6781
2016-08-16 14:33:25 +00:00
Emmanuel Vadot
5f306327fe Use %ju modifier for u_int64_t and %jd modifier for off_t.
off_t is long long on arm32 and long on amd64

MFC after:	1 week
2016-08-16 14:23:35 +00:00
Randall Stewart
0fa047b98c Comments describing how to properly use the new lock_add functions
and its respective companion.

Sponsored by:	Netflix Inc.
2016-08-16 13:08:03 +00:00
Randall Stewart
b07fef500b This cleans up the timer code in TCP and also makes it so we do not
take the INFO lock *unless* we are really going to delete the TCB.

Differential Revision:	D7136
2016-08-16 12:40:56 +00:00
Adrian Chadd
b0754a31cf [mips] fix use-before-initialised.
Found by: gcc-5.3
2016-08-16 07:51:05 +00:00
Sepherosa Ziehau
de56155fe0 hyperv/hn: Simplify RNDIS message checks on RX path.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7502
2016-08-16 07:45:35 +00:00
Sepherosa Ziehau
62c4e6e992 hyperv/hn: Simplify RNDIS NVS message sending.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7501
2016-08-16 07:37:02 +00:00
Sepherosa Ziehau
5ac4acb202 hyperv/hn: Factor out hn_nvs_send/hn_nvs_send_sglist
Avoid unnecessary message type setting and centralize the send context
to transaction id cast.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7500
2016-08-16 07:26:53 +00:00
Sepherosa Ziehau
8452c1b345 tcp/lro: Make # of LRO entries tunable
Reviewed by:	hps, gallatin
Obtained from:	rrs, gallatin
MFC after:	2 weeks
Sponsored by:	Netflix (rrs, gallatin), Microsoft (sephe)
Differential Revision:	https://reviews.freebsd.org/D7499
2016-08-16 06:40:27 +00:00
Mark Johnston
59ceeddecf MFV r301526:
7035 string-related subroutines should validate input earlier

Reviewed by: Alex Wilson <alex.wilson@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Patrick Mooney <pmooney@pfmooney.com>

illumos/illumos-gate@771e39c3b1

MFC after:	2 weeks
2016-08-16 02:25:19 +00:00
Mark Johnston
f66200ee22 MFV r301525:
7033 ustack helper should fault on bad return values

Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Alex Wilson <alex.wilson@joyent.com>

illumos/illumos-gate@a2f72b65eb

MFC after:	2 weeks
2016-08-16 02:20:02 +00:00
Mark Johnston
4aea8f31b1 MFV r301524:
7034 negative record sizes should be rejected

Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Alex Wilson <alex.wilson@joyent.com>

illumos/illumos-gate@0b8049bfb0

MFC after:	2 weeks
2016-08-16 02:18:34 +00:00
Mark Johnston
b7125fa9cd MFV r296989:
6734 dtrace_canstore_statvar() fails for some valid static variables

Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bryan Cantrill <bryan@joyent.com>

illumos/illumos-gate@d65f2bb4e5

MFC after:	2 weeks
2016-08-16 02:16:54 +00:00
John Baldwin
061ae3c519 Remove the mcd(4) driver for Mitsumi CD-ROM players.
This is a driver for a pre-ATAPI ISA CD-ROM adapter.  As noted in
the manpage, this driver is only useful as a backend to cdcontrol to
play audio CDs since it doesn't use DMA, so its data performance is
"abysmal" (and that was true in the mid 90's).
2016-08-15 20:38:02 +00:00
Bruce Evans
79ef07d4c0 Clean up the new sc cn open and close functions (old sc cn grab and ungrab
functions).  Mainly, spell sc as itself instead of as scp->sc.
2016-08-15 20:17:48 +00:00
Ed Schouten
93d9ebd82e Eliminate use of sys_fsync() and sys_fdatasync().
Make the kern_fsync() function public, so that it can be used by other
parts of the kernel. Fix up existing consumers to make use of it.

Requested by:	kib
2016-08-15 20:11:52 +00:00
Eric Badger
b0f2185bbe sem_post(): wake up the sleeper only after adjusting has_waiters
If the caller of sem_post() wakes up a thread sleeping via sem_wait()
before it clears the has_waiters flag, the caller of sem_wait() has no way of
knowing when it is safe to destroy the semaphore and reuse the memory. This is
because the caller of sem_post() may be interrupted between the wake step and
the clearing of has_waiters. It will then write into the has_waiters flag in
userspace after being preempted for some unknown amount of time.

Reviewed by:	jhb, kib, vangyzen
Approved by:	kib (mentor), vangyzen (mentor)
MFC after:	2 weeks
Sponsored by:	Dell Inc.
Differential Revision:	https://reviews.freebsd.org/D7505
2016-08-15 20:09:09 +00:00
Ed Schouten
2256eed3eb Let CloudABI use fdatasync() as well.
Now that FreeBSD supports fdatasync() natively, we can tidy up
CloudABI's equivalent system call to use that instead.
2016-08-15 19:42:21 +00:00
Bruce Evans
43e5b7b6b3 Restructure the grabbing functions into mere wrappers of new open and
close functions.  Scattered calls to sc_cnputc() and sc_cngetc() were
broken by turning the semi-reentrant inline context-switching code in
these functions into the grabbing functions.  cncheckc() calls for
panic dumps are the main broken case.  The grabbing functions have
special behaviour (mainly screen switching in sc_cngrab()) which makes
them unsuitable as replacements for the inline code.
2016-08-15 19:37:18 +00:00
Konstantin Belousov
2f514f92cf Implement VOP_FDATASYNC() for UFS.
Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D7471
2016-08-15 19:22:23 +00:00
Konstantin Belousov
47e61f6cc6 Implement VOP_FDATASYNC() for msdosfs.
Standard VOP_FSYNC() implementation just syncs data buffers, and due
to this, is the correct and efficient implementation for msdosfs or
any other filesystem which uses bufer cache trivially.  Provide
globally visible wrapper vop_stdfdatasync_buf() for future consumption
by other filesystems.

Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D7471
2016-08-15 19:17:00 +00:00
Konstantin Belousov
1d2537a26a Regen after r304176, fdatasync(2) addition. 2016-08-15 19:15:46 +00:00
Konstantin Belousov
295af703a0 Add an implementation of fdatasync(2).
The syscall is a trivial wrapper around new VOP_FDATASYNC(), sharing
code with fsync(2).  For all filesystems, this commit provides the
implementation which delegates the work of VOP_FDATASYNC() to
VOP_FSYNC().  This is functionally correct but not efficient.

This is not yet POSIX-compliant implementation, because it does not
ensure that queued AIO requests are completed before returning.

Reviewed by:	mckusick
Discussed with:	avg (ZFS), jhb (AIO part)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D7471
2016-08-15 19:08:51 +00:00
Konstantin Belousov
c73fb33115 VOP_FSYNC() does not take cred as an argument. Correct comment.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-15 18:55:33 +00:00
Bruce Evans
430320729d Fix restoring the kbd_mode part of the keyboard state in grab/ungrab.
Simply change the mode to K_XLATE using a local variable and use the
grab level as a flag to tell screen switches not to change it again,
so that we don't need to switch scp->kbd_mode.  We did the latter,
but didn't have the complications to update the keyboard mode switch
for every screen switch.  sc->kbd_mode remains at its user setting
for all scp's and ungrabbing restores to it.
2016-08-15 18:02:37 +00:00
John Baldwin
8b2246b349 Add support for register dumps on VF devices.
- Add handling of VF register sets to t4_get_regs_len() and t4_get_regs().
- While here, use t4_get_regs_len() in the ioctl handler for regdump
  instead of inlining it.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7484
2016-08-15 17:42:54 +00:00
John Baldwin
e5e9897c5f Update mailbox writes to work with VF devices.
- Use alternate register locations for the data and control registers for
  VFs.
- Do a dummy read to force the writes to the  mailbox data registers to
  post before the write to the control register on VFs.
- Do not check the PCI-e firmware register for errors on VFs.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7483
2016-08-15 17:41:34 +00:00