5300 Commits
Author SHA1 Message Date
Xin LI b5cd411af6 i2ctinyusb: do not list i2ctinyusb.c twice in SRCS
The module Makefile named its only source file in both the SRCS= line
and the SRCS+= line that follows.  bsd.kmod.mk tolerates the duplicate
in a normal build, but when the kernel is built with -flto=thin the
linker sees the same bitcode object twice and refuses to link the
module ("Expected at most one ThinLTO module per bitcode file").

Fixes:		54e231b373
MFC after:	1 week
2026-11-02 19:00:58 -08:00
Kevin Bowling 6362e5068c tpm: Validate firmware interrupt routes and fall back cleanly
A host IRQ resource is not necessarily an LPC SIRQ selector.  Let the
frontend configure the route: ACPI uses the allocated _CRS interrupt and
_SRS when present, preserving the firmware selector, while ISA supplies a
separate, range-checked SIRQ.  Match trigger and polarity to the host route
and TPM capabilities, including opaque INTRNG resource mappings.
Pass the firmware descriptor unchanged to _SRS; apply the x86 ISA polarity
override only when computing the TPM mode.  ISA chips without rising-edge
support now poll instead of substituting a level mode for the host route.

For both FIFO drivers, require a complete GetRandom transport response and
a fresh DATA_AVAIL interrupt before selecting interrupt waits.  Perform
the test with polling before publishing the device, and repeat it after
resume.  During cold boot, defer the test and publication to an interrupt
configuration hook so the IRQ grace wait can sleep and the handler can run.
Drain the hook before teardown; failed deferred initialization remains
unpublished and can be detached safely.  Missing or failed routes release
the handler and IRQ resource;
TPM 1.2 handler-setup failure now also falls back to polling.

Use monotonic deadlines for TPM 1.2 locality, status and burst polling.
Keep lifecycle locality waits uninterruptible, propagate command signal
errors, and terminate transfers when the burst wait expires instead of
retrying a zero burst indefinitely.  Check VALID with the requested status
bits and retain bounded polling response retries.  Interrupt waits retain
their original single-timeout budget and error return.

Arm only DATA_AVAIL before GO.  Mask delivery on the first interrupt and
before relinquishing locality, preventing idle and repeated-source storms.
Bound interrupt sleeps so lost delivery can recover the current command
through polling.  Defer unexpected-source cleanup to a task that can
acquire locality, and drain it before destroying driver locks.  Preserve
an unread TPM 1.2 response when quiescing an already owned locality.

If the ithread cannot mask the TPM, yield for a tick with the host source
masked so a level storm cannot starve the command owner or cleanup worker.
Register INTR_SLEEPABLE | INTR_EXCL for both drivers, and reject firmware
shared routes before installing a handler.  Such routes now poll: FreeBSD
does not allow sleepable shared handlers.  Drain maskable events during
firmware programming without letting them validate or reject the IRQ test.

Retain the initial hardware-quiesce guarantee, including after _SRS:
initialization fails when delivery cannot be disabled, and a later unrecoverable
quiesce failure suspends command access.  Known TPM 1.2 NOINTS quirks and
the TPM 2.0 polling hint remain effective.  Frontends without an explicit
route method use polling.

Tested by:	jrm (tpm 1.2 tis)
MFC after:	2 weeks
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D59657
2026-10-30 15:01:53 -07:00
Ed Maste 83d0eed501 lan867xphy: New driver for Microchip LAN8670/1/2 10BASE-T1S PHYs
10BASE-T1S is a Single Pair Ethernet (SPE) standard, intended for
automotive and industrial applications.  It supports a multidrop "mixing
segment" of at least 25m with up to 8 nodes.

This driver currently does not support per-silicon-revision config or
PHY-Level Collision Avoidance (PLCA), but is sufficient for establishing
basic connectivity.

Device details are available in the "Microchip LAN8670/1/2 10BASE-T1S
Ethernet PHY Transceiver Datasheet".

Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D60979
2026-10-30 10:03:21 -04:00
Mir Saheb Ali 2c38dc04d6 rtwn: add support for the RTL8188FTV USB chipset
Add support for the RTL8188FTV chipset to rtwn(4)/rtwn_usb(4).

Differential Revision: https://reviews.freebsd.org/D60875
2026-10-27 19:57:07 -07:00
Andrew Gallatin ceb575553b arm64: enable ossl accelerated AES-GCM on arm64
Connect the baseline OpenSSL ARMv8 fused AES-GCM kernels to the OCF
ossl driver. Advertise the algorithm only when the system-wide capability set
includes both AES and PMULL.

Note that get_kernel_reg() is used to detect features such as PMULL
because the ossl device attaches before arm64 populates elf_hwcap when
ossl is built into the kernel or pre-loaded at boot.

Prefer OSSL over armv8crypto for AES-GCM sessions while retaining
armv8crypto as a fallback.

This provides about a 50% speedup for a Netflix ktls workload on a small
neoverse N1 board.

Reviewed by: markj
Constructive review feedback from: andrew, ngie
Differential Revision: https://reviews.freebsd.org/D60097
Sponsored by: Netflix
2026-10-20 15:07:39 -04:00
Abdelkader Boudih 44ceda0a53 acpi_apple: rename source files to match the driver name
The driver, module, kernel option and manual page are all named
acpi_apple, but the sources lived in sys/dev/apple_acpi/ with an
apple_ prefix. Every other vendor ACPI driver in the tree uses the
acpi_<vendor> form for both the directory and the file names.

No functional change.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D60792
2026-10-17 20:48:49 +01:00
Abdelkader Boudih d7d237ce73 acpi_apple: Apple platform ACPI driver,
handles wake-on-LAN arming and lid state on the PCH
PMC/GMUX platform instance, and panel backlight
control on the PNLF instance, registering with
backlight(9).

Reviewed by:	ziaee, adrian
Differential Revision:	https://reviews.freebsd.org/D58867
2026-10-15 14:03:22 +01:00
Ed Maste b80af977f1 mgb: Build module for all archs
It is not x86-specific.

This reverts commit e0a5aa37c1.
This reverts commit 2d935a1e93.

Reviewed by:	kbowling
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60615
2026-10-13 12:51:05 -04:00
Sumit Saxena 70d389bede f_bnxt: add kTLS (kernel TLS) TX offload
Add kTLS TX crypto offload, layered on MPC (crypto add/delete
commands submitted over its TCE channel) and TX completion coalescing
(shared tx_bd_opaque encoding).

Adds kTLS session lifecycle management, a key-context ID allocator,
HWRM key-context alloc/free with partition-mode support, and the TX
submit path: in-order packets go out on the normal iflib path with
CSUM_SND_TAG set, while out-of-order or retransmitted TLS records get
a presync command plus a replayed copy of the record built from the
driver's own replay ring. Also adds kTLS/MPC completion-time counter
sysctls and the max_ktls_entries tunable.

Reviewed by:    gallatin
MFC after:      2 weeks
Sponsored by:   Broadcom Inc.
Differential Revision:  https://reviews.freebsd.org/D58606
2026-10-09 08:24:43 +00:00
Sumit Saxena 42988358a9 if_bnxt: add bnxt_compat.h version-compat shim
Add bnxt_compat.h, a small __FreeBSD_version-gated compatibility
shim: if_getmtu()/if_name()/if_getsoftc()/if_getflags() fallbacks for
pre-1500000, and a config-task vs. config-gtask abstraction over the
iflib API split at 1403000. On this branch's FreeBSD version it also
unconditionally enables KTLS_IFLIB_SUPPORT/KTLS_REC_SEQ_NUMBER, which
the upcoming kTLS patch depends on.

Reviewed by:    gallatin
MFC after:      2 weeks
Sponsored by:   Broadcom Inc.
Differential Revision:  https://reviews.freebsd.org/D58604
2026-10-09 08:24:43 +00:00
Sumit Saxena 088a42c0ff if_bnxt: add MPC (Mid-Path Channel) ring infrastructure
Add MPC ring support: a pair of extra, driver-private
TX/completion/notification rings the firmware uses as a side-channel
for offload commands. The only current consumer is kTLS TX crypto
command submission; RCE/CFA channel types are not yet implemented by
any consumer.

Adds MPC ring allocation/teardown, HWRM ring alloc/free, a private
interrupt path for the MPC NQ ring, and the TX submit/completion
path. The RoCE-only IRQ table builder is split into a generic,
exported bnxt_populate_irq(softc, irq_count) that both MPC and RoCE
use, plus an incremental bnxt_populate_irq_roce() that grows the
table on top of whatever is already there, so IRQ rids stay
consistent regardless of attach order.

This patch does not link standalone: bnxt_mpc_cmp() calls into
kTLS's completion handler, added by a later patch.

Reviewed by:    gallatin
MFC after:      2 weeks
Sponsored by:   Broadcom Inc.
Differential Revision:  https://reviews.freebsd.org/D58603
2026-10-09 08:24:43 +00:00
Sumit Saxena f2c300112e if_bnxt: add RX timestamping support
Add PHC register mapping, RTC initialization, refclk read with
FW-reset serialization, and sbinuptime-based calibration to convert
the raw hardware timestamp carried in RX completions into an mbuf
timestamp. Advertise IFCAP_HWRXTSTMP, configure the RX timestamp
filter in bnxt_init(), and drain the calibration callout on stop.
Check HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED in
bnxt_hwrm_func_qcaps() so the capability bit PTP is gated on actually
gets set, without which PTP never armed on real hardware.

Reviewed by:    gallatin
MFC after:      2 weeks
Sponsored by:   Broadcom Inc.
Differential Revision:  https://reviews.freebsd.org/D58596
2026-10-09 08:24:42 +00:00
John Baldwin 228dd4eaae sys: Enable pcfclock.ko on all architectures
This driver has been in sys/conf/NOTES (and thus enabled in LINT
builds on all architectures) since the file was renamed from the i386
LINT and there is no i386-specific code in the driver.

Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D60177
2026-10-08 11:20:21 -04:00
Martin Matuska 34f9f5680c zfs: merge openzfs/zfs@1f380a4f3
Notable upstream pull request merges:
 #17864 e903655c5 zpool: Add zpool status -vv error ranges
 #18820 -multiple zdb: account pending DDT-log frees in leak detection
 #18884 -multiple zio_crypt: establish platform interface; rework common
                  code to use it
 #19010 -multiple zfs_namecheck: reject '.' and '..' before a snapshot or
                  bookmark
 #19031 994fb1703 Fix metaslab count assertion in metaslab_group_alloc()
                  for small vdevs
 #19093 f5b2fc8e2 zfs_ctldir: make .zfs/snapshot/<name> btime the snapshot
                  creation time
 #19097 2dece2a34 zstream: report invalid record context without assertions
 #19102 78f49e1dd vdev_disk: simplify alignment checks for linear ABDs
 #19108 -multiple Fix permanent errors misfiled into the scrub error log
 #19110 fa4bc4dec spa_errlog: don't let one unresolvable entry hide the
                  whole error log
 #19116 b6dde8a17 zio_crypt: free the key unwrap uios when decryption fails
 #19122 -multiple Fix dd_lock contention on space accounting
 #19126 c792317f2 Avoid dp_lock in the dirty space accounting
 #19131 7fd87803e Make the spa_config_lock reader fast path lockless
 #19137 a83d96835 libzfs: do not iterate snapshots for a mountpoint
                  changelist
 #19152 ccce78729 ZIO: Order a batch arrival against the hold it releases
 #19155 9d7260c9b Propagate vdev state change on probe failure
 #19157 946be3a33 FreeBSD: remove legacy ioctl support
 #19165 1d9c32c16 zpool: accept more redundant special and dedup vdevs
 #19167 638abd22a zfs_domount: fix vfs_t double-free on root setup failure

