Skip to content

Virtual NMI

[email protected] xen-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3svm/vnmi: introduce the vnmi bit support in the cpuid feature setxen/arch/x86/hvm/svm/svm.c xen/arch/x86/include/asm/hvm/hvm.h xen/arch/x86/include/asm/hvm/svm.h+7 -10 replies
2/3svm/vnmi: add the definitions for the svm vnmi management bits in the VMCBxen/arch/x86/hvm/svm/vmcb.h+8 -40 replies
3/3svm/vnmi: Add support for the SVM Virtual NMIxen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/svm/intr.c xen/arch/x86/hvm/svm/svm.c +2 more+68 -110 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] Virtual NMI

From: Abdelkareem Abdelsaamad <[email protected]>

Currently, the Xen hypervisor delivers NMIs to the guests using the Event Injection mechanism. The Event Injection mechanism does not block the delivery of subsequent NMIs. So the Xen Hypervisor tracks the NMI delivery and its completion (by intercepting the IRET instruction) before sending a new NMI.

With the 4th generation AMD EPYC, a hardware NMI virtualization support, Virtual NMI (VNMI), is introduced. The vNMI allows the hypervisor to inject the NMI into the guest w/o using Event Injection mechanism. No need to track the guest NMI and intercepting the IRET instruction.

NMI Virtualization support is indicated by CPUID Fn8000_000A_EDX[VNMI] = 1.[1]

NMI Virtualization is enabled by setting V_NMI_ENABLE (bit 26 in offset 60h of the VMCB). Enabling NMI Virtualization requires the NMI intercept bit to be set. An attempt to run a guest with V_NMI_ENABLE without the NMI intercept bit set results in #VMEXIT(INVALID) [1]

Three new bits are added to the VMCB field at offset 60h to provide NMI virtualization hardware support:

V_NMI(11): Indicates whether a virtual NMI is pending in the guest. The processor will clear V_NMI once it takes the virtual NMI. V_NMI_MASK(12): Indicates whether virtual NMIs are masked. The processor will set V_NMI_MASK once it takes the virtual NMI. V_NMI_MASK is cleared when the guest successfully completes an IRET instruction or #VMEXIT occurs while delivering the virtual NMI.
V_NMI_ENABLE(26): Enables NMI virtualization. [1]

--Abdelkareem Abdelsaamad
[1] https://docs.amd.com/v/u/en-US/24593_3.43

Abdelkareem Abdelsaamad (3):
svm/vnmi: introduce the vnmi bit support in the cpuid feature set svm/vnmi: add the definitions for the svm vnmi management bits in the
VMCB
svm/vnmi: Add support for the SVM Virtual NMI

 xen/arch/x86/hvm/hvm.c             | 29 +++++++++++++++++++++--------
 xen/arch/x86/hvm/svm/intr.c        | 16 ++++++++++++++--
 xen/arch/x86/hvm/svm/svm.c         | 25 ++++++++++++++++++++++++-
 xen/arch/x86/hvm/svm/vmcb.c        |  3 +++
 xen/arch/x86/hvm/svm/vmcb.h        | 12 ++++++++----
 xen/arch/x86/include/asm/hvm/hvm.h | 12 +++++++++++-
 xen/arch/x86/include/asm/hvm/svm.h |  2 ++
 7 files changed, 83 insertions(+), 16 deletions(-)
Signature · 1 line
2.52.0