Skip to contentSkip to conversation

32bit msr support/enable 64bit vlapic

PATCH In review Woller, Thomas 3 participants 3 messages Mar 1, 2006 – Mar 2, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 32bit msr support/enable 64bit vlapic

Svm patch to add 32bit msr support (combined both 32bit with 64bit functions)
and enable vlapic for 64bit.

Applies cleanly to 9023.
Please apply.

# HG changeset patch
# User [email protected]
# Node ID d5d154e66a1def60cd387199aeeef2eee51f4787 # Parent d8451bb6278cb5f3f477dd9392213be7c66730b4 add 32bit msr support/enable vlapic for 64bit.

xen/arch/x86/hvm/svm/svm.c +13 -14
diff -r d8451bb6278c -r d5d154e66a1d xen/arch/x86/hvm/svm/svm.c
@@ -247,6 +247,7 @@
 void svm_restore_msrs(struct vcpu *v)
 {
 }
+#endif
 
 #define IS_CANO_ADDRESS(add) 1
 
@@ -297,8 +298,13 @@
         return 0;
     }
 
+#ifdef __x86_64__
     HVM_DBG_LOG(DBG_LEVEL_2, "mode_do_msr_read: msr_content: %lx\n", 
             msr_content);
+#else
+    HVM_DBG_LOG(DBG_LEVEL_2, "mode_do_msr_read: msr_content: %llx\n", 
+            msr_content);
+#endif
 
     regs->eax = msr_content & 0xffffffff;
     regs->edx = msr_content >> 32;
@@ -311,12 +317,18 @@
     struct vcpu *vc = current;
     struct vmcb_struct *vmcb = vc->arch.hvm_svm.vmcb;
 
+#ifdef __x86_64__
     HVM_DBG_LOG(DBG_LEVEL_1, "mode_do_msr_write msr %lx msr_content %lx\n", 
                 regs->ecx, msr_content);
+#else
+    HVM_DBG_LOG(DBG_LEVEL_1, "mode_do_msr_write msr %x msr_content %llx\n", 
+                regs->ecx, msr_content);
+#endif
 
     switch (regs->ecx)
     {
     case MSR_EFER:
+#ifdef __x86_64__
         if ((msr_content & EFER_LME) ^ test_bit(SVM_CPU_STATE_LME_ENABLED,
                                                 &vc->arch.hvm_svm.cpu_state))
         {
@@ -337,6 +349,7 @@
         if ((msr_content ^ vmcb->efer) & EFER_LME)
             msr_content &= ~EFER_LME;  
         /* No update for LME/LMA since it have no effect */
+#endif
         vmcb->efer = msr_content | EFER_SVME;
         break;
 
@@ -382,18 +395,6 @@
     }
     return 1;
 }
-
-#else
-static inline int long_mode_do_msr_read(struct cpu_user_regs *regs)
-{
-    return 0;
-}
-
-static inline int long_mode_do_msr_write(struct cpu_user_regs *regs)
-{
-    return 0;
-}
-#endif
 
 void svm_store_cpu_guest_ctrl_regs(struct vcpu *v, unsigned long crs[8])
 {
@@ -937,10 +938,8 @@
 
     if (input == 1)
     {
-#ifndef __x86_64__
         if ( hvm_apic_support(v->domain) &&
                 !vlapic_global_enabled((VLAPIC(v))) )
-#endif
             clear_bit(X86_FEATURE_APIC, &edx);
 	    
 #if CONFIG_PAGING_LEVELS < 3

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Content-Description: svm_msr32_vlapic.patch

xen/arch/x86/hvm/svm/svm.c line 307

Quoted 7 lines
xen/arch/x86/hvm/svm/svm.c +5 -0
+#ifdef __x86_64__
     HVM_DBG_LOG(DBG_LEVEL_2, "mode_do_msr_read: msr_content: %lx\n", 
             msr_content);
+#else
+    HVM_DBG_LOG(DBG_LEVEL_2, "mode_do_msr_read: msr_content: %llx\n", 
+            msr_content);
+#endif

Could these simply use %llx and get rid of the #ifdef? %llx is 64-bit on x86 and x86_64

Signature · 2 lines
Aron Griffis
hp Open Source & Linux Organization R&D

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 10 lines · Aron Griffis

xen/arch/x86/hvm/svm/svm.c line 307

Quoted 7 lines
xen/arch/x86/hvm/svm/svm.c +5 -0
+#ifdef __x86_64__
     HVM_DBG_LOG(DBG_LEVEL_2, "mode_do_msr_read: msr_content: %lx\n",
             msr_content);
+#else
+    HVM_DBG_LOG(DBG_LEVEL_2, "mode_do_msr_read: msr_content: %llx\n",
+            msr_content);
+#endif

Could these simply use %llx and get rid of the #ifdef? %llx is 64-bit on x86 and x86_64

Should be PRIu64. I can make that simple cleanup...

-- Keir