<div dir="auto">Hi,<div dir="auto"><br></div><div dir="auto">I have had fun recently trying to get vega gpu passthru working.</div><div dir="auto">After a lot of testing and some kernel patching I would say:</div><div dir="auto">1) if you want vega gpu reset working, use kernel 5.1.5 or above in the guest as well as the host.</div><div dir="auto">2) if you want passthru working instead of a blank screen at vm start, use OVMF efi instead of seabios.</div><div dir="auto">3) you may or may not need a vfio patch that stops the graphics card resizing the BAR.</div><div dir="auto"><br></div><div dir="auto">Kind regards</div><div dir="auto"><br></div><div dir="auto">James</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 3 Jun 2019, 22:40 Micah Morton, <<a href="mailto:mortonm@chromium.org">mortonm@chromium.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Alex,<br>
<br>
Could you remind me whether there is a minimum recommended kernel<br>
version to be running in the VM guest when doing GPU passthrough?<br>
<br>
I'm fine running 4.14 in the host, but was looking to see if I could<br>
run 4.4 in the guest and couldn't remember if it is advised to use a<br>
newer kernel in the guest or if there is any reason to have the guest<br>
kernel match the host kernel version?<br>
<br>
On Wed, May 29, 2019 at 10:00 AM Micah Morton <<a href="mailto:mortonm@chromium.org" target="_blank" rel="noreferrer">mortonm@chromium.org</a>> wrote:<br>
><br>
> Ah my bad. Just realized I was using my own copy of SeaBIOS that I had<br>
> built. When I use the copy from qemu-3.0.0/pc-bios/bios-256k.bin I see<br>
> the i915 driver finding the OpRegion:<br>
> [    0.269341] in i915_driver_init_hw<br>
> [    0.269374] [drm] Memory usable by graphics device = 4096M<br>
> [    0.269585] in intel_opregion_setup<br>
> [    0.269600] graphic opregion physical addr: 0x7fffe000<br>
><br>
> Still working on getting the screen to light up<br>
><br>
> On Wed, May 29, 2019 at 9:44 AM Alex Williamson<br>
> <<a href="mailto:alex.williamson@redhat.com" target="_blank" rel="noreferrer">alex.williamson@redhat.com</a>> wrote:<br>
> ><br>
> > On Wed, 29 May 2019 09:25:59 -0700<br>
> > Micah Morton <<a href="mailto:mortonm@chromium.org" target="_blank" rel="noreferrer">mortonm@chromium.org</a>> wrote:<br>
> ><br>
> > > So as I mentioned, the ChromeOS firmware writes the location of the<br>
> > > OpRegion to the ASLS PCI config register<br>
> > > (<a href="https://github.com/coreboot/coreboot/blob/master/src/drivers/intel/gma/opregion.c#L88" rel="noreferrer noreferrer" target="_blank">https://github.com/coreboot/coreboot/blob/master/src/drivers/intel/gma/opregion.c#L88</a>).<br>
> > > The i915 driver then gets the address for the OpRegion from that<br>
> > > register here: <a href="https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/i915/intel_opregion.c#L910" rel="noreferrer noreferrer" target="_blank">https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/i915/intel_opregion.c#L910</a>.<br>
> > > This all works for Chrome OS, but when we run a VM with SeaBIOS the<br>
> > > ASLS PCI config register doesn't get written with the location of the<br>
> > > OpRegion.:<br>
> > > [    0.263640] in i915_driver_init_hw (I added this)<br>
> > > ...<br>
> > > [    0.263922] in intel_opregion_setup (and this)<br>
> > > [    0.263954] graphic opregion physical addr: 0x0 <-- This is<br>
> > > supposed to point to the OpRegion, not be zero.<br>
> > > [    0.263954] ACPI OpRegion not supported!<br>
> > > ...<br>
> > > [    0.267727] Failed to find VBIOS tables (VBT)<br>
> > ><br>
> > > I'm also not sure if the OpRegion is actually in VM memory or not. Do<br>
> > > you think I need to find a way to put the OpRegion in VM memory as we<br>
> > > have seen coreboot (Chrome OS firmware) do above? Or should using<br>
> > > "x-igd-opregion=on" somehow ensure that the OpRegion makes it into VM<br>
> > > memory? Clearly I at least need to find a way to set that ASLS PCI<br>
> > > config register in the VM or modify the i915 driver that runs in the<br>
> > > guest so it can find the OpRegion.<br>
> ><br>
> > In QEMU, vfio_pci_igd_opregion_init() adds the opregion to a fw_cfg<br>
> > file "etc/igd-opregion" and makes the (virtual) ASLS register<br>
> > writable.  Then in SeaBIOS, any Intel vendor ID, PCI class VGA device<br>
> > will trigger the intel_igd_setup() function, which looks for the fw_cfg<br>
> > file, allocates space for it, and writes the GPA back to the ASLS<br>
> > register.  That's at least how it's supposed to work, which again<br>
> > reminds me for the umpteenth time that x-igd-opregion only works with<br>
> > SeaBIOS as OVMF has rejected this support in favor of an option ROM<br>
> > based solution, which Intel never provided.  I think you're using<br>
> > SeaBIOS though so, so as long as that's not an ancient version it<br>
> > should do the little dance here.  The ASLS is writable though, we don't<br>
> > do any write-once tricks, so something could blindly stomp on it.  You<br>
> > might enable logging in SeaBIOS, it will emit some spew for the<br>
> > OpRegion support.  You could also enable tracing to see the write of<br>
> > the ASLS into QEMU.  Thanks,<br>
> ><br>
> > Alex<br>
<br>
_______________________________________________<br>
vfio-users mailing list<br>
<a href="mailto:vfio-users@redhat.com" target="_blank" rel="noreferrer">vfio-users@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/vfio-users" rel="noreferrer noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/vfio-users</a><br>
</blockquote></div>