]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMFV r368207:
mm [Tue, 1 Dec 2020 15:53:12 +0000 (15:53 +0000)]
MFV r368207:
Update libarchive to 3.5.0

Relevant vendor changes:
  Issue #1258: add archive_read_support_filter_by_code()
  PR #1347: mtree digest reader support
  Issue #1381: skip hardlinks pointing to itself on extraction
  PR #1387: fix writing of cpio archives with hardlinks without file type
  PR #1388: fix rdev field in cpio format for device nodes
  PR #1389: completed support for UTF-8 encoding conversion
  PR #1405: more formats in archive_read_support_format_by_code()
  PR #1408: fix uninitialized size in rar5_read_data
  PR #1409: system extended attribute support
  PR #1435: support for decompression of symbolic links in zipx archives
  Issue #1456: memory leak after unsuccessful archive_write_open_filename

MFC after: 1 week

3 years agoUpdate vendor/libarchive/dist to git 833821f55b1807cac22a63a58b759a7802df2fb7
mm [Tue, 1 Dec 2020 10:36:46 +0000 (10:36 +0000)]
Update vendor/libarchive/dist to git 833821f55b1807cac22a63a58b759a7802df2fb7

Libarchive 3.5.0

Relevant vendor changes:
  Issue #1258: add archive_read_support_filter_by_code()
  PR #1347: mtree digest reader support
  Issue #1381: skip hardlinks pointing to itself on extraction
  PR #1387: fix writing of cpio archives with hardlinks without file type
  PR #1388: fix rdev field in cpio format for device nodes
  PR #1389: completed support for UTF-8 encoding conversion
  PR #1405: more formats in archive_read_support_format_by_code()
  PR #1408: fix uninitialized size in rar5_read_data
  PR #1409: system extended attribute support
  PR #1435: support for decompression of symbolic links in zipx archives
  Issue #1456: memory leak after unsuccessful archive_write_open_filename

3 years agoRemove duplicated SV_ASLR from the elf flags.
mmel [Tue, 1 Dec 2020 09:18:18 +0000 (09:18 +0000)]
Remove duplicated SV_ASLR from the elf flags.

Reported by: lattera

3 years agoAlways use the __unused attribute even for potentially unused parameters.
mmel [Tue, 1 Dec 2020 08:52:13 +0000 (08:52 +0000)]
Always use the __unused attribute even for potentially unused parameters.

Requested by: ian, imp
MFC with: r368167

3 years agoefibootmgr: fix an incorrect error handling check
mhorne [Mon, 30 Nov 2020 22:16:11 +0000 (22:16 +0000)]
efibootmgr: fix an incorrect error handling check

efivar_device_path_to_unix_path() returns standard error codes on
failure and zero on success. Checking for a return value less than zero
means that the actual failure cases won't be handled. This could
manifest as a segfault during the subsequent call to printf().

Reviewed by: imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D27424

3 years agoMove inner loop logic out of sysctl_sysctl_next_ls().
melifaro [Mon, 30 Nov 2020 21:59:52 +0000 (21:59 +0000)]
Move inner loop logic out of sysctl_sysctl_next_ls().

Refactor sysctl_sysctl_next_ls():
* Move huge inner loop out of sysctl_sysctl_next_ls() into a separate
 non-recursive function, returning the next step to be taken.
* Update resulting node oid parts only on successful lookup
* Make sysctl_sysctl_next_ls() return boolean success/failure instead of errno,
 slightly simplifying logic

Reviewed by: freqlabs
Differential Revision: https://reviews.freebsd.org/D27029

3 years agoRenumber NHR_* flags after NHR_IFAIF removal in r368127.
melifaro [Mon, 30 Nov 2020 21:42:55 +0000 (21:42 +0000)]
Renumber NHR_* flags after NHR_IFAIF removal in r368127.

Suggested by: rpokala

3 years agoPrint at least something when failing.
glebius [Mon, 30 Nov 2020 21:05:31 +0000 (21:05 +0000)]
Print at least something when failing.

3 years agowireguard: fix zfs_ copy pasta in module init macro
mmacy [Mon, 30 Nov 2020 20:58:42 +0000 (20:58 +0000)]
wireguard: fix zfs_ copy pasta in module init macro

Reported by: Jessica Clarke

3 years agoRemove (dead) GPL copyright code from wireguard sources
mmacy [Mon, 30 Nov 2020 20:54:44 +0000 (20:54 +0000)]
Remove (dead) GPL copyright code from wireguard sources

3 years agoqat: Initialize the crypto device ID to -1 instead of 0
markj [Mon, 30 Nov 2020 20:53:45 +0000 (20:53 +0000)]
qat: Initialize the crypto device ID to -1 instead of 0

Otherwise qat_detach() may attempt to deregister an unrelated crypto
driver if an error occurs in qat_attach() before crypto_get_driverid()
is called, since 0 is a valid driver ID.

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)

3 years agoqat: Fix firmware module autoloading
markj [Mon, 30 Nov 2020 20:53:25 +0000 (20:53 +0000)]
qat: Fix firmware module autoloading

