]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r320872:
kib [Thu, 29 Mar 2018 19:32:25 +0000 (19:32 +0000)]
MFC r320872:
Create libdl.so.1 as a filter for libc.so.7 which exports public dl*
functions.

6 years agoMFC r331562 (manu):
gjb [Thu, 29 Mar 2018 19:29:12 +0000 (19:29 +0000)]
MFC r331562 (manu):
 release: arm: Copy boot.scr from ports

 Latest u-boot update need u-boot script to load and start ubldr.
 (See D14230 for more details)
 Copy this file for our arm release on the fat partition.

6 years agoMFC r331375:
kib [Thu, 29 Mar 2018 15:12:03 +0000 (15:12 +0000)]
MFC r331375:
Do not send signals to init directly from shutdown_nice(9), do it from
the task context.

6 years agoMFC r331374:
kib [Thu, 29 Mar 2018 15:08:40 +0000 (15:08 +0000)]
MFC r331374:
Fixes for ptrace(PT_GETXSTATE_INFO) related to the padding in struct
ptrace_xstate_info).

6 years agoMFC 331345:
rpokala [Thu, 29 Mar 2018 15:00:48 +0000 (15:00 +0000)]
MFC 331345:

jedec_dimm: Use correct string length when populating sc->slotid_str

Don't limit the copy to the size of the target string *pointer* (always
4 on 32-bit / 8 on 64-bit). Instead, just use strdup().

6 years agoMFC kernel build-id support
emaste [Thu, 29 Mar 2018 12:52:58 +0000 (12:52 +0000)]
MFC kernel build-id support

MFC r320244, r320245, r320246, r320247, r320248, r320249,
    r320250 (bdrewery):

Add basic bsd.linker.mk auto included from bsd.compiler.mk.
This will provide LINKER_TYPE and LINKER_VERSION.

Support XLD for setting X_LINKER_TYPE and X_LINKER_VERSION.
This is similar to r300350 for bsd.compiler.mk.

Support cached linker values in environment.
This is similar to r289659 for bsd.compiler.mk.

LINKER_VERSION: Support external binutils.
The ports binutils stores the version in the 5th word so just look for
a version using a pattern instead.

Don't overwrite already-set LINKER_VERSION/LINKER_TYPE.

Provide proper values for X_LINKER_TYPE/VERSION when XLD == LD.

Pass along LINKER_* vars during installworld and show in test-system-compiler.

MFC r320258, r320272, r320275, r320502 (emaste):

change GNU ld LINKER_TYPE from binutils to bfd

GNU binutils includes two linkers: ld.bfd and ld.gold.  For clarity use
LINKER_TYPE=bfd to refer to ld.bfd, the original binutils linker that
identifies itself as "GNU ld".

bsd.linker.mk: add band-aid for linker invocation failure

In some cases bsd.linker.mk reports an error like:

  make[4]: ".../share/mk/bsd.linker.mk" line 56:
  Unknown linker from LD=ld -m elf32ppc_fbsd:"

For now change this to a .warning, and then assume GNU ld 2.17.50.
At present the linker type detection is used only for enabling build-id,
and we can carry on without it when type detection fails.

Also, show errors from ${LD} --version to aid in failure diagnosis.
Successful invocations of ${LD} --version produce no output on stderr
so this will not create any spam in non-failing builds.

enable --build-id for the kernel link

A Build-ID is an identifier generated at link time to uniquely identify
ELF binaries.  It allows efficient confirmation that an executable or
shared library and a corresponding standalone debuginfo file match.
(Otherwise, a checksum of the debuginfo file must be calculated when
opening it in a debugger.)

The FreeBSD base system includes GNU bfd ld 2.17.50 as the linker for
architectures other than arm64.  Build-ID support was added to bfd ld
shortly after that version, so was not previously available to us.

We can now start making use of Build-ID as we migrate to using lld or
bfd ld from ports, conditionally enabled based on the LINKER_TYPE and
LINKER_VERSION make variables added in r320244 and subsequent commits.

Introduce LINKER_FEATURES to avoid duplicating version logic

MFC r327857 (bdrewery, submitted by Dan McGregor):
Cache LINKER_FEATURES to fix the wrong ones being used.

Sponsored by:   Dell EMC Isilon
Sponsored by:   The FreeBSD Foundation

6 years agoMFC r305860, r306371
araujo [Thu, 29 Mar 2018 05:01:49 +0000 (05:01 +0000)]
MFC r305860, r306371

r305860:
Add an option called "random" that combined with "ether" can generate a
random MAC address for an Ethernet interface.

PR: 211984
Submitted by: pi@
Reviewed by: gnn, cem, jhb, lidl, rpokala, wblock
Approved by: wblock (manpages)

r306371:
Indicate that this is a locally administered MAC address.

Submitted by: lidl
Differential Revision: https://reviews.freebsd.org/D7903

PR: 226459
Requested by: tobik

6 years agoMFC r329817:
araujo [Thu, 29 Mar 2018 04:51:07 +0000 (04:51 +0000)]
MFC r329817:

The firewall_type is ignored if not set in rc.conf or rc.conf.local,
after r190575 there is an option to call rc.firewall with the firewall_type
passed in as an argument.

Submitted by: David P. Discher <dpd@dpdtech.com>
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D14286

6 years agoMFC r325621, r325622, r331227
mjoras [Thu, 29 Mar 2018 04:41:45 +0000 (04:41 +0000)]
MFC r325621, r325622, r331227

Add EVENTHANDLER_LIST and some users.

Also fix a longstanding bug in mtx initialization.

6 years agoRevert r330897:
eadler [Thu, 29 Mar 2018 02:50:57 +0000 (02:50 +0000)]
Revert r330897:

This was intended to be a non-functional change. It wasn't. The commit
message was thus wrong. In addition it broke arm, and merged crypto
related code.

Revert with prejudice.

This revert skips files touched in r316370 since that commit was since
MFCed. This revert also skips files that require $FreeBSD$ property
changes.

Thank you to those who helped me get out of this mess including but not
limited to gonzo, kevans, rgrimes.

Requested by: gjb (re)

6 years agoMFC r329738: MFV r329736: 8969 Cannot boot from RAIDZ with parity > 1
mav [Thu, 29 Mar 2018 02:25:34 +0000 (02:25 +0000)]
MFC r329738: MFV r329736: 8969 Cannot boot from RAIDZ with parity > 1

illumos/illumos-gate@0fb055e81fd0cda5221da8ddd98b2f8d1fc6bdbe

At present it is possible to boot from a root pool that is on RAIDZ but not
one that is on RAIDZ2 or RAIDZ3.  This is because, at the time the pool
version is checked to ensure support for dual/triple parity, the uberblock
has not yet been loaded into the SPA and therefore the code determines that
the pool version is too old and returns ENOTSUP.

Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: Andriy Gapon <avg@FreeBSD.org>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Andy Fiddaman <omnios@citrus-it.co.uk>

FreeBSD already had this fixed, so this is just a diff reduction.

6 years agoMFC r331559:
gjb [Thu, 29 Mar 2018 00:42:44 +0000 (00:42 +0000)]
MFC r331559:
 Escape trailing newlines in a long variable list for consistency.

Sponsored by: The FreeBSD Foundation

6 years agoMFC 331248: Set the proper vnet in IPsec callback functions.
jhb [Wed, 28 Mar 2018 17:49:31 +0000 (17:49 +0000)]
MFC 331248: Set the proper vnet in IPsec callback functions.

When using hardware crypto engines, the callback functions used to handle
an IPsec packet after it has been encrypted or decrypted can be invoked
asynchronously from a worker thread that is not associated with a vnet.
Extend 'struct xform_data' to include a vnet pointer and save the current
vnet in this new member when queueing crypto requests in IPsec.  In the
IPsec callback routines, use the new member to set the current vnet while
processing the modified packet.

This fixes a panic when using hardware offload such as ccr(4) with IPsec
after VIMAGE was enabled in GENERIC.

Sponsored by: Chelsio Communications

6 years agoMFC r326992: embed_mfs: support embedding mfs into loader
emaste [Wed, 28 Mar 2018 17:19:04 +0000 (17:19 +0000)]
MFC r326992: embed_mfs: support embedding mfs into loader

The script originally supported embedding an mfs into ELF files or any
other type of file, because it searched for magic strings to mark the
beginning and end of the embeddable section. It was later modified to
read the section offset and length via readelf, which made it work for
ELF only. Restore the ability to update arbitrary file types by using
the readelf technique for ELF, and the magic string technique for all
others (including PE/COFF files like loader.efi).

Submitted by: Zakary Nafziger <worldofzak@gmail.com>

MFC r327526: embed_mfs: correctly test grep return value

Reported by: br

MFC r327527: ath: revert accidental change committed with r327526

Sponsored by: The FreeBSD Foundation

6 years agoMFC r324707: embed_mfs: add error handling, usage
emaste [Wed, 28 Mar 2018 17:16:16 +0000 (17:16 +0000)]
MFC r324707: embed_mfs: add error handling, usage

Ensure that we are called with two arguments, and that the output file
is writable. Also, if we cannot find the mfs section report the output
file name rather than "kernel", as this script may be used with other
than kernels.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r315522: use INT3 instead of NOP for x86 binary padding
emaste [Wed, 28 Mar 2018 16:58:24 +0000 (16:58 +0000)]
MFC r315522: use INT3 instead of NOP for x86 binary padding

We should never end up executing the inter-function padding, so we
are better off faulting than silently carrying on to whatever function
happens to be next.

Note that LLD does this by default.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r323623: rename(2): document capability mode errors
emaste [Wed, 28 Mar 2018 16:55:45 +0000 (16:55 +0000)]
MFC r323623: rename(2): document capability mode errors

Sponsored by: The FreeBSD Foundation

6 years agoMFC r325422: posix_fallocate.2: add an EINVAL errno case
emaste [Wed, 28 Mar 2018 16:54:15 +0000 (16:54 +0000)]
MFC r325422: posix_fallocate.2: add an EINVAL errno case

As of r325320 in HEAD posix_fallocate returns EINVAL on ZFS to indicate
that the underlying filesystem does not support this operation, per
POSIX.1-2008. Document this case in the man page.

Note that r325320 has not yet been merged to stable/11, and may or may
not be.  However, we should document that EINVAL may be returned if the
filesystem does not support posix_fallocate (even if we don't actually
do so in stable/11), as software should be prepared to handle that case.

Discussed with: avg
Sponsored by: The FreeBSD Foundation

6 years agoRegen *sysent.c after r331679 - posix_fallocate in capability mode
emaste [Wed, 28 Mar 2018 14:44:45 +0000 (14:44 +0000)]
Regen *sysent.c after r331679 - posix_fallocate in capability mode

Sponsored by: The FreeBSD Foundation

6 years agoMFC r324560: allow posix_fallocate in capability mode
emaste [Wed, 28 Mar 2018 14:39:56 +0000 (14:39 +0000)]
MFC r324560: allow posix_fallocate in capability mode

posix_fallocate is logically equivalent to writing zero blocks to the
desired file size and there is no reason to prevent calling it in
capability mode. posix_fallocate already checked for the CAP_WRITE
right, so we merely need to list it in capabilities.conf.

Also MFC r324564: allow posix_fallocate in 32-bit compat capability mode

Sponsored by: The FreeBSD Foundation

6 years agoMFC Capsicum open(2) and openat(2) documentation
emaste [Wed, 28 Mar 2018 14:35:24 +0000 (14:35 +0000)]
MFC Capsicum open(2) and openat(2) documentation

r306537 by cem: open.2: Document Capsicum behavior

Document open(2) and openat(2) behavior in Capsicum capability mode.

Sponsored by: Dell EMC Isilon

r323622 by emaste: open(2): update ENOTCAPABLE description for .. lookups

After r308732 (MFC of r308212) Capsicum permits .. lookups in capability
mode, as long as path component traversal does not escape the directory
corresponding to the provided file descriptor.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r331538:
markj [Wed, 28 Mar 2018 14:01:26 +0000 (14:01 +0000)]
MFC r331538:
Clamp IFLIB_RX_COPY_THRESH to MHLEN in iflib_rxd_pkt_get().

6 years agoMFC r331536:
markj [Wed, 28 Mar 2018 14:00:46 +0000 (14:00 +0000)]
MFC r331536:
Use LIST_FOREACH_SAFE in sleepq_chains_remove_matching().

6 years agoMFC r331329: Fix kernel memory disclosure in ibcs2_getdents
emaste [Wed, 28 Mar 2018 13:41:43 +0000 (13:41 +0000)]
MFC r331329: Fix kernel memory disclosure in ibcs2_getdents

ibcs2_getdents() copies a dirent structure to userland.  The ibcs2
dirent structure contains a 2 byte pad element.  This element is never
initialized, but copied to userland none-the-less.

Note that ibcs2 has not built on HEAD since r302095.

Submitted by: Domagoj Stolfa <ds815@cam.ac.uk>
Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Security: Kernel memory disclosure (803)
Sponsored by: The FreeBSD Foundation

6 years agoRevert r331551. It is causing perl and tcl port build failures.
markj [Wed, 28 Mar 2018 13:39:20 +0000 (13:39 +0000)]
Revert r331551. It is causing perl and tcl port build failures.

Reported by: antoine

6 years agoMFC r331481: Import tzdata 2018d
philip [Wed, 28 Mar 2018 07:42:50 +0000 (07:42 +0000)]
MFC r331481: Import tzdata 2018d

6 years agoMFC: r331533
eadler [Wed, 28 Mar 2018 05:58:08 +0000 (05:58 +0000)]
MFC: r331533

[pci-vendors] Update to 2018-03-21

6 years agoMFC 318387: Add support for child devices that aren't ports.
jhb [Tue, 27 Mar 2018 20:49:47 +0000 (20:49 +0000)]
MFC 318387: Add support for child devices that aren't ports.

Invoke any identify routines of child drivers during attach before attaching
children, and delete any remaining devices after deleting ports.

Sponsored by: Chelsio Communications

