diff mbox

[RFC,1/1] libxl: add one machine property to support IGD GFX passthrough

Message ID 1421824792-3925-1-git-send-email-tiejun.chen@intel.com
State New
Headers show

Commit Message

Tiejun Chen Jan. 21, 2015, 7:19 a.m. UTC
When we're working to support IGD GFX passthrough with qemu
upstream, instead of "-gfx_passthru" we'd like to make that
a machine option, "-machine xxx,gfx_passthru=on". This need
to bring several changes on tool side.

Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
 tools/libxl/libxl_dm.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

Comments

Tiejun Chen Jan. 21, 2015, 7:26 a.m. UTC | #1
CCed Stefano.

Thanks
Tiejun

On 2015/1/21 15:19, Tiejun Chen wrote:
> When we're working to support IGD GFX passthrough with qemu
> upstream, instead of "-gfx_passthru" we'd like to make that
> a machine option, "-machine xxx,gfx_passthru=on". This need
> to bring several changes on tool side.
>
> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
> ---
>   tools/libxl/libxl_dm.c | 19 +++++++++++++++++--
>   1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index c2b0487..2b59d2c 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -318,7 +318,10 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc,
>               flexarray_vappend(dm_args, "-net", "none", NULL);
>           }
>           if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
> -            flexarray_append(dm_args, "-gfx_passthru");
> +            if (b_info->device_model_version !=
> +                LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
> +                flexarray_append(dm_args, "-gfx_passthru");
> +            }
>           }
>       } else {
>           if (!sdl && !vnc)
> @@ -702,7 +705,10 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
>               flexarray_append(dm_args, "none");
>           }
>           if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
> -            flexarray_append(dm_args, "-gfx_passthru");
> +            if (b_info->device_model_version !=
> +                LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
> +                flexarray_append(dm_args, "-gfx_passthru");
> +            }
>           }
>       } else {
>           if (!sdl && !vnc) {
> @@ -748,6 +754,15 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
>                                               machinearg, max_ram_below_4g);
>               }
>           }
> +
> +        if (b_info->device_model_version ==
> +            LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
> +            if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
> +                machinearg = libxl__sprintf(gc, "%s,gfx_passthru=on",
> +                                            machinearg);
> +            }
> +        }
> +
>           flexarray_append(dm_args, machinearg);
>           for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
>               flexarray_append(dm_args, b_info->extra_hvm[i]);
>
Ian Jackson Jan. 21, 2015, 11:37 a.m. UTC | #2
Tiejun Chen writes ("[RFC][PATCH 1/1] libxl: add one machine property to support IGD GFX passthrough"):
> When we're working to support IGD GFX passthrough with qemu
> upstream, instead of "-gfx_passthru" we'd like to make that
> a machine option, "-machine xxx,gfx_passthru=on". This need
> to bring several changes on tool side.

Has the corresponding patch to qemu-upstream been accepted yet ?

I'd like to see a confirmation from the qemu side that this is going
into their tree and that the command-line option syntax has been
agreed.

Thanks,
Ian.
Ian Campbell Jan. 21, 2015, 11:56 a.m. UTC | #3
On Wed, 2015-01-21 at 11:37 +0000, Ian Jackson wrote:
> Tiejun Chen writes ("[RFC][PATCH 1/1] libxl: add one machine property to support IGD GFX passthrough"):
> > When we're working to support IGD GFX passthrough with qemu
> > upstream, instead of "-gfx_passthru" we'd like to make that
> > a machine option, "-machine xxx,gfx_passthru=on". This need
> > to bring several changes on tool side.
> 
> Has the corresponding patch to qemu-upstream been accepted yet ?
> 
> I'd like to see a confirmation from the qemu side that this is going
> into their tree and that the command-line option syntax has been
> agreed.

Do we need to detect old vs. new qemu to know when this option is valid?

Ian.
Gerd Hoffmann Jan. 21, 2015, 1:48 p.m. UTC | #4
On Mi, 2015-01-21 at 11:37 +0000, Ian Jackson wrote:
> Tiejun Chen writes ("[RFC][PATCH 1/1] libxl: add one machine property to support IGD GFX passthrough"):
> > When we're working to support IGD GFX passthrough with qemu
> > upstream, instead of "-gfx_passthru" we'd like to make that
> > a machine option, "-machine xxx,gfx_passthru=on". This need
> > to bring several changes on tool side.
> 
> Has the corresponding patch to qemu-upstream been accepted yet ?
> 
> I'd like to see a confirmation from the qemu side that this is going
> into their tree and that the command-line option syntax has been
> agreed.

Suggested at patch review, not merged (guess thats why it is tagged
'rfc', to get both qemu+xen on the same page).

While being at it:  Should we name this 'igd-passthru' instead of
'gfx-passthru'?  The hostbridge / isabridge quirks needed are actually
specific to igd and are not needed for -- say -- nvidia gfx cards.

cheers,
  Gerd