If firmware_get() fails to find a loaded firmware image, it searches for
candidate KLDs to load.  It will search for a KLD containing a module
with the same name as the requested image, and failing that, will load a
KLD with the same basename as the requested image.

The module name given by fw_stub.awk is simply "<mangled KLD name>_fw".

QAT firmware modules contain two images, neither of which match either
of the names used during lookup, so automatic loading of firmware images
after mountroot does not work.  Work around this by using the same
string for the first image name and for the KLD basename.

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)

3 years agoAdd a few missed entries to ObsoleteFiles.inc:
dim [Mon, 30 Nov 2020 19:18:50 +0000 (19:18 +0000)]
Add a few missed entries to ObsoleteFiles.inc:

* libzfs.so was bumped from 3 to 4 in r364746
* libcap_random.so.1 was removed in r350307, but its .so symlink was not

3 years agoffs: do not read full direct blocks if they are going to be overwritten.
kib [Mon, 30 Nov 2020 17:03:26 +0000 (17:03 +0000)]
ffs: do not read full direct blocks if they are going to be overwritten.

BA_CLRBUF specifies that existing context of the block will be
completely overwritten by caller, so there is no reason to spend io
fetching existing data.  We do the same for indirect blocks.

Reported by: tmunro
Reviewed by: mckusick, tmunro
Tested by: pho, tmunro
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27353

3 years agoEnsure that threading library is initialized in pthread_mutex_init().
kib [Mon, 30 Nov 2020 17:00:36 +0000 (17:00 +0000)]
Ensure that threading library is initialized in pthread_mutex_init().

We need at least thr_malloc ready.  The situation is possible e.g. in case
of libthr being listed in DT_NEEDED before some of its consumers.

Reported and tested by: lev
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agouma: Avoid allocating buckets with the cross-domain lock held
markj [Mon, 30 Nov 2020 16:18:33 +0000 (16:18 +0000)]
uma: Avoid allocating buckets with the cross-domain lock held

Allocation of a bucket can trigger a cross-domain free in the bucket
zone, e.g., if the per-CPU alloc bucket is empty, we free it and get
migrated to a remote domain.  This can lead to deadlocks since a bucket
zone may allocate buckets from itself or a pair of bucket zones could be
allocating from each other.

Fix the problem by dropping the cross-domain lock before allocating a
new bucket and handling refill races.  Use a list of empty buckets to
ensure that we can make forward progress.

Reported by: imp, mjg (witness(9) warnings)
Discussed with: jeff
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27341

3 years agoFix compilation on head and while here:
olivier [Mon, 30 Nov 2020 15:04:35 +0000 (15:04 +0000)]
Fix compilation on head and while here:
- remove unwanted whitespaces
- remove useless function ifphys()
- fix the Makefile to install it into /usr/bin

PR: 250133
Reviewed by: glebius, maxim
Approved by: glebius
Differential Revision: https://reviews.freebsd.org/D27155

3 years agoUnbreak r368167 in userland. Decorate unused arguments.
mmel [Mon, 30 Nov 2020 14:51:48 +0000 (14:51 +0000)]
Unbreak r368167 in userland. Decorate unused arguments.

Reported by: kp, tuexen, jenkins, and many others
MFC with: r368167

3 years agommccam: Convert some printf to CAM_DEBUG
manu [Mon, 30 Nov 2020 14:49:13 +0000 (14:49 +0000)]
mmccam: Convert some printf to CAM_DEBUG

This not not useful if you are not debuging mmccam

3 years agoarm: allwinner: aw_mmc: Add a sysctl for debuging
manu [Mon, 30 Nov 2020 14:48:50 +0000 (14:48 +0000)]
arm: allwinner: aw_mmc: Add a sysctl for debuging

Add a new hw.aw_mmc.debug sysctl to help debugging the driver.
Bit 0 will debug card changes (removal, insertion, power up/down)
Bit 1 will debug ios changes
Bit 2 will debug interrupts received
Bit 3 will debug commands sent

3 years agovt: if loader did pass the font via metadata, use it
tsoome [Mon, 30 Nov 2020 11:45:47 +0000 (11:45 +0000)]
vt: if loader did pass the font via metadata, use it

The built in 8x16 font may be way too small with large framebuffer
resolutions, to improve readability, use loader provied font.

3 years agoUse function macro for sema_init() in the LinuxKPI to limit macro expansion scope.
hselasky [Mon, 30 Nov 2020 09:47:53 +0000 (09:47 +0000)]
Use function macro for sema_init() in the LinuxKPI to limit macro expansion scope.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agofix vmbus_fb_mmio_res after r368168
tsoome [Mon, 30 Nov 2020 08:31:41 +0000 (08:31 +0000)]
fix vmbus_fb_mmio_res after r368168

mixed efifb versus vbefb struct use did slip in by mistake.

3 years agoAdd VT driver for VBE framebuffer device
tsoome [Mon, 30 Nov 2020 08:22:40 +0000 (08:22 +0000)]
Add VT driver for VBE framebuffer device

