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

[Xen-changelog] [xen-unstable] [HVM][SVM] Updated the SVM V_TPR register on MMIO writes to the VLAPIC TPR



# HG changeset patch
# User Travis Betak <travis.betak@xxxxxxx>
# Date 1170272264 0
# Node ID 588dd80b56b5411bd9d1860e9e19da39a64e2f5d
# Parent  b998ae45c076eb6b32a48ec0e7c49d9a03ec846f
[HVM][SVM] Updated the SVM V_TPR register on MMIO writes to the VLAPIC TPR

The SVM architecture includes a virtual TPR register.  This patch
updates this register on MMIO writes to the HVM Virtual APIC.

VT does not have this register as far as I know so a stub is added in
the VT code.

Signed-off-by: Travis Betak <travis.betak@xxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c    |   10 ++++++++++
 xen/arch/x86/hvm/vlapic.c     |    1 +
 xen/arch/x86/hvm/vmx/vmx.c    |    7 +++++++
 xen/include/asm-x86/hvm/hvm.h |   11 +++++++++++
 4 files changed, 29 insertions(+)

diff -r b998ae45c076 -r 588dd80b56b5 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Wed Jan 31 18:15:48 2007 +0000
+++ b/xen/arch/x86/hvm/svm/svm.c        Wed Jan 31 19:37:44 2007 +0000
@@ -660,6 +660,13 @@ void svm_update_guest_cr3(struct vcpu *v
     v->arch.hvm_svm.vmcb->cr3 = v->arch.hvm_vcpu.hw_cr3; 
 }
 
+static void svm_update_vtpr(struct vcpu *v, unsigned long value)
+{
+    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+
+    vmcb->vintr.fields.tpr = value & 0x0f;
+}
+
 unsigned long svm_get_ctrl_reg(struct vcpu *v, unsigned int num)
 {
     switch ( num )
@@ -1048,6 +1055,8 @@ int start_svm(void)
     hvm_funcs.update_host_cr3 = svm_update_host_cr3;
     hvm_funcs.update_guest_cr3 = svm_update_guest_cr3;
     
+    hvm_funcs.update_vtpr = svm_update_vtpr;
+
     hvm_funcs.stts = svm_stts;
     hvm_funcs.set_tsc_offset = svm_set_tsc_offset;
 
@@ -1939,6 +1948,7 @@ static int mov_to_cr(int gpreg, int cr, 
 
     case 8:
         vlapic_set_reg(vlapic, APIC_TASKPRI, ((value & 0x0F) << 4));
+        vmcb->vintr.fields.tpr = value & 0x0F;
         break;
 
     default:
diff -r b998ae45c076 -r 588dd80b56b5 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Wed Jan 31 18:15:48 2007 +0000
+++ b/xen/arch/x86/hvm/vlapic.c Wed Jan 31 19:37:44 2007 +0000
@@ -593,6 +593,7 @@ static void vlapic_write(struct vcpu *v,
     {
     case APIC_TASKPRI:
         vlapic_set_reg(vlapic, APIC_TASKPRI, val & 0xff);
+        hvm_update_vtpr(v, (val >> 4) & 0x0f);
         break;
 
     case APIC_EOI:
diff -r b998ae45c076 -r 588dd80b56b5 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Wed Jan 31 18:15:48 2007 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Wed Jan 31 19:37:44 2007 +0000
@@ -986,6 +986,11 @@ static void vmx_inject_exception(
         v->arch.hvm_vmx.cpu_cr2 = cr2;
 }
 
+static void vmx_update_vtpr(struct vcpu *v, unsigned long value)
+{
+    /* VMX doesn't have a V_TPR field */
+}
+
 /* Setup HVM interfaces */
 static void vmx_setup_hvm_funcs(void)
 {
@@ -1010,6 +1015,8 @@ static void vmx_setup_hvm_funcs(void)
 
     hvm_funcs.update_host_cr3 = vmx_update_host_cr3;
     hvm_funcs.update_guest_cr3 = vmx_update_guest_cr3;
+
+    hvm_funcs.update_vtpr = vmx_update_vtpr;
 
     hvm_funcs.stts = vmx_stts;
     hvm_funcs.set_tsc_offset = vmx_set_tsc_offset;
diff -r b998ae45c076 -r 588dd80b56b5 xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Wed Jan 31 18:15:48 2007 +0000
+++ b/xen/include/asm-x86/hvm/hvm.h     Wed Jan 31 19:37:44 2007 +0000
@@ -115,6 +115,11 @@ struct hvm_function_table {
     void (*update_guest_cr3)(struct vcpu *v);
 
     /*
+     * Reflect the virtual APIC's value in the guest's V_TPR register
+     */
+    void (*update_vtpr)(struct vcpu *v, unsigned long value);
+
+    /*
      * Update specifics of the guest state:
      * 1) TS bit in guest cr0 
      * 2) TSC offset in guest
@@ -201,6 +206,12 @@ hvm_update_host_cr3(struct vcpu *v)
 hvm_update_host_cr3(struct vcpu *v)
 {
     hvm_funcs.update_host_cr3(v);
+}
+
+static inline void
+hvm_update_vtpr(struct vcpu *v, unsigned long value)
+{
+    hvm_funcs.update_vtpr(v, value);
 }
 
 void hvm_update_guest_cr3(struct vcpu *v, unsigned long guest_cr3);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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