ia64/xen-unstable

changeset 4145:0c846e77cca4

bitkeeper revision 1.1236.31.2 (42361633CjfrivegSB7RM_ZE_lYofg)

More work on ia64 multiple domains
author djm@kirby.fc.hp.com
date Mon Mar 14 22:54:43 2005 +0000 (2005-03-14)
parents c77189c38646
children f2d61710e4d9 5cd82956dca3
files 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/xenmisc.c xen/arch/ia64/xensetup.c xen/drivers/char/console.c xen/include/asm-ia64/config.h
line diff
     1.1 --- a/xen/arch/ia64/domain.c	Mon Mar 14 18:28:54 2005 +0000
     1.2 +++ b/xen/arch/ia64/domain.c	Mon Mar 14 22:54:43 2005 +0000
     1.3 @@ -102,7 +102,7 @@ void startup_cpu_idle_loop(void)
     1.4  {
     1.5      /* Just some sanity to ensure that the scheduler is set up okay. */
     1.6      ASSERT(current->domain == IDLE_DOMAIN_ID);
     1.7 -    domain_unpause_by_systemcontroller(current);
     1.8 +    domain_unpause_by_systemcontroller(current->domain);
     1.9      __enter_scheduler();
    1.10  
    1.11      /*
     2.1 --- a/xen/arch/ia64/patch/linux-2.6.7/system.h	Mon Mar 14 18:28:54 2005 +0000
     2.2 +++ b/xen/arch/ia64/patch/linux-2.6.7/system.h	Mon Mar 14 22:54:43 2005 +0000
     2.3 @@ -1,5 +1,5 @@
     2.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
     2.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/system.h	2004-09-17 18:27:22.000000000 -0600
     2.6 +--- ../../linux-2.6.7/include/asm-ia64/system.h	2005-01-31 11:15:23.000000000 -0700
     2.7 ++++ include/asm-ia64/system.h	2005-03-14 11:31:12.000000000 -0700
     2.8  @@ -24,8 +24,16 @@
     2.9    * 0xa000000000000000+2*PERCPU_PAGE_SIZE
    2.10    * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page)
    2.11 @@ -35,9 +35,9 @@
    2.12   #else
    2.13   # define switch_to(prev,next,last)	__switch_to(prev, next, last)
    2.14   #endif
    2.15 -+#ifdef XEN
    2.16 -+#undef switch_to
    2.17 -+#endif
    2.18 ++//#ifdef XEN
    2.19 ++//#undef switch_to
    2.20 ++//#endif
    2.21   
    2.22   /*
    2.23    * On IA-64, we don't want to hold the runqueue's lock during the low-level context-switch,
     3.1 --- a/xen/arch/ia64/process.c	Mon Mar 14 18:28:54 2005 +0000
     3.2 +++ b/xen/arch/ia64/process.c	Mon Mar 14 22:54:43 2005 +0000
     3.3 @@ -148,8 +148,8 @@ void reflect_interruption(unsigned long 
     3.4  		vector &= ~0xf;
     3.5  		if (vector != IA64_DATA_TLB_VECTOR &&
     3.6  		    vector != IA64_DATA_TLB_VECTOR) {
     3.7 -panic_domain(regs,"psr.ic off, delivering fault=%lx,iip=%p,isr=%p,PSCB.iip=%p\n",
     3.8 -	vector,regs->cr_iip,isr,PSCB(ed,iip));
     3.9 +panic_domain(regs,"psr.ic off, delivering fault=%lx,iip=%p,ifa=%p,isr=%p,PSCB.iip=%p\n",
    3.10 +	vector,regs->cr_iip,ifa,isr,PSCB(ed,iip));
    3.11  			
    3.12  		}
    3.13  //printf("Delivering NESTED DATA TLB fault\n");
    3.14 @@ -284,6 +284,9 @@ if (address < 0x4000) printf("WARNING: p
    3.15  		else {
    3.16  			// should never happen.  If it does, region 0 addr may
    3.17  			// indicate a bad xen pointer
    3.18 +			printk("*** xen_handle_domain_access: exception table"
    3.19 +                               " lookup failed, iip=%p, addr=%p, spinning...\n",
    3.20 +				iip,address);
    3.21  			panic_domain(regs,"*** xen_handle_domain_access: exception table"
    3.22                                 " lookup failed, iip=%p, addr=%p, spinning...\n",
    3.23  				iip,address);
    3.24 @@ -816,7 +819,7 @@ ia64_handle_reflection (unsigned long if
    3.25  	unsigned long itir = vcpu_get_itir_on_fault(ed,ifa);
    3.26  
    3.27  	if (!(psr & IA64_PSR_CPL)) {
    3.28 -		panic_domain(regs,"ia64_handle_reflection: reflecting with priv=0!!\n");
    3.29 +		printk("ia64_handle_reflection: reflecting with priv=0!!\n");
    3.30  	}
    3.31  	// FIXME: no need to pass itir in to this routine as we need to
    3.32  	// compute the virtual itir anyway (based on domain's RR.ps)
     4.1 --- a/xen/arch/ia64/regionreg.c	Mon Mar 14 18:28:54 2005 +0000
     4.2 +++ b/xen/arch/ia64/regionreg.c	Mon Mar 14 22:54:43 2005 +0000
     4.3 @@ -262,7 +262,12 @@ int set_one_rr(unsigned long rr, unsigne
     4.4  	newrrv.rrval = 0;
     4.5  	newrid = ed->domain->starting_rid + rrv.rid;
     4.6  
     4.7 -	if (newrid > ed->domain->ending_rid) return 0;
     4.8 +	if (newrid > ed->domain->ending_rid) {
     4.9 +		printk("can't set rr%d to %lx, starting_rid=%lx,"
    4.10 +			"ending_rid=%lx, val=%lx\n", rreg, newrid,
    4.11 +			ed->domain->starting_rid,ed->domain->ending_rid,val);
    4.12 +		return 0;
    4.13 +	}
    4.14  
    4.15  	memrrv.rrval = rrv.rrval;
    4.16  	if (rreg == 7) {
    4.17 @@ -335,21 +340,21 @@ if (!ed->vcpu_info) { printf("Stopping i
    4.18  
    4.19  /* XEN/ia64 INTERNAL ROUTINES */
    4.20  
    4.21 -unsigned long physicalize_rid(struct exec_domain *ed, unsigned long rid)
    4.22 +unsigned long physicalize_rid(struct exec_domain *ed, unsigned long rrval)
    4.23  {
    4.24  	ia64_rr rrv;
    4.25  	    
    4.26 -	rrv.rrval = rid;
    4.27 +	rrv.rrval = rrval;
    4.28  	rrv.rid += ed->domain->starting_rid;
    4.29  	return rrv.rrval;
    4.30  }
    4.31  
    4.32  unsigned long
    4.33 -virtualize_rid(struct exec_domain *ed, unsigned long rid)
    4.34 +virtualize_rid(struct exec_domain *ed, unsigned long rrval)
    4.35  {
    4.36  	ia64_rr rrv;
    4.37  	    
    4.38 -	rrv.rrval = rid;
    4.39 +	rrv.rrval = rrval;
    4.40  	rrv.rid -= ed->domain->starting_rid;
    4.41  	return rrv.rrval;
    4.42  }
    4.43 @@ -365,6 +370,7 @@ unsigned long load_region_regs(struct ex
    4.44  {
    4.45  	unsigned long rr0, rr1,rr2, rr3, rr4, rr5, rr6, rr7;
    4.46  	// TODO: These probably should be validated
    4.47 +	unsigned long bad = 0;
    4.48  
    4.49  	if (ed->vcpu_info->arch.metaphysical_mode) {
    4.50  		ia64_rr rrv;
    4.51 @@ -383,25 +389,28 @@ unsigned long load_region_regs(struct ex
    4.52  		set_rr_no_srlz(0x8000000000000000L, rr4);
    4.53  		set_rr_no_srlz(0xa000000000000000L, rr5);
    4.54  		set_rr_no_srlz(0xc000000000000000L, rr6);
    4.55 +		// skip rr7 when in metaphysical mode
    4.56  	}
    4.57  	else {
    4.58 -		rr0 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[0]);
    4.59 -		rr1 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[1]);
    4.60 -		rr2 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[2]);
    4.61 -		rr3 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[3]);
    4.62 -		rr4 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[4]);
    4.63 -		rr5 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[5]);
    4.64 -		rr6 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[6]);
    4.65 -		set_one_rr(0x0000000000000000L, rr0);
    4.66 -		set_one_rr(0x2000000000000000L, rr1);
    4.67 -		set_one_rr(0x4000000000000000L, rr2);
    4.68 -		set_one_rr(0x6000000000000000L, rr3);
    4.69 -		set_one_rr(0x8000000000000000L, rr4);
    4.70 -		set_one_rr(0xa000000000000000L, rr5);
    4.71 -		set_one_rr(0xc000000000000000L, rr6);
    4.72 -		ia64_srlz_d();
    4.73 +		rr0 =  ed->vcpu_info->arch.rrs[0];
    4.74 +		rr1 =  ed->vcpu_info->arch.rrs[1];
    4.75 +		rr2 =  ed->vcpu_info->arch.rrs[2];
    4.76 +		rr3 =  ed->vcpu_info->arch.rrs[3];
    4.77 +		rr4 =  ed->vcpu_info->arch.rrs[4];
    4.78 +		rr5 =  ed->vcpu_info->arch.rrs[5];
    4.79 +		rr6 =  ed->vcpu_info->arch.rrs[6];
    4.80 +		rr7 =  ed->vcpu_info->arch.rrs[7];
    4.81 +		if (!set_one_rr(0x0000000000000000L, rr0)) bad |= 1;
    4.82 +		if (!set_one_rr(0x2000000000000000L, rr1)) bad |= 2;
    4.83 +		if (!set_one_rr(0x4000000000000000L, rr2)) bad |= 4;
    4.84 +		if (!set_one_rr(0x6000000000000000L, rr3)) bad |= 8;
    4.85 +		if (!set_one_rr(0x8000000000000000L, rr4)) bad |= 0x10;
    4.86 +		if (!set_one_rr(0xa000000000000000L, rr5)) bad |= 0x20;
    4.87 +		if (!set_one_rr(0xc000000000000000L, rr6)) bad |= 0x40;
    4.88 +		if (!set_one_rr(0xe000000000000000L, rr7)) bad |= 0x80;
    4.89  	}
    4.90 -	rr7 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[7]);
    4.91 -	set_one_rr(0xe000000000000000L, rr7);
    4.92  	ia64_srlz_d();
    4.93 +	if (bad) {
    4.94 +		panic_domain(0,"load_region_regs: can't set! bad=%lx\n",bad);
    4.95 +	}
    4.96  }
     5.1 --- a/xen/arch/ia64/xenmisc.c	Mon Mar 14 18:28:54 2005 +0000
     5.2 +++ b/xen/arch/ia64/xenmisc.c	Mon Mar 14 22:54:43 2005 +0000
     5.3 @@ -246,12 +246,12 @@ void cs01foo(void) {}
     5.4  // context_switch
     5.5  void context_switch(struct exec_domain *prev, struct exec_domain *next)
     5.6  {
     5.7 -printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
     5.8 -printk("@@@@@@ context switch from domain %d (%x) to domain %d (%x)\n",
     5.9 -prev->domain->id,(long)prev&0xffffff,next->domain->id,(long)next&0xffffff);
    5.10 -printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
    5.11 -if (prev->domain->id == 1 && next->domain->id == 0) cs10foo();
    5.12 -if (prev->domain->id == 0 && next->domain->id == 1) cs01foo();
    5.13 +//printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
    5.14 +//printk("@@@@@@ context switch from domain %d (%x) to domain %d (%x)\n",
    5.15 +//prev->domain->id,(long)prev&0xffffff,next->domain->id,(long)next&0xffffff);
    5.16 +//printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
    5.17 +//if (prev->domain->id == 1 && next->domain->id == 0) cs10foo();
    5.18 +//if (prev->domain->id == 0 && next->domain->id == 1) cs01foo();
    5.19  	switch_to(prev,next,prev);
    5.20  	clear_bit(EDF_RUNNING, &prev->ed_flags);
    5.21  	//if (!is_idle_task(next->domain) )
    5.22 @@ -265,11 +265,16 @@ void panic_domain(struct pt_regs *regs, 
    5.23  	char buf[128];
    5.24  	struct exec_domain *ed = current;
    5.25  	static volatile int test = 1;	// so can continue easily in debug
    5.26 +	extern spinlock_t console_lock;
    5.27 +	unsigned long flags;
    5.28      
    5.29 -	printf("$$$$$ PANIC in domain %d:",ed->domain->id);
    5.30 +	printf("$$$$$ PANIC in domain %d (k6=%p): ",
    5.31 +		ed->domain->id, ia64_get_kr(IA64_KR_CURRENT));
    5.32  	va_start(args, fmt);
    5.33  	(void)vsnprintf(buf, sizeof(buf), fmt, args);
    5.34  	va_end(args);
    5.35 +	printf(buf);
    5.36  	if (regs) show_registers(regs);
    5.37 -	while(test);
    5.38 +	domain_pause_by_systemcontroller(current->domain);
    5.39 +	//while(test);
    5.40  }
     6.1 --- a/xen/arch/ia64/xensetup.c	Mon Mar 14 18:28:54 2005 +0000
     6.2 +++ b/xen/arch/ia64/xensetup.c	Mon Mar 14 22:54:43 2005 +0000
     6.3 @@ -389,7 +389,7 @@ printk("About to call init_trace_bufs()\
     6.4      console_endboot(cmdline && strstr(cmdline, "tty0"));
     6.5  #endif
     6.6  
     6.7 -    domain_unpause_by_systemcontroller(current);
     6.8 +    domain_unpause_by_systemcontroller(current->domain);
     6.9  #ifdef CLONE_DOMAIN0
    6.10      {
    6.11      int i;
     7.1 --- a/xen/drivers/char/console.c	Mon Mar 14 18:28:54 2005 +0000
     7.2 +++ b/xen/drivers/char/console.c	Mon Mar 14 22:54:43 2005 +0000
     7.3 @@ -644,3 +644,4 @@ void __out_of_line_bug(int line)
     7.4   * indent-tabs-mode: nil
     7.5   * End:
     7.6   */
     7.7 +
     8.1 --- a/xen/include/asm-ia64/config.h	Mon Mar 14 18:28:54 2005 +0000
     8.2 +++ b/xen/include/asm-ia64/config.h	Mon Mar 14 22:54:43 2005 +0000
     8.3 @@ -1,7 +1,6 @@
     8.4  // control flags for turning on/off features under test
     8.5 -//#undef CLONE_DOMAIN0
     8.6 -#define CLONE_DOMAIN0 1
     8.7 -//#undef CLONE_DOMAIN0
     8.8 +#undef CLONE_DOMAIN0
     8.9 +//#define CLONE_DOMAIN0 3
    8.10  #define USER_ACCESS
    8.11  
    8.12  // manufactured from component pieces