[vfio-users] Question about integrated GPU passthrough and initialization

Micah Morton mortonm at chromium.org
Wed May 29 16:25:59 UTC 2019


So as I mentioned, the ChromeOS firmware writes the location of the
OpRegion to the ASLS PCI config register
(https://github.com/coreboot/coreboot/blob/master/src/drivers/intel/gma/opregion.c#L88).
The i915 driver then gets the address for the OpRegion from that
register here: https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/i915/intel_opregion.c#L910.
This all works for Chrome OS, but when we run a VM with SeaBIOS the
ASLS PCI config register doesn't get written with the location of the
OpRegion.:
[    0.263640] in i915_driver_init_hw (I added this)
...
[    0.263922] in intel_opregion_setup (and this)
[    0.263954] graphic opregion physical addr: 0x0 <-- This is
supposed to point to the OpRegion, not be zero.
[    0.263954] ACPI OpRegion not supported!
...
[    0.267727] Failed to find VBIOS tables (VBT)

I'm also not sure if the OpRegion is actually in VM memory or not. Do
you think I need to find a way to put the OpRegion in VM memory as we
have seen coreboot (Chrome OS firmware) do above? Or should using
"x-igd-opregion=on" somehow ensure that the OpRegion makes it into VM
memory? Clearly I at least need to find a way to set that ASLS PCI
config register in the VM or modify the i915 driver that runs in the
guest so it can find the OpRegion.

On Tue, May 28, 2019 at 1:43 PM Micah Morton <mortonm at chromium.org> wrote:
>
> Hey Alex,
>
> I'm seeing the firmware get a hold of the VBT
> (https://github.com/coreboot/coreboot/blob/master/src/drivers/intel/gma/opregion.c#L253)
> and write the location of the OpRegion to the ASLS PCI register
> (https://github.com/coreboot/coreboot/blob/master/src/drivers/intel/gma/opregion.c#L88).
> To sanity check, I booted and Chrome OS firmware put the OpRegion at
> 0x7aa9b520 (I can do `mem rm 0x7aa9b520 16` in the host and see it
> print out "IntelGraphicsMem"). So like you said, OpRegion is
> definitely there and used in the host.
>
> This line (https://github.com/coreboot/coreboot/blob/master/src/drivers/intel/gma/opregion.c#L312)
> seems to imply that the VBT is being included in the OpRegion, so not
> sure whats going wrong. I am right in the middle of debugging this so
> I'll follow up on here if I have further specific questions.
>
> Thanks!
>
> On Tue, May 28, 2019 at 1:23 PM Alex Williamson
> <alex.williamson at redhat.com> wrote:
> >
> > On Tue, 28 May 2019 09:35:16 -0700
> > Micah Morton <mortonm at chromium.org> wrote:
> >
> > > Ah ok thanks!
> > >
> > > The qemu command line i was using is here: `qemu-system-x86_64
> > > -chardev stdio,id=seabios -device
> > > isa-debugcon,iobase=0x402,chardev=seabios -m 2G -smp 2 -M pc -vga none
> > > -usbdevice tablet -cpu host,-invpcid,-tsc-deadline,check -drive
> > > 'file=/path/to/image.bin,index=0,media=disk,cache=unsafe,format=raw'
> > > -enable-kvm -device
> > > vfio-pci,x-igd-opregion=on,host=00:02.0,id=hostdev0,bus=pci.0,addr=0x2,rombar=0
> > > -device 'virtio-net,netdev=eth0' -netdev
> > > 'user,id=eth0,net=10.0.2.0/27,hostfwd=tcp:127.0.0.1:9222-:22'`
> > >
> > > It didn't work, but now at least I know why:
> > > [    0.316117] i915 0000:00:02.0: No more image in the PCI ROM
> > > [    0.316261] [drm] Failed to find VBIOS tables (VBT)
> > >
> > > If I can expose the VBT to the VM maybe it will work :)
> >
> > Hmm, looking at i915 it seems it didn't find this VBT thing in the
> > OpRegion so tried to look at the ROM, which comments indicate would
> > only be the VBT location on an older device.  QEMU should fail if
> > x-igd-opregion=on is specified but the host kernel didn't provide an
> > OpRegion at all, so we've at least done some minimal sanity checking at
> > the host kernel before exposing it, but maybe the OpRegion is missing
> > some things on this chrome device vs a standard pc?  Maybe Chrome OS
> > uses a modified i915 driver that doesn't depend on it so the firmware
> > guys stripped it?  You could write a minimal vfio driver to dump
> > the opregion data if you want to parse it by hand.  Thanks,
> >
> > Alex




More information about the vfio-users mailing list