arm64: Fix and rename midr_check_var_part_range()
At the lowest and highest variants in the specified range,
midr_check_var_part_range() was comparing the part number, rather than
the revision, against the bounds. In other words, the "Y" in "rXpY"
should be compared to CPU_REV() instead of CPU_PART(). Apply this
correction, and rename the function to midr_check_var_rev_range() to
better reflect the field that we are checking.
(cherry picked from commit 39d6e2226484ca434c7d980eda4aa19ed0d62c9e)
bhyve: Fix virtio-input event array resizing
Use the new array size when calling realloc(). Note that this queue
stores events read from a host evdev device, i.e., it is not
guest-controlled.
While here, use the cdefs.h __unused macro and use them correctly, i.e.,
don't mark "arg" as unused when it isn't.
Reported by: Brian Delgado from Intel using Anthropic Opus 4.8
Fixes: 054accac71e0 ("Add a virtio-input device emulation.")
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60679
inotify: Open target the directory when adding a watch
When an application uses inotify to watch a directory,
vn_inotify_add_watch() reads the directory entries and does a name
lookup so as to induce the filesystem to create namecache entries.
Some filesystems expect the directory to be opened before VOP_READDIR
can be called, so do that.
PR: 299239
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D60782
amd64: Don't probe MSR_IRPERF when running under bhyve
vmm doesn't implement it, and bhyve simply aborts. I fixed this in
commit c83e075d72f6, but it'll still be impossible to boot newer FreeBSD
guests on older hosts without this workaround.
Reviewed by: adrian
Fixes: 2272fac218a8 ("hwpmc: Add support for AMD-only IRPERF in hwpmc PERF class")
Differential Revision: https://reviews.freebsd.org/D60730
bhyveload: Factor global variables into a software context
This will make it easier to port bhyveload's functionality into the main
bhyve executable.
No functional change intended.
Reviewed by: novel
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D60481
intel: add a shared header for the LPSS private registers
The Intel Low Power Subsystem wraps its I2C, SPI and UART functions in a
block of private registers that control the functional clock and the
function and DMA resets.
Refactored to use a single header
Reviewed by: imp, adrian
Differential Revision: https://reviews.freebsd.org/D60859
uart: support Meteor Lake-P LPSS UART 0
Recognize Intel 8086:7e25 using 32-bit MMIO with a four-byte register
stride. Deassert the LPSS functional resets and program the 100 MHz
reference clock divider for a 44.2368 MHz UART clock before the UART
core claims the register window, and reprogram both on resume.
Reviewed by: imp, adrian
Differential Revision: https://reviews.freebsd.org/D60858
makefs/zfs: count "." in the link count and size of dataset roots
The root directory of a dataset is populated from an fsnode that is the
"." entry of the staging directory, and its children are the siblings of
that node, so the loop that computes the link count and the size of the
directory (which expects "." among the children, as the nodes of the
other directories have) never counts it. The link count of the root of
every dataset is one less than it should be (1 for an empty dataset
instead of 2, 19 instead of 20 for a root with 18 subdirectories), and
so is its size.
fts(3) trusts the link count of the directories of ZFS when called with
FTS_NOSTAT and FTS_PHYSICAL: it stops looking for subdirectories once it
has seen as many as the link count says, and does not descend into the
ones it did not look at. As a result find(1), and rm(1) when it does
not need to stat the entries, silently skip directories of a pool made
by makefs. On a root filesystem made by makefs, find / does not list
/etc at all.
[13 lines not shown]
sched: INVARIANTS: Check sched_preempt() is called on 'curthread'
sched_preempt() does not support operating on a remote thread. If you
are looking to influence CPU allocation on another thread, see, e.g.,
cpuset_setthread(), which in the end calls sched_affinity().
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
sched_ule: tdq_runq_add(): Scope variables, delineate the different steps
For better readability.
No functional change (intended).
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
sound examples: trigger dsp devices via syncgroup
Triggering is only needed if device is in mmap mode, and in mmap example
the device is triggered as part of syncgroup. For non-mmap mode,
triggering is not needed at all. Triggering mmap'ed device too early
would start the IPTR/OPTR counters and that would cause those pointers
to be out of sync, so let syncgroup do the triggering once the device is
fully configured and ready for capture and playback.
MFC after: 1 week
Reviewed by: christos
Differential Revision: https://reviews.freebsd.org/D60839
Add loongarch64 as an optional boot-test.sh arch
D59889 brings up a FreeBSD/loongarch64 EFI loader, none of it in
this tree yet. Add a disabled config entry (excluded from -A, usable
via -a once the port lands) using the confirmed QEMU virt/la464
recipe; hw/loongarch/virt.c defaults to virtio-blk/net, so the
existing generic EFI+GPT builder needs no arch-specific QEMU code.
loongarch64 has never had a FreeBSD release, so
install_minimal_userland's ISO extraction can never find one. Split
it into ISO and installworld-cross-build paths, selected by a new
no_release capability, so archs without a release can still get a
minimal userland.
Differential Revision: https://reviews.freebsd.org/D59923
nvmecontrol: Use admin device for admin-passthru
When we're doing admin-passhtru, we need to use the admin device, not
the namespace device. So when we're passed in ndaX or nvdX, we need to
translate that to nvmeY for this command for the admin-passthru command,
but not the io-passthru command. Note namespace nuance in man page.
Differential Revision: https://reviews.freebsd.org/D59878
nvmecontrol: select format by sector size
Add automatic selection of lbaf value based on a single sector size. The
lbas (the data sector size) is selected based on the power of 2 in the
sector size, and the metadata size is selected by the remainder. If an
lbaf matches these values is used, otherwise we exit with an error.
When there's a tie, we prefer the higher performance.
Manual selection of these values remains as well for times when we
select incorrectly.
Reviewed by: seuros, chuck
Differential Revision: https://reviews.freebsd.org/D59833
nvme: Notify namespaces on reset sometimes
When we're resetting after a controller failure, and we fix the failure,
and we've not resetting as part of initialization, notify the all the
children devices of new namespaces. When we failed the controller
before, we removed all the namespaces.
Reviewed by: seuros
Differential Revision: https://reviews.freebsd.org/D59832
nvmecontrol: Fix mixup between pi and pil
pi and pil were extracted from the incorrect place. Swap how we get/set
there to be correct. However, since these are always 0, this is a nop.
nvmecontrol: add format dry-run support
Add -n/--dry-run to resolve and print the Format NVM command without
submitting it. This lets users verify namespace selection and format
parameters before making destructive media changes.
Reviewed by: seuros, chuck
Differential Revision: https://reviews.freebsd.org/D59835
nvmecontrol: support controller-wide sector sizes
Extend sector-size selection to controller-wide formats when every
namespace has one compatible format index and matching effective
metadata and protection settings. Reject ambiguous or inconsistent
layouts so heterogeneous fleets can request a sector size without
risking an unintended controller-wide format.
Reviewed by: seuros, chuck
Differential Revision: https://reviews.freebsd.org/D59834
nvme: honor Linux passthrough command timeouts
Now that we have per-command timeouts, allow linux-compat ioctls to have
a passed-in timeout.
Reviewed by: seuros, chuck
Differential Revision: https://reviews.freebsd.org/D59829
nvme: Refactor namespace notifications for additions
When we add a namespace, we have the code inline to do the
notifications. Refactor ahead or reuse.
Reviewed by: seuros
Differential Revision: https://reviews.freebsd.org/D59831
nvme: add a timeout for Format NVM commands
Format commands need a longer timeout.
Reviewed by: seuros, chuck
Differential Revision: https://reviews.freebsd.org/D59827