Skip to contentSkip to conversation

libxl: try to support IGD passthrough for qemu upstream

PATCH Superseded Tiejun Chen 4 participants 35 messages Mar 6, 2015 – Mar 11, 2015

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover libxl: try to support IGD passthrough for qemu upstream

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,igd-passthru=on". This need to bring a change on tool side.

After a discussion with Campbell, we'd like to construct a table to record all IGD devices we can support. If we hit that table, we should pass that option. And so we also introduce a new field of type, 'gfx_passthru_kind', to cooperate with 'gfx_passthru' to cover all scenarios like this,

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

----------------------------------------------------------------
Tiejun Chen (2):
libxl: introduce libxl__is_igd_vga_passthru
libxl: introduce gfx_passthru_kind

 tools/libxl/libxl_dm.c       |  13 +++++++++++++
 tools/libxl/libxl_internal.h |   2 ++
 tools/libxl/libxl_pci.c      | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_types.idl  |   6 ++++++
 tools/libxl/xl_cmdimpl.c     |  19 +++++++++++++++++--
 5 files changed, 162 insertions(+), 2 deletions(-)

Thanks
Tiejun

#1 lore raw

PATCH 1/2 libxl: introduce libxl__is_igd_vga_passthru

While working with qemu, IGD is a specific device in the case of pass through so we need to identify that to handle more later. Here we define a table to record all IGD types currently we can support. Also we need to introduce two helper functions to get vendor and device ids to lookup that table.

---
 tools/libxl/libxl_internal.h |   2 +
 tools/libxl/libxl_pci.c      | 124 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 126 insertions(+)
tools/libxl/libxl_internal.h +2 -0
index 934465a..8b952b8 100644
@@ -1176,6 +1176,8 @@ _hidden int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pc
 _hidden int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid,
                                       libxl_device_pci *pcidev, int num);
 _hidden int libxl__device_pci_destroy_all(libxl__gc *gc, uint32_t domid);
+_hidden int libxl__is_igd_vga_passthru(libxl__gc *gc,
+                                       const libxl_domain_config *d_config);
 
 /*----- xswait: wait for a xenstore node to be suitable -----*/
 
tools/libxl/libxl_pci.c +124 -0

130 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/2 libxl: introduce libxl__is_igd_vga_passthru

In reply to Tiejun Chen

While working with qemu, IGD is a specific device in the case of pass through so we need to identify that to handle more later. Here we define a table to record all IGD types currently we can support. Also we need to introduce two helper functions to get vendor and device ids to lookup that table.

---
 tools/libxl/libxl_internal.h |   2 +
 tools/libxl/libxl_pci.c      | 124 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 126 insertions(+)
tools/libxl/libxl_internal.h +2 -0
index 934465a..8b952b8 100644
@@ -1176,6 +1176,8 @@ _hidden int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pc
 _hidden int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid,
                                       libxl_device_pci *pcidev, int num);
 _hidden int libxl__device_pci_destroy_all(libxl__gc *gc, uint32_t domid);
+_hidden int libxl__is_igd_vga_passthru(libxl__gc *gc,
+                                       const libxl_domain_config *d_config);
 
 /*----- xswait: wait for a xenstore node to be suitable -----*/
 
tools/libxl/libxl_pci.c +124 -0

130 lines not on this page · raw message

Signature · 1 line
1.9.1
#3 lore raw

Re: [Qemu-devel] [PATCH 1/2] libxl: introduce libxl__is_igd_vga_passthru

Quoted 29 lines · Tiejun Chen

While working with qemu, IGD is a specific device in the case of pass through so we need to identify that to handle more later. Here we define a table to record all IGD types currently we can support. Also we need to introduce two helper functions to get vendor and device ids to lookup that table.

---
 tools/libxl/libxl_internal.h |   2 +
 tools/libxl/libxl_pci.c      | 124 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 126 insertions(+)
tools/libxl/libxl_internal.h +2 -0
index 934465a..8b952b8 100644
@@ -1176,6 +1176,8 @@ _hidden int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pc
 _hidden int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid,
                                       libxl_device_pci *pcidev, int num);
 _hidden int libxl__device_pci_destroy_all(libxl__gc *gc, uint32_t domid);
+_hidden int libxl__is_igd_vga_passthru(libxl__gc *gc,
+                                       const libxl_domain_config *d_config);
 
 /*----- xswait: wait for a xenstore node to be suitable -----*/
 
tools/libxl/libxl_pci.c +0 -0
index f3ae132..dc5a89e 100644

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 495

Quoted 5 lines
tools/libxl/libxl_pci.c +2 -0
@@ -491,6 +491,130 @@ static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev,
     return 0;
 }
 
+static unsigned long sysfs_dev_get_vendor(libxl__gc *gc,
+                                          libxl_device_pci *pcidev)

uint16_t?

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 500

Quoted 5 lines
tools/libxl/libxl_pci.c +5 -0
+{
+    char *pci_device_vendor_path =
+            libxl__sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/vendor",
+                           pcidev->domain, pcidev->bus, pcidev->dev,
+                           pcidev->func);

Please use GCSPRINTF macro.

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 502

Quoted 2 lines
tools/libxl/libxl_pci.c +2 -0
+    int read_items;
+    unsigned long pci_device_vendor;

uint16_t?

Same comments apply to _get_device function.

Quoted 20 lines
tools/libxl/libxl_pci.c +20 -0
+
+    FILE *f = fopen(pci_device_vendor_path, "r");
+    if (!f) {
+        LOGE(ERROR,
+             "pci device "PCI_BDF" does not have vendor attribute",
+             pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func);
+        return 0xffff;
+    }
+    read_items = fscanf(f, "0x%lx\n", &pci_device_vendor);
+    fclose(f);
+    if (read_items != 1) {
+        LOGE(ERROR,
+             "cannot read vendor of pci device "PCI_BDF,
+             pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func);
+        return 0xffff;
+    }
+
+    return pci_device_vendor;
+}
+

[...]

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 596

Quoted 5 lines
tools/libxl/libxl_pci.c +5 -0
+/*
+ * Some devices may need some ways to work well. Here like IGD,
+ * we have to pass a specific option to qemu.
+ */
+int libxl__is_igd_vga_passthru(libxl__gc *gc,

bool.

Quoted 5 lines
tools/libxl/libxl_pci.c +5 -0
+                               const libxl_domain_config *d_config)
+{
+    unsigned int i, j, num = ARRAY_SIZE(fixup_ids);
+    uint16_t vendor, device;
+

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 611

Quoted 10 lines
tools/libxl/libxl_pci.c +10 -0
+    for (i = 0 ; i < d_config->num_pcidevs ; i++) {
+        libxl_device_pci *pcidev = &d_config->pcidevs[i];
+
+        for (j = 0 ; j < num ; j++) {
+            vendor = fixup_ids[j].vendor;
+            device = fixup_ids[j].device;
+
+            if (sysfs_dev_get_vendor(gc, pcidev) == vendor &&
+                sysfs_dev_get_device(gc, pcidev) == device)
+                return 1;

Get vendor and device in outer loop to avoid wasting cpu cycles. :-)

Wei.

Quoted 11 lines
tools/libxl/libxl_pci.c +6 -0
+        }
+    }
+
+    return 0;
+}
+
 /*
  * A brief comment about slots.  I don't know what slots are for; however,
  * I have by experimentation determined:
Signature · 1 line
1.9.1
#4 lore raw

Re: [PATCH 1/2] libxl: introduce libxl__is_igd_vga_passthru

Quoted 38 lines · Wei Liu
Quoted 29 lines · Tiejun Chen

While working with qemu, IGD is a specific device in the case of pass through so we need to identify that to handle more later. Here we define a table to record all IGD types currently we can support. Also we need to introduce two helper functions to get vendor and device ids to lookup that table.

---
  tools/libxl/libxl_internal.h |   2 +
  tools/libxl/libxl_pci.c      | 124 +++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 126 insertions(+)
tools/libxl/libxl_internal.h +2 -0
index 934465a..8b952b8 100644
@@ -1176,6 +1176,8 @@ _hidden int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pc
  _hidden int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid,
                                        libxl_device_pci *pcidev, int num);
  _hidden int libxl__device_pci_destroy_all(libxl__gc *gc, uint32_t domid);
+_hidden int libxl__is_igd_vga_passthru(libxl__gc *gc,
+                                       const libxl_domain_config *d_config);
 
  /*----- xswait: wait for a xenstore node to be suitable -----*/
 
tools/libxl/libxl_pci.c +0 -0
index f3ae132..dc5a89e 100644

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 495

Quoted 5 lines
tools/libxl/libxl_pci.c +2 -0
@@ -491,6 +491,130 @@ static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev,
      return 0;
  }
 
+static unsigned long sysfs_dev_get_vendor(libxl__gc *gc,
+                                          libxl_device_pci *pcidev)

uint16_t?

Quoted 7 lines

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 500

Quoted 5 lines
tools/libxl/libxl_pci.c +5 -0
+{
+    char *pci_device_vendor_path =
+            libxl__sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/vendor",
+                           pcidev->domain, pcidev->bus, pcidev->dev,
+                           pcidev->func);

Please use GCSPRINTF macro.

Okay.

Quoted 5 lines

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 502

Quoted 3 lines
tools/libxl/libxl_pci.c +2 -0
+    int read_items;
+    unsigned long pci_device_vendor;

uint16_t?

Yes, I can but I don't see other similar helpers are doing this in this file :)

Quoted 2 lines

Same comments apply to _get_device function.

And especially, if we really set that as uint16_t,

Quoted 10 lines

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 511

Quoted 10 lines
tools/libxl/libxl_pci.c +9 -0
+
+    FILE *f = fopen(pci_device_vendor_path, "r");
+    if (!f) {
+        LOGE(ERROR,
+             "pci device "PCI_BDF" does not have vendor attribute",
+             pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func);
+        return 0xffff;
+    }
+    read_items = fscanf(f, "0x%lx\n", &pci_device_vendor);

we have to refactor this as well,

read_items = fscanf(f, "0x%hx\n", &pci_device_vendor);

Right?

Quoted 14 lines
Quoted 11 lines
tools/libxl/libxl_pci.c +11 -0
+    fclose(f);
+    if (read_items != 1) {
+        LOGE(ERROR,
+             "cannot read vendor of pci device "PCI_BDF,
+             pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func);
+        return 0xffff;
+    }
+
+    return pci_device_vendor;
+}
+

[...]

Quoted 7 lines

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 596

Quoted 5 lines
tools/libxl/libxl_pci.c +5 -0
+/*
+ * Some devices may need some ways to work well. Here like IGD,
+ * we have to pass a specific option to qemu.
+ */
+int libxl__is_igd_vga_passthru(libxl__gc *gc,

bool.

Okay.

Quoted 10 lines
Quoted 10 lines
tools/libxl/libxl_pci.c +9 -0
+                               const libxl_domain_config *d_config)
+{
+    unsigned int i, j, num = ARRAY_SIZE(fixup_ids);
+    uint16_t vendor, device;
+
+    for (i = 0 ; i < d_config->num_pcidevs ; i++) {
+        libxl_device_pci *pcidev = &d_config->pcidevs[i];
+
+        for (j = 0 ; j < num ; j++) {
Quoted 9 lines

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 611

Quoted 6 lines
tools/libxl/libxl_pci.c +6 -0
+            vendor = fixup_ids[j].vendor;
+            device = fixup_ids[j].device;
+
+            if (sysfs_dev_get_vendor(gc, pcidev) == vendor &&
+                sysfs_dev_get_device(gc, pcidev) == device)
+                return 1;

Get vendor and device in outer loop to avoid wasting cpu cycles. :-)

Yeah.

Thanks
Tiejun

#5 lore raw

Re: [Qemu-devel] [PATCH 1/2] libxl: introduce libxl__is_igd_vga_passthru

In reply to Wei Liu
Quoted 38 lines · Wei Liu
Quoted 29 lines · Tiejun Chen

While working with qemu, IGD is a specific device in the case of pass through so we need to identify that to handle more later. Here we define a table to record all IGD types currently we can support. Also we need to introduce two helper functions to get vendor and device ids to lookup that table.

---
  tools/libxl/libxl_internal.h |   2 +
  tools/libxl/libxl_pci.c      | 124 +++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 126 insertions(+)
tools/libxl/libxl_internal.h +2 -0
index 934465a..8b952b8 100644
@@ -1176,6 +1176,8 @@ _hidden int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pc
  _hidden int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid,
                                        libxl_device_pci *pcidev, int num);
  _hidden int libxl__device_pci_destroy_all(libxl__gc *gc, uint32_t domid);
+_hidden int libxl__is_igd_vga_passthru(libxl__gc *gc,
+                                       const libxl_domain_config *d_config);
 
  /*----- xswait: wait for a xenstore node to be suitable -----*/
 
tools/libxl/libxl_pci.c +0 -0
index f3ae132..dc5a89e 100644

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 495

Quoted 5 lines
tools/libxl/libxl_pci.c +2 -0
@@ -491,6 +491,130 @@ static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev,
      return 0;
  }
 
+static unsigned long sysfs_dev_get_vendor(libxl__gc *gc,
+                                          libxl_device_pci *pcidev)

uint16_t?

Quoted 7 lines

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 500

Quoted 5 lines
tools/libxl/libxl_pci.c +5 -0
+{
+    char *pci_device_vendor_path =
+            libxl__sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/vendor",
+                           pcidev->domain, pcidev->bus, pcidev->dev,
+                           pcidev->func);

Please use GCSPRINTF macro.

Okay.

Quoted 5 lines

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 502

Quoted 3 lines
tools/libxl/libxl_pci.c +2 -0
+    int read_items;
+    unsigned long pci_device_vendor;

uint16_t?

Yes, I can but I don't see other similar helpers are doing this in this file :)

Quoted 2 lines

Same comments apply to _get_device function.

And especially, if we really set that as uint16_t,

Quoted 10 lines

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 511

Quoted 10 lines
tools/libxl/libxl_pci.c +9 -0
+
+    FILE *f = fopen(pci_device_vendor_path, "r");
+    if (!f) {
+        LOGE(ERROR,
+             "pci device "PCI_BDF" does not have vendor attribute",
+             pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func);
+        return 0xffff;
+    }
+    read_items = fscanf(f, "0x%lx\n", &pci_device_vendor);

we have to refactor this as well,

read_items = fscanf(f, "0x%hx\n", &pci_device_vendor);

Right?

Quoted 14 lines
Quoted 11 lines
tools/libxl/libxl_pci.c +11 -0
+    fclose(f);
+    if (read_items != 1) {
+        LOGE(ERROR,
+             "cannot read vendor of pci device "PCI_BDF,
+             pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func);
+        return 0xffff;
+    }
+
+    return pci_device_vendor;
+}
+

[...]

Quoted 7 lines

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 596

Quoted 5 lines
tools/libxl/libxl_pci.c +5 -0
+/*
+ * Some devices may need some ways to work well. Here like IGD,
+ * we have to pass a specific option to qemu.
+ */
+int libxl__is_igd_vga_passthru(libxl__gc *gc,

bool.

Okay.

Quoted 10 lines
Quoted 10 lines
tools/libxl/libxl_pci.c +9 -0
+                               const libxl_domain_config *d_config)
+{
+    unsigned int i, j, num = ARRAY_SIZE(fixup_ids);
+    uint16_t vendor, device;
+
+    for (i = 0 ; i < d_config->num_pcidevs ; i++) {
+        libxl_device_pci *pcidev = &d_config->pcidevs[i];
+
+        for (j = 0 ; j < num ; j++) {
Quoted 9 lines

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 611

Quoted 6 lines
tools/libxl/libxl_pci.c +6 -0
+            vendor = fixup_ids[j].vendor;
+            device = fixup_ids[j].device;
+
+            if (sysfs_dev_get_vendor(gc, pcidev) == vendor &&
+                sysfs_dev_get_device(gc, pcidev) == device)
+                return 1;

Get vendor and device in outer loop to avoid wasting cpu cycles. :-)

Yeah.

Thanks
Tiejun

#6 lore raw

Re: [PATCH 1/2] libxl: introduce libxl__is_igd_vga_passthru

On Mon, Mar 09, 2015 at 02:27:46PM +0800, Chen, Tiejun wrote:
[...]

Quoted 10 lines
Quoted 9 lines

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 511

Quoted 9 lines
tools/libxl/libxl_pci.c +9 -0
+
+    FILE *f = fopen(pci_device_vendor_path, "r");
+    if (!f) {
+        LOGE(ERROR,
+             "pci device "PCI_BDF" does not have vendor attribute",
+             pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func);
+        return 0xffff;
+    }
+    read_items = fscanf(f, "0x%lx\n", &pci_device_vendor);
Quoted 6 lines

we have to refactor this as well,

read_items = fscanf(f, "0x%hx\n", &pci_device_vendor);

Right?

Sure. Just eliminate any warnings / errors.

Wei.

#7 lore raw

Re: [Qemu-devel] [PATCH 1/2] libxl: introduce libxl__is_igd_vga_passthru

In reply to Chen, Tiejun

On Mon, Mar 09, 2015 at 02:27:46PM +0800, Chen, Tiejun wrote:
[...]

Quoted 10 lines
Quoted 9 lines

tools/libxl/libxl_pci.c static int sysfs_dev_unbind(libxl__gc *gc, libxl_device_pci *pcidev, · line 511

Quoted 9 lines
tools/libxl/libxl_pci.c +9 -0
+
+    FILE *f = fopen(pci_device_vendor_path, "r");
+    if (!f) {
+        LOGE(ERROR,
+             "pci device "PCI_BDF" does not have vendor attribute",
+             pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func);
+        return 0xffff;
+    }
+    read_items = fscanf(f, "0x%lx\n", &pci_device_vendor);
Quoted 6 lines

we have to refactor this as well,

read_items = fscanf(f, "0x%hx\n", &pci_device_vendor);

Right?

Sure. Just eliminate any warnings / errors.

Wei.

#8 lore raw

PATCH 2/2 libxl: introduce gfx_passthru_kind

In reply to 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
 tools/libxl/libxl_dm.c      | 13 +++++++++++++
 tools/libxl/libxl_types.idl |  6 ++++++
 tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
 3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +13 -0
index 8599a6a..780dd2a 100644
@@ -757,6 +757,19 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                             machinearg, max_ram_below_4g);
             }
         }
