ia64/xen-unstable

changeset 10561:550786d7d352

[IA64] privop_stat.c

Cleanup: create privop_stat.[ch]
Move all stats function to privop_stat.c to depolute other files.

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Mon Jul 03 08:12:16 2006 -0600 (2006-07-03)
parents 75b23b6a7cb7
children dad1f890aca5
files xen/arch/ia64/vmx/mmio.c xen/arch/ia64/vmx/vmx_virt.c xen/arch/ia64/xen/Makefile xen/arch/ia64/xen/dom_fw.c xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/faults.c xen/arch/ia64/xen/hypercall.c xen/arch/ia64/xen/ivt.S xen/arch/ia64/xen/privop.c xen/arch/ia64/xen/privop_stat.c xen/arch/ia64/xen/vcpu.c xen/include/asm-ia64/bundle.h xen/include/asm-ia64/dom_fw.h xen/include/asm-ia64/privop.h xen/include/asm-ia64/privop_stat.h xen/include/asm-ia64/vcpu.h xen/include/asm-ia64/vhpt.h
line diff
     1.1 --- a/xen/arch/ia64/vmx/mmio.c	Mon Jul 03 07:42:17 2006 -0600
     1.2 +++ b/xen/arch/ia64/vmx/mmio.c	Mon Jul 03 08:12:16 2006 -0600
     1.3 @@ -27,7 +27,7 @@
     1.4  #include <asm/gcc_intrin.h>
     1.5  #include <linux/interrupt.h>
     1.6  #include <asm/vmx_vcpu.h>
     1.7 -#include <asm/privop.h>
     1.8 +#include <asm/bundle.h>
     1.9  #include <asm/types.h>
    1.10  #include <public/hvm/ioreq.h>
    1.11  #include <asm/mm.h>
     2.1 --- a/xen/arch/ia64/vmx/vmx_virt.c	Mon Jul 03 07:42:17 2006 -0600
     2.2 +++ b/xen/arch/ia64/vmx/vmx_virt.c	Mon Jul 03 08:12:16 2006 -0600
     2.3 @@ -20,10 +20,7 @@
     2.4   *  Shaofan Li (Susue Li) <susie.li@intel.com>
     2.5   *  Xuefei Xu (Anthony Xu) (Anthony.xu@intel.com)
     2.6   */
     2.7 -
     2.8 -
     2.9 -
    2.10 -#include <asm/privop.h>
    2.11 +#include <asm/bundle.h>
    2.12  #include <asm/vmx_vcpu.h>
    2.13  #include <asm/processor.h>
    2.14  #include <asm/delay.h>	// Debug only
    2.15 @@ -33,7 +30,6 @@
    2.16  #include <asm/vmx.h>
    2.17  #include <asm/virt_event.h>
    2.18  #include <asm/vmx_phy_mode.h>
    2.19 -extern UINT64 privop_trace;
    2.20  extern void vhpi_detection(VCPU *vcpu);//temporarily place here,need a header file.
    2.21  
    2.22  void
    2.23 @@ -1381,15 +1377,6 @@ vmx_emulate(VCPU *vcpu, REGS *regs)
    2.24      cause = VMX(vcpu,cause);
    2.25      opcode = VMX(vcpu,opcode);
    2.26  
    2.27 -/*
    2.28 -    if (privop_trace) {
    2.29 -        static long i = 400;
    2.30 -        //if (i > 0) printf("privop @%p\n",iip);
    2.31 -        if (i > 0) printf("priv_handle_op: @%p, itc=%lx, itm=%lx\n",
    2.32 -            iip,ia64_get_itc(),ia64_get_itm());
    2.33 -        i--;
    2.34 -    }
    2.35 -*/
    2.36  #ifdef  VTLB_DEBUG
    2.37      check_vtlb_sanity(vmx_vcpu_get_vtlb(vcpu));
    2.38      dump_vtlb(vmx_vcpu_get_vtlb(vcpu));
     3.1 --- a/xen/arch/ia64/xen/Makefile	Mon Jul 03 07:42:17 2006 -0600
     3.2 +++ b/xen/arch/ia64/xen/Makefile	Mon Jul 03 08:12:16 2006 -0600
     3.3 @@ -24,5 +24,6 @@ obj-y += xenmisc.o
     3.4  obj-y += xensetup.o
     3.5  obj-y += xentime.o
     3.6  obj-y += flushd.o
     3.7 +obj-y += privop_stat.o
     3.8  
     3.9  obj-$(crash_debug) += gdbstub.o
     4.1 --- a/xen/arch/ia64/xen/dom_fw.c	Mon Jul 03 07:42:17 2006 -0600
     4.2 +++ b/xen/arch/ia64/xen/dom_fw.c	Mon Jul 03 08:12:16 2006 -0600
     4.3 @@ -23,6 +23,7 @@
     4.4  #include <xen/acpi.h>
     4.5  
     4.6  #include <asm/dom_fw.h>
     4.7 +#include <asm/bundle.h>
     4.8  
     4.9  static struct ia64_boot_param *dom_fw_init(struct domain *, const char *,int,char *,int);
    4.10  extern struct domain *dom0;
    4.11 @@ -82,6 +83,83 @@ dom_pa(unsigned long imva)
    4.12          }                                           \
    4.13      } while (0)
    4.14  
    4.15 +/**************************************************************************
    4.16 +Hypercall bundle creation
    4.17 +**************************************************************************/
    4.18 +
    4.19 +static void build_hypercall_bundle(UINT64 *imva, UINT64 brkimm, UINT64 hypnum, UINT64 ret)
    4.20 +{
    4.21 +	INST64_A5 slot0;
    4.22 +	INST64_I19 slot1;
    4.23 +	INST64_B4 slot2;
    4.24 +	IA64_BUNDLE bundle;
    4.25 +
    4.26 +	// slot1: mov r2 = hypnum (low 20 bits)
    4.27 +	slot0.inst = 0;
    4.28 +	slot0.qp = 0; slot0.r1 = 2; slot0.r3 = 0; slot0.major = 0x9;
    4.29 +	slot0.imm7b = hypnum; slot0.imm9d = hypnum >> 7;
    4.30 +	slot0.imm5c = hypnum >> 16; slot0.s = 0;
    4.31 +	// slot1: break brkimm
    4.32 +	slot1.inst = 0;
    4.33 +	slot1.qp = 0; slot1.x6 = 0; slot1.x3 = 0; slot1.major = 0x0;
    4.34 +	slot1.imm20 = brkimm; slot1.i = brkimm >> 20;
    4.35 +	// if ret slot2: br.ret.sptk.many rp
    4.36 +	// else slot2: br.cond.sptk.many rp
    4.37 +	slot2.inst = 0; slot2.qp = 0; slot2.p = 1; slot2.b2 = 0;
    4.38 +	slot2.wh = 0; slot2.d = 0; slot2.major = 0x0;
    4.39 +	if (ret) {
    4.40 +		slot2.btype = 4; slot2.x6 = 0x21;
    4.41 +	}
    4.42 +	else {
    4.43 +		slot2.btype = 0; slot2.x6 = 0x20;
    4.44 +	}
    4.45 +	
    4.46 +	bundle.i64[0] = 0; bundle.i64[1] = 0;
    4.47 +	bundle.template = 0x11;
    4.48 +	bundle.slot0 = slot0.inst; bundle.slot2 = slot2.inst;
    4.49 +	bundle.slot1a = slot1.inst; bundle.slot1b = slot1.inst >> 18;
    4.50 +	
    4.51 +	imva[0] = bundle.i64[0]; imva[1] = bundle.i64[1];
    4.52 +	ia64_fc(imva);
    4.53 +	ia64_fc(imva + 1);
    4.54 +}
    4.55 +
    4.56 +static void build_pal_hypercall_bundles(UINT64 *imva, UINT64 brkimm, UINT64 hypnum)
    4.57 +{
    4.58 +	extern unsigned long pal_call_stub[];
    4.59 +	IA64_BUNDLE bundle;
    4.60 +	INST64_A5 slot_a5;
    4.61 +	INST64_M37 slot_m37;
    4.62 +
    4.63 +	/* The source of the hypercall stub is the pal_call_stub function
    4.64 +	   defined in xenasm.S.  */
    4.65 +
    4.66 +	/* Copy the first bundle and patch the hypercall number.  */
    4.67 +	bundle.i64[0] = pal_call_stub[0];
    4.68 +	bundle.i64[1] = pal_call_stub[1];
    4.69 +	slot_a5.inst = bundle.slot0;
    4.70 +	slot_a5.imm7b = hypnum;
    4.71 +	slot_a5.imm9d = hypnum >> 7;
    4.72 +	slot_a5.imm5c = hypnum >> 16;
    4.73 +	bundle.slot0 = slot_a5.inst;
    4.74 +	imva[0] = bundle.i64[0];
    4.75 +	imva[1] = bundle.i64[1];
    4.76 +	ia64_fc(imva);
    4.77 +	ia64_fc(imva + 1);
    4.78 +	
    4.79 +	/* Copy the second bundle and patch the hypercall vector.  */
    4.80 +	bundle.i64[0] = pal_call_stub[2];
    4.81 +	bundle.i64[1] = pal_call_stub[3];
    4.82 +	slot_m37.inst = bundle.slot0;
    4.83 +	slot_m37.imm20a = brkimm;
    4.84 +	slot_m37.i = brkimm >> 20;
    4.85 +	bundle.slot0 = slot_m37.inst;
    4.86 +	imva[2] = bundle.i64[0];
    4.87 +	imva[3] = bundle.i64[1];
    4.88 +	ia64_fc(imva + 2);
    4.89 +	ia64_fc(imva + 3);
    4.90 +}
    4.91 +
    4.92  // builds a hypercall bundle at domain physical address
    4.93  static void dom_fpswa_hypercall_patch(struct domain *d)
    4.94  {
     5.1 --- a/xen/arch/ia64/xen/domain.c	Mon Jul 03 07:42:17 2006 -0600
     5.2 +++ b/xen/arch/ia64/xen/domain.c	Mon Jul 03 08:12:16 2006 -0600
     5.3 @@ -59,6 +59,7 @@
     5.4  #include <asm/tlbflush.h>
     5.5  #include <asm/regionreg.h>
     5.6  #include <asm/dom_fw.h>
     5.7 +#include <asm/privop_stat.h>
     5.8  
     5.9  #ifndef CONFIG_XEN_IA64_DOM0_VP
    5.10  #define CONFIG_DOMAIN0_CONTIGUOUS
    5.11 @@ -82,8 +83,6 @@ extern void vmx_do_launch(struct vcpu *)
    5.12  void build_physmap_table(struct domain *d);
    5.13  
    5.14  /* this belongs in include/asm, but there doesn't seem to be a suitable place */
    5.15 -unsigned long context_switch_count = 0;
    5.16 -
    5.17  extern struct vcpu *ia64_switch_to (struct vcpu *next_task);
    5.18  
    5.19  /* Address of vpsr.i (in fact evtchn_upcall_mask) of current vcpu.
     6.1 --- a/xen/arch/ia64/xen/faults.c	Mon Jul 03 07:42:17 2006 -0600
     6.2 +++ b/xen/arch/ia64/xen/faults.c	Mon Jul 03 08:12:16 2006 -0600
     6.3 @@ -26,6 +26,8 @@
     6.4  #include <asm/vhpt.h>
     6.5  #include <asm/debugger.h>
     6.6  #include <asm/fpswa.h>
     6.7 +#include <asm/bundle.h>
     6.8 +#include <asm/privop_stat.h>
     6.9  #include <asm/asm-xsi-offsets.h>
    6.10  
    6.11  extern void die_if_kernel(char *str, struct pt_regs *regs, long err);
    6.12 @@ -49,42 +51,8 @@ extern IA64FAULT ia64_hypercall(struct p
    6.13  
    6.14  extern void do_ssc(unsigned long ssc, struct pt_regs *regs);
    6.15  
    6.16 -unsigned long slow_reflect_count[0x80] = { 0 };
    6.17 -unsigned long fast_reflect_count[0x80] = { 0 };
    6.18 -
    6.19  #define inc_slow_reflect_count(vec) slow_reflect_count[vec>>8]++;
    6.20  
    6.21 -void zero_reflect_counts(void)
    6.22 -{
    6.23 -	int i;
    6.24 -	for (i=0; i<0x80; i++) slow_reflect_count[i] = 0;
    6.25 -	for (i=0; i<0x80; i++) fast_reflect_count[i] = 0;
    6.26 -}
    6.27 -
    6.28 -int dump_reflect_counts(char *buf)
    6.29 -{
    6.30 -	int i,j,cnt;
    6.31 -	char *s = buf;
    6.32 -
    6.33 -	s += sprintf(s,"Slow reflections by vector:\n");
    6.34 -	for (i = 0, j = 0; i < 0x80; i++) {
    6.35 -		if ( (cnt = slow_reflect_count[i]) != 0 ) {
    6.36 -			s += sprintf(s,"0x%02x00:%10d, ",i,cnt);
    6.37 -			if ((j++ & 3) == 3) s += sprintf(s,"\n");
    6.38 -		}
    6.39 -	}
    6.40 -	if (j & 3) s += sprintf(s,"\n");
    6.41 -	s += sprintf(s,"Fast reflections by vector:\n");
    6.42 -	for (i = 0, j = 0; i < 0x80; i++) {
    6.43 -		if ( (cnt = fast_reflect_count[i]) != 0 ) {
    6.44 -			s += sprintf(s,"0x%02x00:%10d, ",i,cnt);
    6.45 -			if ((j++ & 3) == 3) s += sprintf(s,"\n");
    6.46 -		}
    6.47 -	}
    6.48 -	if (j & 3) s += sprintf(s,"\n");
    6.49 -	return s - buf;
    6.50 -}
    6.51 -
    6.52  // should never panic domain... if it does, stack may have been overrun
    6.53  void check_bad_nested_interruption(unsigned long isr, struct pt_regs *regs, unsigned long vector)
    6.54  {
    6.55 @@ -194,7 +162,6 @@ void deliver_pending_interrupt(struct pt
    6.56  			++pending_false_positive;
    6.57  	}
    6.58  }
    6.59 -unsigned long lazy_cover_count = 0;
    6.60  
    6.61  static int
    6.62  handle_lazy_cover(struct vcpu *v, struct pt_regs *regs)
     7.1 --- a/xen/arch/ia64/xen/hypercall.c	Mon Jul 03 07:42:17 2006 -0600
     7.2 +++ b/xen/arch/ia64/xen/hypercall.c	Mon Jul 03 08:12:16 2006 -0600
     7.3 @@ -28,16 +28,11 @@
     7.4  #include <xen/domain.h>
     7.5  #include <public/callback.h>
     7.6  #include <xen/event.h>
     7.7 +#include <asm/privop_stat.h>
     7.8  
     7.9  static long do_physdev_op_compat(XEN_GUEST_HANDLE(physdev_op_t) uop);
    7.10  static long do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg);
    7.11  static long do_callback_op(int cmd, XEN_GUEST_HANDLE(void) arg);
    7.12 -/* FIXME: where these declarations should be there ? */
    7.13 -extern int dump_privop_counts_to_user(char *, int);
    7.14 -extern int zero_privop_counts_to_user(char *, int);
    7.15 -
    7.16 -unsigned long idle_when_pending = 0;
    7.17 -unsigned long pal_halt_light_count = 0;
    7.18  
    7.19  hypercall_t ia64_hypercall_table[] =
    7.20  	{
     8.1 --- a/xen/arch/ia64/xen/ivt.S	Mon Jul 03 07:42:17 2006 -0600
     8.2 +++ b/xen/arch/ia64/xen/ivt.S	Mon Jul 03 08:12:16 2006 -0600
     8.3 @@ -14,7 +14,6 @@
     8.4  #define ia64_trace_syscall 0
     8.5  #define sys_call_table 0
     8.6  #define sys_ni_syscall 0
     8.7 -#include <asm/vhpt.h>
     8.8  #include <asm/debugger.h>
     8.9  #endif
    8.10  /*
     9.1 --- a/xen/arch/ia64/xen/privop.c	Mon Jul 03 07:42:17 2006 -0600
     9.2 +++ b/xen/arch/ia64/xen/privop.c	Mon Jul 03 08:12:16 2006 -0600
     9.3 @@ -12,12 +12,11 @@
     9.4  #include <asm/delay.h>	// Debug only
     9.5  #include <asm/dom_fw.h>
     9.6  #include <asm/vhpt.h>
     9.7 -
     9.8 -/* FIXME: where these declarations should be there ? */
     9.9 -extern int dump_reflect_counts(char *);
    9.10 -extern void zero_reflect_counts(void);
    9.11 +#include <asm/bundle.h>
    9.12 +#include <asm/privop_stat.h>
    9.13  
    9.14  long priv_verbose=0;
    9.15 +unsigned long privop_trace = 0;
    9.16  
    9.17  /* Set to 1 to handle privified instructions from the privify tool. */
    9.18  #ifndef CONFIG_PRIVIFY
    9.19 @@ -27,84 +26,6 @@ static const int privify_en = 1;
    9.20  #endif
    9.21  
    9.22  /**************************************************************************
    9.23 -Hypercall bundle creation
    9.24 -**************************************************************************/
    9.25 -
    9.26 -void build_hypercall_bundle(UINT64 *imva, UINT64 brkimm, UINT64 hypnum, UINT64 ret)
    9.27 -{
    9.28 -	INST64_A5 slot0;
    9.29 -	INST64_I19 slot1;
    9.30 -	INST64_B4 slot2;
    9.31 -	IA64_BUNDLE bundle;
    9.32 -
    9.33 -	// slot1: mov r2 = hypnum (low 20 bits)
    9.34 -	slot0.inst = 0;
    9.35 -	slot0.qp = 0; slot0.r1 = 2; slot0.r3 = 0; slot0.major = 0x9;
    9.36 -	slot0.imm7b = hypnum; slot0.imm9d = hypnum >> 7;
    9.37 -	slot0.imm5c = hypnum >> 16; slot0.s = 0;
    9.38 -	// slot1: break brkimm
    9.39 -	slot1.inst = 0;
    9.40 -	slot1.qp = 0; slot1.x6 = 0; slot1.x3 = 0; slot1.major = 0x0;
    9.41 -	slot1.imm20 = brkimm; slot1.i = brkimm >> 20;
    9.42 -	// if ret slot2: br.ret.sptk.many rp
    9.43 -	// else slot2: br.cond.sptk.many rp
    9.44 -	slot2.inst = 0; slot2.qp = 0; slot2.p = 1; slot2.b2 = 0;
    9.45 -	slot2.wh = 0; slot2.d = 0; slot2.major = 0x0;
    9.46 -	if (ret) {
    9.47 -		slot2.btype = 4; slot2.x6 = 0x21;
    9.48 -	}
    9.49 -	else {
    9.50 -		slot2.btype = 0; slot2.x6 = 0x20;
    9.51 -	}
    9.52 -	
    9.53 -	bundle.i64[0] = 0; bundle.i64[1] = 0;
    9.54 -	bundle.template = 0x11;
    9.55 -	bundle.slot0 = slot0.inst; bundle.slot2 = slot2.inst;
    9.56 -	bundle.slot1a = slot1.inst; bundle.slot1b = slot1.inst >> 18;
    9.57 -	
    9.58 -	imva[0] = bundle.i64[0]; imva[1] = bundle.i64[1];
    9.59 -	ia64_fc (imva);
    9.60 -	ia64_fc (imva + 1);
    9.61 -}
    9.62 -
    9.63 -void build_pal_hypercall_bundles(UINT64 *imva, UINT64 brkimm, UINT64 hypnum)
    9.64 -{
    9.65 -	extern unsigned long pal_call_stub[];
    9.66 -	IA64_BUNDLE bundle;
    9.67 -	INST64_A5 slot_a5;
    9.68 -	INST64_M37 slot_m37;
    9.69 -
    9.70 -	/* The source of the hypercall stub is the pal_call_stub function
    9.71 -	   defined in xenasm.S.  */
    9.72 -
    9.73 -	/* Copy the first bundle and patch the hypercall number.  */
    9.74 -	bundle.i64[0] = pal_call_stub[0];
    9.75 -	bundle.i64[1] = pal_call_stub[1];
    9.76 -	slot_a5.inst = bundle.slot0;
    9.77 -	slot_a5.imm7b = hypnum;
    9.78 -	slot_a5.imm9d = hypnum >> 7;
    9.79 -	slot_a5.imm5c = hypnum >> 16;
    9.80 -	bundle.slot0 = slot_a5.inst;
    9.81 -	imva[0] = bundle.i64[0];
    9.82 -	imva[1] = bundle.i64[1];
    9.83 -	ia64_fc (imva);
    9.84 -	ia64_fc (imva + 1);
    9.85 -	
    9.86 -	/* Copy the second bundle and patch the hypercall vector.  */
    9.87 -	bundle.i64[0] = pal_call_stub[2];
    9.88 -	bundle.i64[1] = pal_call_stub[3];
    9.89 -	slot_m37.inst = bundle.slot0;
    9.90 -	slot_m37.imm20a = brkimm;
    9.91 -	slot_m37.i = brkimm >> 20;
    9.92 -	bundle.slot0 = slot_m37.inst;
    9.93 -	imva[2] = bundle.i64[0];
    9.94 -	imva[3] = bundle.i64[1];
    9.95 -	ia64_fc (imva + 2);
    9.96 -	ia64_fc (imva + 3);
    9.97 -}
    9.98 -
    9.99 -
   9.100 -/**************************************************************************
   9.101  Privileged operation emulation routines
   9.102  **************************************************************************/
   9.103  
   9.104 @@ -351,12 +272,10 @@ static IA64FAULT priv_mov_to_pmd(VCPU *v
   9.105  	return (vcpu_set_pmd(vcpu,r3,r2));
   9.106  }
   9.107  
   9.108 -unsigned long to_cr_cnt[128] = { 0 };
   9.109 -
   9.110  static IA64FAULT priv_mov_to_cr(VCPU *vcpu, INST64 inst)
   9.111  {
   9.112  	UINT64 val = vcpu_get_gr(vcpu, inst.M32.r2);
   9.113 -	to_cr_cnt[inst.M32.cr3]++;
   9.114 +	privcnt.to_cr_cnt[inst.M32.cr3]++;
   9.115  	switch (inst.M32.cr3) {
   9.116  	    case 0: return vcpu_set_dcr(vcpu,val);
   9.117  	    case 1: return vcpu_set_itm(vcpu,val);
   9.118 @@ -488,8 +407,6 @@ static IA64FAULT priv_mov_from_pmc(VCPU 
   9.119  	return fault;
   9.120  }
   9.121  
   9.122 -unsigned long from_cr_cnt[128] = { 0 };
   9.123 -
   9.124  #define cr_get(cr) \
   9.125  	((fault = vcpu_get_##cr(vcpu,&val)) == IA64_NO_FAULT) ? \
   9.126  		vcpu_set_gr(vcpu, tgt, val, 0) : fault;
   9.127 @@ -500,7 +417,7 @@ static IA64FAULT priv_mov_from_cr(VCPU *
   9.128  	UINT64 val;
   9.129  	IA64FAULT fault;
   9.130  
   9.131 -	from_cr_cnt[inst.M33.cr3]++;
   9.132 +	privcnt.from_cr_cnt[inst.M33.cr3]++;
   9.133  	switch (inst.M33.cr3) {
   9.134  	    case 0: return cr_get(dcr);
   9.135  	    case 1: return cr_get(itm);
   9.136 @@ -586,23 +503,6 @@ static const PPEFCN Mpriv_funcs[64] = {
   9.137    0, 0, 0, 0, 0, 0, 0, 0
   9.138  };
   9.139  
   9.140 -struct {
   9.141 -	unsigned long mov_to_ar_imm;
   9.142 -	unsigned long mov_to_ar_reg;
   9.143 -	unsigned long mov_from_ar;
   9.144 -	unsigned long ssm;
   9.145 -	unsigned long rsm;
   9.146 -	unsigned long rfi;
   9.147 -	unsigned long bsw0;
   9.148 -	unsigned long bsw1;
   9.149 -	unsigned long cover;
   9.150 -	unsigned long fc;
   9.151 -	unsigned long cpuid;
   9.152 -	unsigned long Mpriv_cnt[64];
   9.153 -} privcnt = { 0 };
   9.154 -
   9.155 -unsigned long privop_trace = 0;
   9.156 -
   9.157  static IA64FAULT
   9.158  priv_handle_op(VCPU *vcpu, REGS *regs, int privlvl)
   9.159  {
   9.160 @@ -791,15 +691,6 @@ priv_emulate(VCPU *vcpu, REGS *regs, UIN
   9.161  	return fault;
   9.162  }
   9.163  
   9.164 -static const char * const hyperpriv_str[HYPERPRIVOP_MAX+1] = {
   9.165 -	0, "rfi", "rsm.dt", "ssm.dt", "cover", "itc.d", "itc.i", "ssm.i",
   9.166 -	"=ivr", "=tpr", "tpr=", "eoi", "itm=", "thash", "ptc.ga", "itr.d",
   9.167 -	"=rr", "rr=", "kr=", "fc", "=cpuid", "=pmd", "=ar.eflg", "ar.eflg="
   9.168 -};
   9.169 -
   9.170 -unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
   9.171 -unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
   9.172 -
   9.173  /* hyperprivops are generally executed in assembly (with physical psr.ic off)
   9.174   * so this code is primarily used for debugging them */
   9.175  int
   9.176 @@ -811,8 +702,8 @@ ia64_hyperprivop(unsigned long iim, REGS
   9.177  
   9.178  // FIXME: Handle faults appropriately for these
   9.179  	if (!iim || iim > HYPERPRIVOP_MAX) {
   9.180 -		printf("bad hyperprivop; ignored\n");
   9.181 -		printf("iim=%lx, iip=0x%lx\n", iim, regs->cr_iip);
   9.182 +		panic_domain(regs, "bad hyperprivop ignored; iim=%lx, "
   9.183 +		             "iip=0x%lx\n", iim, regs->cr_iip);
   9.184  		return 1;
   9.185  	}
   9.186  	slow_hyperpriv_cnt[iim]++;
   9.187 @@ -904,288 +795,3 @@ ia64_hyperprivop(unsigned long iim, REGS
   9.188  }
   9.189  
   9.190  
   9.191 -/**************************************************************************
   9.192 -Privileged operation instrumentation routines
   9.193 -**************************************************************************/
   9.194 -
   9.195 -static const char * const Mpriv_str[64] = {
   9.196 -  "mov_to_rr", "mov_to_dbr", "mov_to_ibr", "mov_to_pkr",
   9.197 -  "mov_to_pmc", "mov_to_pmd", "<0x06>", "<0x07>",
   9.198 -  "<0x08>", "ptc_l", "ptc_g", "ptc_ga",
   9.199 -  "ptr_d", "ptr_i", "itr_d", "itr_i",
   9.200 -  "mov_from_rr", "mov_from_dbr", "mov_from_ibr", "mov_from_pkr",
   9.201 -  "mov_from_pmc", "<0x15>", "<0x16>", "<0x17>",
   9.202 -  "<0x18>", "<0x19>", "privified-thash", "privified-ttag",
   9.203 -  "<0x1c>", "<0x1d>", "tpa", "tak",
   9.204 -  "<0x20>", "<0x21>", "<0x22>", "<0x23>",
   9.205 -  "mov_from_cr", "mov_from_psr", "<0x26>", "<0x27>",
   9.206 -  "<0x28>", "<0x29>", "<0x2a>", "<0x2b>",
   9.207 -  "mov_to_cr", "mov_to_psr", "itc_d", "itc_i",
   9.208 -  "<0x30>", "<0x31>", "<0x32>", "<0x33>",
   9.209 -  "ptc_e", "<0x35>", "<0x36>", "<0x37>",
   9.210 -  "<0x38>", "<0x39>", "<0x3a>", "<0x3b>",
   9.211 -  "<0x3c>", "<0x3d>", "<0x3e>", "<0x3f>"
   9.212 -};
   9.213 -
   9.214 -#define RS "Rsvd"
   9.215 -static const char * const cr_str[128] = {
   9.216 -  "dcr","itm","iva",RS,RS,RS,RS,RS,
   9.217 -  "pta",RS,RS,RS,RS,RS,RS,RS,
   9.218 -  "ipsr","isr",RS,"iip","ifa","itir","iipa","ifs",
   9.219 -  "iim","iha",RS,RS,RS,RS,RS,RS,
   9.220 -  RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
   9.221 -  RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
   9.222 -  "lid","ivr","tpr","eoi","irr0","irr1","irr2","irr3",
   9.223 -  "itv","pmv","cmcv",RS,RS,RS,RS,RS,
   9.224 -  "lrr0","lrr1",RS,RS,RS,RS,RS,RS,
   9.225 -  RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
   9.226 -  RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
   9.227 -  RS,RS,RS,RS,RS,RS,RS,RS
   9.228 -};
   9.229 -
   9.230 -// FIXME: should use snprintf to ensure no buffer overflow
   9.231 -static int dump_privop_counts(char *buf)
   9.232 -{
   9.233 -	int i, j;
   9.234 -	UINT64 sum = 0;
   9.235 -	char *s = buf;
   9.236 -
   9.237 -	// this is ugly and should probably produce sorted output
   9.238 -	// but it will have to do for now
   9.239 -	sum += privcnt.mov_to_ar_imm; sum += privcnt.mov_to_ar_reg;
   9.240 -	sum += privcnt.ssm; sum += privcnt.rsm;
   9.241 -	sum += privcnt.rfi; sum += privcnt.bsw0;
   9.242 -	sum += privcnt.bsw1; sum += privcnt.cover;
   9.243 -	for (i=0; i < 64; i++) sum += privcnt.Mpriv_cnt[i];
   9.244 -	s += sprintf(s,"Privop statistics: (Total privops: %ld)\n",sum);
   9.245 -	if (privcnt.mov_to_ar_imm)
   9.246 -		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.mov_to_ar_imm,
   9.247 -			"mov_to_ar_imm", (privcnt.mov_to_ar_imm*100L)/sum);
   9.248 -	if (privcnt.mov_to_ar_reg)
   9.249 -		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.mov_to_ar_reg,
   9.250 -			"mov_to_ar_reg", (privcnt.mov_to_ar_reg*100L)/sum);
   9.251 -	if (privcnt.mov_from_ar)
   9.252 -		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.mov_from_ar,
   9.253 -			"privified-mov_from_ar", (privcnt.mov_from_ar*100L)/sum);
   9.254 -	if (privcnt.ssm)
   9.255 -		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.ssm,
   9.256 -			"ssm", (privcnt.ssm*100L)/sum);
   9.257 -	if (privcnt.rsm)
   9.258 -		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.rsm,
   9.259 -			"rsm", (privcnt.rsm*100L)/sum);
   9.260 -	if (privcnt.rfi)
   9.261 -		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.rfi,
   9.262 -			"rfi", (privcnt.rfi*100L)/sum);
   9.263 -	if (privcnt.bsw0)
   9.264 -		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.bsw0,
   9.265 -			"bsw0", (privcnt.bsw0*100L)/sum);
   9.266 -	if (privcnt.bsw1)
   9.267 -		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.bsw1,
   9.268 -			"bsw1", (privcnt.bsw1*100L)/sum);
   9.269 -	if (privcnt.cover)
   9.270 -		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.cover,
   9.271 -			"cover", (privcnt.cover*100L)/sum);
   9.272 -	if (privcnt.fc)
   9.273 -		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.fc,
   9.274 -			"privified-fc", (privcnt.fc*100L)/sum);
   9.275 -	if (privcnt.cpuid)
   9.276 -		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.cpuid,
   9.277 -			"privified-getcpuid", (privcnt.cpuid*100L)/sum);
   9.278 -	for (i=0; i < 64; i++) if (privcnt.Mpriv_cnt[i]) {
   9.279 -		if (!Mpriv_str[i]) s += sprintf(s,"PRIVSTRING NULL!!\n");
   9.280 -		else s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.Mpriv_cnt[i],
   9.281 -			Mpriv_str[i], (privcnt.Mpriv_cnt[i]*100L)/sum);
   9.282 -		if (i == 0x24) { // mov from CR
   9.283 -			s += sprintf(s,"            [");
   9.284 -			for (j=0; j < 128; j++) if (from_cr_cnt[j]) {
   9.285 -				if (!cr_str[j])
   9.286 -					s += sprintf(s,"PRIVSTRING NULL!!\n");
   9.287 -				s += sprintf(s,"%s(%ld),",cr_str[j],from_cr_cnt[j]);
   9.288 -			}
   9.289 -			s += sprintf(s,"]\n");
   9.290 -		}
   9.291 -		else if (i == 0x2c) { // mov to CR
   9.292 -			s += sprintf(s,"            [");
   9.293 -			for (j=0; j < 128; j++) if (to_cr_cnt[j]) {
   9.294 -				if (!cr_str[j])
   9.295 -					s += sprintf(s,"PRIVSTRING NULL!!\n");
   9.296 -				s += sprintf(s,"%s(%ld),",cr_str[j],to_cr_cnt[j]);
   9.297 -			}
   9.298 -			s += sprintf(s,"]\n");
   9.299 -		}
   9.300 -	}
   9.301 -	return s - buf;
   9.302 -}
   9.303 -
   9.304 -static int zero_privop_counts(char *buf)
   9.305 -{
   9.306 -	int i, j;
   9.307 -	char *s = buf;
   9.308 -
   9.309 -	// this is ugly and should probably produce sorted output
   9.310 -	// but it will have to do for now
   9.311 -	privcnt.mov_to_ar_imm = 0; privcnt.mov_to_ar_reg = 0;
   9.312 -	privcnt.mov_from_ar = 0;
   9.313 -	privcnt.ssm = 0; privcnt.rsm = 0;
   9.314 -	privcnt.rfi = 0; privcnt.bsw0 = 0;
   9.315 -	privcnt.bsw1 = 0; privcnt.cover = 0;
   9.316 -	privcnt.fc = 0; privcnt.cpuid = 0;
   9.317 -	for (i=0; i < 64; i++) privcnt.Mpriv_cnt[i] = 0;
   9.318 -	for (j=0; j < 128; j++) from_cr_cnt[j] = 0;
   9.319 -	for (j=0; j < 128; j++) to_cr_cnt[j] = 0;
   9.320 -	s += sprintf(s,"All privop statistics zeroed\n");
   9.321 -	return s - buf;
   9.322 -}
   9.323 -
   9.324 -#ifdef PRIVOP_ADDR_COUNT
   9.325 -
   9.326 -extern struct privop_addr_count privop_addr_counter[];
   9.327 -
   9.328 -void privop_count_addr(unsigned long iip, int inst)
   9.329 -{
   9.330 -	struct privop_addr_count *v = &privop_addr_counter[inst];
   9.331 -	int i;
   9.332 -
   9.333 -	for (i = 0; i < PRIVOP_COUNT_NADDRS; i++) {
   9.334 -		if (!v->addr[i]) { v->addr[i] = iip; v->count[i]++; return; }
   9.335 -		else if (v->addr[i] == iip)  { v->count[i]++; return; }
   9.336 -	}
   9.337 -	v->overflow++;;
   9.338 -}
   9.339 -
   9.340 -static int dump_privop_addrs(char *buf)
   9.341 -{
   9.342 -	int i,j;
   9.343 -	char *s = buf;
   9.344 -	s += sprintf(s,"Privop addresses:\n");
   9.345 -	for (i = 0; i < PRIVOP_COUNT_NINSTS; i++) {
   9.346 -		struct privop_addr_count *v = &privop_addr_counter[i];
   9.347 -		s += sprintf(s,"%s:\n",v->instname);
   9.348 -		for (j = 0; j < PRIVOP_COUNT_NADDRS; j++) {
   9.349 -			if (!v->addr[j]) break;
   9.350 -			s += sprintf(s," at 0x%lx #%ld\n",v->addr[j],v->count[j]);
   9.351 -		}
   9.352 -		if (v->overflow) 
   9.353 -			s += sprintf(s," other #%ld\n",v->overflow);
   9.354 -	}
   9.355 -	return s - buf;
   9.356 -}
   9.357 -
   9.358 -static void zero_privop_addrs(void)
   9.359 -{
   9.360 -	int i,j;
   9.361 -	for (i = 0; i < PRIVOP_COUNT_NINSTS; i++) {
   9.362 -		struct privop_addr_count *v = &privop_addr_counter[i];
   9.363 -		for (j = 0; j < PRIVOP_COUNT_NADDRS; j++)
   9.364 -			v->addr[j] = v->count[j] = 0;
   9.365 -		v->overflow = 0;
   9.366 -	}
   9.367 -}
   9.368 -#endif
   9.369 -
   9.370 -extern unsigned long dtlb_translate_count;
   9.371 -extern unsigned long tr_translate_count;
   9.372 -extern unsigned long phys_translate_count;
   9.373 -extern unsigned long vhpt_translate_count;
   9.374 -extern unsigned long fast_vhpt_translate_count;
   9.375 -extern unsigned long recover_to_page_fault_count;
   9.376 -extern unsigned long recover_to_break_fault_count;
   9.377 -extern unsigned long lazy_cover_count;
   9.378 -extern unsigned long idle_when_pending;
   9.379 -extern unsigned long pal_halt_light_count;
   9.380 -extern unsigned long context_switch_count;
   9.381 -
   9.382 -static int dump_misc_stats(char *buf)
   9.383 -{
   9.384 -	char *s = buf;
   9.385 -	s += sprintf(s,"Virtual TR translations: %ld\n",tr_translate_count);
   9.386 -	s += sprintf(s,"Virtual VHPT slow translations: %ld\n",vhpt_translate_count);
   9.387 -	s += sprintf(s,"Virtual VHPT fast translations: %ld\n",fast_vhpt_translate_count);
   9.388 -	s += sprintf(s,"Virtual DTLB translations: %ld\n",dtlb_translate_count);
   9.389 -	s += sprintf(s,"Physical translations: %ld\n",phys_translate_count);
   9.390 -	s += sprintf(s,"Recoveries to page fault: %ld\n",recover_to_page_fault_count);
   9.391 -	s += sprintf(s,"Recoveries to break fault: %ld\n",recover_to_break_fault_count);
   9.392 -	s += sprintf(s,"Idle when pending: %ld\n",idle_when_pending);
   9.393 -	s += sprintf(s,"PAL_HALT_LIGHT (no pending): %ld\n",pal_halt_light_count);
   9.394 -	s += sprintf(s,"context switches: %ld\n",context_switch_count);
   9.395 -	s += sprintf(s,"Lazy covers: %ld\n",lazy_cover_count);
   9.396 -	return s - buf;
   9.397 -}
   9.398 -
   9.399 -static void zero_misc_stats(void)
   9.400 -{
   9.401 -	dtlb_translate_count = 0;
   9.402 -	tr_translate_count = 0;
   9.403 -	phys_translate_count = 0;
   9.404 -	vhpt_translate_count = 0;
   9.405 -	fast_vhpt_translate_count = 0;
   9.406 -	recover_to_page_fault_count = 0;
   9.407 -	recover_to_break_fault_count = 0;
   9.408 -	lazy_cover_count = 0;
   9.409 -	pal_halt_light_count = 0;
   9.410 -	idle_when_pending = 0;
   9.411 -	context_switch_count = 0;
   9.412 -}
   9.413 -
   9.414 -static int dump_hyperprivop_counts(char *buf)
   9.415 -{
   9.416 -	int i;
   9.417 -	char *s = buf;
   9.418 -	unsigned long total = 0;
   9.419 -	for (i = 1; i <= HYPERPRIVOP_MAX; i++) total += slow_hyperpriv_cnt[i];
   9.420 -	s += sprintf(s,"Slow hyperprivops (total %ld):\n",total);
   9.421 -	for (i = 1; i <= HYPERPRIVOP_MAX; i++)
   9.422 -		if (slow_hyperpriv_cnt[i])
   9.423 -			s += sprintf(s,"%10ld %s\n",
   9.424 -				slow_hyperpriv_cnt[i], hyperpriv_str[i]);
   9.425 -	total = 0;
   9.426 -	for (i = 1; i <= HYPERPRIVOP_MAX; i++) total += fast_hyperpriv_cnt[i];
   9.427 -	s += sprintf(s,"Fast hyperprivops (total %ld):\n",total);
   9.428 -	for (i = 1; i <= HYPERPRIVOP_MAX; i++)
   9.429 -		if (fast_hyperpriv_cnt[i])
   9.430 -			s += sprintf(s,"%10ld %s\n",
   9.431 -				fast_hyperpriv_cnt[i], hyperpriv_str[i]);
   9.432 -	return s - buf;
   9.433 -}
   9.434 -
   9.435 -static void zero_hyperprivop_counts(void)
   9.436 -{
   9.437 -	int i;
   9.438 -	for (i = 0; i <= HYPERPRIVOP_MAX; i++) slow_hyperpriv_cnt[i] = 0;
   9.439 -	for (i = 0; i <= HYPERPRIVOP_MAX; i++) fast_hyperpriv_cnt[i] = 0;
   9.440 -}
   9.441 -
   9.442 -#define TMPBUFLEN 8*1024
   9.443 -int dump_privop_counts_to_user(char __user *ubuf, int len)
   9.444 -{
   9.445 -	char buf[TMPBUFLEN];
   9.446 -	int n = dump_privop_counts(buf);
   9.447 -
   9.448 -	n += dump_hyperprivop_counts(buf + n);
   9.449 -	n += dump_reflect_counts(buf + n);
   9.450 -#ifdef PRIVOP_ADDR_COUNT
   9.451 -	n += dump_privop_addrs(buf + n);
   9.452 -#endif
   9.453 -	n += dump_vhpt_stats(buf + n);
   9.454 -	n += dump_misc_stats(buf + n);
   9.455 -	if (len < TMPBUFLEN) return -1;
   9.456 -	if (__copy_to_user(ubuf,buf,n)) return -1;
   9.457 -	return n;
   9.458 -}
   9.459 -
   9.460 -int zero_privop_counts_to_user(char __user *ubuf, int len)
   9.461 -{
   9.462 -	char buf[TMPBUFLEN];
   9.463 -	int n = zero_privop_counts(buf);
   9.464 -
   9.465 -	zero_hyperprivop_counts();
   9.466 -#ifdef PRIVOP_ADDR_COUNT
   9.467 -	zero_privop_addrs();
   9.468 -#endif
   9.469 -	zero_vhpt_stats();
   9.470 -	zero_misc_stats();
   9.471 -	zero_reflect_counts();
   9.472 -	if (len < TMPBUFLEN) return -1;
   9.473 -	if (__copy_to_user(ubuf,buf,n)) return -1;
   9.474 -	return n;
   9.475 -}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/xen/arch/ia64/xen/privop_stat.c	Mon Jul 03 08:12:16 2006 -0600
    10.3 @@ -0,0 +1,389 @@
    10.4 +#include <asm/privop_stat.h>
    10.5 +#include <asm/vhpt.h>
    10.6 +#include <xen/lib.h>
    10.7 +#include <asm/uaccess.h>
    10.8 +
    10.9 +unsigned long dtlb_translate_count = 0;
   10.10 +unsigned long tr_translate_count = 0;
   10.11 +unsigned long phys_translate_count = 0;
   10.12 +unsigned long vhpt_translate_count = 0;
   10.13 +unsigned long fast_vhpt_translate_count = 0;
   10.14 +unsigned long recover_to_page_fault_count = 0;
   10.15 +unsigned long recover_to_break_fault_count = 0;
   10.16 +unsigned long idle_when_pending = 0;
   10.17 +unsigned long pal_halt_light_count = 0;
   10.18 +unsigned long context_switch_count = 0;
   10.19 +unsigned long lazy_cover_count = 0;
   10.20 +
   10.21 +unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
   10.22 +unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
   10.23 +
   10.24 +unsigned long slow_reflect_count[0x80] = { 0 };
   10.25 +unsigned long fast_reflect_count[0x80] = { 0 };
   10.26 +
   10.27 +struct privop_counters privcnt;
   10.28 +
   10.29 +#ifdef PRIVOP_ADDR_COUNT
   10.30 +#define PRIVOP_COUNT_NINSTS 2
   10.31 +#define PRIVOP_COUNT_NADDRS 30
   10.32 +
   10.33 +struct privop_addr_count {
   10.34 +	const char *instname;
   10.35 +	unsigned long addr[PRIVOP_COUNT_NADDRS];
   10.36 +	unsigned long count[PRIVOP_COUNT_NADDRS];
   10.37 +	unsigned long overflow;
   10.38 +};
   10.39 +
   10.40 +
   10.41 +static struct privop_addr_count privop_addr_counter[PRIVOP_COUNT_NINSTS] = {
   10.42 +	[_GET_IFA] = { "=ifa",  { 0 }, { 0 }, 0 },
   10.43 +	[_THASH] = { "thash", { 0 }, { 0 }, 0 }
   10.44 +};
   10.45 +
   10.46 +void privop_count_addr(unsigned long iip, int inst)
   10.47 +{
   10.48 +	struct privop_addr_count *v = &privop_addr_counter[inst];
   10.49 +	int i;
   10.50 +
   10.51 +	if (inst >= PRIVOP_COUNT_NINSTS)
   10.52 +		return;
   10.53 +	for (i = 0; i < PRIVOP_COUNT_NADDRS; i++) {
   10.54 +		if (!v->addr[i]) {
   10.55 +			v->addr[i] = iip;
   10.56 +			v->count[i]++;
   10.57 +			return;
   10.58 +		}
   10.59 +		else if (v->addr[i] == iip) {
   10.60 +			v->count[i]++;
   10.61 +			return;
   10.62 +		}
   10.63 +	}
   10.64 +	v->overflow++;;
   10.65 +}
   10.66 +
   10.67 +static int dump_privop_addrs(char *buf)
   10.68 +{
   10.69 +	int i, j;
   10.70 +	char *s = buf;
   10.71 +	s += sprintf(s, "Privop addresses:\n");
   10.72 +	for (i = 0; i < PRIVOP_COUNT_NINSTS; i++) {
   10.73 +		struct privop_addr_count *v = &privop_addr_counter[i];
   10.74 +		s += sprintf(s, "%s:\n", v->instname);
   10.75 +		for (j = 0; j < PRIVOP_COUNT_NADDRS; j++) {
   10.76 +			if (!v->addr[j])
   10.77 +				break;
   10.78 +			s += sprintf(s, " at 0x%lx #%ld\n",
   10.79 +			             v->addr[j], v->count[j]);
   10.80 +		}
   10.81 +		if (v->overflow) 
   10.82 +			s += sprintf(s, " other #%ld\n", v->overflow);
   10.83 +	}
   10.84 +	return s - buf;
   10.85 +}
   10.86 +
   10.87 +static void zero_privop_addrs(void)
   10.88 +{
   10.89 +	int i,j;
   10.90 +	for (i = 0; i < PRIVOP_COUNT_NINSTS; i++) {
   10.91 +		struct privop_addr_count *v = &privop_addr_counter[i];
   10.92 +		for (j = 0; j < PRIVOP_COUNT_NADDRS; j++)
   10.93 +			v->addr[j] = v->count[j] = 0;
   10.94 +		v->overflow = 0;
   10.95 +	}
   10.96 +}
   10.97 +#endif
   10.98 +
   10.99 +/**************************************************************************
  10.100 +Privileged operation instrumentation routines
  10.101 +**************************************************************************/
  10.102 +
  10.103 +static const char * const Mpriv_str[64] = {
  10.104 +	"mov_to_rr", "mov_to_dbr", "mov_to_ibr", "mov_to_pkr",
  10.105 +	"mov_to_pmc", "mov_to_pmd", "<0x06>", "<0x07>",
  10.106 +	"<0x08>", "ptc_l", "ptc_g", "ptc_ga",
  10.107 +	"ptr_d", "ptr_i", "itr_d", "itr_i",
  10.108 +	"mov_from_rr", "mov_from_dbr", "mov_from_ibr", "mov_from_pkr",
  10.109 +	"mov_from_pmc", "<0x15>", "<0x16>", "<0x17>",
  10.110 +	"<0x18>", "<0x19>", "privified-thash", "privified-ttag",
  10.111 +	"<0x1c>", "<0x1d>", "tpa", "tak",
  10.112 +	"<0x20>", "<0x21>", "<0x22>", "<0x23>",
  10.113 +	"mov_from_cr", "mov_from_psr", "<0x26>", "<0x27>",
  10.114 +	"<0x28>", "<0x29>", "<0x2a>", "<0x2b>",
  10.115 +	"mov_to_cr", "mov_to_psr", "itc_d", "itc_i",
  10.116 +	"<0x30>", "<0x31>", "<0x32>", "<0x33>",
  10.117 +	"ptc_e", "<0x35>", "<0x36>", "<0x37>",
  10.118 +	"<0x38>", "<0x39>", "<0x3a>", "<0x3b>",
  10.119 +	"<0x3c>", "<0x3d>", "<0x3e>", "<0x3f>"
  10.120 +};
  10.121 +
  10.122 +#define RS "Rsvd"
  10.123 +static const char * const cr_str[128] = {
  10.124 +	"dcr","itm","iva",RS,RS,RS,RS,RS,
  10.125 +	"pta",RS,RS,RS,RS,RS,RS,RS,
  10.126 +	"ipsr","isr",RS,"iip","ifa","itir","iipa","ifs",
  10.127 +	"iim","iha",RS,RS,RS,RS,RS,RS,
  10.128 +	RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
  10.129 +	RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
  10.130 +	"lid","ivr","tpr","eoi","irr0","irr1","irr2","irr3",
  10.131 +	"itv","pmv","cmcv",RS,RS,RS,RS,RS,
  10.132 +	"lrr0","lrr1",RS,RS,RS,RS,RS,RS,
  10.133 +	RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
  10.134 +	RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
  10.135 +	RS,RS,RS,RS,RS,RS,RS,RS
  10.136 +};
  10.137 +
  10.138 +// FIXME: should use snprintf to ensure no buffer overflow
  10.139 +static int dump_privop_counts(char *buf)
  10.140 +{
  10.141 +	int i, j;
  10.142 +	unsigned long sum = 0;
  10.143 +	char *s = buf;
  10.144 +
  10.145 +	// this is ugly and should probably produce sorted output
  10.146 +	// but it will have to do for now
  10.147 +	sum += privcnt.mov_to_ar_imm; sum += privcnt.mov_to_ar_reg;
  10.148 +	sum += privcnt.ssm; sum += privcnt.rsm;
  10.149 +	sum += privcnt.rfi; sum += privcnt.bsw0;
  10.150 +	sum += privcnt.bsw1; sum += privcnt.cover;
  10.151 +	for (i=0; i < 64; i++)
  10.152 +		sum += privcnt.Mpriv_cnt[i];
  10.153 +	s += sprintf(s,"Privop statistics: (Total privops: %ld)\n",sum);
  10.154 +	if (privcnt.mov_to_ar_imm)
  10.155 +		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.mov_to_ar_imm,
  10.156 +			"mov_to_ar_imm", (privcnt.mov_to_ar_imm*100L)/sum);
  10.157 +	if (privcnt.mov_to_ar_reg)
  10.158 +		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.mov_to_ar_reg,
  10.159 +			"mov_to_ar_reg", (privcnt.mov_to_ar_reg*100L)/sum);
  10.160 +	if (privcnt.mov_from_ar)
  10.161 +		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.mov_from_ar,
  10.162 +			"privified-mov_from_ar", (privcnt.mov_from_ar*100L)/sum);
  10.163 +	if (privcnt.ssm)
  10.164 +		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.ssm,
  10.165 +			"ssm", (privcnt.ssm*100L)/sum);
  10.166 +	if (privcnt.rsm)
  10.167 +		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.rsm,
  10.168 +			"rsm", (privcnt.rsm*100L)/sum);
  10.169 +	if (privcnt.rfi)
  10.170 +		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.rfi,
  10.171 +			"rfi", (privcnt.rfi*100L)/sum);
  10.172 +	if (privcnt.bsw0)
  10.173 +		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.bsw0,
  10.174 +			"bsw0", (privcnt.bsw0*100L)/sum);
  10.175 +	if (privcnt.bsw1)
  10.176 +		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.bsw1,
  10.177 +			"bsw1", (privcnt.bsw1*100L)/sum);
  10.178 +	if (privcnt.cover)
  10.179 +		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.cover,
  10.180 +			"cover", (privcnt.cover*100L)/sum);
  10.181 +	if (privcnt.fc)
  10.182 +		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.fc,
  10.183 +			"privified-fc", (privcnt.fc*100L)/sum);
  10.184 +	if (privcnt.cpuid)
  10.185 +		s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.cpuid,
  10.186 +			"privified-getcpuid", (privcnt.cpuid*100L)/sum);
  10.187 +	for (i=0; i < 64; i++) if (privcnt.Mpriv_cnt[i]) {
  10.188 +		if (!Mpriv_str[i]) s += sprintf(s,"PRIVSTRING NULL!!\n");
  10.189 +		else s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.Mpriv_cnt[i],
  10.190 +			Mpriv_str[i], (privcnt.Mpriv_cnt[i]*100L)/sum);
  10.191 +		if (i == 0x24) { // mov from CR
  10.192 +			s += sprintf(s,"            [");
  10.193 +			for (j=0; j < 128; j++) if (privcnt.from_cr_cnt[j]) {
  10.194 +				if (!cr_str[j])
  10.195 +					s += sprintf(s,"PRIVSTRING NULL!!\n");
  10.196 +				else
  10.197 +					s += sprintf(s,"%s(%ld),",cr_str[j],
  10.198 +						     privcnt.from_cr_cnt[j]);
  10.199 +			}
  10.200 +			s += sprintf(s,"]\n");
  10.201 +		}
  10.202 +		else if (i == 0x2c) { // mov to CR
  10.203 +			s += sprintf(s,"            [");
  10.204 +			for (j=0; j < 128; j++) if (privcnt.to_cr_cnt[j]) {
  10.205 +				if (!cr_str[j])
  10.206 +					s += sprintf(s,"PRIVSTRING NULL!!\n");
  10.207 +				else
  10.208 +					s += sprintf(s,"%s(%ld),",cr_str[j],
  10.209 +						     privcnt.to_cr_cnt[j]);
  10.210 +			}
  10.211 +			s += sprintf(s,"]\n");
  10.212 +		}
  10.213 +	}
  10.214 +	return s - buf;
  10.215 +}
  10.216 +
  10.217 +static int zero_privop_counts(char *buf)
  10.218 +{
  10.219 +	int i, j;
  10.220 +	char *s = buf;
  10.221 +
  10.222 +	// this is ugly and should probably produce sorted output
  10.223 +	// but it will have to do for now
  10.224 +	privcnt.mov_to_ar_imm = 0;
  10.225 +	privcnt.mov_to_ar_reg = 0;
  10.226 +	privcnt.mov_from_ar = 0;
  10.227 +	privcnt.ssm = 0; privcnt.rsm = 0;
  10.228 +	privcnt.rfi = 0; privcnt.bsw0 = 0;
  10.229 +	privcnt.bsw1 = 0; privcnt.cover = 0;
  10.230 +	privcnt.fc = 0; privcnt.cpuid = 0;
  10.231 +	for (i=0; i < 64; i++)
  10.232 +		privcnt.Mpriv_cnt[i] = 0;
  10.233 +	for (j=0; j < 128; j++)
  10.234 +		privcnt.from_cr_cnt[j] = 0;
  10.235 +	for (j=0; j < 128; j++)
  10.236 +		privcnt.to_cr_cnt[j] = 0;
  10.237 +	s += sprintf(s,"All privop statistics zeroed\n");
  10.238 +	return s - buf;
  10.239 +}
  10.240 +
  10.241 +static int dump_misc_stats(char *buf)
  10.242 +{
  10.243 +	char *s = buf;
  10.244 +	s += sprintf(s,"Virtual TR translations: %ld\n",tr_translate_count);
  10.245 +	s += sprintf(s,"Virtual VHPT slow translations: %ld\n",vhpt_translate_count);
  10.246 +	s += sprintf(s,"Virtual VHPT fast translations: %ld\n",fast_vhpt_translate_count);
  10.247 +	s += sprintf(s,"Virtual DTLB translations: %ld\n",dtlb_translate_count);
  10.248 +	s += sprintf(s,"Physical translations: %ld\n",phys_translate_count);
  10.249 +	s += sprintf(s,"Recoveries to page fault: %ld\n",recover_to_page_fault_count);
  10.250 +	s += sprintf(s,"Recoveries to break fault: %ld\n",recover_to_break_fault_count);
  10.251 +	s += sprintf(s,"Idle when pending: %ld\n",idle_when_pending);
  10.252 +	s += sprintf(s,"PAL_HALT_LIGHT (no pending): %ld\n",pal_halt_light_count);
  10.253 +	s += sprintf(s,"context switches: %ld\n",context_switch_count);
  10.254 +	s += sprintf(s,"Lazy covers: %ld\n",lazy_cover_count);
  10.255 +	return s - buf;
  10.256 +}
  10.257 +
  10.258 +static void zero_misc_stats(void)
  10.259 +{
  10.260 +	dtlb_translate_count = 0;
  10.261 +	tr_translate_count = 0;
  10.262 +	phys_translate_count = 0;
  10.263 +	vhpt_translate_count = 0;
  10.264 +	fast_vhpt_translate_count = 0;
  10.265 +	recover_to_page_fault_count = 0;
  10.266 +	recover_to_break_fault_count = 0;
  10.267 +	lazy_cover_count = 0;
  10.268 +	pal_halt_light_count = 0;
  10.269 +	idle_when_pending = 0;
  10.270 +	context_switch_count = 0;
  10.271 +}
  10.272 +
  10.273 +static const char * const hyperpriv_str[HYPERPRIVOP_MAX+1] = {
  10.274 +	0, "rfi", "rsm.dt", "ssm.dt", "cover", "itc.d", "itc.i", "ssm.i",
  10.275 +	"=ivr", "=tpr", "tpr=", "eoi", "itm=", "thash", "ptc.ga", "itr.d",
  10.276 +	"=rr", "rr=", "kr=", "fc", "=cpuid", "=pmd", "=ar.eflg", "ar.eflg="
  10.277 +};
  10.278 +
  10.279 +
  10.280 +static int dump_hyperprivop_counts(char *buf)
  10.281 +{
  10.282 +	int i;
  10.283 +	char *s = buf;
  10.284 +	unsigned long total = 0;
  10.285 +	for (i = 1; i <= HYPERPRIVOP_MAX; i++)
  10.286 +		total += slow_hyperpriv_cnt[i];
  10.287 +	s += sprintf(s,"Slow hyperprivops (total %ld):\n",total);
  10.288 +	for (i = 1; i <= HYPERPRIVOP_MAX; i++)
  10.289 +		if (slow_hyperpriv_cnt[i])
  10.290 +			s += sprintf(s,"%10ld %s\n",
  10.291 +				slow_hyperpriv_cnt[i], hyperpriv_str[i]);
  10.292 +	total = 0;
  10.293 +	for (i = 1; i <= HYPERPRIVOP_MAX; i++)
  10.294 +		total += fast_hyperpriv_cnt[i];
  10.295 +	s += sprintf(s,"Fast hyperprivops (total %ld):\n",total);
  10.296 +	for (i = 1; i <= HYPERPRIVOP_MAX; i++)
  10.297 +		if (fast_hyperpriv_cnt[i])
  10.298 +			s += sprintf(s,"%10ld %s\n",
  10.299 +				fast_hyperpriv_cnt[i], hyperpriv_str[i]);
  10.300 +	return s - buf;
  10.301 +}
  10.302 +
  10.303 +static void zero_hyperprivop_counts(void)
  10.304 +{
  10.305 +	int i;
  10.306 +	for (i = 0; i <= HYPERPRIVOP_MAX; i++)
  10.307 +		slow_hyperpriv_cnt[i] = 0;
  10.308 +	for (i = 0; i <= HYPERPRIVOP_MAX; i++)
  10.309 +		fast_hyperpriv_cnt[i] = 0;
  10.310 +}
  10.311 +
  10.312 +static void zero_reflect_counts(void)
  10.313 +{
  10.314 +	int i;
  10.315 +	for (i=0; i < 0x80; i++)
  10.316 +		slow_reflect_count[i] = 0;
  10.317 +	for (i=0; i < 0x80; i++)
  10.318 +		fast_reflect_count[i] = 0;
  10.319 +}
  10.320 +
  10.321 +static int dump_reflect_counts(char *buf)
  10.322 +{
  10.323 +	int i,j,cnt;
  10.324 +	char *s = buf;
  10.325 +
  10.326 +	s += sprintf(s,"Slow reflections by vector:\n");
  10.327 +	for (i = 0, j = 0; i < 0x80; i++) {
  10.328 +		if ( (cnt = slow_reflect_count[i]) != 0 ) {
  10.329 +			s += sprintf(s,"0x%02x00:%10d, ",i,cnt);
  10.330 +			if ((j++ & 3) == 3)
  10.331 +				s += sprintf(s,"\n");
  10.332 +		}
  10.333 +	}
  10.334 +	if (j & 3)
  10.335 +		s += sprintf(s,"\n");
  10.336 +	s += sprintf(s,"Fast reflections by vector:\n");
  10.337 +	for (i = 0, j = 0; i < 0x80; i++) {
  10.338 +		if ( (cnt = fast_reflect_count[i]) != 0 ) {
  10.339 +			s += sprintf(s,"0x%02x00:%10d, ",i,cnt);
  10.340 +			if ((j++ & 3) == 3)
  10.341 +				s += sprintf(s,"\n");
  10.342 +		}
  10.343 +	}
  10.344 +	if (j & 3)
  10.345 +		s += sprintf(s,"\n");
  10.346 +	return s - buf;
  10.347 +}
  10.348 +
  10.349 +
  10.350 +#define TMPBUFLEN 8*1024
  10.351 +int dump_privop_counts_to_user(char __user *ubuf, int len)
  10.352 +{
  10.353 +	char buf[TMPBUFLEN];
  10.354 +	int n;
  10.355 +
  10.356 +	if (len < TMPBUFLEN)
  10.357 +		return -1;
  10.358 +
  10.359 +	n = dump_privop_counts(buf);
  10.360 +	n += dump_hyperprivop_counts(buf + n);
  10.361 +	n += dump_reflect_counts(buf + n);
  10.362 +#ifdef PRIVOP_ADDR_COUNT
  10.363 +	n += dump_privop_addrs(buf + n);
  10.364 +#endif
  10.365 +	n += dump_vhpt_stats(buf + n);
  10.366 +	n += dump_misc_stats(buf + n);
  10.367 +	if (__copy_to_user(ubuf,buf,n))
  10.368 +		return -1;
  10.369 +	return n;
  10.370 +}
  10.371 +
  10.372 +int zero_privop_counts_to_user(char __user *ubuf, int len)
  10.373 +{
  10.374 +	char buf[TMPBUFLEN];
  10.375 +	int n;
  10.376 +
  10.377 +	if (len < TMPBUFLEN)
  10.378 +		return -1;
  10.379 +
  10.380 +	n = zero_privop_counts(buf);
  10.381 +
  10.382 +	zero_hyperprivop_counts();
  10.383 +#ifdef PRIVOP_ADDR_COUNT
  10.384 +	zero_privop_addrs();
  10.385 +#endif
  10.386 +	zero_vhpt_stats();
  10.387 +	zero_misc_stats();
  10.388 +	zero_reflect_counts();
  10.389 +	if (__copy_to_user(ubuf,buf,n))
  10.390 +		return -1;
  10.391 +	return n;
  10.392 +}
    11.1 --- a/xen/arch/ia64/xen/vcpu.c	Mon Jul 03 07:42:17 2006 -0600
    11.2 +++ b/xen/arch/ia64/xen/vcpu.c	Mon Jul 03 08:12:16 2006 -0600
    11.3 @@ -20,6 +20,8 @@
    11.4  #include <asm/privop.h>
    11.5  #include <xen/event.h>
    11.6  #include <asm/vmx_phy_mode.h>
    11.7 +#include <asm/bundle.h>
    11.8 +#include <asm/privop_stat.h>
    11.9  
   11.10  /* FIXME: where these declarations should be there ? */
   11.11  extern void getreg(unsigned long regnum, unsigned long *val, int *nat, struct pt_regs *regs);
   11.12 @@ -47,24 +49,6 @@ typedef	union {
   11.13  #define	IA64_PTA_LFMT		(1UL << IA64_PTA_VF_BIT)
   11.14  #define	IA64_PTA_SZ(x)	(x##UL << IA64_PTA_SZ_BIT)
   11.15  
   11.16 -#define STATIC
   11.17 -
   11.18 -#ifdef PRIVOP_ADDR_COUNT
   11.19 -struct privop_addr_count privop_addr_counter[PRIVOP_COUNT_NINSTS+1] = {
   11.20 -	{ "=ifa",  { 0 }, { 0 }, 0 },
   11.21 -	{ "thash", { 0 }, { 0 }, 0 },
   11.22 -	{ 0,       { 0 }, { 0 }, 0 }
   11.23 -};
   11.24 -extern void privop_count_addr(unsigned long addr, int inst);
   11.25 -#define	PRIVOP_COUNT_ADDR(regs,inst) privop_count_addr(regs->cr_iip,inst)
   11.26 -#else
   11.27 -#define	PRIVOP_COUNT_ADDR(x,y) do {} while (0)
   11.28 -#endif
   11.29 -
   11.30 -unsigned long dtlb_translate_count = 0;
   11.31 -unsigned long tr_translate_count = 0;
   11.32 -unsigned long phys_translate_count = 0;
   11.33 -
   11.34  unsigned long vcpu_verbose = 0;
   11.35  
   11.36  /**************************************************************************
   11.37 @@ -446,8 +430,6 @@ UINT64 vcpu_get_ipsr_int_state(VCPU *vcp
   11.38  
   11.39  IA64FAULT vcpu_get_dcr(VCPU *vcpu, UINT64 *pval)
   11.40  {
   11.41 -//extern unsigned long privop_trace;
   11.42 -//privop_trace=0;
   11.43  //verbose("vcpu_get_dcr: called @%p\n",PSCB(vcpu,iip));
   11.44  	// Reads of cr.dcr on Xen always have the sign bit set, so
   11.45  	// a domain can differentiate whether it is running on SP or not
   11.46 @@ -495,10 +477,8 @@ IA64FAULT vcpu_get_iip(VCPU *vcpu, UINT6
   11.47  
   11.48  IA64FAULT vcpu_get_ifa(VCPU *vcpu, UINT64 *pval)
   11.49  {
   11.50 -	UINT64 val = PSCB(vcpu,ifa);
   11.51 -	REGS *regs = vcpu_regs(vcpu);
   11.52 -	PRIVOP_COUNT_ADDR(regs,_GET_IFA);
   11.53 -	*pval = val;
   11.54 +	PRIVOP_COUNT_ADDR(vcpu_regs(vcpu),_GET_IFA);
   11.55 +	*pval = PSCB(vcpu,ifa);
   11.56  	return (IA64_NO_FAULT);
   11.57  }
   11.58  
   11.59 @@ -564,18 +544,13 @@ IA64FAULT vcpu_get_iim(VCPU *vcpu, UINT6
   11.60  
   11.61  IA64FAULT vcpu_get_iha(VCPU *vcpu, UINT64 *pval)
   11.62  {
   11.63 -	//return vcpu_thash(vcpu,PSCB(vcpu,ifa),pval);
   11.64 -	UINT64 val = PSCB(vcpu,iha);
   11.65 -	REGS *regs = vcpu_regs(vcpu);
   11.66 -	PRIVOP_COUNT_ADDR(regs,_THASH);
   11.67 -	*pval = val;
   11.68 +	PRIVOP_COUNT_ADDR(vcpu_regs(vcpu),_THASH);
   11.69 +	*pval = PSCB(vcpu,iha);
   11.70  	return (IA64_NO_FAULT);
   11.71  }
   11.72  
   11.73  IA64FAULT vcpu_set_dcr(VCPU *vcpu, UINT64 val)
   11.74  {
   11.75 -//extern unsigned long privop_trace;
   11.76 -//privop_trace=1;
   11.77  	// Reads of cr.dcr on SP always have the sign bit set, so
   11.78  	// a domain can differentiate whether it is running on SP or not
   11.79  	// Thus, writes of DCR should ignore the sign bit
   11.80 @@ -1332,11 +1307,6 @@ IA64FAULT vcpu_ttag(VCPU *vcpu, UINT64 v
   11.81  	return (IA64_ILLOP_FAULT);
   11.82  }
   11.83  
   11.84 -unsigned long vhpt_translate_count = 0;
   11.85 -unsigned long fast_vhpt_translate_count = 0;
   11.86 -unsigned long recover_to_page_fault_count = 0;
   11.87 -unsigned long recover_to_break_fault_count = 0;
   11.88 -
   11.89  int warn_region0_address = 0; // FIXME later: tie to a boot parameter?
   11.90  
   11.91  /* Return TRUE iff [b1,e1] and [b2,e2] partially or fully overlaps.  */
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/xen/include/asm-ia64/bundle.h	Mon Jul 03 08:12:16 2006 -0600
    12.3 @@ -0,0 +1,228 @@
    12.4 +#ifndef _XEN_IA64_BUNDLE_H
    12.5 +#define _XEN_IA64_BUNDLE_H
    12.6 +
    12.7 +typedef unsigned long IA64_INST;
    12.8 +
    12.9 +typedef union U_IA64_BUNDLE {
   12.10 +    unsigned long i64[2];
   12.11 +    struct { unsigned long template:5,slot0:41,slot1a:18,slot1b:23,slot2:41; };
   12.12 +    // NOTE: following doesn't work because bitfields can't cross natural
   12.13 +    // size boundaries
   12.14 +    //struct { unsigned long template:5, slot0:41, slot1:41, slot2:41; };
   12.15 +} IA64_BUNDLE;
   12.16 +
   12.17 +typedef enum E_IA64_SLOT_TYPE { I, M, F, B, L, ILLEGAL } IA64_SLOT_TYPE;
   12.18 +
   12.19 +typedef union U_INST64_A5 {
   12.20 +    IA64_INST inst;
   12.21 +    struct { unsigned long qp:6, r1:7, imm7b:7, r3:2, imm5c:5, imm9d:9, s:1, major:4; };
   12.22 +} INST64_A5;
   12.23 +
   12.24 +typedef union U_INST64_B4 {
   12.25 +    IA64_INST inst;
   12.26 +    struct { unsigned long qp:6, btype:3, un3:3, p:1, b2:3, un11:11, x6:6, wh:2, d:1, un1:1, major:4; };
   12.27 +} INST64_B4;
   12.28 +
   12.29 +typedef union U_INST64_B8 {
   12.30 +    IA64_INST inst;
   12.31 +    struct { unsigned long qp:6, un21:21, x6:6, un4:4, major:4; };
   12.32 +} INST64_B8;
   12.33 +
   12.34 +typedef union U_INST64_B9 {
   12.35 +    IA64_INST inst;
   12.36 +    struct { unsigned long qp:6, imm20:20, :1, x6:6, :3, i:1, major:4; };
   12.37 +} INST64_B9;
   12.38 +
   12.39 +typedef union U_INST64_I19 {
   12.40 +    IA64_INST inst;
   12.41 +    struct { unsigned long qp:6, imm20:20, :1, x6:6, x3:3, i:1, major:4; };
   12.42 +} INST64_I19;
   12.43 +
   12.44 +typedef union U_INST64_I26 {
   12.45 +    IA64_INST inst;
   12.46 +    struct { unsigned long qp:6, :7, r2:7, ar3:7, x6:6, x3:3, :1, major:4;};
   12.47 +} INST64_I26;
   12.48 +
   12.49 +typedef union U_INST64_I27 {
   12.50 +    IA64_INST inst;
   12.51 +    struct { unsigned long qp:6, :7, imm:7, ar3:7, x6:6, x3:3, s:1, major:4;};
   12.52 +} INST64_I27;
   12.53 +
   12.54 +typedef union U_INST64_I28 { // not privileged (mov from AR)
   12.55 +    IA64_INST inst;
   12.56 +    struct { unsigned long qp:6, r1:7, :7, ar3:7, x6:6, x3:3, :1, major:4;};
   12.57 +} INST64_I28;
   12.58 +
   12.59 +typedef union U_INST64_M28 {
   12.60 +    IA64_INST inst;
   12.61 +    struct { unsigned long qp:6, :14, r3:7, x6:6, x3:3, :1, major:4;};
   12.62 +} INST64_M28;
   12.63 +
   12.64 +typedef union U_INST64_M29 {
   12.65 +    IA64_INST inst;
   12.66 +    struct { unsigned long qp:6, :7, r2:7, ar3:7, x6:6, x3:3, :1, major:4;};
   12.67 +} INST64_M29;
   12.68 +
   12.69 +typedef union U_INST64_M30 {
   12.70 +    IA64_INST inst;
   12.71 +    struct { unsigned long qp:6, :7, imm:7, ar3:7,x4:4,x2:2,x3:3,s:1,major:4;};
   12.72 +} INST64_M30;
   12.73 +
   12.74 +typedef union U_INST64_M31 {
   12.75 +    IA64_INST inst;
   12.76 +    struct { unsigned long qp:6, r1:7, :7, ar3:7, x6:6, x3:3, :1, major:4;};
   12.77 +} INST64_M31;
   12.78 +
   12.79 +typedef union U_INST64_M32 {
   12.80 +    IA64_INST inst;
   12.81 +    struct { unsigned long qp:6, :7, r2:7, cr3:7, x6:6, x3:3, :1, major:4;};
   12.82 +} INST64_M32;
   12.83 +
   12.84 +typedef union U_INST64_M33 {
   12.85 +    IA64_INST inst;
   12.86 +    struct { unsigned long qp:6, r1:7, :7, cr3:7, x6:6, x3:3, :1, major:4; };
   12.87 +} INST64_M33;
   12.88 +
   12.89 +typedef union U_INST64_M35 {
   12.90 +    IA64_INST inst;
   12.91 +    struct { unsigned long qp:6, :7, r2:7, :7, x6:6, x3:3, :1, major:4; };
   12.92 +   
   12.93 +} INST64_M35;
   12.94 +
   12.95 +typedef union U_INST64_M36 {
   12.96 +    IA64_INST inst;
   12.97 +    struct { unsigned long qp:6, r1:7, :14, x6:6, x3:3, :1, major:4; }; 
   12.98 +} INST64_M36;
   12.99 +
  12.100 +typedef union U_INST64_M37 {
  12.101 +    IA64_INST inst;
  12.102 +    struct { unsigned long qp:6, imm20a:20,:1, x4:4,x2:2,x3:3, i:1, major:4; };
  12.103 +} INST64_M37;
  12.104 +
  12.105 +typedef union U_INST64_M41 {
  12.106 +    IA64_INST inst;
  12.107 +    struct { unsigned long qp:6, :7, r2:7, :7, x6:6, x3:3, :1, major:4; }; 
  12.108 +} INST64_M41;
  12.109 +
  12.110 +typedef union U_INST64_M42 {
  12.111 +    IA64_INST inst;
  12.112 +    struct { unsigned long qp:6, :7, r2:7, r3:7, x6:6, x3:3, :1, major:4; };
  12.113 +} INST64_M42;
  12.114 +
  12.115 +typedef union U_INST64_M43 {
  12.116 +    IA64_INST inst;
  12.117 +    struct { unsigned long qp:6, r1:7, :7, r3:7, x6:6, x3:3, :1, major:4; };
  12.118 +} INST64_M43;
  12.119 +
  12.120 +typedef union U_INST64_M44 {
  12.121 +    IA64_INST inst;
  12.122 +    struct { unsigned long qp:6, imm:21, x4:4, i2:2, x3:3, i:1, major:4; };
  12.123 +} INST64_M44;
  12.124 +
  12.125 +typedef union U_INST64_M45 {
  12.126 +    IA64_INST inst;
  12.127 +    struct { unsigned long qp:6, :7, r2:7, r3:7, x6:6, x3:3, :1, major:4; };
  12.128 +} INST64_M45;
  12.129 +
  12.130 +typedef union U_INST64_M46 {
  12.131 +    IA64_INST inst;
  12.132 +    struct { unsigned long qp:6, r1:7, un7:7, r3:7, x6:6, x3:3, un1:1, major:4; };
  12.133 +} INST64_M46;
  12.134 +
  12.135 +typedef union U_INST64_M47 {
  12.136 +    IA64_INST inst;
  12.137 +    struct { unsigned long qp:6, un14:14, r3:7, x6:6, x3:3, un1:1, major:4; };
  12.138 +} INST64_M47;
  12.139 +
  12.140 +typedef union U_INST64_M1{
  12.141 +    IA64_INST inst;
  12.142 +    struct { unsigned long qp:6, r1:7, un7:7, r3:7, x:1, hint:2, x6:6, m:1, major:4; };
  12.143 +} INST64_M1;
  12.144 +
  12.145 +typedef union U_INST64_M2{
  12.146 +    IA64_INST inst;
  12.147 +    struct { unsigned long qp:6, r1:7, r2:7, r3:7, x:1, hint:2, x6:6, m:1, major:4; };
  12.148 +} INST64_M2;
  12.149 +
  12.150 +typedef union U_INST64_M3{
  12.151 +    IA64_INST inst;
  12.152 +    struct { unsigned long qp:6, r1:7, imm7:7, r3:7, i:1, hint:2, x6:6, s:1, major:4; };
  12.153 +} INST64_M3;
  12.154 +
  12.155 +typedef union U_INST64_M4 {
  12.156 +    IA64_INST inst;
  12.157 +    struct { unsigned long qp:6, un7:7, r2:7, r3:7, x:1, hint:2, x6:6, m:1, major:4; };
  12.158 +} INST64_M4;
  12.159 +
  12.160 +typedef union U_INST64_M5 {
  12.161 +    IA64_INST inst;
  12.162 +    struct { unsigned long qp:6, imm7:7, r2:7, r3:7, i:1, hint:2, x6:6, s:1, major:4; };
  12.163 +} INST64_M5;
  12.164 +
  12.165 +typedef union U_INST64_M6 {
  12.166 +    IA64_INST inst;
  12.167 +    struct { unsigned long qp:6, f1:7, un7:7, r3:7, x:1, hint:2, x6:6, m:1, major:4; };
  12.168 +} INST64_M6;
  12.169 +
  12.170 +typedef union U_INST64_M9 {
  12.171 +    IA64_INST inst;
  12.172 +    struct { unsigned long qp:6, :7, f2:7, r3:7, x:1, hint:2, x6:6, m:1, major:4; };
  12.173 +} INST64_M9;
  12.174 +
  12.175 +typedef union U_INST64_M10 {
  12.176 +    IA64_INST inst;
  12.177 +    struct { unsigned long qp:6, imm7:7, f2:7, r3:7, i:1, hint:2, x6:6, s:1, major:4; };
  12.178 +} INST64_M10;
  12.179 +
  12.180 +typedef union U_INST64_M12 {
  12.181 +    IA64_INST inst;
  12.182 +    struct { unsigned long qp:6, f1:7, f2:7, r3:7, x:1, hint:2, x6:6, m:1, major:4; };
  12.183 +} INST64_M12;
  12.184 +			 
  12.185 +typedef union U_INST64_M15 {
  12.186 +    IA64_INST inst;
  12.187 +    struct { unsigned long qp:6, :7, imm7:7, r3:7, i:1, hint:2, x6:6, s:1, major:4; };
  12.188 +} INST64_M15;
  12.189 +
  12.190 +typedef union U_INST64 {
  12.191 +    IA64_INST inst;
  12.192 +    struct { unsigned long :37, major:4; } generic;
  12.193 +    INST64_A5 A5;	// used in build_hypercall_bundle only
  12.194 +    INST64_B4 B4;	// used in build_hypercall_bundle only
  12.195 +    INST64_B8 B8;	// rfi, bsw.[01]
  12.196 +    INST64_B9 B9;	// break.b
  12.197 +    INST64_I19 I19;	// used in build_hypercall_bundle only
  12.198 +    INST64_I26 I26;	// mov register to ar (I unit)
  12.199 +    INST64_I27 I27;	// mov immediate to ar (I unit)
  12.200 +    INST64_I28 I28;	// mov from ar (I unit)
  12.201 +    INST64_M1  M1;	// ld integer
  12.202 +    INST64_M2  M2;
  12.203 +    INST64_M3  M3;
  12.204 +    INST64_M4  M4;	// st integer
  12.205 +    INST64_M5  M5;
  12.206 +    INST64_M6  M6;	// ldfd floating pointer
  12.207 +    INST64_M9  M9;	// stfd floating pointer
  12.208 +    INST64_M10 M10;	// stfd floating pointer
  12.209 +    INST64_M12 M12;    // ldfd pair floating pointer
  12.210 +    INST64_M15 M15;	// lfetch + imm update
  12.211 +    INST64_M28 M28;	// purge translation cache entry
  12.212 +    INST64_M29 M29;	// mov register to ar (M unit)
  12.213 +    INST64_M30 M30;	// mov immediate to ar (M unit)
  12.214 +    INST64_M31 M31;	// mov from ar (M unit)
  12.215 +    INST64_M32 M32;	// mov reg to cr
  12.216 +    INST64_M33 M33;	// mov from cr
  12.217 +    INST64_M35 M35;	// mov to psr
  12.218 +    INST64_M36 M36;	// mov from psr
  12.219 +    INST64_M37 M37;	// break.m
  12.220 +    INST64_M41 M41;	// translation cache insert
  12.221 +    INST64_M42 M42;	// mov to indirect reg/translation reg insert
  12.222 +    INST64_M43 M43;	// mov from indirect reg
  12.223 +    INST64_M44 M44;	// set/reset system mask
  12.224 +    INST64_M45 M45;	// translation purge
  12.225 +    INST64_M46 M46;	// translation access (tpa,tak)
  12.226 +    INST64_M47 M47;	// purge translation entry
  12.227 +} INST64;
  12.228 +
  12.229 +#define MASK_41 ((unsigned long)0x1ffffffffff)
  12.230 +
  12.231 +#endif /* _XEN_IA64_BUNDLE_H */
    13.1 --- a/xen/include/asm-ia64/dom_fw.h	Mon Jul 03 07:42:17 2006 -0600
    13.2 +++ b/xen/include/asm-ia64/dom_fw.h	Mon Jul 03 08:12:16 2006 -0600
    13.3 @@ -166,8 +166,6 @@
    13.4  extern struct ia64_pal_retval xen_pal_emulator(UINT64, u64, u64, u64);
    13.5  extern struct sal_ret_values sal_emulator (long index, unsigned long in1, unsigned long in2, unsigned long in3, unsigned long in4, unsigned long in5, unsigned long in6, unsigned long in7);
    13.6  extern struct ia64_pal_retval pal_emulator_static (unsigned long);
    13.7 -extern unsigned long dom_fw_setup (struct domain *, const char *, int);
    13.8  extern efi_status_t efi_emulator (struct pt_regs *regs, unsigned long *fault);
    13.9  
   13.10 -extern void build_pal_hypercall_bundles(unsigned long *imva, unsigned long brkimm, unsigned long hypnum);
   13.11 -extern void build_hypercall_bundle(UINT64 *imva, UINT64 brkimm, UINT64 hypnum, UINT64 ret);
   13.12 +extern unsigned long dom_fw_setup (struct domain *, const char *, int);
    14.1 --- a/xen/include/asm-ia64/privop.h	Mon Jul 03 07:42:17 2006 -0600
    14.2 +++ b/xen/include/asm-ia64/privop.h	Mon Jul 03 08:12:16 2006 -0600
    14.3 @@ -2,235 +2,10 @@
    14.4  #define _XEN_IA64_PRIVOP_H
    14.5  
    14.6  #include <asm/ia64_int.h>
    14.7 -#include <asm/vmx_vcpu.h>
    14.8  #include <asm/vcpu.h>
    14.9  
   14.10 -typedef unsigned long IA64_INST;
   14.11 -
   14.12  extern IA64FAULT priv_emulate(VCPU *vcpu, REGS *regs, UINT64 isr);
   14.13  
   14.14 -typedef union U_IA64_BUNDLE {
   14.15 -    unsigned long i64[2];
   14.16 -    struct { unsigned long template:5,slot0:41,slot1a:18,slot1b:23,slot2:41; };
   14.17 -    // NOTE: following doesn't work because bitfields can't cross natural
   14.18 -    // size boundaries
   14.19 -    //struct { unsigned long template:5, slot0:41, slot1:41, slot2:41; };
   14.20 -} IA64_BUNDLE;
   14.21 -
   14.22 -typedef enum E_IA64_SLOT_TYPE { I, M, F, B, L, ILLEGAL } IA64_SLOT_TYPE;
   14.23 -
   14.24 -typedef union U_INST64_A5 {
   14.25 -    IA64_INST inst;
   14.26 -    struct { unsigned long qp:6, r1:7, imm7b:7, r3:2, imm5c:5, imm9d:9, s:1, major:4; };
   14.27 -} INST64_A5;
   14.28 -
   14.29 -typedef union U_INST64_B4 {
   14.30 -    IA64_INST inst;
   14.31 -    struct { unsigned long qp:6, btype:3, un3:3, p:1, b2:3, un11:11, x6:6, wh:2, d:1, un1:1, major:4; };
   14.32 -} INST64_B4;
   14.33 -
   14.34 -typedef union U_INST64_B8 {
   14.35 -    IA64_INST inst;
   14.36 -    struct { unsigned long qp:6, un21:21, x6:6, un4:4, major:4; };
   14.37 -} INST64_B8;
   14.38 -
   14.39 -typedef union U_INST64_B9 {
   14.40 -    IA64_INST inst;
   14.41 -    struct { unsigned long qp:6, imm20:20, :1, x6:6, :3, i:1, major:4; };
   14.42 -} INST64_B9;
   14.43 -
   14.44 -typedef union U_INST64_I19 {
   14.45 -    IA64_INST inst;
   14.46 -    struct { unsigned long qp:6, imm20:20, :1, x6:6, x3:3, i:1, major:4; };
   14.47 -} INST64_I19;
   14.48 -
   14.49 -typedef union U_INST64_I26 {
   14.50 -    IA64_INST inst;
   14.51 -    struct { unsigned long qp:6, :7, r2:7, ar3:7, x6:6, x3:3, :1, major:4;};
   14.52 -} INST64_I26;
   14.53 -
   14.54 -typedef union U_INST64_I27 {
   14.55 -    IA64_INST inst;
   14.56 -    struct { unsigned long qp:6, :7, imm:7, ar3:7, x6:6, x3:3, s:1, major:4;};
   14.57 -} INST64_I27;
   14.58 -
   14.59 -typedef union U_INST64_I28 { // not privileged (mov from AR)
   14.60 -    IA64_INST inst;
   14.61 -    struct { unsigned long qp:6, r1:7, :7, ar3:7, x6:6, x3:3, :1, major:4;};
   14.62 -} INST64_I28;
   14.63 -
   14.64 -typedef union U_INST64_M28 {
   14.65 -    IA64_INST inst;
   14.66 -    struct { unsigned long qp:6, :14, r3:7, x6:6, x3:3, :1, major:4;};
   14.67 -} INST64_M28;
   14.68 -
   14.69 -typedef union U_INST64_M29 {
   14.70 -    IA64_INST inst;
   14.71 -    struct { unsigned long qp:6, :7, r2:7, ar3:7, x6:6, x3:3, :1, major:4;};
   14.72 -} INST64_M29;
   14.73 -
   14.74 -typedef union U_INST64_M30 {
   14.75 -    IA64_INST inst;
   14.76 -    struct { unsigned long qp:6, :7, imm:7, ar3:7,x4:4,x2:2,x3:3,s:1,major:4;};
   14.77 -} INST64_M30;
   14.78 -
   14.79 -typedef union U_INST64_M31 {
   14.80 -    IA64_INST inst;
   14.81 -    struct { unsigned long qp:6, r1:7, :7, ar3:7, x6:6, x3:3, :1, major:4;};
   14.82 -} INST64_M31;
   14.83 -
   14.84 -typedef union U_INST64_M32 {
   14.85 -    IA64_INST inst;
   14.86 -    struct { unsigned long qp:6, :7, r2:7, cr3:7, x6:6, x3:3, :1, major:4;};
   14.87 -} INST64_M32;
   14.88 -
   14.89 -typedef union U_INST64_M33 {
   14.90 -    IA64_INST inst;
   14.91 -    struct { unsigned long qp:6, r1:7, :7, cr3:7, x6:6, x3:3, :1, major:4; };
   14.92 -} INST64_M33;
   14.93 -
   14.94 -typedef union U_INST64_M35 {
   14.95 -    IA64_INST inst;
   14.96 -    struct { unsigned long qp:6, :7, r2:7, :7, x6:6, x3:3, :1, major:4; };
   14.97 -   
   14.98 -} INST64_M35;
   14.99 -
  14.100 -typedef union U_INST64_M36 {
  14.101 -    IA64_INST inst;
  14.102 -    struct { unsigned long qp:6, r1:7, :14, x6:6, x3:3, :1, major:4; }; 
  14.103 -} INST64_M36;
  14.104 -
  14.105 -typedef union U_INST64_M37 {
  14.106 -    IA64_INST inst;
  14.107 -    struct { unsigned long qp:6, imm20a:20,:1, x4:4,x2:2,x3:3, i:1, major:4; };
  14.108 -} INST64_M37;
  14.109 -
  14.110 -typedef union U_INST64_M41 {
  14.111 -    IA64_INST inst;
  14.112 -    struct { unsigned long qp:6, :7, r2:7, :7, x6:6, x3:3, :1, major:4; }; 
  14.113 -} INST64_M41;
  14.114 -
  14.115 -typedef union U_INST64_M42 {
  14.116 -    IA64_INST inst;
  14.117 -    struct { unsigned long qp:6, :7, r2:7, r3:7, x6:6, x3:3, :1, major:4; };
  14.118 -} INST64_M42;
  14.119 -
  14.120 -typedef union U_INST64_M43 {
  14.121 -    IA64_INST inst;
  14.122 -    struct { unsigned long qp:6, r1:7, :7, r3:7, x6:6, x3:3, :1, major:4; };
  14.123 -} INST64_M43;
  14.124 -
  14.125 -typedef union U_INST64_M44 {
  14.126 -    IA64_INST inst;
  14.127 -    struct { unsigned long qp:6, imm:21, x4:4, i2:2, x3:3, i:1, major:4; };
  14.128 -} INST64_M44;
  14.129 -
  14.130 -typedef union U_INST64_M45 {
  14.131 -    IA64_INST inst;
  14.132 -    struct { unsigned long qp:6, :7, r2:7, r3:7, x6:6, x3:3, :1, major:4; };
  14.133 -} INST64_M45;
  14.134 -
  14.135 -typedef union U_INST64_M46 {
  14.136 -    IA64_INST inst;
  14.137 -    struct { unsigned long qp:6, r1:7, un7:7, r3:7, x6:6, x3:3, un1:1, major:4; };
  14.138 -} INST64_M46;
  14.139 -
  14.140 -typedef union U_INST64_M47 {
  14.141 -    IA64_INST inst;
  14.142 -    struct { unsigned long qp:6, un14:14, r3:7, x6:6, x3:3, un1:1, major:4; };
  14.143 -} INST64_M47;
  14.144 -
  14.145 -typedef union U_INST64_M1{
  14.146 -    IA64_INST inst;
  14.147 -    struct { unsigned long qp:6, r1:7, un7:7, r3:7, x:1, hint:2, x6:6, m:1, major:4; };
  14.148 -} INST64_M1;
  14.149 -
  14.150 -typedef union U_INST64_M2{
  14.151 -    IA64_INST inst;
  14.152 -    struct { unsigned long qp:6, r1:7, r2:7, r3:7, x:1, hint:2, x6:6, m:1, major:4; };
  14.153 -} INST64_M2;
  14.154 -
  14.155 -typedef union U_INST64_M3{
  14.156 -    IA64_INST inst;
  14.157 -    struct { unsigned long qp:6, r1:7, imm7:7, r3:7, i:1, hint:2, x6:6, s:1, major:4; };
  14.158 -} INST64_M3;
  14.159 -
  14.160 -typedef union U_INST64_M4 {
  14.161 -    IA64_INST inst;
  14.162 -    struct { unsigned long qp:6, un7:7, r2:7, r3:7, x:1, hint:2, x6:6, m:1, major:4; };
  14.163 -} INST64_M4;
  14.164 -
  14.165 -typedef union U_INST64_M5 {
  14.166 -    IA64_INST inst;
  14.167 -    struct { unsigned long qp:6, imm7:7, r2:7, r3:7, i:1, hint:2, x6:6, s:1, major:4; };
  14.168 -} INST64_M5;
  14.169 -
  14.170 -typedef union U_INST64_M6 {
  14.171 -    IA64_INST inst;
  14.172 -    struct { unsigned long qp:6, f1:7, un7:7, r3:7, x:1, hint:2, x6:6, m:1, major:4; };
  14.173 -} INST64_M6;
  14.174 -
  14.175 -typedef union U_INST64_M9 {
  14.176 -    IA64_INST inst;
  14.177 -    struct { unsigned long qp:6, :7, f2:7, r3:7, x:1, hint:2, x6:6, m:1, major:4; };
  14.178 -} INST64_M9;
  14.179 -
  14.180 -typedef union U_INST64_M10 {
  14.181 -    IA64_INST inst;
  14.182 -    struct { unsigned long qp:6, imm7:7, f2:7, r3:7, i:1, hint:2, x6:6, s:1, major:4; };
  14.183 -} INST64_M10;
  14.184 -
  14.185 -typedef union U_INST64_M12 {
  14.186 -    IA64_INST inst;
  14.187 -    struct { unsigned long qp:6, f1:7, f2:7, r3:7, x:1, hint:2, x6:6, m:1, major:4; };
  14.188 -} INST64_M12;
  14.189 -			 
  14.190 -typedef union U_INST64_M15 {
  14.191 -    IA64_INST inst;
  14.192 -    struct { unsigned long qp:6, :7, imm7:7, r3:7, i:1, hint:2, x6:6, s:1, major:4; };
  14.193 -} INST64_M15;
  14.194 -
  14.195 -typedef union U_INST64 {
  14.196 -    IA64_INST inst;
  14.197 -    struct { unsigned long :37, major:4; } generic;
  14.198 -    INST64_A5 A5;	// used in build_hypercall_bundle only
  14.199 -    INST64_B4 B4;	// used in build_hypercall_bundle only
  14.200 -    INST64_B8 B8;	// rfi, bsw.[01]
  14.201 -    INST64_B9 B9;	// break.b
  14.202 -    INST64_I19 I19;	// used in build_hypercall_bundle only
  14.203 -    INST64_I26 I26;	// mov register to ar (I unit)
  14.204 -    INST64_I27 I27;	// mov immediate to ar (I unit)
  14.205 -    INST64_I28 I28;	// mov from ar (I unit)
  14.206 -    INST64_M1  M1;	// ld integer
  14.207 -    INST64_M2  M2;
  14.208 -    INST64_M3  M3;
  14.209 -    INST64_M4  M4;	// st integer
  14.210 -    INST64_M5  M5;
  14.211 -    INST64_M6  M6;	// ldfd floating pointer
  14.212 -    INST64_M9  M9;	// stfd floating pointer
  14.213 -    INST64_M10 M10;	// stfd floating pointer
  14.214 -    INST64_M12 M12;    // ldfd pair floating pointer
  14.215 -    INST64_M15 M15;	// lfetch + imm update
  14.216 -    INST64_M28 M28;	// purge translation cache entry
  14.217 -    INST64_M29 M29;	// mov register to ar (M unit)
  14.218 -    INST64_M30 M30;	// mov immediate to ar (M unit)
  14.219 -    INST64_M31 M31;	// mov from ar (M unit)
  14.220 -    INST64_M32 M32;	// mov reg to cr
  14.221 -    INST64_M33 M33;	// mov from cr
  14.222 -    INST64_M35 M35;	// mov to psr
  14.223 -    INST64_M36 M36;	// mov from psr
  14.224 -    INST64_M37 M37;	// break.m
  14.225 -    INST64_M41 M41;	// translation cache insert
  14.226 -    INST64_M42 M42;	// mov to indirect reg/translation reg insert
  14.227 -    INST64_M43 M43;	// mov from indirect reg
  14.228 -    INST64_M44 M44;	// set/reset system mask
  14.229 -    INST64_M45 M45;	// translation purge
  14.230 -    INST64_M46 M46;	// translation access (tpa,tak)
  14.231 -    INST64_M47 M47;	// purge translation entry
  14.232 -} INST64;
  14.233 -
  14.234 -#define MASK_41 ((UINT64)0x1ffffffffff)
  14.235 -
  14.236  extern void privify_memory(void *start, UINT64 len);
  14.237  
  14.238  extern int ia64_hyperprivop(unsigned long iim, REGS *regs);
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/xen/include/asm-ia64/privop_stat.h	Mon Jul 03 08:12:16 2006 -0600
    15.3 @@ -0,0 +1,66 @@
    15.4 +#ifndef _XEN_UA64_PRIVOP_STAT_H
    15.5 +#define _XEN_UA64_PRIVOP_STAT_H
    15.6 +#include <public/arch-ia64.h>
    15.7 +
    15.8 +extern int dump_privop_counts_to_user(char *, int);
    15.9 +extern int zero_privop_counts_to_user(char *, int);
   15.10 +
   15.11 +#define PRIVOP_ADDR_COUNT
   15.12 +
   15.13 +/* vcpu_translate hit with dtlb.  */
   15.14 +extern unsigned long dtlb_translate_count;
   15.15 +
   15.16 +/* vcpu_translate hit with tr.  */
   15.17 +extern unsigned long tr_translate_count;
   15.18 +
   15.19 +/* vcpu_translate in metaphysical mode.  */
   15.20 +extern unsigned long phys_translate_count;
   15.21 +
   15.22 +extern unsigned long vhpt_translate_count;
   15.23 +extern unsigned long fast_vhpt_translate_count;
   15.24 +extern unsigned long recover_to_page_fault_count;
   15.25 +extern unsigned long recover_to_break_fault_count;
   15.26 +extern unsigned long idle_when_pending;
   15.27 +extern unsigned long pal_halt_light_count;
   15.28 +extern unsigned long context_switch_count;
   15.29 +extern unsigned long lazy_cover_count;
   15.30 +
   15.31 +extern unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1];
   15.32 +extern unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1];
   15.33 +
   15.34 +extern unsigned long slow_reflect_count[0x80];
   15.35 +extern unsigned long fast_reflect_count[0x80];
   15.36 +
   15.37 +struct privop_counters {
   15.38 +	unsigned long mov_to_ar_imm;
   15.39 +	unsigned long mov_to_ar_reg;
   15.40 +	unsigned long mov_from_ar;
   15.41 +	unsigned long ssm;
   15.42 +	unsigned long rsm;
   15.43 +	unsigned long rfi;
   15.44 +	unsigned long bsw0;
   15.45 +	unsigned long bsw1;
   15.46 +	unsigned long cover;
   15.47 +	unsigned long fc;
   15.48 +	unsigned long cpuid;
   15.49 +	unsigned long Mpriv_cnt[64];
   15.50 +
   15.51 +	unsigned long to_cr_cnt[128]; /* Number of mov to cr privop.  */
   15.52 +	unsigned long from_cr_cnt[128]; /* Number of mov from cr privop.  */
   15.53 +};
   15.54 +
   15.55 +extern struct privop_counters privcnt;
   15.56 +
   15.57 +#ifdef PRIVOP_ADDR_COUNT
   15.58 +
   15.59 +/* INST argument of PRIVOP_COUNT_ADDR.  */
   15.60 +#define _GET_IFA 0
   15.61 +#define _THASH 1
   15.62 +#define	PRIVOP_COUNT_ADDR(regs,inst) privop_count_addr(regs->cr_iip,inst)
   15.63 +extern void privop_count_addr(unsigned long addr, int inst);
   15.64 +
   15.65 +#else
   15.66 +#define	PRIVOP_COUNT_ADDR(x,y) do {} while (0)
   15.67 +#endif
   15.68 +
   15.69 +#endif /* _XEN_UA64_PRIVOP_STAT_H */
    16.1 --- a/xen/include/asm-ia64/vcpu.h	Mon Jul 03 07:42:17 2006 -0600
    16.2 +++ b/xen/include/asm-ia64/vcpu.h	Mon Jul 03 08:12:16 2006 -0600
    16.3 @@ -4,7 +4,8 @@
    16.4  // TODO: Many (or perhaps most) of these should eventually be
    16.5  // static inline functions
    16.6  
    16.7 -//#include "thread.h"
    16.8 +#include <asm/fpu.h>
    16.9 +#include <asm/tlb.h>
   16.10  #include <asm/ia64_int.h>
   16.11  #include <public/arch-ia64.h>
   16.12  typedef	unsigned long UINT64;
   16.13 @@ -12,29 +13,13 @@ typedef	unsigned int UINT;
   16.14  typedef	int BOOLEAN;
   16.15  struct vcpu;
   16.16  typedef	struct vcpu VCPU;
   16.17 -
   16.18  typedef cpu_user_regs_t REGS;
   16.19  
   16.20 -
   16.21  /* Note: PSCB stands for Privilegied State Communication Block.  */
   16.22  #define VCPU(_v,_x)	(_v->arch.privregs->_x)
   16.23  #define PSCB(_v,_x) VCPU(_v,_x)
   16.24  #define PSCBX(_v,_x) (_v->arch._x)
   16.25  
   16.26 -#define PRIVOP_ADDR_COUNT
   16.27 -#ifdef PRIVOP_ADDR_COUNT
   16.28 -#define _GET_IFA 0
   16.29 -#define _THASH 1
   16.30 -#define PRIVOP_COUNT_NINSTS 2
   16.31 -#define PRIVOP_COUNT_NADDRS 30
   16.32 -
   16.33 -struct privop_addr_count {
   16.34 -	char *instname;
   16.35 -	unsigned long addr[PRIVOP_COUNT_NADDRS];
   16.36 -	unsigned long count[PRIVOP_COUNT_NADDRS];
   16.37 -	unsigned long overflow;
   16.38 -};
   16.39 -#endif
   16.40  
   16.41  /* general registers */
   16.42  extern UINT64 vcpu_get_gr(VCPU *vcpu, unsigned long reg);
    17.1 --- a/xen/include/asm-ia64/vhpt.h	Mon Jul 03 07:42:17 2006 -0600
    17.2 +++ b/xen/include/asm-ia64/vhpt.h	Mon Jul 03 08:12:16 2006 -0600
    17.3 @@ -21,6 +21,8 @@
    17.4  #define	VLE_CCHAIN_OFFSET		24
    17.5  
    17.6  #ifndef __ASSEMBLY__
    17.7 +#include <xen/percpu.h>
    17.8 +
    17.9  //
   17.10  // VHPT Long Format Entry (as recognized by hw)
   17.11  //