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

[Xen-changelog] [xen-unstable] [IA64] vti fault handler clean up: fix vmx_break_fault and vmx_ia64_handle_break



# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1197665046 25200
# Node ID 2d01937021703d2ec5cc8c37faf73fd75b028d0b
# Parent  5ab3288e5b0fab956d0346b16d4f56e41a457aef
[IA64] vti fault handler clean up: fix vmx_break_fault and vmx_ia64_handle_break

vmx_break_fault and vmx_ia64_handle_break() should check cr.ipsr.vm bit
so that they can handle break fault in xen.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 xen/arch/ia64/vmx/vmx_fault.c |   22 ++++++++++++----------
 xen/arch/ia64/vmx/vmx_ivt.S   |   20 +++++++-------------
 xen/arch/ia64/xen/xenmisc.c   |   11 -----------
 xen/include/asm-ia64/domain.h |    5 +++++
 xen/include/asm-ia64/vmx.h    |    1 -
 5 files changed, 24 insertions(+), 35 deletions(-)

diff -r 5ab3288e5b0f -r 2d0193702170 xen/arch/ia64/vmx/vmx_fault.c
--- a/xen/arch/ia64/vmx/vmx_fault.c     Fri Dec 14 13:40:29 2007 -0700
+++ b/xen/arch/ia64/vmx/vmx_fault.c     Fri Dec 14 13:44:06 2007 -0700
@@ -56,7 +56,6 @@
 #define INITIAL_PSR_VALUE_AT_INTERRUPTION 0x0000001808028034
 
 
-extern void die_if_kernel(char *str, struct pt_regs *regs, long err);
 extern void rnat_consumption (VCPU *vcpu);
 extern void alt_itlb (VCPU *vcpu, u64 vadr);
 extern void itlb_fault (VCPU *vcpu, u64 vadr);
@@ -177,7 +176,7 @@ vmx_ia64_handle_break (unsigned long ifa
 
     perfc_incr(vmx_ia64_handle_break);
 #ifdef CRASH_DEBUG
-    if ((iim == 0 || iim == CDB_BREAK_NUM) && !guest_mode(regs) &&
+    if ((iim == 0 || iim == CDB_BREAK_NUM) && !vmx_user_mode(regs) &&
         IS_VMM_ADDRESS(regs->cr_iip)) {
         if (iim == 0)
             show_registers(regs);
@@ -185,17 +184,20 @@ vmx_ia64_handle_break (unsigned long ifa
     } else
 #endif
     {
-        if (iim == 0) 
-            vmx_die_if_kernel("Break 0 in Hypervisor.", regs, iim);
+        if (!vmx_user_mode(regs)) {
+            show_registers(regs);
+            gdprintk(XENLOG_DEBUG, "%s:%d imm %lx\n", __func__, __LINE__, iim);
+            ia64_fault(11 /* break fault */, isr, ifa, iim,
+                       0 /* cr.itir */, 0, 0, 0, (unsigned long)regs);
+        }
 
         if (ia64_psr(regs)->cpl == 0) {
             /* Allow hypercalls only when cpl = 0.  */
-            if (iim == d->arch.breakimm) {
-                ia64_hypercall(regs);
-                vcpu_increment_iip(v);
-                return IA64_NO_FAULT;
-            }
-            else if (iim == DOMN_PAL_REQUEST) {
+
+            /* normal hypercalls are handled by vmx_break_fault */
+            BUG_ON(iim == d->arch.breakimm);
+
+            if (iim == DOMN_PAL_REQUEST) {
                 pal_emul(v);
                 vcpu_increment_iip(v);
                 return IA64_NO_FAULT;
diff -r 5ab3288e5b0f -r 2d0193702170 xen/arch/ia64/vmx/vmx_ivt.S
--- a/xen/arch/ia64/vmx/vmx_ivt.S       Fri Dec 14 13:40:29 2007 -0700
+++ b/xen/arch/ia64/vmx/vmx_ivt.S       Fri Dec 14 13:44:06 2007 -0700
@@ -461,14 +461,10 @@ ENTRY(vmx_break_fault)
     mov r31=pr
     mov r19=11
     mov r17=cr.iim
-    ;;
-#ifdef VTI_DEBUG
-    // break 0 is already handled in vmx_ia64_handle_break.
-    cmp.eq p6,p7=r17,r0
-    (p6) br.sptk vmx_fault_11
-    ;;
-#endif
     mov r29=cr.ipsr
+    ;;
+    tbit.z p6,p0=r29,IA64_PSR_VM_BIT
+(p6)br.sptk.many vmx_dispatch_break_fault /* make sure before access [r21] */
     adds r22=IA64_VCPU_BREAKIMM_OFFSET, r21
     ;;
     ld4 r22=[r22]
@@ -1426,7 +1422,7 @@ END(vmx_dispatch_tlb_miss)
 END(vmx_dispatch_tlb_miss)
 
 ENTRY(vmx_dispatch_break_fault)
-    VMX_SAVE_MIN_WITH_COVER
+    VMX_SAVE_MIN_WITH_COVER_NO_PANIC
     ;;
     alloc r14=ar.pfs,0,0,4,0 // now it's safe (must be first in insn group!)
     mov out0=cr.ifa
@@ -1439,12 +1435,12 @@ ENTRY(vmx_dispatch_break_fault)
     srlz.i                  // guarantee that interruption collection is on
     ;;
     (p15)ssm psr.i               // restore psr.i
-    movl r14=ia64_leave_hypervisor
-    ;;
+(pUStk)movl r14=ia64_leave_hypervisor
+    ;;
+(pKStk)movl r14=ia64_leave_nested
     VMX_SAVE_REST
     mov rp=r14
     ;;
-    P6_BR_CALL_PANIC(.Lvmx_dispatch_break_fault_string)
     adds out1=16,sp
     br.call.sptk.many b6=vmx_ia64_handle_break
     ;;
@@ -1478,5 +1474,3 @@ END(vmx_dispatch_interrupt)
     .asciz "vmx_dispatch_vexirq\n"
 .Lvmx_dispatch_tlb_miss_string:
     .asciz "vmx_dispatch_tlb_miss\n"
-.Lvmx_dispatch_break_fault_string:
-    .asciz "vmx_dispatch_break_fault\n"
diff -r 5ab3288e5b0f -r 2d0193702170 xen/arch/ia64/xen/xenmisc.c
--- a/xen/arch/ia64/xen/xenmisc.c       Fri Dec 14 13:40:29 2007 -0700
+++ b/xen/arch/ia64/xen/xenmisc.c       Fri Dec 14 13:44:06 2007 -0700
@@ -69,17 +69,6 @@ void die_if_kernel(char *str, struct pt_
        domain_crash_synchronous();
 }
 
-void vmx_die_if_kernel(char *str, struct pt_regs *regs, long err)
-{
-       if (vmx_user_mode(regs))
-               return;
-
-       printk("%s: %s %ld\n", __func__, str, err);
-       debugtrace_dump();
-       show_registers(regs);
-       domain_crash_synchronous();
-}
-
 long
 ia64_peek (struct task_struct *child, struct switch_stack *child_stack,
           unsigned long user_rbs_end, unsigned long addr, long *val)
diff -r 5ab3288e5b0f -r 2d0193702170 xen/include/asm-ia64/domain.h
--- a/xen/include/asm-ia64/domain.h     Fri Dec 14 13:40:29 2007 -0700
+++ b/xen/include/asm-ia64/domain.h     Fri Dec 14 13:44:06 2007 -0700
@@ -306,6 +306,11 @@ do_perfmon_op(unsigned long cmd,
 do_perfmon_op(unsigned long cmd,
               XEN_GUEST_HANDLE(void) arg1, unsigned long arg2);
 
+void
+ia64_fault(unsigned long vector, unsigned long isr, unsigned long ifa,
+           unsigned long iim, unsigned long itir, unsigned long arg5,
+           unsigned long arg6, unsigned long arg7, unsigned long stack);
+
 #endif /* __ASM_DOMAIN_H__ */
 
 /*
diff -r 5ab3288e5b0f -r 2d0193702170 xen/include/asm-ia64/vmx.h
--- a/xen/include/asm-ia64/vmx.h        Fri Dec 14 13:40:29 2007 -0700
+++ b/xen/include/asm-ia64/vmx.h        Fri Dec 14 13:44:06 2007 -0700
@@ -52,7 +52,6 @@ extern void rsv_reg_field (struct vcpu *
 extern void rsv_reg_field (struct vcpu *vcpu);
 extern void vmx_relinquish_guest_resources(struct domain *d);
 extern void vmx_relinquish_vcpu_resources(struct vcpu *v);
-extern void vmx_die_if_kernel(char *str, struct pt_regs *regs, long err);
 extern void vmx_send_assist_req(struct vcpu *v);
 extern void deliver_pal_init(struct vcpu *vcpu);
 extern void vmx_pend_pal_init(struct domain *d);

_______________________________________________
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®.