x86/svm: Offer CPUID Faulting to AMD HVM guests as well
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 11 Jan 2018 17:47:57 +0000 (17:47 +0000)
committerWei Liu <wei.liu2@citrix.com>
Tue, 16 Jan 2018 18:34:04 +0000 (18:34 +0000)
CPUID Faulting can be virtulised for HVM guests without hardware support,
meaning it can be offered to SVM guests.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/msr.c

index c48fdfaa5d0257e0bc5bc0402bca98eaea128384..9d9ad777d1e45dc2e349b0e606f1ce3e80746159 100644 (file)
@@ -1786,6 +1786,12 @@ static void svm_vmexit_do_cpuid(struct cpu_user_regs *regs)
     if ( (inst_len = __get_instruction_length(curr, INSTR_CPUID)) == 0 )
         return;
 
+    if ( hvm_check_cpuid_faulting(curr) )
+    {
+        hvm_inject_hw_exception(TRAP_gp_fault, 0);
+        return;
+    }
+
     guest_cpuid(curr, regs->eax, regs->ecx, &res);
     HVMTRACE_5D(CPUID, regs->eax, res.a, res.b, res.c, res.d);
 
index 31983edc544f711c74111e509856d3d2eb914a8c..187f8623a5f191289ae5fdc8ad610565b1694fd8 100644 (file)
@@ -39,7 +39,8 @@ static void __init calculate_hvm_max_policy(void)
         return;
 
     /* 0x000000ce  MSR_INTEL_PLATFORM_INFO */
-    if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
+    if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ||
+         boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
     {
         dp->plaform_info.available = true;
         dp->plaform_info.cpuid_faulting = true;