whereis(1): Simplify code
Simplify the way we build paths.
Avoid decolonification of source paths.
Remove gnu directories and add non-tracked ones.
Fix a memory leak while here.
Approved by: ngie@
Differential Revision: https://reviews.freebsd.org/D59846
arm64 pmap: Eliminate redundant icache synchronization
Creating an executable user-space mapping to write-back memory
synchronizes the icache with the page's contents, whether or not those
contents have changed since the previous synchronization. Use the pmap
private page flag PGA_ICACHE_SYNCED to record that the icache has been
synchronized with a managed page's contents and that the page has no
writable mappings. When the flag is set, the creation of another
executable mapping to the page can skip the synchronization. The flag
is cleared when a writable mapping to the page is created, using a
single atomic operation that keeps PGA_WRITEABLE and PGA_ICACHE_SYNCED
from ever being simultaneously set, and when the page's last mapping is
destroyed.
Assisted-by: Claude Code (Fable 5.1)
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D59865
vm_page: Replace PGA_EXECUTABLE with PGA_PMAP_PRIV1
At present, PGA_EXECUTABLE is only used by the powerpc mmu_oea64 pmap.
The MI layer only accesses this flag to assert that it is clear when a
managed page is freed. Soon, we will need a similar, but not identical,
machine-dependent flag in the arm64 pmap. So, we rename this flag to
PGA_PMAP_PRIV1, simply saying that it is reserved for use by the pmap.
Each pmap can then define a name that best reflects its own meaning.
However, we still assert that this flag is clear when a managed page is
freed.
No functional change.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D59995
amd64: gate WRMSRNS immediate form on compiler support
This support was introduced in LLVM 20 and we still support releases
with LLVM 19 so it's too early to require LLVM 20. Decay to the
non-immediate form when the compiler it too old. This makes the ifunc
pointless, but limits the need for other ifdefs.
Reviewed by: kib
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D60023
uio: make *copyinuio take a void *
This aligns with copyinuio_t and avoids some hypothetical undefined
behavor around calling functions with mismatched types.
Reviewed by: kib
Effort: CHERI upstreaming
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D60024
ofw: Convert simplebus to device_get_softc_class().
Stop embedding struct simplebus_softc as the first member of subclass
softcs. Use device_get_softc_class() to locate the simplebus portion of
the device softc
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D59837
dpaa2: Don't return simplebus devinfo for a non-simplebus child
dpaa2_mc_simplebus_get_devinfo() must not treat the MC resource-container
device as a simplebus child. Return NULL when child is sc->rcdev instead
of forwarding OFW_BUS_GET_DEVINFO() for that device.
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D59836
nvme: name the reserved Identify Controller fields at bytes 102 through 110
Bytes 102 through 110 of the I/O Command Set Independent Identify
Controller data structure were reserved padding. Name them: Boot
Partition Capabilities (byte 102), CXL HDM Support Information (byte
103), NVM Subsystem Shutdown Latency (bytes 107:104) and Power Loss
Signaling Information (byte 110). Bytes 109:108 stay reserved.
CXL HDM Support Information was added in NVM Express Base Specification
2.4, Figure 338; the others appear in 2.3, Figure 328.
Report the new fields from nvmecontrol identify.
Reviewed by: imp, adrian
Differential Revision: https://reviews.freebsd.org/D60000
uchcom: Set rate to 1 if 0
If userspace provides rate == 0, it causes kernel panic as rate is
directly used as a divident, which cannot be zero. Fix it by set the
rate to 1 if it is passed as 0.
Reviewed by: imp, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59111
boot-test.sh: Add gptboot.efi tests
Make sure that we can chainboot with gptboot.efi. Many projects use this
as their migration tool from gptboot to ping-pong partitions to boot
from. This tests that functionality which I recently broke.
Assisted-by: Claude Code (Fable 5, Opus 5)
Sponsored by: Netflix
Restore booting the partition the EFI boot image was loaded from.
BSDRP images are built with "poudriere image -t firmware", which puts
gptboot.efi on the ESP instead of loader.efi. gptboot.efi reads the GPT
bootme attribute, picks the active system partition (BSDRP1 or BSDRP2),
chainloads /boot/loader.efi from it and hands loader.efi that partition
in LoadedImage->DeviceHandle (stand/efi/boot1/boot1.c:try_boot).
Since ce9bfd78167 ("loader.efi: Refactor try_boot_device_partitions"),
find_currdev() no longer tries that device: try_boot_device_partitions()
walks the parent disk while explicitly skipping dp->pd_handle, on the
assumption that the boot image always comes from an ESP holding no root
filesystem. When chainloaded, the partition gptboot.efi selected is
therefore the one partition never considered, and loader.efi falls
through to the first other UFS partition on the disk - the previous
system. Every A/B upgrade silently boots the old slice.
Commit 1c85c5eea09, which introduced try_boot_device_partitions(), did
try dp itself before its siblings; the refactor dropped it. Restore it,
[5 lines not shown]
boot-test.sh: Add netboot-http-efi test
Using iPXE, chainboot loader.efi with rootdev=http://${next-server}/
to test the loader's http:// code.
Sponsored by: Netflix
boot-test.sh: Add virtio-rng-pci to the EFI RAM-disk netboot qemu invocation
Since the PixieFail security fixes (CVE-2023-45237), EDK II's DxeNetLib --
underneath essentially all of NetworkPkg (Mnp/Arp/Ip4/Dhcp4/Tcp/Http) --
carries a DEPEX on EFI_RNG_PROTOCOL. With no RNG protocol producer
available, that DEPEX is never satisfied and the entire NetworkPkg driver
stack silently fails to load: no error, no assert, it just isn't there.
netboot-efi and netboot-ramdisk never noticed because they only ever touch
the raw EFI_SIMPLE_NETWORK_PROTOCOL via our own net.c, which has no such
dependency. A test that needs EDK II's own NetworkPkg (e.g. one exercising
EFI_HTTP_PROTOCOL) is the first to be affected.
RngDxe can satisfy the DEPEX from the RDRAND instruction alone on a
sufficiently recent edk2 build, but not every installed OVMF is that
recent. -device virtio-rng-pci provides an RNG unconditionally via
VirtioRngDxe, regardless of edk2 vintage or host CPU features.
Unfortunately, the edk2 shipped with qemu lacks the network this needs.
[2 lines not shown]
boot-test.sh: Add a http server per interface
Add the built-in python http server, bound to each of the interaces we
create to expand network testing to include http:// in various
scenarios.
Sponsored by: Netflix
linux: Exposes renderD nodes and chardev in sysfs
To allow normal users to render through the render device, we expose the
renderD node. This enables Wayland applications to use hardware
acceleration when running under the Linux emulator.
Additionally, libdrm and Mesa need to look up
/sys/dev/char/<major>:<minor> and <pcidev>/drm to identify the
corresponding renderer device (e.g., a renderD device). We expose this
path as well so that libdrm can locate the renderer.
Differential Revision: https://reviews.freebsd.org/D59190
fsck_msdosfs: fix head bitmap over-allocation on 32-bit platforms
bitmap_ctor() computed the allocation size as
roundup2(bits, LONG_BIT) / (LONG_BIT / 8)
The dividend is a count of bits, so converting it to bytes requires
dividing by 8 (bits per byte), not by LONG_BIT / 8 (bytes per long).
The two divisors happen to coincide on LP64, but on ILP32 platforms
the head bitmap was allocated at twice the required size; for a
FAT32 file system with close to 2^28 clusters, that is 64 MiB instead
of 32 MiB.
The extra half of the allocation was never accessed, so there is no
functional change other than the reduced memory footprint.
MFC after: 3 days
Pull Request: https://github.com/freebsd/freebsd-src/pull/2440
ihwpstate_intel: update dev.hwpstate_intel.%d.epp sysctl description
Catch up with 8452afeb568: now dev.hwpstate_intel.%d.epp accepts
values from 0 to 255. Update its description accordingly to sync
with the code and the man page.
nvme: collapse the per-counter qpair statistic sysctl handlers
A single handler that takes the counter's offset
within struct nvme_qpair in arg2.
No functional change
Reviewed by: imp, adrian
Differential Revision: https://reviews.freebsd.org/D60020
nvmf: factor out the pending request abort loop
The routine is entered with the namespace lock held and drops it before
completing the requests, which preserves the existing locking.
Reviewed by: imp, adrian
Differential Revision: https://reviews.freebsd.org/D60019
nvme: share one handler between the interrupt coalescing sysctls
The int_coal_time and int_coal_threshold handlers differed only in which
controller field they updated before reprogramming the feature.
Reviewed by: imp, adrian
Differential Revision: https://reviews.freebsd.org/D60018