[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] tools/libxl/libxl_pci.c: Judge igd through class code instead of device ID
commit 5e6e39a1d66bcdcb178ab40423b0943ee151948e Author: Xiong Zhang <xiong.y.zhang@xxxxxxxxx> AuthorDate: Mon Jul 3 03:25:53 2017 +0800 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Tue Jul 4 14:04:09 2017 +0100 tools/libxl/libxl_pci.c: Judge igd through class code instead of device ID IGD passthrough couldn't work on Skylake and Kabylake, because their Device ID aren't in fixup_ids[]. Currently we need to add every intel graphic ID into fixup_ids[], it is hard to maintain. This patch judge intel graphics through vendor id (0x8086) and class code(0x030000), this could support both the old and new intel graphics, and reduce maintain work in future. Signed-off-by: Xiong Zhang <xiong.y.zhang@xxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/libxl_pci.c | 59 ++++++++----------------------------------------- 1 file changed, 9 insertions(+), 50 deletions(-) diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index d109930..65ad5e5 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -559,46 +559,6 @@ out: return ret; } -typedef struct { - uint16_t vendor; - uint16_t device; -} pci_info; - -static const pci_info fixup_ids[] = { - /* Intel HSW Classic */ - {0x8086, 0x0402}, /* HSWGT1D, HSWD_w7 */ - {0x8086, 0x0406}, /* HSWGT1M, HSWM_w7 */ - {0x8086, 0x0412}, /* HSWGT2D, HSWD_w7 */ - {0x8086, 0x0416}, /* HSWGT2M, HSWM_w7 */ - {0x8086, 0x041E}, /* HSWGT15D, HSWD_w7 */ - /* Intel HSW ULT */ - {0x8086, 0x0A06}, /* HSWGT1UT, HSWM_w7 */ - {0x8086, 0x0A16}, /* HSWGT2UT, HSWM_w7 */ - {0x8086, 0x0A26}, /* HSWGT3UT, HSWM_w7 */ - {0x8086, 0x0A2E}, /* HSWGT3UT28W, HSWM_w7 */ - {0x8086, 0x0A1E}, /* HSWGT2UX, HSWM_w7 */ - {0x8086, 0x0A0E}, /* HSWGT1ULX, HSWM_w7 */ - /* Intel HSW CRW */ - {0x8086, 0x0D26}, /* HSWGT3CW, HSWM_w7 */ - {0x8086, 0x0D22}, /* HSWGT3CWDT, HSWD_w7 */ - /* Intel HSW Server */ - {0x8086, 0x041A}, /* HSWSVGT2, HSWD_w7 */ - /* Intel HSW SRVR */ - {0x8086, 0x040A}, /* HSWSVGT1, HSWD_w7 */ - /* Intel BSW */ - {0x8086, 0x1606}, /* BDWULTGT1, BDWM_w7 */ - {0x8086, 0x1616}, /* BDWULTGT2, BDWM_w7 */ - {0x8086, 0x1626}, /* BDWULTGT3, BDWM_w7 */ - {0x8086, 0x160E}, /* BDWULXGT1, BDWM_w7 */ - {0x8086, 0x161E}, /* BDWULXGT2, BDWM_w7 */ - {0x8086, 0x1602}, /* BDWHALOGT1, BDWM_w7 */ - {0x8086, 0x1612}, /* BDWHALOGT2, BDWM_w7 */ - {0x8086, 0x1622}, /* BDWHALOGT3, BDWM_w7 */ - {0x8086, 0x162B}, /* BDWHALO28W, BDWM_w7 */ - {0x8086, 0x162A}, /* BDWGT3WRKS, BDWM_w7 */ - {0x8086, 0x162D}, /* BDWGT3SRVR, BDWM_w7 */ -}; - /* * Some devices may need some ways to work well. Here like IGD, * we have to pass a specific option to qemu. @@ -606,24 +566,23 @@ static const pci_info fixup_ids[] = { bool libxl__is_igd_vga_passthru(libxl__gc *gc, const libxl_domain_config *d_config) { - unsigned int i, j, num = ARRAY_SIZE(fixup_ids); - uint16_t vendor, device, pt_vendor, pt_device; + unsigned int i; + uint16_t pt_vendor, pt_device; + unsigned long class; for (i = 0 ; i < d_config->num_pcidevs ; i++) { libxl_device_pci *pcidev = &d_config->pcidevs[i]; pt_vendor = sysfs_dev_get_vendor(gc, pcidev); pt_device = sysfs_dev_get_device(gc, pcidev); - if (pt_vendor == 0xffff || pt_device == 0xffff) + if (pt_vendor == 0xffff || pt_device == 0xffff || + pt_vendor != 0x8086) continue; - for (j = 0 ; j < num ; j++) { - vendor = fixup_ids[j].vendor; - device = fixup_ids[j].device; - - if (pt_vendor == vendor && pt_device == device) - return true; - } + if (sysfs_dev_get_class(gc, pcidev, &class)) + continue; + if (class == 0x030000) + return true; } return false; -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |