WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

[Xen-ia64-devel] [PATCH] Cleanup: Move is_platform_hp_ski() from xenmisc

To: Alex Williamson <alex.williamson@xxxxxx>
Subject: [Xen-ia64-devel] [PATCH] Cleanup: Move is_platform_hp_ski() from xenmisc.c to xensetup.c
From: Aron Griffis <aron@xxxxxx>
Date: Mon, 02 Jul 2007 10:23:21 -0400
Cc: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 02 Jul 2007 09:51:00 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
- 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>

diff -r 8a6a6d4afcb3 -r 28000afb4487 xen/arch/ia64/linux-xen/efi.c
--- a/xen/arch/ia64/linux-xen/efi.c     Fri Jun 22 11:48:49 2007 -0600
+++ b/xen/arch/ia64/linux-xen/efi.c     Mon Jul 02 10:22:46 2007 -0400
@@ -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 8a6a6d4afcb3 -r 28000afb4487 xen/arch/ia64/xen/dom_fw_utils.c
--- a/xen/arch/ia64/xen/dom_fw_utils.c  Fri Jun 22 11:48:49 2007 -0600
+++ b/xen/arch/ia64/xen/dom_fw_utils.c  Mon Jul 02 10:22:46 2007 -0400
@@ -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 8a6a6d4afcb3 -r 28000afb4487 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Fri Jun 22 11:48:49 2007 -0600
+++ b/xen/arch/ia64/xen/domain.c        Mon Jul 02 10:22:46 2007 -0400
@@ -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 8a6a6d4afcb3 -r 28000afb4487 xen/arch/ia64/xen/faults.c
--- a/xen/arch/ia64/xen/faults.c        Fri Jun 22 11:48:49 2007 -0600
+++ b/xen/arch/ia64/xen/faults.c        Mon Jul 02 10:22:46 2007 -0400
@@ -488,8 +488,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 8a6a6d4afcb3 -r 28000afb4487 xen/arch/ia64/xen/fw_emul.c
--- a/xen/arch/ia64/xen/fw_emul.c       Fri Jun 22 11:48:49 2007 -0600
+++ b/xen/arch/ia64/xen/fw_emul.c       Mon Jul 02 10:22:46 2007 -0400
@@ -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 8a6a6d4afcb3 -r 28000afb4487 xen/arch/ia64/xen/vhpt.c
--- a/xen/arch/ia64/xen/vhpt.c  Fri Jun 22 11:48:49 2007 -0600
+++ b/xen/arch/ia64/xen/vhpt.c  Mon Jul 02 10:22:46 2007 -0400
@@ -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 8a6a6d4afcb3 -r 28000afb4487 xen/arch/ia64/xen/xenmisc.c
--- a/xen/arch/ia64/xen/xenmisc.c       Fri Jun 22 11:48:49 2007 -0600
+++ b/xen/arch/ia64/xen/xenmisc.c       Mon Jul 02 10:22:46 2007 -0400
@@ -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 8a6a6d4afcb3 -r 28000afb4487 xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c      Fri Jun 22 11:48:49 2007 -0600
+++ b/xen/arch/ia64/xen/xensetup.c      Mon Jul 02 10:22:46 2007 -0400
@@ -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,23 @@ 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 +287,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 8a6a6d4afcb3 -r 28000afb4487 xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h     Fri Jun 22 11:48:49 2007 -0600
+++ b/xen/include/asm-ia64/config.h     Mon Jul 02 10:22:46 2007 -0400
@@ -81,8 +81,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-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel