]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoUse full month in dpv(3), figpar(3), and bsdconfig(8) manuals
Devin Teske [Wed, 14 Mar 2018 19:09:06 +0000 (19:09 +0000)]
Use full month in dpv(3), figpar(3), and bsdconfig(8) manuals

Reported by: maxim

6 years agoFix typo in a warning message.
Edward Tomasz Napierala [Wed, 14 Mar 2018 18:27:06 +0000 (18:27 +0000)]
Fix typo in a warning message.

MFC after: 2 weeks

6 years agoFix fat-fingering ("optional standard") and move all the OF code to
Nathan Whitehorn [Wed, 14 Mar 2018 18:07:40 +0000 (18:07 +0000)]
Fix fat-fingering ("optional standard") and move all the OF code to
being marked "standard", which is less confusing than having it conditional
on AIM CPUs here, and then picked up through options FDT from conf/files
on Book-E.

Request by: jhibbits

6 years agoCreate a sysctl kern.cam.{,a,n}da.X.invalidate
Warner Losh [Wed, 14 Mar 2018 17:53:37 +0000 (17:53 +0000)]
Create a sysctl kern.cam.{,a,n}da.X.invalidate

kern.cam.{,a,n}da.X.invalidate=1 forces *daX to detach by calling
cam_periph_invalidate on the underlying periph. This is for testing
purposes only. Include only with options CAM_TEST_FAILURE and rename
the former [AN]DA_TEST_FAILURE, and fix nda to compile with it set.
We're using it at work to harden geom and the buffer cache to be
resilient in the face of drive failure. Today, it far too often
results in a panic. While much work was done on SIM initiated removal
for the USB thumnb drive removal work, little has been done for periph
initiated removal. This simulates what *daerror() does for some errors
nicely: we get the same panics with it that we do with failing drives.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D14581

6 years agoThis should have been += so clean builds work.
Warner Losh [Wed, 14 Mar 2018 16:45:04 +0000 (16:45 +0000)]
This should have been += so clean builds work.

Noticed by: hps@

6 years agoFix inverted logic that counted all completions as errors, except when
Warner Losh [Wed, 14 Mar 2018 16:44:57 +0000 (16:44 +0000)]
Fix inverted logic that counted all completions as errors, except when
they were actual errors.

Sponsored by: Netflix

6 years agoImplement trim collapsing in nda
Warner Losh [Wed, 14 Mar 2018 16:44:50 +0000 (16:44 +0000)]
Implement trim collapsing in nda

When multiple trims are in the queue, collapse them as much as
possible. At present, this usually results in only a few trims being
collapsed together, but more work on that will make it possible to do
hundreds (up to some configurable max).

Sponsored by: Netflix

6 years agoAllow NULL ccb to cam_iosched_bio_complete
Warner Losh [Wed, 14 Mar 2018 16:44:16 +0000 (16:44 +0000)]
Allow NULL ccb to cam_iosched_bio_complete

When the ccb is NULL to cam_iosched_bio_complete, just update the
other statistics, but not the time. If many operations are collapsed
together, this is needed to keep stats properly for the grouped bp.
This should fix trim accounting.

Sponsored by: Netflix

6 years agoThe expression (aim | fdt) is always true on PowerPC. The last PowerPC
Nathan Whitehorn [Wed, 14 Mar 2018 16:16:25 +0000 (16:16 +0000)]
The expression (aim | fdt) is always true on PowerPC. The last PowerPC
platform that can run without a device tree (PS3) still uses the OF_*()
functions to check if one exists and OF_* is used unconditionally in
core parts of the system like powerpc/machdep.c. Reflect this reality
in files.powerpc, for example by changing occurrences of aim | fdt to
standard.

6 years agopkgbase: Fix post-install script for kernel packages
Kyle Evans [Wed, 14 Mar 2018 14:45:57 +0000 (14:45 +0000)]
pkgbase: Fix post-install script for kernel packages

kernel.ucl uses a hardcoded boot/kernel for kldxref, which is the incorrect
directory when we're installing extra kernels that aren't the "default"
kernel (placed at boot/kernel).

Fix this by instead using a new %KERNELDIR% that we now replace in
Makefile.inc1 with "kernel" for the default kernel and "kernel.${_kernel}"
for these extra kernels so that, e.g. /boot/kernel.SHIVA, will get properly
kldxref'd upon update and avoid outdated linker.hints.

Reviewed by: gjb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14689

6 years agoRemove stray ; at end of linux_vdso_deinstall()
Ed Maste [Wed, 14 Mar 2018 13:20:36 +0000 (13:20 +0000)]
Remove stray ; at end of linux_vdso_deinstall()

6 years agoPowerNV: Fix I2C to compile if FDT is disabled
Wojciech Macek [Wed, 14 Mar 2018 09:20:03 +0000 (09:20 +0000)]
PowerNV: Fix I2C to compile if FDT is disabled

Submitted by:          Wojciech Macek <wma@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies

6 years agoUpdate to Zstandard 1.3.3
Conrad Meyer [Wed, 14 Mar 2018 03:00:17 +0000 (03:00 +0000)]
Update to Zstandard 1.3.3

Includes patch to conditionalize use of __builtin_clz(ll) on __has_builtin().
The issue is tracked upstream at https://github.com/facebook/zstd/pull/884 .
Otherwise, these are vanilla Zstandard 1.3.3 files.

Note that the 1.3.4 release should be due out soon.

Sponsored by: Dell EMC Isilon

6 years agoubldr: Bump heap size from 512K to 1M
Kyle Evans [Wed, 14 Mar 2018 02:35:49 +0000 (02:35 +0000)]
ubldr: Bump heap size from 512K to 1M

lualoader in itself only uses another ~200K, but there seems to be no reason
not to bump it a little higher to give us some more wiggle room.

With this, I can boot using a menu-enabled lualoader, no problem and
reasonably fast. Some heap usage datapoints from the review:

forthloader, no menus, kernel loaded:
heap base at 0x1203d5b0, top at 0x1208e000, used 330320

lualoader, no menus, kernel loaded:
heap base at 0x42050028, top at 0x420ab000, used 372696

lualoader, menus, kernel loaded:
heap base at 0x42050028, top at 0x420d5000, used 544728

Since then, the no menu case for lualoader should have decreased slightly as
I've made some changes to make sure that it no longer loads any of th emenu
bits with beastie disabled.

While here, split heap size out into a HEAP_SIZE macro.

Reviewed by: ian, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14471

6 years agocxgbetool(8): Add the ability to decode hardware TCBs.
Navdeep Parhar [Wed, 14 Mar 2018 00:04:58 +0000 (00:04 +0000)]
cxgbetool(8): Add the ability to decode hardware TCBs.

Obtained from: Chelsio Communications
MFC after: 1 week
Sponsored by: Chelsio Communications

6 years agoInstall files added in SVN's r295373, r295457, r295542
Devin Teske [Tue, 13 Mar 2018 23:37:33 +0000 (23:37 +0000)]
Install files added in SVN's r295373, r295457, r295542

Reported by: woodsb02
MFC after: 3 days
X-MFC to: stable/11

6 years agoWe need opt_compat.h after r330819 and 330820.
Warner Losh [Tue, 13 Mar 2018 23:36:15 +0000 (23:36 +0000)]
We need opt_compat.h after r330819 and 330820.

Add opt_compat.h to fix the stand-alone build case.

Sponsored by: Netflix.

6 years agoSupport for TLS offload of TOE connections on T6 adapters.
John Baldwin [Tue, 13 Mar 2018 23:05:51 +0000 (23:05 +0000)]
Support for TLS offload of TOE connections on T6 adapters.

The TOE engine in Chelsio T6 adapters supports offloading of TLS
encryption and TCP segmentation for offloaded connections.  Sockets
using TLS are required to use a set of custom socket options to upload
RX and TX keys to the NIC and to enable RX processing.  Currently
these socket options are implemented as TCP options in the vendor
specific range.  A patched OpenSSL library will be made available in a
port / package for use with the TLS TOE support.

TOE sockets can either offload both transmit and reception of TLS
records or just transmit.  TLS offload (both RX and TX) is enabled by
setting the dev.t6nex.<x>.tls sysctl to 1 and requires TOE to be
enabled on the relevant interface.  Transmit offload can be used on
any "normal" or TLS TOE socket by using the custom socket option to
program a transmit key.  This permits most TOE sockets to
transparently offload TLS when applications use a patched SSL library
(e.g. using LD_LIBRARY_PATH to request use of a patched OpenSSL
library).  Receive offload can only be used with TOE sockets using the
TLS mode.  The dev.t6nex.0.toe.tls_rx_ports sysctl can be set to a
list of TCP port numbers.  Any connection with either a local or
remote port number in that list will be created as a TLS socket rather
than a plain TOE socket.  Note that although this sysctl accepts an
arbitrary list of port numbers, the sysctl(8) tool is only able to set
sysctl nodes to a single value.  A TLS socket will hang without
receiving data if used by an application that is not using a patched
SSL library.  Thus, the tls_rx_ports node should be used with care.
For a server mostly concerned with offloading TLS transmit, this node
is not needed as plain TOE sockets will fall back to software crypto
when using an unpatched SSL library.

New per-interface statistics nodes are added giving counts of TLS
packets and payload bytes (payload bytes do not include TLS headers or
authentication tags/MACs) offloaded via the TOE engine, e.g.:

dev.cc.0.stats.rx_tls_octets: 149
dev.cc.0.stats.rx_tls_records: 13
dev.cc.0.stats.tx_tls_octets: 26501823
dev.cc.0.stats.tx_tls_records: 1620

TLS transmit work requests are constructed by a new variant of
t4_push_frames() called t4_push_tls_records() in tom/t4_tls.c.

TLS transmit work requests require a buffer containing IVs.  If the
IVs are too large to fit into the work request, a separate buffer is
allocated when constructing a work request.  This buffer is associated
with the transmit descriptor and freed when the descriptor is ACKed by
the adapter.

Received TLS frames use two new CPL messages.  The first message is a
CPL_TLS_DATA containing the decryped payload of a single TLS record.
The handler places the mbuf containing the received payload on an
mbufq in the TOE pcb.  The second message is a CPL_RX_TLS_CMP message
which includes a copy of the TLS header and indicates if there were
any errors.  The handler for this message places the TLS header into
the socket buffer followed by the saved mbuf with the payload data.
Both of these handlers are contained in tom/t4_tls.c.

A few routines were exposed from t4_cpl_io.c for use by t4_tls.c
including send_rx_credits(), a new send_rx_modulate(), and
t4_close_conn().

