]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC r341657 (by imp): Dynamically load .so modules to expand functionality
Alexander Motin [Mon, 12 Aug 2019 17:48:14 +0000 (17:48 +0000)]
MFC r341657 (by imp): Dynamically load .so modules to expand functionality

o Dynamically load all the .so files found in /libexec/nvmecontrol and
  /usr/local/libexec/nvmecontrol.
o Link nvmecontrol -rdynamic so that its symbols are visible to the
  libraries we load.
o Create concatinated linker sets that we dynamically expand.
o Add the linked-in top and logpage linker sets to the mirrors for them
  and add those sets to the mirrors when we load a new .so.
o Add some macros to help hide the names of the linker sets.
o Update the man page.

4 years agoMFC r341416 (by imp): Fix typo in comment
Alexander Motin [Mon, 12 Aug 2019 17:42:44 +0000 (17:42 +0000)]
MFC r341416 (by imp): Fix typo in comment

4 years agoMFC r341415 (by imp): Delete the undocumented alias 'wds'.
Alexander Motin [Mon, 12 Aug 2019 17:41:57 +0000 (17:41 +0000)]
MFC r341415 (by imp): Delete the undocumented alias 'wds'.

This was a typo for wdc. Eliminate it since it was in error. People
should use either 'wdc' or 'hgst' for the vendor from now on. 'hgst'
works for all versions this functionality is present for.

4 years agoMFC r341414 (by imp): Move Intel specific log pages to intel.c
Alexander Motin [Mon, 12 Aug 2019 17:41:26 +0000 (17:41 +0000)]
MFC r341414 (by imp): Move Intel specific log pages to intel.c

Move the Intel specific log pages (including the one that samsung
implements) to intel.c. Add comment to the samsung vendor that it will
be going away soon.

4 years agoMFC r341413 (by imp): Usage cleanup pt 2
Alexander Motin [Mon, 12 Aug 2019 17:40:52 +0000 (17:40 +0000)]
MFC r341413 (by imp): Usage cleanup pt 2

Eliminage redundant spaces and nvmecontrol at start of all the usage
strings. Update the usage printing code to add them back when
presenting to the user. Allow multi-line usage messages and print
proper leading spaces for lines starting with a space.

4 years agoMFC r341412 (by imp): Usage cleanup pt 1
Alexander Motin [Mon, 12 Aug 2019 17:40:22 +0000 (17:40 +0000)]
MFC r341412 (by imp): Usage cleanup pt 1

Provide a usage() function that takes a struct nvme_function pointer
and produces a usage mssage. Eliminate all now-redundant usage
functions. Propigate the new argument through the program as needed.
Use common routine to print usage.

4 years agoMFC r341411 (by imp): Return after we find the dispatched function.
Alexander Motin [Mon, 12 Aug 2019 17:39:50 +0000 (17:39 +0000)]
MFC r341411 (by imp): Return after we find the dispatched function.

If the dispatched function doesn't exit, then we get can get a
spurious function not found message. They all do exit, but this is a
little cleaner.

4 years agoMFC r341410 (by imp): Move the hgst/wdc log page printing code into wdc.c
Alexander Motin [Mon, 12 Aug 2019 17:39:16 +0000 (17:39 +0000)]
MFC r341410 (by imp): Move the hgst/wdc log page printing code into wdc.c

These are all hgst/wdc specific, so move them into the wdc.c to live
with the wdc command.

4 years agoMFC r341409 (by imp): Move common logpage routines into nvmecontrol.h
Alexander Motin [Mon, 12 Aug 2019 17:38:48 +0000 (17:38 +0000)]
MFC r341409 (by imp): Move common logpage routines into nvmecontrol.h

For the upcoming move of vendor specific code into vendor specific
files, make the common logpage routines global and move them to
nvmecontrol.h.

4 years agoMFC r341408 (by imp): Make logpage functions a linker set.
Alexander Motin [Mon, 12 Aug 2019 17:38:08 +0000 (17:38 +0000)]
MFC r341408 (by imp): Make logpage functions a linker set.

Move logpage function def to header. Convert all the logpage_function
elements to elements of the linker set. Leave them all in logpage.c
for the moment.

4 years agoMFC r341407 (by imp): Move nvmecontrol to using linker sets for commands
Alexander Motin [Mon, 12 Aug 2019 17:37:35 +0000 (17:37 +0000)]
MFC r341407 (by imp): Move nvmecontrol to using linker sets for commands

More commands will be added to nvmecontrol. Also, there will be a few
more vendor commands (some of which may need to remain private to
companies writing them). The first step on that journey is to move to
using linker sets to dispatch commands. The next step will be using
dlopen to bring in the .so's that have the command that might need
to remain private for seamless integration.

Similar changes to this will be needed for vendor specific log pages.

4 years agonandfs: avoid integer overflow in nandfs_get_dat_bdescs_ioctl
Ed Maste [Mon, 12 Aug 2019 17:25:32 +0000 (17:25 +0000)]
nandfs: avoid integer overflow in nandfs_get_dat_bdescs_ioctl

nandfs was removed in head in r349352 and in any case was not built by
default, but address the potential integer overflow in case someone does
enable it and manages to avoid a panic from other nandfs issues.

admbugs: 815
Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Reviewed by: imp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21232

4 years agoMFC r350498: telnet: use asprintf for r350139 [MFC of r349890] change
Ed Maste [Mon, 12 Aug 2019 15:52:21 +0000 (15:52 +0000)]
MFC r350498: telnet: use asprintf for r350139 [MFC of r349890] change

Sponsored by: The FreeBSD Foundation

4 years agoMFC r349571: upgrade the warning printf-s in bus accessors to KASSERT-s, take 2
Andriy Gapon [Mon, 12 Aug 2019 09:20:02 +0000 (09:20 +0000)]
MFC r349571: upgrade the warning printf-s in bus accessors to KASSERT-s, take 2

After this change sys/bus.h includes sys/systm.h when _KERNEL is
defined.

4 years agoMFC r350025: bge: check that the bus is a pci bus before using it as such
Andriy Gapon [Mon, 12 Aug 2019 08:43:00 +0000 (08:43 +0000)]
MFC r350025: bge: check that the bus is a pci bus before using it as such

4 years agoMFC r349886: linuxcommon: add module version
Andriy Gapon [Mon, 12 Aug 2019 08:36:16 +0000 (08:36 +0000)]
MFC r349886: linuxcommon: add module version

4 years agoMFC r349883: owc_gpiobus: small formatting cleanup
Andriy Gapon [Mon, 12 Aug 2019 08:28:26 +0000 (08:28 +0000)]
MFC r349883: owc_gpiobus: small formatting cleanup

4 years agoMFC r349807, r349974, r349976, r350324, r350361, r350445
Ian Lepore [Sun, 11 Aug 2019 23:01:31 +0000 (23:01 +0000)]
MFC r349807, r349974, r349976, r350324, r350361, r350445

r349807:
Eliminate spurious periodic.daily error message for rotating accounting log.

In 2011, r218961 removed local code for rotating logs in favor of using the
rotate_log command in etc/rc.d/accounting.  If the accounting service is
activated then subsequently de-activated in rc.conf but still remains active
in periodic.conf, then you get an error message every day in the periodic
jobs about being unable to rotate the logs.

With this change to use "onerotate_log", the log rotation will happen the
first time periodic daily runs after accounting was disabled but periodic
accounting was left enabled.  After that happens once, the /var/account/acct
will no longer exist, which results in a different path through the periodic
code and no more error messages will appear (unless daily_show_badconfig is
set, in which case the admin will be told that periodic security processing
is enabled but the accounting file is not present).

This is only a partial fix for the problems reported in PR 202203.

PR: 202203

r349974:
Limit access to system accounting files.

In 2013 the security chapter of the Handbook was updated in r42501 to
suggest limiting access to the system accounting file [*1] by creating the
initial file with a mode of 0600. This was in part based on a discussion in
the forums [*2]. Unfortunately, this advice is overridden by the fact that a
new file is created as part of periodic daily processing, and the file mode
is set by the rc.d/accounting script.

These changes update the accounting script to create the directory with mode
0750 if it doesn't already exist, and to create the daily file with mode
0640. This limits write access to root only, read access to root and members
of wheel, and eliminates world access completely. For admins who want to
prevent even members of wheel from accessing the files, the mode of the
/var/account directory can be manually changed to 0700, because the script
never creates or changes that directory if it already exists.

The accounting_rotate_log() function now also handles the error cases of no
existing log file to rotate, and attempting to rotate the file multiple
times (.0 file already exists).

Another small change here eliminates the complexity of the mktemp/chmod/mv
sequence for creating a new acct file by using install(1) with the flags
needed to directly create the file with the desired ownership and
modes. That allows coalescing two separate if checkyesno accounting_enable
blocks into one.

These changes were inspired by my investigation of PR 202203.

[1] https://www.freebsd.org/doc/handbook/security-accounting.html
[2] http://forums.freebsd.org/showthread.php?t=41059

PR: 202203
Differential Revision: https://reviews.freebsd.org/D20876

r349976:
Add an entry mentioning the permission/mode change to daily accounting files.

r350324:
Fix indentation (spaces->tab).

r350361:
Re-wrap the text at 80 columns after fixing the indent in the prior commit.

r350445:
Create the /var/account dir with mode 0750; this is a followup to r349974.

The rc.d/account script contains code to create the /var/account dir, so
it hadn't occurred to me that it is normally created via mtree; thanks to
jilles@ for pointing it out.

4 years agoMFC r349891, r349972
Ian Lepore [Sun, 11 Aug 2019 22:46:58 +0000 (22:46 +0000)]
MFC r349891, r349972

r349891:
Reorganize the SRCS lists as one file per line, and then alphabetize them.
No functional changes.

r349972:
Add arm_sync_icache() and arm_drain_writebuf() sysarch syscall wrappers.

NetBSD and OpenBSD have libc wrapper functions for the ARM_SYNC_ICACHE and
ARM_DRAIN_WRITEBUF sysarch operations. This change adds compatible functions
to our library. This should make it easier for various upstream sources to
support *BSD operating systems with a single variation of cache maintence
code in tools like interpreters and JIT compilers.

I consider the argument types passed to arm_sync_icache() to be especially
unfortunate, but this is intended to match the other BSDs.

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

4 years agoMFC r350231: Correct spelling, partion -> partition.
Ian Lepore [Sun, 11 Aug 2019 22:32:52 +0000 (22:32 +0000)]
MFC r350231: Correct spelling, partion -> partition.

4 years agoMFC r350104, r350106, r350185, r350203
Ian Lepore [Sun, 11 Aug 2019 22:31:38 +0000 (22:31 +0000)]
MFC r350104, r350106, r350185, r350203

r350104:
Handle the PCF2127 RTC chip the same as PCF2129 when init'ing the chip.

This affects the detection of 24-hour vs AM/PM mode... the ampm bit is in a
different location on 2127 and 2129 chips compared to other nxp rtc chips.
I noticed the 2127 case wasn't being handled correctly when I accidentally
misconfiged my system by claiming my PCF2129 was a 2127.

r350106:
Fix a paste-o, set is212x = false for other chip types.  Doh!

r350185:
Rewrite the nxprtc chip init to extend battery life by using power-saving
features offered by the chips.

For 2127 and 2129 chips, fix the detection of when chip-init is needed.  The
chip config needs to be reset whenever power was lost, but the logic was
wrong for 212x chips (it only worked for 8523).  Now the "oscillator
stopped" bit rather than the power manager mode is used to detect startup
after powerfail.

For all chips, disable the clock output pin.

For chips that have a timestamp/tamper-monitor feature, turn off monitoring
of the timestamp trigger pin.

The 8523, 2127, and 2129 chips have a "power manager" feature that offers
several options.  We've been using the default mode which enables
everything.  Now the code sets the power manager options to

 - direct-switch (when Vdd < Vbat, without extra threshold check)
 - no battery monitor
 - no external powerfail monitor

This reduces the current draw while running on battery from 1930nA to 880nA,
which should roughly double the lifespan of the battery under load.

Because battery checking is a nice thing to have, the code now does a check
at startup, and then once a day after that, instead of checking continuously
(but only actually reporting at startup).  The battery check is now done by
setting the power manager back to default mode, sleeping briefly while it
makes a voltage measurement, then switching back to power-saving mode.

r350203:
Add support for setting the aging/frequency-offset register via sysctl.

The 2127 and 2129 chips support a frequency tuning value in the range of
-7 through +8 PPM; add a sysctl handler to read and set the value.

4 years agoMFC r350015-r350016
Ian Lepore [Sun, 11 Aug 2019 22:19:54 +0000 (22:19 +0000)]
MFC r350015-r350016

r350015:
Fix nxprtc(4) on systems that support i2c repeat-start correctly.

An obscure footnote in the datasheets for the PCx2127, PCx2129, and
PCF8523 rtc chips states that the chips do not support i2c repeat-start
operations.  When the driver was originally written and tested, the i2c
bus on that system also didn't support repeat-start and just quietly
turned repeat-start operations into a stop-then-start, making it appear
that the nxprtc driver was working properly.

The repeat-start situation only comes up on reads, so instead of using
the standard iicdev_readfrom(), use a local nxprtc_readfrom(), which is
just a cut-and-pasted copy of iicdev_readfrom(), modified to send two
separate start-data-stop sequences instead of using repeat-start.

