Move the ACPI PM timer emulation into vmm.ko.

This reduces variability during timer calibration by keeping the emulation
"close" to the guest. Additionally having all timer emulations in the kernel
will ease the transition to a per-VM clock source (as opposed to using the
host's uptime keep track of time).

Discussed with:	grehan
Use a temporary buffer in sys_setgroups for requests with <= XU_NGROUPS groups.

Submitted by:	Tiwei Bie <btw mail.ustc.edu.cn>
X-Additional: JuniorJobs project
MFC after:	2 weeks
Tidy up sys_setgroups and kern_setgroups.

- 'groups' initialization to NULL is always ovewrwriten before use, so plug it
- get rid of 'goto out'
- kern_setgroups's callers already validate ngrp, so only assert the condition
- ngrp  is an u_int, so 'ngrp < 1' is more readable as 'ngrp == 0'

No functional changes.
Add "rpm" and "formfactor" LUN options to match istgt functionality.

MFC after:	1 week
MFV r273688:

Update filesystems magic.  This fixes a regression introduced by
libmagic 5.19 which prevents file(1) to show more verbose information
about a MBR.

Submitted by:	madpilot
MFC after:	2 weeks
Mention VAAI and ODX in ctl(4).

Reviewed by:	mav@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Fix up an assertion in kern_setgroups, it should compare with ngroups_max + 1

Bug introdued in r273685.

Noted by: Tiwei Bie <btw mail.ustc.edu.cn>
Fix printing non-terminated strings in devlist XML.

MFC after:	1 week
sh: Make getopts memory-safe if with changing arguments.

POSIX does not permit to continuing a getopts loop with different
arguments. For parsing the positional parameters, we handle this case by
resetting the getopts state when the positional parameters are changed in
any way (and the getopts state is local to a function). However, in the
syntax getopts <optstring> <var> <arg...>, changes could lead to invalid
memory access.

In the syntax getopts <optstring> <var> <arg...>, store a copy of the
arguments and continue to use them until getopts is reset.
By the time that pmap_init() runs, vm_phys_segs[] has been initialized.  Obtaining
the end of memory address from vm_phys_segs[] is a little easier than obtaining it
from phys_avail[].

Discussed with:	Svatopluk Kraus
Remove incorrect semicolon.
Remove the ARM_DEVICE_MULTIPASS option and make its effect be the default.

Multipass device attachment was tested on many arm platforms by users and
only success was reported on the arm@ mailing list.  This is just the
long-delayed followup of making it the default.

Multipass attachment is necessary when using vendor-supplied FDT data,
because our devices may need to be attached in a different order than they
are described in the FDT data.
Fix CF ERASE breakage caused by 268205.

This prevents BIO_DELETE requests getting stuck in the TRIM queue which
results in a panic on shutdown due to outstanding requests.

PR:		194606
Reported by:	Guido Falsi
Reviewed by:	mav
MFC after:	3 days
Sponsored by:	Multiplay
Change the type of the first argument to the I/O emulation handlers to
'struct vm *'. Previously it used to be a 'void *' but there is no reason
to hide the actual type from the handler.

Discussed with:	tychon
MFC after:	1 week
Avoid dynamic syscall overhead for statically compiled modules.

The kernel tracks syscall users so that modules can safely unregister them.

But if the module is not unloadable or was compiled into the kernel, there is
no need to do this.

Achieve this by adding SY_THR_STATIC_KLD macro which expands to SY_THR_STATIC
during kernel build and 0 otherwise.

Reviewed by:	kib (previous version)
MFC after:	2 weeks
Fix support for LUN flat space addressing.

MFC after:	1 week
Replace update from -r271410 accidentally lost in -r273575.
Add a comment explaining the intent behind the I/O reservation [0x72-0x77].
Allocate buffer for READ BUFFER/WRITE BUFFER commands on demand.

These commands are rare, but consume additional 256KB RAM per LUN.

MFC after:	1 week
Simplify memrw().

MFC after:	10 days