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.
first of all: excellent gist, thanks
second, a bit of assistance might be great
tried it with:
amd fx 8320
m5a97 pro
8 gb ram
asus r9 270 (for arch host)
sapphire hd 6850 (for windows 10 guest (tested it on another pc with the exact same windows as a host - everything's fine))
750 w psu
everything works and boots, except when i try to install catalyst: it gives BSOD: VIDEO_TDR_FAILURE (atikmpag.sys). Pci-stub claims appropriate devices (saw it from dmesg)