@@ -1207,6 +1207,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
int rc;
int next_slot;
bool configure_pci_for_igd = false;
+ const int igd_slot = 2;
/*
* next_slot is only used when we need to configure the pci
* slots for the Intel IGD. Slot 2 will be for the Intel IGD.
@@ -2173,6 +2174,27 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
flexarray_append(dm_envs, NULL);
if (envs)
*envs = (char **) flexarray_contents(dm_envs);
+ if (configure_pci_for_igd) {
+ libxl_device_pci *pci = NULL;
+ for (i = 0; i < guest_config->num_pcidevs; i++) {
+ pci = &guest_config->pcidevs[i];
+ if (!pci->vdevfn) {
+ /*
+ * Find the Intel IGD and configure it for slot 2.
+ * Configure any other devices for slot next_slot.
+ * Since the guest is configured for IGD passthrough,
+ * assume the device on the host at slot 2 is the IGD.
+ */
+ if (pci->domain == 0 && pci->bus == 0 &&
+ pci->dev == igd_slot && pci->func == 0) {
+ pci->vdevfn = PCI_DEVFN(igd_slot, 0);
+ } else {
+ pci->vdevfn = PCI_DEVFN(next_slot, 0);
+ next_slot++;
+ }
+ }
+ }
+ }
return 0;
}
It is possible for the administrator to manually specify the virtual slot addresses of passed through pci devices on the guest's pci bus using the @VSLOT parameter in xl.cfg. With this patch, libxl will by default assign the Intel IGD to slot 2 when gfx_passthru is configured for the Intel IGD so it will no longer be necessary to use the @VSLOT setting to configure the IGD correctly. Also, with this patch, libxl will not override explicit @VSLOT settings by the administrator so in that case the patch will have no effect on guest behavior. The default behavior of letting qemu manage the slot addresses of passed through pci devices when gfx_passthru is disabled and the administrator does not set @VSLOT for passed through pci devices is also preserved. Signed-off-by: Chuck Zmudzinski <brchuckz@aol.com> --- tools/libs/light/libxl_dm.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)