ia64/xen-unstable

changeset 8380:85261a82e02c

diff -r 545ba1b126ca tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c Tue Dec 20 20:11:17 2005
+++ b/tools/libxc/xc_linux_build.c Wed Dec 21 11:50:08 2005
@@ -296,9 +296,13 @@
unsigned long *page_array = NULL;
struct load_funcs load_funcs;
struct domain_setup_info dsi;
+ unsigned long vinitrd_start;
+ unsigned long vinitrd_end;
+ unsigned long v_end;
unsigned long start_page, pgnr;
start_info_t *start_info;
int rc;
+ unsigned long i;

rc = probeimageformat(image, image_size, &load_funcs);
if ( rc != 0 )
@@ -310,11 +314,13 @@
if ( rc != 0 )
goto error_out;

- dsi.v_start = round_pgdown(dsi.v_start);
- dsi.v_end = round_pgup(dsi.v_end);
+ dsi.v_start = round_pgdown(dsi.v_start);
+ vinitrd_start = round_pgup(dsi.v_end);
+ vinitrd_end = vinitrd_start + initrd_len;
+ v_end = round_pgup(vinitrd_end);

start_page = dsi.v_start >> PAGE_SHIFT;
- pgnr = (dsi.v_end - dsi.v_start) >> PAGE_SHIFT;
+ pgnr = (v_end - dsi.v_start) >> PAGE_SHIFT;
if ( (page_array = malloc(pgnr * sizeof(unsigned long))) == NULL )
{
PERROR("Could not allocate memory");
@@ -326,9 +332,38 @@
PERROR("Could not get the page frame list");
goto error_out;
}
+
+#define _p(a) ((void *) (a))
+
+ printf("VIRTUAL MEMORY ARRANGEMENT:\n"
+ " Loaded kernel: %p->%p\n"
+ " Init. ramdisk: %p->%p\n"
+ " TOTAL: %p->%p\n",
+ _p(dsi.v_kernstart), _p(dsi.v_kernend),
+ _p(vinitrd_start), _p(vinitrd_end),
+ _p(dsi.v_start), _p(v_end));
+ printf(" ENTRY ADDRESS: %p\n", _p(dsi.v_kernentry));

(load_funcs.loadimage)(image, image_size, xc_handle, dom, page_array,
&dsi);
+
+ /* Load the initial ramdisk image. */
+ if ( initrd_len != 0 )
+ {
+ for ( i = (vinitrd_start - dsi.v_start);
+ i < (vinitrd_end - dsi.v_start); i += PAGE_SIZE )
+ {
+ char page[PAGE_SIZE];
+ if ( gzread(initrd_gfd, page, PAGE_SIZE) == -1 )
+ {
+ PERROR("Error reading initrd image, could not");
+ goto error_out;
+ }
+ xc_copy_to_domain_page(xc_handle, dom,
+ page_array[i>>PAGE_SHIFT], page);
+ }
+ }
+

*pvke = dsi.v_kernentry;

@@ -358,6 +393,13 @@
start_info->store_evtchn = store_evtchn;
start_info->console_mfn = nr_pages - 1;
start_info->console_evtchn = console_evtchn;
+ if ( initrd_len != 0 )
+ {
+ ctxt->initrd.start = vinitrd_start;
+ ctxt->initrd.size = initrd_len;
+ }
+ strncpy((char *)ctxt->cmdline, cmdline, IA64_COMMAND_LINE_SIZE);
+ ctxt->cmdline[IA64_COMMAND_LINE_SIZE-1] = '\0';
munmap(start_info, PAGE_SIZE);

free(page_array);
diff -r 545ba1b126ca xen/arch/ia64/xen/dom_fw.c
--- a/xen/arch/ia64/xen/dom_fw.c Tue Dec 20 20:11:17 2005
+++ b/xen/arch/ia64/xen/dom_fw.c Wed Dec 21 11:50:08 2005
@@ -861,9 +861,14 @@
bp->console_info.orig_x = 0;
bp->console_info.orig_y = 24;
bp->fpswa = 0;
- bp->initrd_start = (dom0_start+dom0_size) -
- (PAGE_ALIGN(ia64_boot_param->initrd_size) + 4*1024*1024);
- bp->initrd_size = ia64_boot_param->initrd_size;
+ if (d == dom0){
+ bp->initrd_start = (dom0_start+dom0_size) -
+ (PAGE_ALIGN(ia64_boot_param->initrd_size) + 4*1024*1024);
+ bp->initrd_size = ia64_boot_param->initrd_size;
+ }else{
+ bp->initrd_start = d->arch.initrd_start;
+ bp->initrd_size = d->arch.initrd_len;
+ }
printf(" initrd start %0xlx", bp->initrd_start);
printf(" initrd size %0xlx", bp->initrd_size);

diff -r 545ba1b126ca xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c Tue Dec 20 20:11:17 2005
+++ b/xen/arch/ia64/xen/domain.c Wed Dec 21 11:50:08 2005
@@ -297,6 +297,9 @@

*regs = c->regs;
d->arch.sys_pgnr = c->sys_pgnr;
+ d->arch.initrd_start = c->initrd.start;
+ d->arch.initrd_len = c->initrd.size;
+ d->arch.cmdline = c->cmdline;
new_thread(v, regs->cr_iip, 0, 0);

v->vcpu_info->arch.evtchn_vector = c->vcpu.evtchn_vector;
@@ -365,7 +368,7 @@
regs->r28 = dom_fw_setup(d,saved_command_line,256L);
else {
regs->ar_rsc |= (2 << 2); /* force PL2/3 */
- regs->r28 = dom_fw_setup(d,"nomca nosmp xencons=tty0 console=tty0 root=/dev/hda1",256L); //FIXME
+ regs->r28 = dom_fw_setup(d,d->arch.cmdline,256L);
}
VCPU(v, banknum) = 1;
VCPU(v, metaphysical_mode) = 1;
diff -r 545ba1b126ca xen/include/asm-ia64/domain.h
--- a/xen/include/asm-ia64/domain.h Tue Dec 20 20:11:17 2005
+++ b/xen/include/asm-ia64/domain.h Wed Dec 21 11:50:08 2005
@@ -38,6 +38,9 @@
u64 image_len;
u64 entry;
#endif
+ unsigned long initrd_start;
+ unsigned long initrd_len;
+ char *cmdline;
};
#define xen_vastart arch.xen_vastart
#define xen_vaend arch.xen_vaend
diff -r 545ba1b126ca xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h Tue Dec 20 20:11:17 2005
+++ b/xen/include/public/arch-ia64.h Wed Dec 21 11:50:08 2005
@@ -276,6 +276,12 @@
unsigned long start_info_pfn;
} arch_shared_info_t;

+typedef struct {
+ unsigned long start;
+ unsigned long size;
+} arch_initrd_info_t;
+
+#define IA64_COMMAND_LINE_SIZE 512
typedef struct vcpu_guest_context {
#define VGCF_FPU_VALID (1<<0)
#define VGCF_VMX_GUEST (1<<1)
@@ -289,6 +295,8 @@
cpu_user_regs_t regs;
arch_vcpu_info_t vcpu;
arch_shared_info_t shared;
+ arch_initrd_info_t initrd;
+ char cmdline[IA64_COMMAND_LINE_SIZE];
} vcpu_guest_context_t;

#endif /* !__ASSEMBLY__ */
author djm@kirby.fc.hp.com
date Wed Dec 21 09:07:09 2005 -0600 (2005-12-21)
parents 03ea37841682
children 724f412d81ab
files tools/libxc/xc_linux_build.c xen/arch/ia64/xen/domain.c xen/include/asm-ia64/domain.h xen/include/public/arch-ia64.h
line diff
     1.1 --- a/tools/libxc/xc_linux_build.c	Wed Dec 21 08:53:40 2005 -0600
     1.2 +++ b/tools/libxc/xc_linux_build.c	Wed Dec 21 09:07:09 2005 -0600
     1.3 @@ -296,9 +296,13 @@ static int setup_guest(int xc_handle,
     1.4      unsigned long *page_array = NULL;
     1.5      struct load_funcs load_funcs;
     1.6      struct domain_setup_info dsi;
     1.7 +    unsigned long vinitrd_start;
     1.8 +    unsigned long vinitrd_end;
     1.9 +    unsigned long v_end;
    1.10      unsigned long start_page, pgnr;
    1.11      start_info_t *start_info;
    1.12      int rc;
    1.13 +    unsigned long i;
    1.14  
    1.15      rc = probeimageformat(image, image_size, &load_funcs);
    1.16      if ( rc != 0 )
    1.17 @@ -310,11 +314,13 @@ static int setup_guest(int xc_handle,
    1.18      if ( rc != 0 )
    1.19          goto error_out;
    1.20  
    1.21 -    dsi.v_start = round_pgdown(dsi.v_start);
    1.22 -    dsi.v_end   = round_pgup(dsi.v_end);
    1.23 +    dsi.v_start      = round_pgdown(dsi.v_start);
    1.24 +    vinitrd_start    = round_pgup(dsi.v_end);
    1.25 +    vinitrd_end      = vinitrd_start + initrd_len;
    1.26 +    v_end            = round_pgup(vinitrd_end);
    1.27  
    1.28      start_page = dsi.v_start >> PAGE_SHIFT;
    1.29 -    pgnr = (dsi.v_end - dsi.v_start) >> PAGE_SHIFT;
    1.30 +    pgnr = (v_end - dsi.v_start) >> PAGE_SHIFT;
    1.31      if ( (page_array = malloc(pgnr * sizeof(unsigned long))) == NULL )
    1.32      {
    1.33          PERROR("Could not allocate memory");
    1.34 @@ -327,9 +333,38 @@ static int setup_guest(int xc_handle,
    1.35          goto error_out;
    1.36      }
    1.37  
    1.38 +#define _p(a) ((void *) (a))
    1.39 +
    1.40 +    printf("VIRTUAL MEMORY ARRANGEMENT:\n"
    1.41 +           " Loaded kernel: %p->%p\n"
    1.42 +           " Init. ramdisk: %p->%p\n"
    1.43 +           " TOTAL:         %p->%p\n",
    1.44 +           _p(dsi.v_kernstart), _p(dsi.v_kernend), 
    1.45 +           _p(vinitrd_start),   _p(vinitrd_end),
    1.46 +           _p(dsi.v_start),     _p(v_end));
    1.47 +    printf(" ENTRY ADDRESS: %p\n", _p(dsi.v_kernentry));
    1.48 +
    1.49      (load_funcs.loadimage)(image, image_size, xc_handle, dom, page_array,
    1.50                             &dsi);
    1.51  
    1.52 +    /* Load the initial ramdisk image. */
    1.53 +    if ( initrd_len != 0 )
    1.54 +    {
    1.55 +        for ( i = (vinitrd_start - dsi.v_start);
    1.56 +              i < (vinitrd_end - dsi.v_start); i += PAGE_SIZE )
    1.57 +        {
    1.58 +            char page[PAGE_SIZE];
    1.59 +            if ( gzread(initrd_gfd, page, PAGE_SIZE) == -1 )
    1.60 +            {
    1.61 +                PERROR("Error reading initrd image, could not");
    1.62 +                goto error_out;
    1.63 +            }
    1.64 +            xc_copy_to_domain_page(xc_handle, dom,
    1.65 +                                   page_array[i>>PAGE_SHIFT], page);
    1.66 +        }
    1.67 +    }
    1.68 +
    1.69 +
    1.70      *pvke = dsi.v_kernentry;
    1.71  
    1.72      /* Now need to retrieve machine pfn for system pages:
    1.73 @@ -358,6 +393,13 @@ static int setup_guest(int xc_handle,
    1.74      start_info->store_evtchn = store_evtchn;
    1.75      start_info->console_mfn   = nr_pages - 1;
    1.76      start_info->console_evtchn = console_evtchn;
    1.77 +    if ( initrd_len != 0 )
    1.78 +    {
    1.79 +        ctxt->initrd.start    = vinitrd_start;
    1.80 +        ctxt->initrd.size     = initrd_len;
    1.81 +    }
    1.82 +    strncpy((char *)ctxt->cmdline, cmdline, IA64_COMMAND_LINE_SIZE);
    1.83 +    ctxt->cmdline[IA64_COMMAND_LINE_SIZE-1] = '\0';
    1.84      munmap(start_info, PAGE_SIZE);
    1.85  
    1.86      free(page_array);
     2.1 --- a/xen/arch/ia64/xen/domain.c	Wed Dec 21 08:53:40 2005 -0600
     2.2 +++ b/xen/arch/ia64/xen/domain.c	Wed Dec 21 09:07:09 2005 -0600
     2.3 @@ -286,6 +286,9 @@ int arch_set_info_guest(struct vcpu *v, 
     2.4  
     2.5  	*regs = c->regs;
     2.6  	d->arch.sys_pgnr = c->sys_pgnr;
     2.7 +	d->arch.initrd_start = c->initrd.start;
     2.8 +	d->arch.initrd_len   = c->initrd.size;
     2.9 +	d->arch.cmdline      = c->cmdline;
    2.10  	new_thread(v, regs->cr_iip, 0, 0);
    2.11  
    2.12  #ifdef CONFIG_IA64_SPLIT_CACHE
    2.13 @@ -364,6 +367,9 @@ void new_thread(struct vcpu *v,
    2.14  		    regs->r28 = dom_fw_setup(d,saved_command_line,256L);
    2.15  		else {
    2.16  		    regs->ar_rsc |= (2 << 2); /* force PL2/3 */
    2.17 +		    //regs->r28 = dom_fw_setup(d,d->arch.cmdline,256L);
    2.18 +printf("construct domU: d->arch.cmdline=%p, firstchar=%d\n",
    2.19 +d->arch.cmdline,*(d->arch.cmdline));
    2.20  		    regs->r28 = dom_fw_setup(d,"nomca nosmp xencons=tty0 console=tty0 root=/dev/hda1",256L);  //FIXME
    2.21  		}
    2.22  		VCPU(v, banknum) = 1;
     3.1 --- a/xen/include/asm-ia64/domain.h	Wed Dec 21 08:53:40 2005 -0600
     3.2 +++ b/xen/include/asm-ia64/domain.h	Wed Dec 21 09:07:09 2005 -0600
     3.3 @@ -38,6 +38,9 @@ struct arch_domain {
     3.4      u64 image_len;
     3.5      u64 entry;
     3.6  #endif
     3.7 +    unsigned long initrd_start;
     3.8 +    unsigned long initrd_len;
     3.9 +    char *cmdline;
    3.10  };
    3.11  #define xen_vastart arch.xen_vastart
    3.12  #define xen_vaend arch.xen_vaend
     4.1 --- a/xen/include/public/arch-ia64.h	Wed Dec 21 08:53:40 2005 -0600
     4.2 +++ b/xen/include/public/arch-ia64.h	Wed Dec 21 09:07:09 2005 -0600
     4.3 @@ -276,6 +276,12 @@ typedef struct {
     4.4      unsigned long start_info_pfn;
     4.5  } arch_shared_info_t;
     4.6  
     4.7 +typedef struct {
     4.8 +    unsigned long start;
     4.9 +    unsigned long size; 
    4.10 +} arch_initrd_info_t;
    4.11 +
    4.12 +#define IA64_COMMAND_LINE_SIZE 512
    4.13  typedef struct vcpu_guest_context {
    4.14  #define VGCF_FPU_VALID (1<<0)
    4.15  #define VGCF_VMX_GUEST (1<<1)
    4.16 @@ -289,6 +295,8 @@ typedef struct vcpu_guest_context {
    4.17      cpu_user_regs_t regs;
    4.18      arch_vcpu_info_t vcpu;
    4.19      arch_shared_info_t shared;
    4.20 +    arch_initrd_info_t initrd;
    4.21 +    char cmdline[IA64_COMMAND_LINE_SIZE];
    4.22  } vcpu_guest_context_t;
    4.23  
    4.24  #endif /* !__ASSEMBLY__ */