ia64/xen-unstable

changeset 9158:d00fa9827789

[IA64] cleanups

Cleanups: unused code removed, duplicate extern declarations removed,
prototypes moved at the top of the file.

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Wed Mar 08 23:07:51 2006 -0700 (2006-03-08)
parents a693ccb4d581
children 6270e89e1d47
files xen/arch/ia64/xen/process.c xen/arch/ia64/xen/vcpu.c
line diff
     1.1 --- a/xen/arch/ia64/xen/process.c	Tue Mar 07 20:01:29 2006 -0700
     1.2 +++ b/xen/arch/ia64/xen/process.c	Wed Mar 08 23:07:51 2006 -0700
     1.3 @@ -41,6 +41,7 @@ extern long platform_is_hp_ski(void);
     1.4  extern int ia64_hyperprivop(unsigned long, REGS *);
     1.5  extern int ia64_hypercall(struct pt_regs *regs);
     1.6  extern void vmx_do_launch(struct vcpu *);
     1.7 +extern unsigned long lookup_domain_mpa(struct domain *,unsigned long);
     1.8  
     1.9  extern unsigned long dom0_start, dom0_size;
    1.10  
    1.11 @@ -60,18 +61,8 @@ extern unsigned long dom0_start, dom0_si
    1.12  #define PSCB(x,y)	VCPU(x,y)
    1.13  #define PSCBX(x,y)	x->arch.y
    1.14  
    1.15 -extern unsigned long vcpu_verbose;
    1.16 -
    1.17 -long do_iopl(domid_t domain, unsigned int new_io_pl)
    1.18 -{
    1.19 -	dummy();
    1.20 -	return 0;
    1.21 -}
    1.22 -
    1.23  #include <xen/sched-if.h>
    1.24  
    1.25 -extern struct schedule_data schedule_data[NR_CPUS];
    1.26 -
    1.27  void schedule_tail(struct vcpu *prev)
    1.28  {
    1.29  	context_saved(prev);
    1.30 @@ -95,9 +86,6 @@ unsigned long translate_domain_pte(unsig
    1.31  {
    1.32  	struct domain *d = current->domain;
    1.33  	unsigned long mask, pteval2, mpaddr;
    1.34 -	unsigned long lookup_domain_mpa(struct domain *,unsigned long);
    1.35 -	extern struct domain *dom0;
    1.36 -	extern unsigned long dom0_start, dom0_size;
    1.37  
    1.38  	// FIXME address had better be pre-validated on insert
    1.39  	mask = ~itir_mask(itir);
    1.40 @@ -127,7 +115,6 @@ unsigned long translate_domain_pte(unsig
    1.41  // given a current domain metaphysical address, return the physical address
    1.42  unsigned long translate_domain_mpaddr(unsigned long mpaddr)
    1.43  {
    1.44 -	extern unsigned long lookup_domain_mpa(struct domain *,unsigned long);
    1.45  	unsigned long pteval;
    1.46  
    1.47  	if (current->domain == dom0) {
    1.48 @@ -224,7 +211,7 @@ void reflect_interruption(unsigned long 
    1.49  
    1.50  void foodpi(void) {}
    1.51  
    1.52 -unsigned long pending_false_positive = 0;
    1.53 +static unsigned long pending_false_positive = 0;
    1.54  
    1.55  void reflect_extint(struct pt_regs *regs)
    1.56  {
    1.57 @@ -543,7 +530,6 @@ unsigned long running_on_sim = 0;
    1.58  void
    1.59  do_ssc(unsigned long ssc, struct pt_regs *regs)
    1.60  {
    1.61 -	extern unsigned long lookup_domain_mpa(struct domain *,unsigned long);
    1.62  	unsigned long arg0, arg1, arg2, arg3, retval;
    1.63  	char buf[2];
    1.64  /**/	static int last_fd, last_count;	// FIXME FIXME FIXME
    1.65 @@ -653,14 +639,14 @@ if (!running_on_sim) { printf("SSC_OPEN,
    1.66  	vcpu_increment_iip(current);
    1.67  }
    1.68  
    1.69 +/* Also read in hyperprivop.S  */
    1.70  int first_break = 1;
    1.71  
    1.72  void
    1.73  ia64_handle_break (unsigned long ifa, struct pt_regs *regs, unsigned long isr, unsigned long iim)
    1.74  {
    1.75 -	struct domain *d = (struct domain *) current->domain;
    1.76 +	struct domain *d = current->domain;
    1.77  	struct vcpu *v = current;
    1.78 -	extern unsigned long running_on_sim;
    1.79  
    1.80  	if (first_break) {
    1.81  		if (platform_is_hp_ski()) running_on_sim = 1;
    1.82 @@ -668,8 +654,7 @@ ia64_handle_break (unsigned long ifa, st
    1.83  		first_break = 0;
    1.84  	}
    1.85  	if (iim == 0x80001 || iim == 0x80002) {	//FIXME: don't hardcode constant
    1.86 -		if (running_on_sim) do_ssc(vcpu_get_gr(current,36), regs);
    1.87 -		else do_ssc(vcpu_get_gr(current,36), regs);
    1.88 +		do_ssc(vcpu_get_gr(current,36), regs);
    1.89  	} 
    1.90  #ifdef CRASH_DEBUG
    1.91  	else if ((iim == 0 || iim == CDB_BREAK_NUM) && !user_mode(regs)) {
    1.92 @@ -711,6 +696,7 @@ ia64_handle_privop (unsigned long ifa, s
    1.93  	}
    1.94  }
    1.95  
    1.96 +/* Used in vhpt.h.  */
    1.97  #define INTR_TYPE_MAX	10
    1.98  UINT64 int_counts[INTR_TYPE_MAX];
    1.99  
     2.1 --- a/xen/arch/ia64/xen/vcpu.c	Tue Mar 07 20:01:29 2006 -0700
     2.2 +++ b/xen/arch/ia64/xen/vcpu.c	Wed Mar 08 23:07:51 2006 -0700
     2.3 @@ -30,15 +30,16 @@ extern void getreg(unsigned long regnum,
     2.4  extern void setreg(unsigned long regnum, unsigned long val, int nat, struct pt_regs *regs);
     2.5  extern void panic_domain(struct pt_regs *, const char *, ...);
     2.6  extern int set_metaphysical_rr0(void);
     2.7 +extern unsigned long translate_domain_pte(UINT64,UINT64,UINT64);
     2.8 +extern unsigned long translate_domain_mpaddr(unsigned long);
     2.9 +extern void ia64_global_tlb_purge(UINT64 start, UINT64 end, UINT64 nbits);
    2.10 +
    2.11  
    2.12  typedef	union {
    2.13  	struct ia64_psr ia64_psr;
    2.14  	unsigned long i64;
    2.15  } PSR;
    2.16  
    2.17 -//typedef	struct pt_regs	REGS;
    2.18 -//typedef struct domain VCPU;
    2.19 -
    2.20  // this def for vcpu_regs won't work if kernel stack is present
    2.21  //#define	vcpu_regs(vcpu) ((struct pt_regs *) vcpu->arch.regs
    2.22  #define	PSCB(x,y)	VCPU(x,y)
    2.23 @@ -238,7 +239,6 @@ IA64FAULT vcpu_reset_psr_sm(VCPU *vcpu, 
    2.24  	return IA64_NO_FAULT;
    2.25  }
    2.26  
    2.27 -extern UINT64 vcpu_check_pending_interrupts(VCPU *vcpu);
    2.28  #define SPURIOUS_VECTOR 0xf
    2.29  
    2.30  IA64FAULT vcpu_set_psr_dt(VCPU *vcpu)
    2.31 @@ -659,13 +659,6 @@ void vcpu_pend_interrupt(VCPU *vcpu, UIN
    2.32      }
    2.33  }
    2.34  
    2.35 -void early_tick(VCPU *vcpu)
    2.36 -{
    2.37 -	UINT64 *p = &PSCBX(vcpu,irr[3]);
    2.38 -	printf("vcpu_check_pending: about to deliver early tick\n");
    2.39 -	printf("&irr[0]=%p, irr[0]=0x%lx\n",p,*p);
    2.40 -}
    2.41 -
    2.42  #define	IA64_TPR_MMI	0x10000
    2.43  #define	IA64_TPR_MIC	0x000f0
    2.44  
    2.45 @@ -932,6 +925,7 @@ IA64FAULT vcpu_set_tpr(VCPU *vcpu, UINT6
    2.46  {
    2.47  	if (val & 0xff00) return IA64_RSVDREG_FAULT;
    2.48  	PSCB(vcpu,tpr) = val;
    2.49 +	/* This can unmask interrupts.  */
    2.50  	if (vcpu_check_pending_interrupts(vcpu) != SPURIOUS_VECTOR)
    2.51  		PSCB(vcpu,pending_interruption) = 1;
    2.52  	return (IA64_NO_FAULT);
    2.53 @@ -1693,7 +1687,7 @@ IA64FAULT vcpu_set_pkr(VCPU *vcpu, UINT6
    2.54   VCPU translation register access routines
    2.55  **************************************************************************/
    2.56  
    2.57 -static void vcpu_purge_tr_entry(TR_ENTRY *trp)
    2.58 +static inline void vcpu_purge_tr_entry(TR_ENTRY *trp)
    2.59  {
    2.60  	trp->p = 0;
    2.61  }
    2.62 @@ -1747,8 +1741,6 @@ IA64FAULT vcpu_itr_i(VCPU *vcpu, UINT64 
    2.63  
    2.64  void foobar(void) { /*vcpu_verbose = 1;*/ }
    2.65  
    2.66 -extern struct domain *dom0;
    2.67 -
    2.68  void vcpu_itc_no_srlz(VCPU *vcpu, UINT64 IorD, UINT64 vaddr, UINT64 pte, UINT64 mp_pte, UINT64 logps)
    2.69  {
    2.70  	unsigned long psr;
    2.71 @@ -1793,7 +1785,6 @@ void vcpu_itc_no_srlz(VCPU *vcpu, UINT64
    2.72  IA64FAULT vcpu_itc_d(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa)
    2.73  {
    2.74  	unsigned long pteval, logps = itir_ps(itir);
    2.75 -	unsigned long translate_domain_pte(UINT64,UINT64,UINT64);
    2.76  	BOOLEAN swap_rr0 = (!(ifa>>61) && PSCB(vcpu,metaphysical_mode));
    2.77  
    2.78  	if (logps < PAGE_SHIFT) {
    2.79 @@ -1813,7 +1804,6 @@ IA64FAULT vcpu_itc_d(VCPU *vcpu, UINT64 
    2.80  IA64FAULT vcpu_itc_i(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa)
    2.81  {
    2.82  	unsigned long pteval, logps = itir_ps(itir);
    2.83 -	unsigned long translate_domain_pte(UINT64,UINT64,UINT64);
    2.84  	BOOLEAN swap_rr0 = (!(ifa>>61) && PSCB(vcpu,metaphysical_mode));
    2.85  
    2.86  	// FIXME: validate ifa here (not in Xen space), COULD MACHINE CHECK!
    2.87 @@ -1849,7 +1839,6 @@ IA64FAULT vcpu_fc(VCPU *vcpu, UINT64 vad
    2.88  	// TODO: Only allowed for current vcpu
    2.89  	UINT64 mpaddr, paddr;
    2.90  	IA64FAULT fault;
    2.91 -	unsigned long translate_domain_mpaddr(unsigned long);
    2.92  
    2.93  	fault = vcpu_tpa(vcpu, vadr, &mpaddr);
    2.94  	if (fault == IA64_NO_FAULT) {
    2.95 @@ -1884,7 +1873,6 @@ IA64FAULT vcpu_ptc_g(VCPU *vcpu, UINT64 
    2.96  
    2.97  IA64FAULT vcpu_ptc_ga(VCPU *vcpu,UINT64 vadr,UINT64 addr_range)
    2.98  {
    2.99 -	extern void ia64_global_tlb_purge(UINT64 start, UINT64 end, UINT64 nbits);
   2.100  	// FIXME: validate not flushing Xen addresses
   2.101  	// if (Xen address) return(IA64_ILLOP_FAULT);
   2.102  	// FIXME: ??breaks if domain PAGE_SIZE < Xen PAGE_SIZE