Obtained from:	OpenZFS
OpenZFS commit:	1f380a4f34
2026-09-29 09:25:39 +02:00
John Baldwin df7b905568 dtrace: Remove bogus Makefile.inc
This was added in the initial import of dtrace and overrides the
normal load/unload targets with a custom target that loads a hardcoded
set of modules.  Over time, the set of modules has not been updated
and is now incomplete.  It's also not really useful compared to the
default implementation of these targets used for loading or unloading
an individual module being actively developed.

This functionality is also available via dtraceall.ko which is how
users commonly load the full suite of dtrace modules.

Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D59821
2026-09-23 15:13:22 -04:00
Kevin Bowling b9cee186b8 ice: Add a failure injection facility
Add compile-time optional, non-sleeping fail points around every VF
creation resource boundary, before VF VSI reconstruction, and in the
GET_STATS validation path.

Provide an ICE-wide wrapper and device selector so other driver
subsystems can add scoped points without duplicating the failpoint
plumbing.  Keep the current SR-IOV points and VF selector in an iov
child namespace.

Compile the facility only with options DRIVER_FAILPOINTS.  This shared
option avoids a separate kernel option for every driver that provides
test-only injection hooks.  Ordinary kernels contain no ICE failpoint
objects or sysctl nodes.  Require an exact PF device name and
optionally a VF index before any point can fire.  This prevents a stale
test setting from affecting another PF.

The hooks exposed two reset-lifetime defects while validating the
existing SR-IOV review series.  A PF reset could discard a firmware VSI
before teardown, and a rebuilt sibling could leave stale switch-filter
state after IOV destroy.

Tested on an E810-XXV with INVARIANTS and WITNESS.  All twelve creation
checkpoints rolled back and permitted immediate resource reuse.  Forced
reconstruction and malformed GET_STATS failures also preserved sibling
operation and reply cardinality.

Reviewed by:	gallatin, nprice, ziaee
MFC after:	2 weeks
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D58940
2026-09-17 01:37:51 -07:00
Vag Singh 998acbc140 hvuio: Add HV_UIO driver
[PATCH 10/31] FreeBSD OFED support for DPDK MLX5 PMD

Adding UIO driver that exposes the synthetic network device
resources to userspace for application such as DPDK can drive it.

Added rescind CB capability to the VMBUS driver. Whenever the
hypervisor wants to close the device channel, VMBUS on receiving
this msg, calls the CB of the device driver (hv_uio in our case).

Differential revision:	https://reviews.freebsd.org/D32184
MFC after:	1 month
2026-09-16 17:12:07 +03:00
Abdelkader Boudih 8e5e2c3910 intel: add hfsts debug-probe driver for Intel ME/HECI firmware status
Add an amd64-only, Intel-only diagnostic driver that reads ME Host
Firmware Status registers from PCI configuration space without mapping the messaging BAR.

Select the HFS register count per device generation, decode sparse
HFS1 state, mode, and error fields, and expose raw and summarized
status via sysctl. Register an ISA-side hfstsfd probe for supported
RCBA/FD2 generations so firmware-hidden HECI functions can be diagnosed.

Reviewed by:	kbowling, adrian
Differential Revision:	https://reviews.freebsd.org/D58863
2026-09-15 18:30:24 +01:00
Kevin Bowling 9ea7beb173 ixv: Add Hyper-V virtual function support
Hyper-V does not expose the normal Intel PF/VF mailbox.

Import the Hyper-V operation overrides from DPDK and complete its reset
callback with the configuration-space mechanism submitted by Microsoft.
Route ixv operations through the operation table, use mailbox API 1.0,
and limit this environment to one queue pair.

Claim the 82599, X540, X550, X550EM-X, and X550EM-A Hyper-V device IDs
listed by DPDK.  Select the same path for the E610 Hyper-V subdevice
identity defined there.

For E610/Linkville, read the emulated VFLINKS-format status from PCI
configuration space at offset 0x209.  Older families retain the MMIO
VFLINKS path.

Treat receive-mode changes as host-owned no-ops and do not retry VLAN
operations that Hyper-V permanently rejects.  Limit the Hyper-V 82599
MTU to 1504 because its VF does not implement the X540 RLPML field.

Use mailbox reset indications only to refresh cached Hyper-V link state.
Hyper-V does not provide the mailbox handshake required to treat that
indication as a request for an iflib reinitialization.

Tested on 82599 and E610 (with a followup commit) with Windows Server
2025 Hyper-V.

PR:		232472, 239849
Obtained from:	DPDK (shared code)
Sponsored by:	BBOX.io
Co-authored-by:	Wei Hu <[email protected]>
2026-09-14 19:05:00 -07:00
Jaeyoon Choi 28fefc441e ufshci: add a control device node
The driver only exposed a CAM SIM. Userland had no way to reach the
device for anything that is not a SCSI command, so reading a descriptor
or an attribute was impossible.

Add /dev/ufshci%d as a root only node and the ioctl ABI header for it.
The node answers no ioctl yet. The header pulls in ufshci.h, which
declares bool only under _KERNEL, so include stdbool.h for userland the
way nvme.h already does.

