ia64/xen-unstable

changeset 15423:cbf749e9961f

[IA64] Cleanup: Move is_platform_hp_ski() from xenmisc.c to xensetup.c

- only caller is start_kernel
- change to static __init
- also move running_on_sim to xensetup.c, and change it from unsigned
long to int, since it's just a boolean
- declare running_on_sim in config.h near some other externs

Tested by building, booting, starting a PV guest on rx2620.

Signed-off-by: Aron Griffis <aron@hp.com>
author Alex Williamson <alex.williamson@hp.com>
date Mon Jul 02 10:25:29 2007 -0600 (2007-07-02)
parents baffe3497542
children 443ce7edad0e
files xen/arch/ia64/linux-xen/efi.c xen/arch/ia64/xen/dom_fw_utils.c xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/faults.c xen/arch/ia64/xen/fw_emul.c xen/arch/ia64/xen/vhpt.c xen/arch/ia64/xen/xenmisc.c xen/arch/ia64/xen/xensetup.c xen/include/asm-ia64/config.h
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/efi.c	Mon Jul 02 10:15:37 2007 -0600
     1.2 +++ b/xen/arch/ia64/linux-xen/efi.c	Mon Jul 02 10:25:29 2007 -0600
     1.3 @@ -1013,12 +1013,9 @@ efi_memmap_init(unsigned long *s, unsign
     1.4  			continue;
     1.5  		}
     1.6  #ifdef XEN
     1.7 -// this works around a problem in the ski bootloader
     1.8 -{
     1.9 -		extern long running_on_sim;
    1.10 +		/* this works around a problem in the ski bootloader */
    1.11  		if (running_on_sim && md->type != EFI_CONVENTIONAL_MEMORY)
    1.12  			continue;
    1.13 -}
    1.14  #endif
    1.15  		if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != md->phys_addr) {
    1.16  			contig_low = GRANULEROUNDUP(md->phys_addr);
     2.1 --- a/xen/arch/ia64/xen/dom_fw_utils.c	Mon Jul 02 10:15:37 2007 -0600
     2.2 +++ b/xen/arch/ia64/xen/dom_fw_utils.c	Mon Jul 02 10:25:29 2007 -0600
     2.3 @@ -52,7 +52,6 @@ int xen_ia64_is_vcpu_allocated(struct do
     2.4  
     2.5  int xen_ia64_is_running_on_sim(struct domain *unused)
     2.6  {
     2.7 -	extern unsigned long running_on_sim;
     2.8  	return running_on_sim;
     2.9  }
    2.10  
     3.1 --- a/xen/arch/ia64/xen/domain.c	Mon Jul 02 10:15:37 2007 -0600
     3.2 +++ b/xen/arch/ia64/xen/domain.c	Mon Jul 02 10:25:29 2007 -0600
     3.3 @@ -58,8 +58,6 @@ static unsigned long __initdata dom0_siz
     3.4  static unsigned int __initdata dom0_max_vcpus = 1;
     3.5  integer_param("dom0_max_vcpus", dom0_max_vcpus); 
     3.6  
     3.7 -extern unsigned long running_on_sim;
     3.8 -
     3.9  extern char dom0_command_line[];
    3.10  
    3.11  /* forward declaration */
     4.1 --- a/xen/arch/ia64/xen/faults.c	Mon Jul 02 10:15:37 2007 -0600
     4.2 +++ b/xen/arch/ia64/xen/faults.c	Mon Jul 02 10:25:29 2007 -0600
     4.3 @@ -491,8 +491,6 @@ ia64_fault(unsigned long vector, unsigne
     4.4  	panic("Fault in Xen.\n");
     4.5  }
     4.6  
     4.7 -unsigned long running_on_sim = 0;
     4.8 -
     4.9  /* Also read in hyperprivop.S  */
    4.10  int first_break = 0;
    4.11  
     5.1 --- a/xen/arch/ia64/xen/fw_emul.c	Mon Jul 02 10:15:37 2007 -0600
     5.2 +++ b/xen/arch/ia64/xen/fw_emul.c	Mon Jul 02 10:25:29 2007 -0600
     5.3 @@ -39,8 +39,6 @@
     5.4  
     5.5  static DEFINE_SPINLOCK(efi_time_services_lock);
     5.6  
     5.7 -extern unsigned long running_on_sim;
     5.8 -
     5.9  struct sal_mc_params {
    5.10  	u64 param_type;
    5.11  	u64 i_or_m;
    5.12 @@ -142,7 +140,7 @@ sal_emulator (long index, unsigned long 
    5.13  	status = 0;
    5.14  	switch (index) {
    5.15  	    case SAL_FREQ_BASE:
    5.16 -		if (!running_on_sim)
    5.17 +		if (likely(!running_on_sim))
    5.18  			status = ia64_sal_freq_base(in1,&r9,&r10);
    5.19  		else switch (in1) {
    5.20  		      case SAL_FREQ_BASE_PLATFORM:
    5.21 @@ -594,7 +592,7 @@ xen_pal_emulator(unsigned long index, u6
    5.22  	unsigned long flags;
    5.23  	int processor;
    5.24  
    5.25 -	if (running_on_sim)
    5.26 +	if (unlikely(running_on_sim))
    5.27  		return pal_emulator_static(index);
    5.28  
    5.29  	// pal code must be mapped by a TR when pal is called, however
    5.30 @@ -1375,7 +1373,10 @@ do_ssc(unsigned long ssc, struct pt_regs
    5.31  		break;
    5.32  	    case SSC_OPEN:
    5.33  		arg1 = vcpu_get_gr(current,33);	// access rights
    5.34 -if (!running_on_sim) { printk("SSC_OPEN, not implemented on hardware.  (ignoring...)\n"); arg0 = 0; }
    5.35 +		if (!running_on_sim) { 
    5.36 +		    printk("SSC_OPEN, not implemented on hardware.  (ignoring...)\n"); 
    5.37 +		    arg0 = 0; 
    5.38 +		}
    5.39  		if (arg0) {	// metaphysical address
    5.40  			arg0 = translate_domain_mpaddr(arg0, NULL);
    5.41  			retval = ia64_ssc(arg0,arg1,0,0,ssc);
    5.42 @@ -1436,7 +1437,10 @@ if (!running_on_sim) { printk("SSC_OPEN,
    5.43  		arg1 = vcpu_get_gr(current,33);
    5.44  		arg2 = vcpu_get_gr(current,34);
    5.45  		arg3 = vcpu_get_gr(current,35);
    5.46 -		if (!running_on_sim) { printk("SSC_CONNECT_INTERRUPT, not implemented on hardware.  (ignoring...)\n"); break; }
    5.47 +		if (!running_on_sim) { 
    5.48 +		    printk("SSC_CONNECT_INTERRUPT, not implemented on hardware.  (ignoring...)\n"); 
    5.49 +		    break; 
    5.50 +		}
    5.51  		(void)ia64_ssc(arg0,arg1,arg2,arg3,ssc);
    5.52  		break;
    5.53  	    case SSC_NETDEV_PROBE:
     6.1 --- a/xen/arch/ia64/xen/vhpt.c	Mon Jul 02 10:15:37 2007 -0600
     6.2 +++ b/xen/arch/ia64/xen/vhpt.c	Mon Jul 02 10:25:29 2007 -0600
     6.3 @@ -21,8 +21,6 @@
     6.4  #include <asm/vcpumask.h>
     6.5  #include <asm/vmmu.h>
     6.6  
     6.7 -extern long running_on_sim;
     6.8 -
     6.9  DEFINE_PER_CPU (unsigned long, vhpt_paddr);
    6.10  DEFINE_PER_CPU (unsigned long, vhpt_pend);
    6.11  #ifdef CONFIG_XEN_IA64_TLBFLUSH_CLOCK
     7.1 --- a/xen/arch/ia64/xen/xenmisc.c	Mon Jul 02 10:15:37 2007 -0600
     7.2 +++ b/xen/arch/ia64/xen/xenmisc.c	Mon Jul 02 10:25:29 2007 -0600
     7.3 @@ -35,25 +35,6 @@ void hpsim_setup(char **x)
     7.4  #endif
     7.5  }
     7.6  
     7.7 -// called from mem_init... don't think s/w I/O tlb is needed in Xen
     7.8 -//void swiotlb_init(void) { }  ...looks like it IS needed
     7.9 -
    7.10 -long
    7.11 -is_platform_hp_ski(void)
    7.12 -{
    7.13 -	int i;
    7.14 -	long cpuid[6];
    7.15 -
    7.16 -	for (i = 0; i < 5; ++i)
    7.17 -		cpuid[i] = ia64_get_cpuid(i);
    7.18 -	if ((cpuid[0] & 0xff) != 'H') return 0;
    7.19 -	if ((cpuid[3] & 0xff) != 0x4) return 0;
    7.20 -	if (((cpuid[3] >> 8) & 0xff) != 0x0) return 0;
    7.21 -	if (((cpuid[3] >> 16) & 0xff) != 0x0) return 0;
    7.22 -	if (((cpuid[3] >> 24) & 0x7) != 0x7) return 0;
    7.23 -	return 1;
    7.24 -}
    7.25 -
    7.26  struct pt_regs *guest_cpu_user_regs(void) { return vcpu_regs(current); }
    7.27  
    7.28  ///////////////////////////////
     8.1 --- a/xen/arch/ia64/xen/xensetup.c	Mon Jul 02 10:15:37 2007 -0600
     8.2 +++ b/xen/arch/ia64/xen/xensetup.c	Mon Jul 02 10:25:29 2007 -0600
     8.3 @@ -7,7 +7,6 @@
     8.4  #include <xen/config.h>
     8.5  #include <xen/lib.h>
     8.6  #include <xen/errno.h>
     8.7 -//#include <xen/spinlock.h>
     8.8  #include <xen/multiboot.h>
     8.9  #include <xen/sched.h>
    8.10  #include <xen/mm.h>
    8.11 @@ -43,7 +42,6 @@ extern unsigned long domain0_ready;
    8.12  int find_max_pfn (unsigned long, unsigned long, void *);
    8.13  
    8.14  /* FIXME: which header these declarations should be there ? */
    8.15 -extern long is_platform_hp_ski(void);
    8.16  extern void early_setup_arch(char **);
    8.17  extern void late_setup_arch(char **);
    8.18  extern void hpsim_serial_init(void);
    8.19 @@ -84,7 +82,6 @@ boolean_param("xencons_poll", opt_xencon
    8.20   */
    8.21  unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB;
    8.22  unsigned long xenheap_size = XENHEAP_DEFAULT_SIZE;
    8.23 -extern long running_on_sim;
    8.24  unsigned long xen_pstart;
    8.25  void *xen_pickle_offset __read_mostly;
    8.26  
    8.27 @@ -255,6 +252,31 @@ static void noinline init_done(void)
    8.28      startup_cpu_idle_loop();
    8.29  }
    8.30  
    8.31 +int running_on_sim;
    8.32 +
    8.33 +static int __init
    8.34 +is_platform_hp_ski(void)
    8.35 +{
    8.36 +    int i;
    8.37 +    long cpuid[6];
    8.38 +
    8.39 +    for (i = 0; i < 5; ++i)
    8.40 +        cpuid[i] = ia64_get_cpuid(i);
    8.41 +
    8.42 +    if ((cpuid[0] & 0xff) != 'H')
    8.43 +        return 0;
    8.44 +    if ((cpuid[3] & 0xff) != 0x4)
    8.45 +        return 0;
    8.46 +    if (((cpuid[3] >> 8) & 0xff) != 0x0)
    8.47 +        return 0;
    8.48 +    if (((cpuid[3] >> 16) & 0xff) != 0x0)
    8.49 +        return 0;
    8.50 +    if (((cpuid[3] >> 24) & 0x7) != 0x7)
    8.51 +        return 0;
    8.52 +
    8.53 +    return 1;
    8.54 +}
    8.55 +
    8.56  void __init start_kernel(void)
    8.57  {
    8.58      char *cmdline;
    8.59 @@ -273,10 +295,11 @@ void __init start_kernel(void)
    8.60      /* Be sure the struct shared_info size is <= XSI_SIZE.  */
    8.61      BUILD_BUG_ON(sizeof(struct shared_info) > XSI_SIZE);
    8.62  
    8.63 -    running_on_sim = is_platform_hp_ski();
    8.64      /* Kernel may be relocated by EFI loader */
    8.65      xen_pstart = ia64_tpa(KERNEL_START);
    8.66  
    8.67 +    running_on_sim = is_platform_hp_ski();
    8.68 +
    8.69      early_setup_arch(&cmdline);
    8.70  
    8.71      /* We initialise the serial devices very early so we can get debugging. */
     9.1 --- a/xen/include/asm-ia64/config.h	Mon Jul 02 10:15:37 2007 -0600
     9.2 +++ b/xen/include/asm-ia64/config.h	Mon Jul 02 10:25:29 2007 -0600
     9.3 @@ -84,9 +84,12 @@ typedef unsigned long paddr_t;
     9.4  #define LOCK_PREFIX
     9.5  
     9.6  extern unsigned long xenheap_phys_end;
     9.7 +extern unsigned long total_pages;
     9.8  extern unsigned long xen_pstart;
     9.9  extern unsigned long xenheap_size;
    9.10  
    9.11 +extern int running_on_sim;
    9.12 +
    9.13  // from linux/include/linux/mm.h
    9.14  extern struct page_info *mem_map;
    9.15