ia64/xen-unstable

changeset 4146:f2d61710e4d9

bitkeeper revision 1.1236.25.24 (42366e9aQ71LQ8uCB-Y1IwVNqx5eqA)

Merge djm@kirby.fc.hp.com://home/djm/src/xen/xeno-unstable-ia64.bk
into sportsman.spdomain:/home/djm/xeno-unstable-ia64.bk
author djm@sportsman.spdomain
date Tue Mar 15 05:11:54 2005 +0000 (2005-03-15)
parents 288c77d96e81 0c846e77cca4
children a0b28acf0dcd
files BitKeeper/etc/logging_ok xen/arch/ia64/domain.c xen/arch/ia64/patch/linux-2.6.7/system.h xen/arch/ia64/process.c xen/arch/ia64/regionreg.c xen/arch/ia64/xenasm.S xen/arch/ia64/xenmisc.c xen/arch/ia64/xensetup.c xen/drivers/char/console.c xen/include/asm-ia64/config.h
line diff
     1.1 --- a/BitKeeper/etc/logging_ok	Mon Mar 14 22:29:15 2005 +0000
     1.2 +++ b/BitKeeper/etc/logging_ok	Tue Mar 15 05:11:54 2005 +0000
     1.3 @@ -20,7 +20,9 @@ cl349@freefall.cl.cam.ac.uk
     1.4  cl349@labyrinth.cl.cam.ac.uk
     1.5  cwc22@centipede.cl.cam.ac.uk
     1.6  cwc22@donkeykong.cl.cam.ac.uk
     1.7 +djm@djmnc4000.(none)
     1.8  djm@kirby.fc.hp.com
     1.9 +djm@sportsman.spdomain
    1.10  doogie@brainfood.com
    1.11  gm281@boulderdash.cl.cam.ac.uk
    1.12  gm281@tetrapod.cl.cam.ac.uk
     2.1 --- a/xen/arch/ia64/domain.c	Mon Mar 14 22:29:15 2005 +0000
     2.2 +++ b/xen/arch/ia64/domain.c	Tue Mar 15 05:11:54 2005 +0000
     2.3 @@ -102,7 +102,7 @@ void startup_cpu_idle_loop(void)
     2.4  {
     2.5      /* Just some sanity to ensure that the scheduler is set up okay. */
     2.6      ASSERT(current->domain == IDLE_DOMAIN_ID);
     2.7 -    domain_unpause_by_systemcontroller(current);
     2.8 +    domain_unpause_by_systemcontroller(current->domain);
     2.9      __enter_scheduler();
    2.10  
    2.11      /*
    2.12 @@ -670,6 +670,7 @@ void dummy(void)
    2.13  }
    2.14  
    2.15  
    2.16 +#if 0
    2.17  void switch_to(struct exec_domain *prev, struct exec_domain *next)
    2.18  {
    2.19   	struct exec_domain *last;
    2.20 @@ -677,6 +678,7 @@ void switch_to(struct exec_domain *prev,
    2.21  	__switch_to(prev,next,last);
    2.22  	//set_current(next);
    2.23  }
    2.24 +#endif
    2.25  
    2.26  void domain_pend_keyboard_interrupt(int irq)
    2.27  {
     3.1 --- a/xen/arch/ia64/patch/linux-2.6.7/system.h	Mon Mar 14 22:29:15 2005 +0000
     3.2 +++ b/xen/arch/ia64/patch/linux-2.6.7/system.h	Tue Mar 15 05:11:54 2005 +0000
     3.3 @@ -1,5 +1,5 @@
     3.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/asm-ia64/system.h	2005-01-23 13:23:36.000000000 -0700
     3.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/system.h	2004-09-17 18:27:22.000000000 -0600
     3.6 +--- ../../linux-2.6.7/include/asm-ia64/system.h	2005-01-31 11:15:23.000000000 -0700
     3.7 ++++ include/asm-ia64/system.h	2005-03-14 11:31:12.000000000 -0700
     3.8  @@ -24,8 +24,16 @@
     3.9    * 0xa000000000000000+2*PERCPU_PAGE_SIZE
    3.10    * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page)
    3.11 @@ -35,9 +35,9 @@
    3.12   #else
    3.13   # define switch_to(prev,next,last)	__switch_to(prev, next, last)
    3.14   #endif
    3.15 -+#ifdef XEN
    3.16 -+#undef switch_to
    3.17 -+#endif
    3.18 ++//#ifdef XEN
    3.19 ++//#undef switch_to
    3.20 ++//#endif
    3.21   
    3.22   /*
    3.23    * On IA-64, we don't want to hold the runqueue's lock during the low-level context-switch,
     4.1 --- a/xen/arch/ia64/process.c	Mon Mar 14 22:29:15 2005 +0000
     4.2 +++ b/xen/arch/ia64/process.c	Tue Mar 15 05:11:54 2005 +0000
     4.3 @@ -143,15 +143,13 @@ void reflect_interruption(unsigned long 
     4.4  	}
     4.5  	if (!PSCB(ed,interrupt_collection_enabled)) {
     4.6  		if (!(PSCB(ed,ipsr) & IA64_PSR_DT)) {
     4.7 -			printf("psr.dt off, trying to deliver nested dtlb!\n");
     4.8 -			while(1);
     4.9 +			panic_domain(regs,"psr.dt off, trying to deliver nested dtlb!\n");
    4.10  		}
    4.11  		vector &= ~0xf;
    4.12  		if (vector != IA64_DATA_TLB_VECTOR &&
    4.13  		    vector != IA64_DATA_TLB_VECTOR) {
    4.14 -printf("psr.ic off, delivering fault=%lx,iip=%p,isr=%p,PSCB.iip=%p\n",
    4.15 -	vector,regs->cr_iip,isr,PSCB(ed,iip));
    4.16 -			while(1);
    4.17 +panic_domain(regs,"psr.ic off, delivering fault=%lx,iip=%p,ifa=%p,isr=%p,PSCB.iip=%p\n",
    4.18 +	vector,regs->cr_iip,ifa,isr,PSCB(ed,iip));
    4.19  			
    4.20  		}
    4.21  //printf("Delivering NESTED DATA TLB fault\n");
    4.22 @@ -243,9 +241,6 @@ void xen_handle_domain_access(unsigned l
    4.23  	unsigned long lookup_domain_mpa(struct domain *,unsigned long);
    4.24  	unsigned long match_dtlb(struct exec_domain *,unsigned long, unsigned long *, unsigned long *);
    4.25  	IA64FAULT fault;
    4.26 -#ifndef USER_ACCESS
    4.27 -	extern void __get_domain_bundle(void);
    4.28 -#endif
    4.29  
    4.30  // NEED TO HANDLE THREE CASES:
    4.31  // 1) domain is in metaphysical mode
    4.32 @@ -268,13 +263,6 @@ void xen_handle_domain_access(unsigned l
    4.33  		vcpu_itc_no_srlz(ed,2,address,pteval,-1UL,PAGE_SHIFT);
    4.34  		return;
    4.35  	}
    4.36 -#ifndef USER_ACCESS
    4.37 -	if (*(unsigned long *)__get_domain_bundle != iip) {
    4.38 -		printf("Bad user space access @%p ",address);
    4.39 -		printf("iip=%p, ipsr=%p, b0=%p\n",iip,psr,regs->b0);
    4.40 -		while(1);
    4.41 -	}
    4.42 -#endif
    4.43  if (address < 0x4000) printf("WARNING: page_fault @%p, iip=%p\n",address,iip);
    4.44  		
    4.45  	// if we are fortunate enough to have it in the 1-entry TLB...
    4.46 @@ -285,13 +273,6 @@ if (address < 0x4000) printf("WARNING: p
    4.47  	// look in the TRs
    4.48  	fault = vcpu_tpa(ed,address,&mpaddr);
    4.49  	if (fault != IA64_NO_FAULT) {
    4.50 -#ifndef USER_ACCESS
    4.51 -		// this is hardcoded to handle __get_domain_bundle only
    4.52 -		regs->r8 = 0; regs->r9 = 0;
    4.53 -		regs->cr_iip += 0x20;
    4.54 -		//regs->cr_iip |= (2UL << IA64_PSR_RI_BIT);
    4.55 -		return;
    4.56 -#else /* USER_ACCESS */
    4.57  		static int uacnt = 0;
    4.58  		// can't translate it, just fail (poor man's exception)
    4.59  		// which results in retrying execution
    4.60 @@ -306,9 +287,10 @@ if (address < 0x4000) printf("WARNING: p
    4.61  			printk("*** xen_handle_domain_access: exception table"
    4.62                                 " lookup failed, iip=%p, addr=%p, spinning...\n",
    4.63  				iip,address);
    4.64 -			while(1);
    4.65 +			panic_domain(regs,"*** xen_handle_domain_access: exception table"
    4.66 +                               " lookup failed, iip=%p, addr=%p, spinning...\n",
    4.67 +				iip,address);
    4.68  		}
    4.69 -#endif /* USER_ACCESS */
    4.70  	}
    4.71  	if (d == dom0) {
    4.72  		if (mpaddr < dom0_start || mpaddr >= dom0_start + dom0_size) {
    4.73 @@ -375,7 +357,9 @@ void ia64_do_page_fault (unsigned long a
    4.74  	}
    4.75  	vector = is_data ? IA64_DATA_TLB_VECTOR : IA64_INST_TLB_VECTOR;
    4.76  	if (handle_lazy_cover(current, isr, regs)) return;
    4.77 -if (!(address>>61)) { printf("ia64_do_page_fault: @%p???, iip=%p, itc=%p (spinning...)\n",address,iip,ia64_get_itc()); while(1); }
    4.78 +if (!(address>>61)) {
    4.79 +panic_domain(0,"ia64_do_page_fault: @%p???, iip=%p, itc=%p (spinning...)\n",address,iip,ia64_get_itc());
    4.80 +}
    4.81  	if ((isr & IA64_ISR_SP)
    4.82  	    || ((isr & IA64_ISR_NA) && (isr & IA64_ISR_CODE_MASK) == IA64_ISR_CODE_LFETCH))
    4.83  	{
    4.84 @@ -835,8 +819,7 @@ ia64_handle_reflection (unsigned long if
    4.85  	unsigned long itir = vcpu_get_itir_on_fault(ed,ifa);
    4.86  
    4.87  	if (!(psr & IA64_PSR_CPL)) {
    4.88 -		printf("ia64_handle_reflection: reflecting with priv=0!!\n");
    4.89 -		while(1);
    4.90 +		printk("ia64_handle_reflection: reflecting with priv=0!!\n");
    4.91  	}
    4.92  	// FIXME: no need to pass itir in to this routine as we need to
    4.93  	// compute the virtual itir anyway (based on domain's RR.ps)
     5.1 --- a/xen/arch/ia64/regionreg.c	Mon Mar 14 22:29:15 2005 +0000
     5.2 +++ b/xen/arch/ia64/regionreg.c	Tue Mar 15 05:11:54 2005 +0000
     5.3 @@ -262,7 +262,12 @@ int set_one_rr(unsigned long rr, unsigne
     5.4  	newrrv.rrval = 0;
     5.5  	newrid = ed->domain->starting_rid + rrv.rid;
     5.6  
     5.7 -	if (newrid > ed->domain->ending_rid) return 0;
     5.8 +	if (newrid > ed->domain->ending_rid) {
     5.9 +		printk("can't set rr%d to %lx, starting_rid=%lx,"
    5.10 +			"ending_rid=%lx, val=%lx\n", rreg, newrid,
    5.11 +			ed->domain->starting_rid,ed->domain->ending_rid,val);
    5.12 +		return 0;
    5.13 +	}
    5.14  
    5.15  	memrrv.rrval = rrv.rrval;
    5.16  	if (rreg == 7) {
    5.17 @@ -335,21 +340,21 @@ if (!ed->vcpu_info) { printf("Stopping i
    5.18  
    5.19  /* XEN/ia64 INTERNAL ROUTINES */
    5.20  
    5.21 -unsigned long physicalize_rid(struct exec_domain *ed, unsigned long rid)
    5.22 +unsigned long physicalize_rid(struct exec_domain *ed, unsigned long rrval)
    5.23  {
    5.24  	ia64_rr rrv;
    5.25  	    
    5.26 -	rrv.rrval = rid;
    5.27 +	rrv.rrval = rrval;
    5.28  	rrv.rid += ed->domain->starting_rid;
    5.29  	return rrv.rrval;
    5.30  }
    5.31  
    5.32  unsigned long
    5.33 -virtualize_rid(struct exec_domain *ed, unsigned long rid)
    5.34 +virtualize_rid(struct exec_domain *ed, unsigned long rrval)
    5.35  {
    5.36  	ia64_rr rrv;
    5.37  	    
    5.38 -	rrv.rrval = rid;
    5.39 +	rrv.rrval = rrval;
    5.40  	rrv.rid -= ed->domain->starting_rid;
    5.41  	return rrv.rrval;
    5.42  }
    5.43 @@ -365,6 +370,7 @@ unsigned long load_region_regs(struct ex
    5.44  {
    5.45  	unsigned long rr0, rr1,rr2, rr3, rr4, rr5, rr6, rr7;
    5.46  	// TODO: These probably should be validated
    5.47 +	unsigned long bad = 0;
    5.48  
    5.49  	if (ed->vcpu_info->arch.metaphysical_mode) {
    5.50  		ia64_rr rrv;
    5.51 @@ -383,25 +389,28 @@ unsigned long load_region_regs(struct ex
    5.52  		set_rr_no_srlz(0x8000000000000000L, rr4);
    5.53  		set_rr_no_srlz(0xa000000000000000L, rr5);
    5.54  		set_rr_no_srlz(0xc000000000000000L, rr6);
    5.55 +		// skip rr7 when in metaphysical mode
    5.56  	}
    5.57  	else {
    5.58 -		rr0 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[0]);
    5.59 -		rr1 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[1]);
    5.60 -		rr2 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[2]);
    5.61 -		rr3 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[3]);
    5.62 -		rr4 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[4]);
    5.63 -		rr5 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[5]);
    5.64 -		rr6 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[6]);
    5.65 -		set_one_rr(0x0000000000000000L, rr0);
    5.66 -		set_one_rr(0x2000000000000000L, rr1);
    5.67 -		set_one_rr(0x4000000000000000L, rr2);
    5.68 -		set_one_rr(0x6000000000000000L, rr3);
    5.69 -		set_one_rr(0x8000000000000000L, rr4);
    5.70 -		set_one_rr(0xa000000000000000L, rr5);
    5.71 -		set_one_rr(0xc000000000000000L, rr6);
    5.72 -		ia64_srlz_d();
    5.73 +		rr0 =  ed->vcpu_info->arch.rrs[0];
    5.74 +		rr1 =  ed->vcpu_info->arch.rrs[1];
    5.75 +		rr2 =  ed->vcpu_info->arch.rrs[2];
    5.76 +		rr3 =  ed->vcpu_info->arch.rrs[3];
    5.77 +		rr4 =  ed->vcpu_info->arch.rrs[4];
    5.78 +		rr5 =  ed->vcpu_info->arch.rrs[5];
    5.79 +		rr6 =  ed->vcpu_info->arch.rrs[6];
    5.80 +		rr7 =  ed->vcpu_info->arch.rrs[7];
    5.81 +		if (!set_one_rr(0x0000000000000000L, rr0)) bad |= 1;
    5.82 +		if (!set_one_rr(0x2000000000000000L, rr1)) bad |= 2;
    5.83 +		if (!set_one_rr(0x4000000000000000L, rr2)) bad |= 4;
    5.84 +		if (!set_one_rr(0x6000000000000000L, rr3)) bad |= 8;
    5.85 +		if (!set_one_rr(0x8000000000000000L, rr4)) bad |= 0x10;
    5.86 +		if (!set_one_rr(0xa000000000000000L, rr5)) bad |= 0x20;
    5.87 +		if (!set_one_rr(0xc000000000000000L, rr6)) bad |= 0x40;
    5.88 +		if (!set_one_rr(0xe000000000000000L, rr7)) bad |= 0x80;
    5.89  	}
    5.90 -	rr7 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[7]);
    5.91 -	set_one_rr(0xe000000000000000L, rr7);
    5.92  	ia64_srlz_d();
    5.93 +	if (bad) {
    5.94 +		panic_domain(0,"load_region_regs: can't set! bad=%lx\n",bad);
    5.95 +	}
    5.96  }
     6.1 --- a/xen/arch/ia64/xenasm.S	Mon Mar 14 22:29:15 2005 +0000
     6.2 +++ b/xen/arch/ia64/xenasm.S	Tue Mar 15 05:11:54 2005 +0000
     6.3 @@ -261,24 +261,6 @@ GLOBAL_ENTRY(ia64_prepare_handle_reflect
     6.4  	br.cond.sptk.many rp			// goes to ia64_leave_kernel
     6.5  END(ia64_prepare_handle_reflection)
     6.6  
     6.7 -#ifndef USER_ACCESS
     6.8 -// REMOVE: replaced with get_user
     6.9 -// NOTE: instruction spacing must be explicit for recovery on miss
    6.10 -GLOBAL_ENTRY(__get_domain_bundle)
    6.11 -	ld8 r8=[r32],8
    6.12 -	nop 0
    6.13 -	nop 0
    6.14 -	;;
    6.15 -	ld8 r9=[r32]
    6.16 -	nop 0
    6.17 -	nop 0
    6.18 -	;;
    6.19 -	br.ret.sptk.many rp
    6.20 -	nop 0
    6.21 -	nop 0
    6.22 -	;;
    6.23 -END(__get_domain_bundle)
    6.24 -#else
    6.25  GLOBAL_ENTRY(__get_domain_bundle)
    6.26  	EX(.failure_in_get_bundle,ld8 r8=[r32],8)
    6.27  	;;
    6.28 @@ -294,7 +276,6 @@ GLOBAL_ENTRY(__get_domain_bundle)
    6.29  	br.ret.sptk.many rp
    6.30  	;;
    6.31  END(__get_domain_bundle)
    6.32 -#endif
    6.33  
    6.34  GLOBAL_ENTRY(dorfirfi)
    6.35  #define SI_CR_IIP_OFFSET 0x10
     7.1 --- a/xen/arch/ia64/xenmisc.c	Mon Mar 14 22:29:15 2005 +0000
     7.2 +++ b/xen/arch/ia64/xenmisc.c	Tue Mar 15 05:11:54 2005 +0000
     7.3 @@ -203,7 +203,7 @@ char * __devinit  pcibios_setup(char *st
     7.4  
     7.5  void show_registers(struct pt_regs *regs)
     7.6  {
     7.7 -	dummy();
     7.8 +	printf("*** ADD REGISTER DUMP HERE FOR DEBUGGING\n");
     7.9  }	
    7.10  
    7.11  ///////////////////////////////
    7.12 @@ -240,12 +240,41 @@ void *module_text_address(unsigned long 
    7.13  	return NULL;
    7.14  }
    7.15  
    7.16 +void cs10foo(void) {}
    7.17 +void cs01foo(void) {}
    7.18 +
    7.19  // context_switch
    7.20  void context_switch(struct exec_domain *prev, struct exec_domain *next)
    7.21  {
    7.22 -	switch_to(prev,next);
    7.23 +//printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
    7.24 +//printk("@@@@@@ context switch from domain %d (%x) to domain %d (%x)\n",
    7.25 +//prev->domain->id,(long)prev&0xffffff,next->domain->id,(long)next&0xffffff);
    7.26 +//printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
    7.27 +//if (prev->domain->id == 1 && next->domain->id == 0) cs10foo();
    7.28 +//if (prev->domain->id == 0 && next->domain->id == 1) cs01foo();
    7.29 +	switch_to(prev,next,prev);
    7.30  	clear_bit(EDF_RUNNING, &prev->ed_flags);
    7.31  	//if (!is_idle_task(next->domain) )
    7.32  		//send_guest_virq(next, VIRQ_TIMER);
    7.33 -	schedule_tail(next);
    7.34 +	load_region_regs(current);
    7.35  }
    7.36 +
    7.37 +void panic_domain(struct pt_regs *regs, const char *fmt, ...)
    7.38 +{
    7.39 +	va_list args;
    7.40 +	char buf[128];
    7.41 +	struct exec_domain *ed = current;
    7.42 +	static volatile int test = 1;	// so can continue easily in debug
    7.43 +	extern spinlock_t console_lock;
    7.44 +	unsigned long flags;
    7.45 +    
    7.46 +	printf("$$$$$ PANIC in domain %d (k6=%p): ",
    7.47 +		ed->domain->id, ia64_get_kr(IA64_KR_CURRENT));
    7.48 +	va_start(args, fmt);
    7.49 +	(void)vsnprintf(buf, sizeof(buf), fmt, args);
    7.50 +	va_end(args);
    7.51 +	printf(buf);
    7.52 +	if (regs) show_registers(regs);
    7.53 +	domain_pause_by_systemcontroller(current->domain);
    7.54 +	//while(test);
    7.55 +}
     8.1 --- a/xen/arch/ia64/xensetup.c	Mon Mar 14 22:29:15 2005 +0000
     8.2 +++ b/xen/arch/ia64/xensetup.c	Tue Mar 15 05:11:54 2005 +0000
     8.3 @@ -389,7 +389,7 @@ printk("About to call init_trace_bufs()\
     8.4      console_endboot(cmdline && strstr(cmdline, "tty0"));
     8.5  #endif
     8.6  
     8.7 -    domain_unpause_by_systemcontroller(current);
     8.8 +    domain_unpause_by_systemcontroller(current->domain);
     8.9  #ifdef CLONE_DOMAIN0
    8.10      {
    8.11      int i;
     9.1 --- a/xen/drivers/char/console.c	Mon Mar 14 22:29:15 2005 +0000
     9.2 +++ b/xen/drivers/char/console.c	Tue Mar 15 05:11:54 2005 +0000
     9.3 @@ -644,3 +644,4 @@ void __out_of_line_bug(int line)
     9.4   * indent-tabs-mode: nil
     9.5   * End:
     9.6   */
     9.7 +
    10.1 --- a/xen/include/asm-ia64/config.h	Mon Mar 14 22:29:15 2005 +0000
    10.2 +++ b/xen/include/asm-ia64/config.h	Tue Mar 15 05:11:54 2005 +0000
    10.3 @@ -1,7 +1,6 @@
    10.4  // control flags for turning on/off features under test
    10.5  #undef CLONE_DOMAIN0
    10.6 -//#define CLONE_DOMAIN0 1
    10.7 -//#undef CLONE_DOMAIN0
    10.8 +//#define CLONE_DOMAIN0 3
    10.9  #define USER_ACCESS
   10.10  
   10.11  // manufactured from component pieces