1
0
mirror of https://git.FreeBSD.org/src.git synced 2026-06-02 11:24:32 +00:00

309684 Commits

Author SHA1 Message Date
Christos Margiolis 8e804f3dd6 sound: Retire unused hw.snd.vpc_mixer_bypass
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/18
2026-05-27 17:32:11 +02:00
Christos Margiolis f61e65e1b2 sound: Retire mixer_ioctl_channel()
This function never succeeds when it is not called from the same process
that has opened the file descriptor (e.g., mixer(8)). The reason is that
the CHN_FOREACH() loop tries to match the pid of each channel with the
pid of the process performing the ioctl, which will not be the same,
unless it's the same process that both opened the channel and performed
the ioctl.

In the case that the same process opens the channels and performs the
ioctl, however, we still do not need to worry, because mixer_ioctl_cmd()
essentially does the same thing anyway. Additionally, this scenario
should be quite rare, given that most applications do not open both
/dev/dsp* and /dev/mixer*, and in fact, it is actively encouraged by the
official OSSv4 specification not to do that.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/18
2026-05-27 17:32:11 +02:00
Christos Margiolis e8ea97602c sound: Retire M_MIXER
Even though harmless, it is not really useful, as there is essentially
only one allocation with M_MIXER.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/18
2026-05-27 17:32:11 +02:00
Christos Margiolis dfa52e8ed5 sound: Update feeder_eq.c LICENSE header
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/15
2026-05-27 17:27:11 +02:00
Christos Margiolis 8b8dbc6bbe sndctl(8): Implement EQ controls
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/15
2026-05-27 17:27:11 +02:00
Christos Margiolis 98a62ccab6 pcm.4: Document dev.pcm.%d.eq*
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/15
2026-05-27 17:27:11 +02:00
Christos Margiolis 3a3cb16ad4 sound: Retire hint.pcm.%d.eq_preamp
It wasn't documented in the first place, but it is easier to just use
the sysctl.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/15
2026-05-27 17:27:11 +02:00
Christos Margiolis 88bc1d7325 sound: Retire EQ states
The SD_F_EQ_ENABLED does the same thing, and is actually what we test
against in order to create the EQ feeder.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/15
2026-05-27 17:27:11 +02:00
Christos Margiolis f5d6e5cb5c sound: Retire FEEDEQ_DISABLE
We can do this more efficiently by just using the SD_F_EQ* flags. In
fact, the dev.pcm.%d.eq handler will (un)set SD_F_EQ_ENABLED and this is
what we actually test with when choosing to creating the EQ feeder or
not, so setting the state to FEEDEQ_DISABLE does not really an effect in
the first place.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/15
2026-05-27 17:27:11 +02:00
Christos Margiolis 6f130b220d sound: Remove dead EQ FEEDEQ_DISABLE code
If EQ is disabled, we never reach those code paths in the first place.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/15
2026-05-27 17:27:11 +02:00
Christos Margiolis 54a03b44ae sound: Retire FEEDEQ_BYPASS
In effect, this is the same as the disable state. There is a comment
that says the bypass state skips EQ altogether, which is what the
disable should be. The disable state according to the comment disables
EQ but keeps the EQ preamp (dev.pcm.%d.eq_preamp), however after testing
it seems that the preamp does not really take effect, because with EQ
disabled, feeder_eq is non existent, so we never execute any EQ code in
the first place.

Make things simpler and clearer and have 2 states; enable and disable,
and do what they should do intuitively.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/15
2026-05-27 17:27:11 +02:00
Christos Margiolis a0011c74f8 sound: Expose EQ by default
The dev.pcm.%d.eq* sysctls and mixer "bass" and "treble" controls are
exposed only if hint.pcm.%d.eq is set. However, there is no good reason
why we shouldn't at least expose the controls, and let the user
enable/disable/bypass equalization through the sysctl.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/15
2026-05-27 17:27:11 +02:00
Harry Moulton 7bb6b62394 arm64: mte: copy/save tags on copy-on-write
On a copy-on-write, copy the memory tags from the source pages to the
destination pages so the forked process can continue to use MTE.