Reviewed by:	imp (mentor)
Sponsored by:	Samsung Electronics
Differential Revision:	https://reviews.freebsd.org/D59558
2026-09-15 01:44:33 +00:00
John Baldwin c4f32e7a35 Trim various $FreeBSD$ that have snuck back in since the mass removal
Sponsored by:	Chelsio Communications
2026-09-14 11:11:34 -04:00
Martin Matuska 2f10ffc003 zfs: merge openzfs/zfs@02b5baf13
Notable upstream pull request merges:

 #18808 6d4ff3b4f Pool split leaks DTL spacemap objects
 #18844 0833cfd64 Decline Direct I/O reads on a file handle after a benign
                  verify failure
 #18853 39764eb06 Fix double free when cloning a block with a pending free
 #18901 51fe1fb84 dmu_send: a meta-dnode range does not start where an
                  object does
 #18903 904d4327f dmu_objset_open_impl: unregister prop callbacks on error
 #18906 e45640415 zdb: add detailed diagnostics for MOS leaks and spacemap
                  refs
 #18909 1b7143557 Keep a grown vdev from adopting an older pool's labels
 #18912 -multiple Defer destruction of a snapshot that a mount is holding
                  open
 #18921 33ae06bb6 ZIO: Batch vdev children completions
 #18940 7853c27eb ZIO: Batch lightweight ZIOs
 #18967 -multiple Speed up pool rewind and allow it to tolerate minor damage
 #18968 b0fff48dc arc: harness buf_hdr's anon state invariant checks
 #18969 b0da5c4ce dsl_crypt: validate every key change-key will rewrap
 #18974 b19fa7c97 log_spacemap: make zfs_log_sm_blksz tunable
 #18982 c878ee452 zstream: track and limit memory use
 #18991 a1261384a zstream: self-tuning queues
 #18992 fd639b075 zcp: support bookmarks in zfs.sync.destroy
 #18993 0498c554d vdev_disk_open: fix ENOENT retry & cleanup error handling
 #19003 5280a08f6 Write uberblocks only to vdevs used by the txg
 #19008 c47591d5d arc: apply arc_min tunables set before arc_init() has run
 #19016 cd578e518 dnode: fix heap-use-after-free in dnode_rele_and_unlock()
 #19017 b824f3116 zstd: declare __asan_*_memory_region() for user space
                  builds
 #19029 6860d1c2f DDT: Use proper size when calling kmem_free on
                  ddt_prune_entry_t
 #19041 aa26ca67b Do not complete a device removal that hit IO errors
 #19042 8e5bb1d4b Wait for the initialize and trim threads to exit
 #19051 ba524e0d7 zpool: things get messy with 0 columns
 #19053 69ef525a4 dsl_deadlist_space_range: use correct tree when summing
                  up space
 #19059 0ee8ea01b FreeBSD: use sys/abi_compat.h for time32_t
 #19062 e08bc2973 Skip interior dnode slots when receiving DRR_FREEOBJECTS
 #19066 92a3904af Wait for the txg that finished a scan to sync
 #19071 db07a5e0a dbuf: account dirty data for embedded writes
 #19072 1a8e51491 Fix self-deadlock when cloning a range within the same
                  file
 #19075 75bd31c28 L2ARC: do not feed a device while its rebuild is pending
 #19083 56e8d234b Stop the TRIM and initialize threads when a vdev goes
                  offline
 #19090 ab994acdd dmu: remove dmu_prealloc()
 #19092 61fbdf1a2 zfs: spa_sync_upgrades() should only take lock when needed

Obtained from:	OpenZFS
OpenZFS commit:	02b5baf13c
2026-09-14 14:37:46 +02:00
Abdelkader Boudih dd9e49a10b intel/intelpmc: Add Intel PMC Core driver
Add driver for Intel Power Management Controller (PMC) found on Sunrise Point PCH chipsets.
This device exposes S0ix sleep state residency counters and power management status.

Sysctls provided:
  dev.intelpmc.0.slp_s0_residency_us - Time in deepest sleep (us)
  dev.intelpmc.0.ltr_ignore          - LTR ignore mask
  dev.intelpmc.0.pm_cfg              - PM configuration register
  dev.intelpmc.0.pm_sts              - PM status register
  dev.intelpmc.0.access_denied       - Firmware lock status

Supported devices for now:
  - Sunrise Point-LP (0x9D21)
  - Sunrise Point-H (0xA121)

Note: Later PCH generations (Cannon Lake, Tiger Lake, ect.) have different PMC register layouts according to the datasheet and would need per-generation tables.
I avoided adding untested hardware in case they have a quirk.

Reviewed by:	olce, adrian
Differential Revision:	https://reviews.freebsd.org/D54881
2026-09-13 21:36:16 +01:00
Christos Longros d8e315ba97 hid: Add Sony DualSense gamepad driver
Add a driver for the Sony PS5 DualSense controller (054c:0ce6)
providing gamepad input via evdev, lightbar RGB LED control, and
player indicator LEDs through sysctl.

Signed-off-by:	Christos Longros <[email protected]>
Reviewed by:	ziaee, wulf
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D56345
2026-09-11 18:49:22 +03:00
Jean-Sébastien Pédron d4820dc1e6 linuxkpi: Add int_sqrt()
The implementation comes from `isqrt64()` in `sys/cam/cam_iosched.c`. It
is modified to take an `unsigned long` and return an `unsigned int`.

The i915 DRM driver started to use it in Linux 6.15.

Reviewed by:	bz
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58251
2026-09-10 21:39:32 +02:00
Pouria Mousavizadeh Tehrani c6dfeb546d tests/fib_lookup: Fix compilation by adding SYSDIR
This module is intended to compile in its own directory.
Therefore, the SYSDIR is not defined by default. See 0433870efe.

Fixes:	8e98577411 ("kern: Remove needless kern.opts.mk")
2026-09-10 14:30:14 +03:30
Anderson Nascimento 5369f8e73e hwpmc: add MPERF/APERF MSR support for AMD/Intel CPUs
Add support for reading the MPERF (MSR 0xE7) and APERF (MSR 0xE8)
model-specific registers on AMD/Intel CPUs through hwpmc(4). These
counters track maximum and actual performance frequency respectively,
and are used to compute effective CPU frequency scaling independent
of the nominal TSC rate. The name of the class was chosen as PERF
because later support for other PERF MSRs can be added to the same
class.

Extend libpmc(3) to expose the AMD/Intel MPERF/APERF counters added
to hwpmc(4) in the companion kernel change, so userland consumers
(pmcstat(8), etc.) can allocate and read these events by name.

Document the new PERF class and its MPERF/APERF counters in a new
pmc.perf.3 manual page, describing their semantics and how to read
them via pmc(3) and pmcstat(8).

Bump PMC_VERSION_MINOR.

