ia64/xen-unstable

changeset 5909:de1207b85ef8

Always pass around the store machine frame number instead of the linear address.
Also cleanup IOCTL_PRIVCMD_INITDOMAIN_STORE.
Signed-off-by: Rusty Russel <rusty@rustcorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Wed Jul 27 17:17:09 2005 +0000 (2005-07-27)
parents ae3a721bbcb8
children 06c5924b0c2e
files linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c tools/libxc/xc_linux_build.c xen/include/public/xen.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Wed Jul 27 17:06:02 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Wed Jul 27 17:17:09 2005 +0000
     1.3 @@ -200,27 +200,29 @@ static int privcmd_ioctl(struct inode *i
     1.4      case IOCTL_PRIVCMD_INITDOMAIN_STORE:
     1.5      {
     1.6          extern int do_xenbus_probe(void*);
     1.7 +        unsigned long page;
     1.8  
     1.9          if (xen_start_info.store_evtchn != 0) {
    1.10 -            ret = -EINVAL;
    1.11 +            ret = xen_start_info.store_mfn;
    1.12              break;
    1.13          }
    1.14  
    1.15          /* Allocate page. */
    1.16 -        xen_start_info.store_page = get_zeroed_page(GFP_KERNEL);
    1.17 -        if (!xen_start_info.store_page) {
    1.18 +        page = get_zeroed_page(GFP_KERNEL);
    1.19 +        if (!page) {
    1.20              ret = -ENOMEM;
    1.21              break;
    1.22          }
    1.23  
    1.24          /* We don't refcnt properly, so set reserved on page.
    1.25           * (this allocation is permanent) */
    1.26 -        SetPageReserved(virt_to_page(xen_start_info.store_page));
    1.27 +        SetPageReserved(virt_to_page(page));
    1.28  
    1.29          /* Initial connect. Setup channel and page. */
    1.30          xen_start_info.store_evtchn = data;
    1.31 -        ret = pfn_to_mfn(virt_to_phys((void *)xen_start_info.store_page) >>
    1.32 -                         PAGE_SHIFT);
    1.33 +        xen_start_info.store_mfn = pfn_to_mfn(virt_to_phys((void *)page) >>
    1.34 +                                              PAGE_SHIFT);
    1.35 +        ret = xen_start_info.store_mfn;
    1.36  
    1.37          /* We'll return then this will wait for daemon to answer */
    1.38          kthread_run(do_xenbus_probe, NULL, "xenbus_probe");
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c	Wed Jul 27 17:06:02 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c	Wed Jul 27 17:17:09 2005 +0000
     2.3 @@ -202,10 +202,11 @@ int xb_init_comms(void **in, void **out)
     2.4  		return err;
     2.5  	}
     2.6  
     2.7 -	/* FIXME zero out page -- domain builder should probably do this*/
     2.8 -	memset((void *)xen_start_info.store_page, 0, PAGE_SIZE);
     2.9 +	*out = machine_to_virt(xen_start_info.store_mfn << PAGE_SHIFT);
    2.10 +	*in = *out + PAGE_SIZE / 2;
    2.11  
    2.12 -	*out = (void *)xen_start_info.store_page;
    2.13 -	*in = (void *)xen_start_info.store_page + PAGE_SIZE/2;
    2.14 +	/* FIXME zero out page -- domain builder should probably do this*/
    2.15 +	memset(*out, 0, PAGE_SIZE);
    2.16 +
    2.17  	return 0;
    2.18  }
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Wed Jul 27 17:06:02 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Wed Jul 27 17:17:09 2005 +0000
     3.3 @@ -94,7 +94,7 @@ static void *read_reply(enum xsd_sockmsg
     3.4  void xenbus_debug_write(const char *str, unsigned int count)
     3.5  {
     3.6  	struct xsd_sockmsg msg;
     3.7 -	void *out = (void *)xen_start_info.store_page;
     3.8 +	void *out = machine_to_virt(xen_start_info.store_mfn << PAGE_SHIFT);
     3.9  
    3.10  	msg.type = XS_DEBUG;
    3.11  	msg.len = sizeof("print") + count + 1;
     4.1 --- a/tools/libxc/xc_linux_build.c	Wed Jul 27 17:06:02 2005 +0000
     4.2 +++ b/tools/libxc/xc_linux_build.c	Wed Jul 27 17:17:09 2005 +0000
     4.3 @@ -500,6 +500,8 @@ static int setup_guest(int xc_handle,
     4.4          goto error_out;
     4.5  #endif
     4.6  
     4.7 +    *store_mfn = page_array[(vstoreinfo_start-dsi.v_start) >> PAGE_SHIFT];
     4.8 +
     4.9      start_info = xc_map_foreign_range(
    4.10          xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE,
    4.11          page_array[(vstartinfo_start-dsi.v_start)>>PAGE_SHIFT]);
    4.12 @@ -511,7 +513,7 @@ static int setup_guest(int xc_handle,
    4.13      start_info->nr_pt_frames = nr_pt_pages;
    4.14      start_info->mfn_list     = vphysmap_start;
    4.15      start_info->domain_controller_evtchn = control_evtchn;
    4.16 -    start_info->store_page   = vstoreinfo_start;
    4.17 +    start_info->store_mfn    = *store_mfn;
    4.18      start_info->store_evtchn = store_evtchn;
    4.19      if ( initrd_len != 0 )
    4.20      {
    4.21 @@ -522,9 +524,6 @@ static int setup_guest(int xc_handle,
    4.22      start_info->cmd_line[MAX_GUEST_CMDLINE-1] = '\0';
    4.23      munmap(start_info, PAGE_SIZE);
    4.24  
    4.25 -    /* Tell our caller where we told domain store page was. */
    4.26 -    *store_mfn = page_array[((vstoreinfo_start-dsi.v_start)>>PAGE_SHIFT)];
    4.27 -
    4.28      /* shared_info page starts its life empty. */
    4.29      shared_info = xc_map_foreign_range(
    4.30          xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, shared_info_frame);
     5.1 --- a/xen/include/public/xen.h	Wed Jul 27 17:06:02 2005 +0000
     5.2 +++ b/xen/include/public/xen.h	Wed Jul 27 17:17:09 2005 +0000
     5.3 @@ -446,7 +446,7 @@ typedef struct start_info {
     5.4      memory_t mod_start;       /* VIRTUAL address of pre-loaded module.    */
     5.5      memory_t mod_len;         /* Size (bytes) of pre-loaded module.       */
     5.6      s8 cmd_line[MAX_GUEST_CMDLINE];
     5.7 -    memory_t store_page;      /* VIRTUAL address of store page.           */
     5.8 +    memory_t store_mfn;       /* MACHINE page number of shared page.      */
     5.9      u16      store_evtchn;    /* Event channel for store communication.   */
    5.10  } start_info_t;
    5.11