]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoiwm: Use antenna B for TX on 9000-series chips.
markj [Thu, 7 Nov 2019 23:38:17 +0000 (23:38 +0000)]
iwm: Use antenna B for TX on 9000-series chips.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Update the station add command for the new RX API.
markj [Thu, 7 Nov 2019 23:37:55 +0000 (23:37 +0000)]
iwm: Update the station add command for the new RX API.

The firmware expects a new version of the add-station command in
9000-series chips.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Sync with iwm_run_init_mvm_ucode() with iwlwifi.
markj [Thu, 7 Nov 2019 23:37:30 +0000 (23:37 +0000)]
iwm: Sync with iwm_run_init_mvm_ucode() with iwlwifi.

Do not configure bluetooth on newer chips, it causes firmware panics.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Fix scheduler configuration for aux and cmd queue configuration.
markj [Thu, 7 Nov 2019 23:37:17 +0000 (23:37 +0000)]
iwm: Fix scheduler configuration for aux and cmd queue configuration.

- Configure the scheduler only for the management queue.
- Fix a bug when enabling the schduler: the queues are specified using a
  bitmask.
- Fix style in the area.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Implement the new receive path.
markj [Thu, 7 Nov 2019 23:37:02 +0000 (23:37 +0000)]
iwm: Implement the new receive path.

This is the multiqueue receive code required for 9000-series chips.
Note that we still only configure a single RX queue for now.  Multiqueue
support will require MSI-X configuration and a scheme for managing a
global pool of RX buffers.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Enable all 31 tx queues.
markj [Thu, 7 Nov 2019 23:36:46 +0000 (23:36 +0000)]
iwm: Enable all 31 tx queues.

For now iwm only ever uses queue 0 and the management queue, but my 9560
raises a software error interrupt during initialization if this flag is
not set.  iwlwifi sets it for all 7000- and 8000-series hardware, so we
might as well do it unconditionally.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Explicitly enable MSI on newer chipsets.
markj [Thu, 7 Nov 2019 23:36:25 +0000 (23:36 +0000)]
iwm: Explicitly enable MSI on newer chipsets.

9000-series chips implement support for MSI-X interrupts and disable MSI
by default.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Define the mqrx_supported capability.
markj [Thu, 7 Nov 2019 23:36:10 +0000 (23:36 +0000)]
iwm: Define the mqrx_supported capability.

The firmware for 9000-series and newer devices has a different receive
API which supports multiple queues.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Add device configuration definitions for 9000-series chips.
markj [Thu, 7 Nov 2019 23:35:54 +0000 (23:35 +0000)]
iwm: Add device configuration definitions for 9000-series chips.

Match such chips using the device ID.  We should really be checking the
subdevice as well, since a smaller number of 9460 and 9560 devices
actually belong to a new series of devices and require different
firmware, but that will require some extra logic in iwm_attach().

Submitted by: lwhsu, Guo Wen Jun <blockk2000@gmail.com>
MFC after: 2 weeks

4 years agoiwm: Sync the firmware tx_cmd descriptor fields with iwlwifi.
markj [Thu, 7 Nov 2019 23:35:29 +0000 (23:35 +0000)]
iwm: Sync the firmware tx_cmd descriptor fields with iwlwifi.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Use the same delays as iwlwifi when resetting the device.
markj [Thu, 7 Nov 2019 23:35:15 +0000 (23:35 +0000)]
iwm: Use the same delays as iwlwifi when resetting the device.

This is required for initialization to succeed for newer device
families.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Add a device family definition for 9000 chips.
markj [Thu, 7 Nov 2019 23:35:01 +0000 (23:35 +0000)]
iwm: Add a device family definition for 9000 chips.

Convert existing device family checks to avoid assuming that the device
family is always one of IWM_DEVICE_FAMILY_7000 or _8000.

Submitted by: lwhsu, Guo Wen Jun <blockk2000@gmail.com>
MFC after: 2 weeks

4 years agoiwm: Add 9000-series RX register definitions.
markj [Thu, 7 Nov 2019 23:34:41 +0000 (23:34 +0000)]
iwm: Add 9000-series RX register definitions.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Add a few _prph functions needed for 9000-series chips.
markj [Thu, 7 Nov 2019 23:34:28 +0000 (23:34 +0000)]
iwm: Add a few _prph functions needed for 9000-series chips.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Sync the TLV API enum with iwlwifi.
markj [Thu, 7 Nov 2019 23:34:12 +0000 (23:34 +0000)]
iwm: Sync the TLV API enum with iwlwifi.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Define a name for TLV 48.
markj [Thu, 7 Nov 2019 23:33:58 +0000 (23:33 +0000)]
iwm: Define a name for TLV 48.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Avoid calling iwm_start() each time a descriptor is reclaimed.
markj [Thu, 7 Nov 2019 23:29:57 +0000 (23:29 +0000)]
iwm: Avoid calling iwm_start() each time a descriptor is reclaimed.

Only perform the call when a qfull bit transitions.  While here, avoid
assignments in declarations in iwm_mvm_rx_tx_cmd().

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Call iwm_dev_check() earlier in iwm_attach().
markj [Thu, 7 Nov 2019 23:29:43 +0000 (23:29 +0000)]
iwm: Call iwm_dev_check() earlier in iwm_attach().

This ensures that the driver softc reflects device capabilities as early
as possible, for use by device initialization code that is conditional
on certain capabilities.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Simplify fw_has_{api,capa}().
markj [Thu, 7 Nov 2019 23:29:25 +0000 (23:29 +0000)]
iwm: Simplify fw_has_{api,capa}().

