[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5 2/3] arm: Allow the user to specify the GIC version



On Wed, 2015-07-08 at 11:17 +0100, Ian Campbell wrote:
> On Tue, 2015-07-07 at 17:22 +0100, Julien Grall wrote:
> > diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> > index e1632fa..11f6461 100644
> > --- a/tools/libxl/libxl_types.idl
> > +++ b/tools/libxl/libxl_types.idl
> > @@ -369,6 +369,12 @@ libxl_vnode_info = Struct("vnode_info", [
> >      ("vcpus", libxl_bitmap), # vcpus in this node
> >      ])
> >  
> > +libxl_gic_version = Enumeration("gic_version", [
> > +    (0, "DEFAULT"),
> > +    (0x20, "v2"),
> > +    (0x30, "v3")
> > +    ], init_val = "LIBXL_GIC_VERSION_DEFAULT")
> > +
> >  libxl_domain_build_info = Struct("domain_build_info",[
> >      ("max_vcpus",       integer),
> >      ("avail_vcpus",     libxl_bitmap),
> > @@ -480,6 +486,11 @@ libxl_domain_build_info = Struct("domain_build_info",[
> >                                        ])),
> >                   ("invalid", None),
> >                   ], keyvar_init_val = "LIBXL_DOMAIN_TYPE_INVALID")),
> > +
> > +
> > +    ("arch_arm", Struct(None, [("gic_version", libxl_gic_version),
> > +                              ])),
> > +
> >      ], dir=DIR_IN
> 
> This results in the following when building the ocaml bindings:
> 
> Traceback (most recent call last):
>   File "genwrap.py", line 529, in <module>
>     ml.write(gen_ocaml_ml(ty, False))
>   File "genwrap.py", line 217, in gen_ocaml_ml
>     s += gen_struct(ty)
>   File "genwrap.py", line 119, in gen_struct
>     x = ocaml_instance_of_field(f)
>   File "genwrap.py", line 112, in ocaml_instance_of_field
>     return "%s : %s" % (munge_name(name), ocaml_type_of(f.type))
>   File "genwrap.py", line 90, in ocaml_type_of
>     return ty.rawname.capitalize() + ".t"
> AttributeError: 'NoneType' object has no attribute 'capitalize'
> make[7]: *** No rule to make target '_libxl_types.ml.in', needed by 
> 'xenlight.ml'.  Stop.
> 
> I'll take a look.

I have a patch to genwrap.py which results in the following diff to the
generate ml files for the anonymous sub-struct added by the IDL change
above.

Dave/Euan/Rob, is that idiomatic ocaml or is it possible to have
anonymous structs in ocaml like it is in C?

If there is a better/more usual way to do this would you mind supplying
me with the ocaml I should be aiming for please?

Ian.

--- tools/ocaml/libs/xl/_libxl_BACKUP_types.ml.in       2015-07-08 
11:22:35.000000000 +0100
+++ tools/ocaml/libs/xl/_libxl_types.ml.in      2015-07-08 12:25:56.000000000 
+0100
@@ -508,6 +508,17 @@ module Vnode_info = struct
        external default : ctx -> unit -> t = "stub_libxl_vnode_info_init"
 end
 
+(* libxl_gic_version implementation *)
+type gic_version = 
+        | GIC_VERSION_DEFAULT
+        | GIC_VERSION_V2
+        | GIC_VERSION_V3
+
+let string_of_gic_version = function
+       | GIC_VERSION_DEFAULT -> "DEFAULT"
+       | GIC_VERSION_V2 -> "V2"
+       | GIC_VERSION_V3 -> "V3"
+
 (* libxl_domain_build_info implementation *)
 module Domain_build_info = struct
 
@@ -566,6 +577,10 @@ module Domain_build_info = struct
        
        type type__union = Hvm of type_hvm | Pv of type_pv | Invalid
        
+       type arch_arm__anon = {
+               gic_version : gic_version;
+       }
+       
        type t =
        {
                max_vcpus : int;
@@ -607,6 +622,7 @@ module Domain_build_info = struct
                ramdisk : string option;
                device_tree : string option;
                xl_type : type__union;
+               arch_arm : arch_arm__anon;
        }
        external default : ctx -> ?xl_type:domain_type -> unit -> t = 
"stub_libxl_domain_build_info_init"
 end




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.