# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1196304704 -32400 # Node ID efe53f04978e100b94ca1f80fdd519cc067b86ef # Parent b9d0ace3bbb79161658a2bee119f68cbfee92479 vmx_break_fault and vmx_ia64_handle_break() should check cr.ipsr.vm bit so that they can handle break fault in xen. PATCHNAME: clean_up_vmx_break_fault Signed-off-by: Isaku Yamahata diff -r b9d0ace3bbb7 -r efe53f04978e xen/arch/ia64/vmx/vmx_fault.c --- a/xen/arch/ia64/vmx/vmx_fault.c Mon Dec 03 14:12:52 2007 +0900 +++ b/xen/arch/ia64/vmx/vmx_fault.c Thu Nov 29 11:51:44 2007 +0900 @@ -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 b9d0ace3bbb7 -r efe53f04978e xen/arch/ia64/vmx/vmx_ivt.S --- a/xen/arch/ia64/vmx/vmx_ivt.S Mon Dec 03 14:12:52 2007 +0900 +++ b/xen/arch/ia64/vmx/vmx_ivt.S Thu Nov 29 11:51:44 2007 +0900 @@ -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 b9d0ace3bbb7 -r efe53f04978e xen/arch/ia64/xen/xenmisc.c --- a/xen/arch/ia64/xen/xenmisc.c Mon Dec 03 14:12:52 2007 +0900 +++ b/xen/arch/ia64/xen/xenmisc.c Thu Nov 29 11:51:44 2007 +0900 @@ -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 b9d0ace3bbb7 -r efe53f04978e xen/include/asm-ia64/domain.h --- a/xen/include/asm-ia64/domain.h Mon Dec 03 14:12:52 2007 +0900 +++ b/xen/include/asm-ia64/domain.h Thu Nov 29 11:51:44 2007 +0900 @@ -284,6 +284,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 b9d0ace3bbb7 -r efe53f04978e xen/include/asm-ia64/vmx.h --- a/xen/include/asm-ia64/vmx.h Mon Dec 03 14:12:52 2007 +0900 +++ b/xen/include/asm-ia64/vmx.h Thu Nov 29 11:51:44 2007 +0900 @@ -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);