Signed-off-by:	Anderson Nascimento <[email protected]>
Reviewed by:	Ali Mashtizadeh <[email protected]>, mhorne
Reviewed by:	ziaee (manpages)
Sponsored by:	AMD
Differential Revision:	https://reviews.freebsd.org/D58647
2026-09-09 11:42:58 -03:00
Jean-Sébastien Pédron 5fad251f05 linuxkpi: Add timer64_to_tm()
The function converts a number of seconds since Epoch to a `struct tm`.
The implementation was copied from `contrib/tzcode/localtime.c`.

The amdgpu DRM driver started to use it in Linux 6.15.

Reviewed by:	bz
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58758
2026-09-07 22:31:39 +02:00
voidanix 48efb6c4eb gzoned: Introduce Zoned Storage emulator
gzoned(8) is a new GEOM class that exposes a host-managed zoned device
(similar to ZAC/ZBC drives) on top of regular, non-zoned providers.

The created medium is sliced into equally sized zones, by default
sequential-write-required.  Such zones can be turned into conventional
zones if desired.  The zoned drive's state and configuration is
persistent through metadata at the tail of the backing provider, meaning
the zoned device gets recreated at the provider retaste.  Zone state
changes only mark the table dirty with BIO_FLUSH committing it,
mirroring drives whose zone state is volatile until a cache flush.

The new class tries to emulate real zoned drives by incorporating
per-zone write pointers and support for BIO_ZONE management commands.
Fault emulation through zone conditions (RWP recommended, offline, R/O),
URSWRZ bit toggling and concurrent open zone limits are additional
features useful for testing.

While at it, fix zonectl's report of write pointer LBAs for zones that
should have none, remove its forced debug flags and allow the geom(8)
shared subroutines to detect host-managed drives.

ATF-sh tests for gzoned(8) and zonectl(8) (dogfooded by gzoned(8)) are
included, featuring helpers (see zoned_subr.sh) for testing zoned
storage support in other components or GEOM classes.

Reviewed by:	asomers, fuz, ken
Sponsored by:	Google Summer of Code 2026
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2326
2026-09-03 12:27:00 -06:00
Ahmad Khalifa 551b7c5e12 rtwn: add support for the RTL8723BU
Pushed using the RTL8723BU.

Reviewed by:	ziaee, avos, adrian
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D59205
2026-09-01 17:41:04 -04:00
Martin Matuska 22649d4dba zfs: merge openzfs/zfs@84aa7e7e0
Notable upstream pull request merges:

 #16761 eb1738bcb FreeBSD: Enable Direct IO by default
 #16747 -multiple On-demand log-spacemap flush
 #18474 0d0eae2ab implement thorough scrub support (zpool scrub -t)
 #18562 6721ab981 Calling thread IO
 #18657 7ed1268d3 Fix race between device removal completion and pool export
 #18707 0d1f3b1c6 RAIDZ: Fix parity regeneration/check condition
 #18713 -multiple libzfs: fix key unload failure when unmounting an
                  encryption root
 #18714 d902eec64 Disconnect metaslab tracing from default builds
 #18716 e78fa488a zstream: multithreading
 #18718 6acb99cb1 Do not return ESTALE for open-unlinked files
 #18720 f607ef7e7 Fix insufficient locking in dedup verify
 #18722 -multiple snapdir: misc cleanups
 #18724 9bf75b4b1 Fix reads for blocks freed after being cloned
 #18725 9b7642df9 Harden recv record validation
 #18732 37f066e3c FreeBSD: Wire sha512 offload to the build
 #18736 -multiple Remove idmap/userns concept from core & FreeBSD platform
                  code
 #18742 d63f14057 libzutil: keep valid spare and l2cache paths on import
 #18749 f217627d4 Fix receive of split large blocks with a short trailing
                  chunk
 #18754 83bf40784 Use a single creation time for a recursive snapshot
 #18755 ebd9e2765 zstream: add "drop records" chain module
 #18763 7d565cdfa zfs bookmark: add recursive (-r) bookmark creation
 #18765 50557cc80 zpool initialize: add -z to write zeroes
 #18766 0467ba01c Add SECURITY.md policy filE
 #18773 ffde77051 Fix deduce_nblkptr for large dnodes on receive
 #18784 -multiple libzfs: clarify the raw incremental "IV set guid mismatch"
                  error
 #18793 9a02e53ad libzfs: don't abort receiving a raw encrypted send that
                  carries holds
 #18795 30426217b Rate limit Direct I/O verify zevents
 #18798 73b202451 Bound explicit user prefetch to a fraction of the ARC
 #18801 2a5331f8e Fix dmu_zfetch_prime() assuming a stream was created
 #18802 fb5fdefd8 libzfs: fallback VDEV_UPATH to VDEV_PATH for non-DM
                  devices
 #18809 bd2d87399 zdb: output refcounts from verify_spacemap_refcounts()
 #18811 5d530b8be ABD: Validate borrowed buffer length
 #18812 5d687a975 dbuf: use dirty record size for overridden writes
 #18819 -multiple ddt: fix refcount bypass and gang member leak for dedup
                  gang blocks
 #18821 87e2e4047 BRT: Implement partial bv_entcount writing
 #18822 -multiple dnode_sync: Relax constraint on indirect freeing - #18822
 #18827 d98fa72ca L2ARC: bound the rebuild by the write hand on a first
                  sweep
 #18831 90cdd9aef Batch object reallocation syncs in zfs receive
 #18833 466d90e15 zed: let autoexpand see capacity changes on partitioned
                  disks
 #18835 1ac3f2786 mmp: skip non-writeable vdevs during activity check
 #18838 a04c40138 DDT: Fix several bugs in pruning
 #18841 0bb41751f zpool export: return EBUSY when zvol minors are in use
 #18848 3020c18ca dmu_recv: Avoid potential null deref
 #18855 8cdd9b2b7 mmp: do not require writes to mirror legs the config
                  marks absent
 #18858 596c7a0ec Reduce dp_lock scope for MOS writes
 #18859 3ebf3ffc4 Predict and throttle buffers dirtied by the sync context
 #18860 -multiple Further parallelize block cloning
 #18865 412b17a29 Fix DMU bonus hold leak on I/O error
 #18867 b5bb1f816 Add missing checks to zfs_clone_range_replay()
 #18868 3df5b2e7f libzfs: String trimming should not operate out of bounds
 #18869 be62c5385 libzfs: Do not call munmap() when mmap() fails
 #18871 74e76f2d8 libzfs: don't truncate a resolved vdev path in
                  zpool_vdev_name()
 #18874 7312322b5 nvpair: Fix operator precedence
 #18883 3bd8cefdc libzfs: don't read a dataset handle after closing it in
                  resume send
 #18886 b4f70cb9e Fix negative time overflows in DDT pruning
 #18888 674b1ae5c DDT: Make ddt_zap_walk() use cursor _by_dnode functions
 #18889 fd1ae59c7 DDT: Skip DDT log lookups in ddt_prune_walk()
 #18892 -multiple zhack: add "mmp reclaim" to recover a pool stranded by MMP
 #18897 216de07d8 arc: fix race between arc_release() and arc_read_done()
 #18899 28afe8b08 CodeQL: Flag implicit compare-then-assign in branch
                  conditions
 #18917 0a79c039f arc: save on buf_hash_find() call at arc_read_done()
 #18920 7026d3335 Fix race condition in raidz expansion startup
 #18927 be55e01bc FreeBSD: Do not leak TSD zfs_geom_probe_vdev_key on errors
 #18928 5bd7d4466 scan: count skipped blocks as examined
 #18937 a5d678864 Allow pool import with corrupted spare/l2arc configs
 #18960 -multiple vdev_open: use calling credential to check for device
                  access
 #18961 acbcdd92c dmu_recv_begin_check: dsl_dataset_rele() should be called
                  on ds
 #18962 df3ff37fc dmu_redact_snap: Do proper cleanup on ENAMETOOLONG
 #18964 84aa7e7e0 libspl: consult ZFS_HOSTID on FreeBSD as well

Obtained from:	OpenZFS
OpenZFS commit:	84aa7e7e09
2026-08-24 21:54:22 +02:00
Alexander Leidinger 9c8bcdddb3 hwpmc: build hwpmc_rapl.c into the i386 module
The module's i386 source list compiles the files that call
pmc_rapl_initialize() and pmc_rapl_finalize() but not the one that defines
them, so the i386 hwpmc.ko has both undefined and cannot be loaded.

Fixes:		a99d04f39d ("hwpmc: add RAPL energy-counter class (AMD + Intel)")
Assisted-by:	Claude Code (Opus 5)
2026-08-23 10:09:44 +02:00
Bojan Novković 9b3415e9ec sys/dts: Add SD card overlays for the BananaPi-F3 SoC
The K1 user manual lists three separate SDHCI devices but the
upstream DTS file only defines the eMMC device.

Create a temporary overlay to allow the BananaPi-F3 to boot from the
SD card until this is addressed upstream.

Differential Revision:	https://reviews.freebsd.org/D57177
Reviewed by:	mhorne
2026-08-16 19:15:08 +02:00
Bojan Novković 28f3123ec7 riscv: Add spacemit SoC files to the build
Reviewed by:	mhorne
Differential Revision: https://reviews.freebsd.org/D57175
2026-08-16 19:13:23 +02:00
Devin Teske bdb561843e linux: implement pkey_alloc, pkey_free and pkey_mprotect
Bridge the Linux memory protection key syscalls to FreeBSD's native
MPK support instead of returning ENOSYS. Modern Linux software
probes these at startup: Chromium-based browsers (found via
www/linux-brave) use protection keys for V8's heap and JIT
sandboxing, and glibc >= 2.27 exposes the full API.

pkey_alloc() allocates from a per-process bitmap kept in the process
emuldata (key 0 implicitly allocated, matching Linux's
mm_pkey_allocation_map; ENOSPC once keys 1..15 are exhausted or when
PKU is absent, as Linux returns on such hardware) and applies the
requested initial access rights to the calling thread's PKRU, located
in the XSAVE area via xsave_area_offset(). pkey_free() is
bookkeeping only: as on Linux, freeing neither untags pages nor
updates PKRU. pkey_mprotect() performs the protection change and
tags the range through amd64_pkru_update(), factored out of
sysarch(2)'s AMD64_SET_PKRU/AMD64_CLEAR_PKRU implementation so that
both share the same argument checking and map read lock
synchronization with a parallel pmap_vmspace_copy() on fork; tags die
with the mapping, matching Linux VMA semantics. A pkey of -1
degrades to plain mprotect.

The allocation map is inherited on fork and reset on exec. At exec
the Linux sysvecs initialize PKRU to 0x55555554, Linux's init_pkru
default (access disabled for keys 1..15), so memory tagged with a
not yet allocated key is inaccessible to threads that were never
granted rights -- the property V8's thread isolation relies on.
Setting PKRU at exec initializes the user FPU state slightly earlier
than the lazy first-use path; the state would be initialized moments
later in rtld/libc startup regardless. Protection key faults
already deliver SEGV_PKUERR through the existing siginfo
translation.

The common code carries no architecture ifdefs. Machine-dependent
state lives in struct linux_pemuldata_md, embedded in the process
emuldata in the manner of struct mdthread, and common code calls
per-arch lifecycle hooks (linux_pemuldata_init_md/_exec_md) and pkey
back ends after performing the parameter validation Linux applies
regardless of hardware support. On amd64 the implementation lives
in sys/amd64/linux/linux_pkru.c, compiled into linux_common and
serving both the 64-bit and 32-bit Linux ABIs. Elsewhere (arm64,
i386) linux_emul_md.c provides stubs returning what Linux returns on
hardware without protection keys (ENOSPC from pkey_alloc;
pkey_mprotect with a pkey of -1 acts as plain mprotect), so
applications take their normal no-PKU fallback instead of the ENOSYS
path.

PR:             297427
MFC after:      1 month
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D58782
2026-08-15 17:58:43 -07:00
Abdelkader Boudih f5dc2263ab fwcam: convert to video(4) framework
Replaced the monolithic cdevsw implementation with the video(4)
framework.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D58369
2026-08-09 09:57:07 -07:00
Abdelkader Boudih 8cdcf4b27c uvideo: convert to video(4) framework
Replaced the monolithic cdevsw implementation with the video(4)
framework.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D58368
2026-08-09 09:54:00 -07:00
Abdelkader Boudih 9c9428825f video: add generic video(4) capture framework
Add a new video(4) framework that provides /dev/videoN, buffer
management, mmap lifetime, and V4L2 ioctl dispatch for video capture
drivers. Hardware drivers implement struct video_hw_ops callbacks
and use video_buf_acquire/write/done to deliver frames.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D58367
2026-08-09 09:48:22 -07:00
YannickV c2bd655dc3 gpio: add Intel Tiger Lake-H GPIO driver
Add a GPIO driver for the Intel Tiger Lake-H platform based on the generic
intelgpio framework. The driver defines five GPIO communities with pad groups
GPP_A through GPP_K, vGPIO and JTAG, and matches ACPI hardware ID INT34C6.
The kernel module build infrastructure and the wiring into files.x86 are
included.

Reviewed by:		vexeduxr
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Pull Request:		https://github.com/freebsd/freebsd-src/pull/2205
2026-08-06 08:42:08 +02:00
YannickV 8c7a3ccf54 gpio: add Intel Alder Lake-N GPIO driver
Add a GPIO driver for the Intel Alder Lake-N platform based on the generic
intelgpio framework. The driver provides pad group definitions for four GPIO
communities covering groups GPP_A through GPP_T, vGPIO and HVCMOS, and matches
ACPI hardware IDs INTC1056, INTC1057 and INTC1085. The kernel module build
infrastructure and the wiring into files.x86 are included.

Reviewed by:		vexeduxr
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Pull Request:		https://github.com/freebsd/freebsd-src/pull/2205
2026-08-06 08:41:54 +02:00
Kevin Bowling 316f6f2f7f igbv: Isolate VF policy and validate its registers
Give igb virtual functions a separate ifdi method table and move
VF-specific attach, reset, queue, interrupt, and diagnostic policy to
if_igbv.c. Keep shared descriptor-ring mechanisms in if_em.c.

Derive VF identity from IFLIB_IS_VF and assert that hardware
identification agrees. Under INVARIANTS, validate normal VF CSR
accesses against the sparse 82576 and I350 VF register maps.

Stop shared setup from accessing PF-only controls. Require MSI-X and
defer VF sysctls until attach succeeds so failed attachment cannot
leave handlers pointing at freed driver state.

Advertise only VF capabilities, run adaptive moderation without the
PF receive-buffer guard, enable SRRCTL.DROP_EN, and provide a VF-safe
diagnostic register view.

The moved implementation is the existing FreeBSD code. Register model
was cross-checked against the Intel datasheets and other Intel drivers.

Sponsored by:	BBOX.io
2026-07-29 21:52:39 -07:00
Kevin Bowling a2ed165f00 igb: Add SR-IOV PF support for 82576 and I350
Add the PCI IOV schema and PF control plane for up to seven VFs with
one hardware queue per pool. Implement VF mailbox handling, MAC and
VLAN assignment, multicast filtering, promiscuity policy,
anti-spoofing, malicious-driver recovery, reset replay, and queue
lifecycle management.

The basic SR-IOV and VMDq PF implementation follows DPDK Intel e1000
code, including PF pool selection, one queue per pool, mailbox
dispatch, and VF enablement. Intel FreeBSD igb-2.5.31 supplies the
older driver baseline. Linux igb and the Intel SDMs clear up lifecycle,
isolation, reset, and family-specific details absent from DPDK.

Enabling IOV requires the PF to attach with one TX and RX queue.
Systems whose defaults select RSS queues must set the documented iflib
queue override tunables before attach.

Only 82576 and I350 support SR-IOV in silicon.  The series has been
extensively tested on I350, including thowing boundaries at the PCI BAR
that shipping drivers will never.  Still, think carefully before
reaching for this in critical environments.

Relnotes:	yes
Sponsored by:	BBOX.io
2026-07-29 20:06:46 -07:00
Kevin Bowling e6b9ce25ec igbv: Split 82576 and I350 VF registration off igb
Register the 82576 and I350 VF PCI IDs under a separate igbv driver
while continuing to share the igb datapath implementation.

Follow the ixv driver split and give the VF context IFLIB_IS_VF so
iflib does not apply the PF SR-IOV detach guard to a child VF. Program
VTIVAR_MISC in the VF low byte so mailbox and reset notifications reach
the VF admin vector.

The split will become increasingly obvious as bug fixes land, trying to
bias everything with if (sc->vf_ifp) everywhere is error prone in two
directions.

This breaks existing naming/configurations and cannot be MFCed as-is.
I have no plans of adapting it to prior branches at the moment but it
may be possible.

Relnotes:	yes
Sponsored by:	BBOX.io
2026-07-29 18:47:10 -07:00
Abdelkader Boudih 5f74217c05 coreboot: Add coreboot firmware table driver
Nexus-attached driver that discovers and parses coreboot's LBIO tables
from physical memory. Exposes firmware metadata (version, build info,
mainboard, serial config, TSC frequency, CBMEM entries) via sysctl
hw.coreboot.*, the firmware console ring buffer via /dev/coreboot_console,
and structured CBMEM entry access via /dev/cbmem ioctl interface.