TLS keys for both transmit and receive are stored in onboard memory
in the NIC in the "TLS keys" memory region.

In some cases a TLS socket can hang with pending data available in the
NIC that is not delivered to the host.  As a workaround, TLS sockets
are more aggressive about sending CPL_RX_DATA_ACK messages anytime that
any data is read from a TLS socket.  In addition, a fallback timer will
periodically send CPL_RX_DATA_ACK messages to the NIC for connections
that are still in the handshake phase.  Once the connection has
finished the handshake and programmed RX keys via the socket option,
the timer is stopped.

A new function select_ulp_mode() is used to determine what sub-mode a
given TOE socket should use (plain TOE, DDP, or TLS).  The existing
set_tcpddp_ulp_mode() function has been renamed to set_ulp_mode() and
handles initialization of TLS-specific state when necessary in
addition to DDP-specific state.

Since TLS sockets do not receive individual TCP segments but always
receive full TLS records, they can receive more data than is available
in the current window (e.g. if a 16k TLS record is received but the
socket buffer is itself 16k).  To cope with this, just drop the window
to 0 when this happens, but track the overage and "eat" the overage as
it is read from the socket buffer not opening the window (or adding
rx_credits) for the overage bytes.

Reviewed by: np (earlier version)
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D14529

6 years agoFix typo that misteriously passes compilation.
Gleb Smirnoff [Tue, 13 Mar 2018 22:54:29 +0000 (22:54 +0000)]
Fix typo that misteriously passes compilation.

6 years agoSimplify error handling in t4_tom.ko module loading.
John Baldwin [Tue, 13 Mar 2018 21:42:38 +0000 (21:42 +0000)]
Simplify error handling in t4_tom.ko module loading.

- Change t4_ddp_mod_load() to return void instead of always returning
  success.  This avoids having to pretend to have proper support for
  unloading when only part of t4_tom_mod_load() has run.
- If t4_register_uld() fails, don't invoke t4_tom_mod_unload() directly.
  The module handling code in the kernel invokes MOD_UNLOAD on a module
  whose MOD_LOAD fails with an error already.

Reviewed by: np (part of a larger patch)
MFC after: 1 month
Sponsored by: Chelsio Communications

6 years agomd_pad is used by MDIOCLIST and not available for future use.
Brooks Davis [Tue, 13 Mar 2018 20:54:18 +0000 (20:54 +0000)]
md_pad is used by MDIOCLIST and not available for future use.

MFC after: 1 week

6 years agoDon't overflow the kernel struct mdio in the MDIOCLIST ioctl.
Brooks Davis [Tue, 13 Mar 2018 20:39:06 +0000 (20:39 +0000)]
Don't overflow the kernel struct mdio in the MDIOCLIST ioctl.

Always terminate the list with -1 and document the ioctl behavior.
This preserves existing behavior as seen from userspace with the
addition of the unconditional termination which will not be seen by
working consumers of MDIOCLIST.

Because this ioctl can only be performed by root (in default
configurations) and is not used in the base system this bug is not
deemed to warrant either a security advisory or an eratta notice.

Reviewed by: kib
Obtained from: CheriBSD
Discussed with: security-officer (gordon)
MFC after: 3 days
Security: kernel heap buffer overflow
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14685

6 years agoFix lint/igor warnings
Devin Teske [Tue, 13 Mar 2018 20:35:32 +0000 (20:35 +0000)]
Fix lint/igor warnings

6 years agoFix typo and lint/igor warnings
Devin Teske [Tue, 13 Mar 2018 20:31:07 +0000 (20:31 +0000)]
Fix typo and lint/igor warnings

6 years agoFix ISP_FC_LIP and ISP_RESCAN on big-endian 64-bit systems.
Brooks Davis [Tue, 13 Mar 2018 19:56:10 +0000 (19:56 +0000)]
Fix ISP_FC_LIP and ISP_RESCAN on big-endian 64-bit systems.

For _IO() ioctls, addr is a pointer to uap->data which is a caddr_t.
When the caddr_t stores an int, dereferencing addr as an (int *) results
in truncation on little-endian 64-bit systems and corruption (owing to
extracting top bits) on big-endian 64-bit systems. In practice the
value of chan was probably always zero on systems of the latter type as
all such FreeBSD platforms use a register-based calling convention.

Reviewed by: mav
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14673

6 years agoAdd "usbconfig dump_all_desc", a subcommand to dump all device and config
Edward Tomasz Napierala [Tue, 13 Mar 2018 19:49:06 +0000 (19:49 +0000)]
Add "usbconfig dump_all_desc", a subcommand to dump all device and config
descriptors.

Reviewed by: hselasky@
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoAdd a "jail" keyword to list the name of a jail rather than its ID.
John Baldwin [Tue, 13 Mar 2018 18:30:26 +0000 (18:30 +0000)]
Add a "jail" keyword to list the name of a jail rather than its ID.

Inspired by: mwlucas
Reviewed by: jamie
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14683

6 years agoRevert the chunk from r330410 in vm_page_reclaim_run().
Konstantin Belousov [Tue, 13 Mar 2018 18:27:23 +0000 (18:27 +0000)]
Revert the chunk from r330410 in vm_page_reclaim_run().

There, the pages freed might be managed but the page's lock is not
owned.  For KPI correctness, the page lock is requried around the call
to vm_page_free_prep(), which is asserted.  Reclaim loop already did
the work which could be done by vm_page_free_prep(), so the lock is
not needed and the only consequence of not owning it is the assert
trigger.