+
+        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 ==
+                        LIBXL_GFX_PASSTHRU_KIND_IGD) {
+                machinearg = GCSPRINTF("%s,igd-passthru=on", machinearg);
+        } else {
+            LOG(WARN, "gfx_passthru_kind is invalid so ignored.\n");
+        }
+
         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]);
tools/libxl/libxl_types.idl +6 -0
index 02be466..e209460 100644
@@ -140,6 +140,11 @@ libxl_tsc_mode = Enumeration("tsc_mode", [
     (3, "native_paravirt"),
     ])
 
+libxl_gfx_passthru_kind = Enumeration("gfx_passthru_kind", [
+    (0, "default"),
+    (1, "igd"),
+    ], init_val = "LIBXL_GFX_PASSTHRU_KIND_DEFAULT")
+
 # Consistent with the values defined for HVM_PARAM_TIMER_MODE.
 libxl_timer_mode = Enumeration("timer_mode", [
     (-1, "unknown"),
@@ -430,6 +435,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                        ("spice",            libxl_spice_info),
                                        
                                        ("gfx_passthru",     libxl_defbool),
+                                       ("gfx_passthru_kind",     libxl_gfx_passthru_kind),
                                        
                                        ("serial",           string),
                                        ("boot",             string),
tools/libxl/xl_cmdimpl.c +17 -2
index 440db78..3f7fede 100644
@@ -1953,8 +1953,23 @@ skip_vfb:
         xlu_cfg_replace_string (config, "spice_streaming_video",
                                 &b_info->u.hvm.spice.streaming_video, 0);
         xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
-        xlu_cfg_get_defbool(config, "gfx_passthru",
-                            &b_info->u.hvm.gfx_passthru, 0);
+        if (!xlu_cfg_get_long(config, "gfx_passthru", &l, 1)) {
+            if (!l) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+            } else if (i == 1) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
+            } else {
+                fprintf(stderr, "ERROR: invalid value %ld for \"gfx_passthru\"\n", l);
+                exit (1);
+            }
+        } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
+            if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {
+                fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",
+                        buf);
+                exit (1);
+            }
+            libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+        }
         switch (xlu_cfg_get_list_as_string_list(config, "serial",
                                                 &b_info->u.hvm.serial_list,
                                                 1))
Signature · 1 line
1.9.1
#9 lore raw

PATCH 2/2 libxl: introduce gfx_passthru_kind

In reply to 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
 tools/libxl/libxl_dm.c      | 13 +++++++++++++
 tools/libxl/libxl_types.idl |  6 ++++++
 tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
 3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +13 -0
index 8599a6a..780dd2a 100644
@@ -757,6 +757,19 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                             machinearg, max_ram_below_4g);
             }
         }
+
+        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 ==
+                        LIBXL_GFX_PASSTHRU_KIND_IGD) {
+                machinearg = GCSPRINTF("%s,igd-passthru=on", machinearg);
+        } else {
+            LOG(WARN, "gfx_passthru_kind is invalid so ignored.\n");
+        }
+
         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]);
tools/libxl/libxl_types.idl +6 -0
index 02be466..e209460 100644
@@ -140,6 +140,11 @@ libxl_tsc_mode = Enumeration("tsc_mode", [
     (3, "native_paravirt"),
     ])
 
+libxl_gfx_passthru_kind = Enumeration("gfx_passthru_kind", [
+    (0, "default"),
+    (1, "igd"),
+    ], init_val = "LIBXL_GFX_PASSTHRU_KIND_DEFAULT")
+
 # Consistent with the values defined for HVM_PARAM_TIMER_MODE.
 libxl_timer_mode = Enumeration("timer_mode", [
     (-1, "unknown"),
@@ -430,6 +435,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                        ("spice",            libxl_spice_info),
                                        
                                        ("gfx_passthru",     libxl_defbool),
+                                       ("gfx_passthru_kind",     libxl_gfx_passthru_kind),
                                        
                                        ("serial",           string),
                                        ("boot",             string),
tools/libxl/xl_cmdimpl.c +17 -2
index 440db78..3f7fede 100644
@@ -1953,8 +1953,23 @@ skip_vfb:
         xlu_cfg_replace_string (config, "spice_streaming_video",
                                 &b_info->u.hvm.spice.streaming_video, 0);
         xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
-        xlu_cfg_get_defbool(config, "gfx_passthru",
-                            &b_info->u.hvm.gfx_passthru, 0);
+        if (!xlu_cfg_get_long(config, "gfx_passthru", &l, 1)) {
+            if (!l) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+            } else if (i == 1) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
+            } else {
+                fprintf(stderr, "ERROR: invalid value %ld for \"gfx_passthru\"\n", l);
+                exit (1);
+            }
+        } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
+            if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {
+                fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",
+                        buf);
+                exit (1);
+            }
+            libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+        }
         switch (xlu_cfg_get_list_as_string_list(config, "serial",
                                                 &b_info->u.hvm.serial_list,
                                                 1))
Signature · 1 line
1.9.1
#10 lore raw

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

tools/libxl/libxl_dm.c

Quoted 29 lines · 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
  tools/libxl/libxl_dm.c      | 13 +++++++++++++
  tools/libxl/libxl_types.idl |  6 ++++++
  tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
  3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +0 -0
index 8599a6a..780dd2a 100644

Sorry, looks I'm missing to remove '-gfx_passthru' since this should be gone in the case of qemu upstream,

@@ -710,9 +710,6 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,

             flexarray_append(dm_args, "-net");
             flexarray_append(dm_args, "none");
         }
-        if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
-            flexarray_append(dm_args, "-gfx_passthru");
-        }
     } else {
         if (!sdl && !vnc) {
             flexarray_append(dm_args, "-nographic");

I will fold this into next revision after this review.

Thanks
Tiejun

Quoted 75 lines
tools/libxl/libxl_dm.c +13 -0
@@ -757,6 +757,19 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                              machinearg, max_ram_below_4g);
              }
          }
+
+        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 ==
+                        LIBXL_GFX_PASSTHRU_KIND_IGD) {
+                machinearg = GCSPRINTF("%s,igd-passthru=on", machinearg);
+        } else {
+            LOG(WARN, "gfx_passthru_kind is invalid so ignored.\n");
+        }
+
          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]);
tools/libxl/libxl_types.idl +6 -0
index 02be466..e209460 100644
@@ -140,6 +140,11 @@ libxl_tsc_mode = Enumeration("tsc_mode", [
      (3, "native_paravirt"),
      ])
 
+libxl_gfx_passthru_kind = Enumeration("gfx_passthru_kind", [
+    (0, "default"),
+    (1, "igd"),
+    ], init_val = "LIBXL_GFX_PASSTHRU_KIND_DEFAULT")
+
  # Consistent with the values defined for HVM_PARAM_TIMER_MODE.
  libxl_timer_mode = Enumeration("timer_mode", [
      (-1, "unknown"),
@@ -430,6 +435,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                         ("spice",            libxl_spice_info),
 
                                         ("gfx_passthru",     libxl_defbool),
+                                       ("gfx_passthru_kind",     libxl_gfx_passthru_kind),
 
                                         ("serial",           string),
                                         ("boot",             string),
tools/libxl/xl_cmdimpl.c +17 -2
index 440db78..3f7fede 100644
@@ -1953,8 +1953,23 @@ skip_vfb:
          xlu_cfg_replace_string (config, "spice_streaming_video",
                                  &b_info->u.hvm.spice.streaming_video, 0);
          xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
-        xlu_cfg_get_defbool(config, "gfx_passthru",
-                            &b_info->u.hvm.gfx_passthru, 0);
+        if (!xlu_cfg_get_long(config, "gfx_passthru", &l, 1)) {
+            if (!l) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+            } else if (i == 1) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
+            } else {
+                fprintf(stderr, "ERROR: invalid value %ld for \"gfx_passthru\"\n", l);
+                exit (1);
+            }
+        } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
+            if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {
+                fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",
+                        buf);
+                exit (1);
+            }
+            libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+        }
          switch (xlu_cfg_get_list_as_string_list(config, "serial",
                                                  &b_info->u.hvm.serial_list,
                                                  1))
#11 lore raw

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

In reply to Tiejun Chen

tools/libxl/libxl_dm.c

Quoted 29 lines · 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
  tools/libxl/libxl_dm.c      | 13 +++++++++++++
  tools/libxl/libxl_types.idl |  6 ++++++
  tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
  3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +0 -0
index 8599a6a..780dd2a 100644

Sorry, looks I'm missing to remove '-gfx_passthru' since this should be gone in the case of qemu upstream,

@@ -710,9 +710,6 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,

             flexarray_append(dm_args, "-net");
             flexarray_append(dm_args, "none");
         }
-        if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
-            flexarray_append(dm_args, "-gfx_passthru");
-        }
     } else {
         if (!sdl && !vnc) {
             flexarray_append(dm_args, "-nographic");

I will fold this into next revision after this review.

Thanks
Tiejun

Quoted 75 lines
tools/libxl/libxl_dm.c +13 -0
@@ -757,6 +757,19 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                              machinearg, max_ram_below_4g);
              }
          }
+
+        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 ==
+                        LIBXL_GFX_PASSTHRU_KIND_IGD) {
+                machinearg = GCSPRINTF("%s,igd-passthru=on", machinearg);
+        } else {
+            LOG(WARN, "gfx_passthru_kind is invalid so ignored.\n");
+        }
+
          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]);
tools/libxl/libxl_types.idl +6 -0
index 02be466..e209460 100644
@@ -140,6 +140,11 @@ libxl_tsc_mode = Enumeration("tsc_mode", [
      (3, "native_paravirt"),
      ])
 
+libxl_gfx_passthru_kind = Enumeration("gfx_passthru_kind", [
+    (0, "default"),
+    (1, "igd"),
+    ], init_val = "LIBXL_GFX_PASSTHRU_KIND_DEFAULT")
+
  # Consistent with the values defined for HVM_PARAM_TIMER_MODE.
  libxl_timer_mode = Enumeration("timer_mode", [
      (-1, "unknown"),
@@ -430,6 +435,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                         ("spice",            libxl_spice_info),
 
                                         ("gfx_passthru",     libxl_defbool),
+                                       ("gfx_passthru_kind",     libxl_gfx_passthru_kind),
 
                                         ("serial",           string),
                                         ("boot",             string),
tools/libxl/xl_cmdimpl.c +17 -2
index 440db78..3f7fede 100644
@@ -1953,8 +1953,23 @@ skip_vfb:
          xlu_cfg_replace_string (config, "spice_streaming_video",
                                  &b_info->u.hvm.spice.streaming_video, 0);
          xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
-        xlu_cfg_get_defbool(config, "gfx_passthru",
-                            &b_info->u.hvm.gfx_passthru, 0);
+        if (!xlu_cfg_get_long(config, "gfx_passthru", &l, 1)) {
+            if (!l) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+            } else if (i == 1) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
+            } else {
+                fprintf(stderr, "ERROR: invalid value %ld for \"gfx_passthru\"\n", l);
+                exit (1);
+            }
+        } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
+            if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {
+                fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",
+                        buf);
+                exit (1);
+            }
+            libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+        }
          switch (xlu_cfg_get_list_as_string_list(config, "serial",
                                                  &b_info->u.hvm.serial_list,
                                                  1))
#12 lore raw

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

Quoted 46 lines · Tiejun

tools/libxl/libxl_dm.c

Quoted 29 lines · 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
 tools/libxl/libxl_dm.c      | 13 +++++++++++++
 tools/libxl/libxl_types.idl |  6 ++++++
 tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
 3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +0 -0
index 8599a6a..780dd2a 100644

Sorry, looks I'm missing to remove '-gfx_passthru' since this should be gone in the case of qemu upstream,

(quoted diff) +0 -3
@@ -710,9 +710,6 @@ static char **
 libxl__build_device_model_args_new(libxl__gc *gc,
             flexarray_append(dm_args, "-net");
             flexarray_append(dm_args, "none");
         }
-        if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
-            flexarray_append(dm_args, "-gfx_passthru");
-        }
     } else {
         if (!sdl && !vnc) {
             flexarray_append(dm_args, "-nographic");
Quoted 2 lines

I will fold this into next revision after this review.

I think this change alone warrants a separate changeset. It should be patch 0 of your series as a preparatory patch. Please remember to elaborate in commit message why that hunk is not needed in upstream QEMU.

Wei.

#13 lore raw

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

In reply to Chen, Tiejun
Quoted 46 lines · Tiejun

tools/libxl/libxl_dm.c

Quoted 29 lines · 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
 tools/libxl/libxl_dm.c      | 13 +++++++++++++
 tools/libxl/libxl_types.idl |  6 ++++++
 tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
 3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +0 -0
index 8599a6a..780dd2a 100644

Sorry, looks I'm missing to remove '-gfx_passthru' since this should be gone in the case of qemu upstream,

(quoted diff) +0 -3
@@ -710,9 +710,6 @@ static char **
 libxl__build_device_model_args_new(libxl__gc *gc,
             flexarray_append(dm_args, "-net");
             flexarray_append(dm_args, "none");
         }
-        if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
-            flexarray_append(dm_args, "-gfx_passthru");
-        }
     } else {
         if (!sdl && !vnc) {
             flexarray_append(dm_args, "-nographic");
Quoted 2 lines

I will fold this into next revision after this review.

I think this change alone warrants a separate changeset. It should be patch 0 of your series as a preparatory patch. Please remember to elaborate in commit message why that hunk is not needed in upstream QEMU.

Wei.

#14 lore raw

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

Quoted 47 lines · Wei Liu
Quoted 46 lines · Tiejun

tools/libxl/libxl_dm.c

Quoted 29 lines · 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
  tools/libxl/libxl_dm.c      | 13 +++++++++++++
  tools/libxl/libxl_types.idl |  6 ++++++
  tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
  3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +0 -0
index 8599a6a..780dd2a 100644

Sorry, looks I'm missing to remove '-gfx_passthru' since this should be gone in the case of qemu upstream,

(quoted diff) +0 -3
@@ -710,9 +710,6 @@ static char **
 libxl__build_device_model_args_new(libxl__gc *gc,
              flexarray_append(dm_args, "-net");
              flexarray_append(dm_args, "none");
          }
-        if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
-            flexarray_append(dm_args, "-gfx_passthru");
-        }
      } else {
          if (!sdl && !vnc) {
              flexarray_append(dm_args, "-nographic");
Quoted 8 lines
Quoted 2 lines

I will fold this into next revision after this review.

I think this change alone warrants a separate changeset. It should be patch 0 of your series as a preparatory patch. Please remember to elaborate in commit message why that hunk is not needed in upstream QEMU.

What about this?

"-gfx_passthru" is just introduced to work for qemu-xen-traditional so we should get this away from libxl__build_device_model_args_new() in the case of qemu upstream.

Thanks
Tiejun

#15 lore raw

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

In reply to Wei Liu
Quoted 47 lines · Wei Liu
Quoted 46 lines · Tiejun

tools/libxl/libxl_dm.c

Quoted 29 lines · 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
  tools/libxl/libxl_dm.c      | 13 +++++++++++++
  tools/libxl/libxl_types.idl |  6 ++++++
  tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
  3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +0 -0
index 8599a6a..780dd2a 100644

Sorry, looks I'm missing to remove '-gfx_passthru' since this should be gone in the case of qemu upstream,

(quoted diff) +0 -3
@@ -710,9 +710,6 @@ static char **
 libxl__build_device_model_args_new(libxl__gc *gc,
              flexarray_append(dm_args, "-net");
              flexarray_append(dm_args, "none");
          }
-        if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
-            flexarray_append(dm_args, "-gfx_passthru");
-        }
      } else {
          if (!sdl && !vnc) {
              flexarray_append(dm_args, "-nographic");
Quoted 8 lines
Quoted 2 lines

I will fold this into next revision after this review.

I think this change alone warrants a separate changeset. It should be patch 0 of your series as a preparatory patch. Please remember to elaborate in commit message why that hunk is not needed in upstream QEMU.

What about this?

"-gfx_passthru" is just introduced to work for qemu-xen-traditional so we should get this away from libxl__build_device_model_args_new() in the case of qemu upstream.

Thanks
Tiejun

#16 lore raw

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

Quoted 57 lines · Tiejun
Quoted 47 lines · Wei Liu
Quoted 46 lines · Tiejun

tools/libxl/libxl_dm.c

Quoted 29 lines · 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
 tools/libxl/libxl_dm.c      | 13 +++++++++++++
 tools/libxl/libxl_types.idl |  6 ++++++
 tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
 3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +0 -0
index 8599a6a..780dd2a 100644

Sorry, looks I'm missing to remove '-gfx_passthru' since this should be gone in the case of qemu upstream,

(quoted diff) +0 -3
@@ -710,9 +710,6 @@ static char **
 libxl__build_device_model_args_new(libxl__gc *gc,
             flexarray_append(dm_args, "-net");
             flexarray_append(dm_args, "none");
         }
-        if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
-            flexarray_append(dm_args, "-gfx_passthru");
-        }
     } else {
         if (!sdl && !vnc) {
             flexarray_append(dm_args, "-nographic");
Quoted 8 lines
Quoted 2 lines

I will fold this into next revision after this review.

I think this change alone warrants a separate changeset. It should be patch 0 of your series as a preparatory patch. Please remember to elaborate in commit message why that hunk is not needed in upstream QEMU.

Quoted 6 lines

What about this?

"-gfx_passthru" is just introduced to work for qemu-xen-traditional so we should get this away from libxl__build_device_model_args_new() in the case of qemu upstream.

This looks good.

Wei.

Quoted 2 lines

Thanks
Tiejun

#17 lore raw

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

In reply to Chen, Tiejun
Quoted 57 lines · Tiejun
Quoted 47 lines · Wei Liu
Quoted 46 lines · Tiejun

tools/libxl/libxl_dm.c

Quoted 29 lines · 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
 tools/libxl/libxl_dm.c      | 13 +++++++++++++
 tools/libxl/libxl_types.idl |  6 ++++++
 tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
 3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +0 -0
index 8599a6a..780dd2a 100644

Sorry, looks I'm missing to remove '-gfx_passthru' since this should be gone in the case of qemu upstream,

(quoted diff) +0 -3
@@ -710,9 +710,6 @@ static char **
 libxl__build_device_model_args_new(libxl__gc *gc,
             flexarray_append(dm_args, "-net");
             flexarray_append(dm_args, "none");
         }
-        if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
-            flexarray_append(dm_args, "-gfx_passthru");
-        }
     } else {
         if (!sdl && !vnc) {
             flexarray_append(dm_args, "-nographic");
Quoted 8 lines
Quoted 2 lines

I will fold this into next revision after this review.

I think this change alone warrants a separate changeset. It should be patch 0 of your series as a preparatory patch. Please remember to elaborate in commit message why that hunk is not needed in upstream QEMU.

Quoted 6 lines

What about this?

"-gfx_passthru" is just introduced to work for qemu-xen-traditional so we should get this away from libxl__build_device_model_args_new() in the case of qemu upstream.

This looks good.

Wei.

Quoted 2 lines

Thanks
Tiejun

#18 lore raw

Re: [PATCH 2/2] libxl: introduce gfx_passthru_kind

In reply to Tiejun Chen
Quoted 9 lines · 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and

                                                               ^^^^^
                                                               true?
Quoted 21 lines

build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
 tools/libxl/libxl_dm.c      | 13 +++++++++++++
 tools/libxl/libxl_types.idl |  6 ++++++
 tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
 3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +0 -0
index 8599a6a..780dd2a 100644

tools/libxl/libxl_dm.c static char ** libxl__build_device_model_args_new(libxl__gc *gc, · line 765

Quoted 9 lines
tools/libxl/libxl_dm.c +6 -0
@@ -757,6 +757,19 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                             machinearg, max_ram_below_4g);
             }
         }
+
+        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);
+            }

You can remove that {} around machinearg -- it's only one line after `if'.

Quoted 15 lines
tools/libxl/libxl_dm.c +7 -0
+        } else if (b_info->u.hvm.gfx_passthru_kind ==
+                        LIBXL_GFX_PASSTHRU_KIND_IGD) {
+                machinearg = GCSPRINTF("%s,igd-passthru=on", machinearg);
+        } else {
+            LOG(WARN, "gfx_passthru_kind is invalid so ignored.\n");
+        }
+
         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]);
tools/libxl/libxl_types.idl +0 -0
index 02be466..e209460 100644

tools/libxl/libxl_types.idl libxl_tsc_mode = Enumeration("tsc_mode", [ · line 147

Quoted 8 lines
tools/libxl/libxl_types.idl +5 -0
@@ -140,6 +140,11 @@ libxl_tsc_mode = Enumeration("tsc_mode", [
     (3, "native_paravirt"),
     ])
 
+libxl_gfx_passthru_kind = Enumeration("gfx_passthru_kind", [
+    (0, "default"),
+    (1, "igd"),
+    ], init_val = "LIBXL_GFX_PASSTHRU_KIND_DEFAULT")
+

You don't need to set init_val if the default value is 0.

tools/libxl/libxl_types.idl libxl_domain_build_info = Struct("domain_build_info",[ · line 438

Quoted 8 lines
tools/libxl/libxl_types.idl +1 -0
 # Consistent with the values defined for HVM_PARAM_TIMER_MODE.
 libxl_timer_mode = Enumeration("timer_mode", [
     (-1, "unknown"),
@@ -430,6 +435,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                        ("spice",            libxl_spice_info),
 
                                        ("gfx_passthru",     libxl_defbool),
+                                       ("gfx_passthru_kind",     libxl_gfx_passthru_kind),
                                                                ^^^^

One space is enough, I think.

Quoted 10 lines
tools/libxl/libxl_types.idl +0 -0
                                        ("serial",           string),
                                        ("boot",             string),
tools/libxl/xl_cmdimpl.c +0 -0
index 440db78..3f7fede 100644
@@ -1953,8 +1953,23 @@ skip_vfb:
         xlu_cfg_replace_string (config, "spice_streaming_video",
                                 &b_info->u.hvm.spice.streaming_video, 0);

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1962

Quoted 10 lines
tools/libxl/xl_cmdimpl.c +7 -2
         xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
-        xlu_cfg_get_defbool(config, "gfx_passthru",
-                            &b_info->u.hvm.gfx_passthru, 0);
+        if (!xlu_cfg_get_long(config, "gfx_passthru", &l, 1)) {
+            if (!l) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+            } else if (i == 1) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
+            } else {
+                fprintf(stderr, "ERROR: invalid value %ld for \"gfx_passthru\"\n", l);

Please wrap this line to be < 80 column.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1966

Quoted 4 lines
tools/libxl/xl_cmdimpl.c +4 -0
+                exit (1);
+            }
+        } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
+            if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {

Ditto.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1967

Quoted 1 line
tools/libxl/xl_cmdimpl.c +1 -0
+                fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",

Ditto.

Wei.

Quoted 10 lines
tools/libxl/xl_cmdimpl.c +5 -0
+                        buf);
+                exit (1);
+            }
+            libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+        }
         switch (xlu_cfg_get_list_as_string_list(config, "serial",
                                                 &b_info->u.hvm.serial_list,
                                                 1))
Signature · 1 line
1.9.1
#19 lore raw

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

In reply to Tiejun Chen
Quoted 9 lines · 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and

                                                               ^^^^^
                                                               true?
Quoted 21 lines

build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
 tools/libxl/libxl_dm.c      | 13 +++++++++++++
 tools/libxl/libxl_types.idl |  6 ++++++
 tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
 3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +0 -0
index 8599a6a..780dd2a 100644

tools/libxl/libxl_dm.c static char ** libxl__build_device_model_args_new(libxl__gc *gc, · line 765

Quoted 9 lines
tools/libxl/libxl_dm.c +6 -0
@@ -757,6 +757,19 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                             machinearg, max_ram_below_4g);
             }
         }
+
+        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);
+            }

You can remove that {} around machinearg -- it's only one line after `if'.

Quoted 15 lines
tools/libxl/libxl_dm.c +7 -0
+        } else if (b_info->u.hvm.gfx_passthru_kind ==
+                        LIBXL_GFX_PASSTHRU_KIND_IGD) {
+                machinearg = GCSPRINTF("%s,igd-passthru=on", machinearg);
+        } else {
+            LOG(WARN, "gfx_passthru_kind is invalid so ignored.\n");
+        }
+
         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]);
tools/libxl/libxl_types.idl +0 -0
index 02be466..e209460 100644

tools/libxl/libxl_types.idl libxl_tsc_mode = Enumeration("tsc_mode", [ · line 147

Quoted 8 lines
tools/libxl/libxl_types.idl +5 -0
@@ -140,6 +140,11 @@ libxl_tsc_mode = Enumeration("tsc_mode", [
     (3, "native_paravirt"),
     ])
 
+libxl_gfx_passthru_kind = Enumeration("gfx_passthru_kind", [
+    (0, "default"),
+    (1, "igd"),
+    ], init_val = "LIBXL_GFX_PASSTHRU_KIND_DEFAULT")
+

You don't need to set init_val if the default value is 0.

tools/libxl/libxl_types.idl libxl_domain_build_info = Struct("domain_build_info",[ · line 438

Quoted 8 lines
tools/libxl/libxl_types.idl +1 -0
 # Consistent with the values defined for HVM_PARAM_TIMER_MODE.
 libxl_timer_mode = Enumeration("timer_mode", [
     (-1, "unknown"),
@@ -430,6 +435,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                        ("spice",            libxl_spice_info),
 
                                        ("gfx_passthru",     libxl_defbool),
+                                       ("gfx_passthru_kind",     libxl_gfx_passthru_kind),
                                                                ^^^^

One space is enough, I think.

Quoted 10 lines
tools/libxl/libxl_types.idl +0 -0
                                        ("serial",           string),
                                        ("boot",             string),
tools/libxl/xl_cmdimpl.c +0 -0
index 440db78..3f7fede 100644
@@ -1953,8 +1953,23 @@ skip_vfb:
         xlu_cfg_replace_string (config, "spice_streaming_video",
                                 &b_info->u.hvm.spice.streaming_video, 0);

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1962

Quoted 10 lines
tools/libxl/xl_cmdimpl.c +7 -2
         xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
-        xlu_cfg_get_defbool(config, "gfx_passthru",
-                            &b_info->u.hvm.gfx_passthru, 0);
+        if (!xlu_cfg_get_long(config, "gfx_passthru", &l, 1)) {
+            if (!l) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+            } else if (i == 1) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
+            } else {
+                fprintf(stderr, "ERROR: invalid value %ld for \"gfx_passthru\"\n", l);

Please wrap this line to be < 80 column.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1966

Quoted 4 lines
tools/libxl/xl_cmdimpl.c +4 -0
+                exit (1);
+            }
+        } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
+            if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {

Ditto.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1967

Quoted 1 line
tools/libxl/xl_cmdimpl.c +1 -0
+                fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",

Ditto.

Wei.

Quoted 10 lines
tools/libxl/xl_cmdimpl.c +5 -0
+                        buf);
+                exit (1);
+            }
+            libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+        }
         switch (xlu_cfg_get_list_as_string_list(config, "serial",
                                                 &b_info->u.hvm.serial_list,
                                                 1))
Signature · 1 line
1.9.1
#20 lore raw

Re: [PATCH 2/2] libxl: introduce gfx_passthru_kind

Quoted 8 lines · Wei Liu
Quoted 7 lines · 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

Quoted 4 lines
Quoted 2 lines

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and

                                                                ^^^^^
                                                                true?

I just simply pick up this from Campbell's comment but I agree you.

Quoted 26 lines
Quoted 26 lines

build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
  tools/libxl/libxl_dm.c      | 13 +++++++++++++
  tools/libxl/libxl_types.idl |  6 ++++++
  tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
  3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +1 -0
index 8599a6a..780dd2a 100644
@@ -757,6 +757,19 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                              machinearg, max_ram_below_4g);
              }
          }
