bitkeeper revision 1.885 (4094465dmX2TefiJicy4taNzc0jiaw)
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>
Sun, 2 May 2004 00:52:45 +0000 (00:52 +0000)
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>
Sun, 2 May 2004 00:52:45 +0000 (00:52 +0000)
manual merge

1  2 
tools/xc/lib/xc_linux_build.c
tools/xc/lib/xc_netbsd_build.c
xen/common/kernel.c
xenolinux-2.4.26-sparse/arch/xen/drivers/dom0/core.c
xenolinux-2.4.26-sparse/arch/xen/mm/ioremap.c
xenolinux-2.4.26-sparse/include/asm-xen/proc_cmd.h

index 42696666a8c3c021fe9a9cd550a71ab91d68d2ea,27bc6c6668186258145fcd8eb3690da9aaa72b05..67351210fc7a0377baf4cdd6b9a5a51eab635c69
@@@ -71,10 -70,11 +71,11 @@@ static int setup_guestos(int xc_handle
                           gzFile initrd_gfd, unsigned long initrd_len,
                           unsigned long nr_pages,
                           unsigned long *pvsi, unsigned long *pvke,
 -                         dom0_builddomain_t *builddomain, 
 +                       full_execution_context_t *ctxt,
                           const char *cmdline,
                           unsigned long shared_info_frame,
-                          unsigned int control_evtchn)
+                          unsigned int control_evtchn,
+                          int io_priv)
  {
      l1_pgentry_t *vl1tab=NULL, *vl1e=NULL;
      l2_pgentry_t *vl2tab=NULL, *vl2e=NULL;
@@@ -444,9 -440,9 +446,9 @@@ int xc_linux_build(int xc_handle
      if ( setup_guestos(xc_handle, domid, image, image_size, 
                         initrd_gfd, initrd_size, nr_pages, 
                         &vstartinfo_start, &vkern_entry,
 -                       &launch_op.u.builddomain, cmdline,
 +                       ctxt, cmdline,
                         op.u.getdomaininfo.shared_info_frame,
-                        control_evtchn) < 0 )
+                        control_evtchn, io_priv) < 0 )
      {
          ERROR("Error constructing guest OS");
          goto error_out;
index 7c67d57d71e94dd0ce0097f5256b1ae5025cef5d,cac444bd80c63c59092ef107ddc072a304f204ff..8260c75ea469746c17599b2d3e56c5ebdc7cc99b
@@@ -60,10 -59,11 +60,11 @@@ static int setup_guestos(int xc_handle
                           unsigned long tot_pages,
                           unsigned long *virt_startinfo_addr, 
                           unsigned long *virt_load_addr, 
 -                         dom0_builddomain_t *builddomain, 
 +                       full_execution_context_t *ctxt,
                           const char *cmdline,
                           unsigned long shared_info_frame,
-                          unsigned int control_evtchn)
+                          unsigned int control_evtchn,
+                          int io_priv)
  {
      l1_pgentry_t *vl1tab=NULL, *vl1e=NULL;
      l2_pgentry_t *vl2tab=NULL, *vl2e=NULL;
@@@ -267,9 -263,9 +269,9 @@@ int xc_netbsd_build(int xc_handle
  
      if ( setup_guestos(xc_handle, domid, kernel_gfd, tot_pages,
                         &virt_startinfo_addr,
 -                       &load_addr, &launch_op.u.builddomain, cmdline,
 +                       &load_addr, &st_ctxt, cmdline,
                         op.u.getdomaininfo.shared_info_frame,
-                        control_evtchn) < 0 )
+                        control_evtchn, io_priv) < 0 )
      {
          ERROR("Error constructing guest OS");
          goto error_out;
Simple merge
index 4e507081beac8e5ed25bc4882b901dcbe8396aae,e6fc3aed0587a043b9ed67318f63fca9c304deee..98eff634539d5a3bd6daaa27d051879b38cbb49b
@@@ -62,56 -62,14 +62,63 @@@ static int privcmd_ioctl(struct inode *
      }
      break;
  
 +    case IOCTL_PRIVCMD_MMAP:
 +    {
 +#define PRIVCMD_MMAP_SZ 32
 +      privcmd_mmap_t mmapcmd;
 +      privcmd_mmap_entry_t msg[PRIVCMD_MMAP_SZ], *p;
 +      int i, rc;
 +
 +        if ( copy_from_user(&mmapcmd, (void *)data, sizeof(mmapcmd)) )
 +            return -EFAULT;
 +
 +      p = mmapcmd.entry;
 +
 +      for (i=0; i<mmapcmd.num; i+=PRIVCMD_MMAP_SZ, p+=PRIVCMD_MMAP_SZ)
 +      {
 +          int j, n = ((mmapcmd.num-i)>PRIVCMD_MMAP_SZ)?
 +              PRIVCMD_MMAP_SZ:(mmapcmd.num-i);
 +          if ( copy_from_user(&msg, p, n*sizeof(privcmd_mmap_entry_t)) )
 +              return -EFAULT;
 +          
 +          for (j=0;j<n;j++)
 +          {
 +              struct vm_area_struct *vma = 
 +                  find_vma( current->mm, msg[j].va );
 +
 +              if (!vma)
 +                  return -EINVAL;
 +
 +              if (msg[j].va > PAGE_OFFSET)
 +                  return -EINVAL;
 +
 +              if (msg[j].va + (msg[j].npages<<PAGE_SHIFT) > vma->vm_end)
 +                  return -EINVAL;
 +
 +              if (rc = direct_remap_area_pages(vma->vm_mm, 
 +                                          msg[j].va&PAGE_MASK, 
 +                                          msg[j].mfn<<PAGE_SHIFT, 
 +                                          msg[j].npages<<PAGE_SHIFT, 
 +                                          vma->vm_page_prot,
 +                                          mmapcmd.dom))
 +                  return rc;
 +          }
 +      }
 +      ret = 0;
 +    }
 +    break;
 +
+     case IOCTL_PRIVCMD_INITDOMAIN_EVTCHN:
+     {
+         extern int initdom_ctrlif_domcontroller_port;
+         ret = initdom_ctrlif_domcontroller_port;
+     }
+     break;
++    
 +    default:
 +        ret = -EINVAL;
 +      break;
      }
 -
      return ret;
  }
  