Tested on:
- Qotom Q535G6 (Kabylake)
- Intel NUC D54250WYK (Haswell)
- Intel NUC D33217GKE (Ivy Bridge)
- Dell 3100 2-in-1 (Gabbiter)
- Dell 3100 (Fleex)
- Lenovo IdeaPad 320s
- Lenovo ThinkPad T480
- HP Chromebook 11 G4
- HP Chromebook 11 G5
- HP Chromebook 11 G6 EE
- HP Chromebook 14 G4
- HP Chromebook 14 G5
- HP Chromebook x360 11 G1 EE
- HP Chromebook x360 11 G2 EE
- HP Chromebook x360 14 G1
- Acer C720
- Acer Chromebook 11
- Lenovo N22

Reviewed by:	ngie, kib, adrian
Differential Revision:	https://reviews.freebsd.org/D55649
2026-07-29 12:12:41 -07:00
Andre Silva a99d04f39d hwpmc: add RAPL energy-counter class (AMD + Intel)
Add hwpmc_rapl.c/.h implementing PMC_CLASS_RAPL, a read-only
system-scope class modeled on TSC and wired into x86 AMD and Intel MD
init. A per-vendor MSR table covers AMD/Hygon and Intel; energy is
reported in microjoules, with the Intel server 2^-16 J DRAM unit
handled and 32-bit wraps recovered into a 64-bit accumulator.

The overflow guard follows the PMC lifetime: armed on the first
allocated PMC, callout_drain()d on the last release, and each tick only
rendezvouses CPUs holding one. Per-CPU spin locks guard the accumulator
against torn reads on i386. PMC_CAP_DOMWIDE lets pmcstat(8) allocate
one counter per NUMA domain instead of per CPU.

Reviewed by:	mhorne, Ali Mashtizadeh <[email protected]>
Sponsored by:	AMD
Differential Revision:	https://reviews.freebsd.org/D58028
2026-07-28 11:54:21 -03:00
Mitchell Horne cac0eab342 sys/modules/hwpmc/Makefile: tidy up
This module has several source files, with many conditional on the
platform architecture. Make it easier to read, and better for future
diffs against these lists.

- Convert to one SRC per line
- Simplify arm/armv7 condition
- Remove now-empty header comment
- Minor formatting

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2026-07-28 11:48:50 -03:00
Bjoern A. Zeeb e591a76621 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.

In the unlikely event that in the mean time any other consumer would start
showing up they will have to be aware that the current code as-is
essentially is a NOP without the 'struct page' work.  A WARN_ONCE() will
notify them.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-07-24 19:33:57 +00:00
Nick Price dc5c0fc51c aq(4): add Atlantic 2 (AQC113) device support
Add support for the Marvell Atlantic 2 (AQC113/114/115/116) controllers,
a new chip generation that is not register-compatible with the Atlantic 1
parts aq(4) supports today.  Adapted from the OpenBSD/NetBSD if_aq driver.

Register and device definitions (aq2_hw.h): the firmware handshake
(MIF_BOOT / MCP_HOST_REQ_INT / MIF_HOST_FINISHED), the 0x12000/0x13000
firmware interface windows, and the action-resolver table (ART) that
replaces Atlantic 1's discrete RX filters, plus the Atlantic 2 PCI device
ids and the aq_is_atlantic2() helper.  Reserve a chip-feature bit
(AQ_HW_CHIP_ATLANTIC2) and add the aq_hw fields the firmware fills at boot
(ART base index, statistics interface version A0/B0).  The per-VLAN-filter
resolver-tag field comes from the Linux driver; the BSD sources never
write it.

Firmware operations (aq_fwa2.c): Atlantic 2 talks to the management CPU
through the 0x12000/0x13000 register windows plus the boot handshake,
rather than Atlantic 1's mailbox in shared RAM.  Implement that as a third
aq_firmware_ops vtable (reset, set_mode, get_mode, get_mac_addr,
get_stats); aq_fwa2_reboot() boots the firmware, selects the A2 ops, and
reads the version and ART base index, failing fast on the
crash-init / boot-failed bits.  fwa2_set_mode advertises full duplex only
(the media model exposes no half-duplex types) and writes and acks the
link options before raising ACTIVE mode, so a forced media change does not
begin negotiation with a stale rate mask.  enum aq_fw_link_speed gains
aq_fw_10M, which Atlantic 2 supports and Atlantic 1 does not.

Probe and attach: list the device ids with their media types and link
speeds (all copper; AQC113* up to 10G, AQC116C to 1G), populate
hw->device_id, and tag the generation with AQ_HW_CHIP_ATLANTIC2 so
IS_CHIP_FEATURE() recognises it uniformly.  Branch firmware bring-up and
reset on the generation: aq_hw_init_ucp() and aq_hw_reset() reboot the MCP
instead of the Atlantic 1 RBL/FLB reset -- without a real datapath reset
every stop/init cycle reprograms the rings on a live, desynced RX DMA
engine and the receive path stays dead.  aq_hw_init() programs the
Atlantic 2 launch-time clock ratio in place of the Atlantic 1
MRRS / TX-DMA request-limit clamp.  Add an AQ_LINK_10M capability bit
(Atlantic 2 links at 10M, Atlantic 1 cannot), offer 10baseT media, and map
IFM_10_T to aq_fw_10M.

With every supported media type now present, replace the per-speed switch
statements in aq_media.c with a single {link bit, fw rate, IFM_* subtype,
Mbit/s} table -- one source of truth for the supported link speeds.

With this an Atlantic 2 card probes, brings up its firmware, reads its
MAC, and negotiates link; the RX action-resolver datapath comes next.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D58141
2026-07-19 09:48:05 -07:00
Bjoern A. Zeeb c589dc4ef7 mt76: disable debugfs due to missing piece still in review
Until D57524 is not reviewed and committed we will have a missing
function declaration which prevents us to compile (in) debugfs for
mt76 core and mt7921.  Temporary disable debugfs again.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-07-17 15:48:54 +00:00
Andrew Turner 237c69a990 acpi_einj: Add acpi_if.h to SRCS
This is included via acpivar.h so needs to be in SRCS to be generated.

Reported by:	bz
Fixes:	bc49842769 ("acpi_einj: Support for ACPI error injection")
Sponsored by:	Arm Ltd
2026-07-08 07:13:43 +01:00