Commit Graph

307412 Commits

Author SHA1 Message Date
Andrew Turner 80b4129bef arm64: Optimise the repeated TLBI workaround
It has been reported that the overhead of repeating all TLBI
instructions is too large [1]. The Software Developer Errata Notices
(SDEN) for the relevant Arm CPUs have been updated so a single
"tlbi vale1is, xzr" followed by "dsb ish"  is sufficient to work around
the issues.

Replace the places we repeat TLBI instructions with the new sequence.

[1] https://lore.kernel.org/linux-arm-kernel/20260218164348.2022831-1-mark.rutland@arm.com/

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D55646
2026-03-05 15:13:30 +00:00
Andrew Turner 570b8b2575 arm64: Use a canonical address when TBI is enabled
When Top Byte Ignore (TBI) is enabled in a processor we need to pass
a canonical address to the vm subsystem.

Reviewed by:	alc, kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D55619
2026-03-05 15:13:30 +00:00
Ed Maste 5d757312ad build: Retire LLVM_CXXFILT option
The LLVM_CXXFILT option was added when we used ELF Tool Chain tools by
default.  ELF Tool Chain's c++filt failed to demangle some symbols, so
we added a special case to install LLVM's version and enabled it by
default.

The rest of the LLVM tools are now used by default, as of commit
9fa94e1c09 ("Turn on WITH_LLVM_CXXFILT by default").  Simplify the
build logic by removing a special case and just include llvm-cxxfilt
with the rest of the LLVM utilities.

Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55654
2026-03-05 09:43:46 -05:00
Bjoern A. Zeeb f68ebebd8a LinuxKPI: 802.11: change teardown order of disassoc and sta rm
In lkpi_sta_auth_to_scan() we remove the sta from the firmware
for everything supporting (*sta_state).

