[xen stable-4.10] x86/svm: Offer CPUID Faulting to AMD HVM guests as well

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen stable-4.10] x86/svm: Offer CPUID Faulting to AMD HVM guests as well

patchbot
commit 0a7e6b50e036318bd2fcca6a17d9a26fc9a72bcd
Author:     Andrew Cooper <[hidden email]>
AuthorDate: Thu Feb 8 11:43:39 2018 +0100
Commit:     Jan Beulich <[hidden email]>
CommitDate: Thu Feb 8 11:43:39 2018 +0100

    x86/svm: Offer CPUID Faulting to AMD HVM guests as well
   
    CPUID Faulting can be virtulised for HVM guests without hardware support,
    meaning it can be offered to SVM guests.
   
    Signed-off-by: Andrew Cooper <[hidden email]>
    master commit: b7af6be266e3595d7fb925f6156d6732dc456df6
    master date: 2018-01-16 18:34:04 +0000
---
 xen/arch/x86/hvm/svm/svm.c | 6 ++++++
 xen/arch/x86/msr.c         | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index b5b9279..975a2d8 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1784,6 +1784,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);
 
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 31983ed..187f862 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -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;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog