nvmm(4): Improve guest TSC handling
Don't skip updating TSC if the emulator set a zero value, which can
happen if the emulator resets the VM. In this case, we really want this
to be applied.
Meanwhile, rename 'gtsc_match' to 'gtsc_last'.
Credit: Maxime Villard (m00nbsd)
nvmm(4): Make use of kernel_fpu_begin() and kernel_fpu_end()
The kernel_fpu_*() API was added to help drm/amdgpu in commit
1be00ff1850ebb705db236c08160ee8fea99b32a, shortly after I ported NVMM.
Use this API to reduce difference with the NVMM upstream.
Credit: Maxime Villard (m00nbsd)
nvmm(4): Fix CPUID bits
- FMA/F16C/VAES/VPCLMULQDQ are part of AVX and should not be exposed.
- PSE36 is not supported and should not be exposed.
- EferLmsleUnsupp should be unconditionally exposed on AMD.
- SHA is part of XMM, which is supported, so it can be exposed.
Credit: Maxime Villard (m00nbsd)
nvmm(4): Add TPR support for SVM
If DecodeAssist is supported, intercept writes to CR8, and deliver
TPR_CHANGED VMEXITs to the emulator. This should improve the accuracy of
interrupt delivery on guests like Windows that make heavy use of CR8.
Credit: Maxime Villard (m00nbsd)
nvmm(4): Remove NVMM_IOC_VCPU_INJECT and associated artifacts
Events are injected in vcpu_run, so this ioctl is not used anymore.
Credit: Maxime Villard (m00nbsd)
nvmm(4): Fix the XSAVE area size
- Fix nvmm_x86_xsave_size(): x87/SSE are in the legacy region, and the
size of that region is constant regardless of whether SSE is enabled.
- When XSAVEC is supported, CPUID leaf 0x0000000D:ECX=1[EBX] is supposed
to return the current XSAVE area size, but NVMM mistakenly returns
zero. Given that NVMM supports only x87/SSE, XSAVEC is useless, so
rather than fixing the EBX return value, just don't advertise XSAVEC.
Credit: Maxime Villard (m00nbsd)
nvmm(4): Advertise new CPUID and ARCH_CAP bits
Advertise SsbdNotRequired and BTC_NO bits in CPUID and mitigation bits
in ARCH_CAP, for the guest to know not to turn on costly mitigations if
the CPU doesn't require them.
Credit: Maxime Villard (m00nbsd)
nvmm(4): Sync a few minor changes from m00nbsd
* Add new CPUID bits, and rename a few existing ones.
* Define NPF constants locally; don't rely on OS-provided PGEX_* values.
* Use os_vmspace_t instead of 'struct vmspace', which is the proper
OS-independent structure.
No functional changes.
Credit: Maxime Villard (m00nbsd)
nvmm(4): Explicitly specify sub-leaf 0 for CPUID 0x00000007
The 0x00000007 (Structured Extended Feature Flags) leaf has sub-leaves,
so use x86_get_cpuid2() to explicitly specify the sub-leaf for
correctness and portability.
See also the commit 0087a1d163488a57787a9a6431dd94070b1988d4 that fixes
do_cpuid() to explicitly set ECX=0.
nvmm(4): Improve ARCH_CAP feature bit exposure on VMX
The CPUID_0_07_EDX is reserved and is zero on AMD SVM, so simplify the
logic to expose the ARCH_CAP feature bit on VMX.
This improves my previous commit 01caa5e3ae83149daac28ad634f8236d39dbaedd.
Credit: Maxime Villard (m00nbsd)
doc: Document the steps to import and upgrade GCC
This is partially based on a README created by Scott Parlane (sparlane).
Credit: Scott Parlane (sparlane)
vendor/ncurses: Add a trailing nul for magic-string in putwin.
This was flagged by GCC 12.5's -Wstringop-overread.
Patch is from upstream, therefore fixing on the vendor branch.
initrd/mkinitrd.sh: Force strip the binaries to fix size exceeding
A user may set DEBUG_FLAGS in /etc/make.conf to retain debug symbols
during the installation phase, so the copied /rescue tools containing
the debug symbols would exceed the allowed maximum initrd image (current
15MB) and then break the installworld phase.
This issue was introduced by my commit 9d10863cc2df1e9077eb6405dd8572c243ba94d7
that removed the hardcoded 'strip' invocation from crunchgen(1)-
generated makefiles.
Now we force strip the binaries after copying them to the initrd build
directory.
Reported-by: swildner
Discussed-with: swildner
initrd/oinit: Implement login_tty() to avoid depending on libutil
Copy the login_tty() from libutil and thus remove the dependency on
libutil. However, this doesn't reduce the final binary size...
Meanwhile, remove unnecessary header inclusions.