6 years agoMFC r331422:
ken [Tue, 27 Mar 2018 20:34:49 +0000 (20:34 +0000)]
MFC r331422:

  ------------------------------------------------------------------------
  r331422 | ken | 2018-03-23 07:52:26 -0600 (Fri, 23 Mar 2018) | 42 lines

  Disable T10 Protection Information / EEDP handling for type 2 protection.

  The mps(4) and mpr(4) drivers and hardware handle T10 Protection
  Information, which is a system of checksums and guard blocks to protect
  data while it is being transferred and while it is on disk.  It is also
  known as T10 DIF.  For more details, see section 4.22 of the SBC-4 spec.

  Supporting Type 2 protection requires using 32 byte CDBs, and filling in
  the fields in those CDBs.  We don't yet support that in the da(4) driver.

  Type 1 and Type 3 protection don't require that, and can be handled by
  the mps(4)/mpr(4) driver's code and firmware without any additional
  input from the da(4) driver.

  If a drive has Type 2 protection enabled (you frequently see this with
  SAS drives shipped from Dell), don't set the various EEDP fields in the
  mps(4)/mpr(4) driver command fields.  Otherwise, you wind up with errors
  like this that would otherwise make no sense:

  (da9:mpr0:0:18:0): READ(10). CDB: 28 00 00 00 00 00 00 02 00 00
  (da9:mpr0:0:18:0): CAM status: SCSI Status Error
  (da9:mpr0:0:18:0): SCSI status: Check Condition
  (da9:mpr0:0:18:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command operation code)
  (da9:mpr0:0:18:0):
  (da9:mpr0:0:18:0): Field Replaceable Unit: 0
  (da9:mpr0:0:18:0): Command Specific Info: 0
  (da9:mpr0:0:18:0):
  (da9:mpr0:0:18:0): Descriptor 0x80: f8 21
  (da9:mpr0:0:18:0): Descriptor 0x81: 00 00 00 00 00 00
  (da9:mpr0:0:18:0): Error 22, Unretryable error

  In other words, what kind of strange SAS hard drive doesn't support a
  standard 10 byte SCSI READ command?  In this case, one that has Type 2
  protection enabled.

  We can revisit this when we put Type 2 protection support in the da(4)
  driver, but for now this will help people who put Type 2 formatted drives
  in a system and wonder what in the world is going on.

  Sponsored by: Spectra Logic

  ------------------------------------------------------------------------

6 years agoMFC 329785: Move DDP PCB state into a helper structure.
jhb [Tue, 27 Mar 2018 20:14:22 +0000 (20:14 +0000)]
MFC 329785: Move DDP PCB state into a helper structure.

This consolidates all of the DDP state in one place.  Also, the code has
now been fixed to ensure that DDP state is only accessed for DDP
connections.  This should not be a functional change but makes it cleaner
and easier to add state for other TOE socket modes in the future.

Sponsored by: Chelsio Communications

6 years agoMFC r314568 (by emaste):
dim [Tue, 27 Mar 2018 18:52:27 +0000 (18:52 +0000)]
MFC r314568 (by emaste):

kern_sig.c: ANSIfy and remove archaic register keyword

Sponsored by: The FreeBSD Foundation

MFC r318389 (by emaste):

Remove register keyword from sys/ and ANSIfy prototypes

A long long time ago the register keyword told the compiler to store
the corresponding variable in a CPU register, but it is not relevant
for any compiler used in the FreeBSD world today.

ANSIfy related prototypes while here.

Reviewed by: cem, jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10193

6 years agoMFC: r331627
jkim [Tue, 27 Mar 2018 17:54:46 +0000 (17:54 +0000)]
MFC: r331627

Merge OpenSSL 1.0.2o.

6 years agoMFC r330949:
brooks [Tue, 27 Mar 2018 17:51:45 +0000 (17:51 +0000)]
MFC r330949:

Fix FSACTL_GET_NEXT_ADAPTER_FIB under 32-bit compat.

This includes FSACTL_LNX_GET_NEXT_ADAPTER_FIB.

Reviewed by: cem
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14672

6 years agoMFC r330876, r330945
brooks [Tue, 27 Mar 2018 17:46:25 +0000 (17:46 +0000)]
MFC r330876, r330945

r330876:
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
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14673

r330945:
Add opt_compat.h to isp(4) as required by r330876.

6 years agoMFC r330820:
brooks [Tue, 27 Mar 2018 17:39:27 +0000 (17:39 +0000)]
MFC r330820:

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 operation
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 agoMFC r330819, r330885, r330934
brooks [Tue, 27 Mar 2018 17:35:15 +0000 (17:35 +0000)]
MFC r330819, r330885, r330934

r330819:
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
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14654

r330885:
We need opt_compat.h after r330819 and 330820.

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

Sponsored by: Netflix.

r330934:
This should have been += so clean builds work.

Noticed by: hps@

6 years agoMFC r331475: loader consoles: Implement SGR 24, 25
kevans [Tue, 27 Mar 2018 13:59:57 +0000 (13:59 +0000)]
MFC r331475: loader consoles: Implement SGR 24, 25

Mostly for completeness sake- implement 24 (no underline) and 25 (no blink)

6 years agoMFC r331247:
kib [Tue, 27 Mar 2018 13:09:35 +0000 (13:09 +0000)]
MFC r331247:
Check for wrap-around in vm_phys_alloc_seg_contig().

6 years agoMFC r330974: MFV r330973: 9164 assert: newds == os->os_dsl_dataset
avg [Tue, 27 Mar 2018 11:33:21 +0000 (11:33 +0000)]
MFC r330974: MFV r330973: 9164 assert: newds == os->os_dsl_dataset

PR: 225877

6 years agoMFC r331234: Rationalize license text on Linuxolator files
emaste [Tue, 27 Mar 2018 01:02:42 +0000 (01:02 +0000)]
MFC r331234: Rationalize license text on Linuxolator files

i386 linux.h missed in previous update.

Approved by: sos
Sponsored by: The FreeBSD Foundation

6 years agoMFC 330711:
jhb [Tue, 27 Mar 2018 00:35:35 +0000 (00:35 +0000)]
MFC 330711:
Permit sysctl(8) to set an array of numeric values for a single node.

Most sysctl nodes only return a single value, but some nodes return an
array of values (e.g. kern.cp_time).  sysctl(8) understand how to display
the values of a node that returns multiple values (it prints out each
numeric value separated by spaces).  However, until now sysctl(8) has
only been able to set sysctl nodes to a single value.  This change
allows sysctl to accept a new value for a numeric sysctl node that contains
multiple values separated by either spaces or commas.  sysctl(8) parses
this list into an array of values and passes the array as the "new" value
to sysctl(2).

Sponsored by: Chelsio Communications

6 years agoFix buildworld after r331586 by adapting the installation of
hselasky [Mon, 26 Mar 2018 23:23:11 +0000 (23:23 +0000)]
Fix buildworld after r331586 by adapting the installation of
dev/mlx5/mlx5io.h to the build system in FreeBSD 11-stable.

This is a direct commit.

Found by: jhb@
Pointy hat: hselasky@
Sponsored by:   Mellanox Technologies

6 years agoMFC r330654:
hselasky [Mon, 26 Mar 2018 21:14:20 +0000 (21:14 +0000)]
MFC r330654:
Check that the address is specified in mlx5tool(8).

Submitted by: kib@
Sponsored by: Mellanox Technologies

6 years agoMFC r330670:
hselasky [Mon, 26 Mar 2018 21:11:43 +0000 (21:11 +0000)]
MFC r330670:
Make mlx5 compilable on ILP32 arches.

Sponsored by: Mellanox Technologies

6 years agoMFC r330660:
hselasky [Mon, 26 Mar 2018 21:06:23 +0000 (21:06 +0000)]
MFC r330660:
Add call to setup firmware data dump structure during device load in
mlx5core.

Do not consider the inability to create a firmware dump fatal, but
inform about the situation and allow the driver to attach. The device
might not implement the needed VSC, or we might not know the layout of
the registers map. In either case, only firmware dump functionality is
limited, the network operations should be fine.

Submitted by: kib@
Sponsored by: Mellanox Technologies

6 years agoMFC r330659:
hselasky [Mon, 26 Mar 2018 21:04:47 +0000 (21:04 +0000)]
MFC r330659:
Avoid more LFENCE/SFENCe on x86 in mlx5en(4),
by using the FreeBSD native fences.

Submitted by: kib@
Sponsored by: Mellanox Technologies

6 years agoMFC r330658:
hselasky [Mon, 26 Mar 2018 21:03:33 +0000 (21:03 +0000)]
MFC r330658:
Fix mlx5en(4) driver to properly call m_defrag().

When the mlx5en(4) driver was converted to using BUSDMA(9) the call to
m_defrag() was moved after the part of the TX routine that strips the
header from the mbuf chain. Before it called m_defrag it first trimmed
off the now-empty mbufs from the start of the chain. This has the side
effect of also removing the head of the chain that has M_PKTHDR set.
m_defrag() will not defrag a chain that does not have M_PKTHDR set,
thus it was effectively never defragging the mbuf chains.

As it turns out, trimming the mbufs in this fashion is unnecessary since
the call to bus_dmamap_load_mbuf_sg doesn't map empty mbufs anyway, so
remove it.

Differential Revision: https://reviews.freebsd.org/D12050
Submitted by: mjoras@
Sponsored by: Mellanox Technologies

6 years agoMFC r330657:
hselasky [Mon, 26 Mar 2018 21:02:20 +0000 (21:02 +0000)]
MFC r330657:
Use vport rather than physical-port MTU in mlx5en(4).

Set and report vport MTU rather than physical MTU,
The driver will set both vport and physical port mtu
and will rely on the query of vport mtu.

SRIOV VFs have to report their MTU to their vport manager (PF),
and this will allow them to work with any MTU they need
without failing the request.

Also for some cases where the PF is not a port owner, PF can
work with MTU less than the physical port mtu if set physical
port mtu didn't take effect.

Based on Linux upstream commit:
cd255efff9baadd654d6160e52d17ae7c568c9d3

Submitted by: Meny Yossefi <menyy@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330656:
hselasky [Mon, 26 Mar 2018 21:00:57 +0000 (21:00 +0000)]
MFC r330656:
Use the device unit number for naming the ifnet interface in mlx5en(4).

Currently the ifnet interface is named mceX, where X is a monotonically
incremented value. If the device is reset due to a fatal error, then the
interface name will change.  Using the device unit number will keep the
naming consistent across the reset logic.

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330653:
hselasky [Mon, 26 Mar 2018 20:59:26 +0000 (20:59 +0000)]
MFC r330653:
Add kernel and userspace code to dump the firmware state of supported
ConnectX-4/5 devices in mlx5core.

The dump is obtained by reading a predefined register map from the
non-destructive crspace, accessible by the vendor-specific PCIe
capability (VSC). The dump is stored in preallocated kernel memory and
managed by the mlx5tool(8), which communicates with the driver using a
character device node.

The utility allows to store the dump in format
    <address> <value>
into a file, to reset the dump content, and to manually initiate the
dump.

A call to mlx5_fwdump() should be added at the places where a dump
must be fetched automatically. The most likely place is right before a
firmware reset request.

Submitted by: kib@
Sponsored by: Mellanox Technologies

6 years agoMFC r330651:
hselasky [Mon, 26 Mar 2018 20:54:21 +0000 (20:54 +0000)]
MFC r330651:
Add vendor specific capability interface support in mlx5core.

Add the ability to access the vendor specific space gateway in order
to support reading and writing data into the different configuration
domains.

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330650:
hselasky [Mon, 26 Mar 2018 20:52:02 +0000 (20:52 +0000)]
MFC r330650:
Use device_printf() instead of printf() when printing warnings and errors
to dmesg(8) in mlx5core.

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330649:
hselasky [Mon, 26 Mar 2018 20:50:28 +0000 (20:50 +0000)]
MFC r330649:
Add support for per priority flow control, PFC, to mlx5en(4).

Add support for PFC and implement reading the per priority statistics
using the sysctl(8) interface. PFC is used together with VLAN priority
and can be enabled and disabled on a per priority basis.

Global pause frames and PFC are incompatible features and surrounding
logic has been added to warn the user about misconfiguration.

Update relevant mlx5core APIs for PFC configuration.

Sponsored by: Mellanox Technologies

6 years agoMFC r330646:
hselasky [Mon, 26 Mar 2018 20:36:32 +0000 (20:36 +0000)]
MFC r330646:
Fix race between PCI error handlers and health work in mlx5core.

linux commit 05ac2c0b7438ea08c5d54b48797acf9b22cb2f6f

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330645:
hselasky [Mon, 26 Mar 2018 20:35:12 +0000 (20:35 +0000)]
MFC r330645:
Avoid calling sleeping function from the health poll thread in mlx5core.

linux commit c1d4d2e92ad670168a17a57dfa182a5a5baa72d4

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330644 and r330714:
hselasky [Mon, 26 Mar 2018 20:33:31 +0000 (20:33 +0000)]
MFC r330644 and r330714:
Updates for PCI and health monitor recovery in mlx5core.
This patch accumulates the following Linux commits:

mlx5_health.c
78ccb25861d76a8fc5c678d762180e6918834200
  mlx5_core: Fix wrong name in struct
171bb2c560f45c0427ca3776a4c8f4e26e559400
  mlx5_core: Update health syndromes
0144a95e2ad53a40c62148f44fb0c1f9d2a0d1e9
  mlx5_core: Use accessor functions to read from device memory
ac6ea6e81a80172612e0c9ef93720f371b198918
  mlx5_core: Use private health thread for each device
fd76ee4da55abb21babfc69310d321b9cb9a32e0
  mlx5_core: Fix internal error detection conditions
2241007b3d783cbdbaa78c30bdb1994278b6f9b9
  mlx5: Clear health sick bit when starting health poll
712bfef60912d91033cb25739f7444d5b8d8c59f
  mlx5: Fix version printout in case of health issue
89d44f0a6c732db23b219be708e2fe1e03ee4842
  mlx5_core: Add pci error handlers to mlx5_core driver

mlx5_cmd.c
be87544de8df2b1eb34bcb5e32691287d96f9ec4
  mlx5_core: Fix async commands return code
a31208b1e11df334d443ec8cace7636150bb8ce2
  mlx5_core: New init and exit flow for mlx5_core
020446e01eebc9dbe7eda038e570ab9c7ab13586
  mlx5_core: Prepare cmd interface to system errors handling
89d44f0a6c732db23b219be708e2fe1e03ee4842
  mlx5_core: Add pci error handlers to mlx5_core driver
0d834442cc247c7b3f3bd6019512ae03e96dd99a
  mlx5: Fix teardown errors that happen in pci error handler

mlx5_main.c
5fc7197d3a256d9c5de3134870304b24892a4908
  mlx5: Add pci shutdown callback

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330608:
hselasky [Mon, 26 Mar 2018 20:28:50 +0000 (20:28 +0000)]
MFC r330608:
Implement priority to traffic class mapping in mlx5core.

Add support for mapping priority to traffic class via sysctl

Submitted by: Slava Shwartsman <slavash@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330607:
hselasky [Mon, 26 Mar 2018 20:27:08 +0000 (20:27 +0000)]
MFC r330607:
Implement rate limit per traffic class in mlx5core.

Add support for rate limiting traffic class via sysctl.

Submitted by: Slava Shwartsman <slavash@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330606:
hselasky [Mon, 26 Mar 2018 20:25:24 +0000 (20:25 +0000)]
MFC r330606:
Implement support for querying the current port rate in mlx5core.
The mlx5ib(4) part will be merged separately.

- Factor out port speed definitions into new port.h header file,
  similarly as done in Linux upstream.
- Correct two existing port speed definitions in mlx5en according to
  Linux upstream.

Sponsored by: Mellanox Technologies

6 years agoMFC r330604:
hselasky [Mon, 26 Mar 2018 20:10:49 +0000 (20:10 +0000)]
MFC r330604:
Add log message for unsupported QSFPs in mlx5core.

Submitted by: Matthew Finlay <matt@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r330603:
hselasky [Mon, 26 Mar 2018 20:09:36 +0000 (20:09 +0000)]
MFC r330603:
Make sure default VNET is set when adding a new interface in mlx5core.

Adding an interface might be done outside the device_attach() routine
and will then cause a panic, due to the VNET not being set.

Sponsored by: Mellanox Technologies

6 years agoMFC r330600:
hselasky [Mon, 26 Mar 2018 20:08:21 +0000 (20:08 +0000)]
MFC r330600:
Add timeout handle to commands with callback in mlx5core.

The current implementation does not handle timeout in case of command
with callback request, and this can lead to deadlock if the command
doesn't get firmware response. Add delayed callback timeout work
before posting the command to firmware. In case of real firmware
command completion we will cancel the delayed work. In case of
firmware command timeout the callback timeout handler will be called
and it will simulate firmware completion with timeout error.

linux commit 65ee67084589c1783a74b4a4a5db38d7264ec8b5

Sponsored by: Mellanox Technologies

6 years agoMFC r330599:
hselasky [Mon, 26 Mar 2018 20:06:37 +0000 (20:06 +0000)]
MFC r330599:
Fix potential deadlock in command mode change in mlx5core.

Call command completion handler in case of timeout when working in
interrupts mode. Avoid flushing the commands workqueue after acquiring
the semaphores to prevent a potential deadlock.

linux commit 9cba4ebcf374c3772f6eb61f2d065294b2451b49

Sponsored by: Mellanox Technologies

6 years agoMFC r330598:
hselasky [Mon, 26 Mar 2018 20:05:22 +0000 (20:05 +0000)]
MFC r330598:
Use a macro in mlx5_command_str() instead of copying OP name.

linux commit 42ca502e179d0654ef441333a9d0f35c948734f3

Sponsored by: Mellanox Technologies

6 years agoMFC r325661:
hselasky [Mon, 26 Mar 2018 20:01:58 +0000 (20:01 +0000)]
MFC r325661:
Expose the current hardware MTU in mlx5en(4) as a separate entry
in the sysctl tree.

Sponsored by: Mellanox Technologies

6 years agoMFC r325660:
hselasky [Mon, 26 Mar 2018 20:00:30 +0000 (20:00 +0000)]
MFC r325660:
Add support for configuring local multicast and unicast data traffic loopback
in mlx5en(4) driver via the sysctl interface.

Sponsored by: Mellanox Technologies

6 years agoMFC r325659:
hselasky [Mon, 26 Mar 2018 19:59:00 +0000 (19:59 +0000)]
MFC r325659:
Add support for disabling and enabling RX and TX DMA rings in mlx5en(4).
This is useful for supporting setups similar to Netmap.

Sponsored by: Mellanox Technologies

6 years agoMFC r331260:
markj [Mon, 26 Mar 2018 15:22:25 +0000 (15:22 +0000)]
MFC r331260:
Remove a lingering inaccuracy from mlock.2.

6 years agoMFC r331135:
markj [Mon, 26 Mar 2018 15:21:23 +0000 (15:21 +0000)]
MFC r331135:
Use __syscall(2) rather than syscall(2) in syscall/tst.args.c.

6 years agoMFC r331134:
markj [Mon, 26 Mar 2018 15:20:42 +0000 (15:20 +0000)]
MFC r331134:
Fix an access of an uninitialized variable in dtrace_probe().

6 years agoMFC r331128:
markj [Mon, 26 Mar 2018 15:19:45 +0000 (15:19 +0000)]
MFC r331128:
Have vm_page_replace() assert that the new page is not enqueued.

6 years agoMFC r331222:
markj [Mon, 26 Mar 2018 15:17:31 +0000 (15:17 +0000)]
MFC r331222:
Given hidden visibility to symbols referenced by the DOF section.

6 years agoMFC r331425:
markj [Mon, 26 Mar 2018 15:16:57 +0000 (15:16 +0000)]
MFC r331425:
Correct a couple of assertion messages in vm_page_reclaim_run().

6 years agoMFC r331364:
gjb [Mon, 26 Mar 2018 14:13:42 +0000 (14:13 +0000)]
MFC r331364:
 Remove google_accounts_manager from VM_RC_LIST in the GCE configuration
 file, no longer needed.

PR: 221714
Sponsored by: The FreeBSD Foundation

6 years agoMFC r331431:
kib [Mon, 26 Mar 2018 07:55:37 +0000 (07:55 +0000)]
MFC r331431:
Update comment to match current field names.

6 years agoMFC r331203:
ae [Mon, 26 Mar 2018 07:54:11 +0000 (07:54 +0000)]
MFC r331203:
  Remove note that `fwd tablearg` is supported only by IPv4. IPv6 is
  supported too.

6 years agoMFC r329844
truckman [Mon, 26 Mar 2018 04:41:23 +0000 (04:41 +0000)]
MFC r329844
MFC r329875 (by kib)

r329844 | truckman | 2018-02-22 16:12:51 -0800 (Thu, 22 Feb 2018) | 52 lines

Decrease latency by not wrapping the idle loop's potentially lengthy
search for a thread to steal inside a critical section.  Since this
allows the search to be preempted, restart the search if preemption
happens since the search results found earlier may no longer be
valid.

Decrease the latency of starting a thread that may be assigned to
this CPU during the search by polling for incoming threads during
the search and switching to that thread instead of continuing the
search.

Test for stale search results and restart the search before going
through the expense of calling tdq_lock_pair().  Retry some tests
after grabbing the locks since things may have changed while waiting
to get both locks.

