All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Xen Mailing List <xen-devel@lists.sourceforge.net>
Cc: Mike Wray <mike.wray@hpl.hp.com>
Subject: [PATCH] Store page and evtchn in start_info_t
Date: Tue, 31 May 2005 20:47:36 +1000	[thread overview]
Message-ID: <1117536456.7878.26.camel@localhost.localdomain> (raw)

Hi all,

	This is a trivial patch which adds the two fields to start_info_t for
the shared page and event channel port for the share.  Feel free to
destroy this in any way. The python binding just fills zeros in for the
moment, making it harmless.

Mike Wray has a nicer version in his tree, but this is the minimal
version.  (Thanks to Mike for the .esp fix, too).

Cheers,
Rusty.

diff -ur xen-unstable/tools/libxc/xc.h xen-unstable-working/tools/libxc/xc.h
--- xen-unstable/tools/libxc/xc.h	2005-05-31 15:39:52.000000000 +1000
+++ xen-unstable-working/tools/libxc/xc.h	2005-05-31 17:36:49.000000000 +1000
@@ -252,7 +252,9 @@
                    const char *cmdline,
                    unsigned int control_evtchn,
                    unsigned long flags,
-                   unsigned int vcpus);
+                   unsigned int vcpus,
+                   unsigned int store_evtchn,
+                   unsigned long *store_mfn);
 
 int
 xc_plan9_build (int xc_handle,
diff -ur xen-unstable/tools/libxc/xc_linux_build.c xen-unstable-working/tools/libxc/xc_linux_build.c
--- xen-unstable/tools/libxc/xc_linux_build.c	2005-05-24 13:10:24.000000000 +1000
+++ xen-unstable-working/tools/libxc/xc_linux_build.c	2005-05-31 17:44:08.000000000 +1000
@@ -50,7 +50,8 @@
                          unsigned long shared_info_frame,
                          unsigned int control_evtchn,
                          unsigned long flags,
-                         unsigned int vcpus)
+                         unsigned int vcpus,
+                         unsigned int store_evtchn, unsigned long *store_mfn)
 {
     l1_pgentry_t *vl1tab=NULL, *vl1e=NULL;
     l2_pgentry_t *vl2tab=NULL, *vl2e=NULL;
@@ -108,7 +109,8 @@
     {
         vpt_end          = vpt_start + (nr_pt_pages * PAGE_SIZE);
         vstartinfo_start = vpt_end;
-        vstartinfo_end   = vstartinfo_start + PAGE_SIZE;
+        /* Place store shared page after startinfo. */
+        vstartinfo_end   = vstartinfo_start + PAGE_SIZE * 2;
         vstack_start     = vstartinfo_end;
         vstack_end       = vstack_start + PAGE_SIZE;
         v_end            = (vstack_end + (1<<22)-1) & ~((1<<22)-1);
@@ -125,13 +127,15 @@
            " Phys-Mach map: %08lx->%08lx\n"
            " Page tables:   %08lx->%08lx\n"
            " Start info:    %08lx->%08lx\n"
+           " Store page:    %08lx->%08lx\n"
            " Boot stack:    %08lx->%08lx\n"
            " TOTAL:         %08lx->%08lx\n",
            dsi.v_kernstart, dsi.v_kernend, 
            vinitrd_start, vinitrd_end,
            vphysmap_start, vphysmap_end,
            vpt_start, vpt_end,
-           vstartinfo_start, vstartinfo_end,
+           vstartinfo_start, vstartinfo_start + PAGE_SIZE,
+	   vstartinfo_start + PAGE_SIZE, vstartinfo_end,
            vstack_start, vstack_end,
            dsi.v_start, v_end);
     printf(" ENTRY ADDRESS: %08lx\n", dsi.v_kernentry);
@@ -261,6 +265,8 @@
     start_info->nr_pt_frames = nr_pt_pages;
     start_info->mfn_list     = vphysmap_start;
     start_info->domain_controller_evtchn = control_evtchn;
+    start_info->store_page   = vstartinfo_start + PAGE_SIZE;
+    start_info->store_evtchn = store_evtchn;
     if ( initrd_len != 0 )
     {
         start_info->mod_start    = vinitrd_start;
@@ -270,6 +276,9 @@
     start_info->cmd_line[MAX_CMDLINE-1] = '\0';
     munmap(start_info, PAGE_SIZE);
 
+    /* Tell our caller where we told domain store page was. */
+    *store_mfn = page_array[((vstartinfo_start-dsi.v_start)>>PAGE_SHIFT) + 1];
+
     /* shared_info page starts its life empty. */
     shared_info = xc_map_foreign_range(
         xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, shared_info_frame);
@@ -310,7 +319,9 @@
                    const char *cmdline,
                    unsigned int control_evtchn,
                    unsigned long flags,
-                   unsigned int vcpus)
+                   unsigned int vcpus,
+                   unsigned int store_evtchn,
+                   unsigned long *store_mfn)
 {
     dom0_op_t launch_op, op;
     int initrd_fd = -1;
@@ -381,7 +392,8 @@
                        &vstartinfo_start, &vkern_entry,
                        ctxt, cmdline,
                        op.u.getdomaininfo.shared_info_frame,
-                       control_evtchn, flags, vcpus) < 0 )
+                       control_evtchn, flags, vcpus,
+                       store_evtchn, store_mfn) < 0 )
     {
         ERROR("Error constructing guest OS");
         goto error_out;
@@ -412,7 +424,7 @@
     ctxt->user_regs.ss = FLAT_KERNEL_DS;
     ctxt->user_regs.cs = FLAT_KERNEL_CS;
     ctxt->user_regs.eip = vkern_entry;
-    ctxt->user_regs.esp = vstartinfo_start + 2*PAGE_SIZE;
+    ctxt->user_regs.esp = vstartinfo_start + 3*PAGE_SIZE;
     ctxt->user_regs.esi = vstartinfo_start;
     ctxt->user_regs.eflags = 1 << 9; /* Interrupt Enable */
 
@@ -434,7 +446,7 @@
 
     /* Ring 1 stack is the initial stack. */
     ctxt->kernel_ss = FLAT_KERNEL_DS;
-    ctxt->kernel_sp = vstartinfo_start + 2*PAGE_SIZE;
+    ctxt->kernel_sp = vstartinfo_start + 3*PAGE_SIZE;
 
     /* No debugging. */
     memset(ctxt->debugreg, 0, sizeof(ctxt->debugreg));
diff -ur xen-unstable/tools/python/xen/lowlevel/xc/xc.c xen-unstable-working/tools/python/xen/lowlevel/xc/xc.c
--- xen-unstable/tools/python/xen/lowlevel/xc/xc.c	2005-05-31 15:39:54.000000000 +1000
+++ xen-unstable-working/tools/python/xen/lowlevel/xc/xc.c	2005-05-31 17:40:12.000000000 +1000
@@ -261,7 +261,8 @@
 
     u32   dom;
     char *image, *ramdisk = NULL, *cmdline = "";
-    int   control_evtchn, flags = 0, vcpus = 1;
+    int   control_evtchn, store_evtchn = 0, flags = 0, vcpus = 1;
+    unsigned long store_mfn;
 
     static char *kwd_list[] = { "dom", "control_evtchn", 
                                 "image", "ramdisk", "cmdline", "flags", "vcpus",
@@ -272,8 +273,10 @@
                                       &image, &ramdisk, &cmdline, &flags, &vcpus) )
         return NULL;
 
