Skip to content

AMD invpcid exception fix

Bandan Das kvm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3KVM: Add a stub for invpcid in the emulator tablearch/x86/kvm/emulate.c+2 -10 replies
2/3KVM: SVM: Handle invpcid during gp interceptionarch/x86/kvm/svm/svm.c+10 -10 replies
3/3KVM: SVM: check if we need to track GP intercept for invpcidarch/x86/kvm/svm/svm.c+11 -00 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] AMD invpcid exception fix

The pcid-disabled test from kvm-unit-tests fails on a Milan host because the processor injects a #GP while the test expects #UD. While setting the intercept when the guest has it disabled seemed like the obvious thing to do, Babu Moger (AMD) pointed me to an earlier discussion here - https://lkml.org/lkml/2020/6/11/949

Jim points out there that #GP has precedence over the intercept bit when invpcid is called with CPL > 0 and so even if we intercept invpcid, the guest would end up with getting and "incorrect" exception. To inject the right exception, I created an entry for the instruction in the emulator to decode it successfully and then inject a UD instead of a GP when the guest has it disabled.

Bandan Das (3):
KVM: Add a stub for invpcid in the emulator table
KVM: SVM: Handle invpcid during gp interception
KVM: SVM: check if we need to track GP intercept for invpcid

 arch/x86/kvm/emulate.c |  3 ++-
 arch/x86/kvm/svm/svm.c | 22 +++++++++++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)
Signature · 1 line
2.24.1