Windows VM running on Qemu/KVM with cpu pinning, GVTg passthrought and hypervisor hydden from the guest.
Assuming the host has never been set up for running a VM in qemu/kvm.
-
sudo apt-get install qemu qemu-system-x86 qemu-kvm qemu-utils virt-manager libvirt-daemon-driver-qemu
-
Kernel modules
Add:
- kvmgt
- vfio-iommu-type1
- vfio-mdev
to:
- /etc/modules
Rebuild initramfs:
- sudo update-initramfs -u
-
Boot parameters
Modify GRUB_CMDLINE_LINUX line in:
- /etc/default/grub
To match the one in "grub"
update the bootloader:
- sudo update-grub
-
Libvirtd permissions
add kvm and libvirtd-qemu to the root group:
- usermod -a -G root kvm
- usermod -a -G root libvirtd-qemu
-
Gvtg hook
copy the content of "qemu" in:
- /etc/libvirtd/hooks/qemu
make the hook executable:
- sudo chmod +X /etc/libvirtd/hooks/qemu
-
Create a virtual disk
(40GB example):
- qemu-img create -f qcow2 name.qcow2 40G
-
Define VM
- Create a .xml file and copy the content from "win10-virt.xml", or directly download the file instead
- Open the xml file replace PATHTOHDD with the path to your virtual disk
- Define VM:
- sudo virsh define win10-virt.xml
- Now the VM should be visible in Virt-manager
- For further performance optimization:
- First Boot, Windows install:
- Add a Windwos10 ISO as Cdrom and set it as the boot device (via virt-manager)
- Download virtio drives for Windows https://github.com/virtio-win/virtio-win-pkg-scripts
- Add Virtio-driver ISO as Cdrom
- Boot
- Follow this guide: https://linuxhint.com/install_virtio_drivers_kvm_qemu_windows_vm/