Commit Graph

306152 Commits

Author SHA1 Message Date
Mark Johnston a6411f6b7d vmm: Consolidate vm and vcpu definitions
There is quite a lot of duplication of code between amd64, arm64 and
riscv with respect to VM and vCPU state management.  This is a bit
tricky to resolve since struct vm and struct vcpu are private to vmm.c
and both structures contain a mix of machine-dependent and
machine-independent fields.

To allow deduplication without also introducing a lot of churn, follow
the approach of struct pcpu and 1) lift the definitions of those
structures into a new header, sys/dev/vmm/vmm_vm.h, and 2) define
machine-dependent macros, VMM_VM_MD_FIELDS and VMM_VCPU_MD_FIELDS which
lay out the machine-dependent fields.

One disadvantage of this approach is that the two structures are no
longer private to vmm.c, but I think this is acceptable.

No functional change intended.  A follow-up change will move a good deal
of machine/vmm/vmm.c into sys/dev/vmm/vmm_vm.c.

MFC after:	2 months
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D53584
2026-01-08 21:53:31 +00:00
Roman Bogorodskiy 90b9a77ebe bhyve: support MTU configuration for SLIRP net backend
Support configuring MTU for the SLIRP net backend, for example:

  -s 1:0,virtio-net,slirp,mtu=2048,open

Update the manual page accordingly.  While here, also document
MAC address configuration.

Reviewed by:	markj
Approved by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D54133
2026-01-08 18:01:13 +01:00
Johan Söllvander bf98d6775d sesutil: Remove width modifier on encoded "Desc" field
Remove the width modifier to remove white space padding
added to "description" field when running
`sesutil --libxo:JP show`.

Reviewed by:    asomers
Approved by:    asomers (mentor)
MFC after:      1w
Sponsored by:   ConnectWise
Differential Revision:  https://reviews.freebsd.org/D54536
2026-01-08 17:15:54 +01:00
Quentin Thébault cbc6f7e941 bhyve: add UNIX domain socket support to rfb
This commit adds support for a UNIX domain socket to bhyve's remote
framebuffer. It enables the use of the graphical console when the bhyve instance
is running in a jail with no networking, for instance. A VNC client running on
the host can then connect to the UNIX domain socket through the filesystem.

Signed-off-by: 	Quentin Thébault <quentin.thebault@defenso.fr>
Sponsored by:	Defenso
Reviewed by: 	kevans, markj
MFC after: 	2 weeks
Differential Revision: https://reviews.freebsd.org/D53814
2026-01-08 15:24:52 +00:00
Mark Johnston 16f8ea6a81 amd64: Remove tpm(4) from GENERIC for now
It breaks suspend/resume and no one has had time to investigate and fix
it.

PR:		291067
Reviewed by:	emaste
Fixes:		3deb21f1af ("random: TPM_HARVEST should have been named RANDOM_ENABLE_TPM")
Differential Revision:	https://reviews.freebsd.org/D54587
2026-01-08 14:54:15 +00:00
Minsoo Choo d2f1c8e0d1 Makefile: Update doxygen requirements
MFC after:	3 days
Reviewed by:	imp, ziaee
Signed-off-by:	Minsoo Choo <minsoochoo0122@proton.me>
Closes:		https://github.com/freebsd/freebsd-src/pull/1869
2026-01-08 09:01:03 -05:00
Andrew Gallatin b72cb30589 bnxt: fix i2c read to allow access to different addresses
Allow reading of i2c addresses other than A0. A0 does provide most
information, but doesn't provide things like module temps, and optical
signal levels.

Sponsored by: Netflix
Reviewed by: sumit.saxena_broadcom.com
Differential Revision: https://reviews.freebsd.org/D54590
MFC after: 3 days
2026-01-08 08:52:01 -05:00
Kristof Provost 0df9054bc1 pf: handle nlattr_add_nested() failure
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2026-01-08 13:25:25 +01:00
Kristof Provost bf19253516 pf: remove redundant zeroing
nlmsg_reserve_object() already zeroes the header before it gives it to
us, so there's no need to explicitly zero these fields again.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2026-01-08 13:25:24 +01:00
Aymeric Wibo c0df8f6f0e acpi: Make taskqueue only run on BSP
This is needed because when we add the suspend-to-idle loop, we only
want to break the BSP out of idle to process the taskqueue while keeping
all the others idled.

Currently assuming BSP to be CPU0, which may not always be the case on
non-x86.

