]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC r354673:
Ravi Pokala [Tue, 3 Dec 2019 22:53:07 +0000 (22:53 +0000)]
MFC r354673:

Logging improvements to loader::nfs

Include the server IP address when logging nfs_open(), add a few missing
"\n"s, and correct a typo.

4 years agoMFC r354102:
Ravi Pokala [Tue, 3 Dec 2019 22:51:25 +0000 (22:51 +0000)]
MFC r354102:

Args for buf_track() might be unused

If neither FULL_BUF_TRACKING nor BUF_TRACKING are defined, then the body of
buf_track() becomes empty. Mark the arguments with "__unused" so the
compiler doesn't complain about unused arguments in that case.

4 years agoMFC r343583:
Ravi Pokala [Tue, 3 Dec 2019 22:49:24 +0000 (22:49 +0000)]
MFC r343583:

Remove unecessary "All rights reserved" from files under my or Panasas's
copyright.

When all member nations of the Buenos Aires Convention adopted the Berne
Convention, the phrase "All rights reserved" became unnecessary to assert
copyright. Remove it from files under my or Panasas's copyright. The files
related to jedec_dimm(4) also bear avg@'s copyright; he has approved this
change.

4 years agoMFC 342160: Work around BIOS quirks on HPE Proliant MicroServer Gen10
John Baldwin [Tue, 3 Dec 2019 22:01:45 +0000 (22:01 +0000)]
MFC 342160: Work around BIOS quirks on HPE Proliant MicroServer Gen10

PR: 221350

4 years agoMFC r355205: snp: don't reference tp->t_mtx directly
Kyle Evans [Tue, 3 Dec 2019 19:14:02 +0000 (19:14 +0000)]
MFC r355205: snp: don't reference tp->t_mtx directly

This is the only part of snp(4) that pokes around in struct tty directly;
replace it with the tty_getlock accessor to avoid struct tty internals.

4 years agoMFC r354712: arm64: fix BUS_DMA_ALLOCNOW for non-paged aligned sizes
Kyle Evans [Tue, 3 Dec 2019 19:00:12 +0000 (19:00 +0000)]
MFC r354712: arm64: fix BUS_DMA_ALLOCNOW for non-paged aligned sizes

For any size that isn't page-aligned, we end up not pre-allocating enough
for a single mapping because we truncate the size instead of rounding up to
make sure the last bit is accounted for, leaving us one page shy of what we
need to fulfill a request.

4 years agoMFC r354541: csu: Fix dynamiclib/init_test:jcr_test on !HAVE_CTORS archs
Kyle Evans [Tue, 3 Dec 2019 18:58:45 +0000 (18:58 +0000)]
MFC r354541: csu: Fix dynamiclib/init_test:jcr_test on !HAVE_CTORS archs

.jcr still needs a 0-entry added in crtend, even on !HAVE_CTORS archs, as
we're still getting .jcr sections added -- presumably due to the reference
in crtbegin. Without this terminal, the .jcr section (without data) overlaps
with the next section and register_classes in crtbegin will be examining the
wrong item.

PR: 241439

4 years agoMFC r354464: sys/conf/files.arm64: remove unnecessary soc_* dependencies
Kyle Evans [Tue, 3 Dec 2019 18:57:32 +0000 (18:57 +0000)]
MFC r354464: sys/conf/files.arm64: remove unnecessary soc_* dependencies

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

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

4 years agoMFC r351836, r351866, r354328: patch(1) /dev/null testing+improvement
Kyle Evans [Tue, 3 Dec 2019 18:55:09 +0000 (18:55 +0000)]
MFC r351836, r351866, r354328: patch(1) /dev/null testing+improvement

r351836: patch(1): add some basic tests

Summary:
- basic: test application of patches created by diff -u at the
  beginning/middle/end of file, which have differing amounts of context
  before and after chunks being added
- limited_ctx: stems from PR 74127 in which a rogue line was getting added
  when the patch should have been rejected. Similar behavior was
  reproducible with larger contexts near the beginning/end of a file. See
  r326084 for details
- file_creation: patch sourced from /dev/null should create the file
- file_nodupe: said patch sourced from /dev/null shouldn't dupe the contents
  when re-applied (personal vendetta, WIP, see comment)
- file_removal: this follows from nodupe; the reverse of a patch sourced
  from /dev/null is most naturally deleting the file, as is expected based
  on GNU patch behavior (WIP)

r351866: patch(1): fix the file removal test, strengthen it a bit

To remain compatible with GNU patch, we should ensure that once we're
removing empty files after a reversed /dev/null patch we don't remove files
that have been modified. GNU patch leaves these intact and just reverses the
hunk that created the file, effectively implying --remove-empty-files for
reversed /dev/null patches.

r354328: patch(1): give /dev/null patches special treatment

We have a bad habit of duplicating contents of files that are sourced from
/dev/null and applied more than once... take the more sane (in most ways)
GNU route and complain if the file exists and offer reversal options.

This still falls short a little bit as selecting "don't reverse, apply
anyway" will still give you duplicated file contents. There's probably other
issues as well, but awareness is the first step to happiness.

4 years agoMFC r354246: liblua: add loader.lua_path
Kyle Evans [Tue, 3 Dec 2019 18:50:18 +0000 (18:50 +0000)]
MFC r354246: liblua: add loader.lua_path

As described previously, loader.lua_path is absolute path where scripts are
installed. A future commit will use this to build paths for dofile in
try_include, rather than the current pcall/require setup that makes it more
difficult to coordinate loader aborts from local.lua -- we do not need the
flexibility of require(), and local.lua is in-fact not a 'module-like' file
as we will not be referencing anything from it.

4 years agoMFC r354236: mdmfs(8): add -k skel option to populate fs from a skeleton
Kyle Evans [Tue, 3 Dec 2019 18:38:51 +0000 (18:38 +0000)]
MFC r354236: mdmfs(8): add -k skel option to populate fs from a skeleton

mdmfs(8) lacks the ability to populate throwaway memory filesystems from an
existing directory.

This features permits an interesting setup where /var for instance lives on
a device where wear-leveling is something you want to avoid as much as
possible and nonetheless you don't want to lose your logs, ports metadata,
etc. Here are the steps:

1. Copy /var to /var.bak;
2. Mount an mfs into /var using -k /var.bak at startup;
3. Synchronize /var to /var.bak weekly and on shutdown.

Note that this more or less mimics OpenBSD's mount_mfs(8) -P flag.

PR: 146254

