Virtual Machine - UEFI firmware cant load ISOs

This started out over at the GTA V ON LINUX article where i was talking with @WastelandSamurai about why my VM's UEFI is not booting any ISO file.

TL;DR of what is and isn't working is at the end of the post.

Before This Started

Before i got to this point on setting up my VM, i had to set up VFIO and everything else needed to pass through a GPU to QEMU, and that was a pain, but with the current QEMU config I have both USB and the target GPU being passed through to QEMU and all seems well on that end. So, lets talk about the full details of this particular machine before we continue.

Critical System Specs
CPU: Intel i7 5820k
Motherboard: MSI X99S-SLI-PLUS (Supports IOMMU by the looks of things)
GPU1: ASUS Radeon HD 5850 (Host Machine's GPU)
GPU2: EVGA GeForce GTX 780 (VM's Target GPU for passthrough)
RAM: 16GB Corsair Vengeance LPX DD4 2133MHz
OS: Arch Linux w/ GNOME3

Boot Parameters
in arch.conf

...
options root=/dev/sdb3 i915.preliminary_hw_support=1 intel_iommu=on pcie_acs_override=downstream intremap=no_x2apic_optout
...

Im not sure if i need the i915 flag or not,but im fairly certain this config needs the acs override.

Script for VM
Next is the current script that I use for this particular build.

configfile=/etc/vfio-pci1.cfg

vfiobind() {
dev="$1"
vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
device=$(cat /sys/bus/pci/devices/$dev/device)
if [ -e /sys/bus/pci/devices/$dev/driver ]; then
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
fi
echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id

}

modprobe vfio-pci

cat $configfile | while read line;do
echo $line | grep ^# >/dev/null 2>&1 && continue
vfiobind $line
done

cp /usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd /tmp/my_vars.fd
qemu-system-x86_64 \
-enable-kvm \
-m 12288 \
-cpu host,kvm=off \
-vga qxl \
-smp 4,sockets=1,cores=4,threads=1 \
-device ioh3420,bus=pci.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
-device vfio-pci,host=03:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
-device vfio-pci,host=03:00.1,bus=root.1,addr=00.1 \
-device vfio-pci,host=08:00.0,bus=pci.0 \
-drive if=pflash,format=raw,readonly,file=/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd \
-drive if=pflash,format=raw,file=/tmp/my_vars.fd
-drive file=/home/navihawk/windows1.img,id=disk,format=raw -device ide-hd,bus=ide.0,drive=disk \
-drive file=/home/navihawk/win81.iso,id=isocd -device ide-cd,bus=ide.1,drive=isocd \

exit 0

Again, the issue comes into play when loading just the ISO file, same goes with the RAW IMG file if it were added.
Also, the "vga qxl" parameter is temporary so that i can use MKB without switching ports for the moment. I'll be switching it back to "vga none" if and when i need to.

the UEFI im using is the EDKII UEFI since im trying to stay away from SeaBIOS on this one.

What Works

  • GPU Passthrough Is Working (At least i can get an image on an external monitor)
  • USB Passthrough Is Working (Can Boot into a bootable install of Linux and also use any prehipherals plugged into the assigned USB 3.0 bus.

What Is Broken

  • Cannot load Installation ISOs

  • Cannot detect VM image? (possible)

  • GLib-Warning: gmem.c:482: custom memory allocation vtable not supported

Any and all help is appreciated!

1 Like

Ill look further into this with you as I can tonight.

Working right now.

I'll be in the /r/linuxmasterrace IRC under the handle Archhawk

Double posting here, but as an update. I did format my drives last week and dual booted windows 10 and Ubuntu 15.10 for the moment.

Updates to this project:

Starting over from scratch and moved over to ubuntu 15.10 to try and recreate what I did in arch back in october.

  • Gpus are currently swapped. the HD 5850 is currently the target GPU, leaving the GTX 780 open to work on projects in Blender. Windows OS is completely trashed on my windows drive thanks to M$ shoddy PC Reset feature, Can't even complete the refresh process. Just gets locked up and peripherals become unresponsive midway through the second boot cycle.

But enough off topic: I'm currently deliberating wether or not i should try to run with VFIO again, or just stick ti PCI stub assignment. Probably going to try VFIO again. More info to be added later as i'm still trying to get through the setup process again, with some help from the VFIO blog.

Update

Ran into a snag setting up the vm in virt-manager. QEMU fails to find th the UEFI .fd file, I have a copy of EDK2 i can use, but from the GUI side, i dont see a way to tell it to use that file yet.

Update 2

Finally figured out what i was missing, needed to install the required UEFI file via an apt-get installer, Using VFIO drivers from windows 8.1 to install windows 10 onto the virtual machine as per the guide From the VFIO Blogspot posts