+
Quoted 8 lines

tools/libxl/libxl_dm.c static char ** libxl__build_device_model_args_new(libxl__gc *gc, · line 765

Quoted 5 lines
tools/libxl/libxl_dm.c +5 -0
+        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);
+            }

You can remove that {} around machinearg -- it's only one line after `if'.

Okay.

Quoted 19 lines
Quoted 19 lines
tools/libxl/libxl_dm.c +7 -0
+        } else if (b_info->u.hvm.gfx_passthru_kind ==
+                        LIBXL_GFX_PASSTHRU_KIND_IGD) {
+                machinearg = GCSPRINTF("%s,igd-passthru=on", machinearg);
+        } else {
+            LOG(WARN, "gfx_passthru_kind is invalid so ignored.\n");
+        }
+
          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]);
tools/libxl/libxl_types.idl +0 -0
index 02be466..e209460 100644
@@ -140,6 +140,11 @@ libxl_tsc_mode = Enumeration("tsc_mode", [
      (3, "native_paravirt"),
      ])
 
Quoted 7 lines

tools/libxl/libxl_types.idl libxl_tsc_mode = Enumeration("tsc_mode", [ · line 147

Quoted 5 lines
tools/libxl/libxl_types.idl +5 -0
+libxl_gfx_passthru_kind = Enumeration("gfx_passthru_kind", [
+    (0, "default"),
+    (1, "igd"),
+    ], init_val = "LIBXL_GFX_PASSTHRU_KIND_DEFAULT")
+

You don't need to set init_val if the default value is 0.

Got it.

Quoted 11 lines

tools/libxl/libxl_types.idl libxl_domain_build_info = Struct("domain_build_info",[ · line 438

Quoted 9 lines
tools/libxl/libxl_types.idl +1 -0
  # Consistent with the values defined for HVM_PARAM_TIMER_MODE.
  libxl_timer_mode = Enumeration("timer_mode", [
      (-1, "unknown"),
@@ -430,6 +435,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                         ("spice",            libxl_spice_info),
 
                                         ("gfx_passthru",     libxl_defbool),
+                                       ("gfx_passthru_kind",     libxl_gfx_passthru_kind),
                                                                 ^^^^

One space is enough, I think.

Okay.

Quoted 29 lines
Quoted 11 lines
tools/libxl/libxl_types.idl +0 -0
                                         ("serial",           string),
                                         ("boot",             string),
tools/libxl/xl_cmdimpl.c +0 -0
index 440db78..3f7fede 100644
@@ -1953,8 +1953,23 @@ skip_vfb:
          xlu_cfg_replace_string (config, "spice_streaming_video",
                                  &b_info->u.hvm.spice.streaming_video, 0);

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1962

Quoted 10 lines
tools/libxl/xl_cmdimpl.c +7 -2
          xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
-        xlu_cfg_get_defbool(config, "gfx_passthru",
-                            &b_info->u.hvm.gfx_passthru, 0);
+        if (!xlu_cfg_get_long(config, "gfx_passthru", &l, 1)) {
+            if (!l) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+            } else if (i == 1) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
+            } else {
+                fprintf(stderr, "ERROR: invalid value %ld for \"gfx_passthru\"\n", l);

Please wrap this line to be < 80 column.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1966

Quoted 4 lines
tools/libxl/xl_cmdimpl.c +4 -0
+                exit (1);
+            }
+        } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
+            if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {
Quoted 5 lines

Ditto.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1967

Quoted 1 line
tools/libxl/xl_cmdimpl.c +1 -0
+                fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",

Ditto.

So,

@@ -1959,13 +1959,15 @@ skip_vfb:

             } else if (i == 1) {
                 libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
             } else {
-                fprintf(stderr, "ERROR: invalid value %ld for \"gfx_passthru\"\n", l);
+                fprintf(stderr, "ERROR: invalid value %ld for"
+                                " \"gfx_passthru\"\n", l);
                 exit (1);
             }
         } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {

- if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {
- fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",
- buf);
+ if (libxl_gfx_passthru_kind_from_string(buf,
+ &b_info->u.hvm.gfx_passthru_kind)) {
+ fprintf(stderr, "ERROR: invalid value \"%s\" for"

+                                " \"gfx_passthru\"\n", buf);
                 exit (1);
             }
             libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);

Thanks
Tiejun

#21 lore raw

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

In reply to Wei Liu
Quoted 8 lines · Wei Liu
Quoted 7 lines · 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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

Quoted 4 lines
Quoted 2 lines

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and

                                                                ^^^^^
                                                                true?

I just simply pick up this from Campbell's comment but I agree you.

Quoted 26 lines
Quoted 26 lines

build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Here if gfx_passthru_kind = DEFAULT, we will call libxl__is_igd_vga_passthru() to check if we're hitting that table to need to pass that option to qemu. But if gfx_passthru_kind = "igd" we always force to pass that.

---
  tools/libxl/libxl_dm.c      | 13 +++++++++++++
  tools/libxl/libxl_types.idl |  6 ++++++
  tools/libxl/xl_cmdimpl.c    | 19 +++++++++++++++++--
  3 files changed, 36 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +1 -0
index 8599a6a..780dd2a 100644
@@ -757,6 +757,19 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                              machinearg, max_ram_below_4g);
              }
          }
+
Quoted 8 lines

tools/libxl/libxl_dm.c static char ** libxl__build_device_model_args_new(libxl__gc *gc, · line 765

Quoted 5 lines
tools/libxl/libxl_dm.c +5 -0
+        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);
+            }

You can remove that {} around machinearg -- it's only one line after `if'.

Okay.

Quoted 19 lines
Quoted 19 lines
tools/libxl/libxl_dm.c +7 -0
+        } else if (b_info->u.hvm.gfx_passthru_kind ==
+                        LIBXL_GFX_PASSTHRU_KIND_IGD) {
+                machinearg = GCSPRINTF("%s,igd-passthru=on", machinearg);
+        } else {
+            LOG(WARN, "gfx_passthru_kind is invalid so ignored.\n");
+        }
+
          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]);
tools/libxl/libxl_types.idl +0 -0
index 02be466..e209460 100644
@@ -140,6 +140,11 @@ libxl_tsc_mode = Enumeration("tsc_mode", [
      (3, "native_paravirt"),
      ])
 
Quoted 7 lines

tools/libxl/libxl_types.idl libxl_tsc_mode = Enumeration("tsc_mode", [ · line 147

Quoted 5 lines
tools/libxl/libxl_types.idl +5 -0
+libxl_gfx_passthru_kind = Enumeration("gfx_passthru_kind", [
+    (0, "default"),
+    (1, "igd"),
+    ], init_val = "LIBXL_GFX_PASSTHRU_KIND_DEFAULT")
+

You don't need to set init_val if the default value is 0.

Got it.

Quoted 11 lines

tools/libxl/libxl_types.idl libxl_domain_build_info = Struct("domain_build_info",[ · line 438

Quoted 9 lines
tools/libxl/libxl_types.idl +1 -0
  # Consistent with the values defined for HVM_PARAM_TIMER_MODE.
  libxl_timer_mode = Enumeration("timer_mode", [
      (-1, "unknown"),
@@ -430,6 +435,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                         ("spice",            libxl_spice_info),
 
                                         ("gfx_passthru",     libxl_defbool),
+                                       ("gfx_passthru_kind",     libxl_gfx_passthru_kind),
                                                                 ^^^^

One space is enough, I think.

Okay.

Quoted 29 lines
Quoted 11 lines
tools/libxl/libxl_types.idl +0 -0
                                         ("serial",           string),
                                         ("boot",             string),
tools/libxl/xl_cmdimpl.c +0 -0
index 440db78..3f7fede 100644
@@ -1953,8 +1953,23 @@ skip_vfb:
          xlu_cfg_replace_string (config, "spice_streaming_video",
                                  &b_info->u.hvm.spice.streaming_video, 0);

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1962

Quoted 10 lines
tools/libxl/xl_cmdimpl.c +7 -2
          xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
-        xlu_cfg_get_defbool(config, "gfx_passthru",
-                            &b_info->u.hvm.gfx_passthru, 0);
+        if (!xlu_cfg_get_long(config, "gfx_passthru", &l, 1)) {
+            if (!l) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);
+            } else if (i == 1) {
+                libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
+            } else {
+                fprintf(stderr, "ERROR: invalid value %ld for \"gfx_passthru\"\n", l);

Please wrap this line to be < 80 column.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1966

Quoted 4 lines
tools/libxl/xl_cmdimpl.c +4 -0
+                exit (1);
+            }
+        } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
+            if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {
Quoted 5 lines

Ditto.

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1967

Quoted 1 line
tools/libxl/xl_cmdimpl.c +1 -0
+                fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",

Ditto.

So,

@@ -1959,13 +1959,15 @@ skip_vfb:

             } else if (i == 1) {
                 libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
             } else {
-                fprintf(stderr, "ERROR: invalid value %ld for \"gfx_passthru\"\n", l);
+                fprintf(stderr, "ERROR: invalid value %ld for"
+                                " \"gfx_passthru\"\n", l);
                 exit (1);
             }
         } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {

- if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {
- fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",
- buf);
+ if (libxl_gfx_passthru_kind_from_string(buf,
+ &b_info->u.hvm.gfx_passthru_kind)) {
+ fprintf(stderr, "ERROR: invalid value \"%s\" for"

+                                " \"gfx_passthru\"\n", buf);
                 exit (1);
             }
             libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);

Thanks
Tiejun

#22 lore raw

Re: [PATCH 2/2] libxl: introduce gfx_passthru_kind

On Mon, Mar 09, 2015 at 02:45:36PM +0800, Chen, Tiejun wrote:
[...]

Quoted 34 lines
Quoted 11 lines

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1966

Quoted 5 lines
tools/libxl/xl_cmdimpl.c +4 -0
+                exit (1);
+            }
+        } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
+            if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {

Ditto.

Quoted 1 line

+ fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",

Ditto.

So,

(quoted diff) +6 -4
@@ -1959,13 +1959,15 @@ skip_vfb:
             } else if (i == 1) {
                 libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
             } else {
-                fprintf(stderr, "ERROR: invalid value %ld for
 \"gfx_passthru\"\n", l);
+                fprintf(stderr, "ERROR: invalid value %ld for"
+                                " \"gfx_passthru\"\n", l);
                 exit (1);
             }
         } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