Instead of adding the locking to satisfy the assert, revert to the
code that calls vm_page_free_phys() directly.

Reported by: pho
Discussed with: jeff
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoRestore missing temporary variable, deleted by accident in r330845. This
Nathan Whitehorn [Tue, 13 Mar 2018 18:24:21 +0000 (18:24 +0000)]
Restore missing temporary variable, deleted by accident in r330845. This
unbreaks the ppc32 AIM build.

Reported by: jhibbits

6 years agoEFIRT: SetVirtualAddressMap with 1:1 mapping after exiting boot services
Kyle Evans [Tue, 13 Mar 2018 17:10:52 +0000 (17:10 +0000)]
EFIRT: SetVirtualAddressMap with 1:1 mapping after exiting boot services

This fixes a problem encountered on the Lenovo Thinkpad X220/Yoga 11e where
runtime services would try to inexplicably jump to other parts of memory
where it shouldn't be when attempting to enumerate EFI vars, causing a
panic.

The virtual mapping is enabled by default and can be disabled by setting
efi_disable_vmap in loader.conf(5).

Reviewed by: kib (earlier version)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D14677

6 years agoUse C99 boolean type for translate_osrel
Ed Maste [Tue, 13 Mar 2018 16:40:29 +0000 (16:40 +0000)]
Use C99 boolean type for translate_osrel

Migrate to modern types before creating MD Linuxolator bits for new
architectures.

Reviewed by: cem
Sponsored by: Turing Robotic Industries Inc.
Differential Revision: https://reviews.freebsd.org/D14676

6 years agoPrefer uintXX_t to u_intXX_t
Warner Losh [Tue, 13 Mar 2018 16:33:00 +0000 (16:33 +0000)]
Prefer uintXX_t to u_intXX_t

A foolish consistency is the hobgoblin of little minds, adored by
little statesmen and philosophers and divines. With consistency a
great soul has simply nothing to do. -- Ralph Waldo Emerson

6 years agoAdd some argument checks to be more user-friendly.
Alexander Motin [Tue, 13 Mar 2018 15:29:13 +0000 (15:29 +0000)]
Add some argument checks to be more user-friendly.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

6 years agoExecute PowerPC64/AIM kernel from direct map region when possible.
Nathan Whitehorn [Tue, 13 Mar 2018 15:03:58 +0000 (15:03 +0000)]
Execute PowerPC64/AIM kernel from direct map region when possible.

When the kernel can be in real mode in early boot, we can execute from
high addresses aliased to the kernel's physical memory. If that high
address has the first two bits set to 1 (0xc...), those addresses will
automatically become part of the direct map. This reduces page table
pressure from the kernel and it sets up the kernel to be used with
radix translation, for which it has to be up here.

This is accomplished by exploiting the fact that all PowerPC kernels are
built as position-independent executables and relocate themselves
on start. Before this patch, the kernel runs at 1:1 VA:PA, but that
VA/PA is random and set by the bootloader. Very early, it processes
its ELF relocations to operate wherever it happens to find itself.
This patch uses that mechanism to re-enter and re-relocate the kernel
a second time witha new base address set up in the early parts of
powerpc_init().

Reviewed by: jhibbits
Differential Revision: D14647

6 years agoCorrect minor typo in comment, efi_dmcap -> efi_tmcap
Kyle Evans [Tue, 13 Mar 2018 15:02:46 +0000 (15:02 +0000)]
Correct minor typo in comment, efi_dmcap -> efi_tmcap

6 years agoefirtc: Pass a dummy tmcap pointer to efi_get_time_locked
Kyle Evans [Tue, 13 Mar 2018 15:01:23 +0000 (15:01 +0000)]
efirtc: Pass a dummy tmcap pointer to efi_get_time_locked

As noted in the comment, UEFI spec claims the capabilities pointer is
optional, but some implementations will choke and attempt to dereference it
without checking. This specific problem was found on a Lenovo Thinkpad X220
that would panic in efirtc_identify.

6 years agoUse C99 designated initializers for struct execsw
Ed Maste [Tue, 13 Mar 2018 13:09:10 +0000 (13:09 +0000)]
Use C99 designated initializers for struct execsw

It it makes use slightly more clear and facilitates grepping.

6 years agobiosdisk.c should not set d_opendata.
Toomas Soome [Tue, 13 Mar 2018 09:58:29 +0000 (09:58 +0000)]
biosdisk.c should not set d_opendata.

Same as 330807, d_opendata is owned by open_disk and we should not
set it.

M    stand/i386/libi386/biosdisk.c

6 years agoat_rtc: check in ACPI FADT boot flags if the RTC is present
Roger Pau Monné [Tue, 13 Mar 2018 09:42:33 +0000 (09:42 +0000)]
at_rtc: check in ACPI FADT boot flags if the RTC is present

Or else disable the device. Note that the detection can be bypassed by
setting the hw.atrtc.enable option in the loader configuration file.
More information can be found on atrtc(4).

Sponsored by: Citrix Systems R&D
Reviewed by: ian
Differential revision: https://reviews.freebsd.org/D14399

6 years agovt_vga: check if VGA is available from ACPI FADT table
Roger Pau Monné [Tue, 13 Mar 2018 09:38:53 +0000 (09:38 +0000)]
vt_vga: check if VGA is available from ACPI FADT table

