]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMerge ^/head r327886 through r327930.
dim [Sat, 13 Jan 2018 17:52:55 +0000 (17:52 +0000)]
Merge ^/head r327886 through r327930.

6 years agoPull in r314499 from upstream clang trunk (by Daniel Marjamäki):
dim [Sat, 13 Jan 2018 17:47:34 +0000 (17:47 +0000)]
Pull in r314499 from upstream clang trunk (by Daniel Marjamäki):

  [Sema] Suppress warnings for C's zero initializer

  Patch by S. Gilles!

  Differential Revision: https://reviews.llvm.org/D28148

Pull in r314838 from upstream clang trunk (by Richard Smith):

  Suppress -Wmissing-braces warning when aggregate-initializing a
  struct with a single field that is itself an aggregate.

  In C++, such initialization of std::array<T, N> types is guaranteed
  to work by the standard, is completely idiomatic, and the "suggested"
  alternative from Clang was technically invalid.

Together, these suppress unneeded "suggest braces around initialization
of subobject" warnings for C++11 initializer lists.

MFC after: 3 days

6 years agoUse the correct revision specifier (EXT_CSD revision rather than
marius [Sat, 13 Jan 2018 17:36:11 +0000 (17:36 +0000)]
Use the correct revision specifier (EXT_CSD revision rather than
system specification version) for deciding whether the EXT_CSD
register includes the EXT_CSD_GEN_CMD6_TIME field.

Submitted by: Masanobu SAITOH

6 years agoAdd SPDX identifier to header
jhibbits [Sat, 13 Jan 2018 17:25:48 +0000 (17:25 +0000)]
Add SPDX identifier to header

Reported by: pfg

6 years agoFix a bug introduced in r327355; in mmcsd_ioctl_cmd() when ensuring
marius [Sat, 13 Jan 2018 16:32:09 +0000 (16:32 +0000)]
Fix a bug introduced in r327355; in mmcsd_ioctl_cmd() when ensuring
that userland doesn't switch partitions on its own, compare against
the partition mmcsd_ioctl_cmd() is going to switch to (based on the
device node used) rather than the currently selected partition.

6 years agoAdd IDs for Nuvoton NCT6793/NCT6795.
mav [Sat, 13 Jan 2018 16:31:07 +0000 (16:31 +0000)]
Add IDs for Nuvoton NCT6793/NCT6795.

MFC after: 2 weeks

6 years agoFix a bug introduced in r327339; at the point in time re-tuning is
marius [Sat, 13 Jan 2018 16:21:13 +0000 (16:21 +0000)]
Fix a bug introduced in r327339; at the point in time re-tuning is
executed, the interrupt aggregation code might have disabled the
SDHCI_INT_DMA_END and/or SDHCI_INT_RESPONSE bits in slot->intmask
and the SDHCI_SIGNAL_ENABLE register respectively. So when restoring
the interrupt masks based on the previous contents of slot->intmask
in sdhci_exec_tuning(), ensure that the SDHCI_INT_ENABLE register
doesn't lose these two bits.
While at it and in the spirit of r327339, let sdhci_tuning_intmask()
set the tuning error and re-tuning interrupt bits based on the
SDHCI_TUNING_ENABLED rather than the SDHCI_TUNING_SUPPORTED flag
being set, i. e. only when (re-)tuning is actually used. Currently,
this changes makes no net difference, though.

6 years agodwmmc_hisi: Fix build when option MMCCAM is defined
manu [Sat, 13 Jan 2018 14:10:45 +0000 (14:10 +0000)]
dwmmc_hisi: Fix build when option MMCCAM is defined

6 years agoFix a typo introduced in r327919.
tuexen [Sat, 13 Jan 2018 14:10:45 +0000 (14:10 +0000)]
Fix a typo introduced in r327919.

6 years agoAdd support for readv() and writev() to truss.
tuexen [Sat, 13 Jan 2018 13:59:35 +0000 (13:59 +0000)]
Add support for readv() and writev() to truss.

Sponsored by: Netflix, Inc.

6 years agoBuild llvm-extract with -lz, and add a few objects to liblldb, both of
dim [Sat, 13 Jan 2018 13:53:05 +0000 (13:53 +0000)]
Build llvm-extract with -lz, and add a few objects to liblldb, both of
which turn out to be needed when you don't use -ffunction-sections.

Reported by: Shawn Webb <shawn.webb@hardenedbsd.org>

6 years agoAdd sysctl debug.kdb.stack_overflow to conveniently test kernel
kib [Sat, 13 Jan 2018 11:59:49 +0000 (11:59 +0000)]
Add sysctl debug.kdb.stack_overflow to conveniently test kernel
handling of the kstack overflow.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agosx: retry hard shared unlock just like in r327905 for rwlocks
mjg [Sat, 13 Jan 2018 09:26:24 +0000 (09:26 +0000)]
sx: retry hard shared unlock just like in r327905 for rwlocks

6 years agoRemove redundant variable.
cy [Sat, 13 Jan 2018 08:28:46 +0000 (08:28 +0000)]
Remove redundant variable.

MFC after: 1 week

6 years agoThough this block of code is not used by FreeBSD, correct a call to
cy [Sat, 13 Jan 2018 08:16:10 +0000 (08:16 +0000)]
Though this block of code is not used by FreeBSD, correct a call to
sprintf() with a macro call to SNPRINTF similar to other calls to
SNPRINTF within this same block.

MFC after: 1 week

6 years agoReplace the PMC class struct copy with an explicit memcpy()
jhibbits [Sat, 13 Jan 2018 04:53:04 +0000 (04:53 +0000)]
Replace the PMC class struct copy with an explicit memcpy()

This should be effectively a nop for all archs, but for some reason the codegen
difference on the PowerPC 970 is such that the struct assignment doesn't work
(unless a printf() using one of the elements in the copied struct follows it),
while the memcpy() succeeds.  On all archs the memcpy() should be expanded to an
inline copy, since the copy is bounded to ~16 bytes.

MFC after: 3 weeks

6 years agoRevert r327823, Enable ld.lld as bootstrap linker by default on i386
emaste [Sat, 13 Jan 2018 04:00:55 +0000 (04:00 +0000)]
Revert r327823, Enable ld.lld as bootstrap linker by default on i386

There's a report of some regression in ports.  Revert for now for an
exp run for this change in isolation (previous lld exp run also included
switching the linker used for ports to lld).

Also revert the src.conf.5 regeneration in r327824.

Reported by: antoine
Sponsored by: The FreeBSD Foundation

6 years agoChase removal of FDT fixup code on PowerPC in r327907.
nwhitehorn [Sat, 13 Jan 2018 03:09:05 +0000 (03:09 +0000)]
Chase removal of FDT fixup code on PowerPC in r327907.

6 years agoRemove fdt fixups for powerpc, they are no longer needed.
jhibbits [Sat, 13 Jan 2018 02:56:09 +0000 (02:56 +0000)]
Remove fdt fixups for powerpc, they are no longer needed.

If a fixup really is needed, it should be fixed in u-boot, not in FreeBSD.

Suggested by: nwhitehorn

6 years agoEnable L2 cache on supported PowerQUICC and QorIQ platforms
jhibbits [Sat, 13 Jan 2018 01:36:37 +0000 (01:36 +0000)]
Enable L2 cache on supported PowerQUICC and QorIQ platforms

Some PowerQUICC and QorIQ platforms have a L2 cache managed via the
memory-mapped configuration registers, and appear as a node in the device
tree.  This adds basic support to enable the cache.

6 years agorwlock: try regular read unlock even in the hard path
mjg [Sat, 13 Jan 2018 00:05:31 +0000 (00:05 +0000)]
rwlock: try regular read unlock even in the hard path

Saves on turnstile trips if the lock got more readers.

6 years agocxgbe/iw_cxgbe: Remove duplicates to fix compilation with recent gcc.
np [Sat, 13 Jan 2018 00:04:11 +0000 (00:04 +0000)]
cxgbe/iw_cxgbe: Remove duplicates to fix compilation with recent gcc.

6 years agoFix compile error from r327900
jeff [Fri, 12 Jan 2018 23:41:12 +0000 (23:41 +0000)]
Fix compile error from r327900

6 years agoAdd support for NUMA domains to bus dma tags. This causes all memory
jeff [Fri, 12 Jan 2018 23:34:16 +0000 (23:34 +0000)]
Add support for NUMA domains to bus dma tags.  This causes all memory
allocated with a tag to come from the specified domain if it meets the
other constraints provided by the tag.  Automatically create a tag at
the root of each bus specifying the domain local to that bus if
available.

Reviewed by: jhb, kib
Tested by: pho
Sponsored by: Netflix, Dell/EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13545

6 years agoImplement NUMA support in uma(9) and malloc(9). Allocations from specific
jeff [Fri, 12 Jan 2018 23:25:05 +0000 (23:25 +0000)]
Implement NUMA support in uma(9) and malloc(9).  Allocations from specific
domains can be done by the _domain() API variants.  UMA also supports a
first-touch policy via the NUMA zone flag.

The slab layer is now segregated by VM domains and is precise.  It handles
iteration for round-robin directly.  The per-cpu cache layer remains
a mix of domains according to where memory is allocated and freed.  Well
behaved clients can achieve perfect locality with no performance penalty.

The direct domain allocation functions have to visit the slab layer and
so require per-zone locks which come at some expense.

Reviewed by: Attilio (a slightly older version)
Tested by: pho
Sponsored by: Netflix, Dell/EMC Isilon

6 years agoImplement NUMA policy for kmem_*(9). This maintains compatibility with
jeff [Fri, 12 Jan 2018 23:13:55 +0000 (23:13 +0000)]
Implement NUMA policy for kmem_*(9).  This maintains compatibility with
reservations by giving each memory domain its own KVA space in vmem that
is naturally aligned on superpage boundaries.

Reviewed by: alc, markj, kib  (some objections)
Sponsored by: Netflix, Dell/EMC Isilon
Tested by; pho
Differential Revision: https://reviews.freebsd.org/D13289

6 years agolibalias: small memory allocation cleanups.
pfg [Fri, 12 Jan 2018 23:12:30 +0000 (23:12 +0000)]
libalias: small memory allocation cleanups.

Make the calloc wrappers behave as expected by using mallocarray.
It is rather weird that the malloc wrappers also zeroes the memory: update
a comment to reflect at least two cases where it is expected.

Reviewed by: tuexen

6 years agoRegenerate auto-generated files
jeff [Fri, 12 Jan 2018 23:06:35 +0000 (23:06 +0000)]
Regenerate auto-generated files

6 years agoAdd files for r327895
jeff [Fri, 12 Jan 2018 22:57:57 +0000 (22:57 +0000)]
Add files for r327895

Implement 'domainset', a cpuset based NUMA policy mechanism.  This allows
userspace to control NUMA policy administratively and programmatically.

Implement domainset based iterators in the page layer.

Remove the now legacy numa_* syscalls.

Cleanup some header polution created by having seq.h in proc.h.

Reviewed by:  markj, kib
Discussed with:       alc
Tested by:    pho
Sponsored by: Netflix, Dell/EMC Isilon
Differential Revision:        https://reviews.freebsd.org/D13403

6 years agoImplement 'domainset', a cpuset based NUMA policy mechanism. This allows
jeff [Fri, 12 Jan 2018 22:48:23 +0000 (22:48 +0000)]
Implement 'domainset', a cpuset based NUMA policy mechanism.  This allows
userspace to control NUMA policy administratively and programmatically.

Implement domainset based iterators in the page layer.

Remove the now legacy numa_* syscalls.

Cleanup some header polution created by having seq.h in proc.h.

Reviewed by: markj, kib
Discussed with: alc
Tested by: pho
Sponsored by: Netflix, Dell/EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13403

6 years agoEnsure MK_LDD for bootstrap-tools matches MK_LLD_BOOTSTRAP.
bdrewery [Fri, 12 Jan 2018 20:40:27 +0000 (20:40 +0000)]
Ensure MK_LDD for bootstrap-tools matches MK_LLD_BOOTSTRAP.

This fixes building libllvmminimal with MK_LLD support when WITHOUT_LLD
or WITHOUT_TOOLCHAIN are set, which are install flags not build tools
flags.

Reported by: sbruno
Tested by: sbruno
Sponsored by: Dell EMC

6 years agoallwinner/a83t_padconf: Rename "emac" function to "gmac" as per upstream DTS
kevans [Fri, 12 Jan 2018 20:35:27 +0000 (20:35 +0000)]
allwinner/a83t_padconf: Rename "emac" function to "gmac" as per upstream DTS

Although these should have been 'emac', upstream DTS is going with using
'gmac' as the function name for the emac RGMII pins. Rename here to
accommodate.

emac support for the a83t should come in with the 4.16 DTS update, in
another couple of months.

6 years agobsdinstall: disable SUJ by default
emaste [Fri, 12 Jan 2018 20:25:57 +0000 (20:25 +0000)]
bsdinstall: disable SUJ by default

SUJ + cg checksums produce spurious warnings after an unclean shutdown
(e.g. a crash).  For now disable SUJ for UFS installs so installing from
a FreeBSD 12 snapshot results in a usable filesystem, until this can be
fixed.

PR: 225110
Submitted by: Arshan Khanifar <arshankhanifar gmail.com>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13890

6 years agoRevert r280909 "unwind-d2 build workaround for arm64"
emaste [Fri, 12 Jan 2018 20:03:24 +0000 (20:03 +0000)]
Revert r280909 "unwind-d2 build workaround for arm64"

We no longer try to build unwind-dw2.c on arm64 so no need for this
workaround.

Sponsored by: The FreeBSD Foundation

6 years agoAdd "jid" and "jailname" variables to DTrace.
markj [Fri, 12 Jan 2018 19:59:46 +0000 (19:59 +0000)]
Add "jid" and "jailname" variables to DTrace.

These return the jail ID and jail name for the traced process,
respectively, and are analogous to "zonename" on Solaris/illumos.
"zonename" is now aliased to "jailname".

Also add some stress tests for the new variables.

Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
Reviewed by: dteske (previous version)
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D13877

6 years agoMerge ^/head r327624 through r327885.
dim [Fri, 12 Jan 2018 18:23:35 +0000 (18:23 +0000)]
Merge ^/head r327624 through r327885.

6 years agoPull in r321994 from upstream llvm trunk (by Alexey Bataev):
dim [Fri, 12 Jan 2018 18:19:14 +0000 (18:19 +0000)]
Pull in r321994 from upstream llvm trunk (by Alexey Bataev):

  [SLP] Fix PR35777: Incorrect handling of aggregate values.

  Summary:
  Fixes the bug with incorrect handling of InsertValue|InsertElement
  instrucions in SLP vectorizer. Currently, we may use incorrect
  ExtractElement instructions as the operands of the original
  InsertValue|InsertElement instructions.

  Reviewers: mkuper, hfinkel, RKSimon, spatel

  Subscribers: llvm-commits

  Differential Revision: https://reviews.llvm.org/D41767

This should fix "Invalid InsertValueInst operands!" errors when building
certain parts of editors/libreoffice.

Reported by: jbeich
PR: 225086

6 years agoPull in r322264 from upstream lld trunk (by me):
dim [Fri, 12 Jan 2018 18:16:51 +0000 (18:16 +0000)]
Pull in r322264 from upstream lld trunk (by me):

  Fix thread race between SectionPiece's OutputOff and Live members

  Summary:
  As reported in bug 35788, rL316280 reintroduces a race between two
  members of SectionPiece, which share the same 64 bit memory location.

  To fix the race, check the hash before checking the Live member, as
  suggested by Rafael.

  Reviewers: ruiu, rafael

  Reviewed By: ruiu

  Subscribers: smeenai, emaste, llvm-commits

  Differential Revision: https://reviews.llvm.org/D41884

6 years agoCorrect a couple of typos.
schweikh [Fri, 12 Jan 2018 17:33:20 +0000 (17:33 +0000)]
Correct a couple of typos.

6 years agoAllow this file to be included
imp [Fri, 12 Jan 2018 17:21:48 +0000 (17:21 +0000)]
Allow this file to be included

Use simple "foo" rather than "${.CURDIR}/foo" to include Makefile.fat
since the former works when including this Makefile from else
where. Also, use full path from ${BOOTSRC} to the FAT templates for
similar reasons. It doesn't change anything in base FreeBSD, but
allows us to have a custom boot1.efi more easily (though that will be
short-lived for us, it may also be helpful for others).

Sponsored by: Netflix

6 years agoMove getsecs() prototype to stand.h from net.h so it can be used
imp [Fri, 12 Jan 2018 16:28:51 +0000 (16:28 +0000)]
Move getsecs() prototype to stand.h from net.h so it can be used
everywhere.

Sponsored by: Netflix

6 years agoReport the boot order and where we are in that boot order. Add
imp [Fri, 12 Jan 2018 15:30:56 +0000 (15:30 +0000)]
Report the boot order and where we are in that boot order.  Add
ability to create a boot1.efi that always fails for testing purposes
and failover scenarios.

Sponsored by: Netflix

6 years agoAdd GUID for UEFI boot manager variables.
imp [Fri, 12 Jan 2018 15:30:52 +0000 (15:30 +0000)]
Add GUID for UEFI boot manager variables.

Sponsoered by: Netflix

6 years agoFix error in determining the next available boot slot.
imp [Fri, 12 Jan 2018 15:30:48 +0000 (15:30 +0000)]
Fix error in determining the next available boot slot.

Sponsored by: Netflix

6 years agoWorkaround Spectre Variant 2 on arm64.
andrew [Fri, 12 Jan 2018 14:01:38 +0000 (14:01 +0000)]
Workaround Spectre Variant 2 on arm64.

We need to handle two cases:

1. One process attacking another process.
2. A process attacking the kernel.

For the first case we clear the branch predictor state on context switch
between different processes. For the second we do this when taking an
instruction abort on a non-userspace address.

To clear the branch predictor state a per-CPU function pointer has been
added. This is set by the new cpu errata code based on if the CPU is
known to be affected.

On Cortex-A57, A72, A73, and A75 we call into the PSCI firmware as newer
versions of this will clear the branch predictor state for us.

It has been reported the ThunderX is unaffected, however the ThunderX2 is
vulnerable. The Qualcomm Falkor core is also affected. As FreeBSD doesn't
yet run on the ThunderX2 or Falkor no workaround is included for these CPUs.

MFC after: 3 days
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D13812

6 years agomtx: use fcmpset to cover setting MTX_CONTESTED
mjg [Fri, 12 Jan 2018 13:40:50 +0000 (13:40 +0000)]
mtx: use fcmpset to cover setting MTX_CONTESTED

6 years agovfs: tidy up vdrop
mjg [Fri, 12 Jan 2018 13:39:02 +0000 (13:39 +0000)]
vfs: tidy up vdrop

Skip vfs_refcount_release_if_not_last if the interlock is held and just
go straight to refcount_release.

While here do cosmetic rearrangement of _vhold to better show it contains
equivalent behaviour.

6 years agoPowerNV: update OPAL driver
wma [Fri, 12 Jan 2018 12:14:52 +0000 (12:14 +0000)]
PowerNV: update OPAL driver

Update OPAL driver with:
- better console support
- proper AP configuration
- enhanced IRQ/OFW mapping
- RTC support

Created by:            Nathan Whitehorn <nwhitehorn@freebsd.org>
Submitted by:          Wojciech Macek <wma@semihalf.com>
Sponsored by:          FreeBSD Foundation

6 years ago- Fix `make` in sys/modules
lwhsu [Fri, 12 Jan 2018 12:14:14 +0000 (12:14 +0000)]
- Fix `make` in sys/modules

Reviewed by: gonzo, landonf, br
Differential Revision: https://reviews.freebsd.org/D13856

6 years agoPowerNV: initial support for PCIe host controller
wma [Fri, 12 Jan 2018 07:55:49 +0000 (07:55 +0000)]
PowerNV: initial support for PCIe host controller

Provide initial support for PCIe host controller as
well as for IOMMU mapping. This commit allows proper
bus enumeration, but does not guarantee DMA operations
are working.

Created by:            Nathan Whitehorn <nwhitehorn@freebsd.org>
Submitted by:          Wojciech Macek <wma@semihalf.com>
Sponsored by:          FreeBSD Foundation

6 years agoaesni(4): Quiesce spurious GCC 6.3.0 -Wmaybe-uninitialized warnings
cem [Fri, 12 Jan 2018 06:40:58 +0000 (06:40 +0000)]
aesni(4): Quiesce spurious GCC 6.3.0 -Wmaybe-uninitialized warnings

Always initialize some variables GCC warns about.  They are initialized in
every path where they are used, but GCC doesn't know that.

Sponsored by: Dell EMC Isilon

6 years agosys/dev/e1000: fix uses of 1 << 31
eadler [Fri, 12 Jan 2018 06:37:53 +0000 (06:37 +0000)]
sys/dev/e1000: fix uses of 1 << 31

Reviewed by: erj (D13858)

6 years agosys/dev/mlx[45]: fix uses of 1 << 31
eadler [Fri, 12 Jan 2018 06:36:44 +0000 (06:36 +0000)]
sys/dev/mlx[45]: fix uses of 1 << 31

Reviewed by: kib (D13858)

6 years agodhclient(8): add missing include
asomers [Fri, 12 Jan 2018 04:26:40 +0000 (04:26 +0000)]
dhclient(8): add missing include

stdbool is technically needed, though we can get away without it due to
header pollution.

MFC after: 3 days

6 years agoANSIfy function definitions in sys/vm/
emaste [Fri, 12 Jan 2018 03:50:44 +0000 (03:50 +0000)]
ANSIfy function definitions in sys/vm/

6 years agoAdd a hack to disable AUTO_OBJ for 'old style' kernel builds.
bdrewery [Fri, 12 Jan 2018 01:09:41 +0000 (01:09 +0000)]
Add a hack to disable AUTO_OBJ for 'old style' kernel builds.

Another solution would be to extend the Makefile.sys.inc idea, or a .no_obj
file, to more places but I would rather keep that limited to the top-level
build for now to not impact performance (statting a file in every make call)
or to bring unintended side-effects.

Reported by: jhb, imp
Sponsored by: Dell EMC Isilon

6 years agoCache LINKER_FEATURES to fix the wrong ones being used.
bdrewery [Fri, 12 Jan 2018 01:09:30 +0000 (01:09 +0000)]
Cache LINKER_FEATURES to fix the wrong ones being used.

Submitted by: Dan McGregor <dan.mcgregor@usask.ca>

6 years agoBuild systrace_freebsd32 on arm64.
tuexen [Thu, 11 Jan 2018 21:17:05 +0000 (21:17 +0000)]
Build systrace_freebsd32 on arm64.

Since r326501 which added COMPAT_FREEBSD32 to the GENERIC config for arm64,
we need to build systrace_freebsd32, since dtraceall depends on it.

Reviewed by: ed, gnn
Differential Revision: https://reviews.freebsd.org/D13670

6 years agoPull in r316581 from upstream llvm trunk (by John Baldwin):
dim [Thu, 11 Jan 2018 21:12:23 +0000 (21:12 +0000)]
Pull in r316581 from upstream llvm trunk (by John Baldwin):

  Don't try to use a non-existent header on FreeBSD/mips.

  Reviewers: dim

  Differential Revision: https://reviews.llvm.org/D38807

Requested by: jhb
MFC after: 3 days

6 years agoEnsure that the vnet is set when calling pru_sockaddr() and
tuexen [Thu, 11 Jan 2018 20:26:17 +0000 (20:26 +0000)]
Ensure that the vnet is set when calling pru_sockaddr() and
pru_peeraddr().

This is already true when called via kern_getsockname() and
kern_getpeername(). This patch sets it also, when they arecalled
via soo_fill_kinfo(). This is necessary, since the corresponding
functions for SCTP require the vnet to be set. Without this,
if a process having an wildcard bound SCTP socket is
terminated and a core is written, the kernel panics.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D13652

6 years agoe1000: Fix typos in value written to register and a comment
erj [Thu, 11 Jan 2018 19:24:51 +0000 (19:24 +0000)]
e1000: Fix typos in value written to register and a comment

The value written to E1000_TARC(0) wasn't intended to have every bit but
E1000_TARC0_CB_MULTIQ_3_REQ cleared; a ~ was missing.

Also change the referenced spec update section in the comment to the correct
section.

Sponsored by: Intel Corporation

6 years agoAllow MIPS lib32 to build with clang.
jhb [Thu, 11 Jan 2018 19:24:44 +0000 (19:24 +0000)]
Allow MIPS lib32 to build with clang.

Don't try to set -march as clang doesn't permit use of the O32 ABI
with newer CPU microarchitectures like 'mips3'.  In addition, clang
doesn't permit the O32 ABI with the default N64 target, so use an
explicit O32 -target for clang.

Sponsored by: DARPA / AFRL

6 years agoTemporarily disable VIMAGE on i386
emaste [Thu, 11 Jan 2018 19:08:43 +0000 (19:08 +0000)]
Temporarily disable VIMAGE on i386

An lld-linked i386 kernel hangs on boot, after em(4) starts.  This seems
similar to the issue that prompted us to disable VIMAGE on arm64 in
r326179.  Disable VIMAGE on i386 for now while we investigate.

PR: 225077
Sponsored by: The FreeBSD Foundation

6 years agoChange the type of 'crp_opaque' from caddr_t to void *.
jhb [Thu, 11 Jan 2018 18:09:24 +0000 (18:09 +0000)]
Change the type of 'crp_opaque' from caddr_t to void *.

Opaque pointers should be void *.  Note that this does not go through
the tree removing all of the now-unnecessary casts.

Reviewed by: kib
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D13848

6 years agoAxe tmp_iv from the cryptodev session structure.
jhb [Thu, 11 Jan 2018 18:07:21 +0000 (18:07 +0000)]
Axe tmp_iv from the cryptodev session structure.

Just copyin the IV into the crypto descriptor directly.  This avoids
copying the IV twice for each operation.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D13847

6 years agoiAdd ACPI attachments the the GIC and GICv3 interrupt controller drivers.
andrew [Thu, 11 Jan 2018 17:23:24 +0000 (17:23 +0000)]
iAdd ACPI attachments the the GIC and GICv3 interrupt controller drivers.
For each we need to walk the MADT to find which we have, then add the
driver as needed. As each may have a child they will each walk the same
table to find these details.

Reviewed by: mmel
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8720

6 years agoAdd the start of INTRNG support for ACPI.
andrew [Thu, 11 Jan 2018 17:09:12 +0000 (17:09 +0000)]
Add the start of INTRNG support for ACPI.

This adds a new acpi_bus interface with a map_intr method. This is similar
to the Open Firmware map_intr method and allows us to create the needed
mapping from ACPI space to INTRNG space.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8617

6 years agoFix grammar.
kib [Thu, 11 Jan 2018 16:50:03 +0000 (16:50 +0000)]
Fix grammar.

Submitted by: alc
MFC after: 3 days

6 years agoAdd mallocarray.9 to malloc.9's MLINKS.
markj [Thu, 11 Jan 2018 16:41:03 +0000 (16:41 +0000)]
Add mallocarray.9 to malloc.9's MLINKS.

X-MFC with: r327674

6 years agovmstat(8): Hook up NetBSD tests
kevans [Thu, 11 Jan 2018 16:04:04 +0000 (16:04 +0000)]
vmstat(8): Hook up NetBSD tests

The NetBSD tests for vmstat are basically just a smoke test, ensuring that
executing `vmstat` and `vmstat -s` exit successfully. This is more than we
test now, so go with it.

6 years agodev/bhnd: Make use of mallocarray(9).
pfg [Thu, 11 Jan 2018 15:44:03 +0000 (15:44 +0000)]
dev/bhnd: Make use of mallocarray(9).

This makes a calloc-like definition check for overflows as is common
practice.

6 years agonetpfil/ipfw: Make some use of mallocarray(9).
pfg [Thu, 11 Jan 2018 15:29:29 +0000 (15:29 +0000)]
netpfil/ipfw: Make some use of mallocarray(9).

Reviewed by: kp, ae
Differential Revision: https://reviews.freebsd.org/D13834

6 years agodev/(e1000,ixl): Make some use of mallocarray(9).
pfg [Thu, 11 Jan 2018 15:25:26 +0000 (15:25 +0000)]
dev/(e1000,ixl): Make some use of mallocarray(9).

Reviewed by: erj
Differential Revision: https://reviews.freebsd.org/D13833

6 years agoInitialize CONTEXTIDR register on secondary cores by zero,
mmel [Thu, 11 Jan 2018 15:03:01 +0000 (15:03 +0000)]
Initialize CONTEXTIDR register on secondary cores by zero,
not with undefined value from X1 register.

MFC after: 1 month

6 years agopatch(1): Don't check for NUL bytes in Plan A
kevans [Thu, 11 Jan 2018 15:01:48 +0000 (15:01 +0000)]
patch(1): Don't check for NUL bytes in Plan A

Plan A mmap()'s the entire input file and operates on it in memory. The
map(2) call succeeded, so we shouldn't need to bother checking for the NUL
byte as long as we're within our buffer space.

This was clearly intentional to match "the behavior of the original code",
but it creates a discrepancy between Plan A and Plan B that doesn't seem
sensible and it's not inherently wrong to allow a NUL byte.

This change was motivated by the gemspec in net/rubygem-grpc failing to
patch, despite the patch being generated with diff, because a NUL byte was
used as a delimiter in the header briefly in an otherwise text file.

An alternative was considered: to fallback to plan B if plan A won't process
the entire file due to a NUL byte, but I deemed this to be the better option
since plan A isn't failing due to memory limitations and will fail later on
if it's really dealing with a file it shouldn't be.

PR: 224842 (exp-run)
Reported by: swills
Reviewed by: emaste, pfg
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D13738

6 years agoif_awg: Support new emac bindings
kevans [Thu, 11 Jan 2018 14:29:29 +0000 (14:29 +0000)]
if_awg: Support new emac bindings

Highlights of the new bindings:
- ahb clock is specified as 'stmmaceth'
- The PHY to be used is now specified as phy-handle
- We must now check the parent of the node phy-handle points to in order to
discover if we're using internal PHY.
- The ephy clk/reset will be specified on the PHY node, not the emac node.

Care has been taken to ensure that we remain compatible with the older
bindings that we were previously using.

Tested on: Pine64 (A64, old bindings)
Tested on: Pine64-LTS (A64, new bindings) [manu]
Tested on: OrangePi-One (H3, internal PHY) [manu]
Tested on: NanoPi M1 Plus (H3, external PHY) [manu]
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D13777

6 years agoregen src.conf.5 after r327823, WITH_LLD_BOOTSTRAP for i386
emaste [Thu, 11 Jan 2018 14:21:07 +0000 (14:21 +0000)]
regen src.conf.5 after r327823, WITH_LLD_BOOTSTRAP for i386

Sponsored by: The FreeBSD Foundation

6 years agoEnable ld.lld as bootstrap linker by default on i386
emaste [Thu, 11 Jan 2018 14:03:05 +0000 (14:03 +0000)]
Enable ld.lld as bootstrap linker by default on i386

Akin to r327783 for amd64.  lld has been usable for amd64 for quite some
time, but a couple of issues remained that affected i386.  These were
recently addressed upstream in lld and merged into FreeBSD (r326831,
r326879, r326897, r326957), so we can now use ld.lld on i386 as well.

Similarly to amd64 this change enables lld only as the bootstrap linker
(used to link the kernel and userland libraries and executables), while
GNU ld.bfd is still installed as /usr/bin/ld and used for ports builds.

The ports collection is essentially ready to use lld as the system
linker for amd64, but many ports still have trouble with lld on i386,
because lld defaults to -ztext, disallowing relocations against readonly
segments.  Thus switching the system linker (WITH_LLD_IS_LD) will happen
later on a per-arch basis.

Relnotes: Yes
Sponsored by: The FreeBSD Foundation

6 years agoSkip IRELATIVE relocations when loader processes ELF files.
kib [Thu, 11 Jan 2018 13:57:30 +0000 (13:57 +0000)]
Skip IRELATIVE relocations when loader processes ELF files.

ifuncs can be only called in the (early boot) kernel environment, so
postpone resolving until early stage of the kernel boot.  This commit
is performed in advance to make loaders on most machines updated
before ifuncs appear in the kernels.

Reviewed by: emaste, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D13838

6 years agoSoftlink inodes can own buffers with dependencies.
kib [Thu, 11 Jan 2018 13:37:45 +0000 (13:37 +0000)]
Softlink inodes can own buffers with dependencies.

At least, softlinks longer than 120 bytes have data fragments.

Submitted by: mckusick
MFC after: 5 days

6 years agoRemove redundand CLD instructions.
kib [Thu, 11 Jan 2018 13:22:13 +0000 (13:22 +0000)]
Remove redundand CLD instructions.

We already clear %RFLAGS.DF on the kernel entry due to the compiler's
ABI requirements.

Suggested by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

6 years agoDo not clear %RFLAGS.DF on fast syscall entry.
kib [Thu, 11 Jan 2018 12:54:33 +0000 (12:54 +0000)]
Do not clear %RFLAGS.DF on fast syscall entry.

Hardware already did it for us due to the mask loaded into the
MSR_SF_MASK msr register.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D13838

6 years agoMove the hardware setup for fast syscalls into a common function.
kib [Thu, 11 Jan 2018 12:40:43 +0000 (12:40 +0000)]
Move the hardware setup for fast syscalls into a common function.

Discussed with: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoRename COMMON_TSS_RSP0 to TSS_RSP0.
kib [Thu, 11 Jan 2018 12:28:08 +0000 (12:28 +0000)]
Rename COMMON_TSS_RSP0 to TSS_RSP0.

The symbol is just an offset in the hardware TSS structure, it is not
limited to the common_tss instance.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agoUpdate comment explaining the check, to reality.
kib [Thu, 11 Jan 2018 12:07:24 +0000 (12:07 +0000)]
Update comment explaining the check, to reality.

Discussed with: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agoPowerNV: add buffer for OPAL console
wma [Thu, 11 Jan 2018 09:42:24 +0000 (09:42 +0000)]
PowerNV: add buffer for OPAL console

Avoid the lock in vtophys() by providing a static direct-mapped
spinlock- protected output buffer to use when the console driver
cannot acquire locks for some reason. This allows the idle thread
to use printf() (e.g. the SMP startup messages) without crashing
the kernel.

Created by:            Nathan Whitehorn <nwhitehorn@freebsd.org>
Submitted by:          Wojciech Macek <wma@freebsd.org>
Sponsored by:          FreeBSD Foundation

6 years agoPowerNV: set LPCR[LPES] correctly
wma [Thu, 11 Jan 2018 09:39:38 +0000 (09:39 +0000)]
PowerNV: set LPCR[LPES] correctly

Make sure to set LPCR[LPES] so that external interrupts set SRR0 and SRR1
instead of HSRR0 and HSRR1. Without this, external interrupt handlers would
get the wrong MSR value when executing, causing eventual madness.

Created by:            Nathan Whitehorn <nwhitehorn@freebsd.org>
Submitted by:          Wojciech Macek <wma@freebsd.org>
Sponsored by:          FreeBSD Foundation

6 years agoPowerNV: correctly start secondary CPUs
wma [Thu, 11 Jan 2018 09:34:33 +0000 (09:34 +0000)]
PowerNV: correctly start secondary CPUs

Fix AP startup, which was broken.

Created by:            Nathan Whitehorn <nwhitehorn@freebsd.org>
Submitted by:          Wojciech Macek <wma@freebsd.org>
Sponsored by:          FreeBSD Foundation

6 years agoPowerNV: add reset, poweroff, OPAL console
wma [Thu, 11 Jan 2018 09:26:28 +0000 (09:26 +0000)]
PowerNV: add reset, poweroff, OPAL console

Add basic power control (reset, power off) and bind
ttyuX to opal console so that init will start login there.

Created by:            Nathan Whitehorn <nw@freebsd.org>
Submitted by:          Wojciech Macek <wma@freebsd.org>
Sponsored by:          FreeBSD Foundation

6 years agoCXGBE: fix get_filt to be endianness-aware
wma [Thu, 11 Jan 2018 09:17:02 +0000 (09:17 +0000)]
CXGBE: fix get_filt to be endianness-aware

Unconditional 32-bit shift is not endianness-safe.
Modify the logic to work both on LE and BE.

Submitted by:          Wojciech Macek <wma@freebsd.org>
Reviewed by:           np
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies
Differential revision: https://reviews.freebsd.org/D13102

6 years agoPowerNV: initial support for OPAL
wma [Thu, 11 Jan 2018 07:40:06 +0000 (07:40 +0000)]
PowerNV: initial support for OPAL

OPAL is a dedicated firmware acting as a hypervisor.
Add generic functions to provide all access.

Created by:            Nathan Whitehorn <nw@freebsd.org>
Submitted by:          Wojciech Macek <wma@freebsd.org>

6 years agoZstd: Add bswap intrinsics for small MIPS systems (e.g., Onion Omega)
cem [Thu, 11 Jan 2018 06:30:50 +0000 (06:30 +0000)]
Zstd: Add bswap intrinsics for small MIPS systems (e.g., Onion Omega)

Reported by: mizhka
Sponsored by: Dell EMC Isilon

6 years agoawk(1): Add necessary bits for connecting tests, but leave disconnected
kevans [Thu, 11 Jan 2018 05:36:13 +0000 (05:36 +0000)]
awk(1): Add necessary bits for connecting tests, but leave disconnected

The NetBSD test suite has 24 tests for awk, and we pass exactly 4 of them.
Add the necessary pieces for interested parties to easily connect the
tests and run them, but leave them disconnected for the time being.

Some of these tests outright segfault in our awk, others just exhibit the
wrong behavior.

6 years agoWhen we crash, we'll stop the scheduler before we call the
imp [Thu, 11 Jan 2018 03:11:41 +0000 (03:11 +0000)]
When we crash, we'll stop the scheduler before we call the
shutdown_post_sync event.  For adashutdown, this causes problems
because we need to poll for completion of the commands, but we're not
yet officially dumping yet, so the code from r326964 assumed we could
use the interrupt-driven commands rather than the polled ones. This
lead to a hang. Prevent this by also checking to see if the scheduler
is stopped to do the polling.

Reported by: markj@
Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D13845

6 years agoFlesh out static dtrace probes for /dev/crypto ioctl errors.
jhb [Thu, 11 Jan 2018 00:22:24 +0000 (00:22 +0000)]
Flesh out static dtrace probes for /dev/crypto ioctl errors.

In particular, no probes were present for AEAD requests, but also for
some other error cases in other ioctl requests.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

6 years agoAdd encrypt+authenticate modes to cryptotest tool
cem [Wed, 10 Jan 2018 23:19:32 +0000 (23:19 +0000)]
Add encrypt+authenticate modes to cryptotest tool

Like jhb's cryptocheck (uncommitted so far), express encrypt+authenticate
modes as "-a <encalg>+<authalg>".

Example use with aesni(4) on AMD Zen family:

$ ./cryptotest -d aesni0 -a aes256        10000 $((128*1024))
   2.331 sec,   20000 aes256       crypts,  131072 bytes, 1124707930 byte/sec,  8580.8 Mb/sec
$ ./cryptotest -d aesni0 -a sha256        10000 $((128*1024))
   1.109 sec,   10000 sha256       crypts,  131072 bytes, 1181577161 byte/sec,  9014.7 Mb/sec
$ ./cryptotest -d aesni0 -a aes256+sha256 10000 $((128*1024))
   3.805 sec,   10000 sha256+aes256 crypts,  131072 bytes, 344460116 byte/sec,  2628.0 Mb/sec

Reported by: jhb
Sponsored by: Dell EMC Isilon

6 years agox86: Document purpose of _safe variants of {rd,wr}msr()
cem [Wed, 10 Jan 2018 22:41:00 +0000 (22:41 +0000)]
x86: Document purpose of _safe variants of {rd,wr}msr()

Sponsored by: Dell EMC Isilon

6 years agomalloc.9: Fix minor typo from rewording in r327796
cem [Wed, 10 Jan 2018 22:20:49 +0000 (22:20 +0000)]
malloc.9: Fix minor typo from rewording in r327796

Sponsored by: Dell EMC Isilon

6 years agoFix minor locking issues in the Power Mac Uninorth PCI bridge driver.
landonf [Wed, 10 Jan 2018 22:19:11 +0000 (22:19 +0000)]
Fix minor locking issues in the Power Mac Uninorth PCI bridge driver.

- Call resource_int_value() once during attach, rather than within the
  pci_(read|write)_config() code path; this avoids taking a blocking mutex
  to read kenv variables.

- Use a spin lock to protect non-atomic config space accesses; this matches
  the behavior of Darwin's AppleMacRiscPCI driver.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D13839

6 years agomallocarray(9): panic if the requested allocation would overflow
cem [Wed, 10 Jan 2018 21:49:45 +0000 (21:49 +0000)]
mallocarray(9): panic if the requested allocation would overflow

Additionally, move the overflow check logic out to WOULD_OVERFLOW() for
consumers to have a common means of testing for overflowing allocations.
WOULD_OVERFLOW() should be a secondary check -- on 64-bit platforms, just
because an allocation won't overflow size_t does not mean it is a sane size
to request.  Callers should be imposing reasonable allocation limits far,
far, below overflow.

Discussed with: emaste, jhb, kp
Sponsored by: Dell EMC Isilon