From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Kevin Cheng <chengkev@google.com>
Subject: [PATCH v4 0/5] KVM: X86: Fix nested TDP error code info
Date: Fri, 22 May 2026 16:26:56 -0700 [thread overview]
Message-ID: <20260522232701.3671446-1-seanjc@google.com> (raw)
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
next reply other threads:[~2026-05-22 23:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 23:26 Sean Christopherson [this message]
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-07-07 0:00 ` Kevin Cheng
2026-09-20 14:39 ` David Woodhouse
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260522232701.3671446-1-seanjc@google.com \
--to=seanjc@google.com \
--cc=chengkev@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®