Implement vt_vbefb to support Vesa Bios Extensions (VBE) framebuffer with VT.
vt_vbefb is built based on vt_efifb and is assuming similar data for
initialization, use MODINFOMD_VBE_FB to identify the structure vbe_fb
in kernel metadata.

struct vbe_fb, is populated by boot loader, and is passed to kernel via
metadata payload.

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

3 years agoNVME: Don't try to swap data on little endian machines.
mmel [Mon, 30 Nov 2020 07:01:12 +0000 (07:01 +0000)]
NVME: Don't try to swap data on little endian machines.
These swapping functions violate BUSDMA contract - we cannot write
to armed (by bus_dmamap_sync(PRE_..)) buffers. Remove them at least
from little endian machines until a better solution will be developed.

Reviewed by: imp
MFC after: 3 weeks

3 years agoRemove RADIX_MPATH config option.
melifaro [Sun, 29 Nov 2020 19:43:33 +0000 (19:43 +0000)]
Remove RADIX_MPATH config option.

ROUTE_MPATH is the new config option controlling new multipath routing
 implementation. Remove the last pieces of RADIX_MPATH-related code and
 the config option.

Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D27244

3 years agoImport kernel WireGuard support
mmacy [Sun, 29 Nov 2020 19:38:03 +0000 (19:38 +0000)]
Import kernel WireGuard support

Data path largely shared with the OpenBSD implementation by
Matt Dunwoodie <ncon@nconroy.net>

Reviewed by: grehan@freebsd.org
MFC after: 1 month
Sponsored by: Rubicon LLC, (Netgate)
Differential Revision: https://reviews.freebsd.org/D26137

3 years agoReduce MAXPHYS back to 128KB on 32bit architectures.
kib [Sun, 29 Nov 2020 19:06:32 +0000 (19:06 +0000)]
Reduce MAXPHYS back to 128KB on 32bit architectures.

Some of them have limited KVA, like arm, which prevents startup from
allocating needed number of large pbufs.  Other, for instance i386,
are dis-balanced enough after 4/4 that blind bump is probably harmful
because it allows for much more in-flight io than other tunables are
ready for.

Requested by: mmel
Reviewed by: emaste, mmel
Sponsored by: The FreeBSD Foundation

3 years agoStore MPIDR register in pcpu.
mmel [Sun, 29 Nov 2020 18:59:01 +0000 (18:59 +0000)]
Store MPIDR register in pcpu.

MPIDR represents physical locality of given core and it should be used as
the only viable/robust connection between cpuid (which have zero relation to
cores topology) and external description (for example  in FDT).  It can be
used for determining which interrupt is associated to given per-CPU PMU
or by scheduler for determining big/little core or cluster topology.

MFC after: 3 weeks

3 years agoiconv(1): Add EXAMPLE
fernape [Sun, 29 Nov 2020 18:22:14 +0000 (18:22 +0000)]
iconv(1): Add EXAMPLE

Just a small example to show simple usage.

Approved by: manpages (0mp@)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D27385

3 years agoRemove unused options.
mmel [Sun, 29 Nov 2020 17:42:32 +0000 (17:42 +0000)]
Remove unused options.

Marvell files and their related SOC_MV_<foo> options should be cleaned up
in another pass.

3 years ago_ARM_ARCH_5E is always defined, we not support older CPUs.
mmel [Sun, 29 Nov 2020 16:44:22 +0000 (16:44 +0000)]
_ARM_ARCH_5E is always defined, we not support older CPUs.

3 years agosecurity(7): fix copy/paste error and correct aslr oids
yuripv [Sun, 29 Nov 2020 16:29:40 +0000 (16:29 +0000)]
security(7): fix copy/paste error and correct aslr oids

Submitted by: Mina Galić <me_igalic.co>
Differential Revision: https://reviews.freebsd.org/D27408

3 years agoOnly set the PCI bus end when we are reducing it
andrew [Sun, 29 Nov 2020 16:22:33 +0000 (16:22 +0000)]
Only set the PCI bus end when we are reducing it

We read the bus end value from the _CRS method. On some systems we need
to further limit it based on the MCFG table.

Support this by setting a default value, then update it if needed in the
_CRS table, and finally reduce it if it is past the end of the MCFG tabel.
This will allow for both systems that use either method to encode this
value.

This partially reverts r347929, removing the error printf.

Reviewed by: philip
Tested by: philip, Andrey Fesenko <f0andrey_gmail.com>
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D27274

3 years agoRemove orphaned configs.
mmel [Sun, 29 Nov 2020 15:39:54 +0000 (15:39 +0000)]
Remove orphaned configs.

3 years agoRemove remaining fragments of code for older already ceased ARM versions.
mmel [Sun, 29 Nov 2020 15:24:00 +0000 (15:24 +0000)]
Remove remaining fragments of code for older already ceased ARM versions.

3 years agoRemove remaining support of big endian byte order.
mmel [Sun, 29 Nov 2020 15:04:39 +0000 (15:04 +0000)]
Remove remaining support of big endian byte order.
Big endian support was ceased by removing ARMv4 sub architecture.

3 years agoIntroduce rib_walk_ext_internal() to allow iteration with rnh pointer.
melifaro [Sun, 29 Nov 2020 13:54:49 +0000 (13:54 +0000)]
Introduce rib_walk_ext_internal() to allow iteration with rnh pointer.

This solves the case when rib is not yet attached/detached to/from the
 system rib array.

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

3 years agoAdd nhop_ref_any() to unify referencing nhop or nexthop group.
melifaro [Sun, 29 Nov 2020 13:52:06 +0000 (13:52 +0000)]
Add nhop_ref_any() to unify referencing nhop or nexthop group.

It allows code within routing subsystem to transparently reference nexthops
 and nexthop groups, similar to nhop_free_any(), abstracting ROUTE_MPATH
 details.

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

3 years agohastd(8) assumes it has no extra file descriptors opened
eugen [Sun, 29 Nov 2020 13:45:53 +0000 (13:45 +0000)]
hastd(8) assumes it has no extra file descriptors opened
and aborts otherwise, so call closefrom() early.

PR: 227461
MFC after: 2 weeks

3 years agoRefactor fib4/fib6 functions.
melifaro [Sun, 29 Nov 2020 13:41:49 +0000 (13:41 +0000)]
Refactor fib4/fib6 functions.

No functional changes.

* Make lookup path of fib<4|6>_lookup_debugnet() separate functions
 (fib<46>_lookup_rt()). These will be used in the control plane code
 requiring unlocked radix operations and actual prefix pointer.
* Make lookup part of fib<4|6>_check_urpf() separate functions.
 This change simplifies the switch to alternative lookup implementations,
 which helps algorithmic lookups introduction.
* While here, use static initializers for IPv4/IPv6 keys

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

3 years agoAdd tracking for rib/nhops/nhgrp objects and provide cumulative number accessors.
melifaro [Sun, 29 Nov 2020 13:27:24 +0000 (13:27 +0000)]
Add tracking for rib/nhops/nhgrp objects and provide cumulative number accessors.

The resulting KPI can be used by routing table consumers to estimate the required
 scale for route table export.

* Add tracking for rib routes
* Add accessors for number of nexthops/nexthop objects
* Simplify rib_unsubscribe: store rnh we're attached to instead of requiring it up
 again on destruction. This helps in the cases when rnh is not linked yet/already unlinked.

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

3 years agobhyve: limit max GPA to VM_MAXUSER_ADDRESS_LA48.
kib [Sun, 29 Nov 2020 10:32:38 +0000 (10:32 +0000)]
bhyve: limit max GPA to VM_MAXUSER_ADDRESS_LA48.

We use 4-level EPT pages, correct the upper bound.

Reviewed by: grehan
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27402

3 years agobio aio: Destroy ephemeral mapping before unwiring page.
kib [Sun, 29 Nov 2020 10:30:56 +0000 (10:30 +0000)]
bio aio: Destroy ephemeral mapping before unwiring page.

Apparently some architectures, like ppc in its hashed page tables
variants, account mappings by pmap_qenter() in the response from
pmap_is_page_mapped().

While there, eliminate useless userp variable.

Noted and reviewed by: alc (previous version)
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27409

3 years agoRemove the pre-ARMv6 and pre-INTRNG code.
mmel [Sun, 29 Nov 2020 08:40:12 +0000 (08:40 +0000)]
Remove the pre-ARMv6 and pre-INTRNG code.
ARM has required ARMV6+ and INTRNg for some time now, so remove
always false #ifdefs and unconditionally do always true #ifdefs.

3 years agohwpstate_intel: don't unconditionally print the error message
yuripv [Sun, 29 Nov 2020 01:43:04 +0000 (01:43 +0000)]
hwpstate_intel: don't unconditionally print the error message

Actually check the wrmsr_safe() return value when setting autonomous
HWP for package.

PR: 245582
Differential Revision: https://reviews.freebsd.org/D24744

3 years agoRemove alignment requirements for KVA buffer mapping.
mav [Sun, 29 Nov 2020 01:30:17 +0000 (01:30 +0000)]
Remove alignment requirements for KVA buffer mapping.

After r368124 pbuf_zone has extra page to handle this particular case.

3 years agoRemove aligment requirements for passthrough buffer.
mav [Sun, 29 Nov 2020 00:57:19 +0000 (00:57 +0000)]
Remove aligment requirements for passthrough buffer.

After r368124 vmapbuf() should happily map misaligned maxphys-sized buffers
thanks to extra page added to pbuf_zone.

3 years agoRemove alignment requirements for KVA buffer mapping.
mav [Sun, 29 Nov 2020 00:49:14 +0000 (00:49 +0000)]
Remove alignment requirements for KVA buffer mapping.

After r368124 vmapbuf() should happily map misaligned maxphys-sized buffers
thanks to extra page added to pbuf_zone.

3 years agoMark inline functions static.
mav [Sun, 29 Nov 2020 00:35:13 +0000 (00:35 +0000)]
Mark inline functions static.

3 years agoIncrease nvme(4) maximum transfer size from 1MB to 2MB.
mav [Sun, 29 Nov 2020 00:20:31 +0000 (00:20 +0000)]
Increase nvme(4) maximum transfer size from 1MB to 2MB.

With 4KB page size the 2MB is the maximum we can address with one page PRP.
Going further would require chaining, that would add some more complexity.

On the other side, to reduce memory consumption, allocate the PRP memory
respecting maximum transfer size reported in the controller identify data.
Many of NVMe devices support much smaller values, starting from 128KB.
To do that we have to change the initialization sequence to pull the data
earlier, before setting up the I/O queue pairs.  The admin queue pair is
still allocated for full MIN(maxphys, 2MB) size, but it is not a big deal,
since there is only one such queue with only 16 trackers.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

3 years agoping: allow building without INET support
asomers [Sat, 28 Nov 2020 23:24:19 +0000 (23:24 +0000)]
ping: allow building without INET support

Building without INET6 support was already possible. Now it's possible to
build ping with only INET6, or even with neither INET nor INET6.

Reported by: bz
Reviewed by: bz
MFC-With: 368045
Differential Revision: https://reviews.freebsd.org/D27394

3 years agoAdd watchdog(9) driver for the Fintek F81803 SuperIO chip
phk [Sat, 28 Nov 2020 22:34:33 +0000 (22:34 +0000)]
Add watchdog(9) driver for the Fintek F81803 SuperIO chip

3 years agoAdd nhgrp_get_idx() as a counterpart for nhop_get_idx().
melifaro [Sat, 28 Nov 2020 15:46:40 +0000 (15:46 +0000)]
Add nhgrp_get_idx() as a counterpart for nhop_get_idx().

It allows the routing-related code to reference nexthop groups by index
 instead of storing a pointer.

3 years agoCleanup nexthops request flags:
melifaro [Sat, 28 Nov 2020 15:11:59 +0000 (15:11 +0000)]
Cleanup nexthops request flags:
* remove NHR_IFAIF as it was used by previous version of nexthop KPI
* update NHR_REF description

3 years agoRemove now unused armv4 and not-INTRNG files.
mmel [Sat, 28 Nov 2020 15:00:08 +0000 (15:00 +0000)]
Remove now unused armv4 and not-INTRNG files.

3 years agolibc: Add pthread_attr_get_np(3) stub, reporting ESRCH.
kib [Sat, 28 Nov 2020 12:19:20 +0000 (12:19 +0000)]
libc: Add pthread_attr_get_np(3) stub, reporting ESRCH.

This seems to be required by recent clang asan.
I do not see other way than put the symbol under FBSD_1.0 version.

PR: 251112
Reported by: Andrew Stitcher <astitcher@apache.org>
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27389

3 years agoMake MAXPHYS tunable. Bump MAXPHYS to 1M.
kib [Sat, 28 Nov 2020 12:12:51 +0000 (12:12 +0000)]
Make MAXPHYS tunable.  Bump MAXPHYS to 1M.

Replace MAXPHYS by runtime variable maxphys. It is initialized from
MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.

