Skip to content

KVM: Make the instruction emulator aware of Nested Virtualization

Joerg Roedel kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9KVM: Add infrastructure to emulate instruction interceptsarch/x86/include/asm/kvm_emulate.h arch/x86/include/asm/kvm_host.h arch/x86/kvm/svm.c +2 more+26 -00 replies
2/9KVM: SVM: Add checks for CRx read and write interceptsarch/x86/kvm/svm.c+72 -10 replies
3/9KVM: SVM: Add checks for DRx read and write interceptsarch/x86/kvm/svm.c+6 -00 replies
4/9KVM: SVM: Add intercept checks for descriptor table accessesarch/x86/kvm/svm.c+28 -00 replies
5/9KVM: SVM: Add checks for all group 7 instructionsarch/x86/kvm/svm.c+52 -10 replies
6/9KVM: SVM: Add intercept checks for remaining twobyte instructionsarch/x86/kvm/svm.c+29 -00 replies
7/9KVM: SVM: Add intercept checks for one-byte instructionsarch/x86/kvm/svm.c+33 -30 replies
8/9KVM: SVM: Add checks for IO instructionsarch/x86/kvm/svm.c+55 -00 replies
9/9KVM: SVM: Remove nested sel_cr0_write handling codearch/x86/kvm/svm.c+1 -510 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/9] KVM: Make the instruction emulator aware of Nested Virtualization

Hi Avi, Hi Marcelo,

here is a patch-set to make the instruction emulator aware of nested virtualization. It basically works by introducing a new callback into the x86_ops to check if a decoded instruction must be intercepted. If it is intercepted the instruction emulator returns straight into the guest.

I am not entirely happy with this solution because it partially duplicates the code in the x86_emulate_insn function. But there are so many SVM specific cases that need to be taken care of that I consider this solution the better one (even when looking at the diff-stat). Keeping this (SVM-specific) complexity in the SVM specific code is better than extending the generic instruction emulator code path.

The last patch removes the ugly hacks which were required without this patch-set to correctly handle the selective-cr0-write intercept.

I appreciate your feedback.

Thanks,

Joerg

Diffstat:

 arch/x86/include/asm/kvm_emulate.h |    2 +
 arch/x86/include/asm/kvm_host.h    |    3 +
 arch/x86/kvm/svm.c                 |  330 ++++++++++++++++++++++++++++++------
 arch/x86/kvm/vmx.c                 |    8 +
 arch/x86/kvm/x86.c                 |    5 +
 5 files changed, 297 insertions(+), 51 deletions(-)

Shortlog:

Joerg Roedel (9):
KVM: Add infrastructure to emulate instruction intercepts
KVM: SVM: Add checks for CRx read and write intercepts
KVM: SVM: Add checks for DRx read and write intercepts
KVM: SVM: Add intercept checks for descriptor table accesses
KVM: SVM: Add checks for all group 7 instructions
KVM: SVM: Add intercept checks for remaining twobyte instructions
KVM: SVM: Add intercept checks for one-byte instructions
KVM: SVM: Add checks for IO instructions
KVM: SVM: Remove nested sel_cr0_write handling code