Commit Graph
313440 Commits
Author SHA1 Message Date
Konstantin Belousov 20c09e6fec amd64: use WRMSRNS immediate form to update splitlock control, when available
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59815
2026-09-22 18:40:41 +03:00
Konstantin Belousov 74d325fee2 amd64: cache MSR_MEMORY_CTL in pcpu
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59815
2026-09-22 18:40:41 +03:00
Konstantin Belousov 51cea5416a amd64: add userspace control for disabling splitlocks
Thread can control it with sysarch(I386_SET_SPLITLOCK). The global
default is set with hw.splitlock_force.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59815
2026-09-22 18:40:41 +03:00
Konstantin Belousov e318f24c0f amd64: support for tracking per-thread 'disable splitlocks' state
If hw supports it, on atomic operation that requires exclusive ownership
of more than one cache line, #AC is generated.
The state is maintained as the arch-private TDF_MD_SPLITLOCK_AC flag.

The state is inherited on thread creation from the thread spawning the
new one.  It is cleared on exec.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59815
2026-09-22 18:40:40 +03:00
Konstantin Belousov d8c1abb0e3 amd64: calculate if hardware supports disabling splitlocks
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59815
2026-09-22 18:40:40 +03:00
Konstantin Belousov c6d7235ac1 amd64: handle #AC in kernel mode
Recover from it if PCB_ONFAULT handler is provided.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59815
2026-09-22 18:40:40 +03:00
Konstantin Belousov dc97561221 amd64: add md thread flags word
Use a hole in struct mdthread.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59815
2026-09-22 18:40:40 +03:00
Konstantin Belousov 4a8acccc2e amd64 cpufunc.h: add WRMSRNS helpers
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59815
2026-09-22 18:40:40 +03:00
Konstantin Belousov 71f08bfa02 x86: add cpu_stdext_feature5
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59815
2026-09-22 18:40:40 +03:00
Konstantin Belousov 9aa031eb92 x86: add definitions for the CORE_CAP and MEMORY_CTL MSRs
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59815
2026-09-22 18:40:40 +03:00
Enji Cooper 9522310861 contrib/atf: upgrade to 0.26
This new version gets contrib/atf in line with the published version of
the package up on [GitHub][github].

Please note that this release is a major update: it contains several
bugfixes and feature enhancements. Most were already present in the
FreeBSD src repo, but there were a large number of changes made in
addition to what was already present.

MFC after:      1 month

Merge commit '9c78088348bcf1059d82a62bb57a0746309d4312'

Conflicts:
        contrib/atf/.cirrus.yml
        contrib/atf/Makefile.am
        contrib/atf/Makefile.in
        contrib/atf/aclocal.m4
        contrib/atf/admin/ar-lib
        contrib/atf/admin/check-style-common.awk
        contrib/atf/admin/check-style.sh
        contrib/atf/admin/compile
        contrib/atf/admin/config.guess
        contrib/atf/admin/config.sub
        contrib/atf/admin/depcomp
        contrib/atf/admin/install-sh
        contrib/atf/admin/ltmain.sh
        contrib/atf/admin/missing
        contrib/atf/atf-c++/Makefile.am.inc
        contrib/atf/atf-c++/atf-c++.3
        contrib/atf/atf-c++/atf-c++.pc.in
        contrib/atf/atf-c++/check.cpp
        contrib/atf/atf-c++/check.hpp
        contrib/atf/atf-c++/detail/Makefile.am.inc
        contrib/atf/atf-c++/detail/process_test.cpp
        contrib/atf/atf-c/Makefile.am.inc
        contrib/atf/atf-c/atf-c.3
        contrib/atf/atf-c/atf-c.pc.in
        contrib/atf/atf-c/detail/Makefile.am.inc
        contrib/atf/atf-c/detail/fs.c
        contrib/atf/atf-c/detail/fs_test.c
        contrib/atf/atf-c/detail/process_test.c
        contrib/atf/atf-c/tc.c
        contrib/atf/atf-c/tc.h
        contrib/atf/atf-sh/Makefile.am.inc
        contrib/atf/atf-sh/atf-check.cpp
        contrib/atf/atf-sh/atf-check_test.sh
        contrib/atf/bootstrap/Makefile.am.inc
        contrib/atf/bootstrap/package.m4
        contrib/atf/bootstrap/testsuite
        contrib/atf/config.h
        contrib/atf/configure
        contrib/atf/configure.ac
        contrib/atf/doc/Makefile.am.inc
        contrib/atf/doc/atf-test-case.7
        contrib/atf/m4/developer-mode.m4
        contrib/atf/m4/libtool.m4
        contrib/atf/m4/ltoptions.m4
        contrib/atf/m4/ltsugar.m4
        contrib/atf/m4/ltversion.m4
        contrib/atf/m4/lt~obsolete.m4
        contrib/atf/m4/module-defs.m4
        contrib/atf/test-programs/Makefile.am.inc

[github]: https://github.com/freebsd/atf
2026-09-22 08:23:32 -07:00
Enji Cooper 9c78088348 atf: import atf-0.26
This change imports 0.26 release content from [upstream][1].

The atf-0.26 artifact was been verified by [SHA256 checksum][2].

This update pulls in a large number of memory management fixes, polished upstreamed
content from contrib/atf in FreeBSD (proper), etc.

Please note that this new version requires a C++-20 compatible toolchain
to build.

More information about the release (from a high level) can be found in
the [release notes][3].

Updated via [`update_atf.sh`][4] using `update_atf.sh 0.26 atf-0.26`.

1: https://github.com/freebsd/atf/releases/download/atf-0.26/atf-0.26.tar.gz
2: https://github.com/freebsd/atf/releases/download/atf-0.26/atf-0.26.tar.gz.sha256
3: https://github.com/freebsd/atf/blob/atf-0.26/NEWS.md
4: https://codeberg.org/ngie/freebsd-powertools:shell/update_atf.sh@10a04edb
2026-09-22 00:06:06 -07:00
Enji Cooper ac2d088aae atf: import atf-0.26-rc1
This change adds atf atf-0.26-rc1 from [upstream][1].

The atf-0.26-rc1 artifact was been verified by [SHA256 checksum][3].

This release contains the upstreamed version of `require.kmods` support
provided by des@ in [freebsd@83a1ee57][require-kmods-support].

More information about the release (from a high level) can be found in
the [release notes][4].

Updated via [`update_atf.sh`][4] `update_atf.sh 0.26-rc1 atf-0.26`.

1: https://github.com/freebsd/atf/releases/download/atf-0.26-rc1/atf-0.26-rc1.tar.gz
2: https://github.com/freebsd/atf/releases/download/atf-0.26-rc1/atf-0.26-rc1.tar.gz.sha256
3: https://github.com/freebsd/atf/blob/atf-0.26-rc1/NEWS.md
4: https://codeberg.org/ngie/freebsd-powertools:shell/update_atf.sh@10a04edb
require-kmods-support: https://cgit.freebsd.org/src/commit/?id=83a1ee578c9d1ab7013e997289c7cd470c0e6902
2026-09-20 17:46:29 -07:00
Andrew Turner a856958cab arm64/smmu: Fix the SMMU-600 errata check
Fixes:	6dca6e2aa8 ("arm64/smmu: Start handling errata")
Sponsored by:	Arm Ltd
2026-09-18 20:54:16 +01:00
Paulo Fragoso 6d9f435739 hwpmc: fix leak of IBS per-CPU array on unload
pmc_ibs_initialize() allocates the ibs_pcpu[] pointer array, and
pmc_ibs_finalize() exists to free it, but pmc_ibs_finalize() is
never called.  Every hwpmc unload on a CPU with IBS therefore leaks
one pmc_cpu_max()-sized pointer array.

Call pmc_ibs_finalize() from pmc_amd_finalize(), alongside the RAPL,
TSC and perf classes.  IBS is only initialized on CPUs that support
it, so make pmc_ibs_finalize() return early when ibs_pcpu is NULL,
making it safe to call when the class was skipped at initialize
time, as pmc_rapl_finalize() already is.

Tested on an AMD Ryzen 5 5600X (Zen 3, 12 threads) with INVARIANTS.
Before the change, each kldload/kldunload cycle leaked one 96-byte
M_PMC allocation, and DTrace showed the ibs_pcpu[] allocation from
pmc_ibs_initialize() as the only one never freed.  After the change,
50 load/unload cycles leave M_PMC InUse and MemUse unchanged, and
every allocation made at load is freed at unload.

