Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH v4 0/5] KVM: X86: Fix nested TDP error code info
@ 2026-05-22 23:26 Sean Christopherson
  2026-05-22 23:26 ` [PATCH v4 1/5] KVM: x86: Widen x86_exception's error_code to 64 bits Sean Christopherson
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Sean Christopherson @ 2026-05-22 23:26 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel, Kevin Cheng

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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-05-27 18:14 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-22 23:26 [PATCH v4 0/5] KVM: X86: Fix nested TDP error code info Sean Christopherson
2026-05-22 23:26 ` [PATCH v4 1/5] KVM: x86: Widen x86_exception's error_code to 64 bits Sean Christopherson
2026-05-22 23:26 ` [PATCH v4 2/5] KVM: x86: Tell ->inject_page_fault() whether or a fault came from hardware Sean Christopherson
2026-05-26 18:18   ` Yosry Ahmed
2026-05-26 18:48     ` Sean Christopherson
2026-05-26 18:52       ` Yosry Ahmed
2026-05-27 18:11         ` Sean Christopherson
2026-05-22 23:26 ` [PATCH v4 3/5] KVM: SVM: Fix nested NPF injection of PFERR_GUEST_{PAGE,FINAL}_MASK bits Sean Christopherson
2026-05-26 18:31   ` Yosry Ahmed
2026-05-26 18:44     ` Sean Christopherson
2026-05-26 18:50       ` Yosry Ahmed
2026-05-27 18:14         ` Sean Christopherson
2026-05-22 23:27 ` [PATCH v4 4/5] KVM: VMX: Synthesize nested EPT violation GVA_IS_VALID/GVA_TRANSLATED bits Sean Christopherson
2026-05-22 23:27 ` [PATCH v4 5/5] KVM: selftests: Add nested page fault injection test Sean Christopherson
2026-05-27 18:10 ` [PATCH v4 0/5] KVM: X86: Fix nested TDP error code info Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox