}
ret = nested_svm_copy_vmcb12_to_cache(vcpu, vmcb12_gpa);
- if (ret) {
- if (ret == -EFAULT)
- return kvm_handle_memory_failure(vcpu, X86EMUL_IO_NEEDED, NULL);
-
- /* Advance RIP past VMRUN as part of the nested #VMEXIT. */
- if (!svm_skip_emulated_instruction(vcpu))
- return 0;
-
- kvm_pmu_instruction_retired(vcpu);
- return 1;
- }
+ if (ret == -EFAULT)
+ return kvm_handle_memory_failure(vcpu, X86EMUL_IO_NEEDED, NULL);
/*
- * At this point, VMRUN is guaranteed to not fault; advance RIP.
+ * At this point, VMRUN is guaranteed to not fault; advance RIP. If
+ * caching vmcb12 failed for other reasons, return immediately afterward
+ * as a nested #VMEXIT was already set up.
*
* FIXME: If TF is set on VMRUN should inject a #DB (or handle guest
* debugging) right after #VMEXIT, right now it's just ignored.
kvm_pmu_instruction_retired(vcpu);
+ if (ret)
+ return 1;
+
/*
* Since vmcb01 is not in use, we can use it to store some of the L1
* state.