No functional change intended.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Remove a couple of unused fields from the softc.
markj [Thu, 7 Nov 2019 23:29:00 +0000 (23:29 +0000)]
iwm: Remove a couple of unused fields from the softc.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Fix style in the TX path.
markj [Thu, 7 Nov 2019 23:27:54 +0000 (23:27 +0000)]
iwm: Fix style in the TX path.

Also ensure that the htole* macros are applied correctly when specifying
the segment length and upper address bits.  No functional change
intended (unless you use iwm(4) on a big-endian machine).

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agolibcompat: build 32-bit rtld and ldd as part of "everything"
brooks [Thu, 7 Nov 2019 22:58:10 +0000 (22:58 +0000)]
libcompat: build 32-bit rtld and ldd as part of "everything"

Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included
directly so MD paths in Makefiles work. In the process centralize
setting them in LIBCOMPATWMAKEENV.

Alter .PATH and CFLAGS settings in work when the Makefile is included.

While here only support LIB32 on supported platforms rather than always
enabling it and requiring users of MK_LIB32 to filter based
TARGET/MACHINE_ARCH.

The net effect of this change is to make Makefile.libcompat only build
compatability libraries.

Changes relative to r354449:

Correct detection of the compiler type when bsd.compat.mk is used
outside Makefile.libcompat.  Previously it always matched the clang
case.

Set LDFLAGS including the linker emulation for mips where -m32 seems to
be insufficent.

Reviewed by: imp, kib (origional version in r354449)
Obtained from: CheriBSD (conceptually)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D22251

4 years agoRemove now unused INP_INFO_RLOCK macros.
glebius [Thu, 7 Nov 2019 22:26:54 +0000 (22:26 +0000)]
Remove now unused INP_INFO_RLOCK macros.

4 years agorevert r354482, checking for XENHVM was a wrong way of checking for Xen
avg [Thu, 7 Nov 2019 21:43:31 +0000 (21:43 +0000)]
revert r354482, checking for XENHVM was a wrong way of checking for Xen

4 years agobcm_lintc: don't attach if "interrupt-controller" is missing
kevans [Thu, 7 Nov 2019 21:31:15 +0000 (21:31 +0000)]
bcm_lintc: don't attach if "interrupt-controller" is missing

This is a standard required property for interrupt controllers, and present
on the bcm_lintc nodes for currently supported RPi models. For the RPi4, we
have both bcm_lintc as well as GIC-400, but only one may be active at a
time.

Don't probe bcm_lintc if it's missing the "interrupt-controller" property --
in RPi 4 DTS, the bcm_lintc node is actually missing this along with other
required interrupt properties. Presumably, if the earlier boot stages will
support switching to the legacy interrupt controller (as is suggested
possible by the documentation), the DTS will need to be updated to indicate
the proper interrupt-parent and hopefully also mark this node as an
interrupt-controller instead.

4 years agoIn TCP HPTS enter the epoch in tcp_hpts_thread() and assert it in
glebius [Thu, 7 Nov 2019 21:30:27 +0000 (21:30 +0000)]
In TCP HPTS enter the epoch in tcp_hpts_thread() and assert it in
the leaf functions.

4 years agoMechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER() in TCP
glebius [Thu, 7 Nov 2019 21:29:38 +0000 (21:29 +0000)]
Mechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER() in TCP
timewait manipulation leaf functions.

4 years agoSince pfslowtimo() runs in the network epoch, tcp_slowtimo()
glebius [Thu, 7 Nov 2019 21:28:46 +0000 (21:28 +0000)]
Since pfslowtimo() runs in the network epoch, tcp_slowtimo()
also does.  This allows to simplify tcp_tw_2msl_scan() and
always require the network epoch in it.

4 years agoNow that there is no R/W lock on PCB list the pcblist sysctls
glebius [Thu, 7 Nov 2019 21:27:32 +0000 (21:27 +0000)]
Now that there is no R/W lock on PCB list the pcblist sysctls
handlers can be greatly simplified.  All the previous double
cycling and complex locking was added to avoid these functions
holding global PCB locks for extended period of time, preventing
addition of new entries.

4 years agoNow that all of the tcp_input() and all its branches are executed
glebius [Thu, 7 Nov 2019 21:23:07 +0000 (21:23 +0000)]
Now that all of the tcp_input() and all its branches are executed
in the network epoch, we can greatly simplify synchronization.
Remove all unneccesary epoch enters hidden under INP_INFO_RLOCK macro.
Remove some unneccesary assertions and convert necessary ones into the
NET_EPOCH_ASSERT macro.

4 years agoIPI_TRACE is not really supported on xen
avg [Thu, 7 Nov 2019 21:14:59 +0000 (21:14 +0000)]
IPI_TRACE is not really supported on xen

x86 stack_save_td_running() can work safely only if IPI_TRACE is a
non-maskable interrupt.  But at the moment FreeBSD/Xen does not provide
support for the NMI delivery mode.  So, mark the functionality as
unsupported similarly to other platforms without NMI.
Maybe there is a way to provide a Xen-specific working
stack_save_td_running(), but I couldn't figure it out.

MFC after: 3 weeks
Sponsored by: Panzura

4 years agoRemove unnecessary recursive epoch enter via INP_INFO_RLOCK
glebius [Thu, 7 Nov 2019 21:08:49 +0000 (21:08 +0000)]
Remove unnecessary recursive epoch enter via INP_INFO_RLOCK
macro in udp_input().  It shall always run in the network epoch.

4 years agoRemove now unused INP_HASH_RLOCK() macros.
glebius [Thu, 7 Nov 2019 21:03:15 +0000 (21:03 +0000)]
Remove now unused INP_HASH_RLOCK() macros.

4 years agoNow with epoch synchronized PCB lookup tables we can greatly simplify
glebius [Thu, 7 Nov 2019 21:01:36 +0000 (21:01 +0000)]
Now with epoch synchronized PCB lookup tables we can greatly simplify
locking in udp_output() and udp6_output().

First, we select if we need read or write lock in PCB itself, we take
the lock and enter network epoch.  Then, we proceed for the rest of
the function.  In case if we need to modify PCB hash, we would take
write lock on it for a short piece of code.

We could exit the epoch before allocating an mbuf, but with this
patch we are keeping it all the way into ip_output()/ip6_output().
Today this creates an epoch recursion, since ip_output() enters epoch
itself.  However, once all protocols are reviewed, ip_output() and
ip6_output() would require epoch instead of entering it.

Note: I'm not 100% sure that in udp6_output() the epoch is required.
We don't do PCB hash lookup for a bound socket.  And all branches of
in6_select_src() don't require epoch, at least they lack assertions.
Today inet6 address list is protected by rmlock, although it is CKLIST.
AFAIU, the future plan is to protect it by network epoch.  That would
require epoch in in6_select_src().  Anyway, in future ip6_output()
would require epoch, udp6_output() would need to enter it.

4 years agoAdd INP_UNLOCK() which will do whatever R/W unlock is required.
glebius [Thu, 7 Nov 2019 20:57:51 +0000 (20:57 +0000)]
Add INP_UNLOCK() which will do whatever R/W unlock is required.

4 years agoSince r353292 on input path we are always in network epoch, when
glebius [Thu, 7 Nov 2019 20:49:56 +0000 (20:49 +0000)]
Since r353292 on input path we are always in network epoch, when
we lookup PCBs.  Thus, do not enter epoch recursively in
in_pcblookup_hash() and in6_pcblookup_hash().  Same applies to
tcp_ctlinput() and tcp6_ctlinput().

This leaves several sysctl(9) handlers that return PCB credentials
unprotected.  Add epoch enter/exit to all of them.

Differential Revision: https://reviews.freebsd.org/D22197

4 years agoRemove unnecessary recursive epoch enter via INP_INFO_RLOCK
glebius [Thu, 7 Nov 2019 20:44:34 +0000 (20:44 +0000)]
Remove unnecessary recursive epoch enter via INP_INFO_RLOCK
macro in divert_packet().  This function is called only from
pfil(9) filters, which in their place always run in the
network epoch.

4 years agoRemove unnecessary recursive epoch enter via INP_INFO_RLOCK
glebius [Thu, 7 Nov 2019 20:43:12 +0000 (20:43 +0000)]
Remove unnecessary recursive epoch enter via INP_INFO_RLOCK
macro in icmp6_rip6_input().  It shall always run in the
network epoch.

4 years agoRemove unnecessary recursive epoch enter via INP_INFO_RLOCK
glebius [Thu, 7 Nov 2019 20:40:44 +0000 (20:40 +0000)]
Remove unnecessary recursive epoch enter via INP_INFO_RLOCK
macro in raw input functions for IPv4 and IPv6.  They shall
always run in the network epoch.

4 years agoRemove unnecessary recursive epoch enter via INP_INFO_RLOCK
glebius [Thu, 7 Nov 2019 20:38:53 +0000 (20:38 +0000)]
Remove unnecessary recursive epoch enter via INP_INFO_RLOCK
macro in udp6_input().  It shall always run in the network epoch.

4 years agohwpmc : fix AMD perf counter MSR access
gallatin [Thu, 7 Nov 2019 19:54:24 +0000 (19:54 +0000)]
hwpmc : fix AMD perf counter MSR access

- amd_intr() does not account for the offset (0x200) in the counter
MSR address and ends up accessing invalid regions while reading
counter value after the 4th counter (0xC001000[8,9,..]) and
erroneously updates the counter values for counters [1-4].

- amd_intr() should only check core pmcs for interrupts since
 other types of pmcs (L3,DF) cannot generate interrupts.

- fix pmc NMI's being ignored due to NMI latency on newer AMD processors

Note that this fixes a kernel panic due to GPFs accessing MSRs on
higher core count AMD cpus (seen on both Rome 7502P, and
Threadripper 2990WX 32-core CPUs)

Discussed with: markj

Submitted by: Shreyank Amartya
Differential Revision: https://reviews.freebsd.org/D21553

4 years agoMerge commit f596f4507 from llvm git (by Sam Elliott):
dim [Thu, 7 Nov 2019 19:54:08 +0000 (19:54 +0000)]
Merge commit f596f4507 from llvm git (by Sam Elliott):

  [RISCV] Add Custom Parser for Atomic Memory Operands

  Summary:
  GCC Accepts both (reg) and 0(reg) for atomic instruction memory
  operands. These instructions do not allow for an offset in their
  encoding, so in the latter case, the 0 is silently dropped.

  Due to how we have structured the RISCVAsmParser, the easiest way to
  add support for parsing this offset is to add a custom AsmOperand and
  parser. This parser drops all the parens, and just keeps the
  register.

  This commit also adds a custom printer for these operands, which
  matches the GCC canonical printer, printing both `(a0)` and `0(a0)`
  as `(a0)`.

  Reviewers: asb, lewis-revill

  Reviewed By: asb

  Subscribers: s.egerton, hiraditya, rbar, johnrusso, simoncook,
  apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay,
  zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o,
  rkruppe, jfb, PkmX, jocewei, psnobl, benna, Jim, llvm-commits

  Tags: #llvm

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

  llvm-svn: 367553

