ia64/xen-unstable

changeset 9493:cc94ab1e0de0

[IA64] cleanup in regionreg.c

get_impl_rid_bits: use pal call to get implemented_rid_bits.
clean up in regionreg.c

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Thu Apr 06 15:51:59 2006 -0600 (2006-04-06)
parents 2133fb78dba3
children 71e0c2ed4447
files xen/arch/ia64/xen/process.c xen/arch/ia64/xen/regionreg.c xen/arch/ia64/xen/vcpu.c xen/arch/ia64/xen/xenmisc.c xen/include/asm-ia64/regionreg.h
line diff
     1.1 --- a/xen/arch/ia64/xen/process.c	Wed Apr 05 12:19:52 2006 -0600
     1.2 +++ b/xen/arch/ia64/xen/process.c	Thu Apr 06 15:51:59 2006 -0600
     1.3 @@ -37,7 +37,6 @@
     1.4  
     1.5  extern void die_if_kernel(char *str, struct pt_regs *regs, long err);
     1.6  /* FIXME: where these declarations shold be there ? */
     1.7 -extern void load_region_regs(struct vcpu *);
     1.8  extern void panic_domain(struct pt_regs *, const char *, ...);
     1.9  extern long platform_is_hp_ski(void);
    1.10  extern int ia64_hyperprivop(unsigned long, REGS *);
    1.11 @@ -45,8 +44,6 @@ extern int ia64_hypercall(struct pt_regs
    1.12  extern void vmx_do_launch(struct vcpu *);
    1.13  extern unsigned long lookup_domain_mpa(struct domain *,unsigned long);
    1.14  
    1.15 -extern unsigned long dom0_start, dom0_size;
    1.16 -
    1.17  #define IA64_PSR_CPL1	(__IA64_UL(1) << IA64_PSR_CPL1_BIT)
    1.18  // note IA64_PSR_PK removed from following, why is this necessary?
    1.19  #define	DELIVER_PSR_SET	(IA64_PSR_IC | IA64_PSR_I | \
     2.1 --- a/xen/arch/ia64/xen/regionreg.c	Wed Apr 05 12:19:52 2006 -0600
     2.2 +++ b/xen/arch/ia64/xen/regionreg.c	Thu Apr 06 15:51:59 2006 -0600
     2.3 @@ -52,7 +52,7 @@ ia64_set_rr (unsigned long rr, unsigned 
     2.4  #endif
     2.5  
     2.6  // use this to allocate a rid out of the "Xen reserved rid block"
     2.7 -unsigned long allocate_reserved_rid(void)
     2.8 +static unsigned long allocate_reserved_rid(void)
     2.9  {
    2.10  	static unsigned long currentrid = XEN_DEFAULT_RID+1;
    2.11  	unsigned long t = currentrid;
    2.12 @@ -91,14 +91,14 @@ int deallocate_metaphysical_rid(unsigned
    2.13  static int implemented_rid_bits = 0;
    2.14  static struct domain *ridblock_owner[MAX_RID_BLOCKS] = { 0 };
    2.15  
    2.16 -void get_impl_rid_bits(void)
    2.17 +static void get_impl_rid_bits(void)
    2.18  {
    2.19 -	// FIXME (call PAL)
    2.20 -//#ifdef CONFIG_MCKINLEY
    2.21 -	implemented_rid_bits = IA64_MAX_IMPL_RID_BITS;
    2.22 -//#else
    2.23 -//#error "rid ranges won't work on Merced"
    2.24 -//#endif
    2.25 +	pal_vm_info_2_u_t vm_info_2;
    2.26 +
    2.27 +	/* Get machine rid_size.  */
    2.28 +	BUG_ON (ia64_pal_vm_summary (NULL, &vm_info_2) != 0);
    2.29 +	implemented_rid_bits = vm_info_2.pal_vm_info_2_s.rid_size;
    2.30 +
    2.31  	if (implemented_rid_bits <= IA64_MIN_IMPL_RID_BITS ||
    2.32  	    implemented_rid_bits > IA64_MAX_IMPL_RID_BITS)
    2.33  		BUG();
    2.34 @@ -177,31 +177,13 @@ int deallocate_rid_range(struct domain *
    2.35  	return 1;
    2.36  }
    2.37  
    2.38 -
    2.39 -static inline void
    2.40 -set_rr_no_srlz(unsigned long rr, unsigned long rrval)
    2.41 -{
    2.42 -	ia64_set_rr(rr, vmMangleRID(rrval));
    2.43 -}
    2.44 -
    2.45 -void
    2.46 +static void
    2.47  set_rr(unsigned long rr, unsigned long rrval)
    2.48  {
    2.49  	ia64_set_rr(rr, vmMangleRID(rrval));
    2.50  	ia64_srlz_d();
    2.51  }
    2.52  
    2.53 -static inline int validate_page_size(unsigned long ps)
    2.54 -{
    2.55 -	switch(ps) {
    2.56 -	    case 12: case 13: case 14: case 16: case 18:
    2.57 -	    case 20: case 22: case 24: case 26: case 28:
    2.58 -		return 1;
    2.59 -	    default:
    2.60 -		return 0;
    2.61 -	}
    2.62 -}
    2.63 -
    2.64  // validates and changes a single region register
    2.65  // in the currently executing domain
    2.66  // Passing a value of -1 is a (successful) no-op
    2.67 @@ -280,8 +262,8 @@ int set_metaphysical_rr0(void)
    2.68  // validates/changes region registers 0-6 in the currently executing domain
    2.69  // Note that this is the one and only SP API (other than executing a privop)
    2.70  // for a domain to use to change region registers
    2.71 -int set_all_rr( u64 rr0, u64 rr1, u64 rr2, u64 rr3,
    2.72 -		     u64 rr4, u64 rr5, u64 rr6, u64 rr7)
    2.73 +static int set_all_rr(u64 rr0, u64 rr1, u64 rr2, u64 rr3,
    2.74 +		      u64 rr4, u64 rr5, u64 rr6, u64 rr7)
    2.75  {
    2.76  	if (!set_one_rr(0x0000000000000000L, rr0)) return 0;
    2.77  	if (!set_one_rr(0x2000000000000000L, rr1)) return 0;
    2.78 @@ -317,25 +299,6 @@ if (!v->vcpu_info) { printf("Stopping in
    2.79  
    2.80  /* XEN/ia64 INTERNAL ROUTINES */
    2.81  
    2.82 -unsigned long physicalize_rid(struct vcpu *v, unsigned long rrval)
    2.83 -{
    2.84 -	ia64_rr rrv;
    2.85 -	    
    2.86 -	rrv.rrval = rrval;
    2.87 -	rrv.rid += v->arch.starting_rid;
    2.88 -	return rrv.rrval;
    2.89 -}
    2.90 -
    2.91 -unsigned long
    2.92 -virtualize_rid(struct vcpu *v, unsigned long rrval)
    2.93 -{
    2.94 -	ia64_rr rrv;
    2.95 -	    
    2.96 -	rrv.rrval = rrval;
    2.97 -	rrv.rid -= v->arch.starting_rid;
    2.98 -	return rrv.rrval;
    2.99 -}
   2.100 -
   2.101  // loads a thread's region register (0-6) state into
   2.102  // the real physical region registers.  Returns the
   2.103  // (possibly mangled) bits to store into rr7
     3.1 --- a/xen/arch/ia64/xen/vcpu.c	Wed Apr 05 12:19:52 2006 -0600
     3.2 +++ b/xen/arch/ia64/xen/vcpu.c	Thu Apr 06 15:51:59 2006 -0600
     3.3 @@ -23,7 +23,6 @@
     3.4  extern void getreg(unsigned long regnum, unsigned long *val, int *nat, struct pt_regs *regs);
     3.5  extern void setreg(unsigned long regnum, unsigned long val, int nat, struct pt_regs *regs);
     3.6  extern void panic_domain(struct pt_regs *, const char *, ...);
     3.7 -extern int set_metaphysical_rr0(void);
     3.8  extern unsigned long translate_domain_pte(UINT64,UINT64,UINT64);
     3.9  extern unsigned long translate_domain_mpaddr(unsigned long);
    3.10  extern void ia64_global_tlb_purge(UINT64 start, UINT64 end, UINT64 nbits);
     4.1 --- a/xen/arch/ia64/xen/xenmisc.c	Wed Apr 05 12:19:52 2006 -0600
     4.2 +++ b/xen/arch/ia64/xen/xenmisc.c	Thu Apr 06 15:51:59 2006 -0600
     4.3 @@ -29,7 +29,6 @@ int phys_proc_id[NR_CPUS];
     4.4  unsigned long loops_per_jiffy = (1<<12);	// from linux/init/main.c
     4.5  
     4.6  /* FIXME: where these declarations should be there ? */
     4.7 -extern void load_region_regs(struct vcpu *);
     4.8  extern void show_registers(struct pt_regs *regs);
     4.9  
    4.10  void ia64_mca_init(void) { printf("ia64_mca_init() skipped (Machine check abort handling)\n"); }
     5.1 --- a/xen/include/asm-ia64/regionreg.h	Wed Apr 05 12:19:52 2006 -0600
     5.2 +++ b/xen/include/asm-ia64/regionreg.h	Thu Apr 06 15:51:59 2006 -0600
     5.3 @@ -65,6 +65,7 @@ vmMangleRID(unsigned long RIDVal)
     5.4  #define vmUnmangleRID(x)	vmMangleRID(x)
     5.5  
     5.6  extern unsigned long allocate_metaphysical_rr(void);
     5.7 +extern int deallocate_metaphysical_rid(unsigned long rid);
     5.8  
     5.9  struct domain;
    5.10  extern int allocate_rid_range(struct domain *d, unsigned long ridbits);
    5.11 @@ -73,4 +74,8 @@ extern int deallocate_rid_range(struct d
    5.12  struct vcpu;
    5.13  extern void init_all_rr(struct vcpu *v);
    5.14  
    5.15 +extern int set_metaphysical_rr0(void);
    5.16 +
    5.17 +extern void load_region_regs(struct vcpu *v);
    5.18 +
    5.19  #endif		/* !_REGIONREG_H_ */