On x86 the IA-PC Boot Flags in the FADT can signal whether VGA is
available or not.

Sponsored by: Citrix systems R&D
Reviewed by: marcel
Differential revision: https://reviews.freebsd.org/D14397

6 years agoAdd `nvmecontrol format` subcommand.
Alexander Motin [Tue, 13 Mar 2018 03:02:09 +0000 (03:02 +0000)]
Add `nvmecontrol format` subcommand.

It allows to change namespace parameters, such as block size, metadata,
protection information, etc. and/or erase the data.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

6 years agolualoader: Sprinkle some verbose_loading salt
Kyle Evans [Tue, 13 Mar 2018 02:59:13 +0000 (02:59 +0000)]
lualoader: Sprinkle some verbose_loading salt

Our module loading messages should be hidden without verbose_loading -- go
ahead and do that as a first step.

6 years agoApply some style(9) to Linuxulator linux_sysvec.c comments
Ed Maste [Tue, 13 Mar 2018 00:40:05 +0000 (00:40 +0000)]
Apply some style(9) to Linuxulator linux_sysvec.c comments

6 years agoimgact_linux.c: use standard indentation
Ed Maste [Mon, 12 Mar 2018 23:28:25 +0000 (23:28 +0000)]
imgact_linux.c: use standard indentation

Sponsored by: Turing Robotic Industries Inc.

6 years agoUse the stack for temporary storage in OTIOCCONS.
Brooks Davis [Mon, 12 Mar 2018 23:04:42 +0000 (23:04 +0000)]
Use the stack for temporary storage in OTIOCCONS.

The old code used the thread's pcb via the uap->data pointer.

Reviewed by: ed
Approved by: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14674

6 years agoReject ioctls to SCSI enclosures from 32-bit compat processes.
Brooks Davis [Mon, 12 Mar 2018 23:02:01 +0000 (23:02 +0000)]
Reject ioctls to SCSI enclosures from 32-bit compat processes.

The ioctl objects contain pointers and require translation and some
refactoring of the infrastructure to work. For now prevent opertion
on garbage values. This is very slightly overbroad in that ENCIOC_INIT
is safe.

Reviewed by: imp, kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14671

6 years agoReject CAMIOGET and CAMIOQUEUE ioctl's on pass(4) in 32-bit compat mode.
Brooks Davis [Mon, 12 Mar 2018 22:58:07 +0000 (22:58 +0000)]
Reject CAMIOGET and CAMIOQUEUE ioctl's on pass(4) in 32-bit compat mode.

These take a union ccb argument which is full of kernel pointers.
Substantial translation efforts would be required to make this work.
By rejecting the request we avoid processing or returning entierly
wrong data.

Reviewed by: imp, ken, markj, cem
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14654

6 years agoMIPS: Implement fue*word* and casueword* in assembly.
Brooks Davis [Mon, 12 Mar 2018 22:10:06 +0000 (22:10 +0000)]
MIPS: Implement fue*word* and casueword* in assembly.

Remove NO_FUEWORD so the 'e' variants are wrapped by the non-'e'
variants.  This is more correct and leaves sparc64 as the outlier.

Reviewed by: jmallett, kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14603

6 years agoPrint the load and device path as well as BootCurrent and BootOrder
Warner Losh [Mon, 12 Mar 2018 21:40:24 +0000 (21:40 +0000)]
Print the load and device path as well as BootCurrent and BootOrder

Sponsored by: Netflix

6 years agoStar BootCurrent entry when booting.
Warner Losh [Mon, 12 Mar 2018 21:40:19 +0000 (21:40 +0000)]
Star BootCurrent entry when booting.

Sponsored by: Netflix

6 years agoMove the env convenience routines out of boot1.c.
Warner Losh [Mon, 12 Mar 2018 21:40:14 +0000 (21:40 +0000)]
Move the env convenience routines out of boot1.c.

These routines are more generally useful. Even though boot1 is on its
way out, it's better to make these common during the transition than
copy them.

6 years agoUse the one-line-per-file pattern here, and sort the file names.
Warner Losh [Mon, 12 Mar 2018 21:40:09 +0000 (21:40 +0000)]
Use the one-line-per-file pattern here, and sort the file names.

Sponsored by: Netflix

6 years agoGC unused routines.
Warner Losh [Mon, 12 Mar 2018 21:40:05 +0000 (21:40 +0000)]
GC unused routines.

Sponsored by: Netflix

6 years agoRemove d_type from devdesc. It's not needed as we can fetch it from
Warner Losh [Mon, 12 Mar 2018 21:39:59 +0000 (21:39 +0000)]
Remove d_type from devdesc. It's not needed as we can fetch it from
d_dev->dv_type when we need it.

6 years agoUse the actual struct devdesc at the start of all *_devdesc structs
Warner Losh [Mon, 12 Mar 2018 21:39:49 +0000 (21:39 +0000)]
Use the actual struct devdesc at the start of all *_devdesc structs

The current system is fragile and requires very careful layout of all
*_devdesc structures. It also makes it hard to change the base
devdesc. Take a page from CAM and put the 'header' in all the derived
classes and adjust the code to match.

For OFW, move the iHandle h_handle out of a slot conflicting with
d_opendata. Due to quirks in the alignment rules, this worked.
However changing the code to use d_opendata storage now that it's a
pointer is hard, so just have a separate field for it.

