acpi_apple: Fix sleep with non-sleepable lock held
Apple platform attach and detach functions are serialized with ordinary
mutex and contain code that executes malloc() that leads to INVARIANTS
warnings. Fix it through replacement of mutex with sx lock.
Fixes: d7d237ce731f ("acpi_apple: Apple platform ACPI driver")
Reviewed by: seuros
Differential Revision: https://reviews.freebsd.org/D61295
sys/kobj.h: Convert macro DEFINE_CLASS to designated initializers
So that it is less error prone when adding new struct members or
refactoring in future.
No functional change intended.
Reviewed by: kib, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D61276
sdiob: copy vendor/device IDs from card common CIS
Copy both the vendor and device IDs from the card common CIS if they are
absent in a function.
These are optional according to the spec. [1]
[1] Part E1 SDIO Simplified Specification §16.6
MFC after: 3 days
Reviewed by: kibab, imp, adrian
Differential Revision: https://reviews.freebsd.org/D60988
(cherry picked from commit c91dfb47e0bcdf682f7f152624e03747787c6ea3)
TCP RACK: fix RSM computation for TCP fast open
When spitting an RSM containing the SYN and data, honor the
sequence number used by the SYN flag when computing the offset
in the socket buffer.
PR: 297006
Reviewed by: rrs, Peter Lei
MFC after: 3 days
MFC to: stable/15
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D61149
mac syscalls: add kern_ implementations
Where the kern_ interfaces map trivially to the syscall interface, follow
the syscall name even if awkward (e.g., sys___mac* -> kern___mac*).
Otherwise use shorter names.
Effort: CHERI upstreaming
Sponsored by: DARPA, AFRL
Pull Request: https://github.com/freebsd/freebsd-src/pull/2284
xhci: only set the slot context parent hub fields on xHCI 1.2
The Enhanced SuperSpeed meaning of the slot context parent hub slot ID
and port number fields was introduced in xHCI 1.2. Controllers built to
an earlier revision define them only for a Low- or Full-speed device
behind a High-speed hub.
A SuperSpeed device behind a USB 3.2 hub on an Intel Alpine Ridge
controller, an xHCI 1.1 part, stops responding to Address Device and
loops in uhub_reattach_port until the port is disabled.
Fixes: 20b19982545e ("usb: support SSP and SSPx2 xHCI")
Reviewed by: aokblast, ngie, adrian
Differential Revision: https://reviews.freebsd.org/D61278
asmc: notify the SMC of shutdown and restart
Nothing tells the SMC that a power off or restart was user requested, so
the T2 keeps rebooting the machine thinking the system is wedged.
Approved-by: ngie (co-mentor)
Reviewed by: ngie, adrian
Differential Revision: https://reviews.freebsd.org/D61260
powerpc: Define the sub-word atomic load and store directly
All currently supported powerpc CPUs handle single-copy atomicity for
any size up to the native word size, so load and store operations are
guaranteed for sub-word size that are naturally aligned.
powerpc64: Don't ignore lookup errors in kernel linker
If a lookup fails for a R_PPC_JMP_SLOT (PLT relocation) ignoring errors
results in an address of 0 gets written into the jump slot, leading to a
NULL pointer jump when attempting to call the function it points to.
Fix this with proper error checking so that a module will fail to load
instead of crashing later on.
camcontrol: Fix -Wcast-align errors in the NVMe reservation report
Casting the byte buffer that holds the Reservation Report payload to
the status structures trips -Wcast-align on strict-alignment
architectures, which broke the CI builds there. Put the buffer in a
union with the two status structures instead, so it is properly
aligned and no casts are needed.
Reported by: FreeBSD CI
Fixes: ba75cf05727e ("camcontrol: Support NVMe reservations via the persist subcommand")
Co-authored-by: Claude Fable 5 <noreply at anthropic.com>
MFC after: 1 week
Sponsored by: Spectra Logic
camdd: Fix the worker startup race
The reader can hand off its first buffer before the writer sets
CAMDD_DEV_FLAG_ACTIVE. camdd_queue_peer_buf() then mistakes the writer
for an exited peer and releases the buffer instead of queueing it. This
can make a copy fail with bytes read but nothing written, without an
error message.
Mark both devices active before creating either worker, leaving the
workers to clear the flag on exit. The work queues and EVFILT_USER
events are already initialized, so queued buffers and their notification
can wait for the writer to start without a startup barrier.
Treat pthread_create() failure as fatal. Returning through the normal
cleanup path can free devices that an already-started worker is still
using, and an unstarted peer cannot consume any queued buffers.
Reviewed by: imp, markj, ken
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61277
camcontrol: Support NVMe namespace formatting via the format subcommand
Support formatting NVMe namespaces through the existing format
subcommand. The format subcommand now dispatches on the device
protocol, in the same way the identify and persist subcommands do,
and issues the NVMe FORMAT NVM command for NVMe devices.
The SCSI syntax and behavior are unchanged. The NVMe-specific
options are -e (secure erase setting), -G (format all namespaces),
-f (LBA format), -l (protection information location), -m (metadata
setting) and -p (protection information type). The -q and -y options
work for both protocols; NVMe formats gain the same confirmation
question that SCSI formats have always had. The -r and -w options
are SCSI only; -r returns an error for NVMe devices and -w has no
effect, since the NVMe format command does not complete until the
format is finished.
The default timeout for NVMe is 30 seconds for a cryptographic erase
and 30 minutes otherwise; the generic -t option overrides it.
[23 lines not shown]
camcontrol: Add a feature subcommand for NVMe Get/Set Features
Add a feature subcommand for the NVMe Get Features and Set Features
commands:
camcontrol feature ndaX -a <get|set> -f feature [-d data]
[-s num] [-U]
There is no transport-specific prefix in the name: SCSI has no
feature command (the closest equivalents are mode pages), and the
ATA SET FEATURES subcommands are already exposed through dedicated
camcontrol subcommands (apm, aam, epc and the power commands), so
the name is unclaimed. The subcommand returns an error for
non-NVMe devices.
Currently, only the hostid feature is fully implemented. The
hostid value for set is specified with -d as a UUID or an integer
in decimal, hex, or octal, and -U outputs the hostid as a UUID on
get.
[36 lines not shown]
camcontrol: Add support for NVMe namespace Identify
Add a -N argument to camcontrol identify. This will fetch and
display namespace Identify data for NVMe drives, using
nvme_print_namespace() from nvmecontrol(8).
This gets the namespace Identify data via XPT_DEV_ADVINFO (i.e.
data cached in the kernel) like the standard NVMe identify command
does, and so works even on NVMe devices that do not support NVMe
Namespace Management.
sbin/camcontrol/camcontrol.c:
Add a -N argument to camcontrol identify.
Rename nvme_get_cdata() to nvme_get_data(), and give it the
ability to fetch controller or namespace Identify data.
While here, improve its error reporting with
cam_error_print(), and only look at the CAM status bits of
the returned CCB.
[22 lines not shown]
camcontrol: Support NVMe reservations via the persist subcommand
The NVMe reservation model is closely patterned after SCSI Persistent
Reservations, so support NVMe devices through the existing persist
subcommand rather than adding a transport-specific subcommand. The
persist subcommand now dispatches on the device protocol, in the same
way the identify subcommand does.
The SCSI syntax is unchanged. For NVMe devices, the -i modes all map
to the Reservation Report command (read_full_status requests the
extended data structure, which contains 128-bit Host Identifiers), and
the -o service actions map to the corresponding NVMe reservation
operations: register, register_ignore, reserve, preempt,
preempt_abort, release and clear, plus two NVMe-only actions,
unregister and replace. The reservation type names for -T are shared
between SCSI and NVMe. A new -c option gives explicit control over
the NVMe Persist Through Power Loss State; -p is equivalent to
-c enable. SCSI-only options return an error for NVMe devices.
[32 lines not shown]
cam: Add NVMe reservation, format and features CCB building functions
Add NVMe CCB (union ccb / struct ccb_nvmeio) building functions for
the four NVMe reservation opcodes, Format NVM, and Get Features /
Set Features. These use the nvme_command building blocks added to
sys/dev/nvme/nvme.h, and are used by the new camcontrol(8) nvres,
nvformat and nvfeature subcommands that will be added separately.
sys/cam/nvme/nvme_all.c:
Add NVMe CCB building functions for the four NVMe reservation
opcodes: nvme_resv_report(), nvme_resv_register(),
nvme_resv_acquire() and nvme_resv_release(). Data direction
is set internally (CAM_DIR_IN or CAM_DIR_OUT as appropriate),
so no flags parameter is needed.
Add a new nvme_format() CCB building function.
Add nvme_get_feature() and nvme_set_feature() CCB building
functions, along with nvme_get_feature_hostid() and
[16 lines not shown]
nvme: Add reservation, format and features command building support
Add command (struct nvme_command) building functions for the four
NVMe reservation opcodes (Report, Register, Acquire and Release),
Format NVM, and Get Features / Set Features, along with the
enumerations and data structures that go with them. These are
shared between the kernel and userland, and are the underpinnings
for new camcontrol(8) subcommands (nvres, nvformat, nvfeature) that
will be added separately.
The reservation type names are intentionally similar to the SCSI
names for the same reservation types.
sys/dev/nvme/nvme.h:
Add NVMe command building functions for the four NVMe
reservation opcodes: nvme_ns_resv_report_cmd(),
nvme_ns_resv_register_cmd(), nvme_ns_resv_acquire_cmd() and
nvme_ns_resv_release_cmd().
[68 lines not shown]
nvmecontrol: Factor out namespace Identify printing
Move print_namespace() from identify.c to identify_ext.c and rename
it to nvme_print_namespace(), to match nvme_print_controller().
This allows other consumers (notably camcontrol(8)) to print NVMe
namespace Identify data.
No functional changes intended.
sbin/nvmecontrol/identify.c:
Remove print_namespace(), and call nvme_print_namespace()
instead.
sbin/nvmecontrol/identify_ext.c:
Add nvme_print_namespace(), moved here from identify.c.
sbin/nvmecontrol/nvmecontrol.h:
Remove the print_namespace() prototype.
[12 lines not shown]
libthr: require both _Unwind_ForcedUnwind and _Unwind_GetCFA for !PIC
Static linking must bring in both symbols for the unwind to work.
The landing pads added by 2734bbbcba3c reference _Unwind_Resume and
__gcc_personality_v0. In a static link, these pull UnwindLevel1.o
from libgcc_eh.a, which also defines _Unwind_ForcedUnwind, but
not UnwindLevel1-gcc-ext.o, which defines _Unwind_GetCFA. Unless
something else pulls that object in, as libcxxrt does for C++ programs,
thread_unwind_stop() calls a NULL _Unwind_GetCFA on every thread exit.
Reported and tested by: dch
Fixes: 2734bbbcba3c ("libthr: Create landing pad in thr_once in C++ exception")
Sponsored by: The FreeBSD Foundation
ports.7: Add the DEVELOPER make variable
make.conf(5) says make variables that are for the ports tree should
be documented in ports(7). Add this from the porters handbook.
MFC after: 3 days
Reviewed by: alven
Event: FreeBSD 2026 Vendor Summit
Differential Revision: https://reviews.freebsd.org/D61272
contrib/bc: remove vs sub-directory
Some of the files in the vs sub-directory are checked out with CRLF
line breaks via .getattributes. This causes issues when checking out
the source tree with other tools that operate on Git repositories like
"got". Remove the vs sub-directory from the contrib tree, since it is
not required on FreeBSD.
(cherry picked from commit 94d4ba04a96f495d635bf246e4d5021eb1faab22)
iSCSI: Fast and per-session timeouts
Support per-session configurable ping (SCSI NOP) and login timeouts
similar to what is supported in the Linux iSCSI initiator configuration file.
Reduce iscsi timer granularity to 0.1 sec.
For backwards compatibility, when all timers are selected on integer numbers,
all status messages are unchanged. If the higher granularity is used, the
log messages include sub-second granularity.
The sysctl(3) interface has changed from pure int to string, in order to
support fractional seconds in a human-readable, dotted notation.
Reviewed By: #netapp, #manpages, jhb, pauamma_chezdork.com, siderop1_netapp.com
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D32540