72a2f3b5 mmel Dec. 24, 2021, 6:42 p.m.
Always recalculate the frequency, the cache is lazily initialized so it is not always up to date.
While I'm in mark sysctl as MPSAFE.

Discussed with:	manu, adrian
MFC after:	1 week
8ddb4b9b andrew Dec. 24, 2021, 11:59 a.m.
This will be used by the vdso signal trampoline on arm64.

While here fix the license as this part of locore.S to correct the
copyright owner.

Sponsored by:	The FreeBSD Foundation
ada8b24d dim Dec. 24, 2021, 11:46 a.m.
Merge commit 77e8f4eeeeed from llvm git (by David Green):

  [ARM] Define ComplexPatternFuncMutatesDAG

  Some of the Arm complex pattern functions call canExtractShiftFromMul,
  which can modify the DAG in-place. For this to be valid and handled
  successfully we need to define ComplexPatternFuncMutatesDAG.

  Differential Revision: https://reviews.llvm.org/D107476

When building parts of llvm targeting armv6 on stable/12, the following
assertion can appear (or if assertions are disabled, clang is likely to

Assertion failed: (NodeToMatch->getOpcode() != ISD::DELETED_NODE && "NodeToMatch was removed partway through selection"), function SelectCodeCommon, file /usr/src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp, line 3573.
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /usr/obj/usr/src/freebsd12-amd64/tmp/usr/bin/c++ -cc1 -triple armv6kz-unknown-freebsd12.3-gnueabihf -S --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -mrelocation-model static -mconstructor-aliases -target-cpu arm1176jzf-s -target-feature +vfp2 -target-feature +vfp2sp -target-feature -vfp3 -target-feature -vfp3d16 -target-feature -vfp3d16sp -target-feature -vfp3sp -target-feature -fp16 -target-feature -vfp4 -target-feature -vfp4d16 -target-feature -vfp4d16sp -target-feature -vfp4sp -target-feature -fp-armv8 -target-feature -fp-armv8d16 -target-feature -fp-armv8d16sp -target-feature -fp-armv8sp -target-feature -fullfp16 -target-feature +fp64 -target-feature -d32 -target-feature -neon -target-feature -sha2 -target-feature -aes -target-feature -fp16fml -target-feature +strict-align -target-abi aapcs-linux -mfloat-abi hard -fallow-half-arguments-and-returns -ffunction-sections -fdata-sections -O1 -std=c++14 -fdeprecated-macro -fno-rtti -fno-signed-char -faddrsig -fexperimental-new-pass-manager PPCISelLowering-009095.ii
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module 'PPCISelLowering-009095.cpp'.
4.	Running pass 'ARM Instruction Selection' on function '@_ZN4llvm17PPCTargetLoweringC2ERKNS_16PPCTargetMachineERKNS_12PPCSubtargetE'

This crash or assertion is fixed by the upstream commit.

MFC after:	3 days
15910dc0 avg Dec. 24, 2021, 9:02 a.m.
If a disk is already in STANDBY mode, then setting IDLE mode can
actually spin it up.

Reviewed by:	mav
MFC after:	4 weeks
Differential Revision:	https://reviews.freebsd.org/D33588
184c63db dougm Dec. 24, 2021, 8:47 a.m.
Fix a very recent change that introduced a page accounting error in
case of a reserveration being broken.
Reviewed by:	alc
Fixes:	fb38b29b5609 (page_alloc_br) vm_page: Remove extra test, dup code from page alloc
Differential Revision:	https://reviews.freebsd.org/D33645
b7ec0d26 alc Dec. 24, 2021, 4:56 a.m.
Use pmap_pte_exists() instead of pmap_pte() when the caller expects a
mapping to exist at a particular level.  The caller benefits in two
ways from using pmap_pte_exists().  First, because the level is
specified to pmap_pte_exists() as a constant, rather than returned, the
compiler can specialize the implementation of pmap_pte_exists() to the
caller's exact needs, i.e., generate fewer instructions.  Consequently,
within a GENERIC-NODEBUG kernel, 704 bytes worth of instructions are
eliminated from the inner loops of various pmap functions.  Second,
suppose that the mapping doesn't exist.  Rather than requiring every
caller to implement its own KASSERT()s to report missing mappings, the
caller can optionally have pmap_pte_exists() provide the KASSERT().

Reviewed by:	andrew, kib
Tested by:	andrew (an earlier version)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D33597
fb38b29b dougm Dec. 24, 2021, 4:45 a.m.
Extract code common to functions vm_page_alloc_contig_domain and
vm_page_alloc_noobj_contig_domain into a new function.  Do so in a way
that eliminates a bound-to-fail reservation test after a reservation
is broken by a call from vm_page_alloc_contig_domain.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D33551
744c2dc7 rmacklem Dec. 23, 2021, 10:31 p.m.
I thought that these new auth_stat values had been agreed
upon by the IETF NFSv4 working group, but that no longer
is the case.  As such, delete them and use AUTH_TOOWEAK
instead.  Leave the code that uses these new auth_stat
values in the sources #ifdef notnow, in case they are
defined in the future.

MFC after:	1 week
752e211e jhb Dec. 23, 2021, 10:14 p.m.
When the initiator is reconnecting to the target, the connection may
temporarily be marked disconnected or not have an associated socket.
New I/O requests received by the initiator in this state should not
fail with ECONNRESET as that results in an I/O error back to userland.
Instead, they need to still succeed so that CAM can queue the requests
and send them once the connection is re-established.

Setting up DDP for zero-copy receive requires a socket, so just punt
on using DDP for these transfers.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications
c583b025 jhibbits Dec. 23, 2021, 10:06 p.m.
Disable timebase on (some) AIM platforms (tested on PowerMac G4) prior
to synchronization.

Some platforms use a GPIO to enable and disable timebase, while others
use a platform function.

This mirrors 0d69f00b on mpc85xx.

 * Implement various G5 timebase controls.
 * Print out platform code on unknown G5s so we can collect it.
 * Change API to be give/take pairs like Linux does so it's possible to
   do a software sync protocol.

Reviewed By: #powerpc, jhibbits
Subscribers: mikael, markmi_dsl-only.net, luporl, alfredo
Tags: #powerpc
Differential Revision: https://reviews.freebsd.org/D29136
a34d3ca6 jrtc27 Dec. 23, 2021, 8:19 p.m.
IDR0-IDR5 can be read byte-by-byte but must be written to as 4-byte
words. The current code to do this is rather clunky and ends up reading
past the end of the union's eaddr member due to MAC addresses only being
6 bytes. In practice this ends up being fine because the align_dummy
member will pad the union to a multiple of 4 bytes, but this is dodgy,
and on CHERI with subobject bounds enforcement enabled, as is done in
CheriBSD's pure-capability kernel, will trap.

Instead, make the buffer in use the right size, just use an array of
uint32_t's rather than a char buffer that's then cast to uint32_t * to
simplify it in the process, and zero-initialise it first to avoid
reading uninitialised data in the trailing bytes.

Found by:	CHERI
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D33617
95a70e9e adrian Dec. 23, 2021, 6:42 p.m.
This adds the IPQ4018 TLMM code into the IPQ4018 build.

Differential Revision: https://reviews.freebsd.org/D33554
4abe6533 adrian Dec. 23, 2021, 6:41 p.m.
The qualcomm TLMM (top level mode manager) is their gpio/pinmux hardware

Although the pinmux is generic enough to use for the IPQ/APQ series
chips, I'm directly calling the IPQ4018 routines to expedite bring-up.

Notably, I'm not yet implementing the interrupt support - it's not
required at this stage of bring-up.

Differential Revision: https://reviews.freebsd.org/D33554
0727f7b5 adrian Dec. 23, 2021, 6:36 p.m.
The IPQ4018/IPQ4019 cores use the DWC3 core.  So make it available
5bc2e6e2 emaste Dec. 23, 2021, 4:54 p.m.
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33629