| Message ID | 20260826045823.25762-1-junjie.cao@linux.dev |
|---|---|
| State | New |
| Headers | show |
| Series | [SRU,R/N:linux-hwe-7.0,PULL] x86/kvm/fred: Add FRED support and selftests | expand |
On 26/08/2026 06:58, Tao Yu via Junjie Cao wrote: > From: Tao Yu <tao1.yu@intel.com> > > BugLink: https://bugs.launchpad.net/bugs/2162039 > > SRU Justification: > > [ Impact ] > > Intel FRED support is not enabled in the current resolute 7.0 kernel KVM stack. > Without this change set, KVM/VMX cannot virtualize FRED state and controls for > guests, nested VMX does not handle the FRED-related VMCS state, and the > associated KVM selftests are missing. On FRED-capable Intel systems this leaves > guest virtualization support incomplete and prevents validation of the feature > with matching selftest coverage. > > [ Fix ] > > Integration of the x86/KVM/FRED enablement series for resolute 7.0. > > This 30-patch series adds: > > * VMX support for FRED entry/exit controls and FRED MSR handling > * guest save/restore and virtualization of FRED state > * nested VMX handling and validation for FRED-related VMCS fields > * KVM capability and CR4.FRED support updates > * event stack and variable-sized event-frame support needed by the series > * KVM selftests for FRED and related VMX functionality > > These are carried as UBUNTU: SAUCE: patches with the Launchpad BugLink above. > > [ Test Plan ] > > On a FRED-capable Intel platform: > > 1. Boot the kernel successfully on host. > 2. Run KVM selftests, especially: > - tools/testing/selftests/kvm/x86/fred_test > - tools/testing/selftests/kvm/x86/debug_regs > - tools/testing/selftests/kvm/x86/feature_msrs_test > 3. Verify guest creation and normal KVM execution on VMX systems. > 4. Verify nested VMX paths continue to work with FRED-related VMCS handling > enabled. > > Also verify a normal boot and basic KVM guest regression run on non-FRED > hardware shows no change in behaviour. > > [ Where problems could occur ] > > Risk is concentrated in x86 KVM/VMX, nested VMX, FRED entry handling, and > related selftest plumbing. A regression would most likely surface as VM entry > failure, broken nested VMX state handling, guest boot failure on FRED-capable > systems, or selftest failures in the new FRED coverage. The code is localized > to x86 KVM/FRED support and associated test infrastructure. > > [ Other Info ] > > This targets the resolute (26.04) 7.0 GA kernel [R] and the noble (24.04) > linux-hwe-7.0 kernel [N:linux-hwe-7.0]. The identical 30-patch set applies > cleanly to both resolute master-next (7.0.14) and noble hwe-7.0-next > (7.0.12). The pull branch below is based on resolute master-next; a > noble-based branch can be provided on request if a separate pull is > preferred for that tree. > > Sent through junjie.cao@linux.dev; Intel outbound SMTP is unavailable. > Commit authorship and Signed-off-by are unchanged. > > The following changes since commit 42c1aae459f558fc52384c760b92c32ffd1d9f46: > > UBUNTU: Upstream stable to v6.18.38, v7.1.3 (2026-07-17 12:01:46 +0200) > > are available in the Git repository at: > > https://github.com/yutao-intel/linux_resolute sru-fred-7.0 > > for you to fetch changes up to c5e5db04a6b62b4a8a55354824bef6a5798b69c3: > > UBUNTU: SAUCE: x86/fred: Enable FRED by default (2026-07-30 12:54:44 +0800) > > ---------------------------------------------------------------- > Chenyi Qiang (1): > UBUNTU: SAUCE: KVM: selftests: Add the 2nd VM exit controls MSR to the hidden VMX MSR list > > Xin Li (21): > UBUNTU: SAUCE: KVM: VMX: Enable support for secondary VM exit controls > UBUNTU: SAUCE: KVM: VMX: Initialize VM entry/exit FRED controls in vmcs_config > UBUNTU: SAUCE: KVM: VMX: Disable FRED if FRED consistency checks fail > UBUNTU: SAUCE: KVM: VMX: Initialize VMCS FRED fields > UBUNTU: SAUCE: KVM: VMX: Set FRED MSR intercepts > UBUNTU: SAUCE: KVM: VMX: Save/restore guest FRED RSP0 > UBUNTU: SAUCE: KVM: VMX: Add support for saving and restoring FRED MSRs > UBUNTU: SAUCE: KVM: x86: Add a helper to detect if FRED is enabled for a vCPU > UBUNTU: SAUCE: KVM: VMX: Virtualize FRED event_data > UBUNTU: SAUCE: KVM: VMX: Virtualize FRED nested exception tracking > UBUNTU: SAUCE: KVM: x86: Mark CR4.FRED as not reserved > UBUNTU: SAUCE: KVM: VMX: Dump FRED context in dump_vmcs() > UBUNTU: SAUCE: KVM: x86: Advertise support for FRED > UBUNTU: SAUCE: KVM: nVMX: Enable support for secondary VM exit controls > UBUNTU: SAUCE: KVM: nVMX: Handle FRED VMCS fields in nested VMX context > UBUNTU: SAUCE: KVM: nVMX: Validate FRED-related VMCS fields > UBUNTU: SAUCE: KVM: nVMX: Guard SHADOW_FIELD_R[OW] macros with VMX feature checks > UBUNTU: SAUCE: KVM: nVMX: Enable VMX FRED controls > UBUNTU: SAUCE: KVM: selftests: Run debug_regs test with FRED enabled > UBUNTU: SAUCE: KVM: selftests: Add a new VM guest mode to run user level code > UBUNTU: SAUCE: KVM: selftests: Add fred exception tests > > Xin Li (Intel) (8): > UBUNTU: SAUCE: x86/cea: Prefix event stack names with ESTACK_ > UBUNTU: SAUCE: x86/cea: Use array indexing to simplify exception stack access > UBUNTU: SAUCE: x86/cea: Export __this_cpu_ist_top_va() to KVM > UBUNTU: SAUCE: KVM: x86: Save/restore the nested flag of an exception > UBUNTU: SAUCE: task_stack.h: Add a new helper task_empty_stack_pointer() > UBUNTU: SAUCE: x86/fred: Allow variable-sized event frame > UBUNTU: SAUCE: x86: Remove the padding space at top of the init stack > UBUNTU: SAUCE: x86/fred: Enable FRED by default > > Documentation/virt/kvm/api.rst | 19 ++++ > arch/x86/coco/sev/noinstr.c | 4 +- > arch/x86/coco/sev/vc-handle.c | 2 +- > arch/x86/entry/entry_fred.c | 10 ++ > arch/x86/include/asm/cpu_entry_area.h | 70 ++++++------- > arch/x86/include/asm/fred.h | 2 +- > arch/x86/include/asm/kvm_host.h | 13 ++- > arch/x86/include/asm/msr-index.h | 1 + > arch/x86/include/asm/processor.h | 28 +++-- > arch/x86/include/asm/thread_info.h | 11 +- > arch/x86/include/asm/vmx.h | 48 ++++++++- > arch/x86/include/uapi/asm/kvm.h | 4 +- > arch/x86/kernel/cpu/common.c | 12 +-- > arch/x86/kernel/dumpstack.c | 2 +- > arch/x86/kernel/dumpstack_64.c | 18 ++-- > arch/x86/kernel/fred.c | 6 +- > arch/x86/kernel/process.c | 22 ++++ > arch/x86/kernel/traps.c | 2 +- > arch/x86/kernel/vmlinux.lds.S | 7 +- > arch/x86/kvm/cpuid.c | 1 + > arch/x86/kvm/kvm_cache_regs.h | 15 +++ > arch/x86/kvm/svm/svm.c | 2 +- > arch/x86/kvm/vmx/capabilities.h | 25 ++++- > arch/x86/kvm/vmx/nested.c | 344 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------- > arch/x86/kvm/vmx/nested.h | 22 ++++ > arch/x86/kvm/vmx/vmcs.h | 1 + > arch/x86/kvm/vmx/vmcs12.c | 19 ++++ > arch/x86/kvm/vmx/vmcs12.h | 40 ++++++- > arch/x86/kvm/vmx/vmcs_shadow_fields.h | 37 +++++-- > arch/x86/kvm/vmx/vmx.c | 246 ++++++++++++++++++++++++++++++++++++++++--- > arch/x86/kvm/vmx/vmx.h | 54 +++++++++- > arch/x86/kvm/x86.c | 131 ++++++++++++++++++++++- > arch/x86/kvm/x86.h | 8 +- > arch/x86/mm/cpu_entry_area.c | 39 +++++-- > arch/x86/mm/fault.c | 2 +- > include/linux/sched/task_stack.h | 5 + > include/linux/thread_info.h | 1 + > include/uapi/linux/kvm.h | 1 + > kernel/fork.c | 6 ++ > tools/arch/x86/include/asm/msr-index.h | 1 + > tools/testing/selftests/kvm/Makefile.kvm | 1 + > tools/testing/selftests/kvm/include/kvm_util.h | 1 + > tools/testing/selftests/kvm/include/x86/processor.h | 36 +++++++ > tools/testing/selftests/kvm/lib/kvm_util.c | 5 +- > tools/testing/selftests/kvm/lib/x86/processor.c | 15 ++- > tools/testing/selftests/kvm/lib/x86/vmx.c | 160 ++++++++++++++++++++++++++++ > tools/testing/selftests/kvm/x86/debug_regs.c | 50 ++++++--- > tools/testing/selftests/kvm/x86/feature_msrs_test.c | 1 + > tools/testing/selftests/kvm/x86/fred_test.c | 293 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 49 files changed, 1657 insertions(+), 186 deletions(-) > create mode 100644 tools/testing/selftests/kvm/x86/fred_test.c > Rejected for the following reasons: Large feature enablement is not suitable for SRU. This is too intrusive and cannot be maintained long-term. -Stefan
From: Tao Yu <tao1.yu@intel.com> BugLink: https://bugs.launchpad.net/bugs/2162039 SRU Justification: [ Impact ] Intel FRED support is not enabled in the current resolute 7.0 kernel KVM stack. Without this change set, KVM/VMX cannot virtualize FRED state and controls for guests, nested VMX does not handle the FRED-related VMCS state, and the associated KVM selftests are missing. On FRED-capable Intel systems this leaves guest virtualization support incomplete and prevents validation of the feature with matching selftest coverage. [ Fix ] Integration of the x86/KVM/FRED enablement series for resolute 7.0. This 30-patch series adds: * VMX support for FRED entry/exit controls and FRED MSR handling * guest save/restore and virtualization of FRED state * nested VMX handling and validation for FRED-related VMCS fields * KVM capability and CR4.FRED support updates * event stack and variable-sized event-frame support needed by the series * KVM selftests for FRED and related VMX functionality These are carried as UBUNTU: SAUCE: patches with the Launchpad BugLink above. [ Test Plan ] On a FRED-capable Intel platform: 1. Boot the kernel successfully on host. 2. Run KVM selftests, especially: - tools/testing/selftests/kvm/x86/fred_test - tools/testing/selftests/kvm/x86/debug_regs - tools/testing/selftests/kvm/x86/feature_msrs_test 3. Verify guest creation and normal KVM execution on VMX systems. 4. Verify nested VMX paths continue to work with FRED-related VMCS handling enabled. Also verify a normal boot and basic KVM guest regression run on non-FRED hardware shows no change in behaviour. [ Where problems could occur ] Risk is concentrated in x86 KVM/VMX, nested VMX, FRED entry handling, and related selftest plumbing. A regression would most likely surface as VM entry failure, broken nested VMX state handling, guest boot failure on FRED-capable systems, or selftest failures in the new FRED coverage. The code is localized to x86 KVM/FRED support and associated test infrastructure. [ Other Info ] This targets the resolute (26.04) 7.0 GA kernel [R] and the noble (24.04) linux-hwe-7.0 kernel [N:linux-hwe-7.0]. The identical 30-patch set applies cleanly to both resolute master-next (7.0.14) and noble hwe-7.0-next (7.0.12). The pull branch below is based on resolute master-next; a noble-based branch can be provided on request if a separate pull is preferred for that tree. Sent through junjie.cao@linux.dev; Intel outbound SMTP is unavailable. Commit authorship and Signed-off-by are unchanged. The following changes since commit 42c1aae459f558fc52384c760b92c32ffd1d9f46: UBUNTU: Upstream stable to v6.18.38, v7.1.3 (2026-07-17 12:01:46 +0200) are available in the Git repository at: https://github.com/yutao-intel/linux_resolute sru-fred-7.0 for you to fetch changes up to c5e5db04a6b62b4a8a55354824bef6a5798b69c3: UBUNTU: SAUCE: x86/fred: Enable FRED by default (2026-07-30 12:54:44 +0800) ---------------------------------------------------------------- Chenyi Qiang (1): UBUNTU: SAUCE: KVM: selftests: Add the 2nd VM exit controls MSR to the hidden VMX MSR list Xin Li (21): UBUNTU: SAUCE: KVM: VMX: Enable support for secondary VM exit controls UBUNTU: SAUCE: KVM: VMX: Initialize VM entry/exit FRED controls in vmcs_config UBUNTU: SAUCE: KVM: VMX: Disable FRED if FRED consistency checks fail UBUNTU: SAUCE: KVM: VMX: Initialize VMCS FRED fields UBUNTU: SAUCE: KVM: VMX: Set FRED MSR intercepts UBUNTU: SAUCE: KVM: VMX: Save/restore guest FRED RSP0 UBUNTU: SAUCE: KVM: VMX: Add support for saving and restoring FRED MSRs UBUNTU: SAUCE: KVM: x86: Add a helper to detect if FRED is enabled for a vCPU UBUNTU: SAUCE: KVM: VMX: Virtualize FRED event_data UBUNTU: SAUCE: KVM: VMX: Virtualize FRED nested exception tracking UBUNTU: SAUCE: KVM: x86: Mark CR4.FRED as not reserved UBUNTU: SAUCE: KVM: VMX: Dump FRED context in dump_vmcs() UBUNTU: SAUCE: KVM: x86: Advertise support for FRED UBUNTU: SAUCE: KVM: nVMX: Enable support for secondary VM exit controls UBUNTU: SAUCE: KVM: nVMX: Handle FRED VMCS fields in nested VMX context UBUNTU: SAUCE: KVM: nVMX: Validate FRED-related VMCS fields UBUNTU: SAUCE: KVM: nVMX: Guard SHADOW_FIELD_R[OW] macros with VMX feature checks UBUNTU: SAUCE: KVM: nVMX: Enable VMX FRED controls UBUNTU: SAUCE: KVM: selftests: Run debug_regs test with FRED enabled UBUNTU: SAUCE: KVM: selftests: Add a new VM guest mode to run user level code UBUNTU: SAUCE: KVM: selftests: Add fred exception tests Xin Li (Intel) (8): UBUNTU: SAUCE: x86/cea: Prefix event stack names with ESTACK_ UBUNTU: SAUCE: x86/cea: Use array indexing to simplify exception stack access UBUNTU: SAUCE: x86/cea: Export __this_cpu_ist_top_va() to KVM UBUNTU: SAUCE: KVM: x86: Save/restore the nested flag of an exception UBUNTU: SAUCE: task_stack.h: Add a new helper task_empty_stack_pointer() UBUNTU: SAUCE: x86/fred: Allow variable-sized event frame UBUNTU: SAUCE: x86: Remove the padding space at top of the init stack UBUNTU: SAUCE: x86/fred: Enable FRED by default Documentation/virt/kvm/api.rst | 19 ++++ arch/x86/coco/sev/noinstr.c | 4 +- arch/x86/coco/sev/vc-handle.c | 2 +- arch/x86/entry/entry_fred.c | 10 ++ arch/x86/include/asm/cpu_entry_area.h | 70 ++++++------- arch/x86/include/asm/fred.h | 2 +- arch/x86/include/asm/kvm_host.h | 13 ++- arch/x86/include/asm/msr-index.h | 1 + arch/x86/include/asm/processor.h | 28 +++-- arch/x86/include/asm/thread_info.h | 11 +- arch/x86/include/asm/vmx.h | 48 ++++++++- arch/x86/include/uapi/asm/kvm.h | 4 +- arch/x86/kernel/cpu/common.c | 12 +-- arch/x86/kernel/dumpstack.c | 2 +- arch/x86/kernel/dumpstack_64.c | 18 ++-- arch/x86/kernel/fred.c | 6 +- arch/x86/kernel/process.c | 22 ++++ arch/x86/kernel/traps.c | 2 +- arch/x86/kernel/vmlinux.lds.S | 7 +- arch/x86/kvm/cpuid.c | 1 + arch/x86/kvm/kvm_cache_regs.h | 15 +++ arch/x86/kvm/svm/svm.c | 2 +- arch/x86/kvm/vmx/capabilities.h | 25 ++++- arch/x86/kvm/vmx/nested.c | 344 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------- arch/x86/kvm/vmx/nested.h | 22 ++++ arch/x86/kvm/vmx/vmcs.h | 1 + arch/x86/kvm/vmx/vmcs12.c | 19 ++++ arch/x86/kvm/vmx/vmcs12.h | 40 ++++++- arch/x86/kvm/vmx/vmcs_shadow_fields.h | 37 +++++-- arch/x86/kvm/vmx/vmx.c | 246 ++++++++++++++++++++++++++++++++++++++++--- arch/x86/kvm/vmx/vmx.h | 54 +++++++++- arch/x86/kvm/x86.c | 131 ++++++++++++++++++++++- arch/x86/kvm/x86.h | 8 +- arch/x86/mm/cpu_entry_area.c | 39 +++++-- arch/x86/mm/fault.c | 2 +- include/linux/sched/task_stack.h | 5 + include/linux/thread_info.h | 1 + include/uapi/linux/kvm.h | 1 + kernel/fork.c | 6 ++ tools/arch/x86/include/asm/msr-index.h | 1 + tools/testing/selftests/kvm/Makefile.kvm | 1 + tools/testing/selftests/kvm/include/kvm_util.h | 1 + tools/testing/selftests/kvm/include/x86/processor.h | 36 +++++++ tools/testing/selftests/kvm/lib/kvm_util.c | 5 +- tools/testing/selftests/kvm/lib/x86/processor.c | 15 ++- tools/testing/selftests/kvm/lib/x86/vmx.c | 160 ++++++++++++++++++++++++++++ tools/testing/selftests/kvm/x86/debug_regs.c | 50 ++++++--- tools/testing/selftests/kvm/x86/feature_msrs_test.c | 1 + tools/testing/selftests/kvm/x86/fred_test.c | 293 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 49 files changed, 1657 insertions(+), 186 deletions(-) create mode 100644 tools/testing/selftests/kvm/x86/fred_test.c