ia64/xen-unstable

changeset 13741:f91dd7642a42

new domain builder fix to boot domU on IA64.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author kaf24@localhost.localdomain
date Tue Jan 30 13:52:52 2007 +0000 (2007-01-30)
parents b51ed174fe8f
children 69c5afd5ab08
files tools/libxc/xc_dom_boot.c tools/libxc/xc_dom_ia64.c
line diff
     1.1 --- a/tools/libxc/xc_dom_boot.c	Tue Jan 30 13:46:48 2007 +0000
     1.2 +++ b/tools/libxc/xc_dom_boot.c	Tue Jan 30 13:52:52 2007 +0000
     1.3 @@ -157,6 +157,12 @@ static int arch_setup_early(struct xc_do
     1.4      return rc;
     1.5  }
     1.6  
     1.7 +static int arch_setup_middle(struct xc_dom_image *dom)
     1.8 +{
     1.9 +    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
    1.10 +    return 0;
    1.11 +}
    1.12 +
    1.13  static int arch_setup_late(struct xc_dom_image *dom)
    1.14  {
    1.15      static const struct {
    1.16 @@ -259,6 +265,12 @@ static int arch_setup_late(struct xc_dom
    1.17  
    1.18  static int arch_setup_early(struct xc_dom_image *dom)
    1.19  {
    1.20 +    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
    1.21 +    return 0;
    1.22 +}
    1.23 +
    1.24 +static int arch_setup_middle(struct xc_dom_image *dom)
    1.25 +{
    1.26      DECLARE_DOMCTL;
    1.27      int rc;
    1.28  
    1.29 @@ -268,16 +280,35 @@ static int arch_setup_early(struct xc_do
    1.30      domctl.cmd = XEN_DOMCTL_arch_setup;
    1.31      domctl.domain = dom->guest_domid;
    1.32      domctl.u.arch_setup.flags = 0;
    1.33 +
    1.34 +    /* dom->start_info_pfn should be initialized by alloc_magic_pages().
    1.35 +     * However it is called later. So we initialize here.
    1.36 +     */
    1.37 +    dom->start_info_pfn = dom->total_pages - 3;
    1.38      domctl.u.arch_setup.bp = (dom->start_info_pfn << PAGE_SHIFT)
    1.39  	+ sizeof(start_info_t);
    1.40 -    domctl.u.arch_setup.maxmem = dom->total_pages << PAGE_SHIFT;
    1.41 +    /* 3 = start info page, xenstore page and console page */
    1.42 +    domctl.u.arch_setup.maxmem = (dom->total_pages - 3) << PAGE_SHIFT;
    1.43      rc = do_domctl(dom->guest_xc, &domctl);
    1.44      return rc;
    1.45  }
    1.46  
    1.47  static int arch_setup_late(struct xc_dom_image *dom)
    1.48  {
    1.49 -    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
    1.50 +    unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
    1.51 +    shared_info_t *shared_info;
    1.52 +
    1.53 +    /* setup shared_info page */
    1.54 +    xc_dom_printf("%s: shared_info: mfn 0x%" PRIpfn "\n",
    1.55 +		  __FUNCTION__, dom->shared_info_mfn);
    1.56 +    shared_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid,
    1.57 +				       page_size,
    1.58 +				       PROT_READ | PROT_WRITE,
    1.59 +				       dom->shared_info_mfn);
    1.60 +    if (NULL == shared_info)
    1.61 +	return -1;
    1.62 +    dom->arch_hooks->shared_info(dom, shared_info);
    1.63 +    munmap(shared_info, page_size);
    1.64      return 0;
    1.65  }
    1.66  
    1.67 @@ -292,6 +323,12 @@ static int arch_setup_early(struct xc_do
    1.68      return 0;
    1.69  }
    1.70  
    1.71 +static int arch_setup_middle(struct xc_dom_image *dom)
    1.72 +{
    1.73 +    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
    1.74 +    return 0;
    1.75 +}
    1.76 +
    1.77  static int arch_setup_late(struct xc_dom_image *dom)
    1.78  {
    1.79      start_info_t *si =
    1.80 @@ -324,6 +361,12 @@ static int arch_setup_early(struct xc_do
    1.81      return 0;
    1.82  }
    1.83  
    1.84 +static int arch_setup_middle(struct xc_dom_image *dom)
    1.85 +{
    1.86 +    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
    1.87 +    return 0;
    1.88 +}
    1.89 +
    1.90  static int arch_setup_late(struct xc_dom_image *dom)
    1.91  {
    1.92      xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
    1.93 @@ -395,6 +438,9 @@ int xc_dom_boot_mem_init(struct xc_dom_i
    1.94  	return rc;
    1.95      }
    1.96  
    1.97 +    if (0 != (rc = arch_setup_middle(dom)))
    1.98 +        return rc;
    1.99 +
   1.100      return 0;
   1.101  }
   1.102  
     2.1 --- a/tools/libxc/xc_dom_ia64.c	Tue Jan 30 13:46:48 2007 +0000
     2.2 +++ b/tools/libxc/xc_dom_ia64.c	Tue Jan 30 13:52:52 2007 +0000
     2.3 @@ -26,7 +26,11 @@ static int alloc_magic_pages(struct xc_d
     2.4      /* allocate special pages */
     2.5      dom->console_pfn = dom->total_pages -1;
     2.6      dom->xenstore_pfn = dom->total_pages -2;
     2.7 -    dom->start_info_pfn = dom->total_pages -3;
     2.8 +
     2.9 +    /*
    2.10 +     * this is initialized by arch_setup_middle().
    2.11 +     * dom->start_info_pfn = dom->total_pages -3;
    2.12 +     */
    2.13      return 0;
    2.14  }
    2.15  
    2.16 @@ -39,6 +43,7 @@ static int start_info_ia64(struct xc_dom
    2.17  
    2.18      xc_dom_printf("%s\n", __FUNCTION__);
    2.19  
    2.20 +    memset(start_info, 0, sizeof(*start_info));
    2.21      sprintf(start_info->magic, dom->guest_type);
    2.22      start_info->flags = dom->flags;
    2.23      start_info->nr_pages = dom->total_pages;
    2.24 @@ -54,12 +59,12 @@ static int start_info_ia64(struct xc_dom
    2.25  	bp->initrd_start = start_info->mod_start;
    2.26  	bp->initrd_size = start_info->mod_len;
    2.27      }
    2.28 +    bp->command_line = (dom->start_info_pfn << PAGE_SHIFT_IA64)
    2.29 +	    + offsetof(start_info_t, cmd_line);
    2.30      if (dom->cmdline)
    2.31      {
    2.32  	strncpy((char *)start_info->cmd_line, dom->cmdline, MAX_GUEST_CMDLINE);
    2.33  	start_info->cmd_line[MAX_GUEST_CMDLINE - 1] = '\0';
    2.34 -	bp->command_line = (dom->start_info_pfn << PAGE_SHIFT_IA64)
    2.35 -	    + offsetof(start_info_t, cmd_line);
    2.36      }
    2.37      return 0;
    2.38  }