[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v1 2/2] hvm/svm: Implement CPUID events



At this moment the CPUID events for the AMD architecture are not
forwarded to the monitor layer.

This patch adds the CPUID event to the common capabilities and then
forwards the event to the monitor layer.

Signed-off-by: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c    | 8 +++++++-
 xen/include/asm-x86/monitor.h | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index e36ad05..0f1c57d 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1804,6 +1804,7 @@ static void svm_vmexit_do_cpuid(struct cpu_user_regs 
*regs)
     struct vcpu *curr = current;
     unsigned int inst_len;
     struct cpuid_leaf res;
+    int rc = 0;
 
     if ( (inst_len = __get_instruction_length(curr, INSTR_CPUID)) == 0 )
         return;
@@ -1822,7 +1823,12 @@ static void svm_vmexit_do_cpuid(struct cpu_user_regs 
*regs)
     regs->rcx = res.c;
     regs->rdx = res.d;
 
-    __update_guest_eip(regs, inst_len);
+    rc = hvm_monitor_cpuid(inst_len, regs->eax, regs->ecx);
+
+    if ( !rc )
+    {
+        __update_guest_eip(regs, inst_len);
+    }
 }
 
 static void svm_vmexit_do_cr_access(
diff --git a/xen/include/asm-x86/monitor.h b/xen/include/asm-x86/monitor.h
index 7a9e1e8..99ed4b87 100644
--- a/xen/include/asm-x86/monitor.h
+++ b/xen/include/asm-x86/monitor.h
@@ -81,12 +81,12 @@ static inline uint32_t arch_monitor_get_capabilities(struct 
domain *d)
                     (1U << XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT) |
                     (1U << XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR) |
                     (1U << XEN_DOMCTL_MONITOR_EVENT_INTERRUPT) |
+                    (1U << XEN_DOMCTL_MONITOR_EVENT_CPUID) |
                     (1U << XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG));
 
     if ( cpu_has_vmx )
     {
         capabilities |= ((1U << XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION) |
-                         (1U << XEN_DOMCTL_MONITOR_EVENT_CPUID) |
                          (1U << XEN_DOMCTL_MONITOR_EVENT_EMUL_UNIMPLEMENTED));
 
         /* Since we know this is on VMX, we can just call the hvm func */
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.