From: Ian Campbell Subject: Re: Re: [PATCH 3 of 4] libxl: Add support for passing in the machine's E820 for PCI passthrough in libxl_device_pci_parse_bdf Date: Tue, 12 Apr 2011 20:29:42 +0100 Message-ID: <1302636582.5528.25.camel@localhost.localdomain> References: <75e24fb720fa9a1c529b.1302557733@localhost6.localdomain6> <1302610783.27835.146.camel@zakaz.uk.xensource.com> <20110412175315.GA19066@dumpdata.com> <1302633888.5528.23.camel@localhost.localdomain> <20110412190040.GA23249@dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20110412190040.GA23249@dumpdata.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Konrad Rzeszutek Wilk Cc: Tim Deegan , "xen-devel@lists.xensource.com" , Ian Jackson , "keir.fraser@eu.citrix.com" List-Id: xen-devel@lists.xenproject.org On Tue, 2011-04-12 at 20:00 +0100, Konrad Rzeszutek Wilk wrote: > On Tue, Apr 12, 2011 at 07:44:48PM +0100, Ian Campbell wrote: > > On Tue, 2011-04-12 at 18:53 +0100, Konrad Rzeszutek Wilk wrote: > > > On Tue, Apr 12, 2011 at 01:19:43PM +0100, Ian Campbell wrote: > > > > On Mon, 2011-04-11 at 22:35 +0100, Konrad Rzeszutek Wilk wrote: > > > > >=20 > > > > >=20 > > > > > The code libxl_device_pci_parse_bdf calls the libxl__e820_alloc= when > > > > > it has parsed one BDF. Subsequent calls to libxl_device_pci_par= se_bdf > > > > > will > > > > > not trigger libxl__e820_alloc being called (unless the first ca= ll to > > > > > libxl__e820_alloc failed). > > > >=20 > > > > That sounds like a very odd non-intuitive location for that alloc= ation. > > > > Why not do it in libxl_domain_create or somewhere like that? > > > >=20 > > > > I think the e820 map added to the idl should become a simple bool= ean > > > > flag and this should all be taken care of internally based on tha= t. > > >=20 > > > Like this? > >=20 > > Why no_machine_e820 instead of just machine_e820? You can set a non-z= ero > > default in the appropriate libxl_foo_init function if need be. >=20 > I tried to > ("machine_e820", bool, True, "Use machine's E820 for PCI passthrough."= ), >=20 > and it made the the machine_e820 variable be an 'const bool' so that yo= u couldn't > change it anymore.=20 The "True" in the above is the const-ness, not the initial value. You want: ("machine_e820", bool, False, "Use machine's E820 for PCI passthrough."), + the appropriate initialisation in libxl_init_build_info. Ian. >=20 > xl_cmdimpl.c:990: error: assignment of read-only member =E2=80=98machin= e_e820=E2=80=99 >=20 > 112 char * cmdline; > 113 libxl_file_reference ramdisk; > 114 const char * features; > 115 /* > 116 * Use machine's E820 for PCI passthrough. > 117 */ > 118 const bool machine_e820; > 119 } pv; > 120 } u; > 121 } libxl_domain_build_info; >=20 > If I make an 'integer' I get the same thing. Ah, if I modify the python= code: > konrad@phenom:~/hg/xen-unstable.hg/tools/libxl$ hg diff > diff -r cc01692f4b41 tools/libxl/gentypes.py > --- a/tools/libxl/gentypes.py Tue Apr 12 14:46:05 2011 -0400 > +++ b/tools/libxl/gentypes.py Tue Apr 12 14:58:24 2011 -0400 > @@ -48,7 +48,7 @@ def libxl_C_type_define(ty, indent =3D "") > s +=3D format_comment(4, f.comment) > x =3D libxl_C_instance_of(f.type, f.name) > if f.const: > - x =3D "const " + x > + x =3D " " + x > x =3D x.replace("\n", "\n ") > s +=3D " " + x + ";\n" > if ty.typename is None: >=20 > It starts working, but that does not look like the correct fix.