Merge commit f596f4507 from llvm git (by Sam Elliott):

  [RISCV] Add FreeBSD targets

  Reviewers: asb

  Reviewed By: asb

  Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne,
  emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits

  Tags: #clang

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

  Patch by James Clarke (jrtc27)

  llvm-svn: 367557

Merge commit f596f4507 from llvm git (by Hsiangkai Wang):

  [DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.

  It is necessary to generate fixups in .debug_frame or .eh_frame as
  relaxation is enabled due to the address delta may be changed after
  relaxation.

  There is an opcode with 6-bits data in debug frame encoding. So, we
  also need 6-bits fixup types.

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

  llvm-svn: 366524

Merge commit f596f4507 from llvm git (by Hsiangkai Wang):

  [DebugInfo] Some fields do not need relocations even relax is enabled.

  In debug frame information, some fields, e.g., Length in CIE/FDE and
  Offset in FDE are attributes to describe the structure of CIE/FDE.
  They are not related to the relaxed code. However, these attributes
  are symbol differences. So, in current design, these attributes will
  be filled as zero and LLVM generates relocations for them.

  We only need to generate relocations for symbols in executable
  sections.  So, if the symbols are not located in executable sections,
  we still evaluate their values under relaxation.

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

  llvm-svn: 366531

Merge commit f596f4507 from llvm git (by Alex Bradbury):

  [RISCV] Don't force absolute FK_Data_X fixups to relocs

  The current behavior of shouldForceRelocation forces relocations for
  the majority of fixups when relaxation is enabled. This makes sense
  for fixups which incorporate symbols but is unnecessary for simple
  data fixups where the fixup target is already resolved to an absolute
  value.

  Differential Revision: https://reviews.llvm.org/D63404
  Patch by Edward Jones.

  llvm-svn: 369257

Merge commit f596f4507 from llvm git (by Alex Bradbury):

  [RISCV] Implement getExprForFDESymbol to ensure RISCV_32_PCREL is
  used for the FDE location

  Follow binutils in using RISCV_32_PCREL for the FDE initial location.
  As explained in the relevant binutils commit
  <https://github.com/riscv/riscv-binutils-gdb/commit/a6cbf936e3dce68114d28cdf60d510a3f78a6d40>,
  the ADD/SUB pair of relocations is problematic in the presence of
  linker relaxation.

  This patch has the same end goal as D64715 but includes test changes
  and avoids adding a new global VariantKind to MCExpr.h (preferring
  RISCVMCExpr VKs like the rest of the RISC-V backend).

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

  llvm-svn: 369375

This series of merges will permit riscv64 kernels and riscv64sf worlds
to build with clang instead of gcc (but still using the bfd linker).

Requested by: jhb
Obtained from: https://github.com/freebsd/freebsd/compare/master...bsdjhb:riscv_clang
MFC after: 1 month
X-MFC-With: r353358

4 years agoarch.7: claim 12.x as the last architecture with sparc64 support
emaste [Thu, 7 Nov 2019 19:37:26 +0000 (19:37 +0000)]
arch.7: claim 12.x as the last architecture with sparc64 support

GCC 4.2.1 is being removed before FreeBSD 13, as are some other
components required by FreeBSD/sparc64.  Contemporary GCC does not build
and there is currently no indication that anyone is going to address
these issues.

PR: 228919, 233405, 236839, 239851

4 years agoFix declaration of S1 by swapping misplaced ',' and ';'.
brooks [Thu, 7 Nov 2019 19:31:56 +0000 (19:31 +0000)]
Fix declaration of S1 by swapping misplaced ',' and ';'.

Reported by: kargl
Obtained from: OpenBSD (tb@openbsd.org)
MFC after: 1 week

4 years agoRevert change accidentally included in r354465.
brooks [Thu, 7 Nov 2019 19:28:03 +0000 (19:28 +0000)]
Revert change accidentally included in r354465.

Will recommit with a proper commit message shortly.

4 years agoRevert r354449: libcompat: build 32-bit rtld and ldd as part of "everything"
brooks [Thu, 7 Nov 2019 19:22:51 +0000 (19:22 +0000)]
Revert r354449: libcompat: build 32-bit rtld and ldd as part of "everything"

Additional testing is required..

4 years agosys/conf/files.arm64: remove some unnecessary soc_* dependencies
kevans [Thu, 7 Nov 2019 19:13:53 +0000 (19:13 +0000)]
sys/conf/files.arm64: remove some unnecessary soc_* dependencies

These files already have 'device' lines that they require; adding a
dependency on SOC_* options is an extra restriction that adds extra
verbosity when future supported Broadcom-based SOC will also feature the
same compatible device.

Users wishing to not compile these devices in should remove the 'device'
lines from their config.

4 years agosysctl_rtsock() has all necessary locking and doesn't need Giant to run.
glebius [Thu, 7 Nov 2019 19:06:18 +0000 (19:06 +0000)]
sysctl_rtsock() has all necessary locking and doesn't need Giant to run.
While here add description.

4 years agonetinet*: variable cleanup
bz [Thu, 7 Nov 2019 18:29:51 +0000 (18:29 +0000)]
netinet*: variable cleanup

In preparation for another change factor out various variable cleanups.
These mainly include:
(1) do not assign values to variables during declaration:  this makes
    the code more readable and does allow for better grouping of
    variable declarations,
(2) do not assign values to variables before need; e.g., if a variable
    is only used in the 2nd half of a function and we have multiple
    return paths before that, then do not set it before it is needed, and
(3) try to avoid assigning the same value multiple times.

MFC after: 3 weeks
Sponsored by: Netflix

4 years agoDrop Giant before sleeping on a busy page.
markj [Thu, 7 Nov 2019 18:26:29 +0000 (18:26 +0000)]
Drop Giant before sleeping on a busy page.

Before the page busy code was converted to make direct use of
sleepqueues, this was handled by _sleep().

Reported by: glebius
Reviewed by: kib
Sponsored by: The FreeBSD Foundation

4 years agoMerge commit e8316372b from llvm git (by Louis Dionne):
dim [Thu, 7 Nov 2019 18:26:01 +0000 (18:26 +0000)]
Merge commit e8316372b from llvm git (by Louis Dionne):

  [libc++] Add `__truncating_cast` for safely casting float types to
  integers

  This is needed anytime we need to clamp an arbitrary floating point
  value to an integer type.

  Thanks to Eric Fiselier for the patch.

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

  llvm-svn: 370891

Merge commit b92deded8 from llvm git (by Louis Dionne):

  [libc++] Move __clamp_to_integral to <cmath>, and harden against
  min()/max() macros

  llvm-svn: 370900

Merge commit 0ec6a4882 from llvm git (by Louis Dionne):

  [libc++] Fix potential OOB in poisson_distribution

  See details in the original Chromium bug report:
      https://bugs.chromium.org/p/chromium/issues/detail?id=994957

Together, these fix a security issue in libc++'s implementation of
std::poisson_distribution, which can be exploited to read data which is
out of bounds.

Note there are no programs in the FreeBSD base system that use
std::poisson_distribution, so this is only a possible issue for ports
and external programs which have been built against libc++.  Therefore,
I am bumping __FreeBSD_version for the benefit of our port maintainers.

Requested by: emaste
Security: potential OOB read
MFC after: 3 days

4 years agoThe cdceem(4) driver debuted in 12.1.
trasz [Thu, 7 Nov 2019 18:16:46 +0000 (18:16 +0000)]
The cdceem(4) driver debuted in 12.1.

MFC after: 2 weeks

4 years agoExtend the linux rc script to mount the neccessary file systems,
trasz [Thu, 7 Nov 2019 18:15:24 +0000 (18:15 +0000)]
Extend the linux rc script to mount the neccessary file systems,
set ELF fallback brand, and load pty(4).

Reviewed by: emaste (earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21874

4 years agoImport libxo-1.3.1:
phil [Thu, 7 Nov 2019 18:06:44 +0000 (18:06 +0000)]
Import libxo-1.3.1:
- handle argv[0] without '/'
- add test case for argv[0] without '/'

4 years agoAdd more 8 and 16 bit variants of the the atomic(9) functions on arm64.
andrew [Thu, 7 Nov 2019 17:34:44 +0000 (17:34 +0000)]
Add more 8 and 16 bit variants of the the atomic(9) functions on arm64.

These are direct copies of the 32 bit functions, adjusted ad needed.
While here fix atomic_fcmpset_16 to use the valid load and store exclusive
instructions.

Sponsored by: DARPA, AFRL

4 years agoAdd the missing volatile qualifier in atomic_store_ptr
andrew [Thu, 7 Nov 2019 17:21:17 +0000 (17:21 +0000)]
Add the missing volatile qualifier in atomic_store_ptr

MFC after: 1 week
Sponsored by: DARPA, AFRL

4 years agoAdd -0 option to ENV(1)
jrm [Thu, 7 Nov 2019 17:14:59 +0000 (17:14 +0000)]
Add -0 option to ENV(1)

With the -0 option added to ENV(1), some ports will no longer require genv
from sysutils/coreutils.

Reviewed by: kevans (prior version), swills
Approved by: bcr (manpages), imp
Differential Revision: https://reviews.freebsd.org/D22230

4 years agolibcompat: build 32-bit rtld and ldd as part of "everything"
brooks [Thu, 7 Nov 2019 17:10:33 +0000 (17:10 +0000)]
libcompat: build 32-bit rtld and ldd as part of "everything"

Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included
directly so MD paths in Makefiles work. In the process centralize
setting them in LIBCOMPATWMAKEENV.

Alter .PATH and CFLAGS settings in work when the Makefile is included.

While here only support LIB32 on supported platforms rather than always
enabling it and requiring users of MK_LIB32 to filter based
TARGET/MACHINE_ARCH.

The net effect of this change is to make Makefile.libcompat only build
compatability libraries.

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

4 years agoWiden network epoch coverage in nd6_prefix_onlink() as
glebius [Thu, 7 Nov 2019 17:00:20 +0000 (17:00 +0000)]
Widen network epoch coverage in nd6_prefix_onlink() as
in6ifa_ifpforlinklocal() requires the epoch.

Reported by: bz
Reviewed by: bz

4 years agolinux_renameat2: improve flag checks
emaste [Thu, 7 Nov 2019 15:51:44 +0000 (15:51 +0000)]
linux_renameat2: improve flag checks

In the cases where Linux returns an error (e.g. passing in an undefined
flag) there's no need for us to emit a message.  (The target of this
message is a developer working on the linuxulatorm, not the author of
presumably broken Linux software).

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21606

4 years agorc.shutdown: print a newline before watchdog timeout message
emaste [Thu, 7 Nov 2019 15:48:46 +0000 (15:48 +0000)]
rc.shutdown: print a newline before watchdog timeout message

Previously the watchdog timeout message was appended to the last entry
in the "Waiting for PIDS" list, resulting in a message like

    Waiting for PIDS: 31299 31296 90201 9020090 second watchdog timeout
    expired. Shutdown terminated.

Print a newline to separate the watchdog timeout message.  Also perform
the kill before logging or echoing the message.

PR: 241072
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

4 years agonvdimm.4: small grammar improvements
emaste [Thu, 7 Nov 2019 15:47:05 +0000 (15:47 +0000)]
nvdimm.4: small grammar improvements

4 years agoEnqueue lladdr_task to update link level address of vlan, when its parent
ae [Thu, 7 Nov 2019 15:00:37 +0000 (15:00 +0000)]
Enqueue lladdr_task to update link level address of vlan, when its parent
interface has changed.

During vlan reconfiguration without destroying interface, it is possible,
that parent interface will be changed. This usually means, that link
layer address of vlan will be different. Therefore we need to update all
associated with vlan's addresses permanent llentries - NDP for IPv6
addresses, and ARP for IPv4 addresses. This is done via lladdr_task
execution. To avoid extra work, before execution do the check, that L2
address is different.

No objection from: #network
Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D22243

4 years agoarch.7: armv6 uses lld by default as of r354289
emaste [Thu, 7 Nov 2019 14:14:51 +0000 (14:14 +0000)]
arch.7: armv6 uses lld by default as of r354289

4 years agofix zpool list property names
avg [Thu, 7 Nov 2019 11:50:53 +0000 (11:50 +0000)]
fix zpool list property names

This change is based on
r354380 8899 zpool list property documentation doesn't match actual behaviour

There is no "used" pool property, "alloc" is actually spelled
"allocated".

MFC after: 5 days

4 years agoMFV r354377: 10554 Implemented zpool sync command
avg [Thu, 7 Nov 2019 11:18:28 +0000 (11:18 +0000)]
MFV r354377: 10554 Implemented zpool sync command

illumos/illumos-gate@9c2acf00e275b6b2125a306f33cdddcc58393220
https://github.com/illumos/illumos-gate/commit/9c2acf00e275b6b2125a306f33cdddcc58393220

https://www.illumos.org/issues/10554
  During the port of MMP (illumos bug 10499) from ZoL, I found this
  earlier ZoL project is a prerequisite. Here is the original
  description.  This addition will enable us to sync an open TXG to the
  main pool on demand. The functionality is similar to 'sync(2)' but
  'zpool sync' will return when data has hit the main storage instead of
  potentially just the ZIL as is the case with the 'sync(2)' cmd.

Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Author: Alek Pinchuk <apinchuk@datto.com>
MFC after: 3 weeks
Relnotes: possibly

4 years agoloader: implement fallback efi_devpath_to_name()
tsoome [Thu, 7 Nov 2019 11:17:03 +0000 (11:17 +0000)]
loader: implement fallback efi_devpath_to_name()

UEFI 1.10 on macs does not seem to provide devpath to name translation,
provide our own (limited) version, so we can get information about commmon
devices.

MFC after: 1 week

4 years agoadd a note about nctgpio and wbwd move to superio
avg [Thu, 7 Nov 2019 07:21:23 +0000 (07:21 +0000)]
add a note about nctgpio and wbwd move to superio

4 years agoBack out encoder compilation to unbreak HEAD.
phil [Thu, 7 Nov 2019 07:09:28 +0000 (07:09 +0000)]
Back out encoder compilation to unbreak HEAD.

4 years agoMerge commit 8e34dd941 from llvm git (by Sanjay Patel):
dim [Thu, 7 Nov 2019 06:59:09 +0000 (06:59 +0000)]
Merge commit 8e34dd941 from llvm git (by Sanjay Patel):

  [x86] avoid crashing when splitting AVX stores with non-simple type
  (PR43916)

  The store splitting transform was assuming a simple type (MVT), but
  that's not necessarily the case as shown in the test.

This should fix 'Assertion failed: (isSimple() && "Expected a
SimpleValueType!")' when building the security/openssl111 port targeting
a CPU that supports AVX, but not AVX2, such as sandybridge.

PR: 241747
MFC after: 1 month
X-MFC-With: r353358

4 years agoRevert r354238 as the issue has been fixed in r354418
lwhsu [Thu, 7 Nov 2019 04:04:06 +0000 (04:04 +0000)]
Revert r354238 as the issue has been fixed in r354418

PR: 241562
Sponsored by: The FreeBSD Foundation

4 years agoImport libxo-1.3.0:
phil [Thu, 7 Nov 2019 03:57:04 +0000 (03:57 +0000)]
Import libxo-1.3.0:
- move from "oxtradoc" to RST/Sphinx documentation
- new "csv" encoder, which allows path and leaf lists
- address warnings from PVS-Stdio tool
- add "xolint" detected errors to the documentation

4 years agoTag libxo 1.3.0
phil [Thu, 7 Nov 2019 03:47:13 +0000 (03:47 +0000)]
Tag libxo 1.3.0

4 years agoImport libxo 1.3.0
phil [Thu, 7 Nov 2019 03:46:17 +0000 (03:46 +0000)]
Import libxo 1.3.0

4 years agoTCP timers are executed in callout context, so they need to enter network
glebius [Thu, 7 Nov 2019 00:27:23 +0000 (00:27 +0000)]
TCP timers are executed in callout context, so they need to enter network
epoch to look into PCB lists.  Mechanically convert INP_INFO_RLOCK() to
NET_EPOCH_ENTER().  No functional change here.

4 years agoMechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER() in
glebius [Thu, 7 Nov 2019 00:10:14 +0000 (00:10 +0000)]
Mechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER() in
TCP functions that are executed in syscall context.  No
functional change here.

4 years agoMechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER().
glebius [Thu, 7 Nov 2019 00:08:34 +0000 (00:08 +0000)]
Mechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER().
Remove few outdated comments and extraneous assertions.  No
functional change here.

4 years agoFix the alignment of struct xunpcb on systems with >64-bit pointers.
brooks [Thu, 7 Nov 2019 00:07:54 +0000 (00:07 +0000)]
Fix the alignment of struct xunpcb on systems with >64-bit pointers.

Reviewed by: emaste
Obtained from: CheriBSD
MFC after: 3 days
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D22268

4 years agoIf vm_pager_get_pages_async() returns an error synchronously we leak wired
glebius [Wed, 6 Nov 2019 23:45:43 +0000 (23:45 +0000)]
If vm_pager_get_pages_async() returns an error synchronously we leak wired
and busy pages.  Add code that would carefully cleanups the state in case
of synchronous error return.  Cover a case when a first I/O went on
asynchronously, but second or N-th returned error synchronously.

In collaboration with: chs
Reviewed by: jtl, kib

4 years agoclang: Enable unwind tables on !amd64
cem [Wed, 6 Nov 2019 23:44:38 +0000 (23:44 +0000)]
clang: Enable unwind tables on !amd64

There doesn't seem to be much sense in defaulting "on" unwind tables on
amd64 and not on other arches.  It causes surprising differences between
platforms, such as the PR below.

Prior to this change, FreeBSD inherited the default implementation of the
method from the Gnu.h Generic_Elf => Generic_GCC parent class, which
returned true only for amd64 targets.  Override that and opt on always,
similar to, e.g., NetBSD.

PR: 241562
Reported by: lwhsu
Reviewed by: dim
Discussed with: emaste
MFC after: I'm not going to, but you should feel free
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D22252

4 years agoAdd FreeBSD 11.3
sevan [Wed, 6 Nov 2019 23:40:09 +0000 (23:40 +0000)]
Add FreeBSD 11.3

4 years agom_pulldown(): Change an if () panic() into a KASSERT().
bz [Wed, 6 Nov 2019 22:40:19 +0000 (22:40 +0000)]
m_pulldown(): Change an if () panic() into a KASSERT().

If we pass in a NULL mbuf to m_pulldown() we are in a bad situation
already.  There is no point in doing that check for production code.
Change the if () panic() into a KASSERT.

MFC after: 3 weeks
Sponsored by: Netflix

4 years agoloader.efi: HARDDRIVE_DEVICE_PATH may have subpaths
tsoome [Wed, 6 Nov 2019 21:13:10 +0000 (21:13 +0000)]
loader.efi: HARDDRIVE_DEVICE_PATH may have subpaths

The macos does create Vendor Media devices on top of APFS container
(like partition table inside the partition), so we need to collect such
devices into respective device tree.

MFC after: 1 week

4 years agoMake linux(4) create /dev/shm. Linux applications often expect
trasz [Wed, 6 Nov 2019 20:53:33 +0000 (20:53 +0000)]
Make linux(4) create /dev/shm.  Linux applications often expect
a tmpfs to be mounted there, and because they like to verify it's
actually a mountpoint, a symlink won't do.

Reviewed by: dchagin (earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20333

4 years agomgb: Correct spello - recieve -> receive
emaste [Wed, 6 Nov 2019 20:43:40 +0000 (20:43 +0000)]
mgb: Correct spello - recieve -> receive

Reported by: N. J. Mann
MFC with: r354410

4 years agoAdd mgb(4) (Microchip LAN783x PCIe NIC) man page
emaste [Wed, 6 Nov 2019 19:52:31 +0000 (19:52 +0000)]
Add mgb(4) (Microchip LAN783x PCIe NIC) man page

Sponsored by: The FreeBSD Foundation

4 years agoIntroduce if_mgb driver for Microchip LAN743x PCIe NIC
emaste [Wed, 6 Nov 2019 19:51:40 +0000 (19:51 +0000)]
Introduce if_mgb driver for Microchip LAN743x PCIe NIC

The Microchip LAN7430 is a PCIe 10/100/1000 Ethernet MAC with integrated
PHY, and the LAN7431 is a MAC with RGMII interface.

To be connected to the build after further testing and review.
Committing now so that changes like r354345 (adding a common
ETHER_IS_ZERO macro) will update this driver too.

Submitted by: Gerald ND Aryeetey <aryeeteygerald_rogers.com>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20079

4 years agolibstats: Improve ABI assertion.
brooks [Wed, 6 Nov 2019 19:44:44 +0000 (19:44 +0000)]
libstats: Improve ABI assertion.

On platforms where pointers are larger than 64-bits, struct statsblob
may be harmlessly padded out such that opaque[] always has some included
space.  Make the assertion more general by comparing to the offset of
opaque rather than the size of struct statsblob.

Discussed with: jhb, James Clarke
Reviewed by: trasz, lstewart
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D22188

4 years agoRemove obsolete addition of MACHINE_CPUARCH
imp [Wed, 6 Nov 2019 18:54:04 +0000 (18:54 +0000)]
Remove obsolete addition of MACHINE_CPUARCH

In the past, we would add symbolic links for MACHINE_CPUARCH when it differed
from MACHINE. This was for pc98 only, however. All other architectures didn't
need this and it was really due to pc98 pulling from i386 rather than something
more intrinsic. At the time, we had the split we did to mimic what NetBSD did
for its 68k ports where many different kernels were possible for the same
architecture. Since then, both projects have moved away from this convention to
having a more generic MACHINE for each architecture. FreeBSD's new arm64/aarch64
breaks this old notion and so was an exception to the rule. So, we no longer
need to create this link for any old machine or any new machine, delete it
entirely.

Differential Revision: https://reviews.freebsd.org/D22246

4 years agoarm64: allwinner: a64: Do not init the video related clocks
manu [Wed, 6 Nov 2019 18:39:32 +0000 (18:39 +0000)]
arm64: allwinner: a64: Do not init the video related clocks

This should be handled by the video drivers and this break EFIFB
as this changes clock setup by the bootloader.

MFC after: 1 month

4 years agoConvert ksyms(4) to use an OBJT_PHYS object.
markj [Wed, 6 Nov 2019 17:03:06 +0000 (17:03 +0000)]
Convert ksyms(4) to use an OBJT_PHYS object.

The pages stored in the ksyms object are not pageable.  Moreover, this
obviates the need to set OBJ_NOSPLIT.

Reviewed by: alc, kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22229

4 years agoblacklistd.conf.5: pluralization correction
emaste [Wed, 6 Nov 2019 17:01:35 +0000 (17:01 +0000)]
blacklistd.conf.5: pluralization correction

Submitted by: bcr in review D22259
MFC with: r354399

4 years agoFix a race in release_page().
markj [Wed, 6 Nov 2019 16:59:16 +0000 (16:59 +0000)]
Fix a race in release_page().

Since r354156 we may call release_page() without the page's object lock
held, specifically following the page copy during a CoW fault.
release_page() must therefore unbusy the page only after scheduling the
requeue, to avoid racing with a free of the page.  Previously, the
object lock prevented this race from occurring.

Add some assertions that were helpful in tracking this down.

Reported by: pho, syzkaller
Tested by: pho
Reviewed by: alc, jeff, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22234

4 years agoblacklist: update to NetBSD snapshot on 20191106
emaste [Wed, 6 Nov 2019 16:21:35 +0000 (16:21 +0000)]
blacklist: update to NetBSD snapshot on 20191106

Cursory review: cem
MFC after: 3 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22259

4 years agoarm: allwinner: aw_mmc: Check if the regulator support the voltage
manu [Wed, 6 Nov 2019 14:58:25 +0000 (14:58 +0000)]
arm: allwinner: aw_mmc: Check if the regulator support the voltage

Don't blindy say that we support both 3.3V and 1.8V.
If we have a regulator for the data lines, check that the voltage is
supported before adding the signaling caps.
If we don't have a regulator, just assume that the data lines are 3.3V
This unbreak eMMC on some allwinner boards.

Reported by: ganbold
MFC after: 1 month
X-MFC-With: r354396

4 years agoregulator: Add regulator_check_voltage function
manu [Wed, 6 Nov 2019 14:55:24 +0000 (14:55 +0000)]
regulator: Add regulator_check_voltage function

This function will call the regnode_check_voltage method for a given regulator
and check if the desired voltage in reachable by it.
Also adds a default method that check the std_param and which should be enough
for most regulators and add it as the method for axp* rk805 and fixed regulators.

Reviewed by: mmel
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D22260

4 years agoIPv6 tests: test case for scapy bpf parsing bug
bz [Wed, 6 Nov 2019 14:43:35 +0000 (14:43 +0000)]
IPv6 tests: test case for scapy bpf parsing bug

PR: 239380
Reported by: lwhsu, CI system
MFC after: 3 weeks
Sponsored by: Netflix

4 years agoipv6 tests: cleanup
bz [Wed, 6 Nov 2019 14:30:56 +0000 (14:30 +0000)]
ipv6 tests:  cleanup

Remove mentions of fragmentation tests from extension header test.
Remove setting an MTU > IF_MAXMTU from the test cases to avoid warnings;
this was only possible in a local research tree.

MFC after: 2 weeks
Sponsored by: Netflix

4 years agozstd: Add an Xlist and document use during import
cem [Wed, 6 Nov 2019 06:50:02 +0000 (06:50 +0000)]
zstd: Add an Xlist and document use during import

No functional change.

4 years agopowerpc/booke: Fix pmap_mapdev_attr() for multi-TLB1 entry mappings
jhibbits [Wed, 6 Nov 2019 04:40:12 +0000 (04:40 +0000)]
powerpc/booke: Fix pmap_mapdev_attr() for multi-TLB1 entry mappings

Also, fix pmap_change_attr() to ignore non-kernel mappings.

* Fix a masking bug in mmu_booke_mapdev_attr() which caused it to align
  mappings to the smallest mapping alignment, instead of the largest.  This
  caused mappings to be potentially pessimally aligned, using more TLB
  entries than necessary.
* Return existing mappings from mmu_booke_mapdev_attr() that span more than
  one TLB1 entry.  The drm-current-kmod drivers map discontiguous segments
  of the GPU, resulting in more than one TLB entry being used to satisfy the
  mapping.
* Ignore non-kernel mappings in mmu_booke_change_attr().  There's a bug in
  the linuxkpi layer that causes it to actually try to change physical
  address mappings, instead of virtual addresses.  amd64 doesn't encounter
  this because it ignores non-kernel mappings.

With this it's possible to use drm-current-kmod on Book-E.