Install libvirt, virt-manager, latest stock kernel, ovmf-bin. ovmf-bin may need to come from the AUR. Check if your graphics card is UEFI compilant. If not, search for a rom/gpu bios file that does support UEFI and store it somewhere.
** You may need to run your host on UEFI as well if using the i915 as primary graphics. **
If you get permission issues, try running the qemu instances as root. Edit /etc/libvirt/qemu.conf for this.
You can find the ovmf file here: '/usr/share/ovmf/ovmf_x64.bin' if you need it later.
- In '/etc/mkinitcpio.conf':
MODULES="pci-stub vfio-pci"
If libvirt later comes up with a 'IOMMU groups not found' kind like error, add 'vfio_iommu_type_1' to this list. Run a 'mkinitcpio -p linux' after editing mkinitcpio.conf.
- In '/etc/default/grub' set your GPU's pci ids in the CMDLINE like this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on pci-stub.ids=1002:6819,1002:aab0"
Update your grub config afterwards. (grub-mkconfig -o /boot/grub/grub.cfg)
Open up virt-manager. Create a new VM and create it for your Windows installation. Do not customize the settings, just create the VM and force poweroff it when it opens. Do not install Windows. Do NOT choose the q35 chipset. USE i440fx!
Open the VM configuration in virt-manager, and remove all Spice stuff (mouse, keyboard, display, tablet). Set your disks to VirtIO. Not VirtIO SCSI. You may need to remove and re-add your disk manually if virt-manager does not show you this option.
Mount your Windows installation ISO as IDE CDROM. Ensure the Windows ISO is EFI compliant. Download the virtio driver ISO from here: http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/. Add the ISO to your VM as a second IDE CDROM.
Set your CPU topology manually. By default libvirt exposes as seperate sockets, but Windows won't let you use more than two which causes performance issues.
Add your keyboard and mouse as usb devices to your VM using the virt-manager interface and usb device passtrough. Alternatively passtrough the PCI controller they're on. Also pci passtrough your graphics card, using the virt-manager interface. It's advised to not passtrough the 'HDMI audio' device your GPU comes with. (you'll need to create a second passtrough device for this if you wanted to, but just don't).
Close virt-manager. Fire up a shell. Launch 'EDITOR=vim virsh -c qemu:///system edit <name_of_vm>'. If authentication fails, search on the Arch wiki for libvirt polkit rules.
Under the <os> tag, add a <loader> element with the path to the bios. Like this:
<os>
<type arch='x86_64' machine='pc-i440fx-2.1'>hvm</type>
<loader type='pflash'>/usr/share/ovmf/ovmf_x64.bin</loader>
</os>
If you need to inject a UEFI bios for your vm, search for you hostdev pci device and make it look like this:
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</source>
<rom file='/home/maikel/bios7850random.rom'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</hostdev>
The <rom> tag contains the path to the rom you downloaded. Save the file and exit vim. If you haven't rebooted after making the mkinitcpio changes, do it now.
Launch virt-manager. Start your VM and check if something happens. You may get dropped to the UEFI shell. It will mount a device (mostly called FS0:) if a efi partition is found. It works like a Windows shell, 'fs0:' changes to the cdrom device, and cd, dir and ls work like expected. Search for the EFI file (mostly in /efi/boot/), and type it's name to execute it.
The Windows installer will complain it didn't find any disks. Search for drivers on the second cdrom, they're in WIN8/amd64/. The disk driver is called something like 'RedHat VIRTIO SCSI disk device'. Choose that. Now your disk appears and you can install Windows like usual.
@PaulBGD
Hmm.. trying to remember. It seems I had another video adapter with qxl or something similar..
Anyway, here is my current config (windows 10 insider builds with crimson driver work):
qemu-wrapper is a little script to use vga driver. I'm using seabios, tried omvf but after some number of reboots I always getting black screen - it was a year ago, maybe now it can work.. don't want to reinstall windows)
qemu-wrapper:
About stucking.. It's gone: maybe because I upgraded to Sabertooth 990FX R2.0 (at least no more IRVS table fixing by kernel boot parameters), maybe because new windows and linux builds are getting better...
Note: If you want to upgrade to the new Windows build - make sure the following lines are present in your xml:
http://ubuntuforums.org/showthread.php?t=2289210
Keep them during the upgrade, when its finished you can revert back to your cpu
What I haven't solved (or maybe too lazy to look - using pf all the time anyway):
On stock arch kernel when I boot windows linux freezes but windows works as expected
If I do the same on linux-pf which I build from AUR, both systems work and I successfully share mouse and keyboard between them by Synergy.
Booting kernel with:
root=/dev/mapper/lvmVolume-lvmRoot rw irqpoll iommu=pt iommu=1 vfio-pci.ids=1002:6811,1002:aab0