Message ID | 1392965053-1069-3-git-send-email-yang.z.zhang@intel.com |
---|---|
State | New |
Headers | show |
On Fri, Feb 21, 2014 at 02:44:10PM +0800, Yang Zhang wrote: > From: Yang Zhang <yang.z.zhang@Intel.com> > > Some VBIOSs and drivers assume the IGD BDF (bus:device:function) is > always 00:02.0, so this patch reserves 00:02.0 for assigned IGD in > guest. > > The original patch is from Weidong Han <weidong.han@intel.com> > > Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> > Cc: Weidong Han <weidong.han@intel.com> > --- > hw/pci/pci.c | 6 ++++++ > 1 files changed, 6 insertions(+), 0 deletions(-) > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index 4e0701d..e81816e 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -808,6 +808,12 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, > if (devfn < 0) { > for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices); > devfn += PCI_FUNC_MAX) { > +#if defined(CONFIG_XEN_PCI_PASSTHROUGH) > + /* If gfx_passthru is in use, reserve 00:02.* for the IGD */ > + if (gfx_passthru && devfn == 0x10) { > + continue; > + } > +#endif > if (!bus->devices[devfn]) > goto found; > } This does not look quite right, there is maybe another way to reserve a devfn.
diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 4e0701d..e81816e 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -808,6 +808,12 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, if (devfn < 0) { for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices); devfn += PCI_FUNC_MAX) { +#if defined(CONFIG_XEN_PCI_PASSTHROUGH) + /* If gfx_passthru is in use, reserve 00:02.* for the IGD */ + if (gfx_passthru && devfn == 0x10) { + continue; + } +#endif if (!bus->devices[devfn]) goto found; }