Re: [PATCH] KVM: VMX: Enable Notify VM exit

From: Xiaoyao Li
Date: Tue Nov 03 2020 - 02:29:41 EST


On 11/3/2020 2:08 PM, Tao Xu wrote:


On 11/3/20 12:43 AM, Andy Lutomirski wrote:
On Sun, Nov 1, 2020 at 10:14 PM Tao Xu <tao3.xu@xxxxxxxxx> wrote:

...

+static int handle_notify(struct kvm_vcpu *vcpu)
+{
+       unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
+
+       /*
+        * Notify VM exit happened while executing iret from NMI,
+        * "blocked by NMI" bit has to be set before next VM entry.
+        */
+       if (exit_qualification & NOTIFY_VM_CONTEXT_VALID) {
+               if (enable_vnmi &&
+                   (exit_qualification & INTR_INFO_UNBLOCK_NMI))
+                       vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO,
+                                     GUEST_INTR_STATE_NMI);

This needs actual documentation in the SDM or at least ISE please.


Hi Andy,

Do you mean SDM or ISE should call out it needs to restore "blocked by NMI" if bit 12 of exit qualification is set and VMM decides to re-enter the guest?

you can refer to SDM 27.2.3 "Information about NMI unblocking Due to IRET" in latest SDM 325462-072US

Notify VM-Exit is defined in ISE, chapter 9.2:
https://software.intel.com/content/dam/develop/external/us/en/documents/architecture-instruction-set-extensions-programming-reference.pdf

I will add this information into commit message. Thank you for reminding me.