r350016:
In nxprtc(4), use the countdown timer for better timekeeping resolution
on PCx2129 chips too.

The datasheet for the PCx2129 chips says that there is only a watchdog
timer, no countdown timer.  It turns out the countdown timer hardware is
there and works just the same as it does on a PCx2127 chip, except that you
can't use it to trigger an interrupt or toggle an output pin.  We don't need
interrupts or output pins, we only need to read the timer register to get
sub-second resolution.  So start treating the 2129 chips the same as 2127.

4 years agoMFC r349887:
Ian Lepore [Sun, 11 Aug 2019 22:11:59 +0000 (22:11 +0000)]
MFC r349887:

De-pollute arm's sysarch.h.

Instead of including stdint.h for uintptr_t, include sys/_types.h and use
__types for everything that isn't a native C keyword type.

Remove the #include of cdefs.h.  It appears after the include of armreg.h
which has a precondition of cdefs.h being included before it, so everyone
including sysarch.h is already including cdefs.h.  (When armv5 support
goes away, there will be no need include armreg.h here either.)

Unfortunately, the unprefixed struct member names "addr" and "len" cannot
be changed, because 3rd-party software is relying on them (libcompiler_rt
is one known consumer).

4 years agoMFC r349873:
Ian Lepore [Sun, 11 Aug 2019 21:40:18 +0000 (21:40 +0000)]
MFC r349873:

Add pwm.9, it was also deleted during the big round of pwm changes.

4 years agoMFC r349116:
Ian Lepore [Sun, 11 Aug 2019 21:24:44 +0000 (21:24 +0000)]
MFC r349116:

In detach(), call bus_generic_detach() before deleting the iicbus child.
This gives the bus and its children the chance to return EBUSY to abort
the detach if they're in the middle of doing some IO.

4 years agoMFC r349839, r349850
Ian Lepore [Sun, 11 Aug 2019 21:21:32 +0000 (21:21 +0000)]
MFC r349839, r349850

r349839:
Call device_unbusy() on the error exit path, because if iicbus_request_bus()
returns an error, iicbus_release_bus() is not going to be called.

r349850:
Restore the ability for i2c slave devices to do IO from their probe method.

r348164 added code to iicbus_request_bus/iicbus_release_bus to automatically
call device_busy()/device_unbusy() as part of aquiring exclusive use of the
bus (so modules can't be unloaded while the bus is exclusively owned and/or
IO is in progress).  That broke the ability to do i2c IO from a slave device
probe method, because the slave isn't attached yet, so calling device_busy()
triggers a sanity-check panic for trying to busy a non-attached device.

Now we check whether the device status is < DS_ATTACHING, and if so we busy
the iicbus rather than the slave device.  I think this leaves a small window
where a module could be unloaded while probing is in progress.  But I think
that's true of all devices, and probably should be fixed by introducing a
DS_PROBING state for devices, and handling that at various points in the
newbus code.

4 years agoMFC r349319, r349328-r349330
Ian Lepore [Sun, 11 Aug 2019 21:15:30 +0000 (21:15 +0000)]
MFC r349319, r349328-r349330

r349319:
Add some i2c slave-device drivers that were missing from NOTES.

r349328:
The gpiopps(4) driver currently has probe and attach code only for FDT based
systems, so conditionalize it accordingly in conf/files.

r349329:
Add gpio(4) and related drivers to NOTES.

r349330:
Add pwm devices to NOTES.

4 years agoMFC r349072, r349316-r349318
Ian Lepore [Sun, 11 Aug 2019 21:12:29 +0000 (21:12 +0000)]
MFC r349072, r349316-r349318

r349072:
Remove pcf8563reg.h, the driver it was associated with was replaced in 2017
with the nxprtc multi-chip driver.

r349316:
Remove some unused header files from the ad7418 driver.

r349317:
Add the rtc8583 driver to conf/files.  Also, move sy8106a from
file.allwinner to conf/files... it's not allwinner-specific, some day
other platforms could use the same regulator chip.

r349318:
The sy8106a and syr827 drviers require FDT and the ext_resources subsystem.

4 years agoMFC r349325, r349327
Ian Lepore [Sun, 11 Aug 2019 20:50:41 +0000 (20:50 +0000)]
MFC r349325, r349327

r349325:
Allow compiling ukbdmap.h on arm, since it appears to work fine.

r349327:
Build an armv7 LINT kernel in addition to armv5 LINT.  You might think this
had been done years ago.  I did.  All this time we've only compiled a LINT
kernel for TARGET_ARCH=arm.  Now separate LINT-V5 and LINT-V7 configs are
generated and built.

There are two new files in arm/conf, NOTES.armv5 and NOTES.armv7, containing
some of what used to be in the arm NOTES file.  That file now contains only
the bits that are common to v5 and v7.

The makeLINT.mk file now creates the LINT-V5 and LINT-V7 files by concatening
sys/conf/NOTES, arm/conf/NOTES, and arm/conf/NOTES.armv{5,7} in that order.

4 years agoMFC r342102 (by gonzo):
Ian Lepore [Sun, 11 Aug 2019 20:47:01 +0000 (20:47 +0000)]
MFC r342102 (by gonzo):

[twsi] Make extres/clk part conditional based on the EXT_RESOURCES option value

This should fix kernel build for ARMADA38X and possibly some other ARM configs

4 years agoMFC: 350557
George V. Neville-Neil [Sun, 11 Aug 2019 20:34:16 +0000 (20:34 +0000)]
MFC: 350557

Properly validate arguments for route deletion

Reported by: Liang Zhuo brightiup.zhuo@gmail.com

4 years agoMFC r343667:
Konstantin Belousov [Sun, 11 Aug 2019 08:24:56 +0000 (08:24 +0000)]
MFC r343667:
x86: correctly limit max memory resource address.

4 years agoMFC of 350682
Kirk McKusick [Sat, 10 Aug 2019 23:06:52 +0000 (23:06 +0000)]
MFC of 350682

Correct first superblock backup location in fsck_ffs.8.

4 years agoMFC of 350490
Kirk McKusick [Sat, 10 Aug 2019 23:03:23 +0000 (23:03 +0000)]
MFC of 350490

Set FORCE in chk[id]q when returning inodes and blocks.

4 years agoMFC r350229-r350230, r350408, r350410, r350673-r350674
Emmanuel Vadot [Sat, 10 Aug 2019 13:50:15 +0000 (13:50 +0000)]
MFC r350229-r350230, r350408, r350410, r350673-r350674

r350229:
arm: ti: Get the hwmods property from the parent node

Since the Linux 5.0 dts the ti,hwmods property is on the parent
ti.sysc node.

r350230:
arm: ti: Add a driver for ti,sysc bus

ti,sysc is a simple-bus like driver.
Add a driver for it so child nodes can attach.

r350408:
arm: ti: Get the hwmods property either from the node or the parent

r350229 changed the code to lookup the ti,hwmods property in the parent
as it's now like that in the DTS from >= Linux 5.0, allow the property
to be also in the node itself so we can boot with an older DTB.

Reported by: "Dr. Rolf Jansen" <rj@obsigna.com>

r350410:
arm: ti: cpsw: Check the new slave node address

Since DTS from >= Linux 5.0 the slave address are relative to the parent
node address and aren't the full ones.
Check both so the cpsw driver can find the phy id.

r350673:
arm: dts: am33xx: Fix the region for uart0

The region for uart0 is declared to be 0x2000 in size but the parent
node only declare 0x1000.
As the parent only declare a size of 0x1000 in the ranges for it's children
this cause the device to not be mappable.

https://patchwork.kernel.org/patch/11056769/

r350674:
ofw: ofw_reg_to_paddr: Use a 256 static array for the cell

Some hardware needs more than 32, bump this value.

We cannot use the _alloc for of getencprop as this function is called
too early in the boot before pmap is initialized and we only have
2k of stack when cninit is called.

Discussed with:     ian

4 years agoMFC r350683, r350684:
Konstantin Belousov [Sat, 10 Aug 2019 08:29:23 +0000 (08:29 +0000)]
MFC r350683, r350684:
Clarify the robustness guarantees.

4 years agoMFC r350561:
Konstantin Belousov [Sat, 10 Aug 2019 08:27:36 +0000 (08:27 +0000)]
MFC r350561:
amd64: Streamline exceptions and interrupts handlers.

4 years agoMFC r350560:
Konstantin Belousov [Sat, 10 Aug 2019 08:26:10 +0000 (08:26 +0000)]
MFC r350560:
bhyve: Ignore MSI/MSI-X interrupts sent to non-active vCPUs in
physical destination mode.

4 years agoMFC r350815:
Jonathan T. Looney [Sat, 10 Aug 2019 00:01:25 +0000 (00:01 +0000)]
MFC r350815:
  In m_pulldown(), before trying to prepend bytes to the subsequent mbuf,
  ensure that the subsequent mbuf contains the remainder of the bytes
  the caller sought. If this is not the case, fall through to the code
  which gathers the bytes in a new mbuf.

  This fixes a bug where m_pulldown() could fail to gather all the desired
  bytes into consecutive memory.

PR: 238787
Approved by: so (emaste)

4 years agoMFC r345299:
Michal Meloun [Fri, 9 Aug 2019 12:15:23 +0000 (12:15 +0000)]
MFC r345299:

  PSCI: Don't take missing implementation of psci get_version() as fatal.
  Minimalistic PSCI implementation in U-Boot doesn't implement get_version()
  method for some SoC. In this case, use PSCI version declared by 'psci' node
  in DT as fallback.

4 years agoMFC r345297:
Michal Meloun [Fri, 9 Aug 2019 11:21:42 +0000 (11:21 +0000)]
MFC r345297:

  Improve cpufreq_dt.
   - older DT can use 'cpu0-supply' property for power supply binding.  - don't
   expect that actual CPU frequency is contained in CPU
     operational point table, but read current CPU voltage directly from
     reguator. Typically, u-boot can set starting CPU frequency to any value.

4 years agoMFC r345296:
Michal Meloun [Fri, 9 Aug 2019 11:20:05 +0000 (11:20 +0000)]
MFC r345296:

  Use named field's initializer when constructing <foo>_platform structure.  In
  current code, the delay argument in FDT_PLATFORM_DEF(2) improperly initialize
  refs field from kobj_class structure instead of delay_count field.  This
  causes not working DELAY() function (due to never initialized delay_count) in
  earlier boot stages, until the first timer was attached.

4 years agoMFC r345295:
Michal Meloun [Fri, 9 Aug 2019 10:33:23 +0000 (10:33 +0000)]
MFC r345295:

  extres: Unify error codes for <foo>_get_by_ofw_property() methods.  Return:
   - ENOENT if requested property doesn't exist - ENODEV if producer device is
   not (yet) attached - ENXIO otherwise

4 years agoMFC r343963:
Michal Meloun [Fri, 9 Aug 2019 10:31:53 +0000 (10:31 +0000)]
MFC r343963:

  Don't allocate same clock twice..

4 years agoMFC r343962,r343965:
Michal Meloun [Fri, 9 Aug 2019 10:28:20 +0000 (10:28 +0000)]
MFC r343962,r343965:

  r343962:
    Properly handle alignment requests bigger that page size.
     - for now, alignments bigger that page size is allowed only for buffers
       allocated by bus_dmamem_alloc(), cover this fact by KASSERT.
     - never bounce buffers allocated by bus_dmamem_alloc(), these always
     comply
       with the required rules (alignment, boundary, address range).
  r343965:
    Fix bug introduced by r343962.  DMAMAP_DMAMEM_ALLOC is property of dmamap,
    not dmatag.

4 years agoMFC r343828:
Michal Meloun [Fri, 9 Aug 2019 10:00:11 +0000 (10:00 +0000)]
MFC r343828:

  Adapt FreeBSD specific DT stub for Jetson TK1 board to be consistent with
  update of devicetree to 4.19 in r340337.  Our build system doesn't provide
  dependencies for included DTS files, so nobody noticed this issue for long
  time.

4 years agoMFC r343498:
Michal Meloun [Fri, 9 Aug 2019 09:57:04 +0000 (09:57 +0000)]
MFC r343498:

  Properly define and declare phynode_topo_lock, it should be single global
  variable.

4 years agoMFC r350383: Reenable UNMAP support on ramdisks by default.
Alexander Motin [Fri, 9 Aug 2019 00:50:02 +0000 (00:50 +0000)]
MFC r350383: Reenable UNMAP support on ramdisks by default.

For some reason, I guess just mechanical editing, it was disable in r333446.

4 years agoMFC r350378: Allow WRITE SAME handle more then 2^^32 blocks.
Alexander Motin [Fri, 9 Aug 2019 00:49:31 +0000 (00:49 +0000)]
MFC r350378: Allow WRITE SAME handle more then 2^^32 blocks.

If not limited by write_same_max_lba option, split operation into several
2^^31 blocks chunks in a loop.  For large disks it may take a while, so
setting write_same_max_lba may be useful to avoid timeouts.

While there, fix build with CAM_CTL_DEBUG.

4 years agoMFC r350363: Add support for Long LBA mode parameter block descriptor.
Alexander Motin [Fri, 9 Aug 2019 00:49:02 +0000 (00:49 +0000)]
MFC r350363: Add support for Long LBA mode parameter block descriptor.

It is formally required for SBC Base 2016 feature set.

4 years agoMFC r350346: Add device temperature reporting into CTL.
Alexander Motin [Fri, 9 Aug 2019 00:48:31 +0000 (00:48 +0000)]
MFC r350346: Add device temperature reporting into CTL.

The values to report can be set via LUN options.  It can be useful for
testing, and also required for Drive Maintenance 2016 feature set.

4 years agoMFC r350343: Add reporting of SCSI Feature Sets VPD page from SPC-5.
Alexander Motin [Fri, 9 Aug 2019 00:47:27 +0000 (00:47 +0000)]
MFC r350343: Add reporting of SCSI Feature Sets VPD page from SPC-5.

CTL implements all defined feature sets except Drive Maintenance 2016,
which is not very applicable to such a virtual device, and implemented
only partially now.  But may be it could be fixed later at least for
completeness.

4 years agoMFC r348376 (by rpokala):
Alexander Motin [Thu, 8 Aug 2019 03:01:35 +0000 (03:01 +0000)]
MFC r348376 (by rpokala):
Add bits related to SANITIZE, SED, and form-factor to (struct ata_params)

Based on ATA-ACS-4, recognize several bit-fields related to the ATA SANITIZE
feature-set, Self-Encrypting Drives, and form-factor identification.

As part of this change, the name of word 48 of (struct ata_params) is being
changed. The previous name, "usedmovsd" does not appear to be related to the
previous definition of the word ("double-word IO supported"). The word was
defined that way in ATA-1 (1994), but it was marked "Reserved" (meaning
"unused, but might be used in the future") in ATA-2 (1996). It stayed that
way until ATA-8 (2008), which re-defined it as implemented in this change.
The field is not used in-tree.

4 years agoMFC r350331: Make `camcontrol sanitize` support also ATA devices.
Alexander Motin [Thu, 8 Aug 2019 02:29:42 +0000 (02:29 +0000)]
MFC r350331: Make `camcontrol sanitize` support also ATA devices.

ATA sanitize is functionally identical to SCSI, just uses different
initiation commands and status reporting mechanism.

While there, make kernel better handle sanitize commands and statuses.

4 years agoMFC r350257: Make `camcontrol hpa` and `camcontrol ama` trigger reprobe.
Alexander Motin [Thu, 8 Aug 2019 02:29:11 +0000 (02:29 +0000)]
MFC r350257: Make `camcontrol hpa` and `camcontrol ama` trigger reprobe.

This makes OS automatically see the disk's new disk size.

4 years agoMFC r350233: Make CAM ATA stack handle disk resizes.
Alexander Motin [Thu, 8 Aug 2019 02:28:32 +0000 (02:28 +0000)]
MFC r350233: Make CAM ATA stack handle disk resizes.

While for ATA disks resize is even more rare situation than for SCSI, it
may happen in case of HPA or AMA being used.  Make ATA XPT report minor
IDENTIFY DATA change to upper layers with AC_GETDEV_CHANGED, and ada(4)
periph driver handle that event, recalculating all the disk properties and
signalling resize to GEOM.  Since ATA has no mechanism of UNIT ATTENTIONs,
like SCSI, it has no way to detect that something has changed.  That is why
this functionality depends on explicit reprobe via XPT_REPROBE_LUN call.

4 years agoMFC r350214: Unify BTL parsing for `camcontrol debug` and `reset`.
Alexander Motin [Thu, 8 Aug 2019 02:26:12 +0000 (02:26 +0000)]
MFC r350214: Unify BTL parsing for `camcontrol debug` and `reset`.

This makes `camcontrol debug` also allow peripheral device specification.

While there, make BTL parser more strict and switch from strtok() to
strsep().

4 years agoMFC r350150: Properly report ACS revisions alike to kernel.
Alexander Motin [Thu, 8 Aug 2019 02:25:34 +0000 (02:25 +0000)]
MFC r350150: Properly report ACS revisions alike to kernel.

4 years agoMFC r350149: Add Accessible Max Address Configuration support to camcontrol.
Alexander Motin [Thu, 8 Aug 2019 02:24:57 +0000 (02:24 +0000)]
MFC r350149: Add Accessible Max Address Configuration support to camcontrol.

AMA replaced HPA in ACS-3 specification.  It allows to limit size of the
disk alike to HPA, but declares inaccessible data as indeterminate.  One
of its practical use cases is to under-provision SATA SSDs for better
reliability and performance.

While there, fix HPA Security detection/reporting.

4 years agoMFC r350020 (by imp): Use a different approach to range check.
Alexander Motin [Thu, 8 Aug 2019 02:21:30 +0000 (02:21 +0000)]
MFC r350020 (by imp): Use a different approach to range check.

gcc hates dt < CC_DT_NONE since it can never be true when dt is an unsigned
type. Since that's a compiler choice and may be affected by weird stuff, instead
use (unsigned)dt > CC_DT_UNKNOWN to test for bounds error since that will work
regardless of the signedness of dt.

4 years agoMFC r350018: Implement a devtype command.
Alexander Motin [Thu, 8 Aug 2019 02:20:42 +0000 (02:20 +0000)]
MFC r350018: Implement a devtype command.

List the device's protocol. The returned value is one of the following:
        ata     direct attach ATA or SATA device
        satl    a SATA device attached via SAS
        scsi    A parallel SCSI or SAS
        nvme    A direct attached NVMe device
        mmcsd   A MMC or SD attached device

4 years agoMFC r350008 (by imp):
Alexander Motin [Thu, 8 Aug 2019 02:18:14 +0000 (02:18 +0000)]
MFC r350008 (by imp):
Use the more proper term of SATL instead of ATA_BEHIND_SCSI.

Most people know SAS attached SATA devices by the name SAT or SATL
(with the latter being a little more common). Change the device type
ATA_BEHIND_SCSI to SATL since it's more specific and meaningful.

4 years agoMFC r349964: Add device type NVME and device type MMCSD to get_device_type
Alexander Motin [Thu, 8 Aug 2019 02:17:24 +0000 (02:17 +0000)]
MFC r349964: Add device type NVME and device type MMCSD to get_device_type

For completeness, add nvme and mmc/sd devices to the list of device
types we know.

4 years agoMFC r349341: Use ata_param_fixup instead of a custom copy here
Alexander Motin [Thu, 8 Aug 2019 02:12:08 +0000 (02:12 +0000)]
MFC r349341: Use ata_param_fixup instead of a custom copy here

4 years agoMFC r349340 (by imp): Create ata_param_fixup
Alexander Motin [Thu, 8 Aug 2019 02:11:42 +0000 (02:11 +0000)]
MFC r349340 (by imp): Create ata_param_fixup

Create a common fixup routine to do the canonical fixup of the
ata_param fixup. Call it from both the ATA and the ATA over SCSI
paths.

4 years agoMFC r349339 (by imp):
Alexander Motin [Thu, 8 Aug 2019 02:11:08 +0000 (02:11 +0000)]
MFC r349339 (by imp):
Go ahead and completely fix the ata_params before calling the veto
function. This breaks nothing that uses it in the tree since
ata_params is ignored in storvsc_ada_probe_veto which is the only
in-tree consumer.

4 years agoMFC r349283 (by scottl):
Alexander Motin [Thu, 8 Aug 2019 02:08:09 +0000 (02:08 +0000)]
MFC r349283 (by scottl):
Refactor xpt_getattr() to make it more readable.  No outwardly
visible functional changes, though code flow was modified a bit
internally to lessen the need for goto jumps and chained if
conditionals.

4 years agoMFC r349010: Increase the timeout for READ NATIVE MAX
Alexander Motin [Thu, 8 Aug 2019 02:07:05 +0000 (02:07 +0000)]
MFC r349010: Increase the timeout for READ NATIVE MAX

READ NATIVE MAX can take longer than a second if the queued NCQ I/Os
take longer than a second to drain.

4 years agoMFC r348963: Minor white space changes.
Alexander Motin [Thu, 8 Aug 2019 02:06:23 +0000 (02:06 +0000)]
MFC r348963: Minor white space changes.

Remove trailing white space that's crept into this file.

4 years agoMFC r348786 (by chuck): Fix nda(4) PCIe link status output
Alexander Motin [Thu, 8 Aug 2019 02:04:29 +0000 (02:04 +0000)]
MFC r348786 (by chuck): Fix nda(4) PCIe link status output

Differentiate between PCI Express Endpoint devices and Root Complex
Integrated Endpoints in the nda driver. The Link Status and Capability
registers are not valid for Integrated Endpoints and should not be
displayed. The bhyve emulated NVMe device will advertise as being an
Integrated Endpoint.

4 years agoMFC r348110: Fix condition broken at r345815.
Alexander Motin [Thu, 8 Aug 2019 02:02:01 +0000 (02:02 +0000)]
MFC r348110: Fix condition broken at r345815.

4 years agoMFC r345815: Make cam_error_print() decode NVMe commands.
Alexander Motin [Thu, 8 Aug 2019 02:01:01 +0000 (02:01 +0000)]
MFC r345815: Make cam_error_print() decode NVMe commands.

4 years agoMFC r345817: Build NVMe CAM transport unrelated to NVMe SIM.
Alexander Motin [Thu, 8 Aug 2019 02:00:11 +0000 (02:00 +0000)]
MFC r345817: Build NVMe CAM transport unrelated to NVMe SIM.

Before this I suppose it was impossible load CAM-based NVMe as module.
Plus this appeared to be needed to build r345815 without NVMe driver.

4 years agoMFC r345363 (by imp): Make WD and WDC aliases for HGST.
Alexander Motin [Thu, 8 Aug 2019 00:33:23 +0000 (00:33 +0000)]
MFC r345363 (by imp): Make WD and WDC aliases for HGST.

HGST was bought by WDC. Over the years, it has sold different drives
branded as HGST, WD or WDC. All of them need the HGST workaround of
sending 4k-sized packets (or multiples of 4k). And the ones that don't
really need this aren't broken by this change. Submitter is the vendor
who has tested these changes on a number of drives. I've simplified it
slightly, since we don't need additional vendors for this at this
time.

4 years agoMFC r345060 (by 0mp): camcontrol.8: Bump date after r345051
Alexander Motin [Thu, 8 Aug 2019 00:32:22 +0000 (00:32 +0000)]
MFC r345060 (by 0mp): camcontrol.8: Bump date after r345051

4 years agoMFC r345051 (by imp): Add -l to camcontrol readcap.
Alexander Motin [Thu, 8 Aug 2019 00:31:00 +0000 (00:31 +0000)]
MFC r345051 (by imp): Add -l to camcontrol readcap.

The -l flag sends only the READ CAPACITY (16) sevice action. Normally
we send the READ CAPACITY (10) command, and only send RC16 when the
capacity is larger than 2TB (since that's the max RC10 can
report). However, some badly programmed drives report different
numbers for RC10 and RC16. This can be hard to diagnose, but generally
there's a "Logical block address out of range" error when RC16 reports
a larger number than RC10 and the RC10 number is the correct one. By
comparing the output of readcap with and without the -l argmuent, one
can determine if there's a mismatch and if the DA_Q_NO_RC16 quirk is
needed.

4 years agoMFC r344070 (by imp): Fix panic message.
Alexander Motin [Thu, 8 Aug 2019 00:29:39 +0000 (00:29 +0000)]
MFC r344070 (by imp): Fix panic message.

The panic message lead people to believe some userland CAM request had
caused a problem when in reallity it was for a kernel request (eg the
USER bit was cleared). Reword message. Also, improve a couple of
comments to reflect that the periph shouldn't be completely torn down
before we get here (so the path and sim pointers should be valid, but
aren't and the code is designed to be robust enough in the face of
that to give a specific panic message).

4 years agoMFC r343814 (by imp): Add quirk for Sansisk X400 drives
Alexander Motin [Thu, 8 Aug 2019 00:27:26 +0000 (00:27 +0000)]
MFC r343814 (by imp): Add quirk for Sansisk X400 drives

Certain versions of Sandisk x400 firmware can hang under extremely
heavly load of large I/Os for prolonged periods of time. Newer /
current versions work fine, and should be used where possible. Where
not possible, this quirk ensures that I/O requests are limited to 128k
to avoids the bug, even under extreme load. Since MAXPHYS is 128k,
only users with custom kernels are at risk on the older firmware.
Once all known users of the older firmware have upgraded, this quirk
will be removed.

4 years agoMFC r342866 (by imp): Add NO_SYNC_CACHE quirk for PENTAX cameras
Alexander Motin [Thu, 8 Aug 2019 00:23:11 +0000 (00:23 +0000)]
MFC r342866 (by imp): Add NO_SYNC_CACHE quirk for PENTAX cameras

PR: 93389

4 years agoMFC r341769 (by imp):
Alexander Motin [Thu, 8 Aug 2019 00:22:15 +0000 (00:22 +0000)]
MFC r341769 (by imp):
Send a START UNIT command when a disk responds with an ASC of 04/1C.
This will hopefully spin up a disk that's in low-power mode.

4 years agoMFC r340452 (by imp):
Alexander Motin [Thu, 8 Aug 2019 00:19:45 +0000 (00:19 +0000)]
MFC r340452 (by imp):
Introduce scsi_ata_setfeatures() as a convenient way to make
a passthru ATA SETFEATURES command.

4 years agoMFC r340448 (by imp): Remove trailing white space in advance of other changes.
Alexander Motin [Thu, 8 Aug 2019 00:18:36 +0000 (00:18 +0000)]
MFC r340448 (by imp): Remove trailing white space in advance of other changes.

