Jump to content

Skylake HD530 IGD passthrough QEMU almost working (memory fix?)


2 posts in this topic

Recommended Posts

Part 1. Motivation. (skip to part 2 if you're already motivated enough)

 

The idea of this build is to run OS with discrete GPU for gaming (or other GPU intense stuff) and have OS X with integrated intel GPU (IGD) running at the same time.

 

Part 2. The real thing.

 

Hello, I had fun time putting technologies into magical cauldron and managed to passthrough Intel Skylake HD 530 graphics to Sierra in QEMU. And it works ?! But I hate a few things about it... memory management part for example. Let's get right to the business, here's a 1 minute video of booting Sierra with qemu.git, seabios.git, pc-i440fx, ubuntu 17.10, 4.13.0-19-generic, x-igd-opregion=on: 

 

https://www.youtube.com/watch?v=9oRAd9otUFg 

 

Good news! Video was filmed with only 8GB RAM assigned to VM. Increasing RAM gave more usable VRAM, now there can be few apps and Flurry screensaver running, until I switch menus 10 times or so (then it vomits again). Unfortunately I can test only with 15GB, the rest 1GB is left for ubuntu hypervisor).

 

So what should I do? I guess there are two choices:

 

1. Get a 2nd module of DDR4 of any size, sacrifice it to linux hypervisor, and try to assign full 16GB to VM (at least there are no issues while running bare metal with that amount).

2. Patching AppleIntelSKLGraphics.

 

GPU works flawless with linux guest (drm says it gives 4gb to gpu, I've tried running sketches from shadertoy, it didn't die), so I believe it's some memory management issue in AppleIntelSKLGraphics kexts.

 

Part 3. Environment.

 

Ubuntu 17.10,

kernel 4.13.0-19-generic (was installed with ubuntu, didn't compile),

https://github.com/kholia/qemu.git,

https://github.com/coreboot/seabios.git.

Boot GPU is IGD,

BIOS DVMT 1024MB,

grub kernel boot args "vfio_iommu_type1.allow_unsafe_interrupts=1 intel_iommu=on video=vesafb:off,efifb:off modprobe.blacklist=i915,snd_hda_intel"

Qemu command line:

qemu-system-x86_64 -enable-kvm -m 14000 -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on \
          -bios /root/seabios/out/bios.bin \
	  -machine pc \
	  -smp 4,cores=2 \
	  -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" \
	  -smbios type=2 \
          -device vfio-pci,host=00:02.0,bus=pci.0,addr=0x2,x-igd-opregion=on \
	  -drive id=disk0,file=/dev/disk/by-id/ata-PLEXTOR_PX-128,if=none \
	  -drive id=disk1,file=/dev/disk/by-id/ata-Hitachi_HDT,if=none \
	  -drive id=disk2,file=/dev/disk/by-id/ata-ST31000333AS,if=none \
	  -device ahci,id=ahci \
	  -device ide-drive,drive=disk0,bus=ahci.0 \
	  -device ide-drive,drive=disk1,bus=ahci.1 \
	  -device ide-drive,drive=disk2,bus=ahci.2 \
          -drive format=raw,file=/dev/disk/by-id/usb-JetFlash_Transcend_8GB \
	  -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:c9:18:27 \
          -nographic \
	  -usb -usbdevice host:2a7a:0c18 \
          -usb -usbdevice host:0a12:0001 \
	  -vnc 0.0.0.0:1,password=off \
	  -vga none \
          -chardev file,id=seabios,path=/tmp/bios.log \
          -device isa-debugcon,iobase=0x402,chardev=seabios \

Part 4. Notes.

 

Clover should be installed to MBR, so Seabios can boot from it. 

"+invtsc,vmware-cpuid-freq=on" fixes CPU speed

"-device ahci,id=ahci" is a must, I couldn't boot with default IDE controller from pc-i440fx

IGD passthrough worked for me only with pc-i440fx + seabios from git. Didn't work with q35 + ovmf.

"x-igd-opregion=on" is required for IRL display output.

 

Please help! ?

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...
 Share

×
×
  • Create New...