Reviewed by:	kib
Approved by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D54406
2026-01-08 11:35:54 +01:00
Baptiste Daroussin 65e77d34fd nuageinit: fix test after recent behaviour change
with recent change nuageinit always create a "freebsd" user, if no
users are specified, which means we do need to get the rootdir in the
testsuite containing a group file otherwise pw complains and the tests
fails.
2026-01-08 10:55:27 +01:00
Gonéri Le Bouder cae280931c nuageinit: set the hostname when user-data is missing
This address the situation reported here
https://github.com/freebsd/freebsd-src/pull/1952#issuecomment-3720210259

The user-data file was missing and the `sethostname` function is never
called. This commit adjusts slightly the logic to avoid the `exit()` call
when the `user-data` file is missing.

MFC After:	1 week
Signed-off-by: Gonéri Le Bouder <goneri@lebouder.net>
Differential Revision:	https://github.com/freebsd/freebsd-src/pull/1953
2026-01-08 10:55:27 +01:00
William Carrel 9ae43352c8 GCE: ARM64 Support: Add hw.pci.honor_msi_blacklist=0.
This is required for MSI support on GCE ARM64 instances which is
prerequisite to gve(4) not panicking at boot, and nvme(4) also has
a real sad time without interrupts. Tested on a variety of c4a VMs.

This is meant to be a temporary hack; long term fix would be to
check for the hypervisor and quirk gve(4) device with
PCI_QUIRK_ENABLE_MSI_VM.

PR:		kern/292081
MFC after:	1 week
2026-01-08 00:59:07 -08:00
William Carrel f604d84618 GCE: Enable vtnet(4) Multiqueue.
Removes hw.vtnet.mq_disable=1.

This workaround was originally introduced nearly a decade ago to
address stability issues on KVM that have long since been resolved
in both the FreeBSD driver and the GCE hypervisor. Removing this
allows network interrupts to scale across multiple vCPUs.

Tested on n2-highcpu-16 VM with 15.0-RELEASE and confirmed multiple
queue pairs active and interrupts handling across cores.

PR:		kern/292081
MFC after:	1 day
2026-01-08 00:59:06 -08:00
William Carrel 709c1049fe GCE: Fix growfs path
The sed command was missing the ${DESTDIR} prefix, meaning it was
attempting to modify the build host's /etc/rc.d/growfs instead of
the target image's script. Tested in an arm64 builder that builds
as non-root.

PR:		kern/292081
MFC after:	1 day
2026-01-08 00:59:06 -08:00
Dimitry Andric eb1b6ec7a7 zfs: emit .note.GNU-stack section for all ELF targets
On FreeBSD, linking the zfs kernel module with binutils ld 2.44 shows
the following warning:

    ld: warning: aesni-gcm-avx2-vaes.o: missing .note.GNU-stack section implies executable stack
    ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker

Some of the `.S` files under `module/icp/asm-x86_64/modes` check whether
to emit the `.note.GNU-stack` section using:

    #if defined(__linux__) && defined(__ELF__)

We could add `&& defined(__FreeBSD__)` to the test, but since all other
`.S` files in the OpenZFS tree use:

    #ifdef __ELF__

it would seem more logical to use that instead. Any recent ELF platform
should support these note sections by now.

Reviewed by:	emaste, kib, imp
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D54578
2026-01-08 09:51:36 +01:00
Warner Losh cd1aa5f991 tools/cam: Start to add the testing tools for CAM
Create a directory for testing tools arond CAM. These are snippets of
what will eventually be camio. At the moment, it was written using fbt
traces. This is OK, but fragile, so they need to be re-written with the
cam provider. cam_all_but_scsi.d is the first step. It shows how to do
this with the new cam dtrace provider.

Sponsored by:		Netflix
Reviewed by:		adrian
Differential Revision:	https://reviews.freebsd.org/D54472
2026-01-07 23:20:34 -07:00
Warner Losh efb77950fd dtrace: Add definitiosn for the cam dtrace provider
Sponsored by:		Netflix
Reviewed by:		adrian
Differential Revision:	https://reviews.freebsd.org/D54471
2026-01-07 23:20:28 -07:00
Warner Losh aaec2a90b5 cam: When inq data isn't valid, pass NULL
When the device isn't there, we don't have valid inq data. Pass NULL in
this case. All the routines that receive this test against NULL already.

Sponsored by:		Netflix
Reviewed by:		adrian
Differential Revision:	https://reviews.freebsd.org/D54470
2026-01-07 23:19:21 -07:00
Warner Losh 1a7151f796 cam: Add probes for xpt actions
cam::xpt:action(union ccb *)
cam::xpt:done((union ccb *)
cam::xpt:async-cb(void *cbarg, uint32_t async_code, struct cam_path
	*path, void *async_arg);

Called when xpt_action(), xpt_done*() and the xpt async callbacks are
called.

Sponsored by:		Netflix
Reviewed by:		adrian
Differential Revision:	https://reviews.freebsd.org/D54469
2026-01-07 23:19:10 -07:00
Warner Losh ecb1f46583 cam: Start adding dtrace provider 'cam'
Start to provide robust tracing in cam now that clang has broken my
fbt-based dtrace scripts a couple of times.

Sponsored by:		Netflix
Reviewed by:		adrian
Differential Revision:	https://reviews.freebsd.org/D54468
2026-01-07 23:19:03 -07:00
Warner Losh 3989a3d817 loader: Only warn when we have neither FDT nor ACPI
Sponsored by:		Netflix
Reviewed by:		adrian, andrew
Differential Revision:	https://reviews.freebsd.org/D54510
2026-01-07 22:34:28 -07:00
Jarmo Jaakkola d82698ac68 loader.efi: Only use SPCR if enabled.
SerialPort in the SPCR is zeroed when serial redirection is disabled,
rather than the SPCR being omitted from the ACPI tables ony many
systems. Check to see that SerialPort.Address is non-zero before using.

FreeBSD would fail to boot on systems that could have a serial port
redireciton, but don't have it enabled because the loader would create a
bogus hw.uart.console. While one could unset this value to boot, you
couldn't do that automatically very easily. Instead, don't even look
at the SPCR table if the SerialPort is zero'd.

PR: 292206
MFC After: 3 days
Sponsored by: Netflix
Co-authored-by: Warner Losh <imp@FreeBSD.org>
Closes:  https://github.com/freebsd/freebsd-src/pull/1948
2026-01-07 22:28:44 -07:00
George V. Neville-Neil e2bedc7d69 Extend the script to collect gprof data
While we're at it, switch to simple waiting from communicate() calls.
2026-01-08 04:14:52 +00:00
Marius Strobl 9b5d6ab1be sdhci_pci(4): Remove incorrect __unused
The slot parameter actually is used as index into the memory resource.

Fixes:	c11bbc7d
2026-01-08 02:20:54 +01:00
Marius Strobl 61002e0371 tty(4): Consistently use ISO C99 bool
Fixes:	9750d9e5
2026-01-08 02:20:54 +01:00
Konstantin Belousov dcb80621bb vm_object.h: tweak OBJ_ONEMAPPING comment even more
The formulation that pages are allowed to have at most one mapping is
not quite clear.  Nothing prevents pages from having more than one
mapping, but the flag must be cleared then.

Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D54570
2026-01-08 01:56:33 +02:00
Jean-Sébastien Pédron 6c0bcd15e4 linuxkpi: Add rol32()
`rol64()` and `rol32()` are used by <linux/siphash.h>. The former was
added previously, before <linux/siphash.h> was added. However the latter
was not, and it broke the build on armv7.

Reported by:	adrian
Reviewed by:	adrian, rpokala
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54588
2026-01-07 23:39:04 +01:00
Jean-Sébastien Pédron 10c6f1f627 linuxkpi: Replicate the chain of #include in the cec*.h headers
The i915 DRM driver depends on this namespace pollution to access
`debugfs_*` functions, after several explicit #include of
<linux/debugfs.h> were removed in Linux 6.10.

Reviewed by:	bz, christos
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54494
2026-01-07 22:38:40 +01:00
Jean-Sébastien Pédron 3942e85b99 linuxkpi: Add WARN_RATELIMIT()
The i915 DRM driver started to use it in Linux 6.10.

Reviewed by:	bz, christos
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54493
2026-01-07 22:38:40 +01:00
Jean-Sébastien Pédron e86e4f161e linuxkpi: Add <linux/kmsg_dump.h>
This header declares register/unregister functions to allow a piece of
code to tell what function to call in case of a panic. Several panic
handlers may be registered.

The DRM generic code started to use it in Linux 6.10 as part of the
panic handler.

Reviewed by:	bz, christos
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54492
2026-01-07 22:38:40 +01:00
Jean-Sébastien Pédron 514d37fa26 linuxkpi: Add <linux/font.h>
The header defines the minimum to allow the DRM generic code to build.
The only function used so far is `get_default_font()`, as part of a
DRM-specific panic handler. We do not use this panic handler on FreeBSD.

For now, it returns a NULL value. It should probably map to a vt(4)
font.

The DRM generic code started to use it in Linux 6.10 as part of the
panic handler.

Reviewed by:	bz, christos
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54491
2026-01-07 22:38:39 +01:00
Jean-Sébastien Pédron ac341353a0 linuxkpi: Define raw_spinlock_t in <linux/spinlock.h>
For now, it is synonymous to `spinlock_t`. The DRM generic code uses the
`struct raw_spinlock` and not `raw_spinlock_t`, that's why the
definition is a struct embedding a `struct mtx`, compared to
`spinlock_t` which is a simpler typedef.

The DRM generic code started to use it in Linux 6.10.

Reviewed by:	bz, christos
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54489
2026-01-07 22:38:36 +01:00
Andrew Gallatin 14d93f612f iflib: Drop tx lock when freeing mbufs using simple_transmit
Freeing completed transmit mbufs can be time consuming (due to them
being cold in cache, and due to ext free routines taking locks),
especially when we batch tx completions. If we do this when holding
the tx ring mutex, this can cause lock contention on the tx ring mutex
when using iflib_simple_transmit.

To resolve this, this patch opportunistically copies completed mbuf
pointers into a new array (ifsd_m_defer) so they can be freed after
dropping the transmit mutex. The ifsd_m_defer array is
opportunistically used, and may be NULL. If its NULL, then we free
mbufs in the old way. The ifsd_m_defer array is atomically nulled
when a thread is using it, and atomically restored when the freeing
thread is done with it. The use of atomics here avoids
acquire/release of the tx lock to restore the array after freeing
mbufs.

Since we're no longer always freeing mbufs inline, peeking into them to see if a
transmit used TSO or not will cause a useless cache miss, as nothing
else in the mbuf is likely to be accessed soon. To avoid that cache
miss, we encode a TSO or not TSO flag in the lower bits of the mbuf
pointer stored in the ifsd_m array. Note that the IFLIB_NO_TSO flag
exists primarily for sanity/debugging.

iflib_completed_tx_reclaim() was refactored to break out
iflib_txq_can_reclaim() and _iflib_completed_tx_reclaim()
so the that the tx routine can call iflib_tx_credits_update()
just once, rather than twice.

Note that deferred mbuf freeing is not enabled by default, and can be
enabled using the dev.$DEV.$UNIT.iflib.tx_defer_mfree sysctl.

Differential Revision: https://reviews.freebsd.org/D54356
Sponsored by: Netflix
Reviewed by: markj, kbowling, ziaee
2026-01-07 14:32:08 -05:00
Kyle Evans e30086ab4c lualoader: fix pruning of non-existent default kernel
Removing the kernel from the list of available kernels is sufficient to
avoid rendering it in the list, but we need more for booting to actually
work.  Notably, the 'kernel' loader.conf var was left intact to its
default value, so if one didn't use the kernel selector in the menu then
we'd try to boot the nonexistent 'kernel' instead of the new default
(first autodetected).

There's room to improve the error messages here, but for now let's just
make it actually work correctly.

PR:		292232
Fixes:	d04415c520 ("loader: lua: remove the default kernel [...]")
2026-01-07 12:20:05 -06:00
Jose Luis Duran 47015e4546 tests: Increase timeout
Bump the timeout value, to avoid cutoff on emulated architectures on
ci.freebsd.org.

Reported by:	Jenkins
Reviewed by:	ngie
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D54550
2026-01-07 17:52:26 +00:00
Jose Luis Duran 301bc149b9 pf: tests: Require python3
Reported by:	Jenkins
Reviewed by:	kp, ngie
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D54549
2026-01-07 17:51:57 +00:00
Roman Bogorodskiy 9fc7fe6427 bhyve: improve console error reporting on arm64
Currently, on arm64, if bhyve fails to initialize the console,
it falls into assert(), which does not look particularly pretty
for users.

Replace the assert with proper error handling so bhyve prints
a meaningful error message and exits with status code 4 (error).
That matches the behavior on amd64.

Approved by:		markj
Reviewed by:		markj
Differential Revision:	https://reviews.freebsd.org/D54504
2026-01-07 18:06:45 +01:00
Alan Somers 3b6615ec03 netstat: fix a segfault with --libxo
Fix a segfault when printing the "protocol" field.  The field-format and
encoding-format were expecting different numbers of arguments.

Also, fix the width of the tcp-state field in encoded output.

PR:		292228
Fixes:		c2b08c13c2 netstat: add support for UDP-Lite endpoints
MFC after:	1 week
Sponsored by:	ConnectWise
Reviewed by:	tuexen, js, des
Differential Revision: https://reviews.freebsd.org/D54567
2026-01-07 07:35:13 -07:00
Baptiste Daroussin d07198ff72 release: stop disabling sendmail
sendmail is already disabled by default everywhere since 14.0

MFC After:	1 week
Approved by:	emaste (re)
Reviewed by:	emaste (re)
Differential Revision:	https://reviews.freebsd.org/D54575
2026-01-07 15:19:43 +01:00
Gonéri Le Bouder cbc00fcc2b nuageinit: only create the default user when needed
The "default" user should only be created when:

- the `users` key is missing
- or the `default` string is present in the `users` list

Since the `public_keys` is extracted from the meta-data, this patch has
to slightly adjust the way they are loaded.
The change simplify the logic around the default user SSH key injection.
Both `ssh_authorized_keys` and `public_keys` are handled at the same time.

MFC After:	1 week
Signed-off-by: Gonéri Le Bouder <goneri@lebouder.net>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1952
2026-01-07 13:29:58 +01:00
Michael Osipov c2b407244f mrsas.4: Fix devid hex style 2026-01-07 09:04:14 +01:00
Brad Smith 5d73fca1f4 if_rge: sync with up to date OpenBSD code
a0b4d9e5bd63984bc3ad25b7f2881741e0d73980
Add support for RTL8126 chip revision 0x64a00000 from Carl Henriksson.
While here, update and add microcode for the RTL8126 chipset variant.

46810ff569a9416642fc5f8e86501028008a2e95
For RTL8125, there's no need to check whether RGE_CMD_STOPREQ has been
completed.  As with other chip variants, RGE_CMD_STOPREQ never acknowledges
completion.

5729fb17b5eeba56781da0b5c0525c198c5c2cd8
remove duplicate RGE_PHYSTAT_5000MBPS test

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D54517
Obtained from:	OpenBSD
2026-01-06 18:27:09 -08:00
Minsoo Choo f441a225c4 stdbool.h: Update for C23
When a compiler with C23 or higher is detected, builtin bool, true,
and false are used to conform the C23 standard.

Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D44664
2026-01-06 20:26:59 -05:00
Alexander Ziaee 1961785e35 pxeboot.8: Fix mdoc typo for emails, tag spdx
Fixes:		a37825313f (Fix mdoc typos for emails, tag spdx)
MFC after:	3 days
2026-01-06 17:47:54 -05:00
Andrew Gallatin 83e6f0d780 iflib: document new sysctls
Document the new tx related sysctls I've added to iflib in the
last few months:  tx_reclaim_ticks & tx_reclaim_thresh

Sponsored by: Netflix
Reviewed by: ziaee
Differential Revision: https://reviews.freebsd.org/D54564
MFC after: 3 days
2026-01-06 17:46:12 -05:00
Michael Osipov ccec94bf63 mrsas.4: Add Fujitsu RAID Controller SAS 6Gbit/s 1GB (D3116)
This is an OEM card from Fujitsu using an LSI SAS2208 ROC controller shipped
with many Fujitsu PRIMERGY servers like RX300 S7.

Controller description: https://www.fujitsu.com/global/products/computing/servers/primergy/blades/connection/cb-pmod-110426.html

Reviewed by:	ziaee
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D54566
2026-01-06 22:32:26 +01:00
Mark Johnston 203e5a1eee linker: Reset DMAP protections in link_elf_unload_file()
On x86, when a preloaded kernel module is unloaded, we free the backing
(physically contiguous) pages.  The ET_REL linker will have adjusted
protections on segments of the preloaded file, which updates the direct
map, so the original protections must be restored when unloading the
module.

Previously this was handled in kmem_bootstrap_free(), but there is no
apparent reason not to handle this within the kernel linker.  Moreover,
we were not resetting permissions in the kernel map on arm64.

Reviewed by:	alc, kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D54438
2026-01-06 20:54:10 +00:00
Michael Osipov 8b210276cd mfi(4): Add subvendor and subdevice for Fujitsu RAID Controller SAS 6Gbit/s 1GB (D3116)
This is an OEM card from Fujitsu using an LSI SAS2208 ROC controller shipped
with many Fujitsu PRIMERGY servers like RX300 S7. This chip is also recognized
by mrsas(4) under the generic name for the controller chip.

Controller description: https://www.fujitsu.com/global/products/computing/servers/primergy/blades/connection/cb-pmod-110426.html

Reviewed by:	ziaee
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D54520
2026-01-06 20:10:46 +01:00
Minsoo Choo 6c6e00b7f1 mips: remove mips leftovers
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1909
2026-01-06 12:56:50 -05:00