+    /* FIXME: Integrate store_mfn and store_evtchn into python callers. */
     if ( xc_linux_build(xc->xc_handle, dom, image,
-                        ramdisk, cmdline, control_evtchn, flags, vcpus) != 0 )
+                        ramdisk, cmdline, control_evtchn, flags, vcpus,
+			store_evtchn, &store_mfn) != 0 )
         return PyErr_SetFromErrno(xc_error);
     
     Py_INCREF(zero);
diff -ur xen-unstable/xen/include/public/xen.h xen-unstable-working/xen/include/public/xen.h
--- xen-unstable/xen/include/public/xen.h	2005-05-24 13:10:17.000000000 +1000
+++ xen-unstable-working/xen/include/public/xen.h	2005-05-31 17:36:49.000000000 +1000
@@ -461,7 +461,10 @@
     memory_t mod_len;         /* 56: Size (bytes) of pre-loaded module.    */
     _MEMORY_PADDING(G);
     s8 cmd_line[MAX_CMDLINE]; /* 64 */
-} PACKED start_info_t; /* 320 bytes */
+    memory_t store_page;      /* 320: VIRTUAL address of store ringbuffer page. */
+    _MEMORY_PADDING(H);
+    u16      store_evtchn;    /* 328: Event channel for store communication. */
+} PACKED start_info_t; /* 332/336 bytes */
 
 /* These flags are passed in the 'flags' field of start_info_t. */
 #define SIF_PRIVILEGED    (1<<0)  /* Is the domain privileged? */

-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman

                 reply	other threads:[~2005-05-31 10:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1117536456.7878.26.camel@localhost.localdomain \
    --to=rusty@rustcorp.com.au \
    --cc=mike.wray@hpl.hp.com \
    --cc=xen-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.