ia64/xen-unstable

changeset 15171:5c7a1e3abd54

[BUILDER] Propagate the native protocol ABI for a guest out of the
domain builder and in to python code.

This knowledge will be useful to allow us to pre-seed the protocol
field in a VBD entry in xenstore which will allow us to run older
kernels in a 32on64 mixed environment.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Ian Campbell <ian.campbell@xensource.com>
date Tue May 15 17:54:48 2007 +0100 (2007-05-15)
parents e1f43038f1d8
children 5efb46bfbcac
files tools/libxc/xc_dom.h tools/libxc/xc_dom_x86.c tools/python/xen/lowlevel/xc/xc.c
line diff
     1.1 --- a/tools/libxc/xc_dom.h	Tue May 15 17:01:57 2007 +0100
     1.2 +++ b/tools/libxc/xc_dom.h	Tue May 15 17:54:48 2007 +0100
     1.3 @@ -136,6 +136,7 @@ struct xc_dom_arch {
     1.4      int (*vcpu) (struct xc_dom_image * dom, void *vcpu_ctxt);
     1.5  
     1.6      char *guest_type;
     1.7 +    char *native_protocol;
     1.8      int page_shift;
     1.9      int sizeof_pfn;
    1.10  
     2.1 --- a/tools/libxc/xc_dom_x86.c	Tue May 15 17:01:57 2007 +0100
     2.2 +++ b/tools/libxc/xc_dom_x86.c	Tue May 15 17:54:48 2007 +0100
     2.3 @@ -19,6 +19,7 @@
     2.4  #include <xen/foreign/x86_64.h>
     2.5  #include <xen/hvm/hvm_info_table.h>
     2.6  #include <xen/hvm/e820.h>
     2.7 +#include <xen/io/protocols.h>
     2.8  
     2.9  #include "xg_private.h"
    2.10  #include "xc_dom.h"
    2.11 @@ -589,6 +590,7 @@ static int vcpu_x86_64(struct xc_dom_ima
    2.12  
    2.13  static struct xc_dom_arch xc_dom_32 = {
    2.14      .guest_type = "xen-3.0-x86_32",
    2.15 +    .native_protocol = XEN_IO_PROTO_ABI_X86_32,
    2.16      .page_shift = PAGE_SHIFT_X86,
    2.17      .sizeof_pfn = 4,
    2.18      .alloc_magic_pages = alloc_magic_pages,
    2.19 @@ -600,6 +602,7 @@ static struct xc_dom_arch xc_dom_32 = {
    2.20  };
    2.21  static struct xc_dom_arch xc_dom_32_pae = {
    2.22      .guest_type = "xen-3.0-x86_32p",
    2.23 +    .native_protocol = XEN_IO_PROTO_ABI_X86_32,
    2.24      .page_shift = PAGE_SHIFT_X86,
    2.25      .sizeof_pfn = 4,
    2.26      .alloc_magic_pages = alloc_magic_pages,
    2.27 @@ -612,6 +615,7 @@ static struct xc_dom_arch xc_dom_32_pae 
    2.28  
    2.29  static struct xc_dom_arch xc_dom_64 = {
    2.30      .guest_type = "xen-3.0-x86_64",
    2.31 +    .native_protocol = XEN_IO_PROTO_ABI_X86_64,
    2.32      .page_shift = PAGE_SHIFT_X86,
    2.33      .sizeof_pfn = 8,
    2.34      .alloc_magic_pages = alloc_magic_pages,
     3.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Tue May 15 17:01:57 2007 +0100
     3.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Tue May 15 17:54:48 2007 +0100
     3.3 @@ -407,6 +407,7 @@ static PyObject *pyxc_linux_build(XcObje
     3.4      unsigned long console_mfn = 0;
     3.5      PyObject* elfnote_dict;
     3.6      PyObject* elfnote = NULL;
     3.7 +    PyObject* ret;
     3.8      int i;
     3.9  
    3.10      static char *kwd_list[] = { "domid", "store_evtchn", "memsize",
    3.11 @@ -455,12 +456,22 @@ static PyObject *pyxc_linux_build(XcObje
    3.12  	Py_DECREF(elfnote);
    3.13      }
    3.14  
    3.15 +    ret = Py_BuildValue("{s:i,s:i,s:N}",
    3.16 +			"store_mfn", store_mfn,
    3.17 +			"console_mfn", console_mfn,
    3.18 +			"notes", elfnote_dict);
    3.19 +
    3.20 +    if ( dom->arch_hooks->native_protocol )
    3.21 +    {
    3.22 +	PyObject *native_protocol =
    3.23 +	    Py_BuildValue("s", dom->arch_hooks->native_protocol);
    3.24 +	PyDict_SetItemString(ret, "native_protocol", native_protocol);
    3.25 +	Py_DECREF(native_protocol);
    3.26 +    }
    3.27 +
    3.28      xc_dom_release(dom);
    3.29  
    3.30 -    return Py_BuildValue("{s:i,s:i,s:N}", 
    3.31 -                         "store_mfn", store_mfn,
    3.32 -                         "console_mfn", console_mfn,
    3.33 -			 "notes", elfnote_dict);
    3.34 +    return ret;
    3.35  
    3.36    out:
    3.37      xc_dom_release(dom);