ia64/xen-unstable

changeset 7735:d0a2b36f72f2

Integration of the xen4xlilo patch. (by Tristan Gingold)
It is now backward compatible: works with the old elilo.
author djm@kirby.fc.hp.com
date Thu Nov 17 07:21:18 2005 -0600 (2005-11-17)
parents 8c42a46de7f8
children ea1214123c2f
files xen/arch/ia64/xen/dom_fw.c xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/xensetup.c xen/include/asm-ia64/linux-xen/asm/system.h
line diff
     1.1 --- a/xen/arch/ia64/xen/dom_fw.c	Wed Nov 16 18:40:24 2005 -0600
     1.2 +++ b/xen/arch/ia64/xen/dom_fw.c	Thu Nov 17 07:21:18 2005 -0600
     1.3 @@ -686,6 +686,12 @@ dom_fw_init (struct domain *d, char *arg
     1.4  	bp->console_info.orig_x = 0;
     1.5  	bp->console_info.orig_y = 24;
     1.6  	bp->fpswa = 0;
     1.7 +        bp->initrd_start = (dom0_start+dom0_size) -
     1.8 +                (PAGE_ALIGN(ia64_boot_param->initrd_size) + 4*1024*1024);
     1.9 +        bp->initrd_size = ia64_boot_param->initrd_size;
    1.10 +                printf(" initrd start %0xlx", bp->initrd_start);
    1.11 +                printf(" initrd size %0xlx", bp->initrd_size);
    1.12 +
    1.13  
    1.14  	return bp;
    1.15  }
     2.1 --- a/xen/arch/ia64/xen/domain.c	Wed Nov 16 18:40:24 2005 -0600
     2.2 +++ b/xen/arch/ia64/xen/domain.c	Thu Nov 17 07:21:18 2005 -0600
     2.3 @@ -823,6 +823,7 @@ int construct_dom0(struct domain *d,
     2.4  	unsigned long pkern_start;
     2.5  	unsigned long pkern_entry;
     2.6  	unsigned long pkern_end;
     2.7 +	unsigned long pinitrd_start = 0;
     2.8  	unsigned long ret, progress = 0;
     2.9  
    2.10  //printf("construct_dom0: starting\n");
    2.11 @@ -841,12 +842,6 @@ int construct_dom0(struct domain *d,
    2.12  	alloc_start = dom0_start;
    2.13  	alloc_end = dom0_start + dom0_size;
    2.14  	d->tot_pages = d->max_pages = dom0_size/PAGE_SIZE;
    2.15 -	image_start = __va(ia64_boot_param->initrd_start);
    2.16 -	image_len = ia64_boot_param->initrd_size;
    2.17 -//printk("image_start=%lx, image_len=%lx\n",image_start,image_len);
    2.18 -//printk("First word of image: %lx\n",*(unsigned long *)image_start);
    2.19 -
    2.20 -//printf("construct_dom0: about to call parseelfimage\n");
    2.21  	dsi.image_addr = (unsigned long)image_start;
    2.22  	dsi.image_len  = image_len;
    2.23  	rc = parseelfimage(&dsi);
    2.24 @@ -883,11 +878,18 @@ int construct_dom0(struct domain *d,
    2.25  	    return -EINVAL;
    2.26  	}
    2.27  
    2.28 +        if(initrd_start&&initrd_len){
    2.29 +             pinitrd_start=(dom0_start+dom0_size) -
    2.30 +                          (PAGE_ALIGN(initrd_len) + 4*1024*1024);
    2.31 +
    2.32 +             memcpy(__va(pinitrd_start),initrd_start,initrd_len);
    2.33 +        }
    2.34 +
    2.35  	printk("METAPHYSICAL MEMORY ARRANGEMENT:\n"
    2.36  	       " Kernel image:  %lx->%lx\n"
    2.37  	       " Entry address: %lx\n"
    2.38 -	       " Init. ramdisk:   (NOT IMPLEMENTED YET)\n",
    2.39 -	       pkern_start, pkern_end, pkern_entry);
    2.40 +               " Init. ramdisk: %lx len %lx\n",
    2.41 +               pkern_start, pkern_end, pkern_entry, pinitrd_start, initrd_len);
    2.42  
    2.43  	if ( (pkern_end - pkern_start) > (d->max_pages * PAGE_SIZE) )
    2.44  	{
     3.1 --- a/xen/arch/ia64/xen/xensetup.c	Wed Nov 16 18:40:24 2005 -0600
     3.2 +++ b/xen/arch/ia64/xen/xensetup.c	Thu Nov 17 07:21:18 2005 -0600
     3.3 @@ -153,7 +153,8 @@ void start_kernel(void)
     3.4      void *heap_start;
     3.5      int i;
     3.6      unsigned long max_mem, nr_pages, firsthole_start;
     3.7 -    unsigned long dom0_memory_start, dom0_memory_end;
     3.8 +    unsigned long dom0_memory_start, dom0_memory_size;
     3.9 +    unsigned long dom0_initrd_start, dom0_initrd_size;
    3.10      unsigned long initial_images_start, initial_images_end;
    3.11  
    3.12      running_on_sim = is_platform_hp_ski();
    3.13 @@ -190,8 +191,30 @@ void start_kernel(void)
    3.14      firsthole_start = 0;
    3.15      efi_memmap_walk(xen_find_first_hole, &firsthole_start);
    3.16  
    3.17 +    if (ia64_boot_param->domain_start == 0
    3.18 +	|| ia64_boot_param->domain_size == 0) {
    3.19 +	    /* This is possible only with the old elilo, which does not support
    3.20 +	       a vmm.  Fix now, and continue without initrd.  */
    3.21 +	    printk ("Your elilo is not Xen-aware.  Bootparams fixed\n");
    3.22 +	    ia64_boot_param->domain_start = ia64_boot_param->initrd_start;
    3.23 +	    ia64_boot_param->domain_size = ia64_boot_param->initrd_size;
    3.24 +	    ia64_boot_param->initrd_start = 0;
    3.25 +	    ia64_boot_param->initrd_size = 0;
    3.26 +    }
    3.27 +
    3.28      initial_images_start = xenheap_phys_end;
    3.29 -    initial_images_end = initial_images_start + ia64_boot_param->initrd_size;
    3.30 +    initial_images_end = initial_images_start +
    3.31 +       PAGE_ALIGN(ia64_boot_param->domain_size);
    3.32 +
    3.33 +    /* also reserve space for initrd */
    3.34 +    if (ia64_boot_param->initrd_start && ia64_boot_param->initrd_size)
    3.35 +       initial_images_end += PAGE_ALIGN(ia64_boot_param->initrd_size);
    3.36 +    else {
    3.37 +       /* sanity cleanup */
    3.38 +       ia64_boot_param->initrd_size = 0;
    3.39 +       ia64_boot_param->initrd_start = 0;
    3.40 +    }
    3.41 +
    3.42  
    3.43      /* Later may find another memory trunk, even away from xen image... */
    3.44      if (initial_images_end > firsthole_start) {
    3.45 @@ -203,11 +226,21 @@ void start_kernel(void)
    3.46  
    3.47      /* This copy is time consuming, but elilo may load Dom0 image
    3.48       * within xenheap range */
    3.49 -    printk("ready to move Dom0 to 0x%lx...", initial_images_start);
    3.50 +    printk("ready to move Dom0 to 0x%lx with len %lx...", initial_images_start,
    3.51 +          ia64_boot_param->domain_size);
    3.52 +
    3.53      memmove(__va(initial_images_start),
    3.54 +          __va(ia64_boot_param->domain_start),
    3.55 +          ia64_boot_param->domain_size);
    3.56 +//    ia64_boot_param->domain_start = initial_images_start;
    3.57 +
    3.58 +    printk("ready to move initrd to 0x%lx with len %lx...",
    3.59 +          initial_images_start+PAGE_ALIGN(ia64_boot_param->domain_size),
    3.60 +          ia64_boot_param->initrd_size);
    3.61 +    memmove(__va(initial_images_start+PAGE_ALIGN(ia64_boot_param->domain_size)),
    3.62 +
    3.63  	   __va(ia64_boot_param->initrd_start),
    3.64  	   ia64_boot_param->initrd_size);
    3.65 -    ia64_boot_param->initrd_start = initial_images_start;
    3.66      printk("Done\n");
    3.67  
    3.68      /* first find highest page frame number */
    3.69 @@ -329,13 +362,16 @@ printk("About to call do_createdomain()\
    3.70       * We're going to setup domain0 using the module(s) that we stashed safely
    3.71       * above our heap. The second module, if present, is an initrd ramdisk.
    3.72       */
    3.73 -printk("About to call construct_dom0()\n");
    3.74 -    dom0_memory_start = __va(ia64_boot_param->initrd_start);
    3.75 -    dom0_memory_end = ia64_boot_param->initrd_size;
    3.76 -    if ( construct_dom0(dom0, dom0_memory_start, dom0_memory_end,
    3.77 -			0,
    3.78 -                        0,
    3.79 -			0) != 0)
    3.80 +    printk("About to call construct_dom0()\n");
    3.81 +    dom0_memory_start = __va(initial_images_start);
    3.82 +    dom0_memory_size = ia64_boot_param->domain_size;
    3.83 +    dom0_initrd_start = __va(initial_images_start +
    3.84 +			     PAGE_ALIGN(ia64_boot_param->domain_size));
    3.85 +    dom0_initrd_size = ia64_boot_param->initrd_size;
    3.86 + 
    3.87 +    if ( construct_dom0(dom0, dom0_memory_start, dom0_memory_size,
    3.88 +                        dom0_initrd_start,dom0_initrd_size,
    3.89 +  			0) != 0)
    3.90          panic("Could not set up DOM0 guest OS\n");
    3.91  
    3.92      /* PIN domain0 on CPU 0.  */
    3.93 @@ -345,22 +381,28 @@ printk("About to call construct_dom0()\n
    3.94  #ifdef CLONE_DOMAIN0
    3.95      {
    3.96      int i;
    3.97 -    dom0_memory_start = __va(ia64_boot_param->initrd_start);
    3.98 -    dom0_memory_end = ia64_boot_param->initrd_size;
    3.99 +    dom0_memory_start = __va(ia64_boot_param->domain_start);
   3.100 +    dom0_memory_size = ia64_boot_param->domain_size;
   3.101 +
   3.102      for (i = 0; i < CLONE_DOMAIN0; i++) {
   3.103 -printk("CONSTRUCTING DOMAIN0 CLONE #%d\n",i+1);
   3.104 -        if ( construct_domU(clones[i], dom0_memory_start, dom0_memory_end,
   3.105 -                        0, 
   3.106 -                        0,
   3.107 -			0) != 0)
   3.108 +      printk("CONSTRUCTING DOMAIN0 CLONE #%d\n",i+1);
   3.109 +      if ( construct_domU(clones[i], dom0_memory_start, dom0_memory_size,
   3.110 +			  dom0_initrd_start,dom0_initrd_size,
   3.111 +			  0) != 0)
   3.112              panic("Could not set up DOM0 clone %d\n",i);
   3.113      }
   3.114      }
   3.115  #endif
   3.116  
   3.117      /* The stash space for the initial kernel image can now be freed up. */
   3.118 -    init_domheap_pages(ia64_boot_param->initrd_start,
   3.119 -		       ia64_boot_param->initrd_start + ia64_boot_param->initrd_size);
   3.120 +    init_domheap_pages(ia64_boot_param->domain_start,
   3.121 +                       ia64_boot_param->domain_size);
   3.122 +    /* throw away initrd area passed from elilo */
   3.123 +    if (ia64_boot_param->initrd_size) {
   3.124 +        init_domheap_pages(ia64_boot_param->initrd_start,
   3.125 +                          ia64_boot_param->initrd_size);
   3.126 +    }
   3.127 +
   3.128      if (!running_on_sim)  // slow on ski and pages are pre-initialized to zero
   3.129  	scrub_heap_pages();
   3.130  
     4.1 --- a/xen/include/asm-ia64/linux-xen/asm/system.h	Wed Nov 16 18:40:24 2005 -0600
     4.2 +++ b/xen/include/asm-ia64/linux-xen/asm/system.h	Thu Nov 17 07:21:18 2005 -0600
     4.3 @@ -56,6 +56,10 @@ extern struct ia64_boot_param {
     4.4  	__u64 fpswa;		/* physical address of the fpswa interface */
     4.5  	__u64 initrd_start;
     4.6  	__u64 initrd_size;
     4.7 +//for loading initrd for dom0
     4.8 +       __u64 domain_start;     /* virtual address where the boot time domain begins */
     4.9 +       __u64 domain_size;      /* how big is the boot domain */
    4.10 +
    4.11  } *ia64_boot_param;
    4.12  
    4.13  /*