4 years agoMFC rarm: correct kernelstack allocation size
Kyle Evans [Tue, 3 Dec 2019 18:28:39 +0000 (18:28 +0000)]
MFC rarm: correct kernelstack allocation size

This appears to be a copy-pasto from previous lines that propagated to v6
over the years. Indeed, nothing references kernelstack beyond
USPACE_SVC_STACK_TOP and it would be odd if anything did.

4 years agoMFC r354245, r354833, r354837: add flua to the base system
Kyle Evans [Tue, 3 Dec 2019 18:25:16 +0000 (18:25 +0000)]
MFC r354245, r354833, r354837: add flua to the base system

r354245: stand: consolidate knowledge of lua path

Multiple places coordinate to 'know' where lua scripts are installed. Knock
this down to being formally defined (and overridable) in exactly one spot,
defs.mk, and spread the knowledge to loaders and liblua alike. A future
commit will expose this to lua as loader.lua_path, so it can build absolute
paths to lua scripts as needed.

r354833: Add flua to the base system, install to /usr/libexec

FreeBSDlua ("flua") is a FreeBSD-private lua, flavored with whatever
extensions we need for base system operations. We currently support a subset
of lfs and lposix that are used in the rewrite of makesyscall.sh into lua,
added in r354786.

flua is intentionally written such that one can install standard lua and
some set of lua modules from ports and achieve the same effect.

linit_flua is a copy of linit.c from contrib/lua with lfs and lposix added
in. This is similar to what we do in stand/. linit.c has been renamed to
make it clear that this has flua-specific bits.

luaconf has been slightly obfuscated to make extensions more difficult. Part
of the problem is that flua is already hard enough to use as a bootstrap
tool because it's not in PATH- attempting to do extension loading would
require a special bootstrap version of flua with paths changed to protect
the innocent.

src.lua.mk has been added to make it easy for in-tree stuff to find flua,
whether it's bootstrap-flua or relying on PATH frobbing by Makefile.inc1.

r354837: flua: newer GCC complains about format-nonliteral at WARNS=2

Disable that one, too.

4 years agoMFC r354986: Add variant of root_mount_hold() without allocation.
Alexander Motin [Tue, 3 Dec 2019 17:06:48 +0000 (17:06 +0000)]
MFC r354986: Add variant of root_mount_hold() without allocation.

It allows to use this KPI in non-sleepable contexts.

4 years agoMFC r355023: Do not retry long ready waits if previous gave nothing.
Alexander Motin [Tue, 3 Dec 2019 16:51:26 +0000 (16:51 +0000)]
MFC r355023: Do not retry long ready waits if previous gave nothing.

I have some disks reporting "Logical unit is in process of becoming ready"
for about half an hour before finally reporting failure.  During that time
CAM waits for the readiness during ~2 minutes for each request, that makes
system boot take very long time.

This change reduces wait times for the following requests to ~1 second if
previously long wait for that device has timed out.

4 years agoMFC r355013: Remove xpt_lock mutex.
Alexander Motin [Tue, 3 Dec 2019 16:50:06 +0000 (16:50 +0000)]
MFC r355013: Remove xpt_lock mutex.

CAM does not require SIM locks for years, and obviously does not require
it for completely virtual XPT SIM.

4 years agoMFC r355010: Make CAM use root_mount_hold_token() to delay boot.
Alexander Motin [Tue, 3 Dec 2019 16:48:21 +0000 (16:48 +0000)]
MFC r355010: Make CAM use root_mount_hold_token() to delay boot.

Before this change CAM used config_intrhook_establish() for this purpose,
but that approach does not allow to delay it again after releasing once.

USB stack uses root_mount_hold() to delay boot until bus scan is complete.
But once it is, CAM had no time to scan SCSI bus, registered by umass(4),
if it already done other scans and called config_intrhook_disestablish().
The new approach makes it work smooth, assuming the USB device is found
during the initial bus scan.  Devices appearing on USB bus later may still
require setting kern.cam.boot_delay, but hopefully those are minority.

4 years agoMFC r354914: Set handling for some "Logical unit not ready" errors.
Alexander Motin [Tue, 3 Dec 2019 16:46:44 +0000 (16:46 +0000)]
MFC r354914: Set handling for some "Logical unit not ready" errors.

4 years agoMFC r341756 (by scottl):
Alexander Motin [Tue, 3 Dec 2019 16:42:32 +0000 (16:42 +0000)]
MFC r341756 (by scottl):
Don't allocate the config_intrhook separately from the softc, it's small
enough that it costs more code to handle the malloc/free than it saves.

4 years agoMFC r354602
Olivier Houchard [Tue, 3 Dec 2019 16:32:30 +0000 (16:32 +0000)]
MFC r354602

  linprocfs: Make sure to report -1 as tty when we have no controlling tty.

  When reporting a process' stats, we can't just provide the tty as an
  unsigned long, as if we have no controlling tty, the tty would be NODEV, or
  -1. Instaed, just special-case NODEV.

4 years agoMFC r355113: Add some IDs of Intel Wildcat Point-LP.
Alexander Motin [Tue, 3 Dec 2019 14:47:50 +0000 (14:47 +0000)]
MFC r355113: Add some IDs of Intel Wildcat Point-LP.

4 years agoMFC r354269:
Cy Schubert [Tue, 3 Dec 2019 13:47:46 +0000 (13:47 +0000)]
MFC r354269:

MFV r354257:

Update sqlite3-3.29.0 (3290000) --> sqlite3-3.30.1 (3300100)

4 years agoMFC r354349: if_ixv: disable RSS configuration on 82599 and X540 VFs
Andriy Gapon [Tue, 3 Dec 2019 07:22:16 +0000 (07:22 +0000)]
MFC r354349: if_ixv: disable RSS configuration on 82599 and X540 VFs

It is reported that those VFs share their RSS configuration with PF and,
thus, they cannot be configured independently.

Also:
- add missing opt_rss.h to if_ixv.c, otherwise RSS kernel option could
  not be seen
- do not enable IXGBE_FEATURE_RSS on the older VFs
- set flowid / hash type to M_HASHTYPE_NONE or M_HASHTYPE_OPAQUE_HASH
  (based on what the hardware reports) if IXGBE_FEATURE_RSS is not set

4 years agoMFC r354849: hyperv/storvsc: stash a pointer to hv_storvsc_request in ccb
Andriy Gapon [Tue, 3 Dec 2019 07:20:47 +0000 (07:20 +0000)]
MFC r354849: hyperv/storvsc: stash a pointer to hv_storvsc_request in ccb

