Re: bhyve intel 530 integrated graphics error

From: Corvin Khne <corvink_at_FreeBSD.org>
Date: Wed, 17 Jan 2024 07:19:29 UTC
Hi,

unfortunately, GPU passthrough is supported by bhyve but not OVMF. So,
you have to use a patched OVMF. The required patch stack is available
at https://reviews.freebsd.org/D41714. An older version and most
probably still working prebuilt version is available at
https://reviews.freebsd.org/D26209.

On Wed, 2024-01-17 at 01:18 +0100, Michael Sløgedal wrote:
> Hi,
>  
> I’ve been trying to collect the necessary info online about how to do
> gpu passthru with integrated intel graphics to win10, but can’t make
> it work.
>  
>    1. First tried with just passthru, and after 3-4 reboots, the
> display adapter shows up in win10 guest, but it won’t load properly.

Despite some configuration requirements (e.g. always use slot 2) that's
all you need.

>    2. Tried adding the hd audio device as well, get bluescreen with
> “memory_management” stop code in guest

Shouldn't happen but seems like another issue.

>    3. Tried adding a gop rom from
> https://github.com/patmagauran/i915ovmfPkg - host crashed and got
> error below

A GOP is only required for pre OS graphics (e.g. grub menu).

I highly recommend using the GOP from your host system to avoid damages
or strange issues due to incompatibilities. Unfortunately, it's not
always possible to easily extract the GOP from your host system. Even
Intel recommends to ask your board manufacturer:
https://projectacrn.github.io/3.2/tutorials/gpu-passthru.html#enable-the-gvt-d-gop-driver

Some alternative ways to extract the GOP:

On Windows try GPU-Z:
https://nvidia.custhelp.com/app/answers/detail/a_id/4188/~/extracting-the-geforce-video-bios-rom-file
On Linux try sysfs:
https://pve.proxmox.com/wiki/PCI_Passthrough#The_.27romfile.27_option

>  
> I’m at a loss what to try next. Any ideas where I’m going wrong?
>  
> # tail /vm/win10ltsc/vm-bhyve.log        
> Jan 17 00:49:02:  [primary disk: disk0.img]
> Jan 17 00:49:02:  [primary disk dev: file]
> Jan 17 00:49:02: dynamically allocated port 5900 for vnc connections
> Jan 17 00:49:02: booting
> Jan 17 00:49:02:  [bhyve options: -c 6,sockets=1,cores=3,threads=2 -m
> 8G -Hwl bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd -s
> 2:0,passthru,0/2/0,rom=/vm/win10ltsc/i915ovmf.rom -U 8dff5c4a-b083-
> 11ee-b2cd-78d004259091 -S]
> Jan 17 00:49:02:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s
> 4:0,ahci,hd:/vm/win10ltsc/disk0.img -s 31:6,passthru,0/31/6 -s
> 6:0,fbuf,tcp=0.0.0.0:5900,w=1920,h=1080 -s 7:0,xhci,tablet]
> Jan 17 00:49:02:  [bhyve console: -l com1,/dev/nmdm-win10ltsc.1A]

You have to use the `-A` flag. There's an open PR for vm-bhyve:
https://github.com/churchers/vm-bhyve/pull/525/commits/653d01f5b53c0bd8ce707137f67617536de8b1c0

> Jan 17 00:49:02: starting bhyve (run 1)
> Jan 17 00:49:04: bhyve exited with status 134
> Jan 17 00:49:04: stopped
>  
> # tail /vm/win10ltsc/bhyve.log   
> pci_fbuf: mmap_memseg failed
> Assertion failed: (mr->name == memp->name), function unregister_mem,
> file /usr/src/usr.sbin/bhyve/mem.c, line 344.
>  
> # uname -a
> FreeBSD yellowfellow 14.0-RELEASE-p3 FreeBSD 14.0-RELEASE-p3 #0: Mon
> Dec 11 04:56:01 UTC 2023    
> root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/G
> ENERIC amd64

-- 
Kind regards,
Corvin