ia64/xen-unstable

changeset 10570:8dc4af3f192c

[IA64] Implement and use DOM0_DOMAIN_STEUP.

DOM0_GETMEMLIST now reads ptes and use gpfn.
Domain builder reworked: calls DOMAIN_SETUP, setup start_info page.
SAL data are now in domain memory.
is_vti field added in domain.arch.
Many cleanups (indentation, static, warnings).

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Wed Jul 05 09:28:32 2006 -0600 (2006-07-05)
parents f7132169c2bf
children 37c8b562a8f1
files linux-2.6-xen-sparse/arch/ia64/kernel/setup.c linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c tools/ioemu/vl.c tools/libxc/xc_ia64_stubs.c tools/libxc/xc_linux_build.c xen/arch/ia64/linux-xen/entry.S xen/arch/ia64/vmx/mmio.c xen/arch/ia64/vmx/vmmu.c xen/arch/ia64/vmx/vmx_init.c xen/arch/ia64/xen/dom0_ops.c xen/arch/ia64/xen/dom_fw.c xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/fw_emul.c xen/arch/ia64/xen/hypercall.c xen/arch/ia64/xen/mm.c xen/arch/ia64/xen/vcpu.c xen/include/asm-ia64/dom_fw.h xen/include/asm-ia64/domain.h xen/include/asm-ia64/mm.h xen/include/asm-ia64/vmx.h xen/include/public/arch-ia64.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Mon Jul 03 09:11:49 2006 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Wed Jul 05 09:28:32 2006 -0600
     1.3 @@ -523,15 +523,14 @@ setup_arch (char **cmdline_p)
     1.4  		shared_info_t *s = HYPERVISOR_shared_info;
     1.5  
     1.6  		xen_start_info = __va(s->arch.start_info_pfn << PAGE_SHIFT);
     1.7 -		xen_start_info->flags = s->arch.flags;
     1.8  
     1.9  		printk("Running on Xen! start_info_pfn=0x%lx nr_pages=%ld "
    1.10  		       "flags=0x%x\n", s->arch.start_info_pfn,
    1.11  		       xen_start_info->nr_pages, xen_start_info->flags);
    1.12  
    1.13  		/* xen_start_info isn't setup yet, get the flags manually */
    1.14 -		if (s->arch.flags & SIF_INITDOMAIN) {
    1.15 -			if (!(s->arch.flags & SIF_PRIVILEGED))
    1.16 +		if (xen_start_info->flags & SIF_INITDOMAIN) {
    1.17 +			if (!(xen_start_info->flags & SIF_PRIVILEGED))
    1.18  				panic("Xen granted us console access "
    1.19  				      "but not privileged status");
    1.20  		} else {
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Mon Jul 03 09:11:49 2006 -0600
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Wed Jul 05 09:28:32 2006 -0600
     2.3 @@ -547,8 +547,10 @@ xen_ia64_privcmd_entry_mmap(struct vm_ar
     2.4  	unsigned long gpfn;
     2.5  	unsigned long flags;
     2.6  
     2.7 -	BUG_ON((addr & ~PAGE_MASK) != 0);
     2.8 -	BUG_ON(mfn == INVALID_MFN);
     2.9 +	if ((addr & ~PAGE_MASK) != 0 || mfn == INVALID_MFN) {
    2.10 +		error = -EINVAL;
    2.11 +		goto out;
    2.12 +	}
    2.13  
    2.14  	if (entry->gpfn != INVALID_GPFN) {
    2.15  		error = -EBUSY;
     3.1 --- a/tools/ioemu/vl.c	Mon Jul 03 09:11:49 2006 -0600
     3.2 +++ b/tools/ioemu/vl.c	Wed Jul 05 09:28:32 2006 -0600
     3.3 @@ -3198,6 +3198,9 @@ int main(int argc, char **argv)
     3.4                                         PROT_READ|PROT_WRITE,
     3.5                                         page_array[nr_pages - 1]);
     3.6  
     3.7 +    fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n", (nr_pages-1),
     3.8 +           (uint64_t)(page_array[nr_pages - 1]));
     3.9 +
    3.10  #elif defined(__ia64__)
    3.11      if ( xc_ia64_get_pfn_list(xc_handle, domid, page_array, 0, nr_pages)
    3.12           != nr_pages)
    3.13 @@ -3217,7 +3220,7 @@ int main(int argc, char **argv)
    3.14  
    3.15      if ( xc_ia64_get_pfn_list(xc_handle, domid,
    3.16                                page_array,
    3.17 -                              nr_pages + (GFW_SIZE >> PAGE_SHIFT), 1) != 1 )
    3.18 +                              IO_PAGE_START >> PAGE_SHIFT, 1) != 1 )
    3.19      {
    3.20          fprintf(logfile, "xc_ia64_get_pfn_list returned error %d\n", errno);
    3.21          exit(-1);
    3.22 @@ -3226,11 +3229,11 @@ int main(int argc, char **argv)
    3.23      shared_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
    3.24                                         PROT_READ|PROT_WRITE,
    3.25                                         page_array[0]);
    3.26 +
    3.27 +    fprintf(logfile, "shared page at pfn:%lx, mfn: %l016x\n",
    3.28 +	    IO_PAGE_START >> PAGE_SHIFT, page_array[0]);
    3.29  #endif
    3.30  
    3.31 -    fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n", (nr_pages-1),
    3.32 -           (uint64_t)(page_array[nr_pages - 1]));
    3.33 -
    3.34      /* we always create the cdrom drive, even if no disk is there */
    3.35      bdrv_init();
    3.36      if (has_cdrom) {
     4.1 --- a/tools/libxc/xc_ia64_stubs.c	Mon Jul 03 09:11:49 2006 -0600
     4.2 +++ b/tools/libxc/xc_ia64_stubs.c	Wed Jul 05 09:28:32 2006 -0600
     4.3 @@ -141,15 +141,6 @@ error_out:
     4.4  #define HOB_SIGNATURE         0x3436474953424f48        // "HOBSIG64"
     4.5  #define GFW_HOB_START         ((4UL<<30)-(14UL<<20))    // 4G - 14M
     4.6  #define GFW_HOB_SIZE          (1UL<<20)                 // 1M
     4.7 -#define RAW_GFW_START_NR(s)   ((s) >> PAGE_SHIFT)
     4.8 -#define RAW_GFW_HOB_START_NR(s)                \
     4.9 -        (RAW_GFW_START_NR(s) + ((GFW_HOB_START - GFW_START) >> PAGE_SHIFT))
    4.10 -#define RAW_GFW_IMAGE_START_NR(s,i)            \
    4.11 -        (RAW_GFW_START_NR(s) + (((GFW_SIZE - (i))) >> PAGE_SHIFT))
    4.12 -#define RAW_IO_PAGE_START_NR(s)                \
    4.13 -        (RAW_GFW_START_NR(s) + (GFW_SIZE >> PAGE_SHIFT))
    4.14 -#define RAW_STORE_PAGE_START_NR(s)             \
    4.15 -        (RAW_IO_PAGE_START_NR(s) + (IO_PAGE_SIZE >> PAGE_SHFIT))
    4.16  
    4.17  typedef struct {
    4.18      unsigned long signature;
    4.19 @@ -371,7 +362,7 @@ load_hob(int xc_handle, uint32_t dom, vo
    4.20      nr_pages = (hob_size + PAGE_SIZE -1) >> PAGE_SHIFT;
    4.21  
    4.22      return xc_ia64_copy_to_domain_pages(xc_handle, dom,
    4.23 -            hob_buf, RAW_GFW_HOB_START_NR(dom_mem_size), nr_pages );
    4.24 +            hob_buf, GFW_HOB_START>>PAGE_SHIFT, nr_pages );
    4.25  }
    4.26  
    4.27  #define MIN(x, y) ((x) < (y)) ? (x) : (y)
    4.28 @@ -618,16 +609,26 @@ static int setup_guest(  int xc_handle,
    4.29      shared_iopage_t *sp;
    4.30      int i;
    4.31      unsigned long dom_memsize = (memsize << 20);
    4.32 +    DECLARE_DOM0_OP;
    4.33  
    4.34      if ((image_size > 12 * MEM_M) || (image_size & (PAGE_SIZE - 1))) {
    4.35          PERROR("Guest firmware size is incorrect [%ld]?", image_size);
    4.36          return -1;
    4.37      }
    4.38  
    4.39 +    /* This will creates the physmap.  */
    4.40 +    op.u.domain_setup.flags = XEN_DOMAINSETUP_hvm_guest;
    4.41 +    op.u.domain_setup.domain = (domid_t)dom;
    4.42 +    op.u.domain_setup.bp = 0;
    4.43 +    op.u.domain_setup.maxmem = 0;
    4.44 +    
    4.45 +    op.cmd = DOM0_DOMAIN_SETUP;
    4.46 +    if ( xc_dom0_op(xc_handle, &op) )
    4.47 +        goto error_out;
    4.48 +
    4.49      /* Load guest firmware */
    4.50 -    if( xc_ia64_copy_to_domain_pages( xc_handle, dom,
    4.51 -            image, RAW_GFW_IMAGE_START_NR(dom_memsize, image_size),
    4.52 -            image_size>>PAGE_SHIFT)) {
    4.53 +    if( xc_ia64_copy_to_domain_pages(xc_handle, dom, image,
    4.54 +        (GFW_START+GFW_SIZE-image_size)>>PAGE_SHIFT, image_size>>PAGE_SHIFT)) {
    4.55          PERROR("Could not load guest firmware into domain");
    4.56          goto error_out;
    4.57      }
    4.58 @@ -640,7 +641,7 @@ static int setup_guest(  int xc_handle,
    4.59  
    4.60      /* Retrieve special pages like io, xenstore, etc. */
    4.61      if ( xc_ia64_get_pfn_list(xc_handle, dom, page_array,
    4.62 -                              RAW_IO_PAGE_START_NR(dom_memsize), 2) != 2 )
    4.63 +                              IO_PAGE_START>>PAGE_SHIFT, 2) != 2 )
    4.64      {
    4.65          PERROR("Could not get the page frame list");
    4.66          goto error_out;
    4.67 @@ -726,9 +727,7 @@ int xc_hvm_build(int xc_handle,
    4.68  
    4.69      free(image);
    4.70  
    4.71 -    ctxt->flags = VGCF_VMX_GUEST;
    4.72      ctxt->user_regs.cr_iip = 0x80000000ffffffb0UL;
    4.73 -    ctxt->privregs = 0;
    4.74  
    4.75      memset( &launch_op, 0, sizeof(launch_op) );
    4.76  
     5.1 --- a/tools/libxc/xc_linux_build.c	Mon Jul 03 09:11:49 2006 -0600
     5.2 +++ b/tools/libxc/xc_linux_build.c	Wed Jul 05 09:28:32 2006 -0600
     5.3 @@ -2,6 +2,7 @@
     5.4   * xc_linux_build.c
     5.5   */
     5.6  
     5.7 +#include <stddef.h>
     5.8  #include "xg_private.h"
     5.9  #include "xc_private.h"
    5.10  #include <xenctrl.h>
    5.11 @@ -470,6 +471,11 @@ static int setup_guest(int xc_handle,
    5.12      unsigned long v_end;
    5.13      unsigned long start_page, pgnr;
    5.14      start_info_t *start_info;
    5.15 +    unsigned long start_info_mpa;
    5.16 +    struct xen_ia64_boot_param *bp;
    5.17 +    shared_info_t *shared_info;
    5.18 +    int i;
    5.19 +    DECLARE_DOM0_OP;
    5.20      int rc;
    5.21  
    5.22      rc = probeimageformat(image, image_size, &load_funcs);
    5.23 @@ -486,6 +492,17 @@ static int setup_guest(int xc_handle,
    5.24      vinitrd_start    = round_pgup(dsi.v_end);
    5.25      vinitrd_end      = vinitrd_start + initrd->len;
    5.26      v_end            = round_pgup(vinitrd_end);
    5.27 +    start_info_mpa = (nr_pages - 3) << PAGE_SHIFT;
    5.28 +
    5.29 +    /* Build firmware.  */
    5.30 +    op.u.domain_setup.flags = 0;
    5.31 +    op.u.domain_setup.domain = (domid_t)dom;
    5.32 +    op.u.domain_setup.bp = start_info_mpa + sizeof (start_info_t);
    5.33 +    op.u.domain_setup.maxmem = (nr_pages - 3) << PAGE_SHIFT;
    5.34 +    
    5.35 +    op.cmd = DOM0_DOMAIN_SETUP;
    5.36 +    if ( xc_dom0_op(xc_handle, &op) )
    5.37 +        goto error_out;
    5.38  
    5.39      start_page = dsi.v_start >> PAGE_SHIFT;
    5.40      pgnr = (v_end - dsi.v_start) >> PAGE_SHIFT;
    5.41 @@ -538,7 +555,7 @@ static int setup_guest(int xc_handle,
    5.42      IPRINTF("start_info: 0x%lx at 0x%lx, "
    5.43             "store_mfn: 0x%lx at 0x%lx, "
    5.44             "console_mfn: 0x%lx at 0x%lx\n",
    5.45 -           page_array[0], nr_pages,
    5.46 +           page_array[0], nr_pages - 3,
    5.47             *store_mfn,    nr_pages - 2,
    5.48             *console_mfn,  nr_pages - 1);
    5.49  
    5.50 @@ -553,23 +570,35 @@ static int setup_guest(int xc_handle,
    5.51      start_info->console_mfn   = nr_pages - 1;
    5.52      start_info->console_evtchn = console_evtchn;
    5.53      start_info->nr_pages       = nr_pages; // FIXME?: nr_pages - 2 ????
    5.54 +
    5.55 +    bp = (struct xen_ia64_boot_param *)(start_info + 1);
    5.56 +    bp->command_line = start_info_mpa + offsetof(start_info_t, cmd_line);
    5.57 +    if ( cmdline != NULL )
    5.58 +    {
    5.59 +        strncpy((char *)start_info->cmd_line, cmdline, MAX_GUEST_CMDLINE);
    5.60 +        start_info->cmd_line[MAX_GUEST_CMDLINE - 1] = 0;
    5.61 +    }
    5.62      if ( initrd->len != 0 )
    5.63      {
    5.64 -        ctxt->initrd.start    = vinitrd_start;
    5.65 -        ctxt->initrd.size     = initrd->len;
    5.66 +        bp->initrd_start    = vinitrd_start;
    5.67 +        bp->initrd_size     = initrd->len;
    5.68      }
    5.69 -    else
    5.70 -    {
    5.71 -        ctxt->initrd.start    = 0;
    5.72 -        ctxt->initrd.size     = 0;
    5.73 -    }
    5.74 -    if ( cmdline != NULL )
    5.75 -    {
    5.76 -        strncpy((char *)ctxt->cmdline, cmdline, IA64_COMMAND_LINE_SIZE);
    5.77 -        ctxt->cmdline[IA64_COMMAND_LINE_SIZE-1] = '\0';
    5.78 -    }
    5.79 +    ctxt->user_regs.r28 = start_info_mpa + sizeof (start_info_t);
    5.80      munmap(start_info, PAGE_SIZE);
    5.81  
    5.82 +    /* shared_info page starts its life empty. */
    5.83 +    shared_info = xc_map_foreign_range(
    5.84 +        xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, shared_info_frame);
    5.85 +    printf("shared_info = %p, err=%s frame=%lx\n",
    5.86 +           shared_info, strerror (errno), shared_info_frame);
    5.87 +    //memset(shared_info, 0, sizeof(shared_info_t));
    5.88 +    /* Mask all upcalls... */
    5.89 +    for ( i = 0; i < MAX_VIRT_CPUS; i++ )
    5.90 +        shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
    5.91 +    shared_info->arch.start_info_pfn = nr_pages - 3;
    5.92 +
    5.93 +    munmap(shared_info, PAGE_SIZE);
    5.94 +
    5.95      free(page_array);
    5.96      return 0;
    5.97  
    5.98 @@ -1150,16 +1179,10 @@ static int xc_linux_build_internal(int x
    5.99  #ifdef __ia64__
   5.100      /* based on new_thread in xen/arch/ia64/domain.c */
   5.101      ctxt->flags = 0;
   5.102 -    ctxt->shared.flags = flags;
   5.103 -    ctxt->shared.start_info_pfn = nr_pages - 3; /* metaphysical */
   5.104      ctxt->user_regs.cr_ipsr = 0; /* all necessary bits filled by hypervisor */
   5.105      ctxt->user_regs.cr_iip = vkern_entry;
   5.106      ctxt->user_regs.cr_ifs = 1UL << 63;
   5.107      ctxt->user_regs.ar_fpsr = xc_ia64_fpsr_default();
   5.108 -    /* currently done by hypervisor, should move here */
   5.109 -    /* ctxt->regs.r28 = dom_fw_setup(); */
   5.110 -    ctxt->privregs = 0;
   5.111 -    ctxt->sys_pgnr = 3;
   5.112      i = 0; /* silence unused variable warning */
   5.113  #else /* x86 */
   5.114      /*
     6.1 --- a/xen/arch/ia64/linux-xen/entry.S	Mon Jul 03 09:11:49 2006 -0600
     6.2 +++ b/xen/arch/ia64/linux-xen/entry.S	Wed Jul 05 09:28:32 2006 -0600
     6.3 @@ -652,17 +652,8 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
     6.4      ld8 r16 = [r16]
     6.5      ;;
     6.6      cmp.ne p6,p7 = r16, r0
     6.7 - (p6) br.cond.spnt ia64_leave_hypervisor
     6.8 - (p7) br.cond.spnt ia64_leave_kernel
     6.9 -    ;;
    6.10 -//    adds r16 = IA64_VCPU_FLAGS_OFFSET, r13
    6.11 -//    ;;
    6.12 -//    ld8 r16 = [r16]
    6.13 -//    ;;
    6.14 -//    cmp.ne p6,p7 = r16, r0
    6.15 -//	(p6) br.cond.spnt ia64_leave_hypervisor
    6.16 -//	(p7) br.cond.spnt ia64_leave_kernel
    6.17 -//    ;;
    6.18 + (p6) br.cond.spnt ia64_leave_hypervisor	/* VTi */
    6.19 + (p7) br.cond.spnt ia64_leave_kernel		/* !VTi */
    6.20  #else
    6.21  .ret8:
    6.22  	adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
     7.1 --- a/xen/arch/ia64/vmx/mmio.c	Mon Jul 03 09:11:49 2006 -0600
     7.2 +++ b/xen/arch/ia64/vmx/mmio.c	Wed Jul 05 09:28:32 2006 -0600
     7.3 @@ -386,20 +386,16 @@ static void write_ipi (VCPU *vcpu, uint6
     7.4          struct pt_regs *targ_regs = vcpu_regs (targ);
     7.5          struct vcpu_guest_context c;
     7.6  
     7.7 -        printf ("arch_boot_vcpu: %p %p\n",
     7.8 -                (void *)d->arch.boot_rdv_ip,
     7.9 -                (void *)d->arch.boot_rdv_r1);
    7.10          memset (&c, 0, sizeof (c));
    7.11  
    7.12 -        c.flags = VGCF_VMX_GUEST;
    7.13          if (arch_set_info_guest (targ, &c) != 0) {
    7.14              printf ("arch_boot_vcpu: failure\n");
    7.15              return;
    7.16          }
    7.17          /* First or next rendez-vous: set registers.  */
    7.18          vcpu_init_regs (targ);
    7.19 -        targ_regs->cr_iip = d->arch.boot_rdv_ip;
    7.20 -        targ_regs->r1 = d->arch.boot_rdv_r1;
    7.21 +        targ_regs->cr_iip = d->arch.sal_data->boot_rdv_ip;
    7.22 +        targ_regs->r1 = d->arch.sal_data->boot_rdv_r1;
    7.23  
    7.24          if (test_and_clear_bit(_VCPUF_down,&targ->vcpu_flags)) {
    7.25              vcpu_wake(targ);
     8.1 --- a/xen/arch/ia64/vmx/vmmu.c	Mon Jul 03 09:11:49 2006 -0600
     8.2 +++ b/xen/arch/ia64/vmx/vmmu.c	Wed Jul 05 09:28:32 2006 -0600
     8.3 @@ -290,6 +290,7 @@ int vhpt_enabled(VCPU *vcpu, uint64_t va
     8.4  
     8.5  int unimplemented_gva(VCPU *vcpu,u64 vadr)
     8.6  {
     8.7 +#if 0
     8.8      int bit=vcpu->domain->arch.imp_va_msb;
     8.9      u64 ladr =(vadr<<3)>>(3+bit);
    8.10      if(!ladr||ladr==(1U<<(61-bit))-1){
    8.11 @@ -297,6 +298,9 @@ int unimplemented_gva(VCPU *vcpu,u64 vad
    8.12      }else{
    8.13          return 1;
    8.14      }
    8.15 +#else
    8.16 +    return 0;
    8.17 +#endif
    8.18  }
    8.19  
    8.20  
     9.1 --- a/xen/arch/ia64/vmx/vmx_init.c	Mon Jul 03 09:11:49 2006 -0600
     9.2 +++ b/xen/arch/ia64/vmx/vmx_init.c	Wed Jul 05 09:28:32 2006 -0600
     9.3 @@ -271,8 +271,6 @@ vmx_final_setup_guest(struct vcpu *v)
     9.4  {
     9.5  	vpd_t *vpd;
     9.6  
     9.7 -	free_xenheap_pages(v->arch.privregs, get_order(sizeof(mapped_regs_t)));
     9.8 -
     9.9  	vpd = alloc_vpd();
    9.10  	ASSERT(vpd);
    9.11  
    9.12 @@ -317,7 +315,7 @@ typedef struct io_range {
    9.13  	unsigned long type;
    9.14  } io_range_t;
    9.15  
    9.16 -io_range_t io_ranges[] = {
    9.17 +static const io_range_t io_ranges[] = {
    9.18  	{VGA_IO_START, VGA_IO_SIZE, GPFN_FRAME_BUFFER},
    9.19  	{MMIO_START, MMIO_SIZE, GPFN_LOW_MMIO},
    9.20  	{LEGACY_IO_START, LEGACY_IO_SIZE, GPFN_LEGACY_IO},
    9.21 @@ -325,24 +323,24 @@ io_range_t io_ranges[] = {
    9.22  	{PIB_START, PIB_SIZE, GPFN_PIB},
    9.23  };
    9.24  
    9.25 +/* Reseve 1 page for shared I/O and 1 page for xenstore.  */
    9.26  #define VMX_SYS_PAGES	(2 + (GFW_SIZE >> PAGE_SHIFT))
    9.27  #define VMX_CONFIG_PAGES(d) ((d)->max_pages - VMX_SYS_PAGES)
    9.28  
    9.29 -int vmx_build_physmap_table(struct domain *d)
    9.30 +static void vmx_build_physmap_table(struct domain *d)
    9.31  {
    9.32  	unsigned long i, j, start, tmp, end, mfn;
    9.33  	struct vcpu *v = d->vcpu[0];
    9.34  	struct list_head *list_ent = d->page_list.next;
    9.35  
    9.36 -	ASSERT(!d->arch.physmap_built);
    9.37  	ASSERT(!test_bit(ARCH_VMX_CONTIG_MEM, &v->arch.arch_vmx.flags));
    9.38  	ASSERT(d->max_pages == d->tot_pages);
    9.39  
    9.40  	/* Mark I/O ranges */
    9.41  	for (i = 0; i < (sizeof(io_ranges) / sizeof(io_range_t)); i++) {
    9.42  	    for (j = io_ranges[i].start;
    9.43 -		 j < io_ranges[i].start + io_ranges[i].size;
    9.44 -		 j += PAGE_SIZE)
    9.45 +		j < io_ranges[i].start + io_ranges[i].size;
    9.46 +		j += PAGE_SIZE)
    9.47  		__assign_domain_page(d, j, io_ranges[i].type, ASSIGN_writable);
    9.48  	}
    9.49  
    9.50 @@ -362,21 +360,19 @@ int vmx_build_physmap_table(struct domai
    9.51  	if (unlikely(end > MMIO_START)) {
    9.52  	    start = 4 * MEM_G;
    9.53  	    end = start + (end - 3 * MEM_G);
    9.54 -	    for (i = start; (i < end) &&
    9.55 -		 (list_ent != &d->page_list); i += PAGE_SIZE) {
    9.56 -		mfn = page_to_mfn(list_entry(
    9.57 -		    list_ent, struct page_info, list));
    9.58 +	    for (i = start;
    9.59 +	         (i < end) && (list_ent != &d->page_list); i += PAGE_SIZE) {
    9.60 +		mfn = page_to_mfn(list_entry(list_ent, struct page_info, list));
    9.61  		assign_domain_page(d, i, mfn << PAGE_SHIFT);
    9.62  		list_ent = mfn_to_page(mfn)->list.next;
    9.63  	    }
    9.64  	    ASSERT(list_ent != &d->page_list);
    9.65 -        }
    9.66 +	}
    9.67  	 
    9.68  	/* Map guest firmware */
    9.69  	for (i = GFW_START; (i < GFW_START + GFW_SIZE) &&
    9.70  		(list_ent != &d->page_list); i += PAGE_SIZE) {
    9.71 -	    mfn = page_to_mfn(list_entry(
    9.72 -		list_ent, struct page_info, list));
    9.73 +	    mfn = page_to_mfn(list_entry(list_ent, struct page_info, list));
    9.74  	    assign_domain_page(d, i, mfn << PAGE_SHIFT);
    9.75  	    list_ent = mfn_to_page(mfn)->list.next;
    9.76  	}
    9.77 @@ -393,24 +389,22 @@ int vmx_build_physmap_table(struct domai
    9.78  	list_ent = mfn_to_page(mfn)->list.next;
    9.79  	ASSERT(list_ent == &d->page_list);
    9.80  
    9.81 -	d->arch.max_pfn = end >> PAGE_SHIFT;
    9.82 -	d->arch.physmap_built = 1;
    9.83  	set_bit(ARCH_VMX_CONTIG_MEM, &v->arch.arch_vmx.flags);
    9.84 -	return 0;
    9.85  }
    9.86  
    9.87 -void vmx_setup_platform(struct domain *d, struct vcpu_guest_context *c)
    9.88 +void vmx_setup_platform(struct domain *d)
    9.89  {
    9.90  	ASSERT(d != dom0); /* only for non-privileged vti domain */
    9.91  
    9.92 -	if (!d->arch.physmap_built)
    9.93 -	    vmx_build_physmap_table(d);
    9.94 +	vmx_build_physmap_table(d);
    9.95  
    9.96  	d->arch.vmx_platform.shared_page_va =
    9.97  		(unsigned long)__va(__gpa_to_mpa(d, IO_PAGE_START));
    9.98  	/* TEMP */
    9.99  	d->arch.vmx_platform.pib_base = 0xfee00000UL;
   9.100  
   9.101 +	d->arch.sal_data = xmalloc(struct xen_sal_data);
   9.102 +
   9.103  	/* Only open one port for I/O and interrupt emulation */
   9.104  	memset(&d->shared_info->evtchn_mask[0], 0xff,
   9.105  	    sizeof(d->shared_info->evtchn_mask));
   9.106 @@ -430,8 +424,7 @@ void vmx_do_launch(struct vcpu *v)
   9.107  	    domain_crash_synchronous();
   9.108  	}
   9.109  
   9.110 -	clear_bit(iopacket_port(v),
   9.111 -		&v->domain->shared_info->evtchn_mask[0]);
   9.112 +	clear_bit(iopacket_port(v), &v->domain->shared_info->evtchn_mask[0]);
   9.113  
   9.114  	vmx_load_all_rr(v);
   9.115  }
    10.1 --- a/xen/arch/ia64/xen/dom0_ops.c	Mon Jul 03 09:11:49 2006 -0600
    10.2 +++ b/xen/arch/ia64/xen/dom0_ops.c	Wed Jul 05 09:28:32 2006 -0600
    10.3 @@ -19,6 +19,10 @@
    10.4  #include <xen/guest_access.h>
    10.5  #include <public/sched_ctl.h>
    10.6  #include <asm/vmx.h>
    10.7 +#include <asm/dom_fw.h>
    10.8 +
    10.9 +void build_physmap_table(struct domain *d);
   10.10 +
   10.11  extern unsigned long total_pages;
   10.12  long arch_do_dom0_op(dom0_op_t *op, XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op)
   10.13  {
   10.14 @@ -154,52 +158,36 @@ long arch_do_dom0_op(dom0_op_t *op, XEN_
   10.15  
   10.16      case DOM0_GETMEMLIST:
   10.17      {
   10.18 -        unsigned long i = 0;
   10.19 +        unsigned long i;
   10.20          struct domain *d = find_domain_by_id(op->u.getmemlist.domain);
   10.21          unsigned long start_page = op->u.getmemlist.max_pfns >> 32;
   10.22          unsigned long nr_pages = op->u.getmemlist.max_pfns & 0xffffffff;
   10.23          unsigned long mfn;
   10.24 -        struct list_head *list_ent;
   10.25  
   10.26          ret = -EINVAL;
   10.27 -        if ( d != NULL )
   10.28 -        {
   10.29 -            ret = 0;
   10.30 +        if ( d == NULL )
   10.31 +            break;
   10.32 +        for (i = 0 ; i < nr_pages ; i++) {
   10.33 +            pte_t *pte;
   10.34  
   10.35 -            list_ent = d->page_list.next;
   10.36 -            while ( (i != start_page) && (list_ent != &d->page_list)) {
   10.37 -                mfn = page_to_mfn(list_entry(
   10.38 -                    list_ent, struct page_info, list));
   10.39 -                i++;
   10.40 -                list_ent = mfn_to_page(mfn)->list.next;
   10.41 -            }
   10.42 +            pte = (pte_t *)lookup_noalloc_domain_pte(d,
   10.43 +                                               (start_page + i) << PAGE_SHIFT);
   10.44 +            if (pte && pte_present(*pte))
   10.45 +                mfn = pte_pfn(*pte);
   10.46 +            else
   10.47 +                mfn = INVALID_MFN;
   10.48  
   10.49 -            if (i == start_page)
   10.50 -            {
   10.51 -                while((i < (start_page + nr_pages)) &&
   10.52 -                      (list_ent != &d->page_list))
   10.53 -                {
   10.54 -                    mfn = page_to_mfn(list_entry(
   10.55 -                        list_ent, struct page_info, list));
   10.56 +            if ( copy_to_guest_offset(op->u.getmemlist.buffer, i, &mfn, 1) ) {
   10.57 +                    ret = -EFAULT;
   10.58 +                    break;
   10.59 +            }
   10.60 +        }
   10.61  
   10.62 -                    if ( copy_to_guest_offset(op->u.getmemlist.buffer,
   10.63 -                                          i - start_page, &mfn, 1) )
   10.64 -                    {
   10.65 -                        ret = -EFAULT;
   10.66 -                        break;
   10.67 -                    }
   10.68 -                    i++;
   10.69 -                    list_ent = mfn_to_page(mfn)->list.next;
   10.70 -                }
   10.71 -            } else
   10.72 -                ret = -ENOMEM;
   10.73 +        op->u.getmemlist.num_pfns = i;
   10.74 +        if (copy_to_guest(u_dom0_op, op, 1))
   10.75 +            ret = -EFAULT;
   10.76  
   10.77 -            op->u.getmemlist.num_pfns = i - start_page;
   10.78 -            if (copy_to_guest(u_dom0_op, op, 1))
   10.79 -                ret = -EFAULT;
   10.80 -            
   10.81 -            put_domain(d);
   10.82 -        }
   10.83 +        put_domain(d);
   10.84      }
   10.85      break;
   10.86  
   10.87 @@ -225,6 +213,33 @@ long arch_do_dom0_op(dom0_op_t *op, XEN_
   10.88      }
   10.89      break;
   10.90  
   10.91 +    case DOM0_DOMAIN_SETUP:
   10.92 +    {
   10.93 +        dom0_domain_setup_t *ds = &op->u.domain_setup;
   10.94 +        struct domain *d = find_domain_by_id(ds->domain);
   10.95 +
   10.96 +        if ( d == NULL) {
   10.97 +            ret = -EINVAL;
   10.98 +            break;
   10.99 +        }
  10.100 +
  10.101 +        if (ds->flags & XEN_DOMAINSETUP_hvm_guest) {
  10.102 +            if (!vmx_enabled) {
  10.103 +                printk("No VMX hardware feature for vmx domain.\n");
  10.104 +                ret = -EINVAL;
  10.105 +                break;
  10.106 +            }
  10.107 +            d->arch.is_vti = 1;
  10.108 +            vmx_setup_platform(d);
  10.109 +        }
  10.110 +        else {
  10.111 +            build_physmap_table(d);
  10.112 +            dom_fw_setup(d, ds->bp, ds->maxmem);
  10.113 +        }
  10.114 +        put_domain(d);
  10.115 +    }
  10.116 +    break;
  10.117 +
  10.118      default:
  10.119          printf("arch_do_dom0_op: unrecognized dom0 op: %d!!!\n",op->cmd);
  10.120          ret = -ENOSYS;
    11.1 --- a/xen/arch/ia64/xen/dom_fw.c	Mon Jul 03 09:11:49 2006 -0600
    11.2 +++ b/xen/arch/ia64/xen/dom_fw.c	Wed Jul 05 09:28:32 2006 -0600
    11.3 @@ -25,14 +25,16 @@
    11.4  #include <asm/dom_fw.h>
    11.5  #include <asm/bundle.h>
    11.6  
    11.7 -static struct ia64_boot_param *dom_fw_init(struct domain *, const char *,int,char *,int);
    11.8 +static void dom_fw_init (struct domain *d, struct ia64_boot_param *bp, char *fw_mem, int fw_mem_size, unsigned long maxmem);
    11.9 +
   11.10  extern struct domain *dom0;
   11.11  extern unsigned long dom0_start;
   11.12  
   11.13  extern unsigned long running_on_sim;
   11.14  
   11.15 -unsigned long dom_fw_base_mpa = -1;
   11.16 -unsigned long imva_fw_base = -1;
   11.17 +/* Note: two domains cannot be created simulteanously!  */
   11.18 +static unsigned long dom_fw_base_mpa = -1;
   11.19 +static unsigned long imva_fw_base = -1;
   11.20  
   11.21  #define FW_VENDOR "X\0e\0n\0/\0i\0a\0\066\0\064\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
   11.22  
   11.23 @@ -216,21 +218,22 @@ static void dom_fw_pal_hypercall_patch(s
   11.24  }
   11.25  
   11.26  
   11.27 -// FIXME: This is really a hack: Forcing the boot parameter block
   11.28 -// at domain mpaddr 0 page, then grabbing only the low bits of the
   11.29 -// Xen imva, which is the offset into the page
   11.30 -unsigned long dom_fw_setup(struct domain *d, const char *args, int arglen)
   11.31 +void dom_fw_setup(struct domain *d, unsigned long bp_mpa, unsigned long maxmem)
   11.32  {
   11.33  	struct ia64_boot_param *bp;
   11.34  
   11.35  	dom_fw_base_mpa = 0;
   11.36  #ifndef CONFIG_XEN_IA64_DOM0_VP
   11.37 -	if (d == dom0) dom_fw_base_mpa += dom0_start;
   11.38 +	if (d == dom0) {
   11.39 +		dom_fw_base_mpa += dom0_start;
   11.40 +		bp_mpa += dom0_start;
   11.41 +	}
   11.42  #endif
   11.43  	ASSIGN_NEW_DOMAIN_PAGE_IF_DOM0(d, dom_fw_base_mpa);
   11.44  	imva_fw_base = (unsigned long) domain_mpa_to_imva(d, dom_fw_base_mpa);
   11.45 -	bp = dom_fw_init(d, args, arglen, (char *) imva_fw_base, PAGE_SIZE);
   11.46 -	return dom_pa((unsigned long) bp);
   11.47 +	ASSIGN_NEW_DOMAIN_PAGE_IF_DOM0(d, bp_mpa);
   11.48 +	bp = domain_mpa_to_imva(d, bp_mpa);
   11.49 +	dom_fw_init(d, bp, (char *) imva_fw_base, PAGE_SIZE, maxmem);
   11.50  }
   11.51  
   11.52  
   11.53 @@ -603,8 +606,8 @@ efi_mdt_cmp(const void *a, const void *b
   11.54  	return 0;
   11.55  }
   11.56  
   11.57 -static struct ia64_boot_param *
   11.58 -dom_fw_init (struct domain *d, const char *args, int arglen, char *fw_mem, int fw_mem_size)
   11.59 +static void
   11.60 +dom_fw_init (struct domain *d, struct ia64_boot_param *bp, char *fw_mem, int fw_mem_size, unsigned long maxmem)
   11.61  {
   11.62  	efi_system_table_t *efi_systab;
   11.63  	efi_runtime_services_t *efi_runtime;
   11.64 @@ -614,12 +617,11 @@ dom_fw_init (struct domain *d, const cha
   11.65  	struct ia64_sal_desc_ap_wakeup *sal_wakeup;
   11.66  	fpswa_interface_t *fpswa_inf;
   11.67  	efi_memory_desc_t *efi_memmap, *md;
   11.68 -	struct ia64_boot_param *bp;
   11.69 + 	struct xen_sal_data *sal_data;
   11.70  	unsigned long *pfn;
   11.71  	unsigned char checksum = 0;
   11.72 -	char *cp, *cmd_line, *fw_vendor;
   11.73 +	char *cp, *fw_vendor;
   11.74  	int num_mds, j, i = 0;
   11.75 -	unsigned long maxmem = (d->max_pages - d->arch.sys_pgnr) * PAGE_SIZE;
   11.76  #ifdef CONFIG_XEN_IA64_DOM0_VP
   11.77  	const unsigned long start_mpaddr = 0;
   11.78  #else
   11.79 @@ -644,33 +646,23 @@ dom_fw_init (struct domain *d, const cha
   11.80  	sal_wakeup  = (void *) cp; cp += sizeof(*sal_wakeup);
   11.81  	fpswa_inf   = (void *) cp; cp += sizeof(*fpswa_inf);
   11.82  	efi_memmap  = (void *) cp; cp += NUM_MEM_DESCS*sizeof(*efi_memmap);
   11.83 -	bp	    = (void *) cp; cp += sizeof(*bp);
   11.84  	pfn         = (void *) cp; cp += NFUNCPTRS * 2 * sizeof(pfn);
   11.85 -	cmd_line    = (void *) cp;
   11.86 +	sal_data    = (void *) cp; cp += sizeof(*sal_data);
   11.87  
   11.88  	/* Initialise for EFI_SET_VIRTUAL_ADDRESS_MAP emulation */
   11.89  	d->arch.efi_runtime = efi_runtime;
   11.90  	d->arch.fpswa_inf   = fpswa_inf;
   11.91 -
   11.92 -	if (args) {
   11.93 -		if (arglen >= 1024)
   11.94 -			arglen = 1023;
   11.95 -		memcpy(cmd_line, args, arglen);
   11.96 -	} else {
   11.97 -		arglen = 0;
   11.98 -	}
   11.99 -	cmd_line[arglen] = '\0';
  11.100 +	d->arch.sal_data    = sal_data;
  11.101  
  11.102  	memset(efi_systab, 0, sizeof(efi_systab));
  11.103  	efi_systab->hdr.signature = EFI_SYSTEM_TABLE_SIGNATURE;
  11.104  	efi_systab->hdr.revision  = EFI_SYSTEM_TABLE_REVISION;
  11.105  	efi_systab->hdr.headersize = sizeof(efi_systab->hdr);
  11.106 -	cp = fw_vendor = &cmd_line[arglen] + (2-(arglen&1)); // round to 16-bit boundary
  11.107 +	fw_vendor = cp;
  11.108  	cp += sizeof(FW_VENDOR) + (8-((unsigned long)cp & 7)); // round to 64-bit boundary
  11.109  
  11.110  	memcpy(fw_vendor,FW_VENDOR,sizeof(FW_VENDOR));
  11.111  	efi_systab->fw_vendor = dom_pa((unsigned long) fw_vendor);
  11.112 -	
  11.113  	efi_systab->fw_revision = 1;
  11.114  	efi_systab->runtime = (void *) dom_pa((unsigned long) efi_runtime);
  11.115  	efi_systab->nr_tables = NUM_EFI_SYS_TABLES;
  11.116 @@ -772,20 +764,20 @@ dom_fw_init (struct domain *d, const cha
  11.117  	dom_fw_hypercall_patch (d, sal_ed->sal_proc, FW_HYPERCALL_SAL_CALL, 1);
  11.118  	sal_ed->gp = 0;  // will be ignored
  11.119  
  11.120 -	/* SAL return point.  */
  11.121 -	d->arch.sal_return_addr = FW_HYPERCALL_SAL_RETURN_PADDR + start_mpaddr;
  11.122 -	dom_fw_hypercall_patch (d, d->arch.sal_return_addr,
  11.123 -				FW_HYPERCALL_SAL_RETURN, 0);
  11.124 -
  11.125  	/* Fill an AP wakeup descriptor.  */
  11.126  	sal_wakeup->type = SAL_DESC_AP_WAKEUP;
  11.127  	sal_wakeup->mechanism = IA64_SAL_AP_EXTERNAL_INT;
  11.128  	sal_wakeup->vector = XEN_SAL_BOOT_RENDEZ_VEC;
  11.129  
  11.130 +	/* Compute checksum.  */
  11.131  	for (cp = (char *) sal_systab; cp < (char *) efi_memmap; ++cp)
  11.132  		checksum += *cp;
  11.133 +	sal_systab->checksum = -checksum;
  11.134  
  11.135 -	sal_systab->checksum = -checksum;
  11.136 +	/* SAL return point.  */
  11.137 +	d->arch.sal_return_addr = FW_HYPERCALL_SAL_RETURN_PADDR + start_mpaddr;
  11.138 +	dom_fw_hypercall_patch (d, d->arch.sal_return_addr,
  11.139 +				FW_HYPERCALL_SAL_RETURN, 0);
  11.140  
  11.141  	/* Fill in the FPSWA interface: */
  11.142  	fpswa_inf->revision = fpswa_interface->revision;
  11.143 @@ -862,6 +854,7 @@ dom_fw_init (struct domain *d, const cha
  11.144  		else MAKE_MD(EFI_RESERVED_TYPE,0,0,0,0);
  11.145  	} else {
  11.146  #ifndef CONFIG_XEN_IA64_DOM0_VP
  11.147 +	  	/* Dom0 maps legacy mmio in first MB.  */
  11.148  		MAKE_MD(EFI_LOADER_DATA,EFI_MEMORY_WB,0*MB,1*MB, 1);
  11.149  		MAKE_MD(EFI_CONVENTIONAL_MEMORY,EFI_MEMORY_WB,HYPERCALL_END,maxmem, 1);
  11.150  #endif
  11.151 @@ -926,7 +919,7 @@ dom_fw_init (struct domain *d, const cha
  11.152  	bp->efi_memmap_size = i * sizeof(efi_memory_desc_t);
  11.153  	bp->efi_memdesc_size = sizeof(efi_memory_desc_t);
  11.154  	bp->efi_memdesc_version = EFI_MEMDESC_VERSION;
  11.155 -	bp->command_line = dom_pa((unsigned long) cmd_line);
  11.156 +	bp->command_line = 0;
  11.157  	bp->console_info.num_cols = 80;
  11.158  	bp->console_info.num_rows = 25;
  11.159  	bp->console_info.orig_x = 0;
  11.160 @@ -936,12 +929,6 @@ dom_fw_init (struct domain *d, const cha
  11.161  		int j;
  11.162  		u64 addr;
  11.163  
  11.164 -		// XXX CONFIG_XEN_IA64_DOM0_VP
  11.165 -		// initrd_start address is hard coded in construct_dom0()
  11.166 -		bp->initrd_start = (dom0_start+dom0_size) -
  11.167 -		  (PAGE_ALIGN(ia64_boot_param->initrd_size) + 4*1024*1024);
  11.168 -		bp->initrd_size = ia64_boot_param->initrd_size;
  11.169 -
  11.170  		// dom0 doesn't need build_physmap_table()
  11.171  		// see arch_set_info_guest()
  11.172  		// instead we allocate pages manually.
  11.173 @@ -977,17 +964,9 @@ dom_fw_init (struct domain *d, const cha
  11.174  			if (efi_mmio(addr, PAGE_SIZE))
  11.175  				assign_domain_mmio_page(d, addr, PAGE_SIZE);
  11.176  		}
  11.177 -		d->arch.physmap_built = 1;
  11.178 -	}
  11.179 -	else {
  11.180 -		bp->initrd_start = d->arch.initrd_start;
  11.181 -		bp->initrd_size  = d->arch.initrd_len;
  11.182  	}
  11.183  	for (i = 0 ; i < bp->efi_memmap_size/sizeof(efi_memory_desc_t) ; i++) {
  11.184  		md = efi_memmap + i;
  11.185  		print_md(md);
  11.186  	}
  11.187 -	printf(" initrd start 0x%lx", bp->initrd_start);
  11.188 -	printf(" initrd size 0x%lx\n", bp->initrd_size);
  11.189 -	return bp;
  11.190  }
    12.1 --- a/xen/arch/ia64/xen/domain.c	Mon Jul 03 09:11:49 2006 -0600
    12.2 +++ b/xen/arch/ia64/xen/domain.c	Wed Jul 05 09:28:32 2006 -0600
    12.3 @@ -80,7 +80,6 @@ extern char dom0_command_line[];
    12.4  extern void serial_input_init(void);
    12.5  static void init_switch_stack(struct vcpu *v);
    12.6  extern void vmx_do_launch(struct vcpu *);
    12.7 -void build_physmap_table(struct domain *d);
    12.8  
    12.9  /* this belongs in include/asm, but there doesn't seem to be a suitable place */
   12.10  extern struct vcpu *ia64_switch_to (struct vcpu *next_task);
   12.11 @@ -270,14 +269,15 @@ struct vcpu *alloc_vcpu_struct(struct do
   12.12  	}
   12.13  
   12.14  	if (!is_idle_domain(d)) {
   12.15 -	    v->arch.privregs = 
   12.16 -		alloc_xenheap_pages(get_order(sizeof(mapped_regs_t)));
   12.17 -	    BUG_ON(v->arch.privregs == NULL);
   12.18 -	    memset(v->arch.privregs, 0, PAGE_SIZE);
   12.19 -
   12.20 -	    if (!vcpu_id)
   12.21 -	    	memset(&d->shared_info->evtchn_mask[0], 0xff,
   12.22 -		    sizeof(d->shared_info->evtchn_mask));
   12.23 +	    if (!d->arch.is_vti) {
   12.24 +		/* Create privregs page only if not VTi.  */
   12.25 +		v->arch.privregs = 
   12.26 +		    alloc_xenheap_pages(get_order(sizeof(mapped_regs_t)));
   12.27 +		BUG_ON(v->arch.privregs == NULL);
   12.28 +		memset(v->arch.privregs, 0, PAGE_SIZE);
   12.29 +		share_xen_page_with_guest(virt_to_page(v->arch.privregs),
   12.30 +		                          d, XENSHARE_writable);
   12.31 +	    }
   12.32  
   12.33  	    v->arch.metaphysical_rr0 = d->arch.metaphysical_rr0;
   12.34  	    v->arch.metaphysical_rr4 = d->arch.metaphysical_rr4;
   12.35 @@ -349,6 +349,8 @@ int arch_domain_create(struct domain *d)
   12.36  	if ((d->shared_info = (void *)alloc_xenheap_page()) == NULL)
   12.37  	    goto fail_nomem;
   12.38  	memset(d->shared_info, 0, PAGE_SIZE);
   12.39 +	share_xen_page_with_guest(virt_to_page(d->shared_info),
   12.40 +	                          d, XENSHARE_writable);
   12.41  
   12.42  	d->max_pages = (128UL*1024*1024)/PAGE_SIZE; // 128MB default // FIXME
   12.43  	/* We may also need emulation rid for region4, though it's unlikely
   12.44 @@ -357,11 +359,9 @@ int arch_domain_create(struct domain *d)
   12.45  	 */
   12.46  	if (!allocate_rid_range(d,0))
   12.47  		goto fail_nomem;
   12.48 -	d->arch.sys_pgnr = 0;
   12.49  
   12.50  	memset(&d->arch.mm, 0, sizeof(d->arch.mm));
   12.51  
   12.52 -	d->arch.physmap_built = 0;
   12.53  	if ((d->arch.mm.pgd = pgd_alloc(&d->arch.mm)) == NULL)
   12.54  	    goto fail_nomem;
   12.55  
   12.56 @@ -390,70 +390,30 @@ void arch_domain_destroy(struct domain *
   12.57  void arch_getdomaininfo_ctxt(struct vcpu *v, struct vcpu_guest_context *c)
   12.58  {
   12.59  	c->user_regs = *vcpu_regs (v);
   12.60 -	c->shared = v->domain->shared_info->arch;
   12.61 + 	c->privregs_pfn = virt_to_maddr(v->arch.privregs) >> PAGE_SHIFT;
   12.62  }
   12.63  
   12.64  int arch_set_info_guest(struct vcpu *v, struct vcpu_guest_context *c)
   12.65  {
   12.66  	struct pt_regs *regs = vcpu_regs (v);
   12.67  	struct domain *d = v->domain;
   12.68 -	unsigned long cmdline_addr;
   12.69 -
   12.70 -	if ( test_bit(_VCPUF_initialised, &v->vcpu_flags) )
   12.71 -            return 0;
   12.72 -	if (c->flags & VGCF_VMX_GUEST) {
   12.73 -	    if (!vmx_enabled) {
   12.74 -		printk("No VMX hardware feature for vmx domain.\n");
   12.75 -		return -EINVAL;
   12.76 -	    }
   12.77 -
   12.78 -	    if (v == d->vcpu[0])
   12.79 -		vmx_setup_platform(d, c);
   12.80 -
   12.81 -	    vmx_final_setup_guest(v);
   12.82 -	} else if (!d->arch.physmap_built)
   12.83 -	    build_physmap_table(d);
   12.84 -
   12.85 +	
   12.86  	*regs = c->user_regs;
   12.87 -	cmdline_addr = 0;
   12.88 -	if (v == d->vcpu[0]) {
   12.89 -	    /* Only for first vcpu.  */
   12.90 -	    d->arch.sys_pgnr = c->sys_pgnr;
   12.91 -	    d->arch.initrd_start = c->initrd.start;
   12.92 -	    d->arch.initrd_len   = c->initrd.size;
   12.93 -	    d->arch.cmdline      = c->cmdline;
   12.94 -	    d->shared_info->arch = c->shared;
   12.95 -
   12.96 -	    if (!VMX_DOMAIN(v)) {
   12.97 -		    const char *cmdline = d->arch.cmdline;
   12.98 -		    int len;
   12.99 -
  12.100 -		    if (*cmdline == 0) {
  12.101 -#define DEFAULT_CMDLINE "nomca nosmp xencons=tty0 console=tty0 root=/dev/hda1"
  12.102 -			    cmdline = DEFAULT_CMDLINE;
  12.103 -			    len = sizeof (DEFAULT_CMDLINE);
  12.104 -			    printf("domU command line defaulted to"
  12.105 -				   DEFAULT_CMDLINE "\n");
  12.106 -		    }
  12.107 -		    else
  12.108 -			    len = IA64_COMMAND_LINE_SIZE;
  12.109 -		    cmdline_addr = dom_fw_setup (d, cmdline, len);
  12.110 -	    }
  12.111 -
  12.112 -	    /* Cache synchronization seems to be done by the linux kernel
  12.113 -	       during mmap/unmap operation.  However be conservative.  */
  12.114 -	    domain_cache_flush (d, 1);
  12.115 -	}
  12.116 -	vcpu_init_regs (v);
  12.117 -	regs->r28 = cmdline_addr;
  12.118 -
  12.119 -	if ( c->privregs && copy_from_user(v->arch.privregs,
  12.120 -			   c->privregs, sizeof(mapped_regs_t))) {
  12.121 -	    printk("Bad ctxt address in arch_set_info_guest: %p\n",
  12.122 -		   c->privregs);
  12.123 -	    return -EFAULT;
  12.124 -	}
  12.125 -
  12.126 + 	
  12.127 + 	if (!d->arch.is_vti) {
  12.128 + 		/* domain runs at PL2/3 */
  12.129 + 		regs->cr_ipsr |= 2UL << IA64_PSR_CPL0_BIT;
  12.130 + 		regs->ar_rsc |= (2 << 2); /* force PL2/3 */
  12.131 + 	}
  12.132 +	
  12.133 +  	if ( test_bit(_VCPUF_initialised, &v->vcpu_flags) )
  12.134 + 		return 0;
  12.135 + 	if (d->arch.is_vti)
  12.136 + 		vmx_final_setup_guest(v);
  12.137 +	
  12.138 + 	/* This overrides some registers.  */
  12.139 +  	vcpu_init_regs(v);
  12.140 +  
  12.141  	/* Don't redo final setup */
  12.142  	set_bit(_VCPUF_initialised, &v->vcpu_flags);
  12.143  	return 0;
  12.144 @@ -531,6 +491,9 @@ void domain_relinquish_resources(struct 
  12.145  
  12.146      relinquish_memory(d, &d->xenpage_list);
  12.147      relinquish_memory(d, &d->page_list);
  12.148 +
  12.149 +    if (d->arch.is_vti && d->arch.sal_data)
  12.150 +	    xfree(d->arch.sal_data);
  12.151  }
  12.152  
  12.153  void build_physmap_table(struct domain *d)
  12.154 @@ -538,7 +501,6 @@ void build_physmap_table(struct domain *
  12.155  	struct list_head *list_ent = d->page_list.next;
  12.156  	unsigned long mfn, i = 0;
  12.157  
  12.158 -	ASSERT(!d->arch.physmap_built);
  12.159  	while(list_ent != &d->page_list) {
  12.160  	    mfn = page_to_mfn(list_entry(
  12.161  		list_ent, struct page_info, list));
  12.162 @@ -547,7 +509,6 @@ void build_physmap_table(struct domain *
  12.163  	    i++;
  12.164  	    list_ent = mfn_to_page(mfn)->list.next;
  12.165  	}
  12.166 -	d->arch.physmap_built = 1;
  12.167  }
  12.168  
  12.169  unsigned long
  12.170 @@ -762,8 +723,9 @@ int construct_dom0(struct domain *d,
  12.171  	unsigned long pkern_end;
  12.172  	unsigned long pinitrd_start = 0;
  12.173  	unsigned long pstart_info;
  12.174 -	unsigned long cmdline_addr;
  12.175  	struct page_info *start_info_page;
  12.176 +	unsigned long bp_mpa;
  12.177 +	struct ia64_boot_param *bp;
  12.178  
  12.179  #ifdef VALIDATE_VT
  12.180  	unsigned int vmx_dom0 = 0;
  12.181 @@ -913,8 +875,6 @@ int construct_dom0(struct domain *d,
  12.182  	//if ( initrd_len != 0 )
  12.183  	//    memcpy((void *)vinitrd_start, initrd_start, initrd_len);
  12.184  
  12.185 -	d->shared_info->arch.flags = SIF_INITDOMAIN|SIF_PRIVILEGED;
  12.186 -
  12.187  	/* Set up start info area. */
  12.188  	d->shared_info->arch.start_info_pfn = pstart_info >> PAGE_SHIFT;
  12.189  	start_info_page = assign_new_domain_page(d, pstart_info);
  12.190 @@ -924,6 +884,7 @@ int construct_dom0(struct domain *d,
  12.191  	memset(si, 0, PAGE_SIZE);
  12.192  	sprintf(si->magic, "xen-%i.%i-ia64", XEN_VERSION, XEN_SUBVERSION);
  12.193  	si->nr_pages     = max_pages;
  12.194 +	si->flags = SIF_INITDOMAIN|SIF_PRIVILEGED;
  12.195  
  12.196  	console_endboot();
  12.197  
  12.198 @@ -939,15 +900,38 @@ int construct_dom0(struct domain *d,
  12.199  
  12.200  	set_bit(_VCPUF_initialised, &v->vcpu_flags);
  12.201  
  12.202 -	cmdline_addr = dom_fw_setup(d, dom0_command_line, COMMAND_LINE_SIZE);
  12.203 +	/* Build firmware.
  12.204 +	   Note: Linux kernel reserve memory used by start_info, so there is
  12.205 +	   no need to remove it from MDT.  */
  12.206 +	bp_mpa = pstart_info + sizeof(struct start_info);
  12.207 +	dom_fw_setup(d, bp_mpa, max_pages * PAGE_SIZE);
  12.208 +
  12.209 +	/* Fill boot param.  */
  12.210 +	strncpy((char *)si->cmd_line, dom0_command_line, sizeof(si->cmd_line));
  12.211 +	si->cmd_line[sizeof(si->cmd_line)-1] = 0;
  12.212 +
  12.213 +	bp = (struct ia64_boot_param *)(si + 1);
  12.214 +	bp->command_line = pstart_info + offsetof (start_info_t, cmd_line);
  12.215 +
  12.216 +	/* We assume console has reached the last line!  */
  12.217 +	bp->console_info.num_cols = ia64_boot_param->console_info.num_cols;
  12.218 +	bp->console_info.num_rows = ia64_boot_param->console_info.num_rows;
  12.219 +	bp->console_info.orig_x = 0;
  12.220 +	bp->console_info.orig_y = bp->console_info.num_rows == 0 ?
  12.221 +	                          0 : bp->console_info.num_rows - 1;
  12.222 +
  12.223 +	bp->initrd_start = (dom0_start+dom0_size) -
  12.224 +	  (PAGE_ALIGN(ia64_boot_param->initrd_size) + 4*1024*1024);
  12.225 +	bp->initrd_size = ia64_boot_param->initrd_size;
  12.226  
  12.227  	vcpu_init_regs (v);
  12.228  
  12.229 +	vcpu_regs(v)->r28 = bp_mpa;
  12.230 +
  12.231  #ifdef CONFIG_DOMAIN0_CONTIGUOUS
  12.232  	pkern_entry += dom0_start;
  12.233  #endif
  12.234  	vcpu_regs (v)->cr_iip = pkern_entry;
  12.235 -	vcpu_regs (v)->r28 = cmdline_addr;
  12.236  
  12.237  	physdev_init_dom0(d);
  12.238  
    13.1 --- a/xen/arch/ia64/xen/fw_emul.c	Mon Jul 03 09:11:49 2006 -0600
    13.2 +++ b/xen/arch/ia64/xen/fw_emul.c	Wed Jul 05 09:28:32 2006 -0600
    13.3 @@ -96,8 +96,8 @@ sal_emulator (long index, unsigned long 
    13.4   			}
    13.5   			else {
    13.6  				struct domain *d = current->domain;
    13.7 -				d->arch.boot_rdv_ip = in2;
    13.8 -				d->arch.boot_rdv_r1 = in3;
    13.9 +				d->arch.sal_data->boot_rdv_ip = in2;
   13.10 +				d->arch.sal_data->boot_rdv_r1 = in3;
   13.11  			}
   13.12   		}
   13.13   		else
   13.14 @@ -370,7 +370,7 @@ efi_translate_domain_addr(unsigned long 
   13.15  	*fault = IA64_NO_FAULT;
   13.16  
   13.17  again:
   13.18 -	if (v->domain->arch.efi_virt_mode) {
   13.19 + 	if (v->domain->arch.sal_data->efi_virt_mode) {
   13.20  		*fault = vcpu_tpa(v, domain_addr, &mpaddr);
   13.21  		if (*fault != IA64_NO_FAULT) return 0;
   13.22  	}
   13.23 @@ -434,7 +434,9 @@ efi_emulate_set_virtual_address_map(
   13.24  	fpswa_interface_t *fpswa_inf = d->arch.fpswa_inf;
   13.25  
   13.26  	if (descriptor_version != EFI_MEMDESC_VERSION) {
   13.27 -		printf ("efi_emulate_set_virtual_address_map: memory descriptor version unmatched\n");
   13.28 +		printf ("efi_emulate_set_virtual_address_map: memory "
   13.29 +		        "descriptor version unmatched (%d vs %d)\n",
   13.30 +		        (int)descriptor_version, EFI_MEMDESC_VERSION);
   13.31  		return EFI_INVALID_PARAMETER;
   13.32  	}
   13.33  
   13.34 @@ -443,7 +445,8 @@ efi_emulate_set_virtual_address_map(
   13.35  		return EFI_INVALID_PARAMETER;
   13.36  	}
   13.37  
   13.38 -	if (d->arch.efi_virt_mode) return EFI_UNSUPPORTED;
   13.39 +	if (d->arch.sal_data->efi_virt_mode)
   13.40 +		return EFI_UNSUPPORTED;
   13.41  
   13.42  	efi_map_start = virtual_map;
   13.43  	efi_map_end   = efi_map_start + memory_map_size;
   13.44 @@ -485,7 +488,7 @@ efi_emulate_set_virtual_address_map(
   13.45  	}
   13.46  
   13.47  	/* The virtual address map has been applied. */
   13.48 -	d->arch.efi_virt_mode = 1;
   13.49 +	d->arch.sal_data->efi_virt_mode = 1;
   13.50  
   13.51  	return EFI_SUCCESS;
   13.52  }
    14.1 --- a/xen/arch/ia64/xen/hypercall.c	Mon Jul 03 09:11:49 2006 -0600
    14.2 +++ b/xen/arch/ia64/xen/hypercall.c	Wed Jul 05 09:28:32 2006 -0600
    14.3 @@ -154,8 +154,8 @@ fw_hypercall_ipi (struct pt_regs *regs)
    14.4  			
    14.5  		/* First or next rendez-vous: set registers.  */
    14.6  		vcpu_init_regs (targ);
    14.7 -		vcpu_regs (targ)->cr_iip = d->arch.boot_rdv_ip;
    14.8 -		vcpu_regs (targ)->r1 = d->arch.boot_rdv_r1;
    14.9 +		vcpu_regs (targ)->cr_iip = d->arch.sal_data->boot_rdv_ip;
   14.10 +		vcpu_regs (targ)->r1 = d->arch.sal_data->boot_rdv_r1;
   14.11  		vcpu_regs (targ)->b0 = d->arch.sal_return_addr;
   14.12  
   14.13  		if (test_and_clear_bit(_VCPUF_down,
    15.1 --- a/xen/arch/ia64/xen/mm.c	Mon Jul 03 09:11:49 2006 -0600
    15.2 +++ b/xen/arch/ia64/xen/mm.c	Wed Jul 05 09:28:32 2006 -0600
    15.3 @@ -583,7 +583,7 @@ lookup_alloc_domain_pte(struct domain* d
    15.4  }
    15.5  
    15.6  //XXX xxx_none() should be used instread of !xxx_present()?
    15.7 -static volatile pte_t*
    15.8 +volatile pte_t*
    15.9  lookup_noalloc_domain_pte(struct domain* d, unsigned long mpaddr)
   15.10  {
   15.11      struct mm_struct *mm = &d->arch.mm;
   15.12 @@ -1155,11 +1155,10 @@ dom0vp_add_physmap(struct domain* d, uns
   15.13          get_knownalive_domain(rd);
   15.14      }
   15.15  
   15.16 -    if (unlikely(rd == d)) {
   15.17 +    if (unlikely(rd == d || !mfn_valid(mfn))) {
   15.18          error = -EINVAL;
   15.19          goto out1;
   15.20      }
   15.21 -    BUG_ON(!mfn_valid(mfn));
   15.22      if (unlikely(get_page(mfn_to_page(mfn), rd) == 0)) {
   15.23          error = -EINVAL;
   15.24          goto out1;
    16.1 --- a/xen/arch/ia64/xen/vcpu.c	Mon Jul 03 09:11:49 2006 -0600
    16.2 +++ b/xen/arch/ia64/xen/vcpu.c	Wed Jul 05 09:28:32 2006 -0600
    16.3 @@ -1355,7 +1355,7 @@ vcpu_match_tr_entry_range(TR_ENTRY *trp,
    16.4  static TR_ENTRY*
    16.5  vcpu_tr_lookup(VCPU* vcpu, unsigned long va, UINT64 rid, BOOLEAN is_data)
    16.6  {
    16.7 -	unsigned int* regions;
    16.8 +	unsigned char* regions;
    16.9  	TR_ENTRY *trp;
   16.10  	int tr_max;
   16.11  	int i;
    17.1 --- a/xen/include/asm-ia64/dom_fw.h	Mon Jul 03 09:11:49 2006 -0600
    17.2 +++ b/xen/include/asm-ia64/dom_fw.h	Wed Jul 05 09:28:32 2006 -0600
    17.3 @@ -168,4 +168,4 @@ extern struct sal_ret_values sal_emulato
    17.4  extern struct ia64_pal_retval pal_emulator_static (unsigned long);
    17.5  extern efi_status_t efi_emulator (struct pt_regs *regs, unsigned long *fault);
    17.6  
    17.7 -extern unsigned long dom_fw_setup (struct domain *, const char *, int);
    17.8 +extern void dom_fw_setup (struct domain *, unsigned long bp_mpa, unsigned long maxmem);
    18.1 --- a/xen/include/asm-ia64/domain.h	Mon Jul 03 09:11:49 2006 -0600
    18.2 +++ b/xen/include/asm-ia64/domain.h	Wed Jul 05 09:28:32 2006 -0600
    18.3 @@ -63,10 +63,26 @@ struct last_vcpu {
    18.4      int vcpu_id;
    18.5  } ____cacheline_aligned_in_smp;
    18.6  
    18.7 +/* These are data in domain memory for SAL emulator.  */
    18.8 +struct xen_sal_data {
    18.9 +    /* OS boot rendez vous.  */
   18.10 +    unsigned long boot_rdv_ip;
   18.11 +    unsigned long boot_rdv_r1;
   18.12 +
   18.13 +    /* There are these for EFI_SET_VIRTUAL_ADDRESS_MAP emulation. */
   18.14 +    int efi_virt_mode;		/* phys : 0 , virt : 1 */
   18.15 +};
   18.16 +
   18.17  struct arch_domain {
   18.18      struct mm_struct mm;
   18.19 -    unsigned long metaphysical_rr0;
   18.20 -    unsigned long metaphysical_rr4;
   18.21 +
   18.22 +    /* Flags.  */
   18.23 +    union {
   18.24 +        unsigned long flags;
   18.25 +        struct {
   18.26 +            unsigned int is_vti : 1;
   18.27 +        };
   18.28 +    };
   18.29  
   18.30      /* There are two ranges of RID for a domain:
   18.31         one big range, used to virtualize domain RID,
   18.32 @@ -74,37 +90,31 @@ struct arch_domain {
   18.33      /* Big range.  */
   18.34      int starting_rid;		/* first RID assigned to domain */
   18.35      int ending_rid;		/* one beyond highest RID assigned to domain */
   18.36 -    int rid_bits;		/* number of virtual rid bits (default: 18) */
   18.37      /* Metaphysical range.  */
   18.38      int starting_mp_rid;
   18.39      int ending_mp_rid;
   18.40 -
   18.41 +    /* RID for metaphysical mode.  */
   18.42 +    unsigned long metaphysical_rr0;
   18.43 +    unsigned long metaphysical_rr4;
   18.44 +    
   18.45 +    int rid_bits;		/* number of virtual rid bits (default: 18) */
   18.46      int breakimm;     /* The imm value for hypercalls.  */
   18.47  
   18.48 -    int physmap_built;		/* Whether is physmap built or not */
   18.49 -    int imp_va_msb;
   18.50 -    /* System pages out of guest memory, like for xenstore/console */
   18.51 -    unsigned long sys_pgnr;
   18.52 -    unsigned long max_pfn; /* Max pfn including I/O holes */
   18.53      struct virtual_platform_def     vmx_platform;
   18.54  #define	hvm_domain vmx_platform /* platform defs are not vmx specific */
   18.55  
   18.56 -    /* OS boot rendez vous.  */
   18.57 -    unsigned long boot_rdv_ip;
   18.58 -    unsigned long boot_rdv_r1;
   18.59 -
   18.60 +    u64 xen_vastart;
   18.61 +    u64 xen_vaend;
   18.62 +    u64 shared_info_va;
   18.63 + 
   18.64 +    /* Address of SAL emulator data  */
   18.65 +    struct xen_sal_data *sal_data;
   18.66      /* SAL return point.  */
   18.67      unsigned long sal_return_addr;
   18.68  
   18.69 -    u64 shared_info_va;
   18.70 -    unsigned long initrd_start;
   18.71 -    unsigned long initrd_len;
   18.72 -    char *cmdline;
   18.73 -    /* There are these for EFI_SET_VIRTUAL_ADDRESS_MAP emulation. */
   18.74 -    int efi_virt_mode;		/* phys : 0 , virt : 1 */
   18.75 -    /* Metaphysical address to efi_runtime_services_t in domain firmware memory is set. */
   18.76 +    /* Address of efi_runtime_services_t (placed in domain memory)  */
   18.77      void *efi_runtime;
   18.78 -    /* Metaphysical address to fpswa_interface_t in domain firmware memory is set. */
   18.79 +    /* Address of fpswa_interface_t (placed in domain memory)  */
   18.80      void *fpswa_inf;
   18.81  
   18.82      struct last_vcpu last_vcpu[NR_CPUS];
   18.83 @@ -114,23 +124,28 @@ struct arch_domain {
   18.84      offsetof(vcpu_info_t, evtchn_upcall_mask))
   18.85  
   18.86  struct arch_vcpu {
   18.87 -	TR_ENTRY itrs[NITRS];
   18.88 -	TR_ENTRY dtrs[NDTRS];
   18.89 -	TR_ENTRY itlb;
   18.90 -	TR_ENTRY dtlb;
   18.91 -	unsigned int itr_regions;
   18.92 -	unsigned int dtr_regions;
   18.93 -	unsigned long irr[4];
   18.94 -	unsigned long insvc[4];
   18.95 -	unsigned long tc_regions;
   18.96 -	unsigned long iva;
   18.97 -	unsigned long dcr;
   18.98 -	unsigned long itc;
   18.99 -	unsigned long domain_itm;
  18.100 -	unsigned long domain_itm_last;
  18.101 -	unsigned long xen_itm;
  18.102 +    /* Save the state of vcpu.
  18.103 +       This is the first entry to speed up accesses.  */
  18.104 +    mapped_regs_t *privregs;
  18.105 +
  18.106 +    /* TR and TC.  */
  18.107 +    TR_ENTRY itrs[NITRS];
  18.108 +    TR_ENTRY dtrs[NDTRS];
  18.109 +    TR_ENTRY itlb;
  18.110 +    TR_ENTRY dtlb;
  18.111  
  18.112 -    mapped_regs_t *privregs; /* save the state of vcpu */
  18.113 +    /* Bit is set if there is a tr/tc for the region.  */
  18.114 +    unsigned char itr_regions;
  18.115 +    unsigned char dtr_regions;
  18.116 +    unsigned char tc_regions;
  18.117 +
  18.118 +    unsigned long irr[4];	    /* Interrupt request register.  */
  18.119 +    unsigned long insvc[4];		/* Interrupt in service.  */
  18.120 +    unsigned long iva;
  18.121 +    unsigned long dcr;
  18.122 +    unsigned long domain_itm;
  18.123 +    unsigned long domain_itm_last;
  18.124 +
  18.125      unsigned long event_callback_ip;		// event callback handler
  18.126      unsigned long failsafe_callback_ip; 	// Do we need it?
  18.127  
    19.1 --- a/xen/include/asm-ia64/mm.h	Mon Jul 03 09:11:49 2006 -0600
    19.2 +++ b/xen/include/asm-ia64/mm.h	Wed Jul 05 09:28:32 2006 -0600
    19.3 @@ -429,7 +429,7 @@ extern void assign_domain_io_page(struct
    19.4  struct p2m_entry;
    19.5  extern unsigned long lookup_domain_mpa(struct domain *d, unsigned long mpaddr, struct p2m_entry* entry);
    19.6  extern void *domain_mpa_to_imva(struct domain *d, unsigned long mpaddr);
    19.7 -
    19.8 +extern volatile pte_t *lookup_noalloc_domain_pte(struct domain* d, unsigned long mpaddr);
    19.9  #ifdef CONFIG_XEN_IA64_DOM0_VP
   19.10  extern unsigned long assign_domain_mmio_page(struct domain *d, unsigned long mpaddr, unsigned long size);
   19.11  extern unsigned long assign_domain_mach_page(struct domain *d, unsigned long mpaddr, unsigned long size, unsigned long flags);
    20.1 --- a/xen/include/asm-ia64/vmx.h	Mon Jul 03 09:11:49 2006 -0600
    20.2 +++ b/xen/include/asm-ia64/vmx.h	Wed Jul 05 09:28:32 2006 -0600
    20.3 @@ -34,7 +34,7 @@ extern void vmx_init_env(void);
    20.4  extern void vmx_final_setup_guest(struct vcpu *v);
    20.5  extern void vmx_save_state(struct vcpu *v);
    20.6  extern void vmx_load_state(struct vcpu *v);
    20.7 -extern void vmx_setup_platform(struct domain *d, struct vcpu_guest_context *c);
    20.8 +extern void vmx_setup_platform(struct domain *d);
    20.9  extern void vmx_wait_io(void);
   20.10  extern void vmx_io_assist(struct vcpu *v);
   20.11  extern void panic_domain(struct pt_regs *regs, const char *fmt, ...);
   20.12 @@ -43,7 +43,6 @@ extern void vmx_save_state(struct vcpu *
   20.13  extern void vmx_load_state(struct vcpu *v);
   20.14  extern void show_registers(struct pt_regs *regs);
   20.15  #define show_execution_state show_registers
   20.16 -extern int vmx_build_physmap_table(struct domain *d);
   20.17  extern unsigned long __gpfn_to_mfn_foreign(struct domain *d, unsigned long gpfn);
   20.18  extern void sync_split_caches(void);
   20.19  extern void vmx_virq_line_assist(struct vcpu *v);
    21.1 --- a/xen/include/public/arch-ia64.h	Mon Jul 03 09:11:49 2006 -0600
    21.2 +++ b/xen/include/public/arch-ia64.h	Wed Jul 05 09:28:32 2006 -0600
    21.3 @@ -40,19 +40,6 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
    21.4  
    21.5  #ifndef __ASSEMBLY__
    21.6  
    21.7 -#define MAX_NR_SECTION  32  /* at most 32 memory holes */
    21.8 -struct mm_section {
    21.9 -    unsigned long start;  /* start of memory hole */
   21.10 -    unsigned long end;    /* end of memory hole */
   21.11 -};
   21.12 -typedef struct mm_section mm_section_t;
   21.13 -
   21.14 -struct pmt_entry {
   21.15 -    unsigned long mfn : 56;
   21.16 -    unsigned long type: 8;
   21.17 -};
   21.18 -typedef struct pmt_entry pmt_entry_t;
   21.19 -
   21.20  #define GPFN_MEM          (0UL << 56) /* Guest pfn is normal mem */
   21.21  #define GPFN_FRAME_BUFFER (1UL << 56) /* VGA framebuffer */
   21.22  #define GPFN_LOW_MMIO     (2UL << 56) /* Low MMIO range */
   21.23 @@ -94,16 +81,6 @@ typedef struct pmt_entry pmt_entry_t;
   21.24  #define GFW_START        (4*MEM_G -16*MEM_M)
   21.25  #define GFW_SIZE         (16*MEM_M)
   21.26  
   21.27 -/*
   21.28 - * NB. This may become a 64-bit count with no shift. If this happens then the 
   21.29 - * structure size will still be 8 bytes, so no other alignments will change.
   21.30 - */
   21.31 -struct tsc_timestamp {
   21.32 -    unsigned int  tsc_bits;      /* 0: 32 bits read from the CPU's TSC. */
   21.33 -    unsigned int  tsc_bitshift;  /* 4: 'tsc_bits' uses N:N+31 of TSC.   */
   21.34 -}; /* 8 bytes */
   21.35 -typedef struct tsc_timestamp tsc_timestamp_t;
   21.36 -
   21.37  struct pt_fpreg {
   21.38      union {
   21.39          unsigned long bits[2];
   21.40 @@ -302,15 +279,14 @@ struct mapped_regs {
   21.41      unsigned long  reserved7[4096];
   21.42  };
   21.43  typedef struct mapped_regs mapped_regs_t;
   21.44 +typedef mapped_regs_t vpd_t;
   21.45  
   21.46  struct arch_vcpu_info {
   21.47  };
   21.48  typedef struct arch_vcpu_info arch_vcpu_info_t;
   21.49  
   21.50 -typedef mapped_regs_t vpd_t;
   21.51 -
   21.52  struct arch_shared_info {
   21.53 -    unsigned int flags;
   21.54 +    /* PFN of the start_info page.  */
   21.55      unsigned long start_info_pfn;
   21.56  
   21.57      /* Interrupt vector for event channel.  */
   21.58 @@ -318,30 +294,13 @@ struct arch_shared_info {
   21.59  };
   21.60  typedef struct arch_shared_info arch_shared_info_t;
   21.61  
   21.62 -struct arch_initrd_info {
   21.63 -    unsigned long start;
   21.64 -    unsigned long size;
   21.65 -};
   21.66 -typedef struct arch_initrd_info arch_initrd_info_t;
   21.67 -
   21.68  typedef unsigned long xen_callback_t;
   21.69  
   21.70 -#define IA64_COMMAND_LINE_SIZE 512
   21.71  struct vcpu_guest_context {
   21.72 -#define VGCF_FPU_VALID (1<<0)
   21.73 -#define VGCF_VMX_GUEST (1<<1)
   21.74 -#define VGCF_IN_KERNEL (1<<2)
   21.75      unsigned long flags;       /* VGCF_* flags */
   21.76 -    unsigned long pt_base;     /* PMT table base */
   21.77 -    unsigned long share_io_pg; /* Shared page for I/O emulation */
   21.78 -    unsigned long sys_pgnr;    /* System pages out of domain memory */
   21.79 -    unsigned long vm_assist;   /* VMASST_TYPE_* bitmap, now none on IPF */
   21.80  
   21.81      struct cpu_user_regs user_regs;
   21.82 -    struct mapped_regs *privregs;
   21.83 -    struct arch_shared_info shared;
   21.84 -    struct arch_initrd_info initrd;
   21.85 -    char cmdline[IA64_COMMAND_LINE_SIZE];
   21.86 +    unsigned long privregs_pfn;
   21.87  };
   21.88  typedef struct vcpu_guest_context vcpu_guest_context_t;
   21.89  DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
   21.90 @@ -378,6 +337,28 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_conte
   21.91  #define ASSIGN_readonly                 (1UL << _ASSIGN_readonly)
   21.92  #define ASSIGN_writable                 (0UL << _ASSIGN_readonly) // dummy flag
   21.93  
   21.94 +/* This structure has the same layout of struct ia64_boot_param, defined in
   21.95 +   <asm/system.h>.  It is redefined here to ease use.  */
   21.96 +struct xen_ia64_boot_param {
   21.97 +	unsigned long command_line;	/* physical address of cmd line args */
   21.98 +	unsigned long efi_systab;	/* physical address of EFI system table */
   21.99 +	unsigned long efi_memmap;	/* physical address of EFI memory map */
  21.100 +	unsigned long efi_memmap_size;	/* size of EFI memory map */
  21.101 +	unsigned long efi_memdesc_size;	/* size of an EFI memory map descriptor */
  21.102 +	unsigned int  efi_memdesc_version;	/* memory descriptor version */
  21.103 +	struct {
  21.104 +		unsigned short num_cols;	/* number of columns on console.  */
  21.105 +		unsigned short num_rows;	/* number of rows on console.  */
  21.106 +		unsigned short orig_x;	/* cursor's x position */
  21.107 +		unsigned short orig_y;	/* cursor's y position */
  21.108 +	} console_info;
  21.109 +	unsigned long fpswa;		/* physical address of the fpswa interface */
  21.110 +	unsigned long initrd_start;
  21.111 +	unsigned long initrd_size;
  21.112 +	unsigned long domain_start;	/* va where the boot time domain begins */
  21.113 +	unsigned long domain_size;	/* how big is the boot domain */
  21.114 +};
  21.115 +
  21.116  #endif /* !__ASSEMBLY__ */
  21.117  
  21.118  /* Address of shared_info in domain virtual space.