4 years agoMFC r340024 (by imp): Add comments explaining what hold/unhold do
Alexander Motin [Thu, 8 Aug 2019 00:17:16 +0000 (00:17 +0000)]
MFC r340024 (by imp): Add comments explaining what hold/unhold do

They act as a simple one-deep semaphore to keep open/close/probe from
running at the same time to avoid races that creates.

4 years agoMFC r346995:
Mark Johnston [Wed, 7 Aug 2019 20:36:36 +0000 (20:36 +0000)]
MFC r346995:
Add a few regression tests for mlock(2).

4 years agoMFC r347366:
Emmanuel Vadot [Wed, 7 Aug 2019 19:18:32 +0000 (19:18 +0000)]
MFC r347366:

dts: Import files from Linux 5.1

4 years agoMFC r341404-r341405, r344699, r347024, r347442
Emmanuel Vadot [Wed, 7 Aug 2019 18:35:59 +0000 (18:35 +0000)]
MFC r341404-r341405, r344699, r347024, r347442

r341404 by andreast:
Add rule to build the dtb for the rock64 board.

Reviewed by: manu@

r341405 by andreast:
Build the dtb for the rock64 board.

Reviewed by: manu@

r344699:
arm64: rockchip: rk3399_pll: Fix the recalc function

The plls frequency are now correctly calculated in fractional mode
and integer mode.
While here add some debug printfs (disabled by default)
Tested with powerd on the little cluster on a RockPro64.

r347024:
dtb: Include RK3399 RockPro64 DTS in kernel build

The DTS for this board is already present in sys/gnu/dts/arm64/rockchip/
and just needs to be enabled.

Submitted by: alex@wied.io
Differential Revision: https://reviews.freebsd.org/D19823

r347442:
arm64: rockchip: Don't always put PLL to normal mode

We used to put every PLL in normal mode (meaning that the output would
be the result of the PLL configuration) instead of slow mode (the output
is equal to the external oscillator frequency, 24-26Mhz) but this doesn't
work for most of the PLLs as when we put them into normal mode the registers
configuring the output frequency haven't been set.
Add a normal_mode member in clk_pll_def/clk_pll_sc struct and if it's true
we then set the PLL to normal mode.
For now only set it to the LPLL and BPLL (Little cluster PLL and Big cluster
PLL respectively).

Reviewed by: ganbold
Differential Revision: https://reviews.freebsd.org/D20174

4 years agoMFC r341381-r341383, r341385, r343950, r344527, r344576-r344580, r344585, r344589...
Emmanuel Vadot [Wed, 7 Aug 2019 18:26:32 +0000 (18:26 +0000)]
MFC r341381-r341383, r341385, r343950, r344527, r344576-r344580, r344585, r344589-r344590, r344623, r344626-r344627

r341381:
arm64: rockchip: Add RK3399_CLK_PLL

PLLs on the RK3399 are different than the ones on the RK3328.
Add a new type and some dedicated recalc and set_freq functions.
Rename the RK3328 dedicated rk_clk_pll function with rk3328_ prefix.

r341382:
arm64/rockchip: add RK3399 support

Add CRU (Clock and Reset Unit) driver for RK3399.
Add support in rk_pinctrl driver.

Submitted by:  Greg V <greg@unrelenting.technology> (Original version)
Differential Revision: https://reviews.freebsd.org/D16732

r341383:
arm64: rockchip: rk_i2c: Use correct clock

While here add RK3399 support and call clk_set_assigned to set the correct
clock set in the DTS.

r341385:
arm64: rockchip: rk805: Add basic support for RK808 PMIC

RK808 PMIC is the companion chip for RK3399 SoC.
Add basic regulator support in RK805 since they are similar.

r343950:
arm64: Fix compile when removing SOC_ROCKCHIP_* options

Make every rockchip file depend on the multiple soc_rockchip options
While here make rk_i2c and rk_gpio depend on their device options.

Reported by: sbruno

r344527:
arm64: rockchip: clk: Set the write mask when setting the clock mux

RockChip clocks have a write mask in the upper 16bits of the mux register
which wasn't set in the set_mux function.
Also the wrong parent was tested instead of the real current one, when
switch parent, test with the current one before.

Pointy Hat:    manu

r344576:
arm64: rockchip: clk: rk_clk_composite: Properly use the mask bits

RockChip clocks register have a write mask in the upper 16 bits, if a 1
is present the corresponding bit in the lower 16 ones is set.
Use this instead of always setting the mask to 0xFFFF0000.
This avoids a read of the register.
While here add some debug printf useful for debuging clock problems

r344577:
arm64: rockchip: clk: ARM CLK improvement

RockChip clocks register have a write mask in the upper 16 bits, if a 1
is present the corresponding bit in the lower 16 ones is set.
Use this instead of always setting the mask to 0xFFFF0000.
This avoids a read of the register.
While here set the parent after changing its freqeuncy, this reduce the time
between changing the parent and changing the divider for the arm clock.

r344578:
arm64: rockchip: rk3328_pll: Multiple improvement

RockChip clocks register have a write mask in the upper 16 bits, if a 1
is present the corresponding bit in the lower 16 ones is set.
Use this instead of always setting the mask to 0xFFFF0000.
This avoids a read of the register.
While here, when switching PLL frequency, first switch it to slow mode.
When set to slow mode the PLL clock will be the external oscillator.
Changing the PLL parameters while its output is used can cause hang (sometimes).

r344579:
arm64: rockchip: rk805: Add LDO regulators

Add the 3 LDO regulator found in the RK805 Power Management IC.

r344580:
 arm64: rockchip: rk805: Map the regulator

No map function was provided before so every regulator lookup resolved
the regulator with id 1, as it uses the default mapper, which is wrong.
Correctly map the regulators.
While here remove some debug printfs and make them disable by default.

r344585:
arm64: rockchip: rk_pinctrl: Fix two banks in RK3328

The last two banks don't have 3 bits for the pin function but only 2.
This fixes eMMC on the Rock64.

r344589:
arm64: rockchip: rk3399_pll: Switch to slow mode when changing the freq

Like r344578 but for RK3399.
This solve some hangs when switching between frequency.

r344590:
arm64: rockchip: rk3399_pll: Fix copy paste

RK3399 PLLs don't have mode_reg, use the correct register.

r344623:
arm64: rockchip: clk_pll: Multiple improvement

Remove the mode_val from the clock definition as it's a bit unreadable.
Use mode_shift to represent which bit control the mode in the register.
Simplify some case where we can avoid a register read before changing it.
Set the PLL back to normal mode after the PLL have stabilized.

Discussed with:  mmel

r344626:
arm64: rockchip: rk3399_clk: Add sd clock definitions

r344627:
mmc: dwmmc: Match on "rockchip,rk3288-dw-mshc" compatible