index 7b4d1ff0a94284f178889466afc0da24bddfad06,4eeac0c4dda64be7b0bfb8b36506c7d41c9f5a08..773a1f83c38cd6549f36a5c9f5f852189dbb053a
@@@ -56,35 -61,27 +61,33 @@@ static inline int direct_remap_area_pte
          v += 2;
      }
  
-     address &= ~PMD_MASK;
-     end = address + size;
-     if (end > PMD_SIZE)
-         end = PMD_SIZE;
-     if (address >= end)
-         BUG();
      do {
 +#if 0  /* thanks to new ioctl mmaping interface this is no longer a bug */
          if (!pte_none(*pte)) {
              printk("direct_remap_area_pte: page already exists\n");
              BUG();
          }
 +#endif
          v->ptr = virt_to_machine(pte);
          v->val = (machine_addr & PAGE_MASK) | pgprot_val(prot) | _PAGE_IO;
-         v++;
+         if ( ++v == MAX_DIRECTMAP_MMU_QUEUE )
+         {
+             if ( HYPERVISOR_mmu_update(u, MAX_DIRECTMAP_MMU_QUEUE) < 0 )
+                 return -EFAULT;
+             goto reset_buffer;
+         }
          address += PAGE_SIZE;
          machine_addr += PAGE_SIZE;
          pte++;
      } while (address && (address < end));
  
 -    if ( ((v-u) != 0) && (HYPERVISOR_mmu_update(u, v-u) < 0) )
 -        return -EFAULT;
 +    if ( ((v-u) > 2) && (HYPERVISOR_mmu_update(u, v-u) < 0) )
 +    {
 +        printk(KERN_WARNING "Failed to ioremap %08lx->%08lx (%08lx)\n",
 +               end-size, end, machine_addr-size);
 +      return -EINVAL;
 +    }
  
-     vfree(u);
      return 0;
  }
  
@@@ -110,11 -107,10 +113,11 @@@ static inline int direct_remap_area_pmd
          pte_t * pte = pte_alloc(mm, pmd, address);
          if (!pte)
              return -ENOMEM;
-         if ( rc = direct_remap_area_pte(pte, address, end - address, 
-                               address + machine_addr, prot, domid) )
-           return rc;
 +
+         error = direct_remap_area_pte(pte, address, end - address, 
+                                       address + machine_addr, prot, domid);
+         if ( error )
+             break;
          address = (address + PMD_SIZE) & PMD_MASK;
          pmd++;
      } while (address && (address < end));
index 30cec9aff539c69d72047a84043afa85ca1dcb52,d359b6eaa7ee8cb3ee5526c7063318cc6c5b298d..3bf03c6064db71f4641996fbde285e31d7f869f9
@@@ -13,30 -13,21 +13,42 @@@ typedef struct privcmd_hypercal
      unsigned long arg[5];
  } privcmd_hypercall_t;
  
- #define IOCTL_PRIVCMD_HYPERCALL        \
 +typedef struct privcmd_mmap_entry {
 +    unsigned long va;
 +    unsigned long mfn;
 +    unsigned long npages;
 +} privcmd_mmap_entry_t; 
 +
 +typedef struct privcmd_mmap {
 +    int num;
 +    domid_t dom; /* target domain */
 +    privcmd_mmap_entry_t *entry;
 +} privcmd_mmap_t; 
 +
 +typedef struct privcmd_blkmsg
 +{
 +    unsigned long op;
 +    void         *buf;
 +    int           buf_size;
 +} privcmd_blkmsg_t;
 +
+ /*
+  * @cmd: IOCTL_PRIVCMD_HYPERCALL
+  * @arg: &privcmd_hypercall_t
+  * Return: Value returned from execution of the specified hypercall.
+  */
+ #define IOCTL_PRIVCMD_HYPERCALL         \
      _IOC(_IOC_NONE, 'P', 0, sizeof(privcmd_hypercall_t))
- #define IOCTL_PRIVCMD_BLKMSG           \
-     _IOC(_IOC_NONE, 'P', 1, sizeof(privcmd_blkmsg_t))
+ /*
+  * @cmd: IOCTL_PRIVCMD_INITDOMAIN_EVTCHN
+  * @arg: n/a
+  * Return: Port associated with domain-controller end of control event channel
+  *         for the initial domain.
+  */
+ #define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN \
+     _IOC(_IOC_NONE, 'P', 1, 0)
 +#define IOCTL_PRIVCMD_MMAP             \
 +    _IOC(_IOC_NONE, 'P', 2, sizeof(privcmd_mmap_t))
  
  #endif /* __PROC_CMD_H__ */