Commit graph

154517 commits

Author SHA1 Message Date
Kirk McKusick
c2cd605e8c Get consistent updates for UFS superblocks.
Superblocks are written by Freebsd clients using the ffs_sbput()
routine (exported from the kernel in sys/ufs/ffs/ffs_subr.c). These
clients include the kernel, some geom modules, and system utilities
using libufs. Currently backward compatible updates of UFS superblocks
are done only when the kernel writes them. These updates should be
done whenever any call to ffs_sbput() is done. This commit moves
these UFS superblock compatibility updates from the kernel-specific
superblock update to ffs_sbput() so that all clients make these
compatibility updates when they write superblocks.

Reviewed-by:  kib
Tested-by:    Peter Holm
MFC-after:    1 week
Differential  Revision: https://reviews.freebsd.org/D49276
Sponsored-by: Netflix
2025-03-19 16:33:59 -07:00
Justin Hibbits
fe73eb441f powernv: Explicitly enable the facilities we support
Thus far we've relied on the firmware setting HFSCR correctly, enabling
all facilities.  However, it appears some recent firmwares do not.
Linux explicitly enables all facilities it supports (including
transactional memory, which new firmwares apparently do not enable), so
do the same here, explicitly enable all the facilities FreeBSD supports.

MFC after:	1 week
2025-03-19 18:35:17 -04:00
Justin Hibbits
0b663e0cee powerpc: Add Hypervisor Facility Unavailable handling
Treat Hypervisor Facility Unavailable as an illegal instruction in user
space.  This way programs that use facilities like transactional memory,
which will never be supported as it has been removed from the ISA, will
not crash the kernel.

Tested by:	pkubaj
MFC after:	1 week
2025-03-19 18:22:32 -04:00
Christos Margiolis
fc40132603 snd_hda: Support Intel Raptor Lake 0x7a50
PR:		276379
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	emaste, markj
Differential Revision:	https://reviews.freebsd.org/D49389
2025-03-19 19:18:37 +01:00
Navdeep Parhar
c22b297062 cxgbe(4): Add two new transceiver types.
Future firmwares will report these types to the driver.  These
transceivers work already but are misidentified as a different type.

MFC after:	1 month
Sponsored by:	Chelsio Communications
2025-03-18 11:36:00 -07:00
Stephen Hurd
0f684b5aec Disable HS200 on rockchip_dwmmc in attach
HS200 mode requires tuning, and there is no code to perform this
tuning at present.  Until there is, leave HS200 mode disabled.

Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D49400
2025-03-18 13:01:21 -04:00
Stephen Hurd
0832a409c2 Add driver for the RK3328 GPIO_MUTE pin
This is used in in the ROC-RK3328-CC to control a regulator.

Reviewed by:	manu
Differential Revision: https://reviews.freebsd.org/D49399
2025-03-18 13:00:19 -04:00
Bjoern A. Zeeb
b42c339c59 LinuxKPI: 802.11: CONFIG_PM_SLEEP / WoWLAN header adjustments
Sort out some (though not yet all) changes needed for CONFIG_PM_SLEEP
and respectively WoWLAN support (so we can compile it in).  This is
just one further step towards proper suspend/resume support.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-03-18 09:22:01 +00:00
Bjoern A. Zeeb
848fdcae03 rtw89: make wow.c compile
So far we have not compiled wow.c given we do not enable CONFIG_PM
yet.
Make the necessary file local adjustments to make the file compile
once further changes in LinuxKPI 802.11 code are comitted.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-03-18 09:22:01 +00:00
Bjoern A. Zeeb
52a43041d2 iwlwifi: make mvm/d3.c compile again
Given we currently do not ompile the file by default make it compile
again after the last vendor import.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-03-18 09:22:01 +00:00
Bjoern A. Zeeb
c8a6676eb6 LinuxKPI: 802.11: crypto pn lengths
Define the last missing PN length and for consistency use them
in struct ieee80211_key_seq (even though a 6 is a 6 is a 6).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-03-18 09:22:00 +00:00
Bjoern A. Zeeb
7513a0afe5 net80211: make use of IEEE80211_KEY_BITS for debug messages
Use %b with IEEE80211_KEY_BITS for the debug logging in
ieee80211_crypto.c rather than just printing the hex value, which
makes some of the messages more obvious and avoids having the header
file next to one at all times.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D49369
2025-03-18 09:21:57 +00:00
Bjoern A. Zeeb
db8ceb8e59 net80211: cleanup keyidx argument of ieee80211_notify_michael_failure()
Instead of passing -1 to the function in ieee80211_crypto_demic(),
use the defined IEEE80211_KEYIX_NONE.
net80211 uses ieee80211_keyix not u_int as type for the key index
internally.  Use that.  This also helps when printing the -1 unsigned
as it stays within the expected numerical scope and makes the debug
message more readable.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D49368
2025-03-18 09:21:47 +00:00
Bjoern A. Zeeb
0461600dea net80211: correct IEEE80211_KEY_BITS
Not only are some of the bits missing, \4 and following were also
off-by-one.  Correct that so we can use them instead of reading
hex numbers.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D49366
2025-03-18 09:21:31 +00:00
Mark Johnston
f506d5af50 uma: Avoid excessive per-CPU draining
After commit 389a3fa693, uma_reclaim_domain(UMA_RECLAIM_DRAIN_CPU)
calls uma_zone_reclaim_domain(UMA_RECLAIM_DRAIN_CPU) twice on each zone
in addition to globally draining per-CPU caches. This was unintended
and is unnecessarily slow; in particular, draining per-CPU caches
requires binding to each CPU.

Stop draining per-CPU caches when visiting each zone, just do it once in
pcpu_cache_drain_safe() to minimize the amount of expensive sched_bind()
calls.

Fixes:		389a3fa693 ("uma: Add UMA_ZONE_UNMANAGED")
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Reviewed by:	gallatin, kib
Differential Revision:	https://reviews.freebsd.org/D49349
2025-03-17 20:12:58 +01:00
Vladimir Kondratyev
027b93c2f5 acpi_asus_wmi(4): Handle TUF-specific hotkeys internally
- Cycle TUF laptop RGB mode on AURA key press
- Switch TUF 'Throttle Thermal Policy' with 'Fan' key

Sponsored by:	Future Crew LLC
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D48985
2025-03-17 18:45:14 +03:00
Vladimir Kondratyev
d5bf6a7245 acpi_asus_wmi(4): Add support for WMI event queue
Event codes are expected to be retrieved from a queue on at least some
models. Specifically, very likely the ACPI WMI devices with _UID ATK are
queued whereas those with ASUSWMI are not.

Sponsored by:	Future Crew LLC
MFC after:	1 month
Reviewed by:	mav
Differential Revision:	https://reviews.freebsd.org/D48984
2025-03-17 18:45:14 +03:00
Vladimir Kondratyev
f134662a1a acpi_asus_wmi(4): Improve keyboard backlight support.
- Fix maximal keyboard backlight level, Although Linux source code
  comment says that backlight level is encoded in 3 bits of data,
  actual code limits maximum level to 3.
- Add backlight(9) support for keyboard
- Turn off/on keyboard backlight on suspend/resume

Sponsored by:	Future Crew LLC
MFC after:	1 month
Reviewed by:	mav
Differential Revision:	https://reviews.freebsd.org/D48983
2025-03-17 18:45:14 +03:00
Vladimir Kondratyev
5e41194bfc acpi_asus_wmi(4): Add EVDEV support
Use input event device to export hotkey events.

Sponsored by:	Future Crew LLC
MFC after:	1 month
Reviewed by:	mav
Differential Revision:	https://reviews.freebsd.org/D48982
2025-03-17 18:45:14 +03:00
Cheng Cui
a8d2bccb87
tcp cc: use tcp_compute_pipe() for pipe in xx_post_recovery() directly
This follows up with commit 67787d2004, and obsoletes the non-default
pipe calculation from commit 46f5848237 nearly 25 years ago.

Reviewed by: rscheff
Differential Revision: https://reviews.freebsd.org/D49247
2025-03-17 09:00:50 -04:00
Warner Losh
b0375f78e3 usb-msctest: Be more conservative setting GETMAXLUN quirk
Only set the GETMAXLUN quirk when it causes an error, but don't set it
when it returns 0. Since we reset the device when we set any quirk, only
set this quirk when it generates an error so umass will avoid it. When
the command works, there's no reason for umass to avoid it at all.

MFC After: 1 week
Sponsored by: Netflix
2025-03-16 13:23:25 -06:00
Warner Losh
9ea38ca4a8 umass/quirk: Remove useless quirk for Transcend flash
I have several of these. They all work without these quirks (either the
auto quirk mechanism does the right thing, or a likely
soon-to-be-removed vendor catch-all does the right thing, or no probing
at all does the right hting).

Both PREVENT ALLOW and SYNCHRONIZE CACHE are (a) unimplemented but (b)
return the proper asc/ascq code so da just does the right thing, quirk
or no. This was a left-over from the days where you'd get scary error
messages, but we'd work just fine. Now that the scary error messages are
gone (and only a calm one under bootverbose), this can be deleted.

Sponsored by:		Netflix
2025-03-15 21:47:44 -06:00
Warner Losh
4804a461b5 umass/quirks: Remove nonsensical NO_GETMAXLUN quirks
We only try to do a GETMAXLUN query of BBB devices. If we're forcing the
device to be CBI, then it's not BBB. Delete the quirks from there. Also,
UFI devices are all CBI as well, so remove the quirk from there as well.
Confirmed this isn't needed with three different floppy disk drives I
have.

Sponsored by:		Netflix
2025-03-15 21:45:31 -06:00
Navdeep Parhar
011e3d0b8b cxgbe(4): Perform Conventional Reset instead of FLR on the device.
The driver uses bus_reset_child on its parent to reset itself but that
performs an FLR whereas the hardware needs a Conventional Reset[1] for
full re-initialization.  Add routines that perform conventional hot
reset and use them instead.  The available reset mechanisms are:
* PCIe secondary bus reset (default)
* PCIe link bounce

hw.cxgbe.reset_method can be used to override the default.  The internal
PL_RST is also available but is for testing only.

[1] 6.6.1 in PCI Express® Base Specification 5.0 version 1.0

MFC after:	1 month
Sponsored by:	Chelsio Communications
2025-03-15 18:16:42 -07:00
Doug Moore
b82d789759 vm_object: add getpages utility
vnode_pager_generic_getpages() and swap_pager_getpages_locked() each
include code to read a few pages behind, and a few pages ahead of, a
specified page range. The same code can serve each function, and that
code is encapsulated in a new vm_object_page function. For the swap
case, this also eliminates some needless linked-list traversal.

Reviewed by:	alc, kib
Differential Revision:	https://reviews.freebsd.org/D49224
2025-03-14 21:43:44 -05:00
Ed Maste
222c850503 kern.mk: Update SSP comment (not limited to GCC)
Sponsored by:	The FreeBSD Foundation
2025-03-14 16:21:34 -04:00
Colin Percival
55c3348ed7 acpi_pci: Add quirk for DELAY-after-EJ0
On some EC2 instances, there is a race between removing a device from
the system and making the PCI bus stop reporting the presence of the
device.  As a result, a PCI BUS_RESCAN performed immediately after
the _EJ0 method returns "sees" the device which is being ejected, which
then causes problems later (e.g. we won't recognize a new device being
plugged into that slot because we never knew it was vacant).

On other operating systems the bus is synchronously marked as needing
to be rescanned but the rescan does not occur until O(1) seconds later.

Create a new ACPI_Q_DELAY_BEFORE_EJECT_RESCAN quirk and set it in EC2
AMIs, and add a 10 ms DELAY between _EJ0 and BUS_RESCAN when tht quirk
is set.

Reviewed by:	jhb
MFC after:	1 month
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D49252
2025-03-14 11:35:35 -07:00
Bjoern A. Zeeb
4a4eee5533 iwlwifi: adjust a debug comment referring to a PR
A FreeBSD specific comment asked people to report to a PR if they see
this.  By now we got enough feedback and also left this in a release.
Simply point to the PR so people can check the status but not longer
ask to submit a report to the PR.

Sponsored by:	The FreeBSD Foundation
PR:		274382
MFC after:	3 days
2025-03-14 16:32:14 +00:00
Bjoern A. Zeeb
19df0c5abc LinuxKPI: make __kmalloc() play by the rules
According to Documentation/core-api/dma-api.rst kmalloc() is supposd
to provide physically contiguous memory. [1]

In order to guarantee that allocations are contiguous even if using
PAGE_SIZE or larger check the size and use contigmalloc if needed.
This makes use of 9e6544dd6e (and following) allowing free(9) to
also work for contigmalloced memory.

Sponsored by:	The FreeBSD Foundation
Pointed out by:	jhb [1]
Reviewed by:	jhb, emaste
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D46656
2025-03-14 16:24:52 +00:00
Bjoern A. Zeeb
a5c7b44d6a LinuxKPI: always use contig allocations in linux_alloc_kmem()
In linux_alloc_kmem() [used by *get_page*()] we always at least allocate
PAGE_SIZE and we want the allocation to be contiguous so it can be passed
to DMA.  Always use kmem_alloc_contig() and only change the low argument
depending on the GFP_DMA32 flag being given or not.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	jhb, dumbbell
Differential Revision: https://reviews.freebsd.org/D46661
2025-03-14 16:24:52 +00:00
Enji Cooper
d2a55e6a93 openssl: update ASM and version info for 3.0.16 import
MFC after:	1 week
MFC with:	0d0c8621fd
Differential Revision:	https://reviews.freebsd.org/D49297
2025-03-13 23:42:02 -07:00
Wei Hu
47f4137e44 mana: remove redundant doorbell in mana_poll_rx_cq()
With the last commit to refill the rx mbuf in batch, the doorbell
in mana_poll_rx_cq() becomes redundant. Remove it to save a few
microseconds spent in mmio call.

Reported by:	NetApp
Reviewed by:	Tallamraju, Sai
Tested by:	whu
Fixes:		9b8701b8 ("mana: refill the rx mbuf in batch")
MFC after:	3 days
Sponsored by:	Microsoft
2025-03-14 05:51:34 +00:00
Fabian Keil
f7856fe81d g_dev_orphan(): Return early if the device is already gone
The following panic was the result of running "cdcontrol eject" after
using the physical ejection key on the device before the tray was
actually ejected. So we have hardware racing software.

The device was loaded with a DVD.

Resulted in a NULL pointer dereference

g_dev_orphan() at g_dev_orphan+0x2e/frame 0xfffffe01eba0a9f0
g_resize_provider_event() at g_resize_provider_event+0x71/frame 0xfffffe01eba0aa20
g_run_events() at g_run_events+0x20e/frame 0xfffffe01eba0aa70
fork_exit() at fork_exit+0x85/frame 0xfffffe01eba0aab0
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe01eba0aab0

Avoid this possibility and return early of dev is NULL already.