Reviewed by:	andrew
Sponsored by:	Arm Ltd
Signed-off-by:	Harry Moulton <harry.moulton@arm.com>
Differential Revision:	https://reviews.freebsd.org/D55955
2026-05-27 16:22:26 +01:00
Harry Moulton bb9497a2d4 arm64: Add vm_page_t MTE flags
To track which pages have MTE tags. Add a flag field to md_page. We
can then use this in MD code to mark which pages have MTE tags.

Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D55954
2026-05-27 16:22:26 +01:00
Andrew Turner d63a62fb35 arm64: Add support for per-page flags
We need to store some extra information about a page, e.g. the state of
the MTE tags. Add a MD flags field to each page.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D55953
2026-05-27 16:22:25 +01:00
Andrew Turner 5cb511e627 arm64: Check for MTE tag failures on kernel entry
When entering the kernel from userspace we need to check for MTE tag
failures when using asynchronous MTE. This is done by checking if either
tag fault check types that have asynchronous checks are enabled, and
if so check the register the result is stored. It then sets a flag the
kernel can later use to raise a signal.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D55952
2026-05-27 16:22:25 +01:00
Andrew Turner 5a6ae4230b arm64: Manage the MTE state like pointer auth
Add the same group of functions we use to manage pointer authentication
in userspace threads.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D55951
2026-05-27 16:22:25 +01:00
Andrew Turner a780d21eab arm64: Support changing the DMAP memory type
When MTE is enabled we will use the DMAP to manage tags. To be able to
read/write them we need to change the memory attribute to
VM_MEMATTR_TAGGED.

Support changing the DMAP memory type to values known to have
equivalent cache properties.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D55949
2026-05-27 16:22:25 +01:00
Andrew Turner 48da01ad0b arm64: Add a comment about HWCAP values
They must be identical to Linux. Document this requirement to allow
userspace to depend on this.

Sponsored by:	Arm Ltd
2026-05-27 16:22:25 +01:00
John Baldwin 4f876cec30 riscv64: Move pcb out of kstack into a new UMA zone
Similar to arm64, riscv's pcb embeds a copy of the floating point
registers and is too large to store directly in struct mdthread as is
done on amd64.  Instead, use a separate UMA zone for pcbs.  riscv's
floating point state is not as large as arm64's, so its pcb is also
somewhat smaller and a single 4k page can hold 6 pcbs.

Reviewed by:	kib, jrtc27
Sponsored by:	AFRL, DARPA
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
2026-05-27 09:45:26 -04:00
John Baldwin d0b10df718 arm64: Move pcb out of kstack into a new UMA zone
This is similar to commit 5e921ff49e
which moved the pcb for amd64, but a bit different.  arm64's pcb is
much larger (over 1KB!) than amd64's since it still embeds FP
registers.  Moving the pcb out of the kstack frees up that much
additional kstack space.  Unlike amd64 however, embedding the pcb in
struct mdthread is not practical as the resulting struct thread would
grow such that UMA would now store 1 thread per 4k page instead of 2
threads per page.  By using a separate UMA zone for pcbs, 2 struct
threads can continue to fit in a single 4k page, and 3 pcbs can fit in
another 4k page.

Reviewed by:	kib, jrtc27, andrew
Sponsored by:	AFRL, DARPA
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
2026-05-27 09:45:26 -04:00
John Baldwin dcae0f7d7a sys: Consistently use ptoa() with td_kstack_pages
Suggested by:	kib
Reviewed by:	kib, andrew (arm changes)
Sponsored by:	AFRL, DARPA
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
2026-05-27 09:45:26 -04:00
John Baldwin 8b9023cfc1 sys: Add td_kstack_top inline helper function
This function returns a pointer to the top of the kstack.

Reviewed by:	kib, andrew (arm changes)
Sponsored by:	AFRL, DARPA
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
2026-05-27 09:45:26 -04:00
John Baldwin fce595344c arm64 locore: Fix a comment typo: Of -> If
Reviewed by:	kib, andrew
Sponsored by:	AFRL, DARPA
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
2026-05-27 09:45:26 -04:00
John Baldwin f7524d8fcb amd64: Inline set_top_of_stack_td into cpu_thread_new_kstack
Reviewed by:	kib
Sponsored by:	AFRL, DARPA
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
2026-05-27 09:45:25 -04:00
John Baldwin 2893bb741b cpu_thread_new_kstack: Introduce new MD callback
Previously, the cpu_thread_alloc callback was invoked each time a
kernel stack was allocated for a thread.  This included thread
creation, but it was also invoked if a recycled thread had to allocate
a new kstack.  This means that cpu_thread_alloc could be called
multiple times for a single thread, but cpu_thread_free is only called
once.  Not only that, but the cpu_thread_alloc callback can't tell if
it is being invoked on a new thread object, or a recycled thread.
Calling *_alloc multiple times on an object is also atypical for
kernel APIs.

As a result of this confusion, amd64 was potentially leaking an XSAVE
buffer each time a new kstack was allocated for an existing thread,
since cpu_thread_alloc for amd64 always allocated a new XSAVE buffer.
In practice, this edge case is probably rare.  A process object needs
to be recycled where either the new or old process is a kernel process
with a non-default kernel stack size.

Nevertheless, to ease the confusion, redefine cpu_thread_alloc to only
be called once when a new thread is allocated.  The new callback,
cpu_thread_new_kstack is invoked each time a kstack is allocated for a
thread, including both at thread creation time and if a recycled
thread allocates a new kstack.  The new callback should set any fields
whose value is dependent on td_kstack (e.g. the user frame in
td_frame, or td_pcb if the PCB is allocated on the kstack).

Reviewed by:	kib, andrew (arm changes)
Sponsored by:	AFRL, DARPA
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
2026-05-27 09:45:22 -04:00
John Baldwin 59d67f2868 amd64/i386: Remove dead code to clear XSAVE header
If XSAVE is being used, the XSAVE header will be overwritten either by
copying it from the parent thread in copy_thread for user threads, or
by a fresh copy from fpu/npx_initialstate on the first use of the FPU
for kernel threads.

Reviewed by:	kib
Sponsored by:	AFRL, DARPA
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
2026-05-27 09:43:46 -04:00
John Baldwin 187b46e1c4 cpu_fork: Remove redundant assignments to td_pcb and td_frame
cpu_thread_alloc() already sets these fields anytime td_kstack changes.

Reviewed by:	kib, andrew (arm changes)
Sponsored by:	AFRL, DARPA
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
2026-05-27 09:43:43 -04:00
John Baldwin 860aaecf1b amd64: Don't set an initial FPU state save size
This used to be needed to initialize the pcb pointer when the pcb was
allocated on the kstack.

Reviewed by:	kib
Sponsored by:	AFRL, DARPA
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
2026-05-27 09:43:40 -04:00
John Baldwin d01e5afbbf arm64: Remove unneeded declaration from <machine/pcpu.h>
Reviewed by:	kib, andrew
Sponsored by:	AFRL, DARPA
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
2026-05-27 09:43:37 -04:00
Alfredo Mazzinghi a1e07f21dc arm64: Adjust the kernel stack pointer at the end of fork_trampoline
All other paths that return from the kernel to userspace pop the user
trapframe off of the kernel stack pointer before returning to
userspace in restore_registers.  fork_trampoline was missing this, so
all of the user faults after fork pushed another trapframe leaving a
trapframe's worth of wasted space on the kstack.

This would be fatal after a future change to remove duplicate
initialization of td_frame in cpu_fork() as without this fix each time
a thread was recycled it would "lose" another trapframe's worth of
space.

Reviewed by:	kib, andrew
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
2026-05-27 09:43:09 -04:00
Mark Johnston bd15d6ef12 libarchive: Force GNU iconv compatibility on FreeBSD
When libarchive is compiled with FreeBSD's native iconv instead of
libiconv, as happens with libarchive in the base system, we need to
configure iconv(3) to handle invalid sequences by returning -1, as
iconv_strncat_in_locale() assumes GNU iconv semantics.

This corresponds to upstream PR 3056.

PR:		294577
MFC after:	1 week
2026-05-27 15:10:57 +02:00
Dag-Erling Smørgrav e9346d1d13 login.conf(5): Add missing resource limits
While here, reorder the table.

PR:		295618
MFC after:	1 week
Reviewed by:	olce
Differential Revision:	https://reviews.freebsd.org/D57258
2026-05-27 15:10:35 +02:00
Aymeric Wibo 7a11a6c64d acpi: Update mentions of s2idle in comments
We use the explicit "suspend-to-idle" name now.

Sponsored by:	The FreeBSD Foundation
2026-05-27 09:47:14 +01:00
Aymeric Wibo 071d82d997 acpi.4: Update sysctl descriptions with new stype names
Sponsored by:	The FreeBSD Foundation
2026-05-27 09:44:44 +01:00
Tom Jones e4328c1398 acpi: Update s2idle strings to new name
Reviewed by:	obiwac, emaste, olce
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57232
2026-05-27 09:16:49 +01:00
Haoxiang Li f0e702a7a2 smbfs: plug smbfs_node_alloc() leak of name buffers when insmntque() fails
PR:	295577
MFC after:	2 weeks
2026-05-27 11:09:31 +03:00
Jose Luis Duran f1de8e3511 nanobsd: Register the boot.config file in the metalog
Ensure that the boot.config file gets an entry in the metalog by
tgt_touch()ing it.  If a file is not present in the metalog, it gets
excluded from the final image when using "-U" (unprivileged builds).

MFC after:	2 weeks
2026-05-27 00:25:10 +00:00
Jose Luis Duran 5435998230 nanobsd: Adjust the order of the flags in makefs
The order of the flags matter in makefs(8). The -t (type) flag must come
before the -o (options) flag; otherwise, the options are reset.

Move the -t flag before the -o flag and remove the shim function
_xxx_adjust_code_size() that was created to align to the default makefs
FFS values.

It effectively prevented us from generating NanoBSD images using
unprivileged builds with the partitions internally aligned as intended.

Reviewed by:	senguptaangshuman17_gmail.com, imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57226
2026-05-27 00:24:26 +00:00
Jose Luis Duran c579927ac5 nanobsd: Use makefs -R flag to honor rounded sizes
Switch from the min/max size flag (-s) to the round-up flag (-R) when
invoking makefs(8).

Because the partition sizes passed to nano_makefs have already been
rounded up by calculate_partitioning(), using -s can cause makefs to try
to perform sizing adjustments that usually result in failures.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57225
2026-05-27 00:23:46 +00:00
Jose Luis Duran ca2d4026c3 nanobsd: Fix code image size formatting
mkimg(8) parses sizes using expand_number(3).  It is an error to use "b"
as a suffix.  This is the result of a confusion with makefs(8), which
uses NetBSD's strsuftoll(3).

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57224
2026-05-27 00:23:05 +00:00
Jose Luis Duran 87150a2ed1 nanobsd: Refactor secondary code partition logic
Rearrange the conditional logic for building the secondary code slice
(altroot).

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57223
2026-05-27 00:22:39 +00:00
Jose Luis Duran 318a85d4b2 nanobsd: Explicitly set image size and secsz in mkimg
When building an unprivileged NanoBSD image, explicitly set the desired
image size, by passing --capacity to mkimg in bytes, and the logical
sector size (-S) to 512 bytes.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57222
2026-05-27 00:21:57 +00:00
Jose Luis Duran f1de49f508 nanobsd: Offset code partition to a track boundary
Ensure the primary and secondary code partitions start at a proper track
boundary by applying a NANO_SECTS offset in bytes.

While track-boundary alignment is largely obsolete on modern storage,
this change maintains compatibility with current images (legacy).  A
future commit will transition to 1 MiB alignment boundaries.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57221
2026-05-27 00:15:39 +00:00
Jose Luis Duran dadbbccd80 nanobsd: Account for metadata overhead in code slice
The code slice size (CODE_SIZE) includes 16 sectors reserved for disk
metadata (see bsdlabel(8) offset).  Subtract these 16 sectors from the
total size passed to nano_makefs.

This prevents the generated filesystem from consuming the entire slice
allocation, ensuring there is enough space for the metadata without
overflowing the partition boundary.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57220
2026-05-27 00:14:56 +00:00
Jose Luis Duran beddf2c591 nanobsd: Use rounded sizes for cfg and data slices
Use the calculated (rounded up) cfg and data sizes from the
_.partitioning file, instead of consuming them directly from the global
variables.  We obtain the size of the cfg and data slices by explicitly
searching for index 3 and 4 respectively in the _.partitioning file.

This ensures that the final image has the rounded-up sizes, and not the
raw sizes.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57219
2026-05-27 00:14:09 +00:00
Jose Luis Duran d2a9ad033c nanobsd: Remove spurious exit call
Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57217
2026-05-27 00:13:47 +00:00
Jose Luis Duran 9d133c7640 nanobsd: Get the code size by its partition index
Previously the code was assumed to be on the on the first line of the
_.partitioning file.  Instead, explicitly look up the size by its
partition index to make the parsing order-independent.

The _.partitioning file:

1. First column: starting sector.
2. Second column: size in 512-byte sectors.
3. Third column: partition index.

Get the code size by explicitly selecting when the partition index is 1.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57216
2026-05-27 00:13:15 +00:00
Jose Luis Duran 689f7466c1 nanobsd: Use NANO_IMG1NAME
Do not hard-code _.disk.image, use NANO_IMG1NAME instead.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57040
2026-05-27 00:12:48 +00:00
Jose Luis Duran 1dac971fbd nanobsd: Minor style fixes
- Use $(...) notation instead of legacy backticked `...`
- Use tabs for indentation
- Indent continuation lines with 4 spaces

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57039
2026-05-27 00:12:07 +00:00