This is the common denominator for rockchip compatible from RK3288 to RK3399.
The other compatible are generally present in the DTS but the controllers
are the same.

4 years agoMFC r341141-r341143, r341255
Emmanuel Vadot [Wed, 7 Aug 2019 18:16:28 +0000 (18:16 +0000)]
MFC r341141-r341143, r341255

r341141:
rk_clk_composite: Fix set_mux

Pointy Hat:   manu

r341142:
Add RK805 PMIC Support

RK805 is the companion PMIC for RK3328 SoC.
Add a driver for it with most of it's regulators supported.

r341143:
arm64: Add rk_i2c and rk805 to GENERIC

r341255:
arm64: rockchip: armclk: Do not change parent freq if CLK_SET_DRYRUN is set

4 years agoMFC r350568:
Cy Schubert [Wed, 7 Aug 2019 01:08:57 +0000 (01:08 +0000)]
MFC r350568:

Resolve ipfilter kld unload issues related to VNET jails.

When the ipfilter kld is loaded, used within VNET jail, and unloaded,
then subsequent loading, use, and unloading of another packet filters
will cause the subsequently loaded netpfil kld's to panic.

The scenario is as follows:

cd /usr/tests/sys/netpfil/common

kldunload ipl
kldunload pfsync
kldunload ipfw

kyua test pass_block

kldload ipl
kyua test pass_block
kldunload ipl

kldload pfsync
kyua test pass_block
kldunload pfsync
-- page fault panic occurs here --

Reported by: "Ahsan Barkati" <ahsanbarkati@g.....com> via kp@
Discussed with: kp@
Tested by: kp@

4 years agoMFC r350567:
Cy Schubert [Wed, 7 Aug 2019 01:03:35 +0000 (01:03 +0000)]
MFC r350567:

Returning an uninitialized error is a bad thing.

4 years agoMFC r350645: Correct ICMPv6/MLDv2 out-of-bounds memory access
Ed Maste [Tue, 6 Aug 2019 17:13:41 +0000 (17:13 +0000)]
MFC r350645: Correct ICMPv6/MLDv2 out-of-bounds memory access

Previously the ICMPv6 input path incorrectly handled cases where an
MLDv2 listener query packet was internally fragmented across multiple
mbufs.

admbugs: 921
Submitted by: jtl
Reported by: CJD of Apple
Approved by: so
Security: CVE-2019-5608

4 years agoMFC r350635: bsnmp: add asn1 message length validation
Ed Maste [Tue, 6 Aug 2019 16:11:16 +0000 (16:11 +0000)]
MFC r350635: bsnmp: add asn1 message length validation

admbugs: 780
Submitted by: Guido Vranken, bz
Reported by: Guido Vranken
Approved by: so
Security:       CVE-2019-5610

4 years agoMFC r350544:
Mark Johnston [Tue, 6 Aug 2019 14:39:02 +0000 (14:39 +0000)]
MFC r350544:
Add bzip2recover.1.

4 years agoMFC r350432:
Mark Johnston [Tue, 6 Aug 2019 14:38:44 +0000 (14:38 +0000)]
MFC r350432:
Merge r3778 and r3779 from ELFToolchain.

4 years agoMFC r350514:
Mark Johnston [Tue, 6 Aug 2019 14:38:16 +0000 (14:38 +0000)]
MFC r350514:
Add an MLINK for daemonfd(3).

4 years agoMFC r350513:
Mark Johnston [Tue, 6 Aug 2019 14:37:57 +0000 (14:37 +0000)]
MFC r350513:
Fix formatting.

4 years agoMFC r348179-r348182
Emmanuel Vadot [Tue, 6 Aug 2019 12:19:09 +0000 (12:19 +0000)]
MFC r348179-r348182

r348179:
allwinner: aw_ccu: Add some debug printfs (disabled by default)

Also print information about setting frequency at boot under bootverbose

r348180:
arm: allwinner: clk: Add new clock aw_clk_frac

Add a clock driver for clock that can either be used in integer mode
with one N factor and one M divider or in fractional mode where the
output frequency is chosen between two predifined output.

r348181:
arm: allwinner: clk: Use the new frac clock

Some clocks used the NM type but this clock is for the ones with the
formula "clk = clkin / n / m" and not "clk = clkin * n / m"
Use the new frac clock for them.

r348182:
arm: allwinner: Remove frac mode from NM clk

We have a correct clock type aw_clk_frac now for this.

4 years agoMFC r347489-r347491, r347512
Emmanuel Vadot [Tue, 6 Aug 2019 12:12:29 +0000 (12:12 +0000)]
MFC r347489-r347491, r347512

r347489:
allwinner: clk: prediv_mux: Init the current parent

Do not init the first parent but read the clock register to find
it's current parent and init this one.

r347490:
allwinner: clk: sun8i_r: Correct resets

The i2c reset wasn't defined and some bits where wrong, correct them.

r347491:
twsi: Calculate the clock param based on the bus frequency

Instead of precalculating the different speed, respect the bus frequency
and calculate the clock register parameter based on it.
If the platform didn't register the core clk, fallback on the precomputed
values (This is likely do be the case on Marvell boards).

r347512:
arm: allwinner: aw_clk_nm: Don't reparent the clock if we didn't ask

When looking for the best frequency don't change the clock parent if the
clock wasn't configured to do that.

4 years agoMFC 350618:
John Baldwin [Mon, 5 Aug 2019 22:04:16 +0000 (22:04 +0000)]
MFC 350618:
Validate guest-supplied length of headers for TSO transmit requests.

When transmitting a large TCP packet, the final transmit descriptor
includes the length of the protocol headers to be duplicated on each
segment.  The device model was trusting the guest-supplied value
without validating it.  A value of zero would result in the guest
being able to indirect a garbage pointer on the stack to overwrite
arbitrary memory in the bhyve process.  A value that was non-zero but
too small for the requested parameters resulted in the device model
reading and writing values beyond the end of the on-stack buffer used
to hold the template header.

To fix, validate the supplied length and drop requests to transmit
packets that would overflow the header buffer.  While here, initialize
the header pointer to NULL as a preventive measure so that any access
to an unallocated template header crashes they hypervisor
deterministically.

While here, only read the TCP sequence number if the packet being
split is a TCP packet.  The e1000 logic supports a segmentation of UDP
frames, and while UDP segmentation requires this part of the header to
be valid (so there is no buffer overflow), only reading the field when
needed is cleaner.

admbugs: 918
Reported by: Reno Robert <renorobert@gmail.com>
Approved by: so
Security: CVE-2019-5609

4 years agoMFC r350425: printf(1): Note that \c only works in %b strings
Jilles Tjoelker [Mon, 5 Aug 2019 20:19:38 +0000 (20:19 +0000)]
MFC r350425: printf(1): Note that \c only works in %b strings

PR: 238313