We used to run into issues here with iwlwifi in that we had to
use a specific order: set vif->cfg.assoc = false, .aid = 0,
then remove the sta, and then send the mac update as otherwise
we would either have the sta silently removed (if we run
(*bss_info_change) first and fail then or silently not have the
sta removed and upon sta add we would trigger the fw crash.

The order of events seem to have changed now and especially BE200
(iwlwifi/mld) is picky about this and would crash the firmware with
something like:

	iwlwifi0: 0x20103311 | ADVANCED_SYSASSERT
	iwlwifi0: 0x00000000 | umac branchlink1
	iwlwifi0: 0xC00808AA | umac branchlink2
	iwlwifi0: 0xD00D6E90 | umac interruptlink1
	iwlwifi0: 0x0108C504 | umac interruptlink2
	iwlwifi0: 0x00000000 | umac data1 (link_id? seen weird values there though)
	iwlwifi0: 0x00000006 | umac data2 (fw_sta_id)
	iwlwifi0: 0x00000001 | umac data3

if it would still think we were assoc.

So the new order is as one would have expected initially:
set assoc = false, aid = 0;  do the remaining bss_conf (vif/link) changes
and issue the (*vif_cfg_changed) / (*link_info_changed) or for older
drivers (*bss_info_changed).  That will tell the mac we are no longer
associated.  And only then remove the sta from the firmware.

Update the comment there along so we do have the paper trail as to when
and why this changed.

Tested on:	BE200, AX210 (11ac)
Tested on:	AX200. 9260, 8265, 3165 (11a)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-03-05 13:44:02 +00:00
Bjoern A. Zeeb 9592f563c3 LinuxKPI: 802.11: split (*bss_info_changed) up for more modern drivers
With the advent of MLO some of the updates (*bss_info_changed) would
have done are not per-link.  This had (*vif_cfg_changed) and
(*link_conf_changed) introduced which are used by iwlwifi, rtw89,
select mt76 drivers, and ath12k currently it seems.
A driver normally only supports on or the other set.

Factor out the call to (*bss_info_changed) into an internal function.
There split the options up depending on whether they are for the
vif or a link and leave a fallback to (*bss_info_changed) for older
drivers.

Add the mac80211 ops implementations for the two new calls along with
a currently unused backup option for (*bss_info_changed) for each
as I assume we will eventually call the directly rather than from the
internal wrapper function.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-03-05 13:44:02 +00:00
Bjoern A. Zeeb fa41408d60 LinuxKPI: 802.11: fix typo
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-03-05 13:44:01 +00:00
Bjoern A. Zeeb 760e0a18d3 iwlwifi: fixup link_id for certain cases
In iwl_mvm_mld_vif_cfg_changed_station() if we do not do MLO (which we
do not do yet at all), dtim_period is not yet set but asssoc is
(our common case) the link_id can become -1 as active_links is always
0 for the non-MLO case.

This leads to logging of a WARN;
Invalid link ID for session protection: 4294967295

Fixup the link_id if it is -1 to be 0.  This is the deflink link_id so
that should always be fine in this case.

For Linux 7.0-rc2 that code is already gone so this is a local temporary
stopgap measure for the mvm-mld devices (e.g., some AX210).

Sponosred by:	The FreeBSD Foundation
MFC after:	3 days
2026-03-05 13:44:01 +00:00
Bjoern A. Zeeb 9b03cc2a70 net80211: sta: use IEEE80211_STATUS_SUCCESS instead of magic 0
Rather than using the status != 0 check use the way more descriptive
status != IEEE80211_STATUS_SUCCESS definition.  This makes it a lot
more clear what is checked here.  While here add a comment in case
aof the (Re)Assoc Resp failure as we do not update state in that case
but rely on a timeout which will bounce us back to State 1
(cf. 802.11-2024, Figure 11-23) which means SCAN in our case, rather
than possibly moving us back to AUTH.  We will likely have to revisit
this when SAE hits the tree.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D55643
2026-03-05 13:44:00 +00:00
Olivier Cochard 9f71153aec carp: fix global demotion counter to VRRP advertisements
When net.inet.carp.preempt=1 and a physical interface goes down, the global
V_carp_demotion counter is incremented. For CARP this was already reflected in
outgoing advertisements via DEMOTE_ADVSKEW(), but VRRP sent the raw
sc_vrrp_prio unchanged, so demotion had no effect.

Add DEMOTE_VRRP_PRIO(), a macro analogous to DEMOTE_ADVSKEW():
It subtracts V_carp_demotion from the configured priority and clamps the result
to [0, 254]. Priority 0 is VRRPv3's "resign" signal and causes backups to
preempt immediately. Priority 255 (IP address owner) is never demoted.

Reviewed by:	kp
Approved by:	kp
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D55558
2026-03-05 12:02:20 +01:00
Brooks Davis 4dd517acb6 libc/armv7: remove default version for alloca
The alloca() interface has been a macro expanding to __builtin_alloca()
since 2003 (commit 79806b4cdc, included in FreeBSD 5.2).  Even before
that virtually every compiler version I was able to test replaced
alloca() with compiler generated code when targeting C.

Hide it to prevent future (mis)use.

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D51858
2026-03-05 10:34:47 +00:00
Brooks Davis db1ecd5854 getnetconfig: make nc_error a thread local variable
Remove a bunch of complexity at the cost of 4 bytes of storage per
thread.

Reviewed by:	jhb
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D55310
2026-03-05 10:30:30 +00:00
Brooks Davis ea9bc84658 cirrus-ci: move package_check after test
Liveness is often more important than minor packaging glitches (which
might well be the fault of a prior commit.)

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D55481
2026-03-05 10:23:51 +00:00
Jari Sihvola d3eaa40282 riscv: save FPE state in cpu_fork().
Save the Floating Point Extension (FPE) state before copying struct pcb.

Reviewed by:	br
Differential Revision:	https://reviews.freebsd.org/D53804
2026-03-05 09:00:23 +00:00
Ruslan Bukin dff2758b5f static dtb: add BTI note
Add BTI note to fdt_static_dtb.o
- resolves "Branch Target Exception" panic on FDT systems with static DTB
  due to missing landing pads (bti note has to be in all object files used
  for linkage)
- also required by bti_report linker feature

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D55636
2026-03-05 08:50:26 +00:00
Baptiste Daroussin 28ff4d35f8 libedit: vendor import version 2026-03-04
MFC After:	1 week
2026-03-05 08:17:51 +01:00
Baptiste Daroussin b1ddc060e9 libedit: import version 2026-03-04 2026-03-05 08:12:33 +01:00
Gleb Smirnoff 1abb62867f tests/net/bpf: skip the bpf:inject test when RSS is present
With RSS the epair(4) may reorder packets making the test flaky. See
net/if_epair.c:epair_select_queue().
2026-03-04 20:04:11 -08:00
Gleb Smirnoff 78843218b0 rss: manifest RSS option in kernel with kern.features sysctl 2026-03-04 20:01:22 -08:00
Gleb Smirnoff d4083fb836 tests/net/bpf: hexdump(3) the packets if compare fails 2026-03-04 19:57:59 -08:00
Gleb Smirnoff 776604651e hpts: remove call into TCP HPTS from userret()
This hack introduced in d7955cc0ff and e3cbc572f1 proved to have more
ill side effects than benefits.  Sorry for that.

Now the HPTS soft clock is called only after the LRO completion.  Refactor
HPTS module linkage to address that and share the pointer only between
HPTS and LRO.

Reviewed by:		Nick Banks
Differential Revision:	https://reviews.freebsd.org/D55640
2026-03-04 19:16:00 -08:00
Majed Alkhaleefah 2f440158c6 hid: Fix 'strenght' typo in hpen.c
Reviewed by:	wulf, obiwac
Approved by:	wulf, obiwac
Fixes:	d97d5c0ce8 ("hid: Import hidmap-based drivers written by Greg V")
Differential Revision:	https://reviews.freebsd.org/D55626
2026-03-05 00:41:57 +01:00
Gleb Smirnoff c5c54f7d21 hpts: remove no longer relevant comment 2026-03-04 13:35:29 -08:00
Gleb Smirnoff df97a58afd inpcb: use correct label name in a comment 2026-03-04 13:35:07 -08:00
John Baldwin 00ff89c1e0 acpi: Treat ACPI_IVAR_FLAGS as a global IVAR
The ACPI bus uses the flags IVAR for any device with a _PRW method
including devices such as PCI bridges/devices that are not direct
children of acpi0.

Reported by:	ngie
Reviewed by:	ngie
Fixes:		0bb867e9f5 ("acpi: Split ACPI IVARs into global and private sets")
Differential Revision:	https://reviews.freebsd.org/D55561
2026-03-04 15:19:48 -05:00
Ed Maste 858f53dd43 Makefile.inc1: Don't force LLVM_BINUTILS off for cross-tools
Because of this setting we were still using ELF Tool Chain tools for
buildworld.  The sets of binary utilities are largely equivalent and
this went unnoticed after commit 1cae7121c6 ("Enable LLVM_BINUTILS
by default").

This was discovered recently because ELF Tool Chain objcopy produces
standalone debug files without phdrs and this caused an issue with a
3rd party ELF parser [1].  Remove the forced setting so that we use
LLVM's binutils to build the system.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=33876

Reviewed by:	imp, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55650
2026-03-04 14:10:48 -05:00
Christos Longros 71e8b32415 src.conf.5: Fix "incompatibility" typo
MFC after:	3 days
Reviewed by:	ziaee
Signed-off-by:	Christos Longros <chris.longros@gmail.com>
Closes:		https://github.com/freebsd/freebsd-src/pull/2035
2026-03-04 13:32:33 -05:00
Ed Maste c9f3de0ba9 INIT_ALL: Fix typo in option description
From GitHub pull request #2035; the change needs to be applied to the
source file for the option description, not the generated src.conf.5.
2026-03-04 13:32:32 -05:00
Christos Margiolis d15987cc06 virtual_oss(8): Expose ioctl interface
PR:		293545
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-03-04 19:06:17 +01:00
Hans Rosenfeld 4dfeadc32e bhyve/virtio-scsi: Check LUN address validity
Instead of blindly trusting the guest OS driver that it sends us well-
formed LUN addresses, check the LUN address for validity and fail the
request if it is invalid. While here, constify the members of the virtio
requests which aren't device-writable anyway.

Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D53470
2026-03-04 12:30:02 -05:00
Hans Rosenfeld 2a514d377b bhyve/virtio-scsi: Preallocate all I/O requests
By preallocating all I/O requests on all queues, we can take most
allocations out of the hot I/O code paths and simplify the code
significantly. While here, make sure we check all allocations for
success and make sure to handle failures gracefully.

Additionally, check for I/O request validity as early as possible,
and return illegal requests immediately.

Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D53469
2026-03-04 12:30:02 -05:00
Hans Rosenfeld a28cf86c41 bhyve/virtio: Rework iovec handling functions for efficiency and clarity
Add check_iov_len() to check whether an iovec array covers a certain
length without the need to call count_iov() on the whole array first.

Garbage-collect the 'seek' argument to buf_to_iov(), used only by
virtio-scsi control request handling. The apparent benefit of using it
to copy only the final status byte instead of the whole TMF or AN
request (25 and 21 bytes, respectively) is dubious at best, given that
the extra code to handle this in buf_to_iov() allocates and frees a new
iovec array and uses seek_iov(), which traverses the whole array and
copies iovecs around.

Replace seek_iov() and truncate_iov(), used only by virtio-scsi, with
a single function split_iov() which combines the functionality of both
in a more efficient way:
While seek_iov() always copies all iovecs past the seek offset into a
new iovec array, split_iov() works in place and doesn't copy iovecs
unless actually necessary. By using split_iov(), we can avoid almost
all copying of iovecs in I/O handling code paths of virtio-scsi.

Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D53468
2026-03-04 12:30:02 -05:00
Andrew Turner d1650d2262 arm64/vmm: Support PMU v3p9
The only new register is read-only. As the kernel just passes the
registers to the guest directly no further change should be needed.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D51764
2026-03-04 17:10:52 +00:00
Kajetan Puchalski e40e545861 arm64: Treat the PMUVer field of ID_AA64DFR0 as unsigned
The PMUVer field of ID_AA64DFR0 contains an unsigned version of the
Performance Monitors Extension, but it is currently treated as signed.
Change it to unsigned.

Reviewed by:	andrew
Sponsored by:	Arm Ltd
Signed-off-by:	Kajetan Puchalski <kajetan.puchalski@arm.com>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2062
2026-03-04 17:10:52 +00:00
Seth Hoffert 36acf1bd32 pfctl: consistency
% pfctl -F ethernet
Ethernet rules cleared

% pfctl -s ethernet
pfctl: Unknown show modifier 'ethernet'

pfctl accepts 'ethernet' (or any prefix of it) in the -F flag but
accepts only 'ether' (or any prefix of it) in the -s flag, which seems
inconsistent.  This change brings the two to parity while remaining
backwards compatible.

Reviewed by:	kp
MFC after:	2 weeks
Signed-off-by: Seth Hoffert <seth.hoffert@gmail.com>
2026-03-04 17:20:34 +01:00
Aymeric Wibo bc3914737b bus_if: Fix typo
Reviewed by:	olce
Approved by:	olce
Fixes:	4c4392e791 ("Add doxygen doc comments for most of newbus and the BUS interface.")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D48721
2026-03-04 16:48:11 +01:00
Aymeric Wibo 2c60fce365 amdsmu: Sleep entry/exit hints for PMFW
amdsmu_suspend() and amdsmu_resume() for sending hints to the AMD SMU
power management firmware (PMFW) that we are entering and exiting
s2idle. We also dump sleep metrics once we tell it we're exiting sleep,
so the relevant metrics are updated.

Register these as acpi_post_dev_suspend and acpi_post_dev_resume
eventhandlers.

Reviewed by:	olce
Approved by:	olce
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D48721
2026-03-04 16:38:57 +01:00
Dag-Erling Smørgrav 40e52e0edd system(3): Unwrap execve()
There is no need to call execl(), which will allocate an array and copy
our arguments into it, when we can use a static array and call execve()
directly.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55648
2026-03-04 16:22:42 +01:00
Michael Tuexen 3d69387ece tcp: improve NOINET builds
Reported by:	bz
MFC after:	1 week
Sponsored by:	Netflix, Inc.
2026-03-04 15:18:58 +01:00
ShengYi Hung 546d925cb4 ichwd: Add manual for i6300esb watchdog
Reviewed by:    ziaee, mhorne
Approved by:    lwhsu (mentor)
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54466
2026-03-04 21:51:13 +08:00
Bjoern A. Zeeb 31c3cba807 LinuxKPI: pass attrs in more places in dma-mapping.h
Various macros (dma_map_sg_attrs, dma_unmap_sg_attrs,
dma_map_single_attrs, and dma_unmap_single_attrs) currently supress
passing on the attrs argument.  Their implementation (even though at
times still marked the argument __unused; we remove that) have long
gained support for handling the argument.
With ofed fixed (5edf24aac1), pass the argument through so that
other drivers using these functions may hopefully work just a bit
better as well.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D55391
2026-03-04 08:23:22 +00:00
Bjoern A. Zeeb 8f532c7b25 LinuxKPI: 802.11: improve prep_tx_info
Over time struct ieee80211_prep_tx_info has grown further fields.
One which is becoming mandatory is the subtype (of the mgmt frame).
iwlwifi(mld) has a WARN for it if it does not match, so we now have
to set this for proper operation.  In addition we are tyring to improve
the situation of setting/unsetting (prepare_tx/complete_tx) in various
states and cleanup the use of other fields but link_id which we now
leave as a marker for the future everywhere.
The general problem we are facing is that our hook surface in this case
is the state machine but likely would have to be tx/rx mgmt frames but
we would alos have to driver the TX queues from there which is tricky.
The long-term answer is to change net80211.

Further the hardware flag DEAUTH_NEED_MGD_TX_PREP is dead and was
removed again in favour of leting drivers deal with it.  iwlwifi(mvm)
likely being the only driver which ever used this.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-03-04 08:21:41 +00:00
Bjoern A. Zeeb 3d3303b756 LinuxKPI: 802.11: move linuxkpi_ieee80211_handle_wake_tx_queue()
No functional changes.  Just moved the function within the file.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-03-04 08:21:41 +00:00
Bjoern A. Zeeb fa0f891d54 LinuxKPI: 802.11: fix typo
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-03-04 08:21:41 +00:00
Eugene Grosbein f69eab727e me.4: note that it is a point-to-point interface
Add explicit note that me(4) works as a point-to-point pseudo device.

MFC after:	1 week
2026-03-04 15:06:05 +07:00
Eugene Grosbein 46ba263d6e me.4: link if_me kernel module to its manual page.
MFC after:	1 week
2026-03-04 14:29:26 +07:00
Olivier Cochard 4d876fc5fc acpi_spmc: fix revision check reading name as integer
In acpi_spmc_get_constraints_spec(), the revision of the device
constraint detail package was mistakenly read from
constraint_obj->Package.Elements[0], which is the device name
(a string), instead of from the detail sub-package's first element.

Move the initialisation of 'detail' before the revision check and
read the revision from detail->Package.Elements[0] as the comment
already states

Approved by:	obiwac
Differential Revision:	https://reviews.freebsd.org/D55639
Sponsored by:	Netflix
2026-03-04 00:08:23 +01:00
Kyle Evans f268f95955 libutil: avoid an out-of-bounds read in trimdomain(3)
memchr(3) will happily believe we've passed in a valid object, but
hostsize could easily exceed the bounds of fullhost.  Clamp it down to
the string size to be safe and avoid UB.  This plugs a potential
overread noted in the compat shim that was just added.

Reviewed by:	des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D54623
2026-03-03 16:51:02 -06:00
Kyle Evans 7e70589b1b libutil: take a size_t in trimdomain()
INT_MAX is already larger than a reasonable hostname might be, but
size_t makes some of this easier to reason about as we do arithmetic
with it.  This would maybe not be worth it if we had to bump the
soversion because of it, but libutil does symbol versioning now so we
can provide a compat shim.

While we're here, fix some inconsistencies in argument names in the
manpage.

Reviewed by:	des
Obtained from:	https://github.com/apple-oss-distributions/libutil
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D54622
2026-03-03 16:51:01 -06:00
Tuukka Pasanen 5778700fb8 diff3: Add SPDX-License-Identifier tag
Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55462
2026-03-03 14:43:21 -05:00
Siva Mahadevan f26cb4757e LinuxKPI: avoid -Werror=unused-value in sort() from BUILD_BUG_ON_ZERO()
The BUILD_BUG_ON_ZERO() macro returns an (int)0 if it does not fail
at build time. LinuxKPI sort() has it as a guard for an unsupported
argument but ignores the return value.

This leads to gcc complaining:

/usr/src/sys/compat/linuxkpi/common/include/linux/build_bug.h:60:33: error: statement with no effect [-Werror=unused-value]
   60 | #define BUILD_BUG_ON_ZERO(x)    ((int)sizeof(struct { int:-((x) != 0); }))
      |                                 ^
/usr/src/sys/compat/linuxkpi/common/include/linux/sort.h:37:9: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
   37 |         BUILD_BUG_ON_ZERO(swap);                        \
      |         ^~~~~~~~~~~~~~~~~
/usr/src/sys/contrib/dev/rtw89/core.c:2575:9: note: in expansion of macro 'sort'
 2575 |         sort(drift, RTW89_BCN_TRACK_STAT_NR, sizeof(*drift), cmp_u16, NULL);

Change to BUILD_BUG_ON() for the statement version.

Reported by:	CI
Co-authored-by:	bz
Approved by:	emaste (mentor)
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D55634
2026-03-03 14:19:32 -05:00