Make b_pages[] array in struct buf flexible.  Size b_pages[] for buffer
cache buffers exactly to atop(maxbcachebuf) (currently it is sized to
atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1.
The +1 for pbufs allow several pbuf consumers, among them vmapbuf(),
to use unaligned buffers still sized to maxphys, esp. when such
buffers come from userspace (*).  Overall, we save significant amount
of otherwise wasted memory in b_pages[] for buffer cache buffers,
while bumping MAXPHYS to desired high value.

Eliminate all direct uses of the MAXPHYS constant in kernel and driver
sources, except a place which initialize maxphys.  Some random (and
arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted
straight.  Some drivers, which use MAXPHYS to size embeded structures,
get private MAXPHYS-like constant; their convertion is out of scope
for this work.

Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs,
dev/siis, where either submitted by, or based on changes by mav.

Suggested by: mav (*)
Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions)
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27225

3 years agoSuspend I/O on ahci-cd devices during a snapshot.
jhb [Sat, 28 Nov 2020 04:21:22 +0000 (04:21 +0000)]
Suspend I/O on ahci-cd devices during a snapshot.

Submitted by: Vitaliy Gusev <gusev.vitaliy@gmail.com>

3 years agobhyve: Add snapshot support for virtio-rnd.
jhb [Sat, 28 Nov 2020 04:06:09 +0000 (04:06 +0000)]
bhyve: Add snapshot support for virtio-rnd.

This uses the same snapshot routine as other VirtIO devices.

Submitted by: Vitaliy Gusev <gusev.vitaliy@gmail.com>
Differential Revision: https://reviews.freebsd.org/D26265

3 years agobhyve: 'xhci,tablet' snapshot fixes
jhb [Sat, 28 Nov 2020 03:54:48 +0000 (03:54 +0000)]
bhyve: 'xhci,tablet' snapshot fixes

Permit suspend/resume of a XHCI device model that has not been
attached to by a driver in a guest OS.

Submitted by: Vitaliy Gusev <gusev.vitaliy@gmail.com>
Differential Revision: https://reviews.freebsd.org/D26264

3 years agokern: cpuset: drop the lock to allocate domainsets
kevans [Sat, 28 Nov 2020 01:21:11 +0000 (01:21 +0000)]
kern: cpuset: drop the lock to allocate domainsets

Restructure the loop a little bit to make it a little more clear how it
really operates: we never allocate any domains at the beginning of the first
iteration, and it will run until we've satisfied the amount we need or we
encounter an error.

The lock is now taken outside of the loop to make stuff inside the loop
easier to evaluate w.r.t. locking.

This fixes it to not try and allocate any domains for the freelist under the
spinlock, which would have happened before if we needed any new domains.

Reported by: syzbot+6743fa07b9b7528dc561@syzkaller.appspotmail.com
Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D27371

3 years agoConvert vmm_ops calls to IFUNC
grehan [Sat, 28 Nov 2020 01:16:59 +0000 (01:16 +0000)]
Convert vmm_ops calls to IFUNC

There is no need for these to be function pointers since they are
never modified post-module load.

Rename AMD/Intel ops to be more consistent.

Submitted by: adam_fenn.io
Reviewed by: markj, grehan
Approved by: grehan (bhyve)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D27375

3 years agoaddr2line: add label checks when DW_AT_range and DW_AT_low_pc cannot be used
emaste [Fri, 27 Nov 2020 21:38:03 +0000 (21:38 +0000)]
addr2line: add label checks when DW_AT_range and DW_AT_low_pc cannot be used

Check label's ranges for address we want to translate if a CU doesn't
have usable DW_AT_range or DW_AT_low_pc.

Use more appropriate names: "struct CU" -> "struct range"

Developed as part of upstream ELF Tool Chain bug report
https://sourceforge.net/p/elftoolchain/tickets/552/ although this does
not address the specific case reported there.

Submitted by: Tiger Gao <tig@freebsdfoundation.org>
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23782

3 years agoo Move options IOMMU from Debugging section back to the Bus section
br [Fri, 27 Nov 2020 21:37:48 +0000 (21:37 +0000)]
o Move options IOMMU from Debugging section back to the Bus section
  where it originally was. The bug introduced in r366267.
o Remove options IOMMU from i386/MINIMAL as we don't have it in
  i386/GENERIC.

Reported by: Harry Schmalzbauer <freebsd@omnilan.de>
Reviewed by: kib
Sponsored by: Innovate DSbD
Differential Revision: https://reviews.freebsd.org/D27399

3 years agocallout(9): Remove some leftover APM BIOS support
markj [Fri, 27 Nov 2020 20:46:02 +0000 (20:46 +0000)]
callout(9): Remove some leftover APM BIOS support

This code is obsolete since r366546.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27267

3 years agofix casper initialization for setting scripts.
ume [Fri, 27 Nov 2020 18:40:51 +0000 (18:40 +0000)]
fix casper initialization for setting scripts.

MFC after: 1 week

3 years agoarm: Correctly report the size of FPA registers to GDB
markj [Fri, 27 Nov 2020 16:35:43 +0000 (16:35 +0000)]
arm: Correctly report the size of FPA registers to GDB

Modern ARM systems do not have an FPA unit but GDB reserves register
indices for FPA registers and expects the stub to know their sizes.

PR: 251022
Submitted by: Dmitry Salychev <dsl@mcusim.org>
MFC after: 2 weeks

3 years agoSome code reorganization.
mav [Fri, 27 Nov 2020 15:50:20 +0000 (15:50 +0000)]
Some code reorganization.

 - Remove code duplication by adding two new functions to execute prepared
queue entry via either mbox or request queue and wait for result.
 - Since the new function executing via request queue sleeps any way, make
it sleep also in case of overflows or handle shortages.  It should make it
more reliable and less affecting other less flexible request queue users.
 - Turn isp_target_put_entry() into not target-specific isp_send_entry().
 - Make handling of responses with control handles more universal.
 - Move RQSTYPE_RPT_ID_ACQ handling into new function.
 - Inline isp_handle_other_response(), becoming trivial after above.
 - Clean the list of IOCBs from pre-24xx ones.

3 years agoMake generated C files depend on this Makefile
se [Fri, 27 Nov 2020 09:00:21 +0000 (09:00 +0000)]
Make generated C files depend on this Makefile

The contents of lib.c, lib2.c, bc_help.c, and dc_help.c depends on the
parameters passed to strgen.sh in this Makefile. A change to the number
of parameters of strgen.sh has been applied to the invocation of this
command, but this did not cause a rebuild of the generated files.

Reported by: Cy.Schubert@cschubert.com

3 years agoFix bhyve SMBIOS type 19 handling to avoid misreporting total RAM amount
bcran [Fri, 27 Nov 2020 08:00:32 +0000 (08:00 +0000)]
Fix bhyve SMBIOS type 19 handling to avoid misreporting total RAM amount

This fixes the amount of memory displayed in the EDK2 UiApp to be the same
as passed on the bhyve command line. Otherwise, 8GB is displayed as 4GB,
32GB as 28GB etc.

Reviewed by: jhb, kib, rgrimes
Differential Revision: https://reviews.freebsd.org/D27348

3 years agobhyve: fix smbiostbl.c style issues and add comment about date format
bcran [Fri, 27 Nov 2020 07:53:15 +0000 (07:53 +0000)]
bhyve: fix smbiostbl.c style issues and add comment about date format

Fix a couple of style issues introduced in my previous commit.
Add a comment explaining that the SMBIOS specification defines the date
format to be mm/dd/yyyy, which is why we don't use ISO 8601.

3 years agoRestore break statement lost in r367857.
mav [Fri, 27 Nov 2020 05:13:52 +0000 (05:13 +0000)]
Restore break statement lost in r367857.

3 years agolibprocstat.3: Correct two occurrences of kvm_getprocs to procstat_getprocs
0mp [Thu, 26 Nov 2020 22:49:05 +0000 (22:49 +0000)]
libprocstat.3: Correct two occurrences of kvm_getprocs to procstat_getprocs

Submitted by: otis_sk.freebsd.org
Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26151

3 years agoRemove stray column.
kib [Thu, 26 Nov 2020 20:27:23 +0000 (20:27 +0000)]
Remove stray column.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agoStyle.
kib [Thu, 26 Nov 2020 20:23:17 +0000 (20:23 +0000)]
Style.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agoarm64: Do not rely on SPCR table to detect acpi
manu [Thu, 26 Nov 2020 20:22:34 +0000 (20:22 +0000)]
arm64: Do not rely on SPCR table to detect acpi

Since EDK2 commit d8e36289cef7bde628b023219cd65fa8e8d4562a, the Graphical console may
completely hide SPCR, causing panics later when locating timers.
As such simply rely on the ACPI Root pointer presence.

Submitted by: dan.kotowski@a9development.com
Reviewed by: andrew, mw
Differential Revision: https://reviews.freebsd.org/D27306

3 years agoUpdate Makefile for new version 3.2.0
se [Thu, 26 Nov 2020 19:38:02 +0000 (19:38 +0000)]
Update Makefile for new version 3.2.0

3 years agoMore cleanup in response queue and reset code.
mav [Thu, 26 Nov 2020 18:47:23 +0000 (18:47 +0000)]
More cleanup in response queue and reset code.

3 years agoping: add a ping6 hard link for backwards compatibility
asomers [Thu, 26 Nov 2020 18:33:04 +0000 (18:33 +0000)]
ping: add a ping6 hard link for backwards compatibility

When invoked as "ping6", ping will now attempt to use ICMPv6 for hostnames
that resolve both IPv4 and IPv6 addresses.

Reviewed by: bz, manu
MFC-With: r368045
Differential Revision: https://reviews.freebsd.org/D27384

3 years agonullfs: provide custom bypass for VOP_READ_PGCACHE().
kib [Thu, 26 Nov 2020 18:16:32 +0000 (18:16 +0000)]
nullfs: provide custom bypass for VOP_READ_PGCACHE().

Normal bypass expects locked vnode, which is not true for
VOP_READ_PGCACHE().  Ensure liveness of the lower vnode by taking the
upper vnode interlock, which is also taked by null_reclaim() when
setting v_data to NULL.

Reported and tested by: pho
Reviewed by: markj, mjg
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27327

3 years agovn_read_from_obj(): fix handling of doomed vnodes.
kib [Thu, 26 Nov 2020 18:13:33 +0000 (18:13 +0000)]
vn_read_from_obj(): fix handling of doomed vnodes.

There is no reason why vp->v_object cannot be NULL. If it is, it's
fine, handle it by delegating to VOP_READ().

Tested by: pho
Reviewed by: markj, mjg
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27327

3 years agoMore careful handling of the mount failure.
kib [Thu, 26 Nov 2020 18:08:42 +0000 (18:08 +0000)]
More careful handling of the mount failure.

- VFS_UNMOUNT() requires vn_start_write() around it [*].
- call VFS_PURGE() before unmount.
- do not destroy mp if cleanup unmount did not succeed.
- set MNTK_UNMOUNT, and indicate forced unmount with MNTK_UNMOUNTF
  for VFS_UNMOUNT() in cleanup.

PR: 251320 [*]
Reported by: Tong Zhang <ztong0001@gmail.com>
Reviewed by: markj, mjg
Discussed with: rmacklem
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27327

3 years agoclear_inodedeps: handle ERELOOKUP from ffs_syncvnode().
kib [Thu, 26 Nov 2020 18:03:24 +0000 (18:03 +0000)]
clear_inodedeps: handle ERELOOKUP from ffs_syncvnode().

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation

3 years agoMake max ticks for pause in vn_lock_pair() adjustable at runtime.
kib [Thu, 26 Nov 2020 18:00:26 +0000 (18:00 +0000)]
Make max ticks for pause in vn_lock_pair() adjustable at runtime.

Reduce default value from hz / 10 to hz / 100.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation

3 years agoUpdate to version 3.2.0
se [Thu, 26 Nov 2020 17:39:51 +0000 (17:39 +0000)]
Update to version 3.2.0

3 years agobsd.lib.mk: Work around build system raciness
arichardson [Thu, 26 Nov 2020 17:37:27 +0000 (17:37 +0000)]
bsd.lib.mk: Work around build system raciness

We are seeing regular build failures due to libc.so being installed again and
another parallel make job tries to read the partially written libc.so at the
same time. When building with -j32 or higher this almost always happens on
the first clean build (subsequent incremental builds always work fine).
Using -S should "fix" the "section header table goes past the end of the
file: e_shoff = 0x..." errors that have started to plague our builds.

We originally thought this only affected CheriBSD, but I just got the same
error while building the latest upstream FreeBSD.

The real fix should be to not install libraries twice, but until then this
workaround is needed.

Original patch by jrtc27@, I only made some minor changes to the comment.

Obtained from: CheriBSD (https://github.com/CTSRD-CHERI/cheribsd/commit/49837edd3efd5d02a1b120c47f00cfc2d59a9a8e)
Reviewed By: markj, bdrewery
Differential Revision: https://reviews.freebsd.org/D27102

3 years agoAdd .cfi_{start,end}proc for RISC-V assembly functions
arichardson [Thu, 26 Nov 2020 17:37:22 +0000 (17:37 +0000)]
Add .cfi_{start,end}proc for RISC-V assembly functions

This allows GDB to print more useful backtraces when setting a breakpoint
on an assembly function.

Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D27177

3 years agoImport version 3.2.0
se [Thu, 26 Nov 2020 17:27:07 +0000 (17:27 +0000)]
Import version 3.2.0

3 years agoarm: allwinner: a23 timer functions are only used for arm64
manu [Thu, 26 Nov 2020 17:19:47 +0000 (17:19 +0000)]
arm: allwinner: a23 timer functions are only used for arm64

3 years agoarm: tegra: Remove unused variable
manu [Thu, 26 Nov 2020 17:19:30 +0000 (17:19 +0000)]
arm: tegra: Remove unused variable

3 years agoarm: mv: Remove unused code
manu [Thu, 26 Nov 2020 17:19:13 +0000 (17:19 +0000)]
arm: mv: Remove unused code

3 years agoarm: ti: Remove unused function ti_first_gpio_bank
manu [Thu, 26 Nov 2020 17:18:54 +0000 (17:18 +0000)]
arm: ti: Remove unused function ti_first_gpio_bank

3 years agoRevert incomplete import of version 3.2.0
se [Thu, 26 Nov 2020 17:18:18 +0000 (17:18 +0000)]
Revert incomplete import of version 3.2.0

3 years agoUpdate to version 3.2.0
se [Thu, 26 Nov 2020 16:52:17 +0000 (16:52 +0000)]
Update to version 3.2.0

3 years agosdhci: mmccam: Update vccq in the driver ios
manu [Thu, 26 Nov 2020 16:40:39 +0000 (16:40 +0000)]
sdhci: mmccam: Update vccq in the driver ios

Otherwise we always report that the card is running at 1.2V.

3 years agosdhci: Only print mmccam debug code if hw.sdhci.debug is > 1
manu [Thu, 26 Nov 2020 16:40:20 +0000 (16:40 +0000)]
sdhci: Only print mmccam debug code if hw.sdhci.debug is > 1

3 years agommccam: We can't sleep during sdda_add_part so use M_NOWAIT
manu [Thu, 26 Nov 2020 16:39:56 +0000 (16:39 +0000)]
mmccam: We can't sleep during sdda_add_part so use M_NOWAIT

Reviewed by: kibab
Differential Revision: https://reviews.freebsd.org/D25947

3 years agoEnsure consistent error messages from ifconfig(8).
hselasky [Thu, 26 Nov 2020 16:36:50 +0000 (16:36 +0000)]
Ensure consistent error messages from ifconfig(8).

If multiple threads are invoking "ifconfig XXX create" a race may occur
which can lead to two different error messages for the same error.

a) ifconfig: SIOCIFCREATE2: File exists
b) ifconfig: interface XXX already exists

This patch ensures ifconfig prints the same error code
for the same case.

Reviewed by: imp@ and kib@
Differential Revision: https://reviews.freebsd.org/D27380
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoGH Actions: Use pre-installed clang packages
uqs [Thu, 26 Nov 2020 14:42:16 +0000 (14:42 +0000)]
GH Actions: Use pre-installed clang packages

Also fix the run by setting up the environment in non-deprecated way.

Always run with --debug to understand better what sort of stuff is happening in
the background. Also split out the bmake bootstrap stage (takes about 31s on
ubuntu, but 1m14 on macOS?)

Drops the dependency on coreutils (realpath, nproc) and thus (?) fixes macOS to
be just as fast (4 logical cores vs 2 physical cores before, go figure.)

Reviewed by: arichardson