direct-io.hg

changeset 10591:602f5965e217

[IA64] display vmx fault messges

This patch modifies the vmx fault handler to display a message when a
fault occurs in hypervisor.

This includes the followings:

- Break 0 handler is modified to check psr.vm bit instead of cpl.
- External interrupt handler is modified to get current using
MINSTATE_GET_CURRENT instead of r21. r21 has been used in DO_SAVE_MIN
which is called from other fault handlers. I'm not sure why the
original vmx fault handler gets the current from r21.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Signed-off-by: Tetsu Yamamoto <yamamoto.tetsu@jp.fujitsu.com>
author awilliam@xenbuild.aw
date Mon Jun 19 13:42:34 2006 -0600 (2006-06-19)
parents df67fa9b1376
children ea306829506c
files xen/arch/ia64/vmx/vmx_ivt.S xen/arch/ia64/vmx/vmx_process.c xen/arch/ia64/xen/ivt.S xen/arch/ia64/xen/xenmisc.c xen/include/asm-ia64/vmx.h
line diff
     1.1 --- a/xen/arch/ia64/vmx/vmx_ivt.S	Mon Jun 19 13:35:49 2006 -0600
     1.2 +++ b/xen/arch/ia64/vmx/vmx_ivt.S	Mon Jun 19 13:42:34 2006 -0600
     1.3 @@ -88,11 +88,13 @@
     1.4  
     1.5  #include "vmx_minstate.h"
     1.6  
     1.7 +#define MINSTATE_VIRT	/* needed by minstate.h */
     1.8 +#include "minstate.h"
     1.9  
    1.10  
    1.11  #define VMX_FAULT(n)    \
    1.12  vmx_fault_##n:;          \
    1.13 -    br.sptk vmx_fault_##n;         \
    1.14 +    br.sptk.many dispatch_to_fault_handler;         \
    1.15      ;;                  \
    1.16  
    1.17  
    1.18 @@ -508,7 +510,7 @@ ENTRY(vmx_interrupt)
    1.19      ;;
    1.20  .mem.offset 0,0; st8.spill [r16]=r13,16
    1.21  .mem.offset 8,0; st8.spill [r17]=r8,16 /* save ar.fpsr */
    1.22 -    mov r13=r21    /* establish `current' */
    1.23 +    MINSTATE_GET_CURRENT(r13)
    1.24      ;;
    1.25  .mem.offset 0,0; st8.spill [r16]=r15,16
    1.26  .mem.offset 8,0; st8.spill [r17]=r14,16
     2.1 --- a/xen/arch/ia64/vmx/vmx_process.c	Mon Jun 19 13:35:49 2006 -0600
     2.2 +++ b/xen/arch/ia64/vmx/vmx_process.c	Mon Jun 19 13:42:34 2006 -0600
     2.3 @@ -125,7 +125,7 @@ vmx_ia64_handle_break (unsigned long ifa
     2.4  #endif
     2.5      {
     2.6          if (iim == 0) 
     2.7 -            die_if_kernel("bug check", regs, iim);
     2.8 +            vmx_die_if_kernel("Break 0 in Hypervisor.", regs, iim);
     2.9  
    2.10          if (!user_mode(regs)) {
    2.11              /* Allow hypercalls only when cpl = 0.  */
     3.1 --- a/xen/arch/ia64/xen/ivt.S	Mon Jun 19 13:35:49 2006 -0600
     3.2 +++ b/xen/arch/ia64/xen/ivt.S	Mon Jun 19 13:42:34 2006 -0600
     3.3 @@ -1493,7 +1493,7 @@ END(dispatch_unaligned_handler)
     3.4  	 * suitable spot...
     3.5  	 */
     3.6  
     3.7 -ENTRY(dispatch_to_fault_handler)
     3.8 +GLOBAL_ENTRY(dispatch_to_fault_handler)
     3.9  	/*
    3.10  	 * Input:
    3.11  	 *	psr.ic:	off
     4.1 --- a/xen/arch/ia64/xen/xenmisc.c	Mon Jun 19 13:35:49 2006 -0600
     4.2 +++ b/xen/arch/ia64/xen/xenmisc.c	Mon Jun 19 13:42:34 2006 -0600
     4.3 @@ -19,6 +19,7 @@
     4.4  #include <public/sched.h>
     4.5  #include <asm/vhpt.h>
     4.6  #include <asm/debugger.h>
     4.7 +#include <asm/vmx.h>
     4.8  #include <asm/vmx_vcpu.h>
     4.9  #include <asm/vcpu.h>
    4.10  
    4.11 @@ -109,6 +110,17 @@ void die_if_kernel(char *str, struct pt_
    4.12  	domain_crash_synchronous();
    4.13  }
    4.14  
    4.15 +void vmx_die_if_kernel(char *str, struct pt_regs *regs, long err) /* __attribute__ ((noreturn)) */
    4.16 +{
    4.17 +	if (vmx_user_mode(regs))
    4.18 +		return;
    4.19 +
    4.20 +	printk("%s: %s %ld\n", __func__, str, err);
    4.21 +	debugtrace_dump();
    4.22 +	show_registers(regs);
    4.23 +	domain_crash_synchronous();
    4.24 +}
    4.25 +
    4.26  long
    4.27  ia64_peek (struct task_struct *child, struct switch_stack *child_stack,
    4.28  	   unsigned long user_rbs_end, unsigned long addr, long *val)
     5.1 --- a/xen/include/asm-ia64/vmx.h	Mon Jun 19 13:35:49 2006 -0600
     5.2 +++ b/xen/include/asm-ia64/vmx.h	Mon Jun 19 13:42:34 2006 -0600
     5.3 @@ -24,6 +24,7 @@
     5.4  
     5.5  #define RR7_SWITCH_SHIFT	12	/* 4k enough */
     5.6  #include <public/hvm/ioreq.h>
     5.7 +#define vmx_user_mode(regs) (((struct ia64_psr *)&(regs)->cr_ipsr)->vm == 1)
     5.8  
     5.9  #define VCPU_LID(v) (((u64)(v)->vcpu_id)<<24)
    5.10