Eliminate special case handling for stealing from an SMT peer that
uses 1 as the steal threshold.  This can only succeed if a thread
has been assigned but our SMT peer has not yet started executing
it.  This is quite rare and when it happens the other SMT thread
is generally waiting for the same tdq lock that we hold.  Basically
both SMT threads are racing to grab the same spin lock.

Add the kern.sched.always_steal knob from a ULE patch by jeff@.

Incorporate another idea from Jeff's ULE patch.  If the sched_switch()
detects that the CPU is about to go idle, try to steal a thread
before switching to the idle thread.  Since the search for a thread
to steal has to be done inside a critical section in this context,
limit the impact on latency by adding the knob kern.sched.trysteal_limit
to limit the topological distance of the search and don't restart
the search if we detect stale results.  If this search can't find
an stealable thread, the idle loop can do a more complete search.
Also poll for threads being assigned to this CPU during the search
and switch to them instead of continuing the search.  This change
is responsibile for the majority of the improvement in parallel
buildworld times.

In sched_balance_group() change the minimum threshold from stealing
a thread from 1 to 2.  Poaching a newly assigned thread from a CPU
that is waking up hasn't yet switched to that thread from idle is
likely very rare and is likely to have the same lock race as is
seen when stealing threads in the idle loop.  Also use tdq_notify()
to kick the destintation CPU instead of always sending an IPI.
Update a stale comment, the number of transferable threads is not
calculated.

------------------------------------------------------------------------
r329875 | kib | 2018-02-23 10:26:31 -0800 (Fri, 23 Feb 2018) | 5 lines

Restore UP build.

Reviewed by: kib (earlier version, r329844)
Reviewed by: truckman (r329875)
Comments by: avg, jeff, mav (r329844)
Differential Revision: https://reviews.freebsd.org/D12130

6 years agoMFC r330115: Add missing WITH_BSD_GREP_FASTMATCH description
kevans [Mon, 26 Mar 2018 00:30:46 +0000 (00:30 +0000)]
MFC r330115: Add missing WITH_BSD_GREP_FASTMATCH description

6 years agoMFC r331416, r331440: Loader consoles: Implement SGR 22, reste intensity
kevans [Mon, 26 Mar 2018 00:26:46 +0000 (00:26 +0000)]
MFC r331416, r331440: Loader consoles: Implement SGR 22, reste intensity

r331416:
Loader consoles: Implement SGR 22, reset intensity

r331440:
Match broken style of vidconsole.c

This particular function uses a broken mix of indentation styles. Match it
for the newly added SGR 22 bits.

6 years agoMFC r330781:
ae [Sun, 25 Mar 2018 03:50:38 +0000 (03:50 +0000)]
MFC r330781:
  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

6 years agoMFC r330779:
ae [Sun, 25 Mar 2018 03:45:02 +0000 (03:45 +0000)]
MFC r330779:
  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.

6 years agoMFC r330771:
ae [Sun, 25 Mar 2018 03:37:26 +0000 (03:37 +0000)]
MFC r330771:
  Remove obsoleted and unused key_sendup() function.
  Also remove declaration for nonexistend key_usrreq() function.

MFC r330772:
  Check that we have PF_KEY sockets before iterating over all RAW sockets.

MFC r330775:
  Replace panic() with KASSERTs.

MFC r330777:
  Add KASSERT to check that proper targed was used.

6 years agoMFC r329989, r330044
ian [Sun, 25 Mar 2018 02:04:44 +0000 (02:04 +0000)]
MFC r329989, r330044

r329989:
Add support for booting into kdb on arm platforms when the RB_KDB is set
(using "boot -d" at the loader propmt or setting boot_ddb in loader.conf).

Submitted by: Thomas Skibo <thomasskibo@yahoo.com>
Differential Revision: https://reviews.freebsd.org/D14428

r330044:
Add a hw.model sysctl oid for armv6/7 which reports the CPU model, similar
to what other arches (all except riscv and armv4/5) do.

Submitted by: Hyun Hwang <hyun@caffeinated.codes>
Differential Revision: https://reviews.freebsd.org/D14465

6 years agoMFC r331123, r331126, r331129, r331132, r331136, r331138-r331139, r331141
ian [Sun, 25 Mar 2018 01:59:54 +0000 (01:59 +0000)]
MFC r331123, r331126, r331129, r331132, r331136, r331138-r331139, r331141

r331123:
Do not overwrite the contents of BIO_WRITE buffers.  SPI inherently
transfers data in both directions at once.  When writing to the device,
use a dummy buffer for the incoming data, not the same buffer as the
outgoing data.  Writes are done in FLASH_PAGE_SIZE chunks, which is only
256 bytes, so just put the dummy buffer into the softc.

r331126:
Remove a pointless KASSERT and reword a comment a bit.  The KASSERT tested
for the same condition that the preceeding lines checked for and would have
returned EIO, so the assert could never possibly trigger (sc_sectorsize must
inherently be an integer multiple of FLASH_PAGE_SIZE).

r331129:
Eliminate some unneeded intermediate variables.  Eliminate some redundant
parens in shift-and-mask expressions.  Reword and reflow some comments.

r331132:
Bugfix: wait for writes/erases to complete after starting them, instead of
before starting them.

Using the wait-before logic would make sense if there was useful time-
consuming work that could be done between the end of one write and the
beginning of the next, but it also requires doing the wait-for-ready before
reading, because a prior write or erase could still be in progress.  Reading
is the far more common case, so adding a whole extra bus transaction to
check for ready before each read would soak up any small gains that might be
had from doing async writes.

r331136:
Add sc_parent to the softc and use it in place of device_get_parent() calls
all over the place.  Also pass the softc as the arg to all the internal
functions instead of passing a device_t and calling device_get_softc() in
each function.

r331138:
Make all internal routines return an int error status, and check the
status at all call points.  Combine the get_status and wait_for_ready
routines, since waiting for ready is the only reason to ever get status.

r331139:
Add support for 4K and 32K erase block sizes.  Many of the supported chips
have these flags set in the ident table, but there was no code to support
using the smaller erase sizes.

r331141:
Add the device/chip type to the disk d_descr field, and print more info
about the chip including the erase block size at attach time.

Also add myself to the copyrights since at this point svn blame would point
to me as the culprit for much of this.

6 years agoMFC r331068:
ian [Sun, 25 Mar 2018 01:55:17 +0000 (01:55 +0000)]
MFC r331068:

Use EFI RTC capabilities info when registering, add bootverbose diagnostics.

Make some small improvements to the efirtc driver by obtaining the clock
capabilities (resolution and whether the sub-second counters are reset) and
using the info when registering the clock. When the hardware zeroes out the
subsecond info on clock-set, schedule clock updates to happen just before
top-of-second, so that the RTC time is closely in-sync with kernel time.

Also, in the identify() routine, always add the driver if EFI runtime
services are available, then decide in probe() whether to attach the driver
or not. If not attaching and bootverbose is on, say why. All of this is
basically to avoid "silent failure" -- if someone thinks there should be an
efi rtc and it's not attaching, at least they can set bootverbose and maybe
get a clue from the output.

Differential Revision: https://reviews.freebsd.org/D14565 (timed out)

6 years agoMFC r330773, r330778, r330782, r330797
ian [Sun, 25 Mar 2018 01:52:38 +0000 (01:52 +0000)]
MFC r330773, r330778, r330782, r330797

r330773:
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

r330778:
Everywhere that multiple registers are accessed in sequence, lock/unlock
just once around the whole group of accesses.

r330782:
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.

r330797:
Give the atrtc_time_lock a unique name.

Reported by: hps@

6 years agoMFC r330050:
ian [Sun, 25 Mar 2018 01:47:57 +0000 (01:47 +0000)]
MFC r330050:

Initialize all members of vm_page::md_page for armv4/5 systems.  This fixes
a hang in SI_SUB_KMEM sysinit, and is apparently required after r323290.
Inspired by the commit message for r323676.

Reported by: andreast@

6 years agoMFC r330437-r330438, r330440, r331045
ian [Sun, 25 Mar 2018 01:47:17 +0000 (01:47 +0000)]
MFC r330437-r330438, r330440, r331045

r330437:
Do not stop the loop that configures gpio chipselect pins on the first
error, just ignore pins that don't configure and keep setting up the ones
that do.  (But when bootverbose is on, whine about the errors.)

r330438:
Defer attaching the spibus until timers and interrupts are working.  The
driver requires interrupts to do transfers, and the drivers for the SPI
devices on the bus quite reasonably expect to be able to do IO while probing
and attaching.

r330440:
Switch imx_gpio to attach at BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE.
Pretty much any other device might need to manipulate a gpio pin during its
probe or attach routines, so these devices must be available as early as
possible.

The gpio device is an interrupt controller, but I didn't choose the
INTERRUPT pass for that reason (it works fine as an interrupt controller as
long as it attaches any time before interrupts are enabled).  That just
looked like the right place in the passes to ensure that it attaches before
any type of device that might need gpio pin manipulations.

r331045:
Add required interface header.

Reported by: andreast@

6 years agoMFC r322665
sevan [Sun, 25 Mar 2018 01:34:44 +0000 (01:34 +0000)]
MFC r322665

Add caveat to kinfo_getvmmap(3) explaining high CPU utilisation.
Based on kib's reply on https://lists.freebsd.org/pipermail/freebsd-hackers/2016-July/049710.html

6 years agoMFC r316464
sevan [Sun, 25 Mar 2018 01:30:29 +0000 (01:30 +0000)]
MFC r316464

Whilst mount_pcfs originated as a patch in 386BSD, NetBSD 0.8 actually
was the first release of an OS to ship with it.
Heads up by Ingo Schwarze.

6 years agoMFC 321881
sevan [Sun, 25 Mar 2018 01:24:52 +0000 (01:24 +0000)]
MFC 321881

For the udp-client example, instruct user to add an entry for a udp based
service.
For tcp-client & udp-client, use the same port in configuration snippet as used
in the comment prior to remove any ambiguity on the port number which needs to
be specified.

6 years agoMFC r331274
sevan [Sun, 25 Mar 2018 01:03:26 +0000 (01:03 +0000)]
MFC r331274

Extend the description of ALTQ to call it a system which is a framework in
altq(4) to match altq(9). This makes preserving the history section as the
author of ALTQ easier in the history section, rather than calling it a framework
in the description & a system in the history.
Add a history section to altq(4) and extend the history section in altq(9)

6 years agoMFC r330385:
ian [Sun, 25 Mar 2018 00:50:27 +0000 (00:50 +0000)]
MFC r330385:

Flag the first interface on a KTLINK FTDI-based jtag+uart device as being
the jtag port, so that a tty is not created for it.

This is based on information in the PR and from the vendor website.  When
the PR was first opened we had no facility for flagging the jtag ports.  I
stumbled across the still-open PR with the idea of closing it, and noticed
that this wee update was needed.

PR: 175893

6 years agoMFC r330361:
ian [Sat, 24 Mar 2018 23:26:54 +0000 (23:26 +0000)]
MFC r330361:

Correct a misplaced closing paren.  Does not affect the result, but does
clarify (at least for me) that the multiplication happens before the shift.

6 years agoMFC r310017, r310229, r312289, r327260, r329539, r329544-r329546, r329620,
ian [Sat, 24 Mar 2018 23:23:31 +0000 (23:23 +0000)]
MFC r310017, r310229, r312289, r327260, r329539, r329544-r329546, r329620,
    r329729, r329911, r329999

r310017:
[spi] reformat message

This commit corrects print of nomatch (newline was too early)

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by: ray, loos, mizhka
Differential Revision: https://reviews.freebsd.org/D8749

r310229:
ofw_spi: Parse property for the SPI mode and CS polarity.
As cs is stored in a uint32_t, use the last bit to store the
active high flag as it's unlikely that we will have that much CS.

Reviewed by: loos
Differential Revision: https://reviews.freebsd.org/D8614

r312289:
[spibus] small code refactoring

Merge 3 sequential printf calls into one.

Reported by: rpokala
Reviewed by: rpokala, adrian
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D8795

r327260:
SPDX: fix wrong license ID tag in dev/spibus.

r329539:
Provide public declarations for ofw_spibus_driver and ofw_spibus_devclass
so other drivers can refer to them in DRIVER_MODULE() decls.

r329544:
Add modules/spi as a gathering point for SPI-related modules, analagous to
modules/i2c for i2c/iicbus modules.  Build spibus as a module.

r329545:
Add ofw_bus_if.h to SRCS.

r329546:
Build at45d and mx25l SPI flash drivers as modules.

r329620:
Add missing MODULE_DEPENDS().

r329729:
Remove some files that snuck in via cut and paste.

Having these compiled into the module causes the kobj method descriptors
to be resolved incorrectly (by the compile-time linker instead of the
kernel linker), which then leads to hours of frustrating debugging.

r329911:
Add a functional detach() routine, to make things kldunload-friendly.

r329999:
Add a SPI driver for imx5 and imx6.

It can be compiled into the kernel with "device imx_spi" or loaded as a
module, which is also named "imx_spi".

6 years agoMFC r329642:
ian [Sat, 24 Mar 2018 23:07:10 +0000 (23:07 +0000)]
MFC r329642:

Adjust whitespace of things added in the past couple years to match the
original style of the file.  No functional changes.

6 years agoMFC r329537:
ian [Sat, 24 Mar 2018 23:03:59 +0000 (23:03 +0000)]
MFC r329537:

Provide a public function to acquire a gpio pin by giving the property name
and index.  A private function to do exactly that already existed, so this
renames gpio_pin_get_by_ofw_impl() to gpio_pin_get_by_ofw_propidx() and
provides a declaration for it in a public header.

Previously there were functions to get a pin by property name (assuming
there would only be one pin defined for the name), or by index (asuming
the property has the standard name "gpios").  It turns out there are
devicetree bindings that describe properties with names other than "gpios"
which can describe multiple pins.  Hence the need to retrieve the Nth item
from a named property.

6 years agoMFC r325233, r328956, r329170, r329172-r329173, r329224, r330403-r330407,
ian [Sat, 24 Mar 2018 23:01:10 +0000 (23:01 +0000)]
MFC r325233, r328956, r329170, r329172-r329173, r329224, r330403-r330407,
    r330411-r330412, r330416, r330430-r330431, r330433, r330528-r330529,
    r330767

