]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: SVM: implement NEXTRIPsave SVM feature
authorAndre Przywara <andre.przywara@amd.com>
Sun, 11 Apr 2010 21:07:28 +0000 (23:07 +0200)
committerAvi Kivity <avi@redhat.com>
Mon, 17 May 2010 09:17:38 +0000 (12:17 +0300)
commit514949db1a0a09124d86e501bd357f5585cef8e0
tree82a78a5a8ee0b4202b782e695bad3745ef98a65f
parent5d6d142f09140c54723c5b5f9b9ed61702190eb4
KVM: SVM: implement NEXTRIPsave SVM feature

On SVM we set the instruction length of skipped instructions
to hard-coded, well known values, which could be wrong when (bogus,
but valid) prefixes (REX, segment override) are used.
Newer AMD processors (Fam10h 45nm and better, aka. PhenomII or
AthlonII) have an explicit NEXTRIP field in the VMCB containing the
desired information.
Since it is cheap to do so, we use this field to override the guessed
value on newer processors.
A fix for older CPUs would be rather expensive, as it would require
to fetch and partially decode the instruction. As the problem is not
a security issue and needs special, handcrafted code to trigger
(no compiler will ever generate such code), I omit a fix for older
CPUs.
If someone is interested, I have both a patch for these CPUs as well as
demo code triggering this issue: It segfaults under KVM, but runs
perfectly on native Linux.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/include/asm/svm.h
arch/x86/kvm/svm.c