LinuxKPI: page pool updates and add to the build
Split implementation out from the header files.
This "page pool" is the very minimalistic version we need in order to
support packets on mt76.
We allocate the page pool in order to have the meta data available of
which we only make limited use.
This implementation does no pooling, it does no page fragments for now,
it always hands out a full page and frees it upon return.
It is written in a way that it can be in the tree before the 'struct page'
work it depends on has landed in order to reduce friction for people who
want to try mt7921 (or others later) upfront. We use the same #ifdef
as in the struct page work for that reason so one knob will turn everything
on or off.
Once the struct page work has landed and settled we can start filling this
with more complexity.
[8 lines not shown]
LinuxKPI: page.h: resort lines
Two of the "page macros" can be abstracted elsewhere in the upcoming
struct page work, so sort them away from the four which are here to
stay.
No functional change.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D58299
LinuxKPI: page.h: use atop() and ptoa() instead of PAGE_SHIFT
With upcoming changes to 'struct page' this will make the lines
easier to read by using the predefined macros from param.h.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: markj, kib
Differential Revision: https://reviews.freebsd.org/D58298
LinuxKPI: prefer struct page [*] over struct vm_page[_t]
LinuxKPI is based on Linux 'struct page' which is currently aliased
to struct vm_page. Upcoming changes may change that so start using
'struct page *' instead vm_page_t to make future changes transparent.
This is a continuation of 9e9c682ff3a1 and should be a NOP.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste (no objections)
Differential Revision: https://reviews.freebsd.org/D58297
LinuxKPI: move clear_page() within the linux/page.h file
clear_page() would normally live in asm/page.h but adding the file
and fixing the dependencies would be too much for a single line.
Move the function to the end of the file with a clear separator
and make it clear that it does not operate on a 'struct page'
but on a page address by changing the argument name and leaving
a comment.
The function is currently used by at least mthca(4) as the only
in-tree consumer, and drm-kmod ttm_pool.c.
No functional changes.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D58296
LinuxKPI: pci: fix dma handle type in match function
dma_addr_t is a vm_paddr_t which is a uint of some width. Rather than
passing pointers of it around pass the value.
Comparing the addresses of different storage for the same dma handle
(the actual bug here) will not work when passed to the devres match
function.
Sponsored by: The FreeBSD Foundation
Fixes: 0a575891211ef ("implement dmam_free_coherent()")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D58285
uvideo: Return actual mtx_sleep error in dqbuf
Don't coerce errors to EINVAL, which isn't correct for mtx_sleep's
failure cases.
Sponsored by: The FreeBSD Foundation
sys: Import snapshot of Aquantia ACQ107 vendor driver
Obtained from https://github.com/Aquantia/aqtion-freebsd commit
c61d27b1d94af72c642deefa0595884481ea7377.
This is not using a vendor branch. The formerly-upstream repo is
abandoned and I do not believe it will receive updates. This initial
import serves as a snapshot of the vendor code, but from here we will
iterate on it in the tree as our own code.
Bug fixes, code cleanup, and build infrastructure will follow.
NetBSD and OpenBSD have derivatives of this driver (with additional
hardware support). We can look to changes in those drivers, and the
Linux driver, to add support here.
Reviewed by: adrian
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53813
[2 lines not shown]
aq(4): Port to IfAPI
Direct access to struct ifnet members is not possible in FreeBSD 15;
accessors must be used. These exist in all supported FreeBSD versions,
so we do not need to make this conditional.
(cherry picked from commit 4756f5ff8f10cdda925cab60c0b66606698e49ee)
aq(4): Remove #include of user header <unistd.h>
pause() has 2 different definition in unistd.h and sys/systm.h
(cherry picked from commit 14eb7ec7b7135ad1a3448590cbe70b1368b40ec7)
aq(4): Fix VLAN tag test
Previously emitted a compiler warning "warning: bitwise comparison
always evaluates to false."
Looking at the OpenBSD driver (which is based on this code) it looks
like the VLAN flag should be set if either of these bits is. In the
OpenBSD driver these are AQ_RXDESC_TYPE_VLAN and AQ_RXDESC_TYPE_VLAN2
rather than a magic number 0x60.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53836
(cherry picked from commit 8666fda1afb03b3a88e57a20d76da8e7910b6407)
aq(4): Remove unimplemented functions
aq_if_priv_ioctl and aq_if_debug have prototypes but are not yet
implemented. Just remove the commented-out DEVMETHODs and the unused
prototypes, to clear a build-time warning; the DEVMETHODs and prototypes
can be readded if / when they are implemented.
(cherry picked from commit 0156be41a1eb8e0408819466b912181aa7966df9)
vtfontcvt: Avoid dead store in add_char
The fallback glyph is stored at index 0, and does not need to be
inserted into a mapping.
Previously there was a dead store of add_glyph's return value for the
fallback case, which upset Clang's static analyzer. Now, cast the
return value to (void) to make it clear this is intentional.
Also change add_glyph's fallback parameter to a c99 bool to make its use
more clear.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57174
(cherry picked from commit b273481f2a840a05e4039655be99528e1fa9388c)
uvideo: fix step=0 infinite loop and int overflow in fbuf_size
Prevent infinite loop in uvideo_vs_negotiation() when a USB camera reports
step=0 in its continuous frame interval descriptor.
Cast fbuf_size calculation to uint64_t to avoid int overflow for large
width/height/bpp combinations.
Reported by: emaste
libsysdecode: add Netlink attribute decoding infrastructure
Introduce a generic Netlink attribute decoding framework based on
attribute decoder tables. The framework supports decoding primitive
attribute types as well as nested attributes and can be reused by
different Generic Netlink families.
Signed-off-by: Ishan Agrawal <iagrawal9990 at gmail.com>
Sponsored-by: Google LLC (GSoC 2026)
Reviewed-by: kp
Pull-Request: https://github.com/freebsd/freebsd-src/pull/2337
sound: Scale PCM secondary buffers by byte rate
The fixed 128 KiB secondary buffer cap dates from stereo-sized streams.
High channel-count or high sample-width OSS streams can consume most of
that budget in one graph quantum, leaving too little room for capture
catch-up or playback headroom.
Keep 128 KiB as the low-rate floor, but derive the effective soft-ring
cap from the channel byte rate, clamped to 4 MiB. Use that per-channel
cap when resizing the soft buffer and when clamping
SNDCTL_DSP_SETFRAGMENT requests.
Also clamp SNDCTL_DSP_LOW_WATER to the current soft-buffer size so an
impossible readiness threshold cannot make poll/select wait forever.
MFC after: 3 weeks
Reviewed by: christos
Differential Revision: https://reviews.freebsd.org/D58064
cuse: Fix server reference leak in cuse_client_open()
If the server is closing (or the device node is going away), or if
devfs_set_cdevpriv() fails, cuse_client_open() returns with the server
reference taken at the top of the function still held and the newly
allocated client still linked on pcs->hcli. Since cuse_client_free()
has not been registered as the cdevpriv destructor at that point,
nothing ever undoes this work: every open() that races the is_closing
window permanently leaks one server reference and one cuse_client.
A leaked reference is fatal on server exit: cuse_server_free()
busy-waits in an uninterruptible pause("W", hz) loop until pcs->refs
drops to 1, which now never happens, so the exiting server process
(e.g. virtual_oss(8)) is left wedged in state "D", immune to SIGKILL,
cuse.ko is pinned (kldunload hangs too), and only a reboot recovers.
Before 634e578ac7b0 the is_closing error path dropped the reference by
calling devfs_clear_cdevpriv(), which ran the cuse_client_free()
destructor. That commit moved devfs_set_cdevpriv() after the
[14 lines not shown]
snd_uaudio: Don't let an idle stream reprogram a shared UAC2 clock
Some UAC2 devices expose a single Clock Source entity that is shared
between their playback and capture interfaces (it appears in both the
output and input clock bitmaps). On such a device uaudio(4) programs
the sample rate for both directions when a stream starts. If playback
runs at a 44.1 kHz-family rate while the idle capture channel is left
at its 48 kHz-family default, the capture
SET_CUR(UA20_CS_SAM_FREQ_CONTROL) is issued after the playback one and
overwrites the rate on the shared clock. The device then runs at
~48 kHz while the playback stream carries 44.1 kHz data. Consuming
samples faster than they arrive, the device repeatedly runs out of
data, loses sync with the playback stream, and re-locks onto it
(audible dropouts, front-panel play/idle flicker). The 48 kHz family
is unaffected because both directions then agree on the rate.
Fix it in three parts:
- Add a shared-clock guard: before issuing SET_CUR to a clock id, if
[28 lines not shown]
icmp: Verify redirect gateway with fib-aware ifa selection
During call to `icmp_verify_redirect_gateway()` ensure using
fib-aware source address selection function.
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D58409
.git-blame-ignore-revs: Fix hash for sys/kern/kern_cpu.c whitespace changes
Really fill in the hash of the MFCed commit, removing the placeholder
I forgot to update before commit.
This is a direct commit to stable/14.
Fixes: 83e087e0ea21 (".git-blame-ignore-revs: sys/kern/kern_cpu.c whitespace changes")
Sponsored by: The FreeBSD Foundation
.git-blame-ignore-revs: Fix hash for sys/kern/kern_cpu.c whitespace changes
Really fill in the hash of the MFCed commit, removing the placeholder
I forgot to update before commit.
This is a direct commit to stable/15.
Fixes: bd13516d400b (".git-blame-ignore-revs: sys/kern/kern_cpu.c whitespace changes")
Sponsored by: The FreeBSD Foundation
acpi_cpu(4): Call ACPI_GET_FEATURES() on a reset 'features' variable
This is to prevent child drivers from using the features returned by
previous drivers (in an arbitrary order). None of the existing ones do
that, so this is purely defensive.
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 664ad9ac4c9047d29d5f37d43174e1b469e2ec80)
x86/local_apic.c: Fiddle with thermal LVT slot only if supported
The thermal LVT slot does not necessarily exist.
According to Intel's Software Developers Manual, for Intel processors
supporting 64-bit operation (amd64), probably even the earliest ones
should have a local APIC with such a slot (the slot was introduced with
Pentium 4 and Xeon processors according to the manual, and the 64-bit
implementation in some later versions of them). AMD's Architecture
Programmer's Manual also seems to imply that all AMD processors
supporting amd64 should have the slot too. So this change may not be
needed when i386's code is dropped, but it does not hurt to have it, and
it might ease possible MFCs.
Change the signature of lapic_enable_thermal() so that it can report
failure (if there is no local APIC or if there is no thermal LVT slot).
Reviewed by: bnovkov, kib
MFC after: 2 weeks
[4 lines not shown]
i386: provide PCPU pc_small_core for amd64 compat
Provide pc_small_core for i386 too to fix an i386 build break from x86
code referring to it. It won't be set.
Reviewed by: aokblast, kib
Fixes: 7b26353a59d6 ("hwpstate_intel: Disable package control on hybrid CPU")
Differential Revision: https://reviews.freebsd.org/D58335
(cherry picked from commit 29d15d658d175139196d821b123c30a5b58e135e)