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

[Xen-ia64-devel] [PATCH] fix INIT injection



xm trigger command sometimes causes an unexpected domain panic.
There are several symptoms:
 * Guest nested fault (INIT handler runs with vpsr.cpl != 0)
 * Interrupt when IC=0
 * Unexpected virtual <--> physical mode transition

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Signed-off-by: Kazuhiro Suzuki <kaz@xxxxxxxxxxxxxx>

diff -r 4a381ddc764a xen/arch/ia64/vmx/vlsapic.c
--- a/xen/arch/ia64/vmx/vlsapic.c       Tue Sep 16 21:25:30 2008 +0900
+++ b/xen/arch/ia64/vmx/vlsapic.c       Wed Sep 17 11:44:04 2008 +0900
@@ -43,6 +43,7 @@
 #include <asm/vmx_platform.h>
 #include <asm/viosapic.h>
 #include <asm/vlsapic.h>
+#include <asm/vmx_phy_mode.h>
 #include <asm/linux/jiffies.h>
 #include <xen/domain.h>
 #include <asm/hvm/support.h>
@@ -614,9 +615,8 @@ struct vcpu *lid_to_vcpu(struct domain *
  * To inject INIT to guest, we must set the PAL_INIT entry 
  * and set psr to switch to physical mode
  */
-#define PAL_INIT_ENTRY 0x80000000ffffffa0
 #define PSR_SET_BITS (IA64_PSR_DT | IA64_PSR_IT | IA64_PSR_RT | \
-                      IA64_PSR_IC | IA64_PSR_RI)
+                      IA64_PSR_IC | IA64_PSR_RI | IA64_PSR_I | IA64_PSR_CPL)
 
 static void vmx_inject_guest_pal_init(VCPU *vcpu)
 {
diff -r 4a381ddc764a xen/arch/ia64/vmx/vmx_phy_mode.c
--- a/xen/arch/ia64/vmx/vmx_phy_mode.c  Tue Sep 16 21:25:30 2008 +0900
+++ b/xen/arch/ia64/vmx/vmx_phy_mode.c  Wed Sep 17 11:44:04 2008 +0900
@@ -283,6 +283,13 @@ switch_mm_mode(VCPU *vcpu, IA64_PSR old_
 //               old_psr.val, new_psr.val);
         break;
     default:
+        /* Switch to physical mode when injecting PAL_INIT */
+        if (MODE_IND(new_psr) == 0 &&
+            vcpu_regs(vcpu)->cr_iip == PAL_INIT_ENTRY) {
+            vcpu->arch.arch_vmx.mmu_mode = VMX_MMU_PHY_DT;
+            switch_to_physical_rid(vcpu);
+            break;
+        }
         /* Sanity check */
         panic_domain(vcpu_regs(vcpu),
                      "Unexpected virtual <--> physical mode transition, "
diff -r 4a381ddc764a xen/include/asm-ia64/vmx_phy_mode.h
--- a/xen/include/asm-ia64/vmx_phy_mode.h       Tue Sep 16 21:25:30 2008 +0900
+++ b/xen/include/asm-ia64/vmx_phy_mode.h       Wed Sep 17 11:44:04 2008 +0900
@@ -96,4 +96,6 @@ extern void physical_tlb_miss(VCPU *vcpu
 #define VMX_MMU_PHY_D      1    /* Half physical: it=1,dt=0  */
 #define VMX_MMU_PHY_DT     3    /* Full physical mode: it=0,dt=0  */
 
+#define PAL_INIT_ENTRY 0x80000000ffffffa0
+
 #endif /* _PHY_MODE_H_ */
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel

 


Rackspace

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