4 years agoMFC r354638: teach db_nextframe/x86 about [X]xen_intr_upcall interrupt handler
Andriy Gapon [Tue, 3 Dec 2019 07:19:28 +0000 (07:19 +0000)]
MFC r354638: teach db_nextframe/x86 about [X]xen_intr_upcall interrupt handler

4 years agoMFC r355156:
Cy Schubert [Mon, 2 Dec 2019 21:00:29 +0000 (21:00 +0000)]
MFC r355156:

Include fin, the packet information structure (fr_info_t), in the
l4sums DTrace probe, making more information available for the diagnosis
of IPv6 checksum errors.

4 years agoMFC r355142:
Cy Schubert [Mon, 2 Dec 2019 20:58:55 +0000 (20:58 +0000)]
MFC r355142:

Move ipf_pcksum6() to its rightful place, in ip_fil_freebsd.c. This
FreeBSD-only function should live in the O/S specific source file.

This essentially reverts r349929 Now that ipftest and ipfreplay are
disabled in FreeBSD 11-stable.

4 years agoMFC r355141:
Cy Schubert [Mon, 2 Dec 2019 20:57:13 +0000 (20:57 +0000)]
MFC r355141:

Save a little stack by removing a used once intermediate variable.

4 years agoMFC r355140:
Cy Schubert [Mon, 2 Dec 2019 20:55:08 +0000 (20:55 +0000)]
MFC r355140:

Remove redundant #ifdef'd function definitions.

4 years agoMFC r354821:
Mark Johnston [Mon, 2 Dec 2019 17:53:32 +0000 (17:53 +0000)]
MFC r354821:
Group per-domain reservation data in the same structure.

4 years agoMFC r348749 - Speed-up vm_reserv_reclaim_config.
Doug Moore [Mon, 2 Dec 2019 17:28:20 +0000 (17:28 +0000)]
MFC r348749 - Speed-up vm_reserv_reclaim_config.

Requested by: markj

4 years agoMFC r354815:
Mark Johnston [Mon, 2 Dec 2019 15:57:25 +0000 (15:57 +0000)]
MFC r354815:
Let arm64 pmap_qenter() and pmap_kenter() unconditionally set NX.

4 years agoMFC r354816:
Mark Johnston [Mon, 2 Dec 2019 15:56:01 +0000 (15:56 +0000)]
MFC r354816:
Implement vm.pmap.kernel_maps for arm64.

4 years agolibzpool: lz4.c build needs CFLAGS.lz4.c
Toomas Soome [Mon, 2 Dec 2019 15:28:06 +0000 (15:28 +0000)]
libzpool: lz4.c build needs CFLAGS.lz4.c

For some reason the setup from CURRENT did not work, probably I did mix
something up.

4 years agoMFC r354267:
Toomas Soome [Mon, 2 Dec 2019 12:26:47 +0000 (12:26 +0000)]
MFC r354267:
r354264 did mix up the directory path

The correct path is sys/cddl/contrib/opensolaris/common/lz4, not
sys/cddl/contrib/opensolaris/lz4

Reported by: Michael Butler

4 years agoMFC r354253, r354254, r354264, r354265
Toomas Soome [Mon, 2 Dec 2019 11:44:39 +0000 (11:44 +0000)]
MFC r354253, r354254, r354264, r354265
Remove duplicate lz4 implementations

Port illumos change: https://www.illumos.org/issues/11667

Move lz4.c out of zfs tree to opensolaris/common/lz4, adjust it to be
usable from kernel/stand/userland builds, so we can use just one single
source. Add lz4.h to declare lz4_compress() and lz4_decompress().

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

4 years agor353501 did mimerge r350654 boot1 and gptboot were left out
Toomas Soome [Mon, 2 Dec 2019 09:57:07 +0000 (09:57 +0000)]
r353501 did mimerge r350654 boot1 and gptboot were left out

Replace left over BS->HandleProtocol by OpenProtocolByHandle.

Reported by: Harry Schmalzbauer

4 years agoMFC r354436: MFV r354377: 10554 Implemented zpool sync command
Andriy Gapon [Mon, 2 Dec 2019 07:39:55 +0000 (07:39 +0000)]
MFC r354436: MFV r354377: 10554 Implemented zpool sync command

This addition will enable us to sync an open TXG to the main pool on
demand.  The functionality is similar to sync(2) but 'zpool sync' will
return when data has hit the main storage instead of potentially just
the ZIL as is the case with the sync(2) cmd.

4 years agoMFC r354627: db_nextframe/i386: reduce the number of special frame types
Andriy Gapon [Mon, 2 Dec 2019 07:22:01 +0000 (07:22 +0000)]
MFC r354627: db_nextframe/i386: reduce the number of special frame types

4 years agoMFC r354886: zpool.8: remove a paragraph about quorum disks
Andriy Gapon [Mon, 2 Dec 2019 07:20:32 +0000 (07:20 +0000)]
MFC r354886: zpool.8: remove a paragraph about quorum disks

4 years agoMFC r355210:
Konstantin Belousov [Mon, 2 Dec 2019 00:39:58 +0000 (00:39 +0000)]
MFC r355210:
In nfs_lock(), recheck vp->v_data after lock before accessing it.

PR: 242184

4 years agoMFC r355060:
Konstantin Belousov [Sun, 1 Dec 2019 16:02:15 +0000 (16:02 +0000)]
MFC r355060:
amd64: assert that EARLY_COUNTER does not corrupt memory.

4 years agoMFC r355061:
Konstantin Belousov [Sun, 1 Dec 2019 15:29:48 +0000 (15:29 +0000)]
MFC r355061:
tmpfs: resolve deadlock between rename and unmount.

4 years agoMFC r354742:
Navdeep Parhar [Sat, 30 Nov 2019 18:05:38 +0000 (18:05 +0000)]
MFC r354742:

cxgbev(4): Catch up with the pciids in the PF driver.

Sponsored by: Chelsio Communications

4 years agoMFC r354522:
Navdeep Parhar [Sat, 30 Nov 2019 18:03:53 +0000 (18:03 +0000)]
MFC r354522:

cxgbe(4): Query Vdd from the firmware if its last known value is 0.

TVSENSE may not be ready by the time t4_fw_initialize returns and the
firmware returns 0 if the driver asks for the Vdd before the sensor is
ready.

Sponsored by: Chelsio Communications

4 years agoMFC r354110:
Navdeep Parhar [Sat, 30 Nov 2019 17:57:37 +0000 (17:57 +0000)]
MFC r354110:

Fix typo in cxgbe.4.

4 years agoMFC r354106:
Navdeep Parhar [Sat, 30 Nov 2019 17:56:04 +0000 (17:56 +0000)]
MFC r354106:

cxgbe(4): Use correct FetchBurstMin values for T6.

Sponsored by: Chelsio Communications

4 years agoMFC r353578:
Navdeep Parhar [Sat, 30 Nov 2019 17:51:08 +0000 (17:51 +0000)]
MFC r353578:

cxgbe(4): An EQ update can be requested in a TX_PKTS2 work request.

Sponsored by: Chelsio Communications

4 years agoMFC r342876: Enable use of Capsicum sandbox when there is only one
Xin LI [Sat, 30 Nov 2019 06:02:13 +0000 (06:02 +0000)]
MFC r342876: Enable use of Capsicum sandbox when there is only one
input file (or the input is stdin) and we are not creating output
file.

Reported by: Lasse Collin

4 years agoMFC r345839, r345894, r345897, r345900-r345901, r345976, r346220, r348602, r348767...
Xin LI [Sat, 30 Nov 2019 05:43:24 +0000 (05:43 +0000)]
MFC r345839, r345894, r345897, r345900-r345901, r345976, r346220, r348602, r348767, r348967, r349047-r349048, r351502, r351623, r352364

r345839: Assert that q can't be NULL.  'empty' is always non-NULL when DIREMPTY
r345894: Restore the ability of checking and fixing next free
r345897: Restore lfcl when LOSTDIR's chain was corrupted and overwritten
r345900: Implement checking of `.' and `..' entries of subdirectory.
r345901: Fix build.
r345976: Write string constant differently to improve readability.
r346220: Don't cast result from malloc().
r348602: Don't increment cl after increment.
r348767: preen should work independently with alwaysyes and alwaysno.
r348967: Avoid out of boundary access when checking invalid long filenames.
r349047: Blankspace.  No actual code change.
r349048: In ask(): override default option if any of alwaysyes/alwaysno/rdonly is
r351502: Comment boot block checks and perform additional sanity checks:
r351623: Remove unneeded blank line.  No functional change.
r352364: Avoid mixing cluster numbers and sector numbers. Makes code more readable.

4 years agoMFC r355128: Update leap-seconds to leap-seconds.3676924800.
Xin LI [Sat, 30 Nov 2019 04:55:17 +0000 (04:55 +0000)]
MFC r355128: Update leap-seconds to leap-seconds.3676924800.

Obtained from: ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800

4 years agoMFC r355000:
Mark Johnston [Fri, 29 Nov 2019 02:16:45 +0000 (02:16 +0000)]
MFC r355000:
Fix typos in the cpuset_{get,set}domain() man page.

4 years agoMFC r354752: Cleanup address range checks in ioat(4).
Alexander Motin [Fri, 29 Nov 2019 01:00:06 +0000 (01:00 +0000)]
MFC r354752: Cleanup address range checks in ioat(4).

 - Deduce allowed address range for bus_dma(9) from the hardware version.
Different versions (CPU generations) have different documented limits.
 - Remove difference between address ranges for src/dst and crc.  At least
docs for few recent generations of CPUs do not mention anything like that,
while older are already limited with above limits.
 - Remove address assertions from arguments.  While I do not think the
addresses out of allowed ranges should realistically happen there due to
the platforms physical address limitations, there is now bus_dma(9) to
make sure of that, preferably via IOMMU.
 - Since crc now has the same address range as src/dst, remove crc_dmamap,
reusing dst2_dmamap instead.

4 years agoMFC r345813 (by tychon):
Alexander Motin [Fri, 29 Nov 2019 00:58:18 +0000 (00:58 +0000)]
MFC r345813 (by tychon):
ioat(4) should use bus_dma(9) for the operation source and destination
addresses

4 years agoMFC r345812 (by tychon):
Alexander Motin [Fri, 29 Nov 2019 00:38:16 +0000 (00:38 +0000)]
MFC r345812 (by tychon):
ioatcontrol(8) could exercise 8k-aligned copy with page-break, crc and
crc-copy modes.

4 years agoMFC r354753: Initialize *comp_update with valid value.
Alexander Motin [Fri, 29 Nov 2019 00:25:39 +0000 (00:25 +0000)]
MFC r354753: Initialize *comp_update with valid value.

I've noticed that sometimes with enabled DMAR initial write from device
to this address is somehow getting delayed, triggering assertion due to
zero default being invalid.

4 years agoMFC r354908:
Dimitry Andric [Thu, 28 Nov 2019 20:09:19 +0000 (20:09 +0000)]
MFC r354908:

Add explanatory comments for the different SRCS_xxx variables used in
the Makefiles for libllvm and libclang.  While here, cleanup a commented
out SRCS entry in libllvmminimal's Makefile.

4 years agoMFC r354549-r354550
Emmanuel Vadot [Thu, 28 Nov 2019 18:50:33 +0000 (18:50 +0000)]
MFC r354549-r354550

r354549:
libpmc: Match on the cpuid with a regex

The CPUID is, or can be, a regex to be matched.
Use regex from libc instead of strcmp

Tested-by: gallatin

r354550:
libpmc: Forgot regex.h

Reported by: ci
X-MFC-With: r354549

4 years agoMFC r353917-r353919, r354396-r354397
Emmanuel Vadot [Thu, 28 Nov 2019 18:44:06 +0000 (18:44 +0000)]
MFC r353917-r353919, r354396-r354397

r353917:
regulator: Add a regnode_method_init

This is a default init method for regulator that don't really
need one.

r353918:
axp81x: Use the default regnode_init method

r353919:
regulator: Add a regnode_set_constraint function