Tiejun Chen Jan. 22, 2015, 12:51 a.m. UTC | #5
On 2015/1/21 21:48, Gerd Hoffmann wrote:
> On Mi, 2015-01-21 at 11:37 +0000, Ian Jackson wrote:
>> Tiejun Chen writes ("[RFC][PATCH 1/1] libxl: add one machine property to support IGD GFX passthrough"):
>>> When we're working to support IGD GFX passthrough with qemu
>>> upstream, instead of "-gfx_passthru" we'd like to make that
>>> a machine option, "-machine xxx,gfx_passthru=on". This need
>>> to bring several changes on tool side.
>>
>> Has the corresponding patch to qemu-upstream been accepted yet ?
>>
>> I'd like to see a confirmation from the qemu side that this is going
>> into their tree and that the command-line option syntax has been
>> agreed.
>
> Suggested at patch review, not merged (guess thats why it is tagged
> 'rfc', to get both qemu+xen on the same page).

Yeah, this is exactly what I intended to do here :)

>
> While being at it:  Should we name this 'igd-passthru' instead of
> 'gfx-passthru'?  The hostbridge / isabridge quirks needed are actually
> specific to igd and are not needed for -- say -- nvidia gfx cards.
>

At this point I just concern here if we still use 'gfx_passthrou', at 
least it may look like a backward compatibility with older versions of 
qemu in Xen side, qemu-xen-traditional. But I'd like to follow your 
final option.

Thanks
Tiejun
Tiejun Chen Jan. 22, 2015, 12:55 a.m. UTC | #6
On 2015/1/21 19:56, Ian Campbell wrote:
> On Wed, 2015-01-21 at 11:37 +0000, Ian Jackson wrote:
>> Tiejun Chen writes ("[RFC][PATCH 1/1] libxl: add one machine property to support IGD GFX passthrough"):
>>> When we're working to support IGD GFX passthrough with qemu
>>> upstream, instead of "-gfx_passthru" we'd like to make that
>>> a machine option, "-machine xxx,gfx_passthru=on". This need
>>> to bring several changes on tool side.
>>
>> Has the corresponding patch to qemu-upstream been accepted yet ?
>>
>> I'd like to see a confirmation from the qemu side that this is going
>> into their tree and that the command-line option syntax has been
>> agreed.
>
> Do we need to detect old vs. new qemu to know when this option is valid?

Do you mean we should introduce these two options into qemu upstream at 
the same time? Here I just keep that new option, and that old is gone.

Thanks
Tiejun
Tiejun Chen Jan. 23, 2015, 12:43 a.m. UTC | #7
On 2015/1/22 8:51, Chen, Tiejun wrote:
> On 2015/1/21 21:48, Gerd Hoffmann wrote:
>> On Mi, 2015-01-21 at 11:37 +0000, Ian Jackson wrote:
>>> Tiejun Chen writes ("[RFC][PATCH 1/1] libxl: add one machine property
>>> to support IGD GFX passthrough"):
>>>> When we're working to support IGD GFX passthrough with qemu
>>>> upstream, instead of "-gfx_passthru" we'd like to make that
>>>> a machine option, "-machine xxx,gfx_passthru=on". This need
>>>> to bring several changes on tool side.
>>>
>>> Has the corresponding patch to qemu-upstream been accepted yet ?
>>>
>>> I'd like to see a confirmation from the qemu side that this is going
>>> into their tree and that the command-line option syntax has been
>>> agreed.
>>
>> Suggested at patch review, not merged (guess thats why it is tagged
>> 'rfc', to get both qemu+xen on the same page).
>
> Yeah, this is exactly what I intended to do here :)
>
>>
>> While being at it:  Should we name this 'igd-passthru' instead of
>> 'gfx-passthru'?  The hostbridge / isabridge quirks needed are actually
>> specific to igd and are not needed for -- say -- nvidia gfx cards.
>>
>
> At this point I just concern here if we still use 'gfx_passthrou', at
> least it may look like a backward compatibility with older versions of
> qemu in Xen side, qemu-xen-traditional. But I'd like to follow your
> final option.
>

Any feedback to this option I should follow here?

Thanks
Tiejun
Tiejun Chen Jan. 26, 2015, 12:44 a.m. UTC | #8
On 2015/1/23 8:43, Chen, Tiejun wrote:
> On 2015/1/22 8:51, Chen, Tiejun wrote:
>> On 2015/1/21 21:48, Gerd Hoffmann wrote:
>>> On Mi, 2015-01-21 at 11:37 +0000, Ian Jackson wrote:
>>>> Tiejun Chen writes ("[RFC][PATCH 1/1] libxl: add one machine property
>>>> to support IGD GFX passthrough"):
>>>>> When we're working to support IGD GFX passthrough with qemu
>>>>> upstream, instead of "-gfx_passthru" we'd like to make that
>>>>> a machine option, "-machine xxx,gfx_passthru=on". This need
>>>>> to bring several changes on tool side.
>>>>
>>>> Has the corresponding patch to qemu-upstream been accepted yet ?
>>>>
>>>> I'd like to see a confirmation from the qemu side that this is going
>>>> into their tree and that the command-line option syntax has been
>>>> agreed.
>>>
>>> Suggested at patch review, not merged (guess thats why it is tagged
>>> 'rfc', to get both qemu+xen on the same page).
>>
>> Yeah, this is exactly what I intended to do here :)
>>
>>>
>>> While being at it:  Should we name this 'igd-passthru' instead of
>>> 'gfx-passthru'?  The hostbridge / isabridge quirks needed are actually
>>> specific to igd and are not needed for -- say -- nvidia gfx cards.
>>>
>>
>> At this point I just concern here if we still use 'gfx_passthrou', at
>> least it may look like a backward compatibility with older versions of
>> qemu in Xen side, qemu-xen-traditional. But I'd like to follow your
>> final option.
>>
>
> Any feedback to this option I should follow here?
>

Ping...

Thanks
Tiejun
Ian Jackson Jan. 27, 2015, 2:40 p.m. UTC | #9
Chen, Tiejun writes ("Re: [Qemu-devel] [RFC][PATCH 1/1] libxl: add one machine property to support IGD GFX passthrough"):
> On 2015/1/23 8:43, Chen, Tiejun wrote:
> > On 2015/1/22 8:51, Chen, Tiejun wrote:
> >> At this point I just concern here if we still use 'gfx_passthrou', at
> >> least it may look like a backward compatibility with older versions of
> >> qemu in Xen side, qemu-xen-traditional. But I'd like to follow your
> >> final option.
...
> > Any feedback to this option I should follow here?
> 
> Ping...

I think this is a question that qemu upstream should answer.

Thanks,
Ian.
Tiejun Chen Jan. 28, 2015, 12:42 a.m. UTC | #10
On 2015/1/27 22:40, Ian Jackson wrote:
> Chen, Tiejun writes ("Re: [Qemu-devel] [RFC][PATCH 1/1] libxl: add one machine property to support IGD GFX passthrough"):
>> On 2015/1/23 8:43, Chen, Tiejun wrote:
>>> On 2015/1/22 8:51, Chen, Tiejun wrote:
>>>> At this point I just concern here if we still use 'gfx_passthrou', at
>>>> least it may look like a backward compatibility with older versions of
>>>> qemu in Xen side, qemu-xen-traditional. But I'd like to follow your
>>>> final option.
> ...
>>> Any feedback to this option I should follow here?
>>
>> Ping...
>
> I think this is a question that qemu upstream should answer.
>

Actually this is just commented by Gerd in qemu upstream. So now looks 
in Xen side you guys don't have any objection to use 'igd-passthru' as 
well. If yes, I'm fine to adopt this.

Thanks
Tiejun
Wei Liu Jan. 28, 2015, 11:12 a.m. UTC | #11
On Wed, Jan 28, 2015 at 08:42:56AM +0800, Chen, Tiejun wrote:
> On 2015/1/27 22:40, Ian Jackson wrote:
> >Chen, Tiejun writes ("Re: [Qemu-devel] [RFC][PATCH 1/1] libxl: add one machine property to support IGD GFX passthrough"):
> >>On 2015/1/23 8:43, Chen, Tiejun wrote:
> >>>On 2015/1/22 8:51, Chen, Tiejun wrote:
> >>>>At this point I just concern here if we still use 'gfx_passthrou', at
> >>>>least it may look like a backward compatibility with older versions of
> >>>>qemu in Xen side, qemu-xen-traditional. But I'd like to follow your
> >>>>final option.
> >...
> >>>Any feedback to this option I should follow here?
> >>
> >>Ping...
> >
> >I think this is a question that qemu upstream should answer.
> >
> 
> Actually this is just commented by Gerd in qemu upstream. So now looks in
> Xen side you guys don't have any objection to use 'igd-passthru' as well. If
> yes, I'm fine to adopt this.
> 

Yes, we would like to stay in line with upstream.

Just remember to handle old option in libxl if your old option is already
released by some older version of QEMUs.

Wei.

> Thanks
> Tiejun
>
diff mbox

Patch

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index c2b0487..2b59d2c 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -318,7 +318,10 @@  static char ** libxl__build_device_model_args_old(libxl__gc *gc,
             flexarray_vappend(dm_args, "-net", "none", NULL);
         }
         if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
-            flexarray_append(dm_args, "-gfx_passthru");
+            if (b_info->device_model_version !=
+                LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+                flexarray_append(dm_args, "-gfx_passthru");
+            }
         }
     } else {
         if (!sdl && !vnc)
@@ -702,7 +705,10 @@  static char ** libxl__build_device_model_args_new(libxl__gc *gc,
             flexarray_append(dm_args, "none");
         }
         if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
-            flexarray_append(dm_args, "-gfx_passthru");
+            if (b_info->device_model_version !=
+                LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+                flexarray_append(dm_args, "-gfx_passthru");
+            }
         }
     } else {
         if (!sdl && !vnc) {
@@ -748,6 +754,15 @@  static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                             machinearg, max_ram_below_4g);
             }
         }
+
+        if (b_info->device_model_version ==
+            LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+            if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
+                machinearg = libxl__sprintf(gc, "%s,gfx_passthru=on",
+                                            machinearg);
+            }
+        }
+
         flexarray_append(dm_args, machinearg);
         for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
             flexarray_append(dm_args, b_info->extra_hvm[i]);