Skip to content

Commit 3b9c723

Browse files
weihuang-amdbonzini
authored andcommitted
KVM: SVM: Add support for SVM instruction address check change
New AMD CPUs have a change that checks #VMEXIT intercept on special SVM instructions before checking their EAX against reserved memory region. This change is indicated by CPUID_0x8000000A_EDX[28]. If it is 1, #VMEXIT is triggered before #GP. KVM doesn't need to intercept and emulate #GP faults as #GP is supposed to be triggered. Co-developed-by: Bandan Das <[email protected]> Signed-off-by: Bandan Das <[email protected]> Signed-off-by: Wei Huang <[email protected]> Reviewed-by: Maxim Levitsky <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 82a11e9 commit 3b9c723

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@
338338
#define X86_FEATURE_AVIC (15*32+13) /* Virtual Interrupt Controller */
339339
#define X86_FEATURE_V_VMSAVE_VMLOAD (15*32+15) /* Virtual VMSAVE VMLOAD */
340340
#define X86_FEATURE_VGIF (15*32+16) /* Virtual GIF */
341+
#define X86_FEATURE_SVME_ADDR_CHK (15*32+28) /* "" SVME addr check */
341342

342343
/* Intel-defined CPU features, CPUID level 0x00000007:0 (ECX), word 16 */
343344
#define X86_FEATURE_AVX512VBMI (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions*/

arch/x86/kvm/svm/svm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,9 @@ static __init int svm_hardware_setup(void)
10401040
}
10411041
}
10421042

1043+
if (boot_cpu_has(X86_FEATURE_SVME_ADDR_CHK))
1044+
svm_gp_erratum_intercept = false;
1045+
10431046
if (vgif) {
10441047
if (!boot_cpu_has(X86_FEATURE_VGIF))
10451048
vgif = false;

0 commit comments

Comments
 (0)