This method check that boot_on or always_on is set to 1 and if it
is it will try to enable the regulator.
The binding docs aren't clear on what to do but Linux enable the regulator
if any of those properties is set so we want to do the same.
The function first check the status to see if the regulator is
already enabled it then get the voltage to check if it is in a acceptable
range and then enables it.
This will be either called from the regnode_init method (if it's needed by the platform)
or by a SYSINIT at SI_SUB_LAST

Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D22106

r354396:
regulator: Add regulator_check_voltage function

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

Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D22260

r354397:
arm: allwinner: aw_mmc: Check if the regulator support the voltage

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

Reported by: ganbold
X-MFC-With: r354396

4 years agoMFC r353354:
Emmanuel Vadot [Thu, 28 Nov 2019 18:18:10 +0000 (18:18 +0000)]
MFC r353354:

dwmmc: Reset the dma controller at attach

If the bootloader enabled DMA we need to fully reset the DMA controller
otherwise we might have some stale data in it that provoke weird
behavior.

4 years agoMFC r352858, r352860, r353172
Emmanuel Vadot [Thu, 28 Nov 2019 18:15:05 +0000 (18:15 +0000)]
MFC r352858, r352860, r353172

r352858:
Import DTS files from Linux 5.2

r352860:
Import DTS files from Linux 5.3

r353172:
arm: dts: ti: Fix mmc3 instance by setting it to disabled

DTS Import of Linux 5.3 added a patch that rework the L3 mmc instance
in the AM335x SoC but removed the status = 'disabled' on the node.
This cause the kernel to probe the device even if the board doesn't
have this mmc used and since we don't correctly activate the clock
for this module we panic with an external data abort.
Beaglebone(s) don't have this device anyway so simply disabling it.
Patch for the DTS was sent upstream.
https://patchwork.kernel.org/patch/11176921/

PR: 241089
Reported by: phk

4 years agoMFC r353524-r353527, r353534
Emmanuel Vadot [Thu, 28 Nov 2019 18:02:13 +0000 (18:02 +0000)]
MFC r353524-r353527, r353534

r353524:
aw_ccung: Add more debug printfs

No functional changes

r353525:
arm64: allwinner: Add new clock aw_clk_np

This is a clock type present in Allwinner H6 where the formula is :
f = fparent * N / P

r353526:
arm64: allwinner: Add aw_clk_nmm clock

This is a clock type present on Allwinner H6 where the formula is :
f = fparent * n / m0 / m1

r353527:
arm: allwinner: Disable the clock before changing it's freq

You aren't supposed to changing the freq of a clock when it is
enable so disable the clock before changing the freq and then
re-enable it.

r353534:
arm: allwinner: Add np and nmm clock file to the build

4 years agoMFC r352940-r352941, r352943-r352944, r353062-r353063, r353125
Emmanuel Vadot [Thu, 28 Nov 2019 17:52:25 +0000 (17:52 +0000)]
MFC r352940-r352941, r352943-r352944, r353062-r353063, r353125

r352940:
generic_ohci: Look for the phy based on the id

phy-names was never in the bindings schema even if it was present
in some DTS. Get the optional phy based on its ID.

r352941:
arm: allwinner: a10_ehci:  Look for the phy based on the id

phy-names was never in the bindings schema even if it was present
in some DTS. Get the optional phy based on its ID.

PR: 240978

r352943:
arm: allwinner: a10_ehci: Enable all phys

Even if there should be only one phy enable all the ones declared in
the dts just to be sure.

r352944:
generic_ehci: Enable all phys and resets

The number of phys and resets is not defined and it controller dependent
so enable/disable every one of them.

r353062:
Split out the attachment from the generic-ehci driver

Create an attachment file for the existing ACPI attachment, and create a
new FDT attachment for the generic-ehci driver.

Submitted by: andrew (Original version)
Differential Revision: https://reviews.freebsd.org/D19389

r353063:
allwinner: Remove a10_ehci driver

We have generic-ehci since r353062 so use it.

X-MFC-With: r353062

r353125:
arm64: rockchip: usb2phy: Add set/get mode

We only support host mode so those functions are just added so
we won't panic when generic-{e,o}hci will set the phy to host mode.

X-MFC-With: r353062

4 years agoMFC r352853, r352903-r352904, r352936-r352937
Emmanuel Vadot [Thu, 28 Nov 2019 17:45:57 +0000 (17:45 +0000)]
MFC r352853, r352903-r352904, r352936-r352937

r352853:
arm64: rockchip: Add usb2phy driver

This driver is for the usb phy present on rockchip SoC.
It only support RK3399 and host mode for now.
The driver expose the usb clock needed by the usb controller.

r352903:
arm64: rockchip: correct reset value

If bit is 0 the reset is not asserted.
Also register our self as a reset provider, this was commented
in r352850

Reported by: mmel

r352904:
arm64: rockchip: rk_clk_pll: Check mode on recalc

If the pll is in slow or deep slow mode return the correct frequency.

r352936:
arm64: rockchip: rk805: Switch to iicdev_{readfrom,writeto}

This simpify the code a bit.

r352937:
syr827: Switch to iicdev_{readfrom,writeto}

Also use IIC_INTRWAIT as we need this to work with the rockchip i2c driver.

4 years agoMFC r347097, r351187, r351551-r351552, r352849-r352852
Emmanuel Vadot [Thu, 28 Nov 2019 17:42:11 +0000 (17:42 +0000)]
MFC r347097, r351187, r351551-r351552, r352849-r352852

r347097 by ganbold:
Add emmc clock definitions for Rockchip RK3399 SoC.

r351187 by mmel:
Improve rk_pinctrl driver:
- add support for 'output-low', 'output-high', 'output-low' and
  'output-enable' properties. These are use in RK3288 DT files
- add support for RK3288
- to reduce overall file size, use local macros for initialization
  of pinctrl description structures.

r351551:
arm64: rk3328: pinctrl: Add gpio banks and fix iomux

Since r351187 the pinctrl driver need to know the gpio bank as it
directly attach the gpio driver to handle some setup that might
be present in the dts, add the gpio banks table for rk3328.
While here fix some IOMUX definition that prevented to boot
on RK3328 as pinctrl wasn't configured correctly.

Submitted by: mmel (original version)
MFC With: r351187

r351552:
arm64: rk3399: pinctrl: Add gpio banks and fix iomux

Since r351187 the pinctrl driver need to know the gpio bank as it
directly attach the gpio driver to handle some setup that might
be present in the dts, add the gpio banks table for rk3399.
While here fix some IOMUX definition that prevented to boot
on RK3399 as pinctrl wasn't configured correctly.

Submitted by: mmel (original version)
MFC With: r351187

r352849:
arm64: rockchip: rk3399: Add usb2 clocks

r352850:
arm64: rockchip: Implement resets

Module resets where not implemented when rockchip clocks were commited.
Implement them.
Since all resets registers are contiguous a driver only need to give
the start offset and the number of resets. This avoid to have to declare
every resets.

r352851:
arm64: rockchip: Fix map_gpio

The map_gpio function wasn't correct, the first element is the pin
and not the phandle.

r352852:
dwc: Add more delay for chip reset

On rockchip board it seems that the value in the DTS
are not enough for reseting the chip, I don't know if
the value are really incorrect or if DELAY is not precise
enough or if the rockchip gpio driver have some "lag" of some
kind or not.
For now just add more delay.

4 years agoMFC r350180, r351100
Emmanuel Vadot [Thu, 28 Nov 2019 17:34:49 +0000 (17:34 +0000)]
MFC r350180, r351100

r350180:
dtso: allwinner: Add an overlay for H3 i2c0

Most of the H3 boards don't enable i2c as it is unused.
Add an overlay so it's easier for user to use i2c device.

r351100:
twsi: Fix build when DEBUG is used on 32bits arch.

4 years agoMFC r350842, r350844-r350846, r351099, r352848, r352859
Emmanuel Vadot [Thu, 28 Nov 2019 17:30:16 +0000 (17:30 +0000)]
MFC r350842, r350844-r350846, r351099, r352848, r352859

r350842:
allwinner: Rework the BUS_PASS on drivers

- Put all clock and control unit driver in BUS_PASS_RESOURCE except
  for the DE2 CCU as it needs the main CCU to be available.
- Use BUS_PASS_CPU for a20_cpu_cfg as it makes more sense.
- For aw_syscon use SCHEDULER pass as we need it early for drivers
  that attach in BUS_PASS_SUPPORTDEV
- For the rest we can use BUS_PASS_SUPPORTDEV

r350844:
allwinner: Add a new clock aw_clk_m

We used the aw_clk_nm clock for clock with only one divider factor
and used a fake multiplier factor. This cannot work properly as we
end up writing the "fake" factor to the register (and so always set
the LSB to 1).
Create a new clock for those.
The reason for not using the clk_div clock is because those clocks are
a bit special. Since they are (almost) all related to video we also need
to set the parent clock (the main PLL) to a frequency that they can support.
As the main PLL have some minimal frequency that they can support we need to
be able to set the main PLL to a multiple of the desired frequency.
Let say you want to have a 71Mhz pixel clock (typical for a 1280x800 display)
and the main PLL cannot go under 192Mhz, you need to set it to 3 times the
desired frequency and set the divider to 3 on the hdmi clock.
So this also introduce the CLK_SET_ROUND_MULTIPLE flag that allow for this kind
of scenario.

r350845:
Remove some duplicate code that end up in r350844

r350846:
allwinner: Add support to min/max in aw_clk_frac

The Fractionals clock in Allwinner device have some min/max frequencies
that they can do.
Add support for it.

r351099:
arm: allwinner: Set aw_ccu to BUS_PASS_BUS

In r350842 I've switched the bus pass to resource so it matches the other
clock drivers but this cannot work as this drivers is meant to match
the dts node '/clocks' and if we don't do it at this pass simplebus is
catching this node and we cannot attach.
This solve booting on Allwinner boards that are still using /clocks (A20 SoC)

r352848:
arm64: allwinner: a64: Add PLL_MIPI

PLL_MIPI is the last important PLL that we missed.
Add support for it.
Since it's one of the possible parent for TCON0 also add this clock
now that we can.
While here add some info about what video related clocks should be
enabled at boot and with what frequency.

r352859:
arm: allwinner: Add pll_mipi to the files

4 years agoMFC r354341: arm64 linuxulator: default to RW stack (no X)
Ed Maste [Thu, 28 Nov 2019 02:19:41 +0000 (02:19 +0000)]
MFC r354341: arm64 linuxulator: default to RW stack (no X)

This matches Linux's default arm64 data / stack permissions.

Sponsored by: The FreeBSD Foundation

4 years agoMFC r354897: sshd: make getpwclass wrapper MON_ISAUTH not MON_AUTH
Ed Maste [Thu, 28 Nov 2019 02:18:19 +0000 (02:18 +0000)]
MFC r354897: sshd: make getpwclass wrapper MON_ISAUTH not MON_AUTH

In r339216 a privsep wrapper was added for login_getpwclass to address
PR 231172.  Unfortunately the change used the MON_AUTH flag in the
wrapper, and MON_AUTH includes MON_AUTHDECIDE which triggers an
auth_log() on each invocation.  getpwclass() does not participate in the
authentication decision, so should be MON_ISAUTH instead.

PR: 234793
Submitted by: Henry Hu
Reviewed by: Yuichiro NAITO
MFC after: 1 week

4 years agoMFC r355101, r355104: cfi: check for inter overflow in cfi_devioctl
Ed Maste [Thu, 28 Nov 2019 02:12:33 +0000 (02:12 +0000)]
MFC r355101, r355104: cfi: check for inter overflow in cfi_devioctl

Reported by: Pietro Oliva
Security: Possible OOB read in root-only ioctl
Sponsored by: The FreeBSD Foundation

4 years agoMFC r354703: Pass more reasonable WAIT flags to bus_dma(9) calls.
Alexander Motin [Thu, 28 Nov 2019 00:42:45 +0000 (00:42 +0000)]
MFC r354703: Pass more reasonable WAIT flags to bus_dma(9) calls.

4 years agoMFC r354702:
Alexander Motin [Thu, 28 Nov 2019 00:40:42 +0000 (00:40 +0000)]
MFC r354702:
Make ntb(4) send bus_get_dma_tag() requests to parent buses passing real
bus' child pointers instead of grandchilds.

DMAR does not like requests from devices not parented directly by PCI.

4 years agoMFC r350579,r350741,r352584
Alan Cox [Wed, 27 Nov 2019 19:34:33 +0000 (19:34 +0000)]
MFC r350579,r350741,r352584
  Enable superpage promotion within the kernel pmap.

  Ordinarily, during a superpage promotion or demotion within a pmap, the
  pmap's lock ensures that other operations on the pmap don't observe the
  old mapping being broken before the new mapping is established.  However,
  pmap_kextract() doesn't acquire the kernel pmap's lock, so it may observe
  the broken mapping.  And, if it does, it returns an incorrect result.

  This revision implements a lock-free solution to this problem in
  pmap_update_entry() and pmap_kextract() because pmap_kextract() can't
  acquire the kernel pmap's lock.

  In case a translation fault on the kernel address space occurs from
  within a critical section, we must perform a lock-free check on the
  faulting address.

4 years agoMFC r354867:
Vincenzo Maffione [Wed, 27 Nov 2019 18:52:01 +0000 (18:52 +0000)]
MFC r354867:

netmap: check if we already ran mmap before we attempt it

Submitted by:   neel@neelc.org
Reviewed by:    vmaffione
Differential Revision:  https://reviews.freebsd.org/D22390

4 years agoMFC rr354733:
Cy Schubert [Wed, 27 Nov 2019 03:18:35 +0000 (03:18 +0000)]
MFC rr354733:
Disable ntpd stack gap. When ASLR with STACK GAP != 0 ntpd suffers SIGSEGV.

PR: 241421, 241960
Reported by: Vladimir Zakharov <zakharov.vv@gmail.com>,
dewayne@heuristicsystems.com.au
Reviewed by: kib, imp (previous version), ian (suggestion)
Differential Revision: https://reviews.freebsd.org/D22358

4 years agoPartially revert r355028. hpt27xx is not Giant-locked in FreeBSD 12.x,
Scott Long [Tue, 26 Nov 2019 19:04:19 +0000 (19:04 +0000)]
Partially revert r355028.  hpt27xx is not Giant-locked in FreeBSD 12.x,
so is it not going to be deprecated.

Reported by: imp

4 years agoMFC r354659
Vincenzo Maffione [Tue, 26 Nov 2019 18:12:13 +0000 (18:12 +0000)]
MFC r354659

bhyve: rework mevent processing to fix a race condition

At the end of both mevent_add() and mevent_update(), mevent_notify()
is called to wakeup the I/O thread, that will call kevent(changelist)
to update the kernel.
A race condition is possible where the client calls mevent_add() and
mevent_update(EV_ENABLE) before the I/O thread has the chance to wake
up and call mevent_build()+kevent(changelist) in response to mevent_add().
The mevent_add() is therefore ignored by the I/O thread, and
kevent(fd, EV_ENABLE) is called before kevent(fd, EV_ADD), resuliting
in a failure of the kevent(fd, EV_ENABLE) call.

PR:     241808
Reviewed by:    jhb, markj
Differential Revision:  https://reviews.freebsd.org/D22286

4 years agoMFC r354552, r354864
Vincenzo Maffione [Tue, 26 Nov 2019 18:10:45 +0000 (18:10 +0000)]
MFC r354552, r354864

bhyve: add support for virtio-net mergeable rx buffers

Mergeable rx buffers is a virtio-net feature that allows the hypervisor
to use multiple RX descriptor chains to receive a single receive packet.
Without this feature, a TSO-enabled guest is compelled to publish only
64K (or 32K) long chains, and each of these large buffers is consumed
to receive a single packet, even a very short one. This is a waste of
memory, as a RX queue has room for 256 chains, which means up to 16MB
of buffer memory for each (single-queue) vtnet device.
With the feature on, the guest can publish 2K long chains, and the
hypervisor will merge them as needed.

This change also enables the feature in the netmap backend, which
supports virtio-net offloads. We plan to add support for the
tap backend too.
Note that differently from QEMU/KVM, here we implement one-copy receive,
while QEMU uses two copies.

Reviewed by:    jhb
Differential Revision:  https://reviews.freebsd.org/D21007

4 years agoMFC r354841: Add ioat_get_domain() to ioat(4) KPI.
Alexander Motin [Tue, 26 Nov 2019 15:23:24 +0000 (15:23 +0000)]
MFC r354841: Add ioat_get_domain() to ioat(4) KPI.

This allows NUMA-aware consumers to reduce inter-domain traffic.

4 years agoMFC r354840: Call bus_dma_dmar_set_buswide(9) added in r354830.
Alexander Motin [Tue, 26 Nov 2019 15:21:01 +0000 (15:21 +0000)]
MFC r354840: Call bus_dma_dmar_set_buswide(9) added in r354830.

PLX NTB sends translated DMA requests not only from itsels, but from all
slots and functions of its bus.  By default DMAR blocks those additional.

4 years agoMFC r354858:
Andrey V. Elsukov [Tue, 26 Nov 2019 02:50:25 +0000 (02:50 +0000)]
MFC r354858:
  Fix the byte order of IPv4 address parsed from begemotSnmpdTransInetStatus
  config option.

  An address is already in network byte order, there is no need to do
  htonl().

  PR: 242056

4 years agoMFC r355015: MMCCAM: defer release of ccb until we're done with it
Kyle Evans [Mon, 25 Nov 2019 19:38:05 +0000 (19:38 +0000)]
MFC r355015: MMCCAM: defer release of ccb until we're done with it

If we've found a device, we attempt to call xpt_action() on a ccb that's
already been released. Simply defer release until after we're done with it.

4 years agoMFC r355088:
Konstantin Belousov [Mon, 25 Nov 2019 14:18:55 +0000 (14:18 +0000)]
MFC r355088:
Limit bus_dma_dmar_set_buswide() definition to kernel only.

4 years agoMFC r354828:
Konstantin Belousov [Mon, 25 Nov 2019 09:53:49 +0000 (09:53 +0000)]
MFC r354828:
Add x86 msr tweak KPI.

4 years agoMFC r354830:
Konstantin Belousov [Mon, 25 Nov 2019 09:43:36 +0000 (09:43 +0000)]
MFC r354830:
bus_dma_dmar_set_buswide(9): KPI to indicate that the whole dmar
context should share page tables.

4 years agoMFC r354619: db_nextframe/amd64: remove TRAP_INTERRUPT frame type
Andriy Gapon [Mon, 25 Nov 2019 06:16:53 +0000 (06:16 +0000)]
MFC r354619: db_nextframe/amd64: remove TRAP_INTERRUPT frame type

4 years agoMFC r354669, r354672, r354689: move __stack_chk_guard constructor
Kyle Evans [Mon, 25 Nov 2019 03:49:38 +0000 (03:49 +0000)]
MFC r354669, r354672, r354689: move __stack_chk_guard constructor

r354669:
ssp: add a priority to the __stack_chk_guard constructor

First, this commit is a NOP on GCC <= 4.x; this decidedly doesn't work
cleanly on GCC 4.2, and it will be gone soon anyways so I chose not to dump
time into figuring out if there's a way to make it work. xtoolchain-gcc,
clocking in as GCC6, can cope with it just fine and later versions are also
generally ok with the syntax. I suspect very few users are running GCC4.2
built worlds and also experiencing potential fallout from the status quo.

For dynamically linked applications, this change also means very little.
rtld will run libc ctors before most others, so the situation is
approximately a NOP for these as well.

The real cause for this change is statically linked applications doing
almost questionable things in their constructors. qemu-user-static, for
instance, creates a thread in a global constructor for their async rcu
callbacks. In general, this works in other places-

- On OpenBSD, __stack_chk_guard is stored in an .openbsd.randomdata section
  that's initialized by the kernel in the static case, or ld.so in the
  dynamic case
- On Linux, __stack_chk_guard is apparently stored in TLS and such a problem
  is circumvented there because the value is presumed stable in the new
  thread.

On FreeBSD, the rcu thread creation ctor and __guard_setup are both unmarked
priority. qemu-user-static spins up the rcu thread prior to __guard_setup
which starts making function calls- some of these are sprinkled with the
canary. In the middle of one of these functions, __guard_setup is invoked in
the main thread and __stack_chk_guard changes- qemu-user-static is promptly
terminated for an SSP violation that didn't actually happen.

This is not an all-too-common problem. We circumvent it here by giving the
__stack_chk_guard constructor a solid priority. 200 was chosen because that
gives static applications ample range (down to 101) for working around it
if they really need to. I suspect most applications will "just work" as
expected- the default/non-prioritized flavor of __constructor__ functions
run last, and the canary is generally not expected to change as of this
point at the very least.

This took approximately three weeks of spare time debugging to pin down.

r354672:
ssp: rework the logic to use priority=200 on clang builds

The preproc logic was added at the last minute to appease GCC 4.2, and
kevans@ did clearly not go back and double-check that the logic worked out
for clang builds to use the new variant.

It turns out that clang defines __GNUC__ == 4. Flip it around and check
__clang__ as well, leaving a note to remove it later.

r354689:
ssp: further refine the conditional used for constructor priority

__has_attribute(__constructor__) is a better test for clang than
defined(__clang__). Switch to it instead.

While we're already here and touching it, pfg@ nailed down when GCC actually
introduced the priority argument -- 4.3. Use that instead of our
hammer-guess of GCC >= 5 for the sake of correctness.

PR: 241905

4 years agoMFC r354999: Fix off-by-one error in HPA/AMA maximum reporting.
Alexander Motin [Mon, 25 Nov 2019 03:38:49 +0000 (03:38 +0000)]
MFC r354999: Fix off-by-one error in HPA/AMA maximum reporting.

Before my refactoring the code reported value as maximum number of sectors,
adding one to the maximum sector number returned by respective command.
While this difference is somewhat confusing, restore previous behavior.

4 years agoMFC r354997: add deprecation notice to amd man page
Ed Maste [Mon, 25 Nov 2019 01:32:50 +0000 (01:32 +0000)]
MFC r354997: add deprecation notice to amd man page

Clarify the deprecation notice in amd.8.  amd will be removed from the
FreeBSD base system before FreeBSD 13.0.

Discussed with: cy

4 years agoMFC r354822:
Mark Johnston [Mon, 25 Nov 2019 00:34:59 +0000 (00:34 +0000)]
MFC r354822:
Fix inconsistencies in anonymous DOF files.

4 years agoMFC r354829:
Mark Johnston [Mon, 25 Nov 2019 00:33:56 +0000 (00:33 +0000)]
MFC r354829:
Add a "B" suffix to memory quantities in top(1) output.

4 years agoMFC r354790:
Konstantin Belousov [Sun, 24 Nov 2019 12:30:41 +0000 (12:30 +0000)]
MFC r354790:
Add elf image flag to disable stack gap.

4 years agoMFC r354789:
Konstantin Belousov [Sun, 24 Nov 2019 12:27:13 +0000 (12:27 +0000)]
MFC r354789:
kern_exec: p_osrel and p_fctl0 were obliterated by failed execve(2) attempt.

4 years agoMFC r354785
Doug Moore [Sun, 24 Nov 2019 06:46:49 +0000 (06:46 +0000)]
MFC r354785

The loop in vm_map_protect that verifies that all transition map
entries are stabilized, repeatedly verifies the same entry. Check each
entry in turn.

4 years agoMFC r354978:
Cy Schubert [Sun, 24 Nov 2019 02:27:50 +0000 (02:27 +0000)]
MFC r354978:

Chase r344883. ntp is 4.2.8p13.

4 years agoMFC r351605: Man page for AMD Non-Transparent Bridge (ntb_hw_amd) driver.
Alexander Motin [Sun, 24 Nov 2019 01:27:04 +0000 (01:27 +0000)]
MFC r351605: Man page for AMD Non-Transparent Bridge (ntb_hw_amd) driver.

4 years agoMFC r354581,r354597: Add compact scraptchpad protocol for ntb_transport(4).
Alexander Motin [Sun, 24 Nov 2019 00:55:42 +0000 (00:55 +0000)]
MFC r354581,r354597: Add compact scraptchpad protocol for ntb_transport(4).

Previously ntb_transport(4) required at least 6 scratchpad registers,
plus 2 more for each additional memory window.  That is too much for some
configurations, where several drivers have to share resources of the same
NTB hardware.  This patch introduces new compact version of the protocol,
requiring only 3 scratchpad registers, plus one more for each additional
memory window.  The optimization is based on fact that neither of version,
number of windows or number of queue pairs really need more then one byte
each, and window sizes of 4GB are not very useful now.  The new protocol
is activated automatically when the configuration is low on scratchpad
registers, or it can be activated explicitly with loader tunable.

4 years agoMFC r354580: Allow splitting PLX NTB BAR2 into several memory windows.
Alexander Motin [Sun, 24 Nov 2019 00:53:22 +0000 (00:53 +0000)]
MFC r354580: Allow splitting PLX NTB BAR2 into several memory windows.

Address Lookup Table (A-LUT) being enabled allows to specify separate
translation for each 1/128th or 1/256th of the BAR2.  Previously it was
used only to limit effective window size by blocking access through some
of A-LUT elements.  This change allows A-LUT elements to also point
different memory locations, providing to upper layers several (up to 128)
independent memory windows.  A-LUT hardware allows even more flexible
configurations than this, but NTB KPI have no way to manage that now.

4 years agoMFC r354633:
Mike Karels [Sat, 23 Nov 2019 13:20:24 +0000 (13:20 +0000)]
MFC r354633:

Fix netstat -gs with ip_mroute module and/or vnet

The code for "netstat -gs -f inet" failed if the kernel namelist did not
include the _mrtstat symbol. However, that symbol is not in a standard
kernel even with the ip_mroute module loaded, where the functionality is
available. It is also not in a kernel with MROUTING but also VIMAGE, as
there can be multiple sets of stats. However, when running the command
on a live system, the symbol is not used; a sysctl is used. Go ahead
and try the sysctl in any case, and complain that IPv4 MROUTING is not
present only if the sysctl fails with ENOENT. Also fail if _mrtstat is
not defined when running on a core file; netstat doesn't know about vnets,
so can only work if MROUTING was included, and VIMAGE was not.

Reviewed by:    bz

4 years agoMFC 355012 and 355021. Mark trm and hpt27xx for removal in 13.0
Scott Long [Sat, 23 Nov 2019 07:06:16 +0000 (07:06 +0000)]
MFC 355012 and 355021.  Mark trm and hpt27xx for removal in 13.0