Reviewed by:	mhorne
Fixes:		e51ef8ae49 ("hwpmc: Initial support for AMD IBS")
Sponsored by:	NLINK (https://nlink.com.br), Recife, Brazil
Differential Revision:	https://reviews.freebsd.org/D59881
2026-09-22 11:01:24 -03:00
Siva Mahadevan 34c40126fd tarfs_test: split large file test into independent cases
This avoids globally set timeouts for the group of
tarfs_large tests on slower emulated architectures.

While here, lower each testcase's timeout to reflect
the reduction of work. On QEMU aarch64, the largest case
runs in ~500s on a modern desktop, so double that for a
conservative estimate.

Discussed with:		des
MFC after:		3 days
Sponsored by:		The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D59033
2026-09-22 09:55:58 -04:00
Brian Scott fa28ede31d jh7110_temp: CPU temperature sensor for JH7110
This patch adds a driver for the CPU temperature sensor on the jh7110
SoC.

The calibration numbers come from the OpenBSD driver but are reworked to
produce a result in K rather than C.

The temperature is exposed as a sysctl, dev.jh7110_temp.0.temperature
but I have also exposed it as dev.cpu.0.temperature because that's where
you find it on a RaspberryPi and amdtemp(4), so it's a lot more obvious.

(mhorne: Added 'starfive,jh7100-temp' compatible.)

Reviewed by:	mhorne, bnovkov
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D59478
2026-09-22 10:52:24 -03:00
Kajetan Puchalski 334f81f411 arm64/vmm: Fix translation regime in s2_tlbi_range
s2_tlbi_range under VHE is supposed to clear HCR_EL2.TGE, but it erroneously
clears an unrelated bit 27 in TCR_EL2 (HWU61). Since HCR_TGE determines which
translation regime will be used by a tlbi, the instruction targets the
wrong regime when it is not cleared.

Fix the register accessed by the function to actually clear HCR_EL2.TGE.

Signed-off-by: Kajetan Puchalski <[email protected]>
Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://github.com/freebsd/freebsd-src/pull/2435
2026-09-18 20:07:49 +01:00
Enji Cooper 6f3445006a [tests] lib/libc/gen:assert_test: skip tests when NDEBUG set
In the event that NDEBUG is specified in CFLAGS--which is most likely
triggered via `MK_ASSERT_DEBUG` == "no" -- all assert(3) statements are
optimized out by design. This breaks the assert(3) tests as they
specifically rely on assert(3) actually raising a `SIGABRT` instead of
quietly succeeding.

Skip both tests if `NDEBUG` is set. There's no sense running the
`assert(true)` test if the result could instead be a false positive.

MFC after:	2 weeks
2026-09-21 23:30:30 -07:00
Alexander Ziaee 14b855d296 mandoc: Drop -ieee754-2008 abbreviation
Improve manpage compatability by dropping an abbreviation macro that
compiler upstreams do not want, causing manuals using it to render
incorrectly on other toolchains or operating systems. It was only used
in three manuals, which are amended in this commit.

Reviewed by:	fuz, markj
MFC after:	no, these did not MFC
Requested by:	Ingo Schwarze <[email protected]>
Fixes:		db3884b039 ("contrib/mandoc: add -ieee754-2008")
Fixes:		63cd0841de ("document .St -ieee754-2008 in mdoc")
Differential Revision:	https://reviews.freebsd.org/D59880
2026-09-22 01:00:06 -04:00
Enji Cooper d90a75af95 src.conf(5): regenerate after f6db138f97
MFC after:	2 weeks
MFC with:	f6db138f97 ("src.opts.mk: force the Dtrace tests ...")
2026-09-21 20:02:02 -07:00
Enji Cooper df6131e2b7 Remove CDDL and ctfconvert tests when their controlling knobs are disabled
In the event someone specified MK_CDDL == no prior to this change, all
tests under `/usr/tests/cddl` would stick around after the change,
resulting in errors. Similarly, MK_DTRACE == no removed ctfconvert,
which the ctfconvert tests relied on (but remained around after the knob
was disabled).

Remove the tests under the respective blocks now so they don't linger
around on systems where these knobs are disabled, resulting in false
positives when running the complete test suite.

The ctfconvert tests weren't specifically put under
`${MK_DTRACE_TESTS}` == no because ctfconvert was bundled separately
from the upstream provided Dtrace test suite.

MFC after:	2 weeks
MFC with:	30c20ca26 ("Remove Dtrace/ZFS tests if their knobs are disabled")
2026-09-21 19:53:03 -07:00
Enji Cooper f6db138f97 src.opts.mk: force the Dtrace tests off if ${MK_DTRACE} == no
Prior to this change Dtrace's tests could be enabled even if
`${MK_DTRACE}` == no. Allowing this doesn't make sense so remove the
tests if `${MK_DTRACE}` is also disabled.

MFC after:	2 weeks
2026-09-21 19:53:03 -07:00
Maxim Konovalov 04fcf30961 dummynet: do not overflow the points[ED_MAX_SAMPLES_NO] array
Otherwise, the following would segfault

dnctl pipe 1 config bw 1Mbit/s profile 1025points.txt

Found with:	Claude Code Sonnet 5
MFC after:	2 weeks
2026-09-22 02:36:46 +00:00
Enji Cooper 30c20ca26e Remove Dtrace/ZFS tests if their knobs are disabled
Prior to this change, Dtrace and ZFS tests and their respective
directories would remain installed even if `${MK_DTRACE_TESTS}` == no or
`${MK_ZFS_TESTS}` == no.

This change enhances the logic to remove the tests when the respective
knobs are disabled so the tests will be removed when `make delete-old`
is run.

MFC after:	2 weeks
2026-09-21 19:31:34 -07:00
Colin Percival 5a2328a178 vmimage.subr: Include dangling symlinks in images
When creating VM images, we filter the METALOG file created by pkg(8)
when installing non-base packages, rejecting any lines which correspond
to files which don't exist; this solves a problem which arose when a
package was installed and then deinstalled (or upgraded) later in the
image-building process.

Unfortunately [ -e ... ] follows symlinks and is not basedir-aware, so
an absolute symlink which is valid *inside* the image is omitted from
the image if it points to something which isn't present in the build
host system.

Replace [ -e ... ] with [ -e ... ] || [ -L ... ] so that symlinks are
included even if dangling.

While I'm here, add quoting in case future paths become problematic.

Sponsored by:	Amazon
MFC after:	3 days
2026-09-21 17:19:01 -07:00
Osvaldo Janeri Filho 8a0cab240f hwpmc/amd: replace static pmcdesc[] and pc_amdpmcs[] with dynamic allocation
AMD_NPMCS_MAX = 342 (16 core + 6 L3 + 64 DF + 256 UMC). On a Zen 4
EPYC 9654 with 6 core, 6 L3, 16 DF, and 4 UMC counters, only 32
descriptors are needed; the static arrays over-allocate by ~10x.

Replace both amd_pmcdesc[AMD_NPMCS_MAX] and per-CPU pc_amdpmcs[AMD_NPMCS_MAX]
with mallocarray() sized to the actual registered PMC count:
  - amd_pmcdesc: allocated in pmc_amd_initialize()
  - pc_amdpmcs:  allocated per-CPU in amd_pcpu_init(), freed in fini()

Normalize amd_l3_npmcs and amd_df_npmcs against the AMDID2_PTSCEL2I
and AMDID2_PNXC feature bits before computing npmcs_total, so that
allocation, registration, and amd_get_msr() row offsets are all derived
from the same values.  Previously the ternary in npmcs_total excluded
L3/DF from the allocation while the globals retained their defaults,
causing amd_get_msr() to miscompute DF row offsets when L3 is absent.

amd_umc_npmcs comes from CPUID Fn8000_0022h EBX[23:16] (NumUMCCounters)
and is zero when the leaf is absent, so no additional feature flag is
needed.  See AMD64 APM Vol.3 Appendix E.

Fix three error-path memory leaks: amd_hwcheck() failure, goto error,
and finalize.  Reset amd_npmcs = 0 on the error path.

Tested on AMD EPYC 9654 (Zen 4, Family 19h Model 11h, 192 threads).
Full PMC test suite (IBS/UMCDF/PMC/L3/DF/TSC): 0 failures.

Signed-off-by: Osvaldo Janeri Filho <[email protected]>
Reviewed by:	mhorne
MFC after:	1 week
Sponsored by:	AMD
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2415
2026-09-21 19:49:42 -03:00
Mitchell Horne c745fccd9b riscv: enable gpiopower driver
It is functional, and there are some RISC-V platforms which can benefit
from it.

Requested by:	Brian Scott <[email protected]>
Sponsored by:	The FreeBSD Foundation
2026-09-21 19:43:43 -03:00
Brian Scott e67697869e eqos: Reduce RX error noisiness
Reduce very common console messages:
	Receive error rdes3=30208000

As observed on the VisionFive v2 hardware after some large transfers.

Differentiate between overflow errors and others. Report the errors when
the length is non-zero (overflow errors).

Also, count errors for netstat purposes.

Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D59479
2026-09-21 19:43:31 -03:00
Enji Cooper 9257ae7294 Add entries for third-party projects I maintain
Add myself formally as the "maintainer" for atf, kyua, and lutok, both
in the GitHub CODEOWNERS and MAINTAINERS files.

This change matches the herald rules I recently setup for these
third-party components.
2026-09-21 15:04:04 -07:00
Alexander Ziaee 2784767077 umct.4: Canonicalize SYNOPSIS, HARDWARE, tag SPDX
MFC after:	3 days
2026-09-21 17:03:20 -04:00
Alexander Ziaee 71a0ea7023 umcs.4: Describe better, canonicalize SYNOPSIS
+ tag SPDX
+ improve apropos and hardware notes context
+ canonicalize SYNOPSIS

MFC after:	3 days
2026-09-21 17:03:20 -04:00
Alexander Ziaee b952821be7 ulpt.4: Canonicalize SYNOPSIS, tag SPDX
MFC after:	3 days
2026-09-21 17:03:20 -04:00
Alexander Ziaee 6204c60fc0 uled.4: Canonicalize SYNOPSIS, tag SPDX
MFC after:	3 days
2026-09-21 17:03:20 -04:00
Federico Angelilli 46d383af0d pciconf: Add -C option to filter by class name
Differential Revision:	https://reviews.freebsd.org/D59602
MFC after:	3 weeks
PR:		289923
Reviewed by:	bnovkov
2026-09-21 20:37:59 +02:00
Konstantin Belousov 64a73d1b6d amd64/*sigtramp.S: re-enable some cfi annotations for special registers
Also explicitly specify .cfi_sections to emit the cfi bytecode into the
loadable .eh_frame section.

Reviewed by:	mchoo
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59838
2026-09-21 21:25:38 +03:00
Siva Mahadevan 1b9aea382e gh-bc/tests: run tests in parallel
Helps to mitigate failures due to timeout in CI on emulated architectures:
https://ci.freebsd.org/job/FreeBSD-main-riscv64-test/16565/testReport/usr.bin.gh-bc/

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D59547
2026-09-21 14:22:08 -04:00
Alexander Ziaee f4e7e5eced ukbd.4: Canonicalize SYNOPSIS, tag SPDX
Also add a missing Cd tag for consistency.

MFC after:	3 days
2026-09-21 13:06:40 -04:00
Alexander Ziaee f1a4ac4aca uipaq.4: Canonicalize SYNOPSIS, tag SPDX
MFC after:	3 days
2026-09-21 13:06:40 -04:00
Roman Bogorodskiy b27a221ef7 bhyve: fix boot device ordering
EDK2's QemuBootOrderLib inspects the bootorder file provided
via fw_cfg and requires it to be NUL-terminated. Otherwise,
it rejects the supplied bootorder and falls back to its
default boot order.

Currently, bhyve registers bootorder with qemu_fwcfg_add_file()
using bootorder_len returned by open_memstream(), which excludes
the trailing NUL byte.

Fix that by passing bootorder_len + 1 to qemu_fwcfg_add_file() so
the fw_cfg payload is properly NUL-terminated.

PR:		279720
Reviewed by:	markj
Found with:	codex (gpt-5.6-sol)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D59859
2026-09-21 18:54:45 +02:00
Alexander Ziaee 00d693e47e ufoma.4: Improve HARDWARE introductory sentence
MFC after:	3 days
2026-09-21 12:50:47 -04:00
Alexander Ziaee 2407b84c68 uhso.4: describe better, SYNOPSIS, HARDWARE, SPDX
+ Update SYNOPSIS to the new standard format
+ Give this a clearer description in apropos
+ Give this a clearer description in hardware note
+ Spinoff SYSCTL VARIABLES from HARDWARE
+ Pet linter for long lines and trailing punctuation
+ Tag SPDX

MFC after:	3 days
2026-09-21 12:49:05 -04:00
Alexander Ziaee 7d1edc5b36 uhid.4: Canonicalize SYNOPSIS, tag SPDX
MFC after:	3 days
2026-09-21 12:49:05 -04:00
Alexander Ziaee 6a075798bf ugold.4: Canonicalize SYNOPSIS, HARDWARE, tag SPDX
MFC after:	3 days
2026-09-21 12:49:05 -04:00
Hayzam Sherif fc44154841 vmm: Re-arm the PIT callout for square wave mode
The 8254's square wave mode (mode 3) is periodic, with the same
interrupt rate as the rate generator mode (mode 2), but
vatpit_callout_handler() only re-arms the channel 0 callout for
TIMER_RATEGEN.  A guest that programs mode 3 therefore receives a
single IRQ0 and no further timer interrupts.

Re-arm the callout for TIMER_SQWAVE as well, matching illumos
change 13301.

Reviewed by:	markj
Obtained from:	illumos 93d78aba5b32996fc2ae893a6237a0d3972f86b2
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D59816
2026-09-21 16:36:11 +00:00
Hayzam Sherif ce5b70657f vmm: Fix a page wiring leak in MOVS emulation
When emulating a MOVS from MMIO to guest RAM, the kernel's
vm_copy_setup() wires the destination pages.  If the subsequent
MMIO read fails, emulate_movs() skips vm_copy_teardown(), leaking
the page wire references acquired during setup.

Run vm_copy_teardown() regardless of the MMIO read result, and
only copy the value to guest memory if the read succeeds.
Preserve the existing error return.

This matches illumos change 13309.

Reviewed by:	markj
Obtained from:	illumos 83cd75bb2949d26e6eb38ddefc60fdeed1909643
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D59823
2026-09-21 16:36:11 +00:00
Hayzam Sherif d400b1ca31 vmm: Synchronize long-mode state when emulating CR0 writes
vmx_emulate_cr0_access() sets EFER.LMA and the IA-32e guest VM-entry
control when enabling paging with EFER.LME set, but does not clear them
when disabling paging.  This can leave an inconsistent guest state that
fails VM entry.

Update both fields in either direction based on EFER.LME and the CR0
value written to the VMCS.  Use the mask-adjusted CR0 value so the
resulting state remains consistent with the VMX fixed-bit requirements.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D59756
2026-09-21 16:36:06 +00:00
Hayzam Sherif 3330226fd3 vmm: Normalize a zero PIT count before starting channel 0
pit_timer_start_cntr0() does not schedule a callout when the initial
count is zero.  The counter write handler normalizes a programmed zero
count only after calling it, leaving an initially unarmed channel 0
without a scheduled timer event.

Move the existing normalization before the timer-start call.  Retain the
historical 0xffff representation of a zero count.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D59749
2026-09-21 16:35:58 +00:00
Roman Bogorodskiy 51234535dd bhyveload: validate character disk devices
Currently, bhyveload(8) does not validate the supplied disk
image path. For example, it allows passing the /dev/null
device, which later fails in userboot because it does not
support DIOCGSECTORSIZE and DIOCGMEDIASIZE ioctls (see
userdisk_init() in stand/userboot/userboot/userboot_disk.c).

Fix that by checking DIOCGSECTORSIZE and DIOCGMEDIASIZE ioctls early.
A similar check already exists in bhyve(8). While here, make
cb_diskioctl() report the obtained sector size instead of
hard-coding 512.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D59253
2026-09-21 16:31:34 +00:00
Alexander Ziaee 8943d47938 ugen.4: Canonicalize SYNOPSIS + tag SPDX
MFC after:	3 days
2026-09-21 12:23:39 -04:00