All other cleanups were to make the *_devdesc structures match where
they'd taken some liberties that were none-the-less compatible enough
to work.

6 years agoMake struct libi386_devdesc match the struct devdesc better
Warner Losh [Mon, 12 Mar 2018 21:39:42 +0000 (21:39 +0000)]
Make struct libi386_devdesc match the struct devdesc better

Move data to top and call it d_opendata.

6 years agoWe can't use d_opendata for blkio storage.
Warner Losh [Mon, 12 Mar 2018 21:39:38 +0000 (21:39 +0000)]
We can't use d_opendata for blkio storage.

open_disk uses d_opendata for it's own purpse. We can't store blkio
there. Fortunately, blkio is stored elsewhere and we never actually
retrieve blkio from d_opendata. Eliminate it as a source of confusion.
Eliminate all stores of d_opendata in efi since this layer doesn't own
that field.

6 years agoMinor cosmetic changes.
Warner Losh [Mon, 12 Mar 2018 21:39:27 +0000 (21:39 +0000)]
Minor cosmetic changes.

Make sure { on the same line as struct for all struct *devdesc.  Move
some type definitions to next to the dv_type define, since that's what
sets the d_type.

6 years agoe1000g: this statement may fall through
Toomas Soome [Mon, 12 Mar 2018 17:05:53 +0000 (17:05 +0000)]
e1000g: this statement may fall through

The gcc 7 does check for switch statement fall through cases, and if legit,
such complaint can besilenced by /* FALLTHROUGH */ comment. Unfortunately
such comment is quite limited, but will still notify the reader.

This patch is backport from illumos, see
https://www.illumos.org/rb/r/941/

Reviewed by: eadler
Differential Revision: https://reviews.freebsd.org/D14663

6 years agoPrint fuses and fna fields in identify data.
Alexander Motin [Mon, 12 Mar 2018 16:31:25 +0000 (16:31 +0000)]
Print fuses and fna fields in identify data.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

6 years agoANSIfy sys/kern/imgact_*
Ed Maste [Mon, 12 Mar 2018 15:45:50 +0000 (15:45 +0000)]
ANSIfy sys/kern/imgact_*

6 years agoLinuxulator: apply style(9) to return
Ed Maste [Mon, 12 Mar 2018 15:35:24 +0000 (15:35 +0000)]
Linuxulator: apply style(9) to return

Sponsored by: Turing Robotic Industries Inc.

6 years agoGive the atrtc_time_lock a unique name.
Ian Lepore [Mon, 12 Mar 2018 15:26:11 +0000 (15:26 +0000)]
Give the atrtc_time_lock a unique name.

Reported by: hps@

6 years agoTighten up periph lock to avoid some races
Warner Losh [Mon, 12 Mar 2018 15:17:16 +0000 (15:17 +0000)]
Tighten up periph lock to avoid some races

Make sure the periph lock is held around rmw access to softc data,
espeically flags, including work flags in iosched.
Add asserts for the periph lock where it should be held.

PR: 226510
Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D14456

6 years agoThe vmresult table was missing most of the values apart from two due to
Bjoern A. Zeeb [Mon, 12 Mar 2018 13:32:51 +0000 (13:32 +0000)]
The vmresult table was missing most of the values apart from two due to
extra "_" in the names we grep for. Add the "_" to the pattern.

Reviewed by: jhb
MFC after: 3 days
Sponsored by: iXsystems, Inc.

6 years agofix r297857, do not modify CPU extension bits under virtual machines
Andriy Gapon [Mon, 12 Mar 2018 11:28:09 +0000 (11:28 +0000)]
fix r297857, do not modify CPU extension bits under virtual machines

r297857 was meant for real hardware only.

PR: 213155
Submitted by: mainland@apeiron.net
MFC after: 1 week

6 years agoDo not try to reassemble IPv6 fragments in "reass" rule.
Andrey V. Elsukov [Mon, 12 Mar 2018 09:40:46 +0000 (09:40 +0000)]
Do not try to reassemble IPv6 fragments in "reass" rule.

ip_reass() expects IPv4 packet and will just corrupt any IPv6 packets
that it gets. Until proper IPv6 fragments handling function will be
implemented, pass IPv6 packets to next rule.

PR: 170604
MFC after: 1 week

6 years agoImplement NO_WCAST_QUAL for gcc4.2 architectures
Conrad Meyer [Mon, 12 Mar 2018 05:41:27 +0000 (05:41 +0000)]
Implement NO_WCAST_QUAL for gcc4.2 architectures

6 years agoAdd a new 'debug' command tree and 'dump_reqs' command to grab and parse
Scott Long [Mon, 12 Mar 2018 05:03:32 +0000 (05:03 +0000)]
Add a new 'debug' command tree and 'dump_reqs' command to grab and parse
command and chain frames of in-flight I/O from the driver.

Sponsored by: Netflix

6 years agoImplement a sysctl to dump in-flight I/O state for debugging. The tool to
Scott Long [Mon, 12 Mar 2018 05:02:22 +0000 (05:02 +0000)]
Implement a sysctl to dump in-flight I/O state for debugging.  The tool to
parse it will be committed in a separate action.

Sponsored by: Netflix

6 years agoberi loader: Replace getc/putc with beri_ prefixed versions
Kyle Evans [Mon, 12 Mar 2018 03:54:38 +0000 (03:54 +0000)]
beri loader: Replace getc/putc with beri_ prefixed versions

This matches a convention that we use, at least in ubldr, to prefix
getc/putc with a loader-specific prefix to avoid collisions. This was
encountered while trying to build the beri loader with MK_LOADER_LUA=yes.

No objection from: brooks
Reported by: emaste

6 years agoFix the resource leak of a 'FILE *' which could happen in routine
Garance A Drosehn [Mon, 12 Mar 2018 01:41:16 +0000 (01:41 +0000)]
Fix the resource leak of a 'FILE *' which could happen in routine
ctl_readcf() if a call to malloc failed.

PR: 204955
Reported by: David Binderman

6 years agoarm: Remove SoC Specific -MMCCAM kernelconfig
Emmanuel Vadot [Sun, 11 Mar 2018 23:14:50 +0000 (23:14 +0000)]
arm: Remove SoC Specific -MMCCAM kernelconfig

One should use the GENERIC-MMCCAM for this.

6 years agoRevert r330780, it was improperly tested and results in taking a spin
Ian Lepore [Sun, 11 Mar 2018 20:13:15 +0000 (20:13 +0000)]
Revert r330780, it was improperly tested and results in taking a spin
mutex before acquiring sleep mutexes.

Reported by: kib@

6 years agoRemove MTX_NOPROFILE from atrtc_lock, it was inappropriately copy/pasted
Ian Lepore [Sun, 11 Mar 2018 19:56:07 +0000 (19:56 +0000)]
Remove MTX_NOPROFILE from atrtc_lock, it was inappropriately copy/pasted
from the i8254 driver when I created separate mutexes for each.  The i8254
driver could be the active timecounter, leading to recursion during mutex
profiling, but the atrtc driver cannot be a timecounter, so it isn't needed.

6 years agoUpdate pfkey_open() function to set socket's write buffer size to
Andrey V. Elsukov [Sun, 11 Mar 2018 19:26:34 +0000 (19:26 +0000)]
Update pfkey_open() function to set socket's write buffer size to
128k and receive buffer size to 2MB. In case if system has bigger
default values, do not lower them.

This should partially solve the problem, when setkey(8) returns
EAGAIN error on systems with many SAs or SPs.

PR: 88336
Obtained from: NetBSD/ipsec-tools
MFC after: 2 weeks

6 years agoEliminate atrtc_time_lock, and use atrtc_lock for efirtc locking.
Ian Lepore [Sun, 11 Mar 2018 19:22:58 +0000 (19:22 +0000)]
Eliminate atrtc_time_lock, and use atrtc_lock for efirtc locking.

6 years agoRework key_sendup_mbuf() a bit:
Andrey V. Elsukov [Sun, 11 Mar 2018 19:14:01 +0000 (19:14 +0000)]
Rework key_sendup_mbuf() a bit:

o count in_nomem counter when we have failed to allocate mbuf for
  promisc socket;
o count in_msgtarget counter when we have secussfully sent data to socket;
o Since we are sending messages in a loop, returning error on first fail
  interrupts the loop, and all remaining sockets will not receive this
  message. So, do not return error when we have failed to send data to ALL
  or REGISTERED target. Return error only for KEY_SENDUP_ONE case. Now,
  when some socket has overfilled its receive buffer, this will not break
  other sockets.

MFC after: 2 weeks

6 years agoEverywhere that multiple registers are accessed in sequence, lock/unlock
Ian Lepore [Sun, 11 Mar 2018 18:54:45 +0000 (18:54 +0000)]
Everywhere that multiple registers are accessed in sequence, lock/unlock
just once around the whole group of accesses.

6 years agoAdd KASSERT to check that proper targed was used.
Andrey V. Elsukov [Sun, 11 Mar 2018 18:46:40 +0000 (18:46 +0000)]
Add KASSERT to check that proper targed was used.

MFC after: 2 weeks

6 years agoReplace panic() with KASSERTs.
Andrey V. Elsukov [Sun, 11 Mar 2018 18:37:55 +0000 (18:37 +0000)]
Replace panic() with KASSERTs.

MFC after: 2 weeks

6 years agoUse separate mutexes for atrtc and i8254 locking. Change all the strange
Ian Lepore [Sun, 11 Mar 2018 18:20:49 +0000 (18:20 +0000)]
Use separate mutexes for atrtc and i8254 locking.  Change all the strange
un-function-like RTC_LOCK/UNLOCK macro usage into normal function calls.
Since there is no longer any need to handle register access from a debugger
context, those function calls can just be regular mutex lock/unlock calls.

Requested by:  bde

6 years agoCheck that we have PF_KEY sockets before iterating over all RAW sockets.
Andrey V. Elsukov [Sun, 11 Mar 2018 18:10:59 +0000 (18:10 +0000)]
Check that we have PF_KEY sockets before iterating over all RAW sockets.

MFC after: 2 weeks

6 years agoRemove obsoleted and unused key_sendup() function.
Andrey V. Elsukov [Sun, 11 Mar 2018 18:03:55 +0000 (18:03 +0000)]
Remove obsoleted and unused key_sendup() function.
Also remove declaration for nonexistend key_usrreq() function.

MFC after: 2 weeks

6 years agoAdd myself (fernape) to calendar.freebsd
Fernando Apesteguía [Sun, 11 Mar 2018 17:21:48 +0000 (17:21 +0000)]
Add myself (fernape) to calendar.freebsd

As indicated in Committers guide Chapter 6, point 9
"Optional: Update Ports with Personal Information"

Approved by: tcberner
Differential Revision: https://reviews.freebsd.org/D14653

6 years agoConvert atrtc the new style rtc debugging output. Remove the db show
Ian Lepore [Sun, 11 Mar 2018 16:57:14 +0000 (16:57 +0000)]
Convert atrtc the new style rtc debugging output.  Remove the db show
command handler which provided much the same information.  Removing the
possibility of accessing the hardware regs from the debugger context
paves the way for simplifying the locking code in the driver.

6 years agoRemove obsolete pcaudioio.h.
Brooks Davis [Sun, 11 Mar 2018 16:17:53 +0000 (16:17 +0000)]
Remove obsolete pcaudioio.h.

Nothing uses the #define's values or the types.  (Some NTP code does use
an audio_info_t, but it is in #ifdef'd support for Solaris and is not
this audio_info_t).

