[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [IA64] Cleanup: Move is_platform_hp_ski() from xenmisc.c to xensetup.c



# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1183393529 21600
# Node ID cbf749e9961f3af319acae821f56cb0d6c01a408
# Parent  baffe3497542530af293facbdd38dc9053a4f869
[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@xxxxxx>
---
 xen/arch/ia64/linux-xen/efi.c    |    5 +----
 xen/arch/ia64/xen/dom_fw_utils.c |    1 -
 xen/arch/ia64/xen/domain.c       |    2 --
 xen/arch/ia64/xen/faults.c       |    2 --
 xen/arch/ia64/xen/fw_emul.c      |   16 ++++++++++------
 xen/arch/ia64/xen/vhpt.c         |    2 --
 xen/arch/ia64/xen/xenmisc.c      |   19 -------------------
 xen/arch/ia64/xen/xensetup.c     |   31 +++++++++++++++++++++++++++----
 xen/include/asm-ia64/config.h    |    3 +++
 9 files changed, 41 insertions(+), 40 deletions(-)

diff -r baffe3497542 -r cbf749e9961f xen/arch/ia64/linux-xen/efi.c
--- a/xen/arch/ia64/linux-xen/efi.c     Mon Jul 02 10:15:37 2007 -0600
+++ b/xen/arch/ia64/linux-xen/efi.c     Mon Jul 02 10:25:29 2007 -0600
@@ -1013,12 +1013,9 @@ efi_memmap_init(unsigned long *s, unsign
                        continue;
                }
 #ifdef XEN
-// this works around a problem in the ski bootloader
-{
-               extern long running_on_sim;
+               /* this works around a problem in the ski bootloader */
                if (running_on_sim && md->type != EFI_CONVENTIONAL_MEMORY)
                        continue;
-}
 #endif
                if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != 
md->phys_addr) {
                        contig_low = GRANULEROUNDUP(md->phys_addr);
diff -r baffe3497542 -r cbf749e9961f xen/arch/ia64/xen/dom_fw_utils.c
--- a/xen/arch/ia64/xen/dom_fw_utils.c  Mon Jul 02 10:15:37 2007 -0600
+++ b/xen/arch/ia64/xen/dom_fw_utils.c  Mon Jul 02 10:25:29 2007 -0600
@@ -52,7 +52,6 @@ int xen_ia64_is_vcpu_allocated(struct do
 
 int xen_ia64_is_running_on_sim(struct domain *unused)
 {
-       extern unsigned long running_on_sim;
        return running_on_sim;
 }
 
diff -r baffe3497542 -r cbf749e9961f xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Mon Jul 02 10:15:37 2007 -0600
+++ b/xen/arch/ia64/xen/domain.c        Mon Jul 02 10:25:29 2007 -0600
@@ -57,8 +57,6 @@ static unsigned long __initdata dom0_siz
 /* dom0_max_vcpus: maximum number of VCPUs to create for dom0.  */
 static unsigned int __initdata dom0_max_vcpus = 1;
 integer_param("dom0_max_vcpus", dom0_max_vcpus); 
-
-extern unsigned long running_on_sim;
 
 extern char dom0_command_line[];
 
diff -r baffe3497542 -r cbf749e9961f xen/arch/ia64/xen/faults.c
--- a/xen/arch/ia64/xen/faults.c        Mon Jul 02 10:15:37 2007 -0600
+++ b/xen/arch/ia64/xen/faults.c        Mon Jul 02 10:25:29 2007 -0600
@@ -491,8 +491,6 @@ ia64_fault(unsigned long vector, unsigne
        panic("Fault in Xen.\n");
 }
 
-unsigned long running_on_sim = 0;
-
 /* Also read in hyperprivop.S  */
 int first_break = 0;
 
diff -r baffe3497542 -r cbf749e9961f xen/arch/ia64/xen/fw_emul.c
--- a/xen/arch/ia64/xen/fw_emul.c       Mon Jul 02 10:15:37 2007 -0600
+++ b/xen/arch/ia64/xen/fw_emul.c       Mon Jul 02 10:25:29 2007 -0600
@@ -38,8 +38,6 @@
 #include <xen/time.h>
 
 static DEFINE_SPINLOCK(efi_time_services_lock);
-
-extern unsigned long running_on_sim;
 
 struct sal_mc_params {
        u64 param_type;
@@ -142,7 +140,7 @@ sal_emulator (long index, unsigned long 
        status = 0;
        switch (index) {
            case SAL_FREQ_BASE:
-               if (!running_on_sim)
+               if (likely(!running_on_sim))
                        status = ia64_sal_freq_base(in1,&r9,&r10);
                else switch (in1) {
                      case SAL_FREQ_BASE_PLATFORM:
@@ -594,7 +592,7 @@ xen_pal_emulator(unsigned long index, u6
        unsigned long flags;
        int processor;
 
-       if (running_on_sim)
+       if (unlikely(running_on_sim))
                return pal_emulator_static(index);
 
        // pal code must be mapped by a TR when pal is called, however
@@ -1375,7 +1373,10 @@ do_ssc(unsigned long ssc, struct pt_regs
                break;
            case SSC_OPEN:
                arg1 = vcpu_get_gr(current,33); // access rights
-if (!running_on_sim) { printk("SSC_OPEN, not implemented on hardware.  
(ignoring...)\n"); arg0 = 0; }
+               if (!running_on_sim) { 
+                   printk("SSC_OPEN, not implemented on hardware.  
(ignoring...)\n"); 
+                   arg0 = 0; 
+               }
                if (arg0) {     // metaphysical address
                        arg0 = translate_domain_mpaddr(arg0, NULL);
                        retval = ia64_ssc(arg0,arg1,0,0,ssc);
@@ -1436,7 +1437,10 @@ if (!running_on_sim) { printk("SSC_OPEN,
                arg1 = vcpu_get_gr(current,33);
                arg2 = vcpu_get_gr(current,34);
                arg3 = vcpu_get_gr(current,35);
-               if (!running_on_sim) { printk("SSC_CONNECT_INTERRUPT, not 
implemented on hardware.  (ignoring...)\n"); break; }
+               if (!running_on_sim) { 
+                   printk("SSC_CONNECT_INTERRUPT, not implemented on hardware. 
 (ignoring...)\n"); 
+                   break; 
+               }
                (void)ia64_ssc(arg0,arg1,arg2,arg3,ssc);
                break;
            case SSC_NETDEV_PROBE:
diff -r baffe3497542 -r cbf749e9961f xen/arch/ia64/xen/vhpt.c
--- a/xen/arch/ia64/xen/vhpt.c  Mon Jul 02 10:15:37 2007 -0600
+++ b/xen/arch/ia64/xen/vhpt.c  Mon Jul 02 10:25:29 2007 -0600
@@ -20,8 +20,6 @@
 #include <asm/vcpu.h>
 #include <asm/vcpumask.h>
 #include <asm/vmmu.h>
-
-extern long running_on_sim;
 
 DEFINE_PER_CPU (unsigned long, vhpt_paddr);
 DEFINE_PER_CPU (unsigned long, vhpt_pend);
diff -r baffe3497542 -r cbf749e9961f xen/arch/ia64/xen/xenmisc.c
--- a/xen/arch/ia64/xen/xenmisc.c       Mon Jul 02 10:15:37 2007 -0600
+++ b/xen/arch/ia64/xen/xenmisc.c       Mon Jul 02 10:25:29 2007 -0600
@@ -33,25 +33,6 @@ void hpsim_setup(char **x)
 #ifdef CONFIG_SMP
        init_smp_config();
 #endif
-}
-
-// called from mem_init... don't think s/w I/O tlb is needed in Xen
-//void swiotlb_init(void) { }  ...looks like it IS needed
-
-long
-is_platform_hp_ski(void)
-{
-       int i;
-       long cpuid[6];
-
-       for (i = 0; i < 5; ++i)
-               cpuid[i] = ia64_get_cpuid(i);
-       if ((cpuid[0] & 0xff) != 'H') return 0;
-       if ((cpuid[3] & 0xff) != 0x4) return 0;
-       if (((cpuid[3] >> 8) & 0xff) != 0x0) return 0;
-       if (((cpuid[3] >> 16) & 0xff) != 0x0) return 0;
-       if (((cpuid[3] >> 24) & 0x7) != 0x7) return 0;
-       return 1;
 }
 
 struct pt_regs *guest_cpu_user_regs(void) { return vcpu_regs(current); }
diff -r baffe3497542 -r cbf749e9961f xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c      Mon Jul 02 10:15:37 2007 -0600
+++ b/xen/arch/ia64/xen/xensetup.c      Mon Jul 02 10:25:29 2007 -0600
@@ -7,7 +7,6 @@
 #include <xen/config.h>
 #include <xen/lib.h>
 #include <xen/errno.h>
-//#include <xen/spinlock.h>
 #include <xen/multiboot.h>
 #include <xen/sched.h>
 #include <xen/mm.h>
@@ -43,7 +42,6 @@ int find_max_pfn (unsigned long, unsigne
 int find_max_pfn (unsigned long, unsigned long, void *);
 
 /* FIXME: which header these declarations should be there ? */
-extern long is_platform_hp_ski(void);
 extern void early_setup_arch(char **);
 extern void late_setup_arch(char **);
 extern void hpsim_serial_init(void);
@@ -84,7 +82,6 @@ boolean_param("xencons_poll", opt_xencon
  */
 unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB;
 unsigned long xenheap_size = XENHEAP_DEFAULT_SIZE;
-extern long running_on_sim;
 unsigned long xen_pstart;
 void *xen_pickle_offset __read_mostly;
 
@@ -255,6 +252,31 @@ static void noinline init_done(void)
     startup_cpu_idle_loop();
 }
 
+int running_on_sim;
+
+static int __init
+is_platform_hp_ski(void)
+{
+    int i;
+    long cpuid[6];
+
+    for (i = 0; i < 5; ++i)
+        cpuid[i] = ia64_get_cpuid(i);
+
+    if ((cpuid[0] & 0xff) != 'H')
+        return 0;
+    if ((cpuid[3] & 0xff) != 0x4)
+        return 0;
+    if (((cpuid[3] >> 8) & 0xff) != 0x0)
+        return 0;
+    if (((cpuid[3] >> 16) & 0xff) != 0x0)
+        return 0;
+    if (((cpuid[3] >> 24) & 0x7) != 0x7)
+        return 0;
+
+    return 1;
+}
+
 void __init start_kernel(void)
 {
     char *cmdline;
@@ -273,9 +295,10 @@ void __init start_kernel(void)
     /* Be sure the struct shared_info size is <= XSI_SIZE.  */
     BUILD_BUG_ON(sizeof(struct shared_info) > XSI_SIZE);
 
-    running_on_sim = is_platform_hp_ski();
     /* Kernel may be relocated by EFI loader */
     xen_pstart = ia64_tpa(KERNEL_START);
+
+    running_on_sim = is_platform_hp_ski();
 
     early_setup_arch(&cmdline);
 
diff -r baffe3497542 -r cbf749e9961f xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h     Mon Jul 02 10:15:37 2007 -0600
+++ b/xen/include/asm-ia64/config.h     Mon Jul 02 10:25:29 2007 -0600
@@ -84,8 +84,11 @@ typedef unsigned long paddr_t;
 #define LOCK_PREFIX
 
 extern unsigned long xenheap_phys_end;
+extern unsigned long total_pages;
 extern unsigned long xen_pstart;
 extern unsigned long xenheap_size;
+
+extern int running_on_sim;
 
 // from linux/include/linux/mm.h
 extern struct page_info *mem_map;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.