r325233:
[i2c/clock] add support for EPSON RTC-8583

RTC-8583 is time-of-day clock used in some SOHO routers. This clock has
only 2 bits for year values, but thanks to user SRAM it's possible to save
year value and keep it up to date via driver code.

Tested on Planex_MZK-W300NAG (SoC is RT2880)

Submitted by: Hiroki Mori <yamori83@yahoo.co.jp>
Differential Revision: https://reviews.freebsd.org/D12833

r328956:
Use const pointers for input data not modified by clock utility functions.

r329170:
Replace the existing print_ct() private debugging function with a set of
three public functions to format and print the three major data structures
used by realtime clock drivers (clocktime, bcd_clocktime, and timespec).

r329172:
Add a set of convenience routines for RTC drivers to use for debug output,
and a debug.clock_show_io sysctl to control debugging output.

r329173:
Add a new sysctl, debug.clock_do_io, to allow manully triggering a one-shot
read or write of all registered realtime clocks.  In the read case, the
values read are simply discarded.  For writes, there's no alternative but
to actually write the current system time to the device.

r329224:
Fix bad indentation.  Whitespace only, no functional changes.

Reported by: bde@

r330403:
Add calls to the new clock_dbgprint_xxx() functions.

r330404:
Add calls to the new clock_dbgprint_xxx() functions.

r330405:
Oops, fix a paste-o.

r330406:
Add calls to the new clock_dbgprint_xxx() functions.

r330407:
Add calls to the new clock_dbgprint_xxx() functions.  Also, stop applying
a local .5 second adjustment to the time, since that is now done by the
code in subr_rtc.c.

r330411:
Convert to the new(ish) bcd_clocktime conversion functions, add calls to
the new debug output functions, and when setting the clock, propagate the
timespec nsecs to the 1/100ths register.

r330412:
Build iicbus/rtc8583 as a module.

r330416:
The year is stored in a single byte in sram, in binary format, as a count
of years since the century, so strip the century out when converting to or
from bcd_clocktime format (the conversion routines will infer century by
pivoting on 70).

r330430:
Switch to the new bcd_clocktime conversion routines, and add calls to the
new clock_dbgprint_xxx() functions.

r330431:
Switch to the new bcd_clocktime conversion routines, and add calls to the
new clock_dbgprint_xxx() functions.

r330433:
Switch to the new bcd_clocktime conversion routines, and add calls to the
new clock_dbgprint_xxx() functions.

r330528:
Fix a paste-o that broke the build.  There is no softc pointer here, just
use the dev arg.

Reported by: Jonathan Looney <jonlooney@gmail.com>
Pointy hat: ian@

r330529:
Build the ds1672 driver as a module.  Add a detach() to unregister the rtc.

r330767:
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 agoMFC r329534-r329535
ian [Sat, 24 Mar 2018 22:50:59 +0000 (22:50 +0000)]
MFC r329534-r329535

r329534:
Arrange SRCS= as 1 file per line, alphabetical, so it's easier to maintain.
Whitespace only, no functional changes.

r329535:
Add iic_recover_bus.c, now part of iicbus.  This should have been added
as part of r320463.

6 years agoMFC r329479-r329480, r329483, r329506-r329507, r329526, r329529, r329536,
ian [Sat, 24 Mar 2018 22:39:38 +0000 (22:39 +0000)]
MFC r329479-r329480, r329483, r329506-r329507, r329526, r329529, r329536,
    r329541, r329730, r329841, r329988, r330397

r329479:
Do not try to deallocate memory that wasn't allocated (you'd think that
would be safe, but the function also tries to destroy mutexes that never
got created).

I guess this can only happen when imx_ehci_detach() is called on the
error-exit path from imx_ehci_attach(), and that path never got exercised
before today.

r329480:
Don't call sdhci_cleanup_slot() if sdhci_init_slot() never got called.
Also, do callout_init() very early in attach, so that callout_drain()
can be called in detach without worrying about whether it ever got init'd.

r329483:
Fix fallout from the import of fresh dts source files from linux 4.15.  It
appears that node names no longer include leading zeroes in the @address
qualifiers, so we have to search for the nodes involved in interrupt fixup
using both flavors of name to be compatible with old and new .dtb files.

(You know you're in a bad place when you're applying a workaround to code
that exists only as a workaround for another problem.)

r329506:
Add a detach method so that this can be a kldunload-friendly module.

r329507:
Build modules specific to imx5/imx6 only when building those kernels.

This adds sys/modules/imx with a SUBDIR makefile to make the whole
collection of modules that are specific to these SoCs.  Initially, that
"whole collection" consists of the if_ffec and imx_i2c drivers.

The if_ffec driver is referenced in its existing home in ../ffec rather
than moving it into the imx directory, because it's used by powerpc too,
but it is no longer built for all armv6/7 systems.

The imx_i2c driver is newly added as a module.

r329526:
Allow i2c hardware drivers to declare their own relationships to ofw_iicbus
rather than relying on a set of canned EARLY_DRIVER_MODULE() statements in
the ofw_iicbus source.  This means hw drivers will no longer be required to
use one of a few predefined driver names.  They will also now be able to
decide themselves if they want to use DRIVER_MODULE or EARLY_DRIVER_MODULE
and to set which pass to attach on for early modules.

Mainly, this adds extern declarations for the driver and devclass variables.
It also renames ofwiicbus_devclass to ofw_iicbus_devclass to be consistant
with the way we use ofw_ prefixes on this stuff.

r329529:
Give the imx_i2c driver its own name, set up its relationship to ofw_iicbus.
Previously it called itself 'iichb' to link up with the EARLY_DRIVER_MODULE
declaration in ofw_iicbus.c.

r329536:
Add the MODULE_DEPEND()s needed so that the kernel linker can resolve all
the symbols at load time when iicbus is not compiled into the kernel.

r329541:
Build ofw_iicbus as a module if OPT_FDT is defined.

r329730:
Add required header files.

Reported by: andreast@

r329841:
Add a missing line continuation.

How many commits does it take to get a simple module makefile working?
Apparently at least three.

Pointy hat to:  ian

r329988:
Instead of building ofw_iicbus as a separate module, just compile it in to
the iicbus module for FDT-based systems.

The primary motivation for this is that host controller drivers which
declare DRIVER_MODULE(ofw_iicbus, thisdriver, etc, etc) now only need a
single MODULE_DEPEND(thisdriver, ofw_iicbus) for runtime linking to resolve
all the symbols.  With ofw_iicbus and iicbus in separate modules, drivers
would need to declare a MODULE_DEPEND() on both, because symbol lookup is
non-recursive through the dependency chain.  Requiring a driver to have
MODULE_DEPENDS() on both amounts to requiring the drivers to understand the
kobj inheritence details of how ofw_iicbus is implemented, which seems like
something they shouldn't have to know (and could even change some day).

Also, this is somewhat analogous to how the drivers get built when compiled
into the kernel.  You don't have to ask for ofw_iicbus separately, it just
gets built in along with iicbus when option FDT is in effect.

r330397:
Fix a paste-o: use the IICBUS version constants, not IICBB bitbang driver's.