PR:  215856
Reviewed by: imp (I've triggered this once or twice over the years too)
Sponsored by: Netflix
2025-03-13 17:20:00 -06:00
Christos Margiolis
68b6567d09 snd_hda: Patch Framework AMD 13th gen
Redirect sound to headphone jack when plugged in.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D49346
2025-03-13 22:51:45 +01:00
John Baldwin
f402078d09 device_pager: Assert that the handle is not NULL
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D49333
2025-03-13 12:57:40 -04:00
John Baldwin
00d78c5007 rwmlock/rwlock/sx: Print the pointer of destroyed locks in panic messages
Suggested by:	markj
Reviewed by:	kib, markj
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D49332
2025-03-13 12:57:06 -04:00
John Baldwin
a52a51a2d5 lockmgr/rmlock/rwlock/sx: Make various assertions more robust
Print pointers to locks instead of their names to avoid a nested panic
if the lock object is corrupted.

Reviewed by:	markj
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D49331
2025-03-13 12:57:06 -04:00
Gleb Smirnoff
c56e75390e inpcb: make sure we don't pass uninitialized faddr to in_pcbladdr()
This very theoretical edge case was discovered by Coverity, not sure if
it was introduced by 2af953b132 or was there before.

CID:			1593695
Fixes:			2af953b132
2025-03-13 09:53:40 -07:00
Gleb Smirnoff
5f42f87fc4 inpcb: in_pcbinshash() can't fail on connect(2)
CID:			1593687
2025-03-13 09:53:40 -07:00
Gleb Smirnoff
c78a14a2b8 inpcb: in_pcb_lport_dest() doesn't use lportp as input argument
This assignment just created false positive analyzer report.

CID:			1593692
2025-03-13 09:53:40 -07:00
Konstantin Belousov
e60f608eb9 Add sysctl kern.proc.kqueue
reporting registered events in the specified kqueue.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D49163
2025-03-13 18:09:35 +02:00
Konstantin Belousov
0a7c164d91 kern/sys_eventfd.c: fix includes
Remove redundant includes like sys/types.h and sys/param.h due to
sys/systm.h. Sort alphabetically.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D49163
2025-03-13 18:09:35 +02:00
Konstantin Belousov
480fc5b8e5 mlx5en: bump MLX5E_MAX_BUSDMA_RX_SEGS
This is needed to accomodate more data segments in wqes for 64K receive
mbuf chains.

Reviewed by:	Ariel Ehrenberg <aehrenberg@nvidia.com>, Slava Shwartsman <slavash@nvidia.com>
Sponsored by:	NVidia networking
MFC after:	1 week
2025-03-13 18:02:17 +02:00
Konstantin Belousov
016f40466a mlx5en: fix rq->wqe_sz usage
Define it as the size of the single data segment in wqe.

Reviewed by:	Ariel Ehrenberg <aehrenberg@nvidia.com>, Slava Shwartsman <slavash@nvidia.com>
Sponsored by:	NVidia networking
MFC after:	1 week
2025-03-13 18:01:59 +02:00
Konstantin Belousov
c2987d7876 mlx5: bump the max LRO packet size
The belief is that the 7*MCLBYTES limit was set to not hit the segment
limit for wqe busdma tag.  But with the current mbuf allocator it is not
possible, and even if it was, the corresponding wqe fill would simply
fail.

Reviewed by:	Ariel Ehrenberg <aehrenberg@nvidia.com>, Slava Shwartsman <slavash@nvidia.com>
Sponsored by:	NVidia networking
MFC after:	1 week
2025-03-13 18:01:36 +02:00
Konstantin Belousov
89491b1edb mlx5en: stop arbitrary limiting max wqe size
Since the times the driver accepts s/g receive buffers, there is no
sense in trying to use pre-existing mbuf clusters sizes.  The only
possible optimization is to use full page size if wqe size is greater
than MCLBYTES.

Reviewed by:	Ariel Ehrenberg <aehrenberg@nvidia.com>, Slava Shwartsman <slavash@nvidia.com>
Sponsored by:	NVidia networking
MFC after:	1 week
2025-03-13 18:01:17 +02:00
Konstantin Belousov
bc10238492 mlx5: overwrite only the echo reply timestamp from the last packet in LRO
Reviewed by:	Ariel Ehrenberg <aehrenberg@nvidia.com>, Slava Shwartsman <slavash@nvidia.com>
Sponsored by:	NVidia networking
MFC after:	1 week
2025-03-13 18:01:05 +02:00
Konstantin Belousov
7560ed3a6b mlx5: assert CQE structure size
Reviewed by:	Ariel Ehrenberg <aehrenberg@nvidia.com>, Slava Shwartsman <slavash@nvidia.com>
Sponsored by:	NVidia networking
MFC after:	1 week
2025-03-13 18:00:53 +02:00
Konstantin Belousov
903996760d mlx5: correct the predicate asserted in __predict_true()
Reviewed by:	Ariel Ehrenberg <aehrenberg@nvidia.com>, Slava Shwartsman <slavash@nvidia.com>
Sponsored by:	NVidia networking
MFC after:	1 week
2025-03-13 18:00:42 +02:00
Konstantin Belousov
efe9a3996e mlx5: recalculate tcp checksum for ipv6 hw lro coalesced packet
Reviewed by:	Ariel Ehrenberg <aehrenberg@nvidia.com>, Slava Shwartsman <slavash@nvidia.com>
Sponsored by:	NVidia networking
MFC after:	1 week
2025-03-13 18:00:27 +02:00