Sponsored by: DARPA, AFRL

6 years agoAdd myself (fernape) to commiters-port.dot
Fernando Apesteguía [Sun, 11 Mar 2018 10:47:40 +0000 (10:47 +0000)]
Add myself (fernape) to commiters-port.dot

Approved by: tcberner (mentor)
Differential Revision: https://reviews.freebsd.org/D14639

6 years agoAdd CR2 get/set support.
Peter Grehan [Sun, 11 Mar 2018 08:27:11 +0000 (08:27 +0000)]
Add CR2 get/set support.

Reported/Tested by:  Fabian Freyer
Reviewed by: araujo
Differential Revision: https://reviews.freebsd.org/D14648
MFC after: 3 weeks

6 years agosorry for that. Fix next typo
Jochen Neumeister [Sun, 11 Mar 2018 08:07:40 +0000 (08:07 +0000)]
sorry for that. Fix next typo

Pointy hat to: joneum

6 years agoFix typo
Jochen Neumeister [Sun, 11 Mar 2018 08:02:14 +0000 (08:02 +0000)]
Fix typo

Reported by: tcberner

6 years agoAdd myself to committers-ports.dot
Jochen Neumeister [Sun, 11 Mar 2018 07:33:49 +0000 (07:33 +0000)]
Add myself to committers-ports.dot

