Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-20 Thread Chen, Tiejun
On 2015/3/20 18:11, Ian Campbell wrote: On Fri, 2015-03-20 at 18:08 +0800, Chen, Tiejun wrote: +if (!xlu_cfg_get_string(config, "gfx_passthru_kind", &buf, 0)) { +if (libxl_gfx_passthru_kind_from_string(buf, + &b_info->u.hvm.gfx_passthru_kind)) { +fprintf(stder

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-20 Thread Ian Campbell
On Fri, 2015-03-20 at 18:08 +0800, Chen, Tiejun wrote: > +if (!xlu_cfg_get_string(config, "gfx_passthru_kind", &buf, 0)) { > +if (libxl_gfx_passthru_kind_from_string(buf, > + > &b_info->u.hvm.gfx_passthru_kind)) { > +fprintf(stderr, > +"E

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-20 Thread Chen, Tiejun
+case LIBXL_GFX_PASSTHRU_KIND_DEFAULT: +LOG(ERROR, "unable to detect required gfx_passthru_kind"); In this case you will now have logged twice. I'd suggest logging only here and not in the helper. +default: And this case is subtly different to LIBXL_GF

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-20 Thread Ian Campbell
On Fri, 2015-03-20 at 09:04 +0800, Chen, Tiejun wrote: > Refactor again, > > diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c > index 8599a6a..05c8916 100644 > --- a/tools/libxl/libxl_dm.c > +++ b/tools/libxl/libxl_dm.c > @@ -409,6 +409,23 @@ static char *dm_spice_options(libxl__gc *gc

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-19 Thread Chen, Tiejun
On 2015/3/19 18:44, Ian Campbell wrote: On Thu, 2015-03-19 at 10:07 +0800, Chen, Tiejun wrote: This duplicates the code from above. I think this would be best done as: static int libxl__detect_gfx_passthru_kind(libxl__gc *gc, guest_config) { if (b_info->u.hvm.gfx_passthru_kind != LIBXL_

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-19 Thread Ian Campbell
On Thu, 2015-03-19 at 10:07 +0800, Chen, Tiejun wrote: > > This duplicates the code from above. I think this would be best done as: > > > > static int libxl__detect_gfx_passthru_kind(libxl__gc *gc, guest_config) > > { > > if (b_info->u.hvm.gfx_passthru_kind != LIBXL_GFX_PASSTHRU_KIND_DEFAULT)

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-18 Thread Chen, Tiejun
This duplicates the code from above. I think this would be best done as: static int libxl__detect_gfx_passthru_kind(libxl__gc *gc, guest_config) { if (b_info->u.hvm.gfx_passthru_kind != LIBXL_GFX_PASSTHRU_KIND_DEFAULT) return 0; if (libxl__is_igd_vga_passthru(gc, guest_config)

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-18 Thread Ian Campbell
On Wed, 2015-03-18 at 15:32 +0800, Chen, Tiejun wrote: > > I think the _libxl_ message needs to be just "Unable to detect graphics > > passthru kind". i.e. it can't/shouldn't reference anything to do with xl > > config options etc (which would make no sense if libvirt was being > > used). > > > > T

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-18 Thread Chen, Tiejun
I think the _libxl_ message needs to be just "Unable to detect graphics passthru kind". i.e. it can't/shouldn't reference anything to do with xl config options etc (which would make no sense if libvirt was being used). That's not very user friendly though, so you may want to consider adding a new

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-17 Thread Ian Campbell
On Tue, 2015-03-17 at 15:46 +0800, Chen, Tiejun wrote: > >>> If I remember the context correctly this is in the autodetect case, > >>> so I think shouldn't mention IGD. Something like "Unable to detect > >>> graphics passthru kind, please set gfx_passthru_kind. See xl.cfg(5) > >>> for more > >> > >

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-17 Thread Chen, Tiejun
If I remember the context correctly this is in the autodetect case, so I think shouldn't mention IGD. Something like "Unable to detect graphics passthru kind, please set gfx_passthru_kind. See xl.cfg(5) for more s/gfx_passthru_kind/gfx_passthru, right? Because actually we always get 'gfx_passthr

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-16 Thread Ian Campbell
On Mon, 2015-03-16 at 09:07 +0800, Chen, Tiejun wrote: > On 2015/3/13 18:11, Ian Campbell wrote: > > On Fri, 2015-03-13 at 09:39 +0800, Chen, Tiejun wrote: > >>> I don't think you can abort here, since a user can set > >>> b_info->u.hvm.gfx_passthru_kind to default. You would need to > >>> return a

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-15 Thread Chen, Tiejun
On 2015/3/13 18:11, Ian Campbell wrote: On Fri, 2015-03-13 at 09:39 +0800, Chen, Tiejun wrote: I don't think you can abort here, since a user can set b_info->u.hvm.gfx_passthru_kind to default. You would need to return an error. Then, looks I should do this, LOG(ERROR, "No supported IGD to pa

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-13 Thread Ian Campbell
On Fri, 2015-03-13 at 09:39 +0800, Chen, Tiejun wrote: > > I don't think you can abort here, since a user can set > > b_info->u.hvm.gfx_passthru_kind to default. You would need to return an > > error. > > Then, looks I should do this, > > LOG(ERROR, "No supported IGD to passt

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-12 Thread Chen, Tiejun
I don't think you can abort here, since a user can set b_info->u.hvm.gfx_passthru_kind to default. You would need to return an error. Then, looks I should do this, LOG(ERROR, "No supported IGD to passthru," " or please force set gfx_passthru=\"igd\".\

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-12 Thread Ian Campbell
On Thu, 2015-03-12 at 11:18 +0800, Chen, Tiejun wrote: > >> + > >> +if (b_info->u.hvm.gfx_passthru_kind == > >> +LIBXL_GFX_PASSTHRU_KIND_DEFAULT) { > >> +if (libxl__is_igd_vga_passthru(gc, guest_config)) > >> +machinearg = GCSPRINTF("%s,igd-passth

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-11 Thread Chen, Tiejun
+ +if (b_info->u.hvm.gfx_passthru_kind == +LIBXL_GFX_PASSTHRU_KIND_DEFAULT) { +if (libxl__is_igd_vga_passthru(gc, guest_config)) +machinearg = GCSPRINTF("%s,igd-passthru=on", machinearg); +} else if (b_info->u.hvm.gfx_passthru_kind == +

Re: [Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-11 Thread Ian Campbell
On Tue, 2015-03-10 at 17:42 +0800, Tiejun Chen wrote: > Although we already have 'gfx_passthru' in b_info, this doesn' suffice > after we want to handle IGD specifically. Now we define a new field of > type, gfx_passthru_kind, to indicate we're trying to pass IGD. Actually > this means we can benef

[Xen-devel] [v2][PATCH 2/2] libxl: introduce gfx_passthru_kind

2015-03-10 Thread Tiejun Chen
Although we already have 'gfx_passthru' in b_info, this doesn' suffice after we want to handle IGD specifically. Now we define a new field of type, gfx_passthru_kind, to indicate we're trying to pass IGD. Actually this means we can benefit this to support other specific devices just by extending gf