devstat: Provide 32-bit compatibility
If a 32-bit process running on a 64-bit kernel requests kern.devstat.all,
translate each struct devstat to its 32-bit equivalent before copying it
out.
Also fix a bug where an early error would be ignored if there were no
devices to report.
MFC after: 1 week
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D54591
sys/module.h: allow MODULE_DEPEND to accept macros
Allow MODULE_DEPEND to accept macros by adding an extra level of
indirection. Some drivers in the tree actually depend on this being the
case.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D54874
vchiq: fix build with clang 21
When compiling vchiq with clang 21, the following -Werror warning is
produced:
sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c:728:27: error: default initialization of an object of type 'VCHIQ_QUEUE_MESSAGE32_T' with const member leaves the object uninitialized [-Werror,-Wdefault-const-init-field-unsafe]
728 | VCHIQ_QUEUE_MESSAGE32_T args32;
| ^
sys/contrib/vchiq/interface/vchiq_arm/vchiq_ioctl.h:151:40: note: member 'elements' declared 'const' here
151 | const /*VCHIQ_ELEMENT_T * */ uint32_t elements;
| ^
While the warning is formally correct, the 'args32' object is
immediately initialized after its declaration. Therefore, suppress the
warning.
MFC after: 3 days
(cherry picked from commit b39662fc388678db2b7b5fa3c900205252d15b3b)
mxge(4): avoid clang 21 warning in NO-IP configuration
Building the LINT-NOIP kernel on amd64 with clang 21 results in a
-Werror warning similar to:
sys/dev/mxge/if_mxge.c:1846:44: error: variable 'sum' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
1846 | cksum_offset, sizeof(sum), (caddr_t)&sum);
| ^~~
Indeed, if both `INET` and `INET6` are undefined, `sum` is never
initialized. Initialize it to zero to silence the warning.
Reviewed by: jhibbits
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D54730
(cherry picked from commit 74cac745fe302b26ad22114f60735c8b73e90571)
libc++ inttypes.h: define __STDC_CONSTANT_MACROS and __STDC_LIMIT_MACROS
Before transitively including the base version of inttypes.h, define
__STDC_CONSTANT_MACROS and __STDC_LIMIT_MACROS, because the base
inttypes.h directly includes sys/stdint.h, instead of going through the
'regular' stdint.h.
The libc++ version of the latter does define those macros, to ensure
things like UINT64_C() and SIZE_MAX are defined even in C++98 or C++03.
MFC after: 3 days
(cherry picked from commit 3cdb6c9d92ecf479a0df338267f3f844ef6feeb2)
modules: miiproxy: Fix standalone build
The fix is made in main branch [1] by imp but it appears to be done
incidentally. Let's do it directly for stable/15 branch.
[1] 8e985774117d kern: Remove needless kern.opts.mk
modules: iwlwifi/rtw89 allow standalone build
The KERN_OPTS:MDEV_ACPI checks are fine for as long as we are building
modules along the kernel. If one wants to just build the module
standalone out of the module directory this would fail.
Add the missing include for kmod.opts.mk (as was done for tcp
in 1319a76179682).
Sponsored by: The FreeBSD Foundation
Reported by: Tassilo Philipp (tphilipp potion-studios.com)
Fixes: f5a77dc8f8df ("improve module Makefile dependency on ACPI")
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D54769
(cherry picked from commit 0f0b833e4db6d450b39de0365b657936f5a6993b)
exterr: Sort output from make_libc_exterr_cat_filenames.sh
Otherwise the script may permute the order of entries in the file since
find(1) output is not stable.
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D54669
(cherry picked from commit bda6ed2ee4d8e836b1b2f8ca7a6ed72034e5f231)
linuxkpi: Clean up linux_shmem_file_setup() a bit
- Free the pointer that was returned by the allocator, instead of the
address of the first member. These will be equal in practice, but
it's sketchy and won't work on CHERI with subobject bounds checking.
- Use an anonymous struct, there's no need to name it.
Reviewed by: bz, brooks, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D54673
(cherry picked from commit 251662e5abdd85f5a83766b400e23c2ac5597fb9)
asmc: add per-fan manual mode control via sysctl
Add per-fan manual mode control via dev.asmc.0.fan.N.manual sysctl.
Apple SMCs support manual fan control via the FS! SMC key,
a 16-bit bitmask where each bit controls one fan (0=auto, 1=manual).
This change adds a new sysctl per fan:
dev.asmc.0.fan.N.manual (0=auto, 1=manual)
When set to manual mode (1), the fan runs at the speed set via
dev.asmc.0.fan.N.targetspeed instead of automatic thermal control. When
set to auto mode (0), the SMC controls fan speed automatically.
The FS! key was already defined in asmcvar.h but not accessible.
This exposes it for debugging, testing, and advanced fan control.
Implementation uses read-modify-write to allow independent control of
each fan without affecting others.
[6 lines not shown]
linuxkpi: Fix an error path in linux_alloc_current()
If the allocation fails we should free the task struct.
While here get rid of a couple of unnecessary assertions.
Reported by: Kevin Day <kevin at your.org>
Reviewed by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D54671
(cherry picked from commit a4955b0143361900140df640d116891f047f5431)
arm64/iommu: Fix a resource leak in smmu_domain_alloc()
We should free the allocated ASID if smmu_init_cd() fails.
Move the allocation of "domain" to simplify the first error path.
Reported by: Kevin Day <kevin at your.org>
Reviewed by: br
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D54676
(cherry picked from commit 6740cccb1eff2a0e1e6d451fa9676a21736937d2)
arm64/vgic_v3: Fix an inverted test when reading GICD_I<C|S>ENABLER
On read, these registers' fields return 1 if forwarding of the
corresponding interrupt is enabled, and 0 otherwise. The test in
read_enabler() was inverted.
Reported by: Kevin Day <kevin at your.org>
Reviewed by: andrew
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D54678
(cherry picked from commit 6fef0c9ee64cea1f22b6a33a0c4dd39f605b7465)
kqueue.2: Fix reference to unexisting kevent1()
kqueue1() was meant.
While here, make the wording in the AUTHORS section more clear.
PR: 291908
Fixes: 9b1585384d53 ("kqueue.2: Editorial pass")
Reviewed by: kib, dab
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D54858