6 years agoAdd new opcodes and statuses from NVMe 1.3a.
Alexander Motin [Sun, 11 Mar 2018 06:30:09 +0000 (06:30 +0000)]
Add new opcodes and statuses from NVMe 1.3a.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

6 years agoAdd new identify data structures fields from NVMe 1.3a.
Alexander Motin [Sun, 11 Mar 2018 05:09:02 +0000 (05:09 +0000)]
Add new identify data structures fields from NVMe 1.3a.

Some of them are already supported by existing hardware, so reporting
them `nvmecontrol identify` can be useful.

6 years agoextres/regulators: Add sysctls for regulators
Emmanuel Vadot [Sun, 11 Mar 2018 04:37:05 +0000 (04:37 +0000)]
extres/regulators: Add sysctls for regulators

For each regulators create an hw.regulator.<regname>. :
uvolt: Current value
always_on: 1 If the reg is always on
boot_on: 1 If the reg is set at boot time
enable_cnt: Number of consumer(s)
enable_delay: Delay before enabling the regulator
ramp_delay: The Ramp delay
max_uamp: The maximum value of the regulator in uAmps
min_uamp: The minimal value of the regulator in uAmps
max_uvolt: The maximum value of the regulator in uVolts
min_uvolt: The minimal value of the regulator in uVolts

Reviewed by: ian
Differential Revision: https://reviews.freebsd.org/D14578

6 years agostand/interp_lua: correct errorr => error
Kyle Evans [Sun, 11 Mar 2018 04:10:18 +0000 (04:10 +0000)]
stand/interp_lua: correct errorr => error

6 years agoallwinner: Add IR clock to sun8i
Emmanuel Vadot [Sun, 11 Mar 2018 04:01:23 +0000 (04:01 +0000)]
allwinner: Add IR clock to sun8i

Add ir clock definition to sun8i-r-ccu.
No idea if it's working but aw_cir seems happy now and the frequency
is set to 3Mhz as it should.

6 years agoMake FDT-using parts of ofw_machdep.c condition on options FDT. This fixes
Nathan Whitehorn [Sun, 11 Mar 2018 01:09:31 +0000 (01:09 +0000)]
Make FDT-using parts of ofw_machdep.c condition on options FDT. This fixes
the kernel build when options FDT is absent.

6 years agootus(4): check mcast / mgt / ucast rates during Tx descriptor setup
Andriy Voskoboinyk [Sun, 11 Mar 2018 00:38:08 +0000 (00:38 +0000)]
otus(4): check mcast / mgt / ucast rates during Tx descriptor setup

These parameters may be changed via ifconfig(8); by default,
mgt / mcast rates are lowest possible and ucast rate is not set
(matches previous configuration).

While here, store some variables locally for better readability.

6 years agortwn(4): reset Tx power values before calling get_txpower()
Andriy Voskoboinyk [Sat, 10 Mar 2018 23:47:03 +0000 (23:47 +0000)]
rtwn(4): reset Tx power values before calling get_txpower()
for RTL8192C / RTL8188E (like it is done for other chipsets).