Kevin's series to fix how KVM populates error information when injecting
nested page faults (NPF on SVM, EPT violations on VMX) to L1 during
instruction emulation.
See v3 for the full cover letter.
v4:
- Pass @from_hardware directly instead of stuff a flag in x86_exception.
- Use the bits in @access (thanks to MBEC+GMET) to get the fault stage.
- Check the entire PFEC/EXIT_QUAL in the selftest.
- Use hardware _or_ KVM information, never merge the two.
- Name the selftest nested_tdp_fault_test.
v3:
- https://lore.kernel.org/all/20260313071033.4153209-1-chengkev@google.com
- Introduce hardware_nested_page_fault in struct x86_exception to
distinguish hardware NPF/EPT exits from emulation-triggered faults
as per Sean
- For SVM, take PFERR_GUEST_FAULT_STAGE bits from hardware exit_info_1
on hardware NPF exits, and from fault->error_code on emulation
faults
- For VMX, conditionally OR hardware exit qualification GVA_IS_VALID/
GVA_TRANSLATED bits only for hardware EPT violation exits as per
Sean
- Replace #if PTTYPE != PTTYPE_EPT preprocessor guards in
paging_tmpl.h with runtime kvm_nested_fault_is_ept() helper that
checks guest_mmu as per Sean
v2:
- https://lore.kernel.org/all/20260224071822.369326-1-chengkev@google.com
- Split out the widening of the x86_exception error code into a
separate patch as per Sean.
- Added a WARN if both PFERR_GUEST_* bits are set and force the
exit_info_1 to PFERR_GUEST_FINAL_MASK if this occurs.
- Removed the selftest TDP helpers as per Sean
- Added a patch to populate the EPT violation bits for VMX nested page
faults as per Sean.
- Expanded the added selftest to support VMX and also added a test
case for write protected pages using the INS instruction.
v1: https://lore.kernel.org/all/20260121004906.2373989-1-chengkev@google.com
Kevin Cheng (4):
KVM: x86: Widen x86_exception's error_code to 64 bits
KVM: SVM: Fix nested NPF injection of PFERR_GUEST_{PAGE,FINAL}_MASK
bits
KVM: VMX: Synthesize nested EPT violation GVA_IS_VALID/GVA_TRANSLATED
bits
KVM: selftests: Add nested page fault injection test
Sean Christopherson (1):
KVM: x86: Tell ->inject_page_fault() whether or a fault came from
hardware
arch/x86/include/asm/kvm_host.h | 20 +-
arch/x86/kvm/kvm_emulate.h | 2 +-
arch/x86/kvm/mmu/paging_tmpl.h | 36 +-
arch/x86/kvm/svm/nested.c | 38 ++-
arch/x86/kvm/vmx/nested.c | 29 +-
arch/x86/kvm/x86.c | 16 +-
tools/testing/selftests/kvm/Makefile.kvm | 1 +
.../selftests/kvm/include/x86/processor.h | 9 +
.../selftests/kvm/x86/nested_tdp_fault_test.c | 313 ++++++++++++++++++
9 files changed, 422 insertions(+), 42 deletions(-)
create mode 100644 tools/testing/selftests/kvm/x86/nested_tdp_fault_test.c
base-commit: 66939c1603bd5579e63278f9dc72cba5b79da9b5
--
2.54.0.794.g4f17f83d09-goog