-            if (libxl_gfx_passthru_kind_from_string(buf,
 &b_info->u.hvm.gfx_passthru_kind)) {
-                fprintf(stderr, "ERROR: invalid value \"%s\" for
 \"gfx_passthru\"\n",
-                        buf);
+            if (libxl_gfx_passthru_kind_from_string(buf,
+ &b_info->u.hvm.gfx_passthru_kind)) {
+                fprintf(stderr, "ERROR: invalid value \"%s\" for"
+                                " \"gfx_passthru\"\n", buf);
Quoted 4 lines
                 exit (1);
             }
             libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);

Your changes are mangled by your email client. But we don't normally split the format string so that it's easier to grep.

What we normally do is

     fprintf(stderr,
             "FORMAT STRING",
	     a, b, c);

If format string still treads over 80 column it's fine. We can live with that.

Wei.

Quoted 2 lines

Thanks
Tiejun

#23 lore raw

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

In reply to Chen, Tiejun

On Mon, Mar 09, 2015 at 02:45:36PM +0800, Chen, Tiejun wrote:
[...]

Quoted 34 lines
Quoted 11 lines

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1966

Quoted 5 lines
tools/libxl/xl_cmdimpl.c +4 -0
+                exit (1);
+            }
+        } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
+            if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {

Ditto.

Quoted 1 line

+ fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",

Ditto.

So,

(quoted diff) +6 -4
@@ -1959,13 +1959,15 @@ skip_vfb:
             } else if (i == 1) {
                 libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
             } else {
-                fprintf(stderr, "ERROR: invalid value %ld for
 \"gfx_passthru\"\n", l);
+                fprintf(stderr, "ERROR: invalid value %ld for"
+                                " \"gfx_passthru\"\n", l);
                 exit (1);
             }
         } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
-            if (libxl_gfx_passthru_kind_from_string(buf,
 &b_info->u.hvm.gfx_passthru_kind)) {
-                fprintf(stderr, "ERROR: invalid value \"%s\" for
 \"gfx_passthru\"\n",
-                        buf);
+            if (libxl_gfx_passthru_kind_from_string(buf,
+ &b_info->u.hvm.gfx_passthru_kind)) {
+                fprintf(stderr, "ERROR: invalid value \"%s\" for"
+                                " \"gfx_passthru\"\n", buf);
Quoted 4 lines
                 exit (1);
             }
             libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);

Your changes are mangled by your email client. But we don't normally split the format string so that it's easier to grep.

What we normally do is

     fprintf(stderr,
             "FORMAT STRING",
	     a, b, c);

If format string still treads over 80 column it's fine. We can live with that.

Wei.

Quoted 2 lines

Thanks
Tiejun

#24 lore raw

Re: [PATCH 2/2] libxl: introduce gfx_passthru_kind

Quoted 35 lines · Wei Liu

On Mon, Mar 09, 2015 at 02:45:36PM +0800, Chen, Tiejun wrote:
[...]

Quoted 33 lines
Quoted 11 lines

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1966

Quoted 5 lines
tools/libxl/xl_cmdimpl.c +4 -0
+                exit (1);
+            }
+        } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
+            if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {

Ditto.

Quoted 1 line

+ fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",

Ditto.

So,

(quoted diff) +5 -4
@@ -1959,13 +1959,15 @@ skip_vfb:
              } else if (i == 1) {
                  libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
              } else {
-                fprintf(stderr, "ERROR: invalid value %ld for
 \"gfx_passthru\"\n", l);
+                fprintf(stderr, "ERROR: invalid value %ld for"
+                                " \"gfx_passthru\"\n", l);
                  exit (1);
              }
          } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
-            if (libxl_gfx_passthru_kind_from_string(buf,
 &b_info->u.hvm.gfx_passthru_kind)) {
-                fprintf(stderr, "ERROR: invalid value \"%s\" for
 \"gfx_passthru\"\n",
-                        buf);
+            if (libxl_gfx_passthru_kind_from_string(buf,
+ &b_info->u.hvm.gfx_passthru_kind)) {
+                fprintf(stderr, "ERROR: invalid value \"%s\" for"
Quoted 8 lines
Quoted 5 lines
(quoted diff) +1 -0
+                                " \"gfx_passthru\"\n", buf);
                  exit (1);
              }
              libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);

Your changes are mangled by your email client. But we don't normally split the format string so that it's easier to grep.

Yeah.

Quoted 10 lines

What we normally do is

      fprintf(stderr,
              "FORMAT STRING",
	     a, b, c);

If format string still treads over 80 column it's fine. We can live with that.

Understood.

Thanks
Tiejun

#25 lore raw

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

In reply to Wei Liu
Quoted 35 lines · Wei Liu

On Mon, Mar 09, 2015 at 02:45:36PM +0800, Chen, Tiejun wrote:
[...]

Quoted 33 lines
Quoted 11 lines

tools/libxl/xl_cmdimpl.c skip_vfb: · line 1966

Quoted 5 lines
tools/libxl/xl_cmdimpl.c +4 -0
+                exit (1);
+            }
+        } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
+            if (libxl_gfx_passthru_kind_from_string(buf, &b_info->u.hvm.gfx_passthru_kind)) {

Ditto.

Quoted 1 line

+ fprintf(stderr, "ERROR: invalid value \"%s\" for \"gfx_passthru\"\n",

Ditto.

So,

(quoted diff) +5 -4
@@ -1959,13 +1959,15 @@ skip_vfb:
              } else if (i == 1) {
                  libxl_defbool_set(&b_info->u.hvm.gfx_passthru, true);
              } else {
-                fprintf(stderr, "ERROR: invalid value %ld for
 \"gfx_passthru\"\n", l);
+                fprintf(stderr, "ERROR: invalid value %ld for"
+                                " \"gfx_passthru\"\n", l);
                  exit (1);
              }
          } else if (!xlu_cfg_get_string(config, "gfx_passthru", &buf, 0)) {
-            if (libxl_gfx_passthru_kind_from_string(buf,
 &b_info->u.hvm.gfx_passthru_kind)) {
-                fprintf(stderr, "ERROR: invalid value \"%s\" for
 \"gfx_passthru\"\n",
-                        buf);
+            if (libxl_gfx_passthru_kind_from_string(buf,
+ &b_info->u.hvm.gfx_passthru_kind)) {
+                fprintf(stderr, "ERROR: invalid value \"%s\" for"
Quoted 8 lines
Quoted 5 lines
(quoted diff) +1 -0
+                                " \"gfx_passthru\"\n", buf);
                  exit (1);
              }
              libxl_defbool_set(&b_info->u.hvm.gfx_passthru, false);

Your changes are mangled by your email client. But we don't normally split the format string so that it's easier to grep.

Yeah.

Quoted 10 lines

What we normally do is

      fprintf(stderr,
              "FORMAT STRING",
	     a, b, c);

If format string still treads over 80 column it's fine. We can live with that.

Understood.

Thanks
Tiejun

#26 lore raw

Re: [PATCH 2/2] libxl: introduce gfx_passthru_kind

In reply to Chen, Tiejun
Quoted 3 lines · Tiejun
Quoted 2 lines · Wei Liu
Quoted 1 line · Tiejun Chen

Although we already have 'gfx_passthru' in b_info, this doesn' suffice

                                                                   ^t
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and

                                                                ^^^^^
                                                                true?

I just simply pick up this from Campbell's comment but I agree you.

Sorry! Wei is right.

#27 lore raw

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

In reply to Chen, Tiejun
Quoted 3 lines · Tiejun
Quoted 2 lines · Wei Liu
Quoted 1 line · Tiejun Chen

Although we already have 'gfx_passthru' in b_info, this doesn' suffice

                                                                   ^t
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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 gfx_passthru_kind. And then we can cooperate with gfx_passthru to address IGD cases as follows:

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and

                                                                ^^^^^
                                                                true?

I just simply pick up this from Campbell's comment but I agree you.

Sorry! Wei is right.

#28 lore raw
In reply to Tiejun Chen
Quoted 16 lines · Tiejun Chen

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,igd-passthru=on". This need to bring a change on tool side.

After a discussion with Campbell, we'd like to construct a table to record all IGD devices we can support. If we hit that table, we should pass that option. And so we also introduce a new field of type, 'gfx_passthru_kind', to cooperate with 'gfx_passthru' to cover all scenarios like this,

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

Quoted 8 lines

----------------------------------------------------------------
Tiejun Chen (2):
libxl: introduce libxl__is_igd_vga_passthru
libxl: introduce gfx_passthru_kind

 tools/libxl/libxl_dm.c       |  13 +++++++++++++
 tools/libxl/libxl_internal.h |   2 ++
 tools/libxl/libxl_pci.c      | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

It might be helpful to use --stat-width=72 or some other options to limit the width of your diffstat. :-)

Wei.

Quoted 6 lines
 tools/libxl/libxl_types.idl  |   6 ++++++
 tools/libxl/xl_cmdimpl.c     |  19 +++++++++++++++++--
 5 files changed, 162 insertions(+), 2 deletions(-)

Thanks
Tiejun

#29 lore raw
Quoted 22 lines · Wei Liu
Quoted 21 lines · Tiejun Chen

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,igd-passthru=on". This need to bring a change on tool side.

After a discussion with Campbell, we'd like to construct a table to record all IGD devices we can support. If we hit that table, we should pass that option. And so we also introduce a new field of type, 'gfx_passthru_kind', to cooperate with 'gfx_passthru' to cover all scenarios like this,

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

----------------------------------------------------------------
Tiejun Chen (2):
libxl: introduce libxl__is_igd_vga_passthru
libxl: introduce gfx_passthru_kind

Quoted 7 lines
Quoted 3 lines
  tools/libxl/libxl_dm.c       |  13 +++++++++++++
  tools/libxl/libxl_internal.h |   2 ++
  tools/libxl/libxl_pci.c      | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

It might be helpful to use --stat-width=72 or some other options to limit the width of your diffstat. :-)

Will do.

Thanks
Tiejun

#30 lore raw
In reply to Wei Liu
Quoted 22 lines · Wei Liu
Quoted 21 lines · Tiejun Chen

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,igd-passthru=on". This need to bring a change on tool side.

After a discussion with Campbell, we'd like to construct a table to record all IGD devices we can support. If we hit that table, we should pass that option. And so we also introduce a new field of type, 'gfx_passthru_kind', to cooperate with 'gfx_passthru' to cover all scenarios like this,

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

----------------------------------------------------------------
Tiejun Chen (2):
libxl: introduce libxl__is_igd_vga_passthru
libxl: introduce gfx_passthru_kind

Quoted 7 lines
Quoted 3 lines
  tools/libxl/libxl_dm.c       |  13 +++++++++++++
  tools/libxl/libxl_internal.h |   2 ++
  tools/libxl/libxl_pci.c      | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

It might be helpful to use --stat-width=72 or some other options to limit the width of your diffstat. :-)

Will do.

Thanks
Tiejun

#31 lore raw
In reply to Tiejun Chen
Quoted 2 lines · Tiejun Chen

When we're working to support IGD GFX passthrough with qemu upstream, instead of "-gfx_passthru" we'd like to make that

Could you also include in the cover letter an URL link to the latest discussion on this?

Thank you.

Quoted 33 lines

a machine option, "-machine xxx,igd-passthru=on". This need to bring a change on tool side.

After a discussion with Campbell, we'd like to construct a table to record all IGD devices we can support. If we hit that table, we should pass that option. And so we also introduce a new field of type, 'gfx_passthru_kind', to cooperate with 'gfx_passthru' to cover all scenarios like this,

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

----------------------------------------------------------------
Tiejun Chen (2):
libxl: introduce libxl__is_igd_vga_passthru
libxl: introduce gfx_passthru_kind

 tools/libxl/libxl_dm.c       |  13 +++++++++++++
 tools/libxl/libxl_internal.h |   2 ++
 tools/libxl/libxl_pci.c      | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_types.idl  |   6 ++++++
 tools/libxl/xl_cmdimpl.c     |  19 +++++++++++++++++--
 5 files changed, 162 insertions(+), 2 deletions(-)

Thanks
Tiejun

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#32 lore raw
In reply to Tiejun Chen
Quoted 2 lines · Tiejun Chen

When we're working to support IGD GFX passthrough with qemu upstream, instead of "-gfx_passthru" we'd like to make that

Could you also include in the cover letter an URL link to the latest discussion on this?

Thank you.

Quoted 33 lines

a machine option, "-machine xxx,igd-passthru=on". This need to bring a change on tool side.

After a discussion with Campbell, we'd like to construct a table to record all IGD devices we can support. If we hit that table, we should pass that option. And so we also introduce a new field of type, 'gfx_passthru_kind', to cooperate with 'gfx_passthru' to cover all scenarios like this,

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

----------------------------------------------------------------
Tiejun Chen (2):
libxl: introduce libxl__is_igd_vga_passthru
libxl: introduce gfx_passthru_kind

 tools/libxl/libxl_dm.c       |  13 +++++++++++++
 tools/libxl/libxl_internal.h |   2 ++
 tools/libxl/libxl_pci.c      | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_types.idl  |   6 ++++++
 tools/libxl/xl_cmdimpl.c     |  19 +++++++++++++++++--
 5 files changed, 162 insertions(+), 2 deletions(-)

Thanks
Tiejun

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#33 lore raw
Quoted 6 lines · Konrad Rzeszutek Wilk
Quoted 2 lines · Tiejun Chen

When we're working to support IGD GFX passthrough with qemu upstream, instead of "-gfx_passthru" we'd like to make that

Could you also include in the cover letter an URL link to the latest discussion on this?

Thanks for reminding. I really should do this.

https://lists.nongnu.org/archive/html/qemu-devel/2015-01/msg02050.html

Thanks
Tiejun

Quoted 36 lines

Thank you.

Quoted 33 lines

a machine option, "-machine xxx,igd-passthru=on". This need to bring a change on tool side.

After a discussion with Campbell, we'd like to construct a table to record all IGD devices we can support. If we hit that table, we should pass that option. And so we also introduce a new field of type, 'gfx_passthru_kind', to cooperate with 'gfx_passthru' to cover all scenarios like this,

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

----------------------------------------------------------------
Tiejun Chen (2):
libxl: introduce libxl__is_igd_vga_passthru
libxl: introduce gfx_passthru_kind

  tools/libxl/libxl_dm.c       |  13 +++++++++++++
  tools/libxl/libxl_internal.h |   2 ++
  tools/libxl/libxl_pci.c      | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  tools/libxl/libxl_types.idl  |   6 ++++++
  tools/libxl/xl_cmdimpl.c     |  19 +++++++++++++++++--
  5 files changed, 162 insertions(+), 2 deletions(-)

Thanks
Tiejun

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#34 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 6 lines · Konrad Rzeszutek Wilk
Quoted 2 lines · Tiejun Chen

When we're working to support IGD GFX passthrough with qemu upstream, instead of "-gfx_passthru" we'd like to make that

Could you also include in the cover letter an URL link to the latest discussion on this?

Thanks for reminding. I really should do this.

https://lists.nongnu.org/archive/html/qemu-devel/2015-01/msg02050.html

Thanks
Tiejun

Quoted 36 lines

Thank you.

Quoted 33 lines

a machine option, "-machine xxx,igd-passthru=on". This need to bring a change on tool side.

After a discussion with Campbell, we'd like to construct a table to record all IGD devices we can support. If we hit that table, we should pass that option. And so we also introduce a new field of type, 'gfx_passthru_kind', to cooperate with 'gfx_passthru' to cover all scenarios like this,

gfx_passthru = 0 => sets build_info.u.gfx_passthru to false
gfx_passthru = 1 => sets build_info.u.gfx_passthru to false and
build_info.u.gfx_passthru_kind to DEFAULT
gfx_passthru = "igd" => sets build_info.u.gfx_passthru to false
and build_info.u.gfx_passthru_kind to IGD

----------------------------------------------------------------
Tiejun Chen (2):
libxl: introduce libxl__is_igd_vga_passthru
libxl: introduce gfx_passthru_kind

  tools/libxl/libxl_dm.c       |  13 +++++++++++++
  tools/libxl/libxl_internal.h |   2 ++
  tools/libxl/libxl_pci.c      | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  tools/libxl/libxl_types.idl  |   6 ++++++
  tools/libxl/xl_cmdimpl.c     |  19 +++++++++++++++++--
  5 files changed, 162 insertions